Ignore:
Timestamp:
May 19, 2003, 4:41:00 AM (22 years ago)
Author:
bird
Message:

#434: Initial tcpip header merges.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/include/netinet/in.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    11/* Modified for emx by hv and em 1994,1996
     2 * Modified for gcc/os2 by bird 2003
    23 *
    34 * Copyright (c) 1982, 1986, 1990 Regents of the University of California.
     
    6667#define IPPROTO_UDP             17              /* user datagram protocol */
    6768#define IPPROTO_IDP             22              /* xns idp */
     69#ifndef TCPV40HDRS
    6870#define IPPROTO_TP              29              /* tp-4 w/ class negotiation */
    6971#define IPPROTO_EON             80              /* ISO cnlp */
     72#define IPPROTO_ENCAP           98              /* encapsulation header */
     73#endif
    7074
    7175#define IPPROTO_RAW             255             /* raw IP packet */
     
    8084 * for servers, not necessarily privileged.
    8185 */
     86#ifdef TCPV40HDRS
    8287#define IPPORT_RESERVED         1024
    8388#define IPPORT_USERRESERVED     5000
     89#else
     90 /* Changing the ephemeral port #s as per Internet Assigned Numbers Authority's
     91  * update as found in JUL '97. [Ref: http://www.isi.edu/div7/iana/descript/html] */
     92#define IPPORT_RESERVED        49152  /* Old 1024. Changed as per IANA draft */
     93#define IPPORT_USERRESERVED    65535  /* Old 5000. Changed as per IANA draft */
     94#endif
     95
     96#ifdef TCPV40HDRS
     97/*
     98 * Link numbers
     99 */
     100#define IMPLINK_IP              155
     101#define IMPLINK_LOWEXPER        156
     102#define IMPLINK_HIGHEXPER       158
     103#endif
    84104
    85105/*
     
    113133
    114134#define IN_CLASSD(i)            (((long)(i) & 0xf0000000) == 0xe0000000)
     135#ifdef TCPV40HDRS
     136#define IN_CLASSD_NET           0xffffffff
     137#define IN_CLASSD_HOST          0
     138#else
    115139#define IN_CLASSD_NET           0xf0000000      /* These ones aren't really */
     140#define IN_CLASSD_HOST          0x0fffffff      /* routing needn't know. */
     141#endif
    116142#define IN_CLASSD_NSHIFT        28              /* net and host fields, but */
    117 #define IN_CLASSD_HOST          0x0fffffff      /* routing needn't know. */
    118143#define IN_MULTICAST(i)         IN_CLASSD(i)
    119144
     145#ifdef TCPV40HDRS
    120146#define IN_EXPERIMENTAL(i)      (((long)(i) & 0xe0000000) == 0xe0000000)
     147#else
     148#define IN_EXPERIMENTAL(i)      (((long)(i) & 0xf0000000) == 0xe0000000)
     149#endif
    121150#define IN_BADCLASS(i)          (((long)(i) & 0xf0000000) == 0xf0000000)
    122151
    123152#define INADDR_ANY              (u_long)0x00000000
     153#ifndef TCPV40HDRS
    124154#define INADDR_LOOPBACK         (u_long)0x7f000001
     155#endif
    125156#define INADDR_BROADCAST        (u_long)0xffffffff      /* must be masked */
    126 #ifndef KERNEL
    127 #define INADDR_NONE             0xffffffff              /* -1 return */
    128 #endif
    129157
    130158#define INADDR_UNSPEC_GROUP     (u_long)0xe0000000      /* 224.0.0.0 */
     
    132160#define INADDR_MAX_LOCAL_GROUP  (u_long)0xe00000ff      /* 224.0.0.255 */
    133161
     162#ifndef KERNEL
     163#define INADDR_NONE             0xffffffff              /* -1 return */
     164#endif
     165
    134166#define IN_LOOPBACKNET          127                     /* official! */
    135167
    136 /*
    137  * Define a macro to stuff the loopback address into an Internet address
    138  */
    139 #define IN_SET_LOOPBACK_ADDR(a) { \
    140         (a)->sin_addr.s_addr = htonl(INADDR_LOOPBACK); \
    141         (a)->sin_family = AF_INET; }
     168
    142169/*
    143170 * Socket address, internet style. 4.3BSD
    144171 */
     172#ifdef TCPV40HDRS
    145173struct sockaddr_in {
    146174        short   sin_family;
     
    149177        char    sin_zero[8];
    150178};
     179#else
     180#pragma pack(1)
     181struct sockaddr_in {
     182        u_char  sin_len;
     183        u_char  sin_family;
     184        u_short sin_port;
     185        struct  in_addr sin_addr;
     186        char    sin_zero[8];
     187};
     188#pragma pack()
     189#endif
    151190
    152191/*
     
    157196 * (this gets put into the header proper).
    158197 */
     198#ifndef TCPV40HDRS
     199#pragma pack(1)
     200#endif
    159201struct ip_opts {
    160202        struct  in_addr ip_dst;         /* first hop, 0 w/o src rt */
    161203        char    ip_opts[40];            /* actually variable in size */
    162204};
     205#ifndef TCPV40HDRS
     206#pragma pack()
     207#endif
    163208
    164209/*
     
    167212 */
    168213#define IP_OPTIONS              1       /* buf/ip_opts; set/get IP options */
    169 
    170214#define IP_MULTICAST_IF         2       /* u_char; set/get IP mcast i/f */
    171215#define IP_MULTICAST_TTL        3       /* u_char; set/get IP mcast ttl */
     
    173217#define IP_ADD_MEMBERSHIP       5       /* ip_mreq; add IP group membership */
    174218#define IP_DROP_MEMBERSHIP      6       /* ip_mreq; drop IP group membership */
    175 
    176 #ifndef __EMX__ /* not supported so far */
    177 #define IP_HDRINCL              2       /* int; header is included with data */
    178 #define IP_TOS                  3       /* int; IP type of service and preced */
    179 #define IP_TTL                  4       /* int; IP time to live */
    180 #define IP_RECVOPTS             5       /* bool; receive all IP opts w/dgram */
    181 #define IP_RECVRETOPTS          6       /* bool; receive IP opts for response */
    182 #define IP_RECVDSTADDR          7       /* bool; receive IP dst addr w/dgram */
    183 #define IP_RETOPTS              8       /* ip_opts; set/get IP options */
    184 #endif
    185 
     219#ifndef TCPV40HDRS
     220#define IP_HDRINCL              7    /* int; header is included with data */
     221#define IP_TOS                  8    /* int; IP type of service and preced. */
     222#define IP_TTL                  9    /* int; IP time to live */
     223#define IP_RECVOPTS             10   /* bool; receive all IP opts w/dgram */
     224#define IP_RECVRETOPTS          11   /* bool; receive IP opts for response */
     225#define IP_RECVDSTADDR          12   /* bool; receive IP dst addr w/dgram */
     226#define IP_RETOPTS              13   /* ip_opts; set/get IP options */
     227#define IP_RECVTRRI             14   /* bool; receive token ring routing inf */
     228#endif
     229
     230/*
     231 * Defaults and limits for options
     232 */
    186233#define IP_DEFAULT_MULTICAST_TTL   1    /* normally limit m'casts to 1 hop  */
    187234#define IP_DEFAULT_MULTICAST_LOOP  1    /* normally hear sends if a member  */
    188235#define IP_MAX_MEMBERSHIPS         20   /* per socket; must fit in one mbuf */
     236#ifndef TCPV40HDRS
     237#define MAX_IN_MULTI      16*IP_MAX_MEMBERSHIPS      /* 320 max per os2 */
     238extern u_short CntInMulti;
     239#endif
    189240
    190241/*
    191242 * Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP.
    192243 */
     244#ifndef TCPV40HDRS
     245#pragma pack(1)
     246#endif
    193247struct ip_mreq {
    194248        struct  in_addr imr_multiaddr;  /* IP multicast address of group */
    195249        struct  in_addr imr_interface;  /* local IP address of interface */
    196250};
    197 
    198 /* prototypes for functions in inet(3) */
    199 extern  u_long          inet_addr(__const__ char*);
    200 extern  struct in_addr  inet_makeaddr(u_long, u_long);
    201 extern  u_long          inet_network(__const__ char*);
    202 extern  char            *inet_ntoa(struct in_addr);
    203 extern  u_long          inet_netof(struct in_addr);
    204 extern  u_long          inet_lnaof(struct in_addr);
     251#ifndef TCPV40HDRS
     252#pragma pack()
     253#endif
     254
     255#ifdef TCPV40HDRS
     256/* for functions */
     257#include <arpa/inet.h>
     258
     259#else
     260
     261/*
     262 * Definitions for inet sysctl operations.
     263 *
     264 * Third level is protocol number.
     265 * Fourth level is desired variable within that protocol.
     266 */
     267#define IPPROTO_MAXID   (IPPROTO_IDP + 1)       /* don't list to IPPROTO_MAX */
     268
     269#define CTL_IPPROTO_NAMES { \
     270        { "ip", CTLTYPE_NODE }, \
     271        { "icmp", CTLTYPE_NODE }, \
     272        { "igmp", CTLTYPE_NODE }, \
     273        { "ggp", CTLTYPE_NODE }, \
     274        { 0, 0 }, \
     275        { 0, 0 }, \
     276        { "tcp", CTLTYPE_NODE }, \
     277        { 0, 0 }, \
     278        { "egp", CTLTYPE_NODE }, \
     279        { 0, 0 }, \
     280        { 0, 0 }, \
     281        { 0, 0 }, \
     282        { "pup", CTLTYPE_NODE }, \
     283        { 0, 0 }, \
     284        { 0, 0 }, \
     285        { 0, 0 }, \
     286        { 0, 0 }, \
     287        { "udp", CTLTYPE_NODE }, \
     288        { 0, 0 }, \
     289        { 0, 0 }, \
     290        { 0, 0 }, \
     291        { 0, 0 }, \
     292        { "idp", CTLTYPE_NODE }, \
     293}
     294#endif /*TCPV40HDRS (else) */
    205295
    206296#if defined (__cplusplus)
Note: See TracChangeset for help on using the changeset viewer.