epoc32/include/libc/netinet/ip.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@2
     1
/* IP.H
williamr@2
     2
 * 
williamr@4
     3
 * Portions Copyright (c) 1997-1999 Nokia Corporation and/or its subsidiary(-ies).
williamr@4
     4
 * All rights reserved.
williamr@2
     5
 */
williamr@2
     6
williamr@2
     7
/** @file
williamr@2
     8
@publishedAll
williamr@2
     9
@released
williamr@2
    10
*/
williamr@2
    11
williamr@2
    12
/*
williamr@2
    13
 * Copyright (c) 1982, 1986 Regents of the University of California.
williamr@2
    14
 * All rights reserved.
williamr@2
    15
 *
williamr@2
    16
 * Redistribution and use in source and binary forms are permitted
williamr@2
    17
 * provided that this notice is preserved and that due credit is given
williamr@2
    18
 * to the University of California at Berkeley. The name of the University
williamr@2
    19
 * may not be used to endorse or promote products derived from this
williamr@2
    20
 * software without specific prior written permission. This software
williamr@2
    21
 * is provided ``as is'' without express or implied warranty.
williamr@2
    22
 */
williamr@2
    23
williamr@2
    24
/*
williamr@2
    25
 * Definitions for internet protocol version 4.
williamr@2
    26
 * Per RFC 791, September 1981.
williamr@2
    27
 */
williamr@2
    28
williamr@2
    29
#ifndef	_NETINET_IP_H
williamr@2
    30
#define	_NETINET_IP_H
williamr@2
    31
williamr@2
    32
#ifdef	__cplusplus
williamr@2
    33
