Files
m241Neelima/components/ip_net2-6.9/ipxinc/include/netinet/ip.h
T
2026-07-30 11:19:44 +05:30

161 lines
5.1 KiB
C

/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ip.h,v $ $Revision: 1.2 $
* $Source: /home/interpeak/CVSRoot/ipxinc/include/netinet/ip.h,v $
* $Author: lob $ $Date: 2004-08-24 11:42:34 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Lennart Bang <lob@interpeak.se>
******************************************************************************
*/
#ifndef IP_NETINET_IP_H
#define IP_NETINET_IP_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
#include "ipcom_config.h"
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include "sys/types.h"
#include "netinet/in.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
*===========================================================================
* IP options
*===========================================================================
*/
#define IPOPT_COPY 0x80
#define IPOPT_CLASS_MASK 0x60
#define IPOPT_NUMBER_MASK 0x1f
#define IPOPT_COPIED(o) ((o) & IPOPT_COPY)
#define IPOPT_CLASS(o) ((o) & IPOPT_CLASS_MASK)
#define IPOPT_NUMBER(o) ((o) & IPOPT_NUMBER_MASK)
#define IPOPT_CONTROL 0x00
#define IPOPT_RESERVED1 0x20
#define IPOPT_DEBMEAS 0x40
#define IPOPT_MEASUREMENT IPOPT_DEBMEAS
#define IPOPT_RESERVED2 0x60
#define IPOPT_EOL 0 /* end of option list */
#define IPOPT_END IPOPT_EOL
#define IPOPT_NOP 1 /* no operation */
#define IPOPT_NOOP IPOPT_NOP
#define IPOPT_RR 7 /* record packet route */
#define IPOPT_TS 68 /* timestamp */
#define IPOPT_TIMESTAMP IPOPT_TS
#define IPOPT_SECURITY 130 /* provide s,c,h,tcc */
#define IPOPT_SEC IPOPT_SECURITY
#define IPOPT_LSRR 131 /* loose source route */
#define IPOPT_SATID 136 /* satnet id */
#define IPOPT_SID IPOPT_SATID
#define IPOPT_SSRR 137 /* strict source route */
#define IPOPT_RA 148 /* router alert */
/*
*===========================================================================
* misc
*===========================================================================
*/
#define MAXTTL 255
#define IPDEFTTL 64
#define IPFRAGTTL 60
#define IPTTLDEC 1
#define IP_MSS 576
#define IPVERSION 4
#define IP_MAXPACKET 65535
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
/*
* Structure of an internet header, naked of options.
*/
struct ip
{
#ifdef IP_LITTLE_ENDIAN
unsigned int ip_hl:4; /* header length */
unsigned int ip_v:4; /* version */
#elif defined(IP_BIG_ENDIAN)
unsigned int ip_v:4; /* version */
unsigned int ip_hl:4; /* header length */
#else
#error ENDIAN_NOT_DEFINED
#endif
u_int8_t ip_tos; /* type of service */
unsigned short ip_len; /* total length */
unsigned short ip_id; /* identification */
unsigned short ip_off; /* fragment offset field */
u_int8_t ip_ttl; /* time to live */
u_int8_t ip_p; /* protocol */
unsigned short ip_sum; /* checksum */
struct in_addr ip_src, ip_dst; /* source and dest address */
};
#define IP_RF 0x8000 /* reserved fragment flag */
#define IP_DF 0x4000 /* dont fragment flag */
#define IP_MF 0x2000 /* more fragments flag */
#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/