1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/genericopenlibs/cstdlib/LINCINET/IP.H Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,170 @@
1.4 +/* IP.H
1.5 + *
1.6 + * Portions Copyright (c) 1997-1999 Nokia Corporation and/or its subsidiary(-ies).
1.7 + * All rights reserved.
1.8 + */
1.9 +
1.10 +/** @file
1.11 +@publishedAll
1.12 +@released
1.13 +*/
1.14 +
1.15 +/*
1.16 + * Copyright (c) 1982, 1986 Regents of the University of California.
1.17 + * All rights reserved.
1.18 + *
1.19 + * Redistribution and use in source and binary forms are permitted
1.20 + * provided that this notice is preserved and that due credit is given
1.21 + * to the University of California at Berkeley. The name of the University
1.22 + * may not be used to endorse or promote products derived from this
1.23 + * software without specific prior written permission. This software
1.24 + * is provided ``as is'' without express or implied warranty.
1.25 + */
1.26 +
1.27 +/*
1.28 + * Definitions for internet protocol version 4.
1.29 + * Per RFC 791, September 1981.
1.30 + */
1.31 +
1.32 +#ifndef _NETINET_IP_H
1.33 +#define _NETINET_IP_H
1.34 +
1.35 +#ifdef __cplusplus
1.36 +extern "C" {
1.37 +#endif
1.38 +
1.39 +#define IPVERSION 4
1.40 +
1.41 +/**
1.42 +Structure of an internet header, naked of options.
1.43 +
1.44 +We declare ip_len and ip_off to be short, rather than u_short
1.45 +pragmatically since otherwise unsigned comparisons can result
1.46 +against negative integers quite easily, and fail in subtle ways.
1.47 +*/
1.48 +struct ip {
1.49 +#ifdef _BIT_FIELDS_LTOH
1.50 + u_char ip_hl:4, /* header length */
1.51 + ip_v:4; /* version */
1.52 +#else
1.53 + u_char ip_v:4, /* version */
1.54 + ip_hl:4; /* header length */
1.55 +#endif
1.56 + u_char ip_tos; /* type of service */
1.57 + short ip_len; /* total length */
1.58 + u_short ip_id; /* identification */
1.59 + short ip_off; /* fragment offset field */
1.60 +#define IP_DF 0x4000 /* dont fragment flag */
1.61 +#define IP_MF 0x2000 /* more fragments flag */
1.62 + u_char ip_ttl; /* time to live */
1.63 + u_char ip_p; /* protocol */
1.64 + u_short ip_sum; /* checksum */
1.65 + struct in_addr ip_src, ip_dst; /* source and dest address */
1.66 +};
1.67 +
1.68 +#define IP_MAXPACKET 65535 /* maximum packet size */
1.69 +
1.70 +/**
1.71 +Definitions for IP type of service (ip_tos)
1.72 +*/
1.73 +#define IPTOS_LOWDELAY 0x10
1.74 +#define IPTOS_THROUGHPUT 0x08
1.75 +#define IPTOS_RELIABILITY 0x04
1.76 +
1.77 +/**
1.78 +Definitions for IP precedence (also in ip_tos) (hopefully unused)
1.79 +*/
1.80 +#define IPTOS_PREC_NETCONTROL 0xe0
1.81 +#define IPTOS_PREC_INTERNETCONTROL 0xc0
1.82 +#define IPTOS_PREC_CRITIC_ECP 0xa0
1.83 +#define IPTOS_PREC_FLASHOVERRIDE 0x80
1.84 +#define IPTOS_PREC_FLASH 0x60
1.85 +#define IPTOS_PREC_IMMEDIATE 0x40
1.86 +#define IPTOS_PREC_PRIORITY 0x20
1.87 +#define IPTOS_PREC_ROUTINE 0x00
1.88 +
1.89 +/**
1.90 +Definitions for options.
1.91 +*/
1.92 +#define IPOPT_COPIED(o) ((o)&0x80)
1.93 +#define IPOPT_CLASS(o) ((o)&0x60)
1.94 +#define IPOPT_NUMBER(o) ((o)&0x1f)
1.95 +
1.96 +#define IPOPT_CONTROL 0x00
1.97 +#define IPOPT_RESERVED1 0x20
1.98 +#define IPOPT_DEBMEAS 0x40
1.99 +#define IPOPT_RESERVED2 0x60
1.100 +
1.101 +#define IPOPT_EOL 0 /* end of option list */
1.102 +#define IPOPT_NOP 1 /* no operation */
1.103 +
1.104 +#define IPOPT_RR 7 /* record packet route */
1.105 +#define IPOPT_TS 68 /* timestamp */
1.106 +#define IPOPT_SECURITY 130 /* provide s,c,h,tcc */
1.107 +#define IPOPT_LSRR 131 /* loose source route */
1.108 +#define IPOPT_SATID 136 /* satnet id */
1.109 +#define IPOPT_SSRR 137 /* strict source route */
1.110 +
1.111 +/**
1.112 +Offsets to fields in options other than EOL and NOP.
1.113 +*/
1.114 +#define IPOPT_OPTVAL 0 /* option ID */
1.115 +#define IPOPT_OLEN 1 /* option length */
1.116 +#define IPOPT_OFFSET 2 /* offset within option */
1.117 +#define IPOPT_MINOFF 4 /* min value of above */
1.118 +
1.119 +/**
1.120 +Time stamp option structure.
1.121 +*/
1.122 +struct ip_timestamp {
1.123 + u_char ipt_code; /* IPOPT_TS */
1.124 + u_char ipt_len; /* size of structure (variable) */
1.125 + u_char ipt_ptr; /* index of current entry */
1.126 +#ifdef _BIT_FIELDS_LTOH
1.127 + u_char ipt_flg:4, /* flags, see below */
1.128 + ipt_oflw:4; /* overflow counter */
1.129 +#else
1.130 + u_char ipt_oflw:4, /* overflow counter */
1.131 + ipt_flg:4; /* flags, see below */
1.132 +#endif
1.133 + union ipt_timestamp {
1.134 + n_long ipt_time[1];
1.135 + struct ipt_ta {
1.136 + struct in_addr ipt_addr;
1.137 + n_long ipt_time;
1.138 + } ipt_ta[1];
1.139 + } ipt_timestamp;
1.140 +};
1.141 +
1.142 +/**
1.143 +flag bits for ipt_flg
1.144 +*/
1.145 +#define IPOPT_TS_TSONLY 0 /* timestamps only */
1.146 +#define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */
1.147 +#define IPOPT_TS_PRESPEC 2 /* specified modules only */
1.148 +
1.149 +/**
1.150 +bits for security (not byte swapped)
1.151 +*/
1.152 +#define IPOPT_SECUR_UNCLASS 0x0000
1.153 +#define IPOPT_SECUR_CONFID 0xf135
1.154 +#define IPOPT_SECUR_EFTO 0x789a
1.155 +#define IPOPT_SECUR_MMMM 0xbc4d
1.156 +#define IPOPT_SECUR_RESTR 0xaf13
1.157 +#define IPOPT_SECUR_SECRET 0xd788
1.158 +#define IPOPT_SECUR_TOPSECRET 0x6bc5
1.159 +
1.160 +/**
1.161 +Internet implementation parameters.
1.162 +*/
1.163 +#define MAXTTL 255 /* maximum time to live (seconds) */
1.164 +#define IPFRAGTTL 60 /* time to live for frags, slowhz */
1.165 +#define IPTTLDEC 1 /* subtracted when forwarding */
1.166 +
1.167 +#define IP_MSS 576 /* default maximum segment size */
1.168 +
1.169 +#ifdef __cplusplus
1.170 +}
1.171 +#endif
1.172 +
1.173 +#endif /* _NETINET_IP_H */