extern "C" {
williamr@2
    34
#endif
williamr@2
    35
williamr@2
    36
#define	IPVERSION	4
williamr@2
    37
williamr@2
    38
/**
williamr@2
    39
Structure of an internet header, naked of options.
williamr@2
    40
williamr@2
    41
We declare ip_len and ip_off to be short, rather than u_short
williamr@2
    42
pragmatically since otherwise unsigned comparisons can result
williamr@2
    43
against negative integers quite easily, and fail in subtle ways.
williamr@2
    44
*/
williamr@2
    45
struct ip {
williamr@2
    46
#ifdef _BIT_FIELDS_LTOH
williamr@2
    47
	u_char	ip_hl:4,		/* header length */
williamr@2
    48
		ip_v:4;			/* version */
williamr@2
    49
#else
williamr@2
    50
	u_char	ip_v:4,			/* version */
williamr@2
    51
		ip_hl:4;		/* header length */
williamr@2
    52
#endif
williamr@2
    53
	u_char	ip_tos;			/* type of service */
williamr@2
    54
	short	ip_len;			/* total length */
williamr@2
    55
	u_short	ip_id;			/* identification */
williamr@2
    56
	short	ip_off;			/* fragment offset field */
williamr@2
    57
#define	IP_DF 0x4000			/* dont fragment flag */
williamr@2
    58
#define	IP_MF 0x2000			/* more fragments flag */
williamr@2
    59
	u_char	ip_ttl;			/* time to live */
williamr@2
    60
	u_char	ip_p;			/* protocol */
williamr@2
    61
	u_short	ip_sum;			/* checksum */
williamr@2
    62
	struct	in_addr ip_src, ip_dst;	/* source and dest address */
williamr@2
    63
};
williamr@2
    64
williamr@2
    65
#define	IP_MAXPACKET	65535		/* maximum packet size */
williamr@2
    66
williamr@2
    67
/**
williamr@2
    68
Definitions for IP type of service (ip_tos)
williamr@2
    69
*/
williamr@2
    70
#define	IPTOS_LOWDELAY		0x10
williamr@2
    71
#define	IPTOS_THROUGHPUT	0x08
williamr@2
    72
#define	IPTOS_RELIABILITY	0x04
williamr@2
    73
williamr@2
    74
/**
williamr@2
    75
Definitions for IP precedence (also in ip_tos) (hopefully unused)
williamr@2
    76
*/
williamr@2
    77
#define	IPTOS_PREC_NETCONTROL		0xe0
williamr@2
    78
#define	IPTOS_PREC_INTERNETCONTROL	0xc0
williamr@2
    79
#define	IPTOS_PREC_CRITIC_ECP		0xa0
williamr@2
    80
#define	IPTOS_PREC_FLASHOVERRIDE	0x80
williamr@2
    81
#define	IPTOS_PREC_FLASH		0x60
williamr@2
    82
#define	IPTOS_PREC_IMMEDIATE		0x40
williamr@2
    83
#define	IPTOS_PREC_PRIORITY		0x20
williamr@2
    84
#define	IPTOS_PREC_ROUTINE		0x00
williamr@2
    85
williamr@2
    86
/**
williamr@2
    87
Definitions for options.
williamr@2
    88
*/
williamr@2
    89
#define	IPOPT_COPIED(o)		((o)&0x80)
williamr@2
    90
#define	IPOPT_CLASS(o)		((o)&0x60)
williamr@2
    91
#define	IPOPT_NUMBER(o)		((o)&0x1f)
williamr@2
    92
williamr@2
    93
#define	IPOPT_CONTROL		0x00
williamr@2
    94
#define	IPOPT_RESERVED1		0x20
williamr@2
    95
#define	IPOPT_DEBMEAS		0x40
williamr@2
    96
#define	IPOPT_RESERVED2		0x60
williamr@2
    97
williamr@2
    98
#define	IPOPT_EOL		0		/* end of option list */
williamr@2
    99
#define	IPOPT_NOP		1		/* no operation */
williamr@2
   100
williamr@2
   101
#define	IPOPT_RR		7		/* record packet route */
williamr@2
   102
#define	IPOPT_TS		68		/* timestamp */
williamr@2
   103
#define	IPOPT_SECURITY		130		/* provide s,c,h,tcc */
williamr@2
   104
#define	IPOPT_LSRR		131		/* loose source route */
williamr@2
   105
#define	IPOPT_SATID		136		/* satnet id */
williamr@2
   106
#define	IPOPT_SSRR		137		/* strict source route */
williamr@2
   107
williamr@2
   108
/**
williamr@2
   109
Offsets to fields in options other than EOL and NOP.
williamr@2
   110
*/
williamr@2
   111
#define	IPOPT_OPTVAL		0		/* option ID */
williamr@2
   112
#define	IPOPT_OLEN		1		/* option length */
williamr@2
   113
#define	IPOPT_OFFSET		2		/* offset within option */
williamr@2
   114
#define	IPOPT_MINOFF		4		/* min value of above */
williamr@2
   115
williamr@2
   116
/**
williamr@2
   117
Time stamp option structure.
williamr@2
   118
*/
williamr@2
   119
struct	ip_timestamp {
williamr@2
   120
	u_char	ipt_code;		/* IPOPT_TS */
williamr@2
   121
	u_char	ipt_len;		/* size of structure (variable) */
williamr@2
   122
	u_char	ipt_ptr;		/* index of current entry */
williamr@2
   123
#ifdef _BIT_FIELDS_LTOH
williamr@2
   124
	u_char	ipt_flg:4,		/* flags, see below */
williamr@2
   125
		ipt_oflw:4;		/* overflow counter */
williamr@2
   126
#else
williamr@2
   127
	u_char	ipt_oflw:4,		/* overflow counter */
williamr@2
   128
		ipt_flg:4;		/* flags, see below */
williamr@2
   129
#endif
williamr@2
   130
	union ipt_timestamp {
williamr@2
   131
		n_long	ipt_time[1];
williamr@2
   132
		struct	ipt_ta {
williamr@2
   133
			struct in_addr ipt_addr;
williamr@2
   134
			n_long ipt_time;
williamr@2
   135
		} ipt_ta[1];
williamr@2
   136
	} ipt_timestamp;
williamr@2
   137
};
williamr@2
   138
williamr@2
   139
/**
williamr@2
   140
flag bits for ipt_flg 
williamr@2
   141
*/
williamr@2
   142
#define	IPOPT_TS_TSONLY		0		/* timestamps only */
williamr@2
   143
#define	IPOPT_TS_TSANDADDR	1		/* timestamps and addresses */
williamr@2
   144
#define	IPOPT_TS_PRESPEC	2		/* specified modules only */
williamr@2
   145
williamr@2
   146
/** 
williamr@2
   147
bits for security (not byte swapped) 
williamr@2
   148
*/
williamr@2
   149
#define	IPOPT_SECUR_UNCLASS	0x0000
williamr@2
   150
#define	IPOPT_SECUR_CONFID	0xf135
williamr@2
   151
#define	IPOPT_SECUR_EFTO	0x789a
williamr@2
   152
#define	IPOPT_SECUR_MMMM	0xbc4d
williamr@2
   153
#define	IPOPT_SECUR_RESTR	0xaf13
williamr@2
   154
#define	IPOPT_SECUR_SECRET	0xd788
williamr@2
   155
#define	IPOPT_SECUR_TOPSECRET	0x6bc5
williamr@2
   156
williamr@2
   157
/**
williamr@2
   158
Internet implementation parameters.
williamr@2
   159
*/
williamr@2
   160
#define	MAXTTL		255		/* maximum time to live (seconds) */
williamr@2
   161
#define	IPFRAGTTL	60		/* time to live for frags, slowhz */
williamr@2
   162
#define	IPTTLDEC	1		/* subtracted when forwarding */
williamr@2
   163
williamr@2
   164
#define	IP_MSS		576		/* default maximum segment size */
williamr@2
   165
williamr@2
   166
#ifdef	__cplusplus
williamr@2
   167
}
williamr@2
   168
#endif
williamr@2
   169
williamr@2
   170
#endif	/* _NETINET_IP_H */