Changeset 183


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

#434: Initial tcpip header merges.

Location:
trunk/src/emx/include
Files:
2 added
37 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/include/arpa/ftp.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    1 /*
     1/* Modified for gcc by bird 2003
     2 *
    23 * Copyright (c) 1983, 1989 Regents of the University of California.
    34 * All rights reserved.
     
    3637#ifndef _FTP_H_
    3738#define _FTP_H_
     39#define _ARPA_FTP_H_
    3840
    3941/* Definitions for FTP; see RFC-765. */
  • trunk/src/emx/include/arpa/inet.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    11/* Modified for emx by hv and em 1994
     2 * Modified for gcc/os2 by bird 2003
    23 *
    34 * Copyright (c) 1983 Regents of the University of California.
     
    4445
    4546/* External definitions for functions in inet(3) */
    46 extern u_long           inet_addr(__const__ char*);
    47 extern u_long           inet_lnaof(struct in_addr);
    48 extern struct in_addr   inet_makeaddr(u_long, u_long);
    49 extern u_long           inet_netof(struct in_addr);
    50 extern u_long           inet_network(__const__ char*);
    51 extern char*            inet_ntoa(struct in_addr);
     47
     48#ifndef TCPV40HDRS
     49#include <sys/param.h>
     50#include <sys/types.h>
     51#include <sys/cdefs.h>
     52int             _System inet_aton (const char *, struct in_addr *);
     53char *          _System inet_neta (u_long, char *, size_t);
     54char *          _System inet_net_ntop (int, const void *, int, char *, size_t);
     55int             _System inet_net_pton (int, const char *, void *, size_t);
     56int             _System inet_pton (int af, const char *src, void *dst);
     57const char *    _System inet_ntop (int af, const void *src, char *dst, size_t s);
     58u_int           _System inet_nsap_addr (const char *, u_char *, int maxlen);
     59char *          _System inet_nsap_ntoa (int, const u_char *, char *ascii);
     60#endif
     61
     62extern u_long   _System inet_addr(__const__ char*);
     63extern u_long   _System inet_lnaof(struct in_addr);
     64extern struct in_addr _System inet_makeaddr(u_long, u_long);
     65extern u_long   _System inet_netof(struct in_addr);
     66extern u_long   _System inet_network(__const__ char*);
     67extern char*    _System inet_ntoa(struct in_addr);
    5268
    5369#if defined (__cplusplus)
  • trunk/src/emx/include/arpa/nameser.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    11/* Modified for emx by hv 1994,1996
     2 * Modified for gcc/os2 by bird 2003
    23 *
    34 * Copyright (c) 1983, 1989 Regents of the University of California.
     
    4546#include <sys/param.h>          /* htons() etc. */
    4647#include <machine/endian.h>     /* BYTE ORDER etc. */
     48#ifndef TCPV40HDRS
     49#include <types.h>
     50#include <sys/cdefs.h>
     51#endif
    4752
    4853/*
     
    5055 */
    5156#define PACKETSZ        512             /* maximum packet size */
     57#ifdef TCPV40HDRS
    5258#define MAXDNAME        256             /* maximum domain name */
     59#else
     60#define MAXDNAME        1025            /* maximum presentation domain name */
     61#endif
    5362#define MAXCDNAME       255             /* maximum compressed domain name */
    5463#define MAXLABEL        63              /* maximum length of domain label */
     
    5766        /* number of bytes of fixed size data in resource record */
    5867#define RRFIXEDSZ       10
     68#ifndef TCPV40HDRS
     69#define HFIXEDSZ        12              /* #/bytes of fixed data in header */
     70#define RRFIXEDSZ       10              /* #/bytes of fixed data in r record */
     71#define INT32SZ         4               /* for systems without 32-bit ints */
     72#define INT16SZ         2               /* for systems without 16-bit ints */
     73#define INADDRSZ        4               /* IPv4 T_A */
     74#define IN6ADDRSZ       16              /* IPv6 T_AAAA */
     75#endif
    5976
    6077/*
     
    6885#define QUERY           0x0             /* standard query */
    6986#define IQUERY          0x1             /* inverse query */
     87#ifdef TCPV40HDRS
     88#define CQUERYM         2               /* completion query (multiple) */
     89#define CQUERYU         3               /* completion query (unique) */
     90#endif
    7091#define STATUS          0x2             /* nameserver status query */
    7192/*#define xxx           0x3                0x3 reserved */
    7293        /* non standard */
     94#ifdef TCPV40HDRS
    7395/* IBM has changed these codes in TCP/IP for OS/2 */
    7496#define UPDATEA         100             /* add resource record */
     
    7799#define ZONEINIT        103             /* initial zone transfer */
    78100#define ZONEREF         104             /* incremental zone referesh */
     101#else
     102#define NS_NOTIFY_OP    0x4             /* notify secondary of SOA change */
     103#endif
    79104
    80105/*
     
    88113#define REFUSED         5               /* query refused */
    89114        /* non standard */
     115#ifdef TCPV40HDRS
    90116#define NOCHANGE        100             /* update failed to change db */
     117#endif
    91118
    92119/*
     
    108135#define T_MINFO         14              /* mailbox information */
    109136#define T_MX            15              /* mail routing information */
     137#ifndef TCPV40HDRS
    110138#define T_TXT           16              /* text strings */
     139#define T_RP            17              /* responsible person */
     140#define T_AFSDB         18              /* AFS cell database */
     141#define T_X25           19              /* X_25 calling address */
     142#define T_ISDN          20              /* ISDN calling address */
     143#define T_RT            21              /* router */
     144#define T_NSAP          22              /* NSAP address */
     145#define T_NSAP_PTR      23              /* reverse NSAP lookup (deprecated) */
     146#define T_SIG           24              /* security signature */
     147#define T_KEY           25              /* security key */
     148#define T_PX            26              /* X.400 mail mapping */
     149#define T_GPOS          27              /* geographical position (withdrawn) */
     150#define T_AAAA          28              /* IP6 Address */
     151#define T_LOC           29              /* Location Information */
     152#define T_NXT           30              /* Next Valid Name in Zone */
     153#define T_EID           31              /* Endpoint identifier */
     154#define T_NIMLOC        32              /* Nimrod locator */
     155#define T_SRV           33              /* Server selection */
     156#define T_ATMA          34              /* ATM Address */
     157#define T_NAPTR         35              /* Naming Authority PoinTeR */
     158#endif
    111159        /* non standard */
    112160#define T_UINFO         100             /* user (finger) information */
    113161#define T_UID           101             /* user ID */
    114162#define T_GID           102             /* group ID */
     163#ifndef TCPV40HDRS
    115164#define T_UNSPEC        103             /* Unspecified format (binary data) */
     165#endif
    116166        /* Query type values which do not appear in resource records */
     167#ifndef TCPV40HDRS
     168#define T_IXFR          251             /* incremental zone transfer */
     169#endif
    117170#define T_AXFR          252             /* transfer zone of authority */
    118171#define T_MAILB         253             /* transfer mailbox records */
     
    125178#define C_IN            1               /* the arpa internet */
    126179#define C_CHAOS         3               /* for chaos net at MIT */
     180#ifndef TCPV40HDRS
    127181#define C_HS            4               /* for Hesiod name server at MIT */
     182#endif
    128183        /* Query class values which do not appear in resource records */
    129184#define C_ANY           255             /* wildcard match */
    130185
     186/*
     187 * Flags field of the KEY RR rdata
     188 */
     189#define KEYFLAG_TYPEMASK        0xC000  /* Mask for "type" bits */
     190#define KEYFLAG_TYPE_AUTH_CONF  0x0000  /* Key usable for both */
     191#define KEYFLAG_TYPE_CONF_ONLY  0x8000  /* Key usable for confidentiality */
     192#define KEYFLAG_TYPE_AUTH_ONLY  0x4000  /* Key usable for authentication */
     193#define KEYFLAG_TYPE_NO_KEY     0xC000  /* No key usable for either; no key */
     194/* The type bits can also be interpreted independently, as single bits: */
     195#define KEYFLAG_NO_AUTH         0x8000  /* Key not usable for authentication */
     196#define KEYFLAG_NO_CONF         0x4000  /* Key not usable for confidentiality */
     197
     198#define KEYFLAG_EXPERIMENTAL    0x2000  /* Security is *mandatory* if bit=0 */
     199#define KEYFLAG_RESERVED3       0x1000  /* reserved - must be zero */
     200#define KEYFLAG_RESERVED4       0x0800  /* reserved - must be zero */
     201#define KEYFLAG_USERACCOUNT     0x0400  /* key is assoc. with a user acct */
     202#define KEYFLAG_ENTITY          0x0200  /* key is assoc. with entity eg host */
     203#define KEYFLAG_ZONEKEY         0x0100  /* key is zone key for the zone named */
     204#define KEYFLAG_IPSEC           0x0080  /* key is for IPSEC use (host or user)*/
     205#define KEYFLAG_EMAIL           0x0040  /* key is for email (MIME security) */
     206#define KEYFLAG_RESERVED10      0x0020  /* reserved - must be zero */
     207#define KEYFLAG_RESERVED11      0x0010  /* reserved - must be zero */
     208#define KEYFLAG_SIGNATORYMASK   0x000F  /* key can sign DNS RR's of same name */
     209
     210#define  KEYFLAG_RESERVED_BITMASK ( KEYFLAG_RESERVED3 | \
     211                                    KEYFLAG_RESERVED4 | \
     212                                    KEYFLAG_RESERVED10| KEYFLAG_RESERVED11)
     213
     214/* The Algorithm field of the KEY and SIG RR's is an integer, {1..254} */
     215#define ALGORITHM_MD5RSA        1       /* MD5 with RSA */
     216#define ALGORITHM_EXPIRE_ONLY   253     /* No alg, no security */
     217#define ALGORITHM_PRIVATE_OID   254     /* Key begins with OID indicating alg */
     218
     219/* Signatures */
     220                                        /* Size of a mod or exp in bits */
     221#define MIN_MD5RSA_KEY_PART_BITS         512
     222#define MAX_MD5RSA_KEY_PART_BITS        2552
     223                                        /* Total of binary mod and exp, bytes */
     224#define MAX_MD5RSA_KEY_BYTES            ((MAX_MD5RSA_KEY_PART_BITS+7/8)*2+3)
     225                                        /* Max length of text sig block */
     226#define MAX_KEY_BASE64                  (((MAX_MD5RSA_KEY_BYTES+2)/3)*4)
     227
     228#ifndef TCPV40HDRS
    131229/*
    132230 * Status return codes for T_UNSPEC conversion routines
     
    137235#define CONV_BADCKSUM -3
    138236#define CONV_BADBUFLEN -4
     237#endif
    139238
    140239/*
    141240 * Structure for query header, the order of the fields is machine and
    142  * compiler dependent, in our case, the bits within a byte are assignd 
    143  * least significant first, while the order of transmition is most 
     241 * compiler dependent, in our case, the bits within a byte are assignd
     242 * least significant first, while the order of transmition is most
    144243 * significant first.  This requires a somewhat confusing rearrangement.
    145244 */
     245#ifndef TCPV40HDRS
     246#pragma pack(1)
     247#endif
    146248typedef struct {
    147249        u_short id;             /* query identification number */
     
    155257                        /* fields in fourth byte */
    156258        u_char  ra:1;           /* recursion available */
     259#ifdef TCPV40HDRS
    157260        u_char  pr:1;           /* primary server required (non standard) */
    158261        u_char  unused:2;       /* unused bits */
     262#else
     263        u_char  unused :1;      /* unused bits (MBZ as of 4.9.3a3) */
     264        u_char  ad: 1;          /* authentic data from named */
     265        u_char  cd: 1;          /* checking disabled by resolver */
     266#endif
    159267        u_char  rcode:4;        /* response code */
    160268#endif
     
    168276                        /* fields in fourth byte */
    169277        u_char  rcode:4;        /* response code */
     278#ifdef TCPV40HDRS
    170279        u_char  unused:2;       /* unused bits */
    171280        u_char  pr:1;           /* primary server required (non standard) */
     281#else
     282        u_char  cd: 1;          /* checking disabled by resolver */
     283        u_char  ad: 1;          /* authentic data from named */
     284        u_char  unused :1;      /* unused bits (MBZ as of 4.9.3a3) */
     285#endif
    172286        u_char  ra:1;           /* recursion available */
    173287#endif
     
    178292        u_short arcount;        /* number of resource entries */
    179293} HEADER;
     294#ifndef TCPV40HDRS
     295#pragma pack()
     296#endif
    180297
    181298/*
     
    184301#define INDIR_MASK      0xc0
    185302
     303#ifdef TCPV40HDRS
    186304/*
    187305 * Structure for passing resource records around.
     
    197315};
    198316#pragma pack()
    199 
    200 /*
    201  * Inline versions of get/put short/long.
    202  * Pointer is advanced; we assume that both arguments
    203  * are lvalues and will already be in registers.
    204  * cp MUST be u_char *.
     317#endif
     318
     319#ifndef TCPV40HDRS
     320/*
     321 * Inline versions of get/put short/long.  Pointer is advanced.
     322 *
     323 * These macros demonstrate the property of C whereby it can be
     324 * portable or it can be elegant but rarely both.
    205325 */
    206326#define GETSHORT(s, cp) { \
    207         (s) = *(cp)++ << 8; \
    208         (s) |= *(cp)++; \
     327        register u_char *t_cp = (u_char *)(cp); \
     328        (s) = ((u_int16_t)t_cp[0] << 8) \
     329            | ((u_int16_t)t_cp[1]) \
     330            ; \
     331        (cp) += INT16SZ; \
    209332}
    210333
    211334#define GETLONG(l, cp) { \
    212         (l) = *(cp)++ << 8; \
    213         (l) |= *(cp)++; (l) <<= 8; \
    214         (l) |= *(cp)++; (l) <<= 8; \
    215         (l) |= *(cp)++; \
    216 }
    217 
     335        register u_char *t_cp = (u_char *)(cp); \
     336        (l) = ((u_int32_t)t_cp[0] << 24) \
     337            | ((u_int32_t)t_cp[1] << 16) \
     338            | ((u_int32_t)t_cp[2] << 8) \
     339            | ((u_int32_t)t_cp[3]) \
     340            ; \
     341        (cp) += INT32SZ; \
     342}
    218343
    219344#define PUTSHORT(s, cp) { \
    220         *(cp)++ = (s) >> 8; \
    221         *(cp)++ = (s); \
    222 }
    223 
    224 /*
    225  * Warning: PUTLONG destroys its first argument.
    226  */
     345        register u_int16_t t_s = (u_int16_t)(s); \
     346        register u_char *t_cp = (u_char *)(cp); \
     347        *t_cp++ = t_s >> 8; \
     348        *t_cp   = t_s; \
     349        (cp) += INT16SZ; \
     350}
     351
    227352#define PUTLONG(l, cp) { \
    228         (cp)[3] = l; \
    229         (cp)[2] = (l >>= 8); \
    230         (cp)[1] = (l >>= 8); \
    231         (cp)[0] = l >> 8; \
    232         (cp) += sizeof(u_long); \
    233 }
     353        register u_int32_t t_l = (u_int32_t)(l); \
     354        register u_char *t_cp = (u_char *)(cp); \
     355        *t_cp++ = t_l >> 24; \
     356        *t_cp++ = t_l >> 16; \
     357        *t_cp++ = t_l >> 8; \
     358        *t_cp   = t_l; \
     359        (cp) += INT32SZ; \
     360}
     361#endif /*!TCPV40HDRS*/
    234362
    235363/* function prototypes */
    236 u_short _getshort(u_char*);
    237 u_long  _getlong(u_char*);
    238 void    putshort(u_short, u_char *);
    239 void    putlong(u_long, u_char *);
    240 int     dn_expand(__const__ u_char*, __const__ u_char*, __const__ u_char*,
    241                   u_char*, int);
    242 int     dn_comp(__const__ u_char*, u_char*, int, u_char**, u_char**);
    243 int     dn_find(u_char*, u_char*, u_char**, u_char**);
    244 int     dn_skipname(__const__ u_char*, __const__ u_char*);
    245 int     res_init(void);
    246 int     res_mkquery(int, __const__ char*, int, int, __const__ char*,
    247                     int, __const__ struct rrec*, char*, int);
    248 int     res_send(__const__ char*, int, char*, int);
    249 int     res_query(char*, int, int, u_char*, int);
    250 int     res_search(char*, int, int, u_char*, int);
    251 int     res_querydomain(char*, char*, int, int, u_char*, int);
     364u_short _System _getshort(u_char*);
     365u_long  _System _getlong(u_char*);
     366#ifdef TCPV40HDRS /* newer have this in resolver */
     367void    _System putshort(u_short, u_char *);
     368void    _System putlong(u_long, u_char *);
     369int     _System dn_expand(__const__ u_char*, __const__ u_char*, __const__ u_char*, u_char*, int);
     370int     _System dn_comp(__const__ u_char*, u_char*, int, u_char**, u_char**);
     371int     _System dn_find(u_char*, u_char*, u_char**, u_char**);
     372int     _System dn_skipname(__const__ u_char*, __const__ u_char*);
     373int     _System res_init(void);
     374int     _System res_mkquery(int, __const__ char*, int, int, __const__ char*, int, __const__ struct rrec*, char*, int);
     375int     _System res_send(__const__ char*, int, char*, int);
     376int     _System res_query(char*, int, int, u_char*, int);
     377int     _System res_search(char*, int, int, u_char*, int);
     378int     _System res_querydomain(char*, char*, int, int, u_char*, int);
     379#endif
    252380
    253381#if defined (__cplusplus)
  • trunk/src/emx/include/arpa/telnet.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    1 /*
     1/* Modified for gcc by bird 2003
     2 *
    23 * Copyright (c) 1983 Regents of the University of California.
    34 * All rights reserved.
     
    3637#ifndef _TELNET_H_
    3738#define _TELNET_H_
     39#define _ARPA_TELNET_H_
    3840
    3941/*
     
    7577#define TELCMD_FIRST    xEOF
    7678#define TELCMD_LAST     IAC
    77 #define TELCMD_OK(x)    ((x) <= TELCMD_LAST && (x) >= TELCMD_FIRST)
     79#define TELCMD_OK(x)    ((unsigned int)(x) <= TELCMD_LAST && (unsigned int)(x) >= TELCMD_FIRST)
    7880#define TELCMD(x)       telcmds[(x)-TELCMD_FIRST]
    7981
     
    115117#define TELOPT_LINEMODE 34      /* Linemode option */
    116118#define TELOPT_XDISPLOC 35      /* X Display Location */
    117 #define TELOPT_ENVIRON  36      /* Environment variables */
     119#define TELOPT_OLD_ENVIRON 36   /* Old - Environment variables */
    118120#define TELOPT_AUTHENTICATION 37/* Authenticate */
    119121#define TELOPT_ENCRYPT  38      /* Encryption option */
     122#define TELOPT_NEW_ENVIRON 39   /* New - Environment variables */
    120123#define TELOPT_EXOPL    255     /* extended-options-list */
    121124
    122125
    123 #define NTELOPTS        (1+TELOPT_ENCRYPT)
     126#define NTELOPTS        (1+TELOPT_NEW_ENVIRON)
    124127#ifdef TELOPTS
    125128char *telopts[NTELOPTS+1] = {
     
    132135        "TACACS UID", "OUTPUT MARKING", "TTYLOC",
    133136        "3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW",
    134         "LINEMODE", "XDISPLOC", "ENVIRON", "AUTHENTICATION",
    135         "ENCRYPT",
     137        "LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION",
     138        "ENCRYPT", "NEW-ENVIRON",
    136139        0,
    137140};
    138141#define TELOPT_FIRST    TELOPT_BINARY
    139 #define TELOPT_LAST     TELOPT_ENCRYPT
    140 #define TELOPT_OK(x)    ((x) <= TELOPT_LAST && (x) >= TELOPT_FIRST)
     142#define TELOPT_LAST     TELOPT_NEW_ENVIRON
     143#define TELOPT_OK(x)    ((unsigned int)(x) <= TELOPT_LAST)
    141144#define TELOPT(x)       telopts[(x)-TELOPT_FIRST]
    142145#endif
     
    148151#define TELQUAL_REPLY   2       /* AUTHENTICATION: client version of IS */
    149152#define TELQUAL_NAME    3       /* AUTHENTICATION: client version of IS */
     153
     154#define LFLOW_OFF               0       /* Disable remote flow control */
     155#define LFLOW_ON                1       /* Enable remote flow control */
     156#define LFLOW_RESTART_ANY       2       /* Restart output on any char */
     157#define LFLOW_RESTART_XON       3       /* Restart output only on XON */
    150158
    151159/*
     
    209217#endif
    210218
    211 #define SLC_NAME_OK(x)  ((x) >= 0 && (x) < NSLC)
     219#define SLC_NAME_OK(x)  ((unsigned int)(x) <= NSLC)
    212220#define SLC_NAME(x)     slc_names[x]
    213221
     
    226234#define SLC_FLUSHOUT    0x20
    227235
    228 #define ENV_VALUE       0
    229 #define ENV_VAR         1
    230 #define ENV_ESC         2
     236#define OLD_ENV_VALUE   0
     237#define OLD_ENV_VAR     1
     238#define NEW_ENV_VAR     0
     239#define NEW_ENV_VALUE   1
     240#define ENV_ESC         2
     241#define ENV_USERVAR     3
    231242
    232243/*
     
    265276#endif
    266277
    267 #define AUTHTYPE_NAME_OK(x)     ((x) >= 0 && (x) < AUTHTYPE_CNT)
     278#define AUTHTYPE_NAME_OK(x)     ((unsigned int)(x) < AUTHTYPE_CNT)
    268279#define AUTHTYPE_NAME(x)        authtype_names[x]
    269280
     
    302313
    303314
    304 #define ENCRYPT_NAME_OK(x)      ((x) >= 0 && (x) < ENCRYPT_CNT)
     315#define ENCRYPT_NAME_OK(x)      ((unsigned int)(x) < ENCRYPT_CNT)
    305316#define ENCRYPT_NAME(x)         encrypt_names[x]
    306317
    307 #define ENCTYPE_NAME_OK(x)      ((x) >= 0 && (x) < ENCTYPE_CNT)
     318#define ENCTYPE_NAME_OK(x)      ((unsigned int)(x) < ENCTYPE_CNT)
    308319#define ENCTYPE_NAME(x)         enctype_names[x]
    309320
  • trunk/src/emx/include/net/if.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    11/* Modifed for emx by hv 1994,1996
     2 * Modified for gcc/os2 by bird 2003
    23 *
    34 * Copyright (c) 1982, 1986, 1989 Regents of the University of California.
     
    4344#endif
    4445
     46/*  XXX fast fix for SNMP, going away soon */
     47#include <sys/time.h>
     48
     49
     50#ifdef TCPV40HDRS
    4551/*
    4652 * Structures defining a network interface, providing a packet
     
    6773 * interfaces.  These routines live in the files if.c and route.c
    6874 */
    69 /*  XXX fast fix for SNMP, going away soon */
    70 #include <sys/time.h>
    71 
    72 #ifdef TCPIPV4
    73 #pragma pack(1)
    74 #else
    75 #pragma pack(4)
    76 #endif
    77 
    7875
    7976/*
     
    8279 * (Would like to call this struct ``if'', but C isn't PL/1.)
    8380 */
    84 /*forward*/ struct mbuf;
    85 /*forward*/ struct ifaddr;
     81#pragma pack(1)
     82struct mbuf;
     83struct ifaddr;
    8684struct ifnet {
    8785        char    *if_name;               /* name, e.g. ``en'' or ``lo'' */
     
    9593                struct  mbuf *ifq_head;
    9694                struct  mbuf *ifq_tail;
    97 #ifndef TCPIPV4
    98                 int     ifq_len;
    99                 int     ifq_maxlen;
    100                 int     ifq_drops;
    101 #else
    10295                short   ifq_len;
    10396                short   ifq_maxlen;
    10497                u_short ifq_drops;
    105 #endif
    10698        } if_snd;                       /* output queue */
    10799/* procedure handles */
     
    112104        int     (*if_watchdog)(void);   /* timer routine */
    113105/* generic interface statistics */
    114 #ifndef TCPIPV4
    115         int     if_ipackets;            /* packets received on interface */
    116         int     if_ierrors;             /* input errors on interface */
    117         int     if_opackets;            /* packets sent on interface */
    118         int     if_oerrors;             /* output errors on interface */
    119         int     if_collisions;          /* collisions on csma interfaces */
    120 #else
    121106        u_short if_ipackets;            /* packets received on interface */
    122107        u_short if_ierrors;             /* input errors on interface */
     
    124109        u_short if_oerrors;             /* output errors on interface */
    125110        u_short if_collisions;          /* collisions on csma interfaces */
    126 #endif
    127111/* end statistics */
    128112        struct  ifnet *if_next;
    129113
     114#ifdef __OS2__
    130115/* the following structures are special for OS/2 TCP/IP only */
    131116        u_char  if_adapternum;          /* adapter number */
     
    134119        u_long  if_speed;
    135120
    136 #define IF_RTTSCALE     1000
    137         u_short if_rtt;                 /* Est interface rtt in ms */
    138         u_short if_rttvar;              /* Est interface rttvar in ms */
    139         u_short if_rttmin;              /* Fixed interface rttmin in ms */
    140         u_short if_sendpipe;            /* Send socket buffer/window size */
    141         u_short if_recvpipe;            /* Recv socket buffer/window size */
    142         u_short if_ssthresh;            /* Gateway buffer limit (slow strt) */
    143 #ifdef TCPIPV4
    144         u_long  if_eflags;              /* Extended flags */
    145         struct ifqueue if_traceq;       /* packet trace queue */
    146         u_short if_segsize;             /* segment size for interface */
    147         u_short if_use576;              /* use 576 or 1460 as def. mss if */
    148                                         /* going through a router */
    149         u_short if_rfc1469;             /* using broadcast or functional */
    150                                         /* addr for IP Multicast */
    151 #define IFF_RFC1469_BC  1               /* use broadcast */
    152 #define IFF_RFC1469_FA  2               /* use functional address */
    153 #define IFF_RFC1469_MA  3               /* use multicast address */
    154 #endif
    155 };
    156 
    157 #ifndef TCPIPV4
    158 struct ifmib {
    159         int     ifNumber;               /* number of network interfaces */
    160         struct iftable {
    161                 int     ifIndex;        /* index of this interface */
    162                 char    ifDescr[45];    /* description */
    163                 int     ifType;         /* type of the interface */
    164                 int     ifMtu;          /* MTU of the interface */
    165                 char    ifPhysAddr[6];  /* MTU of the interface */
    166                 int     ifOperStatus;
    167                 u_long  ifSpeed;
    168                 u_long  ifLastChange;
    169                 u_long  ifInOctets;
    170                 u_long  ifOutOctets;
    171                 u_long  ifOutDiscards;
    172                 u_long  ifInDiscards;
    173                 u_long  ifInErrors;
    174                 u_long  ifOutErrors;
    175                 u_long  ifInUnknownProtos;
    176                 u_long  ifInUcastPkts;
    177                 u_long  ifOutUcastPkts;
    178                 u_long  ifInNUcastPkts;
    179                 u_long  ifOutNUcastPkts;
    180         } iftable[20];
    181 };
    182 #else /* TCP/IP V4 */
     121        /* Interface TCP estimates/controls.  Serves the same */
     122        /* purpose as the per-route values in BSD-Reno, but I didn't */
     123        /* have to touch any of the route manipulation code.         */
     124        u_short if_rtt;                 /* Est interface rtt in ms */
     125        u_short if_rttvar;              /* Est interface rttvar in ms */
     126        u_short if_rttmin;              /* Fixed interface rttmin in ms */
     127        u_short if_sendpipe;            /* Send socket buffer/window size */
     128        u_short if_recvpipe;            /* Recv socket buffer/window size */
     129        u_short if_ssthresh;            /* Gateway buffer limit (slow strt) */
     130        u_long  if_eflags;              /* Extended Flags */
     131        struct ifqueue if_traceq;       /* packet trace queue */
     132        u_short if_segsize;             /* segment size for interface*/
     133        u_short if_use576;              /* use 576 or 1460 as def. mss if going thru a router */
     134        /* Token Ring IP multicast flag */
     135        u_short if_rfc1469;             /* using broadcast or functional address */
     136                                        /* for IP Mulitcast */
     137#define IF_RTTSCALE 1000
     138#endif /* __OS2__ */
     139};
     140#pragma pack()
     141#endif /*TCPV40HDRS*/
    183142
    184143#ifndef IFMIB_ENTRIES
     
    186145#endif
    187146
     147#ifdef TCPV40HDRS
     148#pragma pack(1)
    188149struct ifmib {
    189150        short   ifNumber;               /* number of network interfaces */
     
    210171        } iftable[IFMIB_ENTRIES];
    211172};
    212 #endif /* TCP/IP V4 */
    213 #pragma pack()
     173#pragma pack()
     174
     175#else /*TCPV40HDRS*/
     176
     177#pragma pack(1) /* force on doubleword boundary */
     178struct iftable {
     179    short  iftIndex;        /* index of this interface */
     180    char   iftDescr[45];    /* description             */
     181    short  iftType;         /* type of the interface   */
     182    short  iftMtu;          /* MTU of the interface   */
     183    char   iftPhysAddr[6];  /* MTU of the interface   */
     184    short  iftOperStatus;
     185    u_long iftSpeed;
     186    u_long iftLastChange;
     187    u_long iftInOctets;
     188    u_long iftOutOctets;
     189    u_long iftOutDiscards;
     190    u_long iftInDiscards;
     191    u_long iftInErrors;
     192    u_long iftOutErrors;
     193    u_long iftInUnknownProtos;
     194    u_long iftInUcastPkts;
     195    u_long iftOutUcastPkts;
     196    u_long iftInNUcastPkts;
     197    u_long iftOutNUcastPkts;
     198};
     199struct ifmib {
     200    short ifNumber;
     201    struct iftable iftable[IFMIB_ENTRIES];
     202};
     203#pragma pack()   /* reset to default packing */
     204
     205#define IFC_ALLRTSBCAST    0x0001
     206#define IFC_802_3          0x0002
     207#define IFC_FDDI           0x0004
     208#define IFC_NOREDIR        0x0010
     209
     210#define OPERSTATUS_UP      0x1
     211#define OPERSTATUS_DOWN    0x2
     212#define OPERSTATUS_TESTING 0x3
     213#endif /*TCPV40HDRS*/
    214214
    215215#define IFF_UP          0x1             /* interface is up */
     
    219219#define IFF_POINTOPOINT 0x10            /* interface is point-to-point link */
    220220#define IFF_NOTRAILERS  0x20            /* avoid use of trailers */
     221#ifndef TCPV40HDRS
     222#define IFF_LINK2       IFF_NOTRAILERS  /* was trailers, not used */
     223#endif
    221224#define IFF_RUNNING     0x40            /* resources allocated */
    222225#define IFF_NOARP       0x80            /* no address resolution protocol */
    223 /* next two not supported now, but reserved: */
    224226#define IFF_PROMISC     0x100           /* receive all packets */
    225227#define IFF_ALLMULTI    0x200           /* receive all multicast packets */
    226 #define IFF_OACTIVE     0x400           /* transmission in progress */
    227 #define IFF_SIMPLEX     0x800           /* can't hear own transmissions */
     228#define IFF_DEFMTU      0x400           /* default mtu of 1500 */
     229#define IFF_MULTICAST   0x800           /* supports multicast */
     230/*
     231 * The IFF_MULTICAST flag indicates that the network can support the
     232 * transmission and reception of higher-level (e.g., IP) multicast packets.
     233 * It is independent of hardware support for multicasting; for example,
     234 * point-to-point links or pure broadcast networks may well support
     235 * higher-level multicasts.
     236 */
    228237#define IFF_BRIDGE      0x1000          /* support token ring routine field */
    229 #define IFF_SNAP        0x2000          /* support extended SNAP header */
     238#define IFF_SNAP        0x2000          /* support extended SAP header */
    230239#define IFF_ETHER       0x4000          /* ethernet interface */
    231240#define IFF_LOOPBRD     0x8000          /* ethernet interface */
     241#ifndef TCPV40HDRS
     242#define IFF_SIMPLEX     0x10000         /* can't hear own transmissions */
     243#define IFF_OACTIVE     0x20000         /* transmission in progress */
     244#define IFF_802_3       0x40000         /* */
     245#define IFF_CANONICAL   0x80000         /* */
     246#define IFF_RUNNINGBLK  0x100000        /* threads waited for intf running */
     247#endif
     248
     249#define IFF_RFC1469_BC 1  /* using broadcast */
     250#define IFF_RFC1469_FA 2  /* using functional address */
     251#define IFF_RFC1469_MA 3  /* using mulitcast address */
    232252
    233253/*hv: flags set internally only */
    234 #ifdef BSD_TCPCOMPAT
     254#ifdef TCPV40HDRS
     255#define IFF_CANTCHANGE  (IFF_BROADCAST | IFF_POINTOPOINT | IFF_RUNNING)
     256#else
    235257#define IFF_CANTCHANGE \
    236258        (IFF_BROADCAST|IFF_POINTOPOINT|IFF_RUNNING|IFF_OACTIVE| \
    237         IFF_SIMPLEX|IFF_MULTICAST)
    238 #else
    239 #define IFF_CANTCHANGE  (IFF_BROADCAST | IFF_POINTOPOINT | IFF_RUNNING)
    240 #endif
    241 
    242 #ifdef TCPIPV4
     259            IFF_SIMPLEX|IFF_MULTICAST|IFF_ALLMULTI)
     260#endif
     261
    243262/* packet tracing extension */
    244263#define IFFE_PKTTRACE   0x00000001      /* trace datalink where possible */
    245264#define IFFE_IPTRACE    0x00000002      /* trace ONLY IP packets */
    246265
     266#ifndef TCPV40HDRS
     267#pragma pack(1)
     268#endif
    247269struct pkt_trace_hdr {
    248270        u_short         pt_htype;       /* header type */
    249 #define         HT_IP           0x01    /*      IP */
    250 #define         HT_ETHER        0x06    /*      Ethernet */
    251 #define         HT_ISO88023     0x07    /*      CSMA CD */
    252 #define         HT_ISO88025     0x09    /*      Token Ring */
    253 #define         HT_SLIP         0x1c    /*      Serial Line IP */
    254 #define         HT_PPP          0x18    /*      PPP IP */
    255271        u_short         pt_len;         /* in: pt_buf len, out: packet len */
    256272        caddr_t         pt_data;        /* packet ATTN: This is a _Seg16 addr! */
    257273        u_long          pt_tstamp;      /* time stamp in milliseconds */
    258274};
    259 
    260 #endif /* TCP/IP V4 */
    261 
     275#ifndef TCPV40HDRS
     276#pragma pack()
     277#endif
     278#define HT_IP           0x01 /* IP */
     279#define HT_ETHER        0x06 /* Ethernet */
     280#define HT_ISO88023     0x07 /* CSMA CD */
     281#define HT_ISO88025     0x09 /* Token Ring */
     282#define HT_SLIP         0x1c /* Serial Line IP */
     283#define HT_PPP          0x18 /* PPP IP */
     284
     285#ifndef TCPV40HDRS
     286/* genric interface information */
     287#pragma pack(1)
     288struct  if_data {
     289                u_char  ifi_type;       /* ethernet, tokenring, etc */
     290                u_char  ifi_addrlen;    /* media address length */
     291                u_char  ifi_hdrlen;     /* media header length */
     292                u_long  ifi_mtu;        /* maximum transmission unit */
     293                u_long  ifi_metric;     /* routing metric (external only) */
     294                u_long  ifi_baudrate;   /* linespeed */
     295                                        /* volatile statistics */
     296                u_long  ifi_collisions; /* collisions on csma interfaces */
     297                u_long  ifi_ibytes;     /* total number of octets received */
     298                u_long  ifi_obytes;     /* total number of octets sent */
     299                u_long  ifi_oqdrops;    /* dropped on output, this interface */
     300                u_long  ifi_iqdrops;    /* dropped on input, this interface */
     301                u_long  ifi_ierrors;    /* input errors on interface */
     302                u_long  ifi_oerrors;    /* output errors on interface */
     303                u_long  ifi_noproto;    /* destined for unsupported protocol */
     304                u_long  ifi_ipackets;   /* packets received on interface */
     305                u_long  ifi_opackets;   /* packets sent on interface */
     306                u_long  ifi_imcasts;    /* packets received via multicast */
     307                u_long  ifi_omcasts;    /* packets sent via multicast */
     308                short   ifi_OperStatus; /* SNMP Oper Status */
     309                struct  timeval ifi_lastchange;/* last updated */
     310                u_char  ifi_descr[45];  /* description of the interface */
     311};
     312#pragma pack()
     313
     314/*
     315 * Message format for use in obtaining information about interfaces
     316 * from getkerninfo and the routing socket
     317 */
     318#pragma pack(1)
     319struct if_msghdr {
     320        u_short ifm_msglen;     /* to skip over non-understood messages */
     321        u_char  ifm_version;    /* future binary compatability */
     322        u_char  ifm_type;       /* message type */
     323        int     ifm_addrs;      /* like rtm_addrs */
     324        int     ifm_flags;      /* value of if_flags */
     325        u_short ifm_index;      /* index for associated ifp */
     326        struct  if_data ifm_data;/* statistics and other data about if */
     327};
     328#pragma pack()
     329
     330/*
     331 * Message format for use in obtaining information about interface addresses
     332 * from getkerninfo and the routing socket
     333 */
     334#pragma pack(1)
     335struct ifa_msghdr {
     336        u_short ifam_msglen;    /* to skip over non-understood messages */
     337        u_char  ifam_version;   /* future binary compatability */
     338        u_char  ifam_type;      /* message type */
     339        int     ifam_addrs;     /* like rtm_addrs */
     340        int     ifam_flags;     /* value of ifa_flags */
     341        u_short ifam_index;     /* index for associated ifp */
     342        int     ifam_metric;    /* value of ifa_metric */
     343};
     344#pragma pack()
     345#endif /*!TCPV40HDRS*/
     346
     347#ifdef TCPV40HDRS
    262348/*
    263349 * Output queues (ifp->if_snd) and internetwork datagram level (pup level 1)
     
    284370        (ifq)->ifq_len++;\
    285371}
    286 #define IF_DEQUEUE(ifq, m) {\
    287         (m)=(ifq)->ifq_head;\
    288         if (m) {\
    289                 if (((ifq)->ifq_head=(m)->m_act)==0)\
    290                         (ifq)->ifq_tail=0;\
    291                 (m)->m_act=0;\
    292                 (ifq)->ifq_len--;\
    293         }\
    294 }
     372/*
     373 * Packets destined for level-1 protocol input routines
     374 * have a pointer to the receiving interface prepended to the data.
     375 * IF_DEQUEUEIF extracts and returns this pointer when dequeueing the packet.
     376 * IF_ADJ should be used otherwise to adjust for its presence.
     377 */
    295378#define IF_ADJ(m) {\
    296379        (m)->m_off+=sizeof(struct ifnet*);\
     
    313396        }\
    314397}
     398#define IF_DEQUEUE(ifq, m) {\
     399        (m)=(ifq)->ifq_head;\
     400        if (m) {\
     401                if (((ifq)->ifq_head=(m)->m_act)==0)\
     402                        (ifq)->ifq_tail=0;\
     403                (m)->m_act=0;\
     404                (ifq)->ifq_len--;\
     405        }\
     406}
    315407
    316408#define IFQ_MAXLEN      50
     
    334426        struct ifaddr   *ifa_next;              /* next address for interface */
    335427};
     428#endif /*TCPV40HDRS*/
    336429
    337430/*
     
    341434 * remainder may be interface specific.
    342435 */
     436#ifndef TCPV40HDRS
     437#pragma pack(1)
     438#endif
    343439struct  ifreq {
    344440#define IFNAMSIZ        16
     
    358454#define ifr_metric      ifr_ifru.ifru_metric    /* metric */
    359455#define ifr_data        ifr_ifru.ifru_data      /* for use by interface */
    360 };
     456#ifndef TCPV40HDRS
     457#define ifr_eflags      ifr_ifru.ifru_data      /* Extended flags */
     458#endif
     459};
     460#ifndef TCPV40HDRS
     461#pragma pack()
     462#endif
     463
     464#ifndef TCPV40HDRS
     465#pragma pack(1)
     466struct ifaliasreq {
     467  char    ifra_name[IFNAMSIZ];            /* if name, e.g. "en0" */
     468  struct  sockaddr ifra_addr;
     469  struct  sockaddr ifra_broadaddr;
     470  struct  sockaddr ifra_mask;
     471};
     472#pragma pack()
     473#endif
    361474
    362475/*
     
    366479 * must know all networks accessible).
    367480 */
     481#ifndef TCPV40HDRS
     482#pragma pack(1) /* paranoia I believe */
     483#endif
    368484struct  ifconf {
    369485        int     ifc_len;                /* size of associated buffer */
     
    375491#define ifc_req ifc_ifcu.ifcu_req       /* array of structures returned */
    376492};
     493#ifndef TCPV40HDRS
     494#pragma pack()
     495#endif
    377496
    378497#include <net/if_arp.h>
     
    382501#endif
    383502
     503#ifndef TCPV40HDRS
     504#include <netinet/in.h>
     505
     506#pragma pack(1)
     507struct  in_aliasreq {
     508        char    ifra_name[IFNAMSIZ];            /* if name, e.g. "en0" */
     509        struct  sockaddr_in ifra_addr;
     510        struct  sockaddr_in ifra_broadaddr;
     511#define ifra_dstaddr ifra_broadaddr
     512        struct  sockaddr_in ifra_mask;
     513};
     514#pragma pack()
     515
     516#pragma pack(1)
     517struct  addrreq  {                              /* get multicast addresses */
     518        char    ifr_name[IFNAMSIZ];
     519        struct  sockaddr ifr_addrs;
     520        u_long  maddr[MAX_IN_MULTI];
     521};
     522#pragma pack()
     523
     524#pragma pack(1)
     525struct  statatreq {
     526        u_long addr;
     527        short interface;
     528        u_long mask;
     529        u_long broadcast;
     530};
     531#pragma pack()
     532
     533/* PPP statistics table. Moved here from previous ifstat.h */
     534struct ifstat {
     535    u_long iftLastChange;
     536    u_long iftInOctets;
     537    u_long iftOutOctets;
     538    u_long iftOutDiscards;
     539    u_long iftInDiscards;
     540    u_long iftInErrors;
     541    u_long iftOutErrors;
     542    u_long iftInUnknownProtos;
     543    u_long iftInUcastPkts;
     544    u_long iftOutUcastPkts;
     545    u_long iftInNUcastPkts;
     546    u_long iftOutNUcastPkts;
     547};
     548#endif /*!TCPV40HDRS*/
     549
    384550#endif /* _NET_IF_H_ */
  • trunk/src/emx/include/net/if_arp.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    11/* Modified for emx by hv 1994,1996
     2 * Modified for gcc/os2 by bird 2003
    23 *
    34 * Copyright (c) 1986 Regents of the University of California.
     
    4950 * specified.  Field names used correspond to RFC 826.
    5051 */
     52#ifndef TCPV40HDR
     53#pragma pack(1)
     54#endif
    5155struct  arphdr {
    5256        u_short ar_hrd;         /* format of hardware address */
    5357#define ARPHRD_ETHER    1       /* ethernet hardware address */
    5458#define ARPHRD_802      6       /* 802 net hardware address */
     59#ifndef TCPV40HDRS
     60#define ARPHRD_FRELAY   15      /* frame relay hardware format */
     61#endif
    5562        u_short ar_pro;         /* format of protocol address */
    5663        u_char  ar_hln;         /* length of hardware address */
     
    5966#define ARPOP_REQUEST   1       /* request to resolve address */
    6067#define ARPOP_REPLY     2       /* response to previous request */
     68#ifndef TCPV40HDRS
     69#define ARPOP_REVREQUEST 3      /* request protocol address given hardware */
     70#define ARPOP_REVREPLY   4      /* response giving protocol address */
     71#define ARPOP_INVREQUEST 8      /* request to identify peer */
     72#define ARPOP_INVREPLY   9      /* response identifying peer */
     73#endif
     74#if 0 /* not OS/2 */
    6175#define REVARP_REQUEST  3       /* reverse ARP request (not IBM) */
    6276#define REVARP_REPLY    4       /* reverse ARP reply (not IBM) */
     77#endif
    6378/*
    6479 * The remaining fields are variable in size,
     
    7085/*      u_char  ar_tpa[];        * target protocol address */
    7186};
     87#ifndef TCPV40HDRS
     88#pragma pack()
     89#endif
    7290
    7391/*
    7492 * ARP ioctl request
    7593 */
     94#ifndef TCPV40HDRS
     95#pragma pack(4)
     96#endif
    7697struct arpreq {
    7798        struct  sockaddr arp_pa;                /* protocol address */
     
    79100        int     arp_flags;                      /* flags */
    80101};
     102#ifndef TCPV40HDRS
     103#pragma pack()
     104#endif
     105
     106#ifndef TCPV40HDRS
     107/*
     108 * Token ring ARP ioctl request
     109 */
     110#pragma pack(4)
     111struct arpreq_tr {
     112        struct  sockaddr arp_pa;                /* protocol address */
     113        struct  sockaddr arp_ha;                /* hardware address */
     114        long    arp_flags;                     /* flags */
     115        u_short arp_rcf;                        /* token ring routing control field */
     116        u_short arp_rseg[8];                    /* token ring routing segments */
     117};
     118#endif /*!TCPV40HDRS*/
     119
     120
    81121/*  arp_flags and at_flags field values */
    82122#define ATF_INUSE       0x01    /* entry in use */
     
    85125#define ATF_PUBL        0x08    /* publish entry (respond for other host) */
    86126#define ATF_USETRAILERS 0x10    /* has requested trailers */
     127#ifndef TCPV40HDRS
     128#define ATF_802_3       0x20    /* sender's ether if set to 802.3 */
     129#endif
    87130
    88131#endif /* !_NET_IF_ARP_H_ */
  • trunk/src/emx/include/net/route.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  *
     2 * Modified for gcc/os2 by bird 2003
     3 *
    34 * Copyright (c) 1980, 1986 Regents of the University of California.
    45 * All rights reserved.
     
    4748/*
    4849 * Kernel resident routing tables.
    49  * 
     50 *
    5051 * The routing tables are initialized when interface addresses
    5152 * are set by making entries for all directly connected interfaces.
     
    6263};
    6364
     65
     66#ifndef TCPV40HDRS
     67/*
     68 * These numbers are used by reliable protocols for determining
     69 * retransmission behavior and are included in the routing structure.
     70 */
     71struct rt_metrics {
     72        u_long  rmx_locks;      /* Kernel must leave these values alone */
     73        u_long  rmx_mtu;        /* MTU for this path */
     74        u_long  rmx_hopcount;   /* max hops expected */
     75        u_long  rmx_expire;     /* lifetime for route, e.g. redirect */
     76        u_long  rmx_recvpipe;   /* inbound delay-bandwith product */
     77        u_long  rmx_sendpipe;   /* outbound delay-bandwith product */
     78        u_long  rmx_ssthresh;   /* outbound gateway buffer limit */
     79        u_long  rmx_rtt;        /* estimated round trip time */
     80        u_long  rmx_rttvar;     /* estimated rtt variance */
     81        u_long  rmx_pksent;     /* packets sent using this route */
     82        u_long  rmx_filler[4];  /* will be used for T/TCP later */
     83};
     84
    6485/*
    6586 * rmx_rtt and rmx_rttvar are stored as microseconds;
     
    6990#define RTM_RTTUNIT     1000000 /* units for rtt, rttvar, as units per sec */
    7091#define RTTTOPRHZ(r)    ((r) / (RTM_RTTUNIT / PR_SLOWHZ))
     92#endif /* !TCPV40HDRS */
     93
    7194
    7295/*
     
    80103 * Following structure necessary for 4.3 compatibility;
    81104 */
    82 struct rtentry {
     105#pragma pack(1)
     106#ifdef TCPV40HDRS
     107struct rtentry
     108#else
     109struct ortentry
     110#endif
     111{
    83112        u_long  rt_hash;                /* to speed lookups */
    84113        struct  sockaddr rt_dst;        /* key */
     
    90119        long metric1,metric2,metric3,metric4; /*IBM special */
    91120};
    92 
    93 #define RTF_UP          0x1             /* route useable */
     121#pragma pack()
     122
     123/* IBM: hv: I think this is the internal structure of the RT table of the
     124 * router daemon. Don't think it belongs here, but the toolkit has it as well
     125 */
     126#define RTENTRY_COUNT   512
     127#pragma pack(1)
     128struct rtentries {
     129        short   hostcount;
     130        short   netcount;
     131        #ifdef TCPV40HDRS
     132        struct rtentry  rttable[RTENTRY_COUNT];
     133        #else
     134        struct ortentry rttable[RTENTRY_COUNT];
     135        #endif
     136};
     137#pragma pack()
     138
     139
     140#define RTF_UP          0x1             /* route usable */
    94141#define RTF_GATEWAY     0x2             /* destination is a gateway */
    95142#define RTF_HOST        0x4             /* host entry (net otherwise) */
     
    104151#define RTF_STATIC      0x800           /* route manually added */
    105152#define RTF_BLACKHOLE   0x1000          /* discard packets during updates */
     153#ifndef TCPV40HDRS
     154#define RTF_LLTEMP      0x2000          /* manually added temporary arp entry */
     155#endif
    106156#define RTF_PROTO2      0x4000          /* protocol specific routing flag */
    107157#define RTF_PROTO1      0x8000          /* protocol specific routing flag */
     158#ifndef TCPV40HDRS
     159#define RTF_PRCLONING   0x10000         /* protocol requires cloning */
     160#define RTF_WASCLONED   0x20000         /* route generated through cloning */
     161#define RTF_PROTO3      0x40000         /* protocol specific routing flag */
     162#define RTF_CHAINDELETE 0x80000         /* chain is being deleted (internal) */
     163#define RTF_PINNED      0x100000        /* future use */
     164#define RTF_TUNNEL      0x200000        /* tunnelling bit */
     165#define RTF_CRYPT       0x400000        /* encrypting tunnel */
     166#define RTF_AUTH        0x800000        /* authenticating tunnel */
     167#endif
    108168
    109169
     
    118178        short   rts_wildcard;           /* lookups satisfied by a wildcard */
    119179};
     180#ifndef TCPV40HDRS
    120181/*
    121182 * Structures for routing messages.
    122183 */
    123 #ifndef __EMX__
     184#pragma pack(1)
    124185struct rt_msghdr {
    125         u_short rtm_msglen;     /* to skip over non-understood messages */
    126         u_char  rtm_version;    /* future binary compatability */
    127         u_char  rtm_type;       /* message type */
    128         u_short rtm_index;      /* index for associated ifp */
    129         pid_t   rtm_pid;        /* identify sender */
    130         int     rtm_addrs;      /* bitmask identifying sockaddrs in msg */
    131         int     rtm_seq;        /* for sender to identify action */
    132         int     rtm_errno;      /* why failed */
    133         int     rtm_flags;      /* flags, incl. kern & message, e.g. DONE */
    134         int     rtm_use;        /* from rtentry */
    135         u_long  rtm_inits;      /* which metrics we are initializing */
    136         struct  rt_metrics rtm_rmx; /* metrics themselves */
     186#define IFNAMSIZ        16
     187        u_short rtm_msglen;     /* to skip over non-understood messages */
     188        u_char  rtm_version;    /* future binary compatibility */
     189        u_char  rtm_type;       /* message type */
     190        u_short rtm_index;      /* index for associated ifp */
     191        short   rtm_unit;       /* new field for subnet routing */
     192        int     rtm_flags;      /* flags, incl. kern & message, e.g. DONE */
     193        int     rtm_addrs;      /* bitmask identifying sockaddrs in msg */
     194        pid_t   rtm_pid;        /* identify sender */
     195        int     rtm_seq;        /* for sender to identify action */
     196        int     rtm_errno;      /* why failed */
     197        int     rtm_use;        /* from rtentry */
     198        u_long  rtm_inits;      /* which metrics we are initializing */
     199        u_long  rtm_netmask;    /* new field for subnet routing */
     200        char    rtm_name[IFNAMSIZ]; /* new field for subnet routing */
     201        struct  rt_metrics rtm_rmx; /* metrics themselves */
     202};
     203#pragma pack()
     204
     205#define RTM_VERSION     4       /* Up the ante and ignore older versions */
     206
     207#define RTM_ADD         0x1     /* Add Route */
     208#define RTM_DELETE      0x2     /* Delete Route */
     209#define RTM_CHANGE      0x3     /* Change Metrics or flags */
     210#define RTM_GET         0x4     /* Report Metrics */
     211#define RTM_LOSING      0x5     /* Kernel Suspects Partitioning */
     212#define RTM_REDIRECT    0x6     /* Told to use different route */
     213#define RTM_MISS        0x7     /* Lookup failed on this address */
     214#define RTM_LOCK        0x8     /* fix specified metrics */
     215#define RTM_OLDADD      0x9     /* caused by SIOCADDRT */
     216#define RTM_OLDDEL      0xa     /* caused by SIOCDELRT */
     217#define RTM_RESOLVE     0xb     /* req to resolve dst to LL addr */
     218#define RTM_NEWADDR     0xc     /* address being added to iface */
     219#define RTM_DELADDR     0xd     /* address being removed from iface */
     220#define RTM_IFINFO      0xe     /* iface going up/down etc. */
     221
     222#define RTV_MTU         0x1     /* init or lock _mtu */
     223#define RTV_HOPCOUNT    0x2     /* init or lock _hopcount */
     224#define RTV_EXPIRE      0x4     /* init or lock _hopcount */
     225#define RTV_RPIPE       0x8     /* init or lock _recvpipe */
     226#define RTV_SPIPE       0x10    /* init or lock _sendpipe */
     227#define RTV_SSTHRESH    0x20    /* init or lock _ssthresh */
     228#define RTV_RTT         0x40    /* init or lock _rtt */
     229#define RTV_RTTVAR      0x80    /* init or lock _rttvar */
     230
     231/*
     232 * Bitmask values for rtm_addr.
     233 */
     234#define RTA_DST         0x1     /* destination sockaddr present */
     235#define RTA_GATEWAY     0x2     /* gateway sockaddr present */
     236#define RTA_NETMASK     0x4     /* netmask sockaddr present */
     237#define RTA_GENMASK     0x8     /* cloning mask sockaddr present */
     238#define RTA_IFP         0x10    /* interface name sockaddr present */
     239#define RTA_IFA         0x20    /* interface addr sockaddr present */
     240#define RTA_AUTHOR      0x40    /* sockaddr for author of redirect */
     241#define RTA_BRD         0x80    /* for NEWADDR, broadcast or p-p dest addr */
     242
     243/*
     244 * Index offsets for sockaddr array for alternate internal encoding.
     245 */
     246#define RTAX_DST        0       /* destination sockaddr present */
     247#define RTAX_GATEWAY    1       /* gateway sockaddr present */
     248#define RTAX_NETMASK    2       /* netmask sockaddr present */
     249#define RTAX_GENMASK    3       /* cloning mask sockaddr present */
     250#define RTAX_IFP        4       /* interface name sockaddr present */
     251#define RTAX_IFA        5       /* interface addr sockaddr present */
     252#define RTAX_AUTHOR     6       /* sockaddr for author of redirect */
     253#define RTAX_BRD        7       /* for NEWADDR, broadcast or p-p dest addr */
     254#define RTAX_MAX        8       /* size of array to allocate */
     255
     256struct rt_addrinfo {
     257        int     rti_addrs;
     258        struct  sockaddr *rti_info[RTAX_MAX];
    137259};
    138260
    139261struct route_cb {
    140         int     ip_count;
    141         int     ns_count;
    142         int     iso_count;
    143         int     any_count;
    144 };
    145 #define RTM_VERSION     2       /* Up the ante and ignore older versions */
    146 
    147 #define RTM_ADD         0x1     /* Add Route */
    148 #define RTM_DELETE      0x2     /* Delete Route */
    149 #define RTM_CHANGE      0x3     /* Change Metrics or flags */
    150 #define RTM_GET         0x4     /* Report Metrics */
    151 #define RTM_LOSING      0x5     /* Kernel Suspects Partitioning */
    152 #define RTM_REDIRECT    0x6     /* Told to use different route */
    153 #define RTM_MISS        0x7     /* Lookup failed on this address */
    154 #define RTM_LOCK        0x8     /* fix specified metrics */
    155 #define RTM_OLDADD      0x9     /* caused by SIOCADDRT */
    156 #define RTM_OLDDEL      0xa     /* caused by SIOCDELRT */
    157 #define RTM_RESOLVE     0xb     /* req to resolve dst to LL addr */
    158 
    159 #define RTV_MTU         0x1     /* init or lock _mtu */
    160 #define RTV_HOPCOUNT    0x2     /* init or lock _hopcount */
    161 #define RTV_EXPIRE      0x4     /* init or lock _hopcount */
    162 #define RTV_RPIPE       0x8     /* init or lock _recvpipe */
    163 #define RTV_SPIPE       0x10    /* init or lock _sendpipe */
    164 #define RTV_SSTHRESH    0x20    /* init or lock _ssthresh */
    165 #define RTV_RTT         0x40    /* init or lock _rtt */
    166 #define RTV_RTTVAR      0x80    /* init or lock _rttvar */
    167 
    168 #define RTA_DST         0x1     /* destination sockaddr present */
    169 #define RTA_GATEWAY     0x2     /* gateway sockaddr present */
    170 #define RTA_NETMASK     0x4     /* netmask sockaddr present */
    171 #define RTA_GENMASK     0x8     /* cloning mask sockaddr present */
    172 #define RTA_IFP         0x10    /* interface name sockaddr present */
    173 #define RTA_IFA         0x20    /* interface addr sockaddr present */
    174 #define RTA_AUTHOR      0x40    /* sockaddr for author of redirect */
    175 #endif
    176 
    177 /* IBM: hv: I think this is the internal structure of the RT table of the
    178  * router daemon. Don't think it belongs here, but the toolkit has it as well
    179  */
    180 #define RTENTRY_COUNT   512
    181 struct rtentries {
    182         short   hostcount;
    183         short   netcount;
    184         struct rtentry rttable[RTENTRY_COUNT];
    185 };
     262        int     ip_count;
     263        int     ns_count;
     264        int     iso_count;
     265        int     any_count;
     266};
     267#endif /* !TCPV40HDRS */
    186268
    187269#if defined (__cplusplus)
  • trunk/src/emx/include/netdb.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    11/*- Modified for emx by hv and em 1994-1997
     2 *- Modified for gcc by bird 2003
    23 *
    34 * Copyright (c) 1980, 1983, 1988 Regents of the University of California.
     
    3334 *
    3435 *      from: @(#)netdb.h       5.15 (Berkeley) 4/3/91
    35  *      netdb.h,v 1.1 2003/04/16 15:53:07 bird Exp
     36 *      netdb.h,v 1.2 2003/05/19 02:41:00 bird Exp
    3637 */
    3738
    3839#ifndef _NETDB_H_
    3940#define _NETDB_H_
     41#ifdef TCPV40HDRS
     42#define __NETDB_32H
     43#endif
    4044
    4145#if defined (__cplusplus)
    4246extern "C" {
    4347#endif
     48
     49/* toolkit compatibility - start */
     50#include <sys/param.h>
     51#include <sys/cdefs.h>
     52/* toolkit compatibility - end */
    4453
    4554#ifndef _EMX_TCPIP
     
    5463#endif
    5564
    56 extern int h_errno;
    57 
    58 #define _PATH_HEQUIV    "/tcpip/etc/hosts.equiv"
    59 #define _PATH_HOSTS     "/tcpip/etc/hosts"
    60 #define _PATH_NETWORKS  "/tcpip/etc/networks"
    61 #define _PATH_PROTOCOLS "/tcpip/etc/protocols"
    62 #define _PATH_SERVICES  "/tcpip/etc/services"
     65
     66#define _PATH_HEQUIV    "/mptn/etc/hosts.equiv"
     67#define _PATH_HOSTS     "/mptn/etc/hosts"
     68#define _PATH_NETWORKS  "/mptn/etc/networks"
     69#define _PATH_PROTOCOLS "/mptn/etc/protocols"
     70#define _PATH_SERVICES  "/mptn/etc/services"
     71
     72#ifdef TCPV40HDRS
     73#define h_errno         (tcp_h_errno())   /* __MT__ safe */
     74#else
     75#define h_errno         (*tcp_h_errno1()) /* __MT__ safe */
     76#endif
    6377
    6478/*
     
    104118 * (left in extern int h_errno).
    105119 */
    106 #if 0
    107 #define h_errno (tcp_h_errno()) /* thread safe */
     120#ifndef TCPV40HDRS
     121#define NETDB_INTERNAL  -1      /* see errno */
     122#define NETDB_SUCCESS   0       /* no problem */
    108123#endif
    109124#define HOST_NOT_FOUND  1 /* Authoritative Answer Host not found */
     
    113128#define NO_ADDRESS      NO_DATA         /* no address, look for MX record */
    114129
    115 int             gethostname (char *, int);
    116 void            endhostent (void);
    117 void            endnetent (void);
    118 void            endprotoent (void);
    119 void            endservent (void);
    120 struct hostent  *gethostbyaddr (__const__ char *, int, int);
    121 struct hostent  *gethostbyname (__const__ char *);
    122 struct hostent  *gethostent (void);
    123 struct netent   *getnetbyaddr (u_long, int);
    124 struct netent   *getnetbyname (__const__ char *);
    125 struct netent   *getnetent (void);
    126 struct protoent *getprotobyname (__const__ char *);
    127 struct protoent *getprotobynumber (int);
    128 struct protoent *getprotoent (void);
    129 struct servent  *getservbyname (__const__ char *, __const__ char *);
    130 struct servent  *getservbyport (int, __const__ char *);
    131 struct servent  *getservent (void);
    132 void            herror (__const__ char *);
    133 void            sethostent (int);
    134 void            setnetent (int);
    135 void            setprotoent (int);
    136 void            setservent (int);
    137 
    138 #ifdef NETDB_IBM_ADDENDUM
     130
     131#ifdef TCPV40HDRS
     132#include <stdio.h>
     133#include <string.h>
     134#include <netinet\in.h>
    139135
    140136/* IBM addendum structures and functions */
     
    144140#define _MAXLINELEN     1024
    145141
    146 /* this is the internally used data structure to which pointers of 
     142/* this is the internally used data structure to which pointers of
    147143 * struct hostent ponit to, after gethostbyname_r/gethostbyaddr_r were
    148144 * called. ATTENTION EMX: The component _opaque_ is a pointer to a data
     
    159155        int     stayopen;                       /* AIX addon */
    160156        u_long  host_addresses[_MAXADDRS];      /* Actual Addresses. */
    161 };                                             
     157};
    162158
    163159struct servent_data {
     
    167163        int     _serv_stayopen;
    168164};
    169 
    170 int gethostbyname_r(char*, struct hostent*, struct hostent_data*);
    171 int gethostbyaddr_r(char*, int, int, struct hostent*, struct hostent_data*);
    172 int getservbyname_r(char*, char*, struct servent*, struct servent_data*);
    173 struct hostent *_gethtbyname(char*);
    174 struct hostent *_gethtbyaddr(char*, int, int);
    175 int tcp_h_errno(void);  /* thread safe h_errno */
    176 
    177 #endif /* NETDB_IBM_ADDENDUM */
     165#endif
     166
     167
     168/* BSD */
     169int                 _System gethostname( char *, int );
     170struct hostent *    _System gethostbyname( __const__ char * );
     171struct hostent *    _System gethostbyaddr( __const__ char *, int, int );
     172struct netent *     _System getnetbyname( __const__ char * );
     173struct netent *     _System getnetbyaddr( unsigned long, int );
     174struct servent *    _System getservbyname( __const__ char *, char * );
     175struct servent *    _System getservbyport( int, __const__ char * );
     176struct servent *    _System getservent( void );
     177struct protoent *   _System getprotobyname( __const__ char * );
     178struct protoent *   _System getprotobynumber( int );
     179void                _System sethostent( int );
     180struct hostent *    _System gethostent( void );
     181void                _System endhostent(void);
     182void                _System setnetent( int );
     183struct netent *     _System getnetent( void );
     184void                _System endnetent(void);
     185void                _System setprotoent( int );
     186struct protoent *   _System getprotoent( void );
     187void                _System endprotoent(void);
     188void                _System setservent( int );
     189struct servent *    _System getservent( void );
     190void                _System endservent(void);
     191#ifndef TCPV40HDRS
     192struct hostent *    _System gethostbyname2( __const__ char *, int );
     193#endif
     194
     195
     196/* OS2 Additions */
     197#ifdef TCPV40HDRS
     198int                 _System tcp_h_errno(void);
     199struct hostent *    _System Rgethostbyname(char *); /* Socks additions */
     200#else
     201const char *        _System hstrerror(int);
     202/* void               _System sethostfile(const char *); */
     203int *               _System tcp_h_errno1(void);
     204#endif
     205
     206/* EMX/BSD additions. */
     207void                herror (__const__ char *);
     208
     209/* EMX/BSD stuff which isn't implemeneted  */
     210#ifndef TCPV40HDRS
     211struct hostent_data;
     212struct servent_data;
     213#endif
     214int                 gethostbyname_r(char*, struct hostent*, struct hostent_data*);
     215int                 gethostbyaddr_r(char*, int, int, struct hostent*, struct hostent_data*);
     216int                 getservbyname_r(char*, char*, struct servent*, struct servent_data*);
     217struct hostent *    _gethtbyname(char*);
     218struct hostent *    _gethtbyaddr(char*, int, int);
     219
    178220
    179221#ifdef __RSXNT__
     
    187229
    188230#endif /* !_NETDB_H_ */
     231
  • trunk/src/emx/include/netinet/icmp_var.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    1 /*
     1/* Modified for gcc/os2 by bird 2003
     2 *
    23 * Copyright (c) 1982, 1986, 1993
    34 *      The Regents of the University of California.  All rights reserved.
     
    4950 */
    5051struct  icmpstat {
     52#if 0 /* OS2 is slightly different */
    5153/* statistics related to icmp packets generated */
    5254        u_long  icps_error;             /* # of calls to icmp_error */
     
    6163        u_long  icps_reflect;           /* number of responses */
    6264        u_long  icps_inhist[ICMP_MAXTYPE + 1];
     65#else  /* OS2: short not longs */
     66        u_short icps_error;             /* # of calls to icmp_error */
     67        u_short icps_oldshort;          /* no error 'cuz old ip too short */
     68        u_short icps_oldicmp;           /* no error 'cuz old was icmp */
     69        u_short icps_outhist[ICMP_MAXTYPE + 1];
     70/* statistics related to input messages processed */
     71        u_short icps_badcode;           /* icmp_code out of range */
     72        u_short icps_tooshort;          /* packet < ICMP_MINLEN */
     73        u_short icps_checksum;          /* bad checksum */
     74        u_short icps_badlen;            /* calculated bound mismatch */
     75        u_short icps_reflect;           /* number of responses */
     76        u_short icps_inhist[ICMP_MAXTYPE + 1];
     77#endif
    6378#if 0 /* not on OS/2 */
    6479        u_long  icps_bmcastecho;        /* b/mcast echo requests dropped */
  • trunk/src/emx/include/netinet/if_ether.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    11/* Modified for emx by hv 1994,1996
     2 * Modified for gcc by bird 2003
    23 *
    34 * Copyright (c) 1982, 1986 Regents of the University of California.
     
    3940#define _NETINET_IF_ETHER_H_
    4041
    41 /*
    42  * Ethernet address - 6 octets
    43  * this is only used by the ethers(3) functions.
    44  */
    45 struct ether_addr {
    46         u_char ether_addr_octet[6];
    47 };
     42#ifdef TCPV40HDRS
    4843
    4944/*
     
    5752
    5853#define ETHERTYPE_PUP           0x0200  /* PUP protocol */
    59 /* the IBM header corrects the following to 0x608 for OS/2 but I believe
    60  * this is just a dirty hack
    61  */
     54#define ETHERTYPE_IP            0x0800  /* IP protocol */
     55#ifdef OS2 /* hv thinks this is just a dirty hack, but we must include it. */
     56#define ETHERTYPE_ARP           0x0608  /* address resolution protocol */
     57#else
    6258#define ETHERTYPE_ARP           0x0806  /* address resolution protocol */
    63 #define ETHERTYPE_IP            0x0800  /* IP protocol */
    64 #define ETHERTYPE_REVARP        0x8035  /* reverse addr resolution protocol */
     59#endif
    6560
    6661/*
     
    7974 *
    8075 * See RFC 826 for protocol description.  Structure below is adapted
    81  * to resolving internet addresses.  Field names used correspond to 
     76 * to resolving internet addresses.  Field names used correspond to
    8277 * RFC 826.
    8378 */
     
    113108 * Internet to ethernet address resolution table.
    114109 */
    115 #ifdef TCPIPV4
    116110#pragma pack(1)
    117 #else
    118 #pragma pack(4)
    119 #endif
    120111struct  arptab {
    121112        struct  in_addr at_iaddr;       /* internet address */
     
    127118        u_short at_rcf;                 /* token ring routing control field */
    128119        u_short at_rseg[8];             /* token ring routing segments */
     120#ifdef OS2
    129121        u_long at_millisec;             /* TOD millsecons of last update */
    130 #ifdef TCPIPV4
    131122        short at_interface;             /* interface index */
    132 #else
    133         int at_interface;               /* interface index */
    134123#endif
    135124};
    136125#pragma pack()
    137126
     127
     128#else /*TCPV40HDRS*/
     129
     130
     131#pragma pack(1)
     132struct sockaddr_inarp {
     133        u_char  sin_len;
     134        u_char  sin_family;
     135        u_short sin_port;
     136        struct  in_addr sin_addr;
     137        struct  in_addr sin_srcaddr;
     138        u_short sin_tos;
     139        u_short sin_other;
     140#define SIN_PROXY 1
     141};
     142struct oarptab {
     143        struct  in_addr at_iaddr;       /* internet address */
     144        u_char  at_enaddr[6];           /* ethernet address */
     145        u_char  at_timer;               /* minutes since last reference */
     146        u_char  at_flags;               /* flags */
     147        void * at_hold;
     148        u_short at_rcf;                 /* token ring routing control field */
     149        u_short at_rseg[8];             /* token ring routing segments */
     150        u_long  at_millisec;            /* TOD milliseconds of last update */
     151        u_short at_interface;           /* interface index */
     152};
     153#pragma pack()
     154
     155/*
     156 * IP and ethernet specific routing flags
     157 */
     158#define RTF_USETRAILERS RTF_PROTO1      /* use trailers */
     159#define RTF_ANNOUNCE    RTF_PROTO2      /* announce new arp entry */
     160
     161
     162#endif /*TCPV40HDRS (else) */
     163
    138164#endif /* !_NETINET_IF_ETHER_H_ */
  • trunk/src/emx/include/netinet/igmp.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    11/* Modified for emx by hv 1996
     2 * Modified for gcc/os2 by bird 2003
    23 *
    34 * Copyright (c) 1988 Stephen Deering.
     
    4748 * IGMP packet format.
    4849 */
     50#ifndef TCPV40HDRS
     51#pragma pack(1)
     52#endif
    4953struct igmp {
    5054        u_char          igmp_type;      /* version & type of IGMP message  */
     
    5357        struct in_addr  igmp_group;     /* group address being reported    */
    5458};                                      /*  (zero for queries)             */
     59#ifndef TCPV40HDRS
     60#pragma pack()
     61#endif
    5562
    5663#define IGMP_MINLEN                  8
  • trunk/src/emx/include/netinet/igmp_var.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    1 /*
     1/* Modified for gcc/os2 by bird 2003
     2 *
    23 * Copyright (c) 1988 Stephen Deering.
    34 * Copyright (c) 1992, 1993
  • 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)
  • trunk/src/emx/include/netinet/ip.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    11/* Modified for emx by hv 1994,1996
     2 * Modified for gcc/os2 by bird 2003
    23 *
    34 * Copyright (c) 1982, 1986 Regents of the University of California.
     
    3940#define _NETINET_IP_H_
    4041
    41 #ifdef __EMX__
    4242#include <machine/endian.h>
    43 #endif /* __EMX__ */
    4443
    4544/*
     
    5655 * against negative integers quite easily, and fail in subtle ways.
    5756 */
     57#pragma pack(1)
    5858struct ip {
    5959#if BYTE_ORDER == LITTLE_ENDIAN
     
    7171#define IP_DF 0x4000                    /* dont fragment flag */
    7272#define IP_MF 0x2000                    /* more fragments flag */
     73#ifndef TCPV40HDRS
     74#define IP_OFFMASK 0x1fff               /* mask for fragmenting bits */
     75#endif
    7376        u_char  ip_ttl;                 /* time to live */
    7477        u_char  ip_p;                   /* protocol */
     
    7679        struct  in_addr ip_src,ip_dst;  /* source and dest address */
    7780};
    78 
     81#pragma pack()
     82
     83#ifdef TCPV40HDRS
    7984#define IP_MAXPACKET    32767           /* OS2 maximum packet size */
     85#else
     86#define IP_MAXPACKET    65535           /* maximum packet size */
     87#endif
    8088
    8189/*
     
    96104#define IPTOS_PREC_IMMEDIATE            0x40
    97105#define IPTOS_PREC_PRIORITY             0x20
     106#ifdef TCPV40HDRS
    98107#define IPTOS_PREC_ROUTINE              0x10
     108#else
     109#define IPTOS_PREC_ROUTINE              0x00
     110#endif
    99111
    100112/*
    101113 * Definitions for options.
    102114 */
     115#ifndef TCPV40HDRS
     116#define IPOPT_COPY              0x80
     117#endif
    103118#define IPOPT_COPIED(o)         ((o)&0x80)
    104119#define IPOPT_CLASS(o)          ((o)&0x60)
     
    119134#define IPOPT_SATID             136             /* satnet id */
    120135#define IPOPT_SSRR              137             /* strict source route */
     136#ifndef TCPV40HDRS
     137#define IPOPT_RALERT            148             /* router alert */
     138#endif
    121139
    122140/*
     
    131149 * Time stamp option structure.
    132150 */
     151#pragma pack(1)
    133152struct  ip_timestamp {
    134153        u_char  ipt_code;               /* IPOPT_TS */
     
    151170        } ipt_timestamp;
    152171};
     172#pragma pack()
    153173
    154174/* flag bits for ipt_flg */
    155175#define IPOPT_TS_TSONLY         0               /* timestamps only */
    156176#define IPOPT_TS_TSANDADDR      1               /* timestamps and addresses */
     177#ifdef TCPV40HDRS
     178#define IPOPT_TS_PRESPEC        2               /* specified modules only */
     179#else
    157180#define IPOPT_TS_PRESPEC        3               /* specified modules only */
     181#endif
     182
    158183
    159184/* bits for security (not byte swapped) */
     
    170195 */
    171196#define MAXTTL          255             /* maximum time to live (seconds) */
     197/* This is being defined as TCP_TTL, UDP_TTL etc in tcp_time.h
     198   #define IPDEFTTL        64
     199*/
    172200#define IPFRAGTTL       60              /* time to live for frags, slowhz */
    173201#define IPTTLDEC        1               /* subtracted when forwarding */
     
    175203#define IP_MSS          576             /* default maximum segment size */
    176204
    177 /* hv: this is a new data structure in TCPIPV4; consult IBM's doc for
    178  * details (provided they tell anything about it at all)
    179  */
    180 #ifdef TCPIPV4
     205#ifdef TCPV40HDRS
    181206struct  ipstat {
    182207        long    ips_total;
     
    204229        long    ips_ipInUnknownProtos;
    205230};
    206 #endif
     231#endif /* TCPV40HDRS */
     232
    207233
    208234#endif /* !_NETINET_IP_H_ */
  • trunk/src/emx/include/netinet/ip_icmp.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    11/* Modified for emx by hv 1994
     2 * Modified for gcc/os2 by bird 2003
    23 *
    34 * Copyright (c) 1982, 1986 Regents of the University of California.
     
    4748 * Structure of an icmp header.
    4849 */
     50#pragma pack(1)
    4951struct icmp {
    5052        u_char  icmp_type;              /* type of message, see below */
     
    5961                } ih_idseq;
    6062                int ih_void;
     63#ifndef TCPV40HDRS
     64
     65                /* ICMP_UNREACH_NEEDFRAG -- Path MTU Discovery (RFC1191) */
     66                struct ih_pmtu {
     67                        n_short ipm_void;
     68                        n_short ipm_nextmtu;
     69                } ih_pmtu;
     70#endif
    6171        } icmp_hun;
    6272#define icmp_pptr       icmp_hun.ih_pptr
     
    6575#define icmp_seq        icmp_hun.ih_idseq.icd_seq
    6676#define icmp_void       icmp_hun.ih_void
     77#ifndef TCPV40HDRS
     78#define icmp_pmvoid     icmp_hun.ih_pmtu.ipm_void
     79#define icmp_nextmtu    icmp_hun.ih_pmtu.ipm_nextmtu
     80#endif
    6781        union {
    6882                struct id_ts {
     
    8599#define icmp_data       icmp_dun.id_data
    86100};
     101#pragma pack()
    87102
    88103/*
     
    112127#define         ICMP_UNREACH_NEEDFRAG   4               /* IP_DF caused drop */
    113128#define         ICMP_UNREACH_SRCFAIL    5               /* src route failed */
     129#ifndef TCPV40HDRS
     130#define         ICMP_UNREACH_NET_UNKNOWN 6              /* unknown net */
     131#define         ICMP_UNREACH_HOST_UNKNOWN 7             /* unknown host */
     132#define         ICMP_UNREACH_ISOLATED   8               /* src host isolated */
     133#define         ICMP_UNREACH_NET_PROHIB 9               /* prohibited access */
     134#define         ICMP_UNREACH_HOST_PROHIB 10             /* ditto */
     135#define         ICMP_UNREACH_TOSNET     11              /* bad tos for net */
     136#define         ICMP_UNREACH_TOSHOST    12              /* bad tos for host */
     137#endif
    114138#define ICMP_SOURCEQUENCH       4               /* packet lost, slow down */
    115139#define ICMP_REDIRECT           5               /* shorter route, codes: */
     
    119143#define         ICMP_REDIRECT_TOSHOST   3               /* for tos and host */
    120144#define ICMP_ECHO               8               /* echo service */
     145#ifndef TCPV40HDRS
     146#define ICMP_ROUTERADVERT       9               /* router advertisement */
     147#define ICMP_ROUTERSOLICIT      10              /* router solicitation */
     148#endif
    121149#define ICMP_TIMXCEED           11              /* time exceeded, code: */
    122150#define         ICMP_TIMXCEED_INTRANS   0               /* ttl==0 in transit */
    123151#define         ICMP_TIMXCEED_REASS     1               /* ttl==0 in reass */
    124152#define ICMP_PARAMPROB          12              /* ip header bad */
     153#ifndef TCPV40HDRS
     154#define         ICMP_PARAMPROB_OPTABSENT 1              /* req. opt. absent */
     155#endif
    125156#define ICMP_TSTAMP             13              /* timestamp request */
    126157#define ICMP_TSTAMPREPLY        14              /* timestamp reply */
     
    132163#define ICMP_MAXTYPE            18
    133164
     165#ifdef TCPV40HDRS
    134166#define ICMP_INFOTYPE(type) \
    135167        ((type) == ICMP_ECHOREPLY || (type) == ICMP_ECHO || \
     
    137169        (type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || \
    138170        (type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY)
    139 
    140 /* hv: this is a new TCPIPV4 data structure. Consult IBM's doc on that. */
    141 #ifdef TCPIPV4
     171#else
     172#define ICMP_INFOTYPE(type) \
     173        ((type) == ICMP_ECHOREPLY || (type) == ICMP_ECHO || \
     174        (type) == ICMP_ROUTERADVERT || (type) == ICMP_ROUTERSOLICIT || \
     175        (type) == ICMP_TSTAMP || (type) == ICMP_TSTAMPREPLY || \
     176        (type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || \
     177        (type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY)
     178#endif
     179
     180#ifdef TCPV40HDRS
     181#pragma pack(1)
    142182struct  icmpstat {
     183/* statistics related to icmp packets generated */
    143184        short   icps_error;
    144185        short   icps_oldshort;
    145186        short   icps_oldicmp;
    146187        short   icps_outhist[ICMP_MAXTYPE + 1];
     188/* statistics related to input messages processed */
    147189        short   icps_badcode;
    148190        short   icps_tooshort;
     
    177219        u_long  icps_OutAddrMaskReps;
    178220};
     221#pragma pack()
    179222#endif
    180223
  • trunk/src/emx/include/netinet/ip_mroute.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    5959 * Multicast Routing set/getsockopt commands.
    6060 */
     61#if 1 /* not on OS/2 - but let's include it anyway. */
    6162#define MRT_INIT        100     /* initialize forwarder */
    6263#define MRT_DONE        101     /* shut down forwarder */
    6364#define MRT_ADD_VIF     102     /* create virtual interface */
    6465#define MRT_DEL_VIF     103     /* delete virtual interface */
    65 #if 0 /* different on OS/2 */
    6666#define MRT_ADD_MFC     104     /* insert forwarding cache entry */
    6767#define MRT_DEL_MFC     105     /* delete forwarding cache entry */
    6868#define MRT_VERSION     106     /* get kernel version number */
    6969#define MRT_ASSERT      107     /* enable PIM assert processing */
     70#if 0
    7071#define GET_TIME(t)     microtime(&t)
    71 #else /* OS2: */
     72#endif
     73#endif
     74
     75
     76#if 1 /* OS2 only? It's aliases of the above defs it seems... */
     77/*
     78 * DVMRP-specific setsockopt commands.
     79 */
     80#define DVMRP_INIT      100
     81#define DVMRP_DONE      101
     82#define DVMRP_ADD_VIF   102
     83#define DVMRP_DEL_VIF   103
    7284#define DVMRP_ADD_LGRP  104
    7385#define DVMRP_DEL_LGRP  105
     
    105117        u_char  vifc_flags;             /* VIFF_ flags defined below */
    106118        u_char  vifc_threshold;         /* min ttl required to forward on vif */
     119#if 0 /* not on OS/2 */
    107120        u_int   vifc_rate_limit;        /* max rate */
     121#endif
    108122        struct  in_addr vifc_lcl_addr;  /* local interface address */
    109123        struct  in_addr vifc_rmt_addr;  /* remote address (tunnels only) */
  • trunk/src/emx/include/netinet/ip_var.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    9090#pragma pack()
    9191
    92 #if 0 /* different/not on OS/2 */
     92
    9393/*
    9494 * Structure stored in mbuf in inpcb.ip_options
     
    9797 * is in m_len.
    9898 */
     99#define MAX_IPOPTLEN    40
     100#if 0 /* different/not on OS/2 */
    99101struct ipoption {
    100102        struct  in_addr ipopt_dst;      /* first-hop dst if source routed */
  • trunk/src/emx/include/netinet/tcp.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    11/* Modified for emx by hv 1996
     2 * Modified for gcc/os2 by bird 2003
    23 *
    34 * Copyright (c) 1982, 1986 Regents of the University of California.
     
    4647 * Per RFC 793, September, 1981.
    4748 */
     49#pragma pack(1)
    4850struct tcphdr {
    4951        u_short th_sport;               /* source port */
     
    5153        tcp_seq th_seq;                 /* sequence number */
    5254        tcp_seq th_ack;                 /* acknowledgement number */
     55#ifdef TCPV40HDRS
     56#if BYTE_ORDER == LITTLE_ENDIAN
     57        u_int   th_x2:4,                /* (unused) */
     58                th_off:4,               /* data offset */
     59                th_flags:8,
     60                th_win:16;
     61#endif
     62#if BYTE_ORDER == BIG_ENDIAN
     63        u_int   th_win:16,
     64                th_flags:8,
     65                th_off:4,               /* data offset */
     66                th_x2:4;                /* (unused) */
     67#endif
     68#define TH_FIN  0x01
     69#define TH_SYN  0x02
     70#define TH_RST  0x04
     71#define TH_PUSH 0x08
     72#define TH_ACK  0x10
     73#define TH_URG  0x20
     74#else
    5375#if BYTE_ORDER == LITTLE_ENDIAN
    5476        u_char  th_x2:4,                /* (unused) */
     
    6789#define TH_URG  0x20
    6890        u_short th_win;                 /* window */
     91#endif
    6992        u_short th_sum;                 /* checksum */
    7093        u_short th_urp;                 /* urgent pointer */
    7194};
     95#pragma pack()
    7296
    7397#define TCPOPT_EOL      0
    7498#define TCPOPT_NOP      1
    7599#define TCPOPT_MAXSEG   2
     100#ifndef TCPV40HDRS
     101#define    TCPOLEN_MAXSEG               4
     102#define TCPOPT_WINDOW           3
     103#define    TCPOLEN_WINDOW               3
     104#define TCPOPT_SACK_PERMITTED   4               /* Experimental */
     105#define    TCPOLEN_SACK_PERMITTED       2
     106#define TCPOPT_SACK             5               /* Experimental */
     107#define TCPOPT_TIMESTAMP        8
     108#define    TCPOLEN_TIMESTAMP            10
     109#define    TCPOLEN_TSTAMP_APPA          (TCPOLEN_TIMESTAMP+2) /* appendix A */
     110
     111#define TCPOPT_CC               11              /* CC options: RFC-1644 */
     112#define TCPOPT_CCNEW            12
     113#define TCPOPT_CCECHO           13
     114#define    TCPOLEN_CC                   6
     115#define    TCPOLEN_CC_APPA              (TCPOLEN_CC+2)
     116#define    TCPOPT_CC_HDR(ccopt)         \
     117    (TCPOPT_NOP<<24|TCPOPT_NOP<<16|(ccopt)<<8|TCPOLEN_CC)
     118#define TTCP_CLIENT_SND_WND   4096 /* dflt send window of ttcp client */
     119#define TCPOPT_TSTAMP_HDR       \
     120    (TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP)
     121#endif /*!TCPV40HDRS*/
    76122
    77123/*
     
    81127 * This should be defined as MIN(512, IP_MSS - sizeof (struct tcpiphdr)).
    82128 */
     129#ifdef TCPV40HDRS
     130#ifdef  lint
     131#define TCP_MSS 536
     132#else
     133#ifndef IP_MSS
     134#define IP_MSS  576
     135#endif
     136#define TCP_MSS MIN(512, IP_MSS - 40)
     137#endif
     138#else /* TCPV40HDRS*/
    83139#define TCP_MSS 512
     140#endif
    84141
    85142#define TCP_MAXWIN      65535           /* largest value for window */
     143
     144#ifndef TCPV40HDRS
     145#define TCP_MAX_WINSHIFT        14      /* maximum window shift */
     146#endif
    86147
    87148/*
     
    90151#define TCP_NODELAY     0x01    /* don't delay send to coalesce packets */
    91152#define TCP_MAXSEG      0x02    /* set maximum segment size */
     153#ifndef TCPV40HDRS
     154#define TCP_MSL         0x03    /* MSL HACK */
     155#define TCP_TIMESTMP    0x04    /* RFC 1323 (RTTM TimeStamp)   */
     156#define TCP_WINSCALE    0x05    /* RFC 1323 (Window Scale)     */
     157#define TCP_CC          0x06    /* RFC 1644 (Connection Count) */
     158#ifdef VEGAS
     159#define TCP_TAHOE                       3
     160#define TCP_RENO                        4
     161#define TCP_VEGAS                       5
     162#define TCP_VEGAS_SPIKE_ON              6
     163#define TCP_VEGAS_EXP_INC_OFF           7
     164#define TCP_VEGAS_CONG_DETECT_OFF       8
     165#define TCP_VEGAS_24                    9
     166#define TCP_VEGAS_CONG_DETECT_PRED_ON   10
     167#endif
     168#endif /*!TCPV40HDS*/
    92169
    93 /* hv: this is a new data structure in TCPIPV4. */
    94 #ifdef TCPIPV4
     170#ifdef TCPV40HDRS
    95171#include <netinet/tcp_var.h>
    96172#endif
  • trunk/src/emx/include/netinet/tcp_var.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    11/* Modified for emx by hv 1996
    2  * 
     2 *
    33 * Copyright (c) 1982, 1986 Regents of the University of California.
    44 * All rights reserved.
     
    4444 * but that's inconvenient at the moment.
    4545 */
    46 #ifdef TCPIPCV4
    4746struct  tcpstat {
    4847        u_long  tcps_connattempt;       /* connections initiated */
     
    7271        u_long  tcps_sndwinup;          /* window update-only packets sent */
    7372        u_long  tcps_sndctrl;           /* control (SYN|FIN|RST) packets sent */
     73        u_long  tcps_sndrst;            /* RST packets sent, MIB II ... */
    7474
    7575        u_long  tcps_rcvtotal;          /* total packets received */
     
    9494        u_long  tcps_rcvackbyte;        /* bytes acked by rcvd acks */
    9595        u_long  tcps_rcvwinupd;         /* rcvd window update packets */
     96#ifndef TCPV40HDRS
     97        u_long  tcps_pawsdrop;          /* segments dropped due to PAWS */
     98        u_long  tcps_predack;           /* times hdr predict ok for acks */
     99        u_long  tcps_preddat;           /* times hdr predict ok for data pkts*/
     100        u_long  tcps_pcbcachemiss;
     101        u_long  tcps_persistdrop;       /* timeout in persist state */
     102        u_long  tcps_badsyn;            /* bogus SYN, e.g. premature ACK */
     103
     104        /* the fillowing 7 are for mtudisco and ttcp */
     105
     106        u_long  tcps_mturesent;         /* resends due to MTU discovery */
     107        u_long  tcps_cachedrtt;         /* times cached RTT in route updated */
     108        u_long  tcps_cachedrttvar;      /* times cached rttvar updated */
     109        u_long  tcps_cachedssthresh;    /* times cached ssthresh updated */
     110        u_long  tcps_usedrtt;           /* times RTT initialized from route */
     111        u_long  tcps_usedrttvar;        /* times RTTVAR initialized from rt */
     112        u_long  tcps_usedssthresh;      /* times ssthresh initialized from rt*/
     113#endif
    96114};
    97 #endif
     115
     116#ifndef TCPV40HDRS
     117/*
     118 * Names for TCP sysctl objects
     119 */
     120#define TCPCTL_MSSDFLT          1       /* MSS default */
     121#define TCPCTL_STATS            2       /* statistics (read-only) */
     122#define TCPCTL_RTTDFLT          3       /* default RTT estimate */
     123#define TCPCTL_MSL              4       /* No Of Keepalive probes */
     124#define TCPCTL_INETCFG          6       /* Generic TCP Inetcfg switching */
     125#define TCPCTL_LINGERTIME       7       /* Linger On close timer */
     126#define TCPCTL_KEEPCNT          8       /* No Of Keepalive probes */
     127#define TCPCTL_TCPSWIN          9       /* TCP Send Window Size    */
     128#define TCPCTL_TCPRWIN          10      /* TCP Recieve Window Size */
     129#define TCPCTL_TTL              11      /* TTL for TCP  packets */
     130#define TCPCTL_MTU              12      /* Path MTU Discovery ON/OFF flg */
     131#define TCPCTL_WINSCALE         13      /* Winow Scale (Fat Pipe) ON/OFF flg */
     132#define TCPCTL_TIMESTMP         14      /* TCP TimeStamp ON/OFF flg */
     133#define TCPCTL_CC               15      /* Cc, CCnew & Echo ON/OFF flg */
     134#define TCPCTL_REALSLOW         16      /* Real Slow Timer for Time Wait Q */
     135#define TCPCTL_REUSETW          17      /* Reuse TW inetcfg */
     136#define TCPCTL_SYNCOOKIE        18      /* Syncookie inetcfg */
     137#define TCPCTL_PERFHTTP        19      /* Fast Path HTTP */
     138
     139
     140/*Inetcfg ioctl constants */
     141#define ICFG_SETKEEPALIVE       20      /* sysctl code:Set the KeepAlive timer */
     142#define ICFG_GETKEEPALIVE       21      /* sysctl code:Get the KeepAlive timer defaults */
     143
     144#define TCPCTL_NAMES { \
     145        { 0, 0 }, \
     146        { "mssdflt", CTLTYPE_INT },    \
     147        { "stats",   CTLTYPE_STRUCT }, \
     148        { "rttdflt", CTLTYPE_INT },    \
     149        { "inetcfg", CTLTYPE_INETCFG },\
     150}
     151#endif /* !TCPV40HDRS */
    98152
    99153#endif /* !_NETINET_TCP_VAR_H_ */
  • trunk/src/emx/include/netinet/udp.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    11/* Modified for emx by hv 1996
     2 * Modified for gcc/os2 by bird 2003
    23 *
    34 * Copyright (c) 1982, 1986 Regents of the University of California.
     
    3940#define _NETINET_UDP_H_
    4041
     42#ifdef TCPV40HDRS
     43#include <netinet/udp_var.h>
     44#else
    4145/*
    4246 * Udp protocol header.
    4347 * Per RFC 768, September, 1981.
    4448 */
     49#pragma pack(1)
    4550struct udphdr {
    4651        u_short uh_sport;               /* source port */
     
    4954        u_short uh_sum;                 /* udp checksum */
    5055};
    51 
    52 /* hv: this is a new structure of TCPIPV4. Consult IBM's docs on that */
    53 #ifdef TCPIPV4
    54 #include <netinet/udp_var.h>
    55 struct  udpstat {
    56         u_long  udps_hdrops;
    57         u_long  udps_badsum;
    58         u_long  udps_badlen;
    59         u_long  udps_udpInDatagrams;
    60         u_long  udps_udpNoPorts;
    61         u_long  udps_udpOutDatagrams;
    62 };
     56#pragma pack()
    6357#endif
    6458
  • trunk/src/emx/include/netinet/udp_var.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    11/* Modified for emx by hv 1996
    2  *
     2 * Modified for gcc/os2 by bird 2003
     3 *
    34 * Copyright (c) 1982, 1986, 1989 Regents of the University of California.
    45 * All rights reserved.
     
    3940#define _NETINET_UDP_VAR_H_
    4041
    41 #ifdef TCPIPV4
    42 struct  udpstat {
    43                                 /* input statistics: */
    44 #ifndef __EMX__
    45         u_long  udps_ipackets;          /* total input packets */
    46 #endif
    47         u_long  udps_hdrops;            /* packet shorter than header */
    48         u_long  udps_badsum;            /* checksum error */
    49         u_long  udps_badlen;            /* data length larger than packet */
    50 #ifndef __EMX__
    51         u_long  udps_noport;            /* no socket on port */
    52         u_long  udps_noportbcast;       /* of above, arrived as broadcast */
    53         u_long  udps_fullsock;          /* not delivered, input socket full */
    54         u_long  udpps_pcbcachemiss;     /* input packets missing pcb cache */
    55                                         /* output statistics: */
    56         u_long  udps_opackets;          /* total output packets */
    57 #else /* __EMX__ */
     42#ifdef TCPV40HDRS
     43struct  udpstat {
     44        u_long  udps_hdrops;
     45        u_long  udps_badsum;
     46        u_long  udps_badlen;
    5847        u_long  udps_udpInDatagrams;
    5948        u_long  udps_udpNoPorts;
    6049        u_long  udps_udpOutDatagrams;
    61 #endif /* __EMX__ */
    6250};
    63 #endif /* TCPIPV4 */
    6451
    65 #define UDP_TTL         30      /* default time to live for UDP packets */
     52#else
     53
     54/*
     55 * UDP kernel structures and variables.
     56 */
     57#pragma pack(1)
     58struct  udpiphdr {
     59        struct  ipovly ui_i;            /* overlaid ip structure */
     60        struct  udphdr ui_u;            /* udp header */
     61};
     62#pragma pack()
     63#define ui_next         ui_i.ih_next
     64#define ui_prev         ui_i.ih_prev
     65#define ui_x1           ui_i.ih_x1
     66#define ui_pr           ui_i.ih_pr
     67#define ui_len          ui_i.ih_len
     68#define ui_src          ui_i.ih_src
     69#define ui_dst          ui_i.ih_dst
     70#define ui_sport        ui_u.uh_sport
     71#define ui_dport        ui_u.uh_dport
     72#define ui_ulen         ui_u.uh_ulen
     73#define ui_sum          ui_u.uh_sum
     74
     75struct  udpstat {
     76                                /* input statistics: */
     77        u_long  udps_ipackets;          /* total input packets */
     78        u_long  udps_hdrops;            /* packet shorter than header */
     79        u_long  udps_badsum;            /* checksum error */
     80        u_long  udps_badlen;            /* data length larger than packet */
     81        u_long  udps_noport;            /* no socket on port */
     82        u_long  udps_noportbcast;       /* of above, arrived as broadcast */
     83        u_long  udps_fullsock;          /* not delivered, input socket full */
     84        u_long  udpps_pcbcachemiss;     /* input packets missing pcb cache */
     85                                /* output statistics: */
     86        u_long  udps_opackets;          /* total output packets */
     87};
     88
     89/*
     90 * Names for UDP sysctl objects
     91 */
     92#define UDPCTL_CHECKSUM         1       /* checksum UDP packets */
     93#define UDPCTL_STATS            2       /* statistics (read-only) */
     94#define UDPCTL_INETCFG          31      /* sysctl code-Generic UDP Inetcfg switching */
     95#define UDPCTL_TTL              32      /* sysctl code-TTL for UDP  packets */
     96#define UDPCTL_UDPSWIN          33      /* sysctl code-UDP really MAX datagram Size */
     97#define UDPCTL_UDPRWIN          34      /* sysctl code-UDP recieve window size */
     98
     99#define UDPCTL_NAMES { \
     100        { 0, 0 }, \
     101        { "stats", CTLTYPE_STRUCT }, \
     102        { "inetcfg",CTLTYPE_INETCFG},\
     103}
     104
     105#endif /* TCPV40HDRS */
    66106
    67107#endif /* !_NETINET_UDP_VAR_H_ */
  • trunk/src/emx/include/netnb/nb.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    1212
    1313#define NBPROTO_NB      1
    14 #define NB_FAMILY       AF_NETBIOS
     14#define NB_FAMILY       18 /* temporary hack? */
    1515#define NB_ADDRSIZE     sizeof(struct sockaddr_nb)
    1616#define NB_UNIQUE       0
     
    2020#define NB_NETIDLEN     8
    2121#define NB_HOSTLEN      12
    22 #define NB_PORTLEN      4
     22#define NB_PORTLEN      (NB_NAMELEN - NB_HOSTLEN)
    2323/*                       1234567890123456 */
    2424#define NB_BCAST_NAME   "*               "
     
    2626#define NB_NULL_NAME    "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
    2727
    28 #define NBPORT_RESERVED IPPORT_RESERVED
    29 #define NBPORT_USERRESERVED IPPORT_USERRESERVED
     28/* must match IOPORT_* constants in netinet/in.h! */
     29#ifdef TCPV40HDRS
     30#define NBPORT_RESERVED         "1024"
     31#define NBPORT_USERRESERVED     "5000"
     32#else
     33#define NBPORT_RESERVED         "49152"
     34#define NBPORT_USERRESERVED     "65535"
     35#endif
    3036
    3137/* address format for netbios */
     38#pragma pack(1)
    3239struct sockaddr_nb {
     40#ifdef TCPV40HDRS
    3341        short   snb_family;             /* protocol family */
     42#else
     43        u_char  snb_len;
     44        u_char  snb_family;             /* netbios protocol family */
     45#endif
    3446        short   snb_type;               /* unique/multicast */
    3547        char    snb_netid[NB_NETIDLEN]; /* netid */
    3648        char    snb_name[NB_NAMELEN];   /* name */
    3749};
     50#pragma pack()
    3851
    3952#endif /* !_NETNB_NB_H_ */
  • trunk/src/emx/include/resolv.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    11/* Modified for EMX by hv 1994,1996
     2 * Modified for gcc by bird 2003
    23 *
    34 * Copyright (c) 1983, 1987, 1989 The Regents of the University of California.
     
    3334 *
    3435 *      from: @(#)resolv.h      5.15 (Berkeley) 4/3/91
    35  *      resolv.h,v 1.1 2003/04/16 15:53:07 bird Exp
     36 *      resolv.h,v 1.2 2003/05/19 02:41:00 bird Exp
    3637 */
    3738
     
    3940#define _RESOLV_H_
    4041
     42
    4143#if defined (__cplusplus)
    4244extern "C" {
    4345#endif
    4446
    45 #pragma pack(4)
     47/* toolkit includes a bunch of headers */
     48#ifndef TCPV40HDRS
     49#include <sys/param.h>
     50#include <types.h>
     51#include <sys/cdefs.h>
     52#include <stdio.h>
     53
     54
     55/*
     56 * Revision information.  This is the release date in YYYYMMDD format.
     57 * It can change every day so the right thing to do with it is use it
     58 * in preprocessor commands such as "#if (__RES > 19931104)".  Do not
     59 * compare for equality; rather, use it to determine whether your resolver
     60 * is new enough to contain a certain feature.
     61 */
     62
     63#define __RES   19960801
    4664
    4765/*
     
    5270
    5371#ifndef _PATH_RESCONF
    54 #define _PATH_RESCONF        "/tcpip/etc/resolv.conf"
    55 #endif
     72#define _PATH_RESCONF        "/mptn/etc/resolv.conf"
     73#endif
     74#endif /* TCPV40HDRS */
    5675
    5776/*
     
    6079#define MAXNS                   3       /* max # name servers we'll track */
    6180#define MAXDFLSRCH              3       /* # default domain levels to try */
     81#define LOCALDOMAINPARTS        2       /* min levels in name that is "local" */
     82#define RES_TIMEOUT             4       /* min. seconds between retries */
     83#ifdef TCPV40HDRS
     84#define MAXDNSRCH               3       /* max # domains in search path */
     85#else
    6286#define MAXDNSRCH               6       /* max # domains in search path */
    63 #define LOCALDOMAINPARTS        2       /* min levels in name that is "local" */
    64 #define MAXDNSLUS               4       /* max # of host lookup types */
    65 
    66 #define RES_TIMEOUT             5       /* min. seconds between retries */
     87#define MAXRESOLVSORT           10      /* number of net to sort on */
     88#define RES_MAXNDOTS            15      /* should reflect bit field size */
     89#endif
     90
     91
     92#ifdef TCPV40HDRS
    6793
    6894#pragma pack(4)
     
    77103        char    defdname[MAXDNAME];     /* default domain */
    78104        char    *dnsrch[MAXDNSRCH+1];   /* components of domain to search */
    79 /*      char    lookups[MAXDNSLUS];*/   /* not in OS/2 */
    80105};
    81 #pragma pack(1)
     106#pragma pack()
     107
     108#else
     109
     110#pragma pack(4)
     111struct __res_state {
     112        int     retrans;                /* retransmition time interval */
     113        int     retry;                  /* number of times to retransmit */
     114        u_long  options;                /* option flags - see below. */
     115        int     nscount;                /* number of name servers */
     116        struct sockaddr_in
     117                nsaddr_list[MAXNS];     /* address of name server */
     118#define nsaddr  nsaddr_list[0]          /* for backward compatibility */
     119        u_short id;                     /* current message id */
     120        char    defdname[256];          /* default domain (deprecated) */
     121        char    *dnsrch[MAXDNSRCH+1];   /* components of domain to search */
     122        u_long  pfcode;                 /* RES_PRF_ flags - see below. */
     123        unsigned ndots:4;               /* threshold for initial abs. query */
     124        unsigned nsort:4;               /* number of elements in sort_list[] */
     125        char    unused[3];
     126        struct {
     127                struct in_addr  addr;
     128                u_int32_t       mask;
     129        } sort_list[MAXRESOLVSORT];
     130        char    pad[72];                /* on an i386 this means 512b total */
     131};
     132#pragma pack()
     133
     134#endif
    82135
    83136/*
     
    94147#define RES_STAYOPEN    0x0100          /* Keep TCP socket open */
    95148#define RES_DNSRCH      0x0200          /* search up local domain tree */
     149#ifndef TCPV40HDRS
     150#define RES_INSECURE1   0x00000400      /* type 1 security disabled */
     151#define RES_INSECURE2   0x00000800      /* type 2 security disabled */
     152#define RES_NOALIASES   0x00001000      /* shuts off HOSTALIASES feature */
     153#define RES_USE_INET6   0x00002000      /* use/map IPv6 in gethostbyname() */
     154#endif
    96155
    97156#define RES_DEFAULT     (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH)
    98157
     158
     159
     160#ifdef TCPV40HDRS
     161
    99162extern  struct state _res;
    100163
     164#else
     165
     166/*
     167 * Resolver "pfcode" values.  Used by dig.
     168 */
     169#define RES_PRF_STATS   0x00000001
     170/*                      0x00000002      */
     171#define RES_PRF_CLASS   0x00000004
     172#define RES_PRF_CMD     0x00000008
     173#define RES_PRF_QUES    0x00000010
     174#define RES_PRF_ANS     0x00000020
     175#define RES_PRF_AUTH    0x00000040
     176#define RES_PRF_ADD     0x00000080
     177#define RES_PRF_HEAD1   0x00000100
     178#define RES_PRF_HEAD2   0x00000200
     179#define RES_PRF_TTLID   0x00000400
     180#define RES_PRF_HEADX   0x00000800
     181#define RES_PRF_QUERY   0x00001000
     182#define RES_PRF_REPLY   0x00002000
     183#define RES_PRF_INIT    0x00004000
     184/*                      0x00008000      */
     185
     186/* hooks are still experimental as of 4.9.2 */
     187typedef enum { res_goahead, res_nextns, res_modified, res_done, res_error }
     188        res_sendhookact;
     189
     190typedef res_sendhookact (* _System res_send_qhook)(struct sockaddr_in * const *ns,
     191                                              const u_char **query,
     192                                              int *querylen,
     193                                              u_char *ans,
     194                                              int anssiz,
     195                                              int *resplen);
     196
     197typedef res_sendhookact (* _System res_send_rhook)(const struct sockaddr_in *ns,
     198                                              const u_char *query,
     199                                              int querylen,
     200                                              u_char *ans,
     201                                              int anssiz,
     202                                              int *resplen);
     203
     204#pragma pack(4)
     205struct res_sym {
     206        int     number;         /* Identifying number, like T_MX */
     207        char *  name;           /* Its symbolic name, like "MX" */
     208        char *  humanname;      /* Its fun name, like "mail exchanger" */
     209};
     210#pragma pack()
     211
     212extern struct __res_state   _ress[2];
     213extern const struct res_sym __p_class_syms[];
     214extern const struct res_sym __p_type_syms[];
     215#define _res (_ress[0])
     216
    101217/* Private routines shared between libc/net, named, nslookup and others. */
    102 int     dn_skipname (__const__ u_char *, __const__ u_char *);
    103 void    putlong (u_long, u_char *);
    104 void    putshort (u_short, u_char *);
    105 
    106 /* public routines */
    107 int     dn_comp(__const__ u_char *, u_char *, int, u_char **, u_char **);
    108 int     dn_expand(__const__ u_char *, __const__ u_char *, __const__ u_char *,
    109                         u_char *, int);
    110 int     res_init(void);
    111 int     res_mkquery(int, __const__ char *, int, int, __const__ char *, int,
    112                         __const__ struct rrec *, char *, int);
    113 int     res_send(__const__ char *, int, char *, int);
     218#define res_hnok        __res_hnok
     219#define res_ownok       __res_ownok
     220#define res_mailok      __res_mailok
     221#define res_dnok        __res_dnok
     222#define sym_ston        __sym_ston
     223#define sym_ntos        __sym_ntos
     224#define sym_ntop        __sym_ntop
     225#define b64_ntop        __b64_ntop
     226#define b64_pton        __b64_pton
     227#define loc_ntoa        __loc_ntoa
     228#define loc_aton        __loc_aton
     229#define dn_skipname     __dn_skipname
     230#define fp_resstat      __fp_resstat
     231#define fp_query        __fp_query
     232#define fp_nquery       __fp_nquery
     233#define hostalias       __hostalias
     234#define putlong         __putlong
     235#define putshort        __putshort
     236#define p_class         __p_class
     237#define p_time          __p_time
     238#define p_type          __p_type
     239#define p_query         __p_query
     240#define p_cdnname       __p_cdnname
     241#define p_cdname        __p_cdname
     242#define p_fqnname       __p_fqnname
     243#define p_fqname        __p_fqname
     244#define p_rr            __p_rr
     245#define p_option        __p_option
     246#define p_secstodate    __p_secstodate
     247#define dn_count_labels __dn_count_labels
     248#define dn_comp         __dn_comp
     249#define dn_expand       __dn_expand
     250#define res_init        __res_init
     251#define res_randomid    __res_randomid
     252#define res_query       __res_query
     253#define res_search      __res_search
     254#define res_querydomain __res_querydomain
     255#define res_mkquery     __res_mkquery
     256#define res_send        __res_send
     257#define res_isourserver __res_isourserver
     258#define res_nameinquery __res_nameinquery
     259#define res_queriesmatch __res_queriesmatch
     260#define res_close       __res_close
     261
     262int             _System res_hnok(const char *);
     263int             _System res_ownok(const char *);
     264int             _System res_mailok(const char *);
     265int             _System res_dnok(const char *);
     266int             _System sym_ston(const struct res_sym *, char *, int *);
     267const char *    _System sym_ntos(const struct res_sym *, int, int *);
     268const char *    _System sym_ntop(const struct res_sym *, int, int *);
     269int             _System b64_ntop(u_char const *, size_t, char *, size_t);
     270int             _System b64_pton(char const *, u_char *, size_t);
     271int             _System loc_aton(const char *, u_char *);
     272const char *    _System loc_ntoa(const u_char *, char *);
     273int             _System dn_skipname(const u_char *, const u_char *);
     274void            _System fp_resstat(struct __res_state *, int);
     275void            _System fp_query(const u_char *, int);
     276void            _System fp_nquery(const u_char *, int, int);
     277const char *    _System hostalias(const char *);
     278void            _System putlong(u_int32_t, u_char *);
     279void            _System putshort(u_int16_t, u_char *);
     280const char *    _System p_class(int);
     281const char *    _System p_time(u_int32_t);
     282const char *    _System p_type(int);
     283void            _System p_query(const u_char *);
     284const u_char *  _System p_cdnname(const u_char *, const u_char *, int, int);
     285const u_char *  _System p_cdname(const u_char *, const u_char *, int);
     286const u_char *  _System p_fqnname(const u_char *cp, const u_char *msg,
     287                                             int, char *, int);
     288const u_char *  _System p_fqname(const u_char *, const u_char *, int);
     289const u_char *  _System p_rr(const u_char *, const u_char *, int);
     290const char *    _System p_option(u_long option);
     291char *          _System p_secstodate(u_long);
     292int             _System dn_count_labels(char *);
     293int             _System dn_comp(const char *, u_char *, int,
     294                                u_char **, u_char **);
     295int             _System dn_expand(const u_char *, const u_char *, const u_char *,
     296                                  char *, int);
     297int             _System res_init(void);
     298u_int           _System res_randomid(void);
     299int             _System res_query(const char *, int, int, u_char *, int);
     300int             _System res_search(const char *, int, int, u_char *, int);
     301int             _System res_querydomain(const char *, const char *, int, int, u_char *, int);
     302int             _System res_mkquery(int, const char *, int, int, const u_char *, int,
     303                                    const u_char *, u_char *, int);
     304int             _System res_send(const u_char *, int, u_char *, int);
     305int             _System res_isourserver(const struct sockaddr_in *);
     306int             _System res_nameinquery(const char *, int, int,
     307                                        const u_char *, const u_char *);
     308int             _System res_queriesmatch(const u_char *, const u_char *,
     309                                         const u_char *, const u_char *);
     310void            _System res_close(void);
     311int             _System dn_find(u_char *exp_dn, u_char *msg,
     312                               u_char **dnptrs, u_char **lastdnptr);
     313#endif /* !TCPV40HDRS */
     314
    114315
    115316#if defined (__cplusplus)
  • trunk/src/emx/include/socks.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    5151
    5252-----------------------------------------------------------------*/
     53#ifndef _SOCKS_H_
     54#define _SOCKS_H_
    5355#include <netinet\in.h>
    5456
     
    8082} Socks_t;
    8183
     84
    8285typedef struct socksdata {
    8386   /* the following feilds are for socks */
     
    9598   struct sockaddr_in me;
    9699} SD;
    97 
     100#endif
  • trunk/src/emx/include/sys/cdefs.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    1 /*
     1/*- modified for gcc/os2 by bird 2003
     2 *
    23 * Copyright (c) 1991, 1993
    34 *      The Regents of the University of California.  All rights reserved.
     
    3435 * SUCH DAMAGE.
    3536 *
    36  *      @(#)cdefs.h     8.7 (Berkeley) 1/21/94
    37  */
    38 
    39 #ifndef _CDEFS_H_
    40 #define _CDEFS_H_
     37 *      @(#)cdefs.h     8.8 (Berkeley) 1/9/95
     38 * $FreeBSD: src/sys/sys/cdefs.h,v 1.68 2002/10/21 20:50:30 mike Exp $
     39 */
     40
     41#ifndef _SYS_CDEFS_H_
     42#define _SYS_CDEFS_H_
     43#define _CDEFS_H_ /* compatability */
    4144
    4245#if defined(__cplusplus)
    4346#define __BEGIN_DECLS   extern "C" {
    44 #define __END_DECLS     };
     47#define __END_DECLS     }
    4548#else
    4649#define __BEGIN_DECLS
     
    5154 * The __CONCAT macro is used to concatenate parts of symbol names, e.g.
    5255 * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
    53  * The __CONCAT macro is a bit tricky -- make sure you don't put spaces
    54  * in between its arguments.  __CONCAT can also concatenate double-quoted
    55  * strings produced by the __STRING macro, but this only works with ANSI C.
     56 * The __CONCAT macro is a bit tricky to use if it must work in non-ANSI
     57 * mode -- there must be no spaces between its arguments, and for nested
     58 * __CONCAT's, all the __CONCAT's must be at the left.  __CONCAT can also
     59 * concatenate double-quoted strings produced by the __STRING macro, but
     60 * this only works with ANSI C.
     61 *
     62 * __XSTRING is like __STRING, but it expands any macros in its argument
     63 * first.  It is only available with ANSI C.
    5664 */
    5765#if defined(__STDC__) || defined(__cplusplus)
    5866#define __P(protos)     protos          /* full-blown ANSI C */
    59 #define __CONCAT(x,y)   x ## y
    60 #define __STRING(x)     #x
     67#define __CONCAT1(x,y)  x ## y
     68#define __CONCAT(x,y)   __CONCAT1(x,y)
     69#define __STRING(x)     #x              /* stringify without expanding x */
     70#define __XSTRING(x)    __STRING(x)     /* expand x, then stringify */
    6171
    6272#define __const         const           /* define reserved names to standard */
     
    94104#define signed
    95105#define volatile
    96 #endif
     106#endif  /* !NO_ANSI_KEYWORDS */
    97107#endif  /* !__GNUC__ */
    98108#endif  /* !(__STDC__ || __cplusplus) */
    99109
    100110/*
    101  * GCC1 and some versions of GCC2 declare dead (non-returning) and
    102  * pure (no side effects) functions using "volatile" and "const";
    103  * unfortunately, these then cause warnings under "-ansi -pedantic".
    104  * GCC2 uses a new, peculiar __attribute__((attrs)) style.  All of
    105  * these work for GNU C++ (modulo a slight glitch in the C++ grammar
    106  * in the distribution version of 2.5.5).
    107  */
    108 #if !defined(__GNUC__) || __GNUC__ < 2 || __GNUC_MINOR__ < 5
    109 #define __attribute__(x)        /* delete __attribute__ if non-gcc or gcc1 */
    110 #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
    111 #define __dead          __volatile
    112 #define __pure          __const
    113 #endif
    114 #endif
    115 
    116 /* Delete pseudo-keywords wherever they are not available or needed. */
    117 #ifndef __dead
    118 #define __dead
    119 #define __pure
    120 #endif
    121 
    122 #endif /* !_CDEFS_H_ */
     111 * Compiler-dependent macros to help declare dead (non-returning) and
     112 * pure (no side effects) functions, and unused variables.  They are
     113 * null except for versions of gcc that are known to support the features
     114 * properly (old versions of gcc-2 supported the dead and pure features
     115 * in a different (wrong) way).  If we do not provide an implementation
     116 * for a given compiler, let the compile fail if it is told to use
     117 * a feature that we cannot live without.
     118 */
     119#ifdef lint
     120#define __dead2
     121#define __pure2
     122#define __unused
     123#define __packed
     124#define __aligned(x)
     125#define __section(x)
     126#else
     127#if __GNUC__ < 2 || __GNUC__ == 2 && __GNUC_MINOR__ < 5
     128#define __dead2
     129#define __pure2
     130#define __unused
     131#endif
     132#if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 7
     133#define __dead2         __attribute__((__noreturn__))
     134#define __pure2         __attribute__((__const__))
     135#define __unused
     136/* XXX Find out what to do for __packed, __aligned and __section */
     137#endif
     138#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ == 3
     139#define __dead2         __attribute__((__noreturn__))
     140#define __pure2         __attribute__((__const__))
     141#define __unused        __attribute__((__unused__))
     142#define __packed        __attribute__((__packed__))
     143#define __aligned(x)    __attribute__((__aligned__(x)))
     144#define __section(x)    __attribute__((__section__(x)))
     145#endif
     146#endif
     147
     148/* XXX: should use `#if __STDC_VERSION__ < 199901'. */
     149#if !(__GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ >= 3)
     150#define __func__        NULL
     151#endif
     152
     153#if __GNUC__ >= 2 && !defined(__STRICT_ANSI__) || __STDC_VERSION__ >= 199901
     154#define __LONG_LONG_SUPPORTED
     155#endif
     156
     157/*
     158 * GCC 2.95 provides `__restrict' as an extension to C90 to support the
     159 * C99-specific `restrict' type qualifier.  We happen to use `__restrict' as
     160 * a way to define the `restrict' type qualifier without disturbing older
     161 * software that is unaware of C99 keywords.
     162 */
     163#if !(__GNUC__ == 2 && __GNUC_MINOR__ == 95)
     164#if __STDC_VERSION__ < 199901
     165#define __restrict
     166#else
     167#define __restrict      restrict
     168#endif
     169#endif
     170
     171/*
     172 * We define this here since <stddef.h>, <sys/queue.h>, and <sys/types.h>
     173 * require it.
     174 */
     175#define __offsetof(type, field) ((size_t)(&((type *)0)->field))
     176
     177/*
     178 * Compiler-dependent macros to declare that functions take printf-like
     179 * or scanf-like arguments.  They are null except for versions of gcc
     180 * that are known to support the features properly (old versions of gcc-2
     181 * didn't permit keeping the keywords out of the application namespace).
     182 */
     183#if __GNUC__ < 2 || __GNUC__ == 2 && __GNUC_MINOR__ < 7
     184#define __printflike(fmtarg, firstvararg)
     185#define __scanflike(fmtarg, firstvararg)
     186#else
     187#define __printflike(fmtarg, firstvararg) \
     188            __attribute__((__format__ (__printf__, fmtarg, firstvararg)))
     189#define __scanflike(fmtarg, firstvararg) \
     190            __attribute__((__format__ (__scanf__, fmtarg, firstvararg)))
     191#endif
     192
     193/* Compiler-dependent macros that rely on FreeBSD-specific extensions. */
     194#if __FreeBSD_cc_version >= 300001 && __FreeBSD_cc_version < 500003
     195#define __printf0like(fmtarg, firstvararg) \
     196            __attribute__((__format__ (__printf0__, fmtarg, firstvararg)))
     197#else
     198#define __printf0like(fmtarg, firstvararg)
     199#endif
     200
     201#if 0 /* def __GNUC__ - ELF specific, so skip everything */
     202#define __strong_reference(sym,aliassym)        \
     203        extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym)));
     204#ifdef __STDC__
     205#define __weak_reference(sym,alias)     \
     206        __asm__(".weak " #alias);       \
     207        __asm__(".equ "  #alias ", " #sym)
     208#define __warn_references(sym,msg)      \
     209        __asm__(".section .gnu.warning." #sym); \
     210        __asm__(".asciz \"" msg "\"");  \
     211        __asm__(".previous")
     212#else
     213#define __weak_reference(sym,alias)     \
     214        __asm__(".weak alias");         \
     215        __asm__(".equ alias, sym")
     216#define __warn_references(sym,msg)      \
     217        __asm__(".section .gnu.warning.sym"); \
     218        __asm__(".asciz \"msg\"");      \
     219        __asm__(".previous")
     220#endif  /* __STDC__ */
     221#endif  /* __GNUC__ */
     222
     223#if 0 /*def __GNUC__ - ELF specific. */
     224#define __IDSTRING(name,string) __asm__(".ident\t\"" string "\"")
     225#else
     226/*
     227 * This doesn't work in header files. But it may be better than nothing.
     228 * The alternative is: #define __IDSTRING(name,string)  [nothing]
     229 */
     230#define __IDSTRING(name,string) static const char name[] __unused = string
     231#endif
     232
     233/*
     234 * Embed the rcs id of a source file in the resulting library.  Note that in
     235 * more recent ELF binutils, we use .ident allowing the ID to be stripped.
     236 * Usage:
     237 *      __FBSDID("$FreeBSD: src/sys/sys/cdefs.h,v 1.68 2002/10/21 20:50:30 mike Exp $");
     238 */
     239#ifndef __FBSDID
     240#if !defined(lint) && !defined(STRIP_FBSDID)
     241#define __FBSDID(s)     __IDSTRING(__CONCAT(__rcsid_,__LINE__),s)
     242#else
     243#define __FBSDID(s)     struct __hack
     244#endif
     245#endif
     246
     247#ifndef __RCSID
     248#ifndef NO__RCSID
     249#define __RCSID(s)      __IDSTRING(__CONCAT(__rcsid_,__LINE__),s)
     250#else
     251#define __RCSID(s)
     252#endif
     253#endif
     254
     255#ifndef __RCSID_SOURCE
     256#ifndef NO__RCSID_SOURCE
     257#define __RCSID_SOURCE(s)       __IDSTRING(__CONCAT(__rcsid_source_,__LINE__),s)
     258#else
     259#define __RCSID_SOURCE(s)
     260#endif
     261#endif
     262
     263#ifndef __SCCSID
     264#ifndef NO__SCCSID
     265#define __SCCSID(s)     __IDSTRING(__CONCAT(__sccsid_,__LINE__),s)
     266#else
     267#define __SCCSID(s)
     268#endif
     269#endif
     270
     271#ifndef __COPYRIGHT
     272#ifndef NO__COPYRIGHT
     273#define __COPYRIGHT(s)  __IDSTRING(__CONCAT(__copyright_,__LINE__),s)
     274#else
     275#define __COPYRIGHT(s)
     276#endif
     277#endif
     278
     279#ifndef __DECONST
     280#define __DECONST(type, var)    ((type)(uintptr_t)(const void *)(var))
     281#endif
     282
     283#ifndef __DEVOLATILE
     284#define __DEVOLATILE(type, var) ((type)(uintptr_t)(volatile void *)(var))
     285#endif
     286
     287#ifndef __DEQUALIFY
     288#define __DEQUALIFY(type, var)  ((type)(uintptr_t)(const volatile void *)(var))
     289#endif
     290
     291/*-
     292 * The following definitions are an extension of the behavior originally
     293 * implemented in <sys/_posix.h>, but with a different level of granularity.
     294 * POSIX.1 requires that the macros we test be defined before any standard
     295 * header file is included.
     296 *
     297 * Here's a quick run-down of the versions:
     298 *  defined(_POSIX_SOURCE)              1003.1-1988
     299 *  _POSIX_C_SOURCE == 1                1003.1-1990
     300 *  _POSIX_C_SOURCE == 2                1003.2-1992 C Language Binding Option
     301 *  _POSIX_C_SOURCE == 199309           1003.1b-1993
     302 *  _POSIX_C_SOURCE == 199506           1003.1c-1995, 1003.1i-1995,
     303 *                                      and the omnibus ISO/IEC 9945-1: 1996
     304 *  _POSIX_C_SOURCE == 200112           1003.1-2001
     305 *
     306 * In addition, the X/Open Portability Guide, which is now the Single UNIX
     307 * Specification, defines a feature-test macro which indicates the version of
     308 * that specification, and which subsumes _POSIX_C_SOURCE.
     309 *
     310 * Our macros begin with two underscores to avoid namespace screwage.
     311 */
     312
     313/* Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. */
     314#if _POSIX_C_SOURCE == 1
     315#undef _POSIX_C_SOURCE          /* Probably illegal, but beyond caring now. */
     316#define _POSIX_C_SOURCE         199009
     317#endif
     318
     319/* Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2. */
     320#if _POSIX_C_SOURCE == 2
     321#undef _POSIX_C_SOURCE
     322#define _POSIX_C_SOURCE         199209
     323#endif
     324
     325/* Deal with various X/Open Portability Guides and Single UNIX Spec. */
     326#ifdef _XOPEN_SOURCE
     327#if _XOPEN_SOURCE - 0 >= 600
     328#define __XSI_VISIBLE           600
     329#undef _POSIX_C_SOURCE
     330#define _POSIX_C_SOURCE         200112
     331#elif _XOPEN_SOURCE - 0 >= 500
     332#define __XSI_VISIBLE           500
     333#undef _POSIX_C_SOURCE
     334#define _POSIX_C_SOURCE         199506
     335#endif
     336#endif
     337
     338/*
     339 * Deal with all versions of POSIX.  The ordering relative to the tests above is
     340 * important.
     341 */
     342#if defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE)
     343#define _POSIX_C_SOURCE         198808
     344#endif
     345#ifdef _POSIX_C_SOURCE
     346#if _POSIX_C_SOURCE >= 200112
     347#define __POSIX_VISIBLE         200112
     348#define __ISO_C_VISIBLE         1999
     349#elif _POSIX_C_SOURCE >= 199506
     350#define __POSIX_VISIBLE         199506
     351#define __ISO_C_VISIBLE         1990
     352#elif _POSIX_C_SOURCE >= 199309
     353#define __POSIX_VISIBLE         199309
     354#define __ISO_C_VISIBLE         1990
     355#elif _POSIX_C_SOURCE >= 199209
     356#define __POSIX_VISIBLE         199209
     357#define __ISO_C_VISIBLE         1990
     358#elif _POSIX_C_SOURCE >= 199009
     359#define __POSIX_VISIBLE         199009
     360#define __ISO_C_VISIBLE         1990
     361#else
     362#define __POSIX_VISIBLE         198808
     363#define __ISO_C_VISIBLE         0
     364#endif /* _POSIX_C_SOURCE */
     365#else
     366/*-
     367 * Deal with _ANSI_SOURCE:
     368 * If it is defined, and no other compilation environment is explicitly
     369 * requested, then define our internal feature-test macros to zero.  This
     370 * makes no difference to the preprocessor (undefined symbols in preprocessing
     371 * expressions are defined to have value zero), but makes it more convenient for
     372 * a test program to print out the values.
     373 *
     374 * If a program mistakenly defines _ANSI_SOURCE and some other macro such as
     375 * _POSIX_C_SOURCE, we will assume that it wants the broader compilation
     376 * environment (and in fact we will never get here).
     377 */
     378#if defined(_ANSI_SOURCE)       /* Hide almost everything. */
     379#define __POSIX_VISIBLE         0
     380#define __XSI_VISIBLE           0
     381#define __BSD_VISIBLE           0
     382#define __ISO_C_VISIBLE         1990
     383#elif defined(_C99_SOURCE)      /* Localism to specify strict C99 env. */
     384#define __POSIX_VISIBLE         0
     385#define __XSI_VISIBLE           0
     386#define __BSD_VISIBLE           0
     387#define __ISO_C_VISIBLE         1999
     388#else                           /* Default environment: show everything. */
     389#define __POSIX_VISIBLE         200112
     390#define __XSI_VISIBLE           600
     391#define __BSD_VISIBLE           1
     392#define __ISO_C_VISIBLE         1999
     393#endif
     394#endif
     395
     396/* toolkit pollution */
     397#define __TCPPROTO(args) __P(args)
     398
     399#endif /* !_SYS_CDEFS_H_ */
  • trunk/src/emx/include/sys/ioctl.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    88#endif
    99
    10 #if defined (_EMX_TCPIP)
    11 #include <sys/so_ioctl.h>
    12 #endif
     10#include <sys/ioccom.h>
     11#include <sys/sockio.h>
     12#include <sys/filio.h>
    1313
    1414#if !defined (TCGETA)
     
    2626#define _TCSADRAIN  10          /* Used internally for tcsetattr() */
    2727#define _TCSAFLUSH  11          /* Used internally for tcsetattr() */
    28 
    29 #if !defined (FIONREAD)
    30 #define FIONREAD   16
    31 #endif
    3228
    3329#if !defined (FGETHTYPE)
     
    4743#endif
    4844
    49 int ioctl (int, int, ...);
    50 
    51 int _ioctl (int, int, ...);
    52 
    5345#if defined (__cplusplus)
    5446}
  • trunk/src/emx/include/sys/param.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    1 /* sys/param.h (emx+gcc) */
     1/** @file sys/param.h
     2 * BSD like sys\param.h file.
     3 *
     4 * TCPV40HDRS does include this file, but as we don't need to be
     5 * 100% compatible we don't care.
     6 */
    27
    38#ifndef _SYS_PARAM_H
    49#define _SYS_PARAM_H
     10#define _SYS_PARAM_H_ /* toolkit */
    511
    612#if defined (__cplusplus)
     
    814#endif
    915
    10 #if !defined (PAGE_SIZE)
    11 #define PAGE_SIZE 0x1000
     16
     17#if !defined (NULL)
     18#if defined (__cplusplus)
     19#define NULL    0
     20#else
     21#define NULL    ((void*)0)
     22#endif
    1223#endif
    1324
    14 #if !defined (HZ)
     25
     26/** @group BSD version defines.
     27 * OS2: The toolkit headers define these. Resent FreeBSD release does too.
     28 * Warning! Be aware that config scripts and programs may check for these and
     29 *          assume they're running on BSD. We might have to take out these
     30 *          defines.
     31 * @{
     32 */
     33/** System version - year and month */
     34#ifdef TCPV40HDRS
     35#define BSD     43
     36#else
     37#define BSD     199506
     38#endif
     39#ifndef TCPV40HDRS
     40/** Indicate BSD4.3 features present. */
     41#define BSD4_3  1
     42/** Indicate BSD4.4 features present. */
     43#define BSD4_4  1
     44#endif
     45/** @} */
     46
     47
     48#ifndef LOCORE
     49#include <types.h>
     50#endif
     51#include <sys/syslimits.h>
     52#include <sys/signal.h>
     53#include <machine/param.h>
     54#include <machine/limits.h>
     55
     56
     57/** @group  System Parameters (BSD flavored)
     58 *
     59 * @{ */
     60#ifndef MAXCOMLEN
     61/** Max command name remembered. */
     62#define MAXCOMLEN       19
     63#endif
     64
     65#ifndef MAXINTERP
     66/** Max interpreter file name length (ELF?).
     67 * OS2: Have no meaning. */
     68#define MAXINTERP       12
     69#endif
     70
     71#ifndef MAXLOGNAME
     72/** Max login name length including terminating NULL. */
     73#define MAXLOGNAME      LOGIN_NAME_MAX
     74#endif
     75
     76#ifndef MAXUPRC
     77/** Maximum simultaneous processes. */
     78#define MAXUPRC         CHILD_MAX
     79#endif
     80
     81#ifndef NCARGS
     82/** Max argument size for an exec function.
     83 * OS2: Assuming at least 4KB of environment gives us 0xf000 at the very best.
     84 *      However we set it to 32KB which should be a safe max. */
     85#define NCARGS          ARG_MAX
     86#endif
     87#ifndef NGROUPS
     88/** Max supplemental group id's.
     89 * OS2: doesn't make much sens just set it high. */
     90#define NGROUPS         NGROUPS_MAX
     91#endif
     92
     93#ifndef NOFILE
     94/** Max number of open files per process.
     95 * OS2: Using DosSetMaxFH the theoretical maximum should be 0xfff0 I believe.
     96 */
     97#define NOFILE          OPEN_MAX
     98#endif
     99
     100#ifndef NOGROUP
     101/** Marker for empty group set member.
     102 * OS2: no meaning currently. */
     103#define NOGROUP         0xffff
     104#endif
     105
     106#ifndef MAXHOSTNAMELEN
     107/** Max number of bytes in a hostname. */
     108#define MAXHOSTNAMELEN  256
     109#endif
     110
     111#ifndef SPECNAMELEN
     112/** Max number of bytes in a devicename.
     113 * OS2: no real meaning. */
     114#define SPECNAMELEN     16
     115#endif
     116
     117#ifndef MAXNAMLEN
     118/** Max number of chars in a file name.
     119 * BSD name for posix NAME_MAX. */
     120#define MAXNAMLEN       NAME_MAX
     121#endif
     122
     123#ifndef MAXPATHLEN
     124/** Max number of chars in a path name.
     125 * BSD name for posix PATH_MAX.
     126 * @remark Very strict BSD kernel/user code may expect it to be a number which
     127 *         is the power of two an. The OS/2 number is not a power of 2. */
     128#define MAXPATHLEN      PATH_MAX
     129#endif
     130/** @} */
     131
     132
     133/** @group EMX defines
     134 * @{
     135 */
     136#ifndef HZ
     137/** Frequencey of something but have no clue of what...
     138 * Freebsd isn't defining this, linux is but only for the kernel sources.
     139 * Considered EMX specific. */
    15140#define HZ        100
    16141#endif
     142/** @} */
    17143
    18 #if !defined (MAXNAMLEN)
    19 #define MAXNAMLEN  260
     144
     145/** @group Bitmap Access
     146 * The bitmaps in question is arrays if integer.
     147 * @{ */
     148/** number of bytes in an int */
     149#define NBPW sizeof(int)
     150/** Set a bit in the bitmap */
     151#define setbit(Bitmap,iBit)   ( (Bitmap)[(i)/NBBY] |=   1 << ((i) % NBBY)  )
     152/** Clear a bit in the bitmap */
     153#define clrbit(Bitmap,iBit)   ( (Bitmap)[(i)/NBBY] &= ~(1 << ((i) % NBBY)) )
     154/** Test if a bit in a bitmap is set. */
     155#define isset(Bitmap,iBit)    ( (Bitmap)[(i)/NBBY]  &  (1 << ((i) % NBBY)) )
     156/** Test if a bit in a bitmap is clear. */
     157#define isclr(Bitmap,iBit)    (((Bitmap)[(i)/NBBY]  & 1 << ((i) % NBBY)) == 0 )
     158/** @} */
     159
     160
     161/* Handle flags of some kind... Toolkit defines it here.
     162 * Freebsd headers indicates that these are KERNEL flags, but
     163 * there is a chance one or two tcpip ioctls are using them. */
     164#ifndef _POSIX_SOURCE
     165#define FREAD   1
     166#define FWRITE  2
    20167#endif
    21168
    22 #if !defined (MAXPATHLEN)
    23 #define MAXPATHLEN 260
    24 #endif
    25 
    26 /* Don't try to do this inline for now */
    27 
     169#if 0 /* we don't need it, endian takes care of this */
     170/* Basic byte order conversion (non-inline).
     171 * Note that freebsd only does this when KERNEL is defined. */
    28172#if !defined (htonl)
    29173#define htonl(X) _swapl(X)
     
    32176#define ntohs(X) _swaps(X)
    33177#endif
    34 
    35178unsigned short _swaps (unsigned short _x);
    36179unsigned long _swapl (unsigned long _x);
     180#endif
     181
    37182
    38183#if defined (__cplusplus)
  • trunk/src/emx/include/sys/select.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    33#ifndef _SYS_SELECT_H
    44#define _SYS_SELECT_H
     5#define _SYS_SELECT_H_
    56
    67#if defined (__cplusplus)
     
    89#endif
    910
     11#include <sys/cdefs.h>
     12
     13/** Define sigset_t here for pselect(). */
     14#if !defined (_SIGSET_T)
     15#define _SIGSET_T
     16typedef unsigned long sigset_t;
     17#endif
     18
     19/** Define the number of file handles in the select buffer.
     20 * @remark we might wanna bump this one up a bit... */
    1021#if !defined (FD_SETSIZE)
    11 #define FD_SETSIZE      256
     22#define FD_SETSIZE 256
    1223#elif FD_SETSIZE < 256
    1324#error FD_SETSIZE must be at least 256
    1425#endif
    1526
     27/** BSD thingy to figure out the size of a bitmap array. */
     28#ifndef _howmany
     29#define _howmany(a,b)       (((a) + ((b) - 1)) / (b))
     30#endif
     31#if defined(TCPV40HDRS) && !defined(howmany)
     32#define howmany(a,b)        (((a) + ((b) - 1)) / (b))
     33#endif
     34
    1635#if !defined (_FD_SET_T)
    1736#define _FD_SET_T
     37/** The base type for the select file descriptor bitmap. */
     38typedef unsigned long   __fd_mask;
     39/** Number of bits in a byte. */
     40#define NBBY        8
     41/** Number of bits in a byte. */
     42#define _NFDBITS    (sizeof(__fd_mask) * 8)     /* bits per mask */
     43/** Select set. */
     44typedef struct fd_set
     45{
     46    __fd_mask   __fds_bits[_howmany(FD_SETSIZE, _NFDBITS)];
     47} fd_set;
    1848
    19 typedef struct _fd_set
    20 {
    21   unsigned long fds_bits[(FD_SETSIZE+31) / 32];
    22 } fd_set;
     49#if defined(__BSD_VISIBLE) || defined(TCPV40HDRS)
     50typedef __fd_mask   fd_mask;
     51#define fds_bits    __fds_bits
     52#define NFDBITS     _NFDBITS
     53#endif
    2354
    2455#endif
    2556
    26 #define FD_SET(n,s)    ((s)->fds_bits[(n)/32] |=  (1L << ((n) & 0x1f)))
    27 #define FD_CLR(n,s)    ((s)->fds_bits[(n)/32] &= ~(1L << ((n) & 0x1f)))
    28 #define FD_ISSET(n,s)  ((s)->fds_bits[(n)/32] &   (1L << ((n) & 0x1f)))
    29 #define FD_ZERO(s)     (void)memset (s, 0, sizeof (*(s)))
     57#ifndef FD_SET
     58/** Set a bit in the select file descriptor bitmap. */
     59#define FD_SET(n,s)    ((s)->__fds_bits[(n)/_NFDBITS] |=  (1L << ((n) & (_NFDBITS - 1))))
     60/** Clear a bit in the select file descriptor bitmap. */
     61#define FD_CLR(n,s)    ((s)->__fds_bits[(n)/_NFDBITS] &= ~(1L << ((n) & (_NFDBITS - 1))))
     62/** Test if a bit in the select file descriptor bitmap is set. */
     63#define FD_ISSET(n,s)  ((s)->__fds_bits[(n)/_NFDBITS] &   (1L << ((n) & (_NFDBITS - 1))))
     64/** Initialize the select file descriptor bitmap clearing all bits. */
     65#define FD_ZERO(s)     (void)memset(s, 0, sizeof(*(s)))
     66#if __BSD_VISIBLE
     67/** Copy a select file descriptor bitmap. */
     68#define FD_COPY(src,trg) (void)(*(trg) = *(src))
     69#endif
     70#endif /* !FD_SET */
    3071
    3172struct timeval;
     73int select (int, struct fd_set *, struct fd_set *, struct fd_set *, struct timeval *);
     74int _select (int, struct fd_set *, struct fd_set *, struct fd_set *, struct timeval *);
     75void *memset (void *, int, size_t); /* Used by FD_ZERO */
     76#ifdef _LIBC_TODO
     77/** A slightly different select call which have better time precision and signal support. */
     78#warning int pselect(int, fd_set *, fd_set *, fd_set *, const struct timespec *, const sigset_t *);
     79#endif
    3280
    33 int select (int, struct _fd_set *, struct _fd_set *, struct _fd_set *,
    34     struct timeval *);
     81#ifdef TCPV40HDRS
     82/** This is the TCPIP v4.0 bsd styled select.
     83 * Normally it's mapped to select(), but since we don't want any such
     84 * confusion we don't.
     85 * @remark The normal select() doesn't have socket capabilities int the sys style libc.
     86 */
     87int _System bsdselect(int, struct fd_set *, struct fd_set *, struct fd_set *, struct timeval *);
     88#define os2_select  tcpip40_os2_select
     89#endif
     90/** This is the TCPIP OS/2 styled select. */
     91int _System os2_select(int *, int, int, int, long);
    3592
    36 int _select (int, struct _fd_set *, struct _fd_set *, struct _fd_set *,
    37     struct timeval *);
    38 
    39 void *memset (void *, int, size_t); /* Used by FD_ZERO */
     93/* toolkit BSD pollution: */
     94#ifndef TCPV40HDRS
     95/*
     96 * Used to maintain information about processes that wish to be
     97 * notified when I/O becomes possible.
     98 */
     99#pragma pack(1)
     100struct selinfo {
     101        pid_t   si_pid;         /* process to be notified */
     102        short   si_flags;       /* see below */
     103};
     104#pragma pack()
     105#define SI_COLL 0x0001          /* collision occurred */
     106#endif /* !TCPV40HDRS */
    40107
    41108#if defined (__cplusplus)
  • trunk/src/emx/include/sys/so_ioctl.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    1 /* so_ioctl.h derived from BSD's ioctl.h by hv and em 1994,1996
    2  *
    3  * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
    4  * All rights reserved.
    5  *
    6  * Redistribution and use in source and binary forms, with or without
    7  * modification, are permitted provided that the following conditions
    8  * are met:
    9  * 1. Redistributions of source code must retain the above copyright
    10  *    notice, this list of conditions and the following disclaimer.
    11  * 2. Redistributions in binary form must reproduce the above copyright
    12  *    notice, this list of conditions and the following disclaimer in the
    13  *    documentation and/or other materials provided with the distribution.
    14  * 3. All advertising materials mentioning features or use of this software
    15  *    must display the following acknowledgement:
    16  *      This product includes software developed by the University of
    17  *      California, Berkeley and its contributors.
    18  * 4. Neither the name of the University nor the names of its contributors
    19  *    may be used to endorse or promote products derived from this software
    20  *    without specific prior written permission.
    21  *
    22  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
    23  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    25  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
    26  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    27  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    28  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    29  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    31  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    32  * SUCH DAMAGE.
    33  *
    34  *      from: @(#)ioctl.h       7.19 (Berkeley) 6/26/91
    35  */
     1/* backward compatibility */
     2#warning sys/so_ioctl.h is outdated, use sys/ioctl.h or sys/sockio.h.
     3#include <sys/sockio.h>
    364
    37 #if !defined (_SYS_SO_IOCTL_H)
    38 #define _SYS_SO_IOCTL_H
    39 
    40 #define _IOC(a,b) ((a<<8)|b)
    41 #define _IOW(a,b,c) _IOC(a,b)
    42 #define _IOR(a,b,c) _IOC(a,b)
    43 #define _IOWR(a,b,c) _IOC(a,b)
    44 
    45 #define _TCPIP_FIONREAD  _IOC('f', 127)
    46 #define FIONBIO         _IOC('f', 126)
    47 #define FIOASYNC        _IOC('f', 125)
    48 #define FIOTCPCKSUM     _IOC('f', 128)
    49 #define FIONSTATUS      _IOC('f', 120)
    50 #define FIONURG         _IOC('f', 121)
    51 #define FIOBSTATUS      _IOC('f', 122)
    52 
    53 /* socket i/o controls */
    54 #define SIOCSHIWAT      _IOW('s',  0, int)      /* set high watermark */
    55 #define SIOCGHIWAT      _IOR('s',  1, int)      /* get high watermark */
    56 #define SIOCSLOWAT      _IOW('s',  2, int)      /* set low watermark */
    57 #define SIOCGLOWAT      _IOR('s',  3, int)      /* get low watermark */
    58 #define SIOCATMARK      _IOR('s',  7, int)      /* at oob mark? */
    59 #define SIOCSPGRP       _IOW('s',  8, int)      /* set process group */
    60 #define SIOCGPGRP       _IOR('s',  9, int)      /* get process group */
    61 #define SIOCSHOSTID     _IOW('s', 10, int)      /* set hostid */
    62 
    63 /*hv Netbios IOCtls excluded here - no docs about them */
    64 
    65 #define SIOCADDRT       _IOW('r', 10, struct ortentry)  /* add route */
    66 #define SIOCDELRT       _IOW('r', 11, struct ortentry)  /* delete route */
    67 
    68 /* hv SIOMETRIC*RT excluded here - no docs about them (routing, nonportable) */
    69 /* hv SIOCREG* excluded here - no docs about them (routing, nonportable) */
    70 
    71 #define SIOCSIFADDR     _IOW('i', 12, struct ifreq)     /* set ifnet address */
    72 #define SIOCGIFADDR     _IOWR('i',13, struct ifreg)     /* get ifnet addres */
    73 #define OSIOCGIFADDR    SIOCGIFADDR
    74 #define SIOCSIFDSTADDR  _IOW('i', 14, struct ifreq)     /* set p-p address */
    75 #define SIOCGIFDSTADDR  _IOWR('i',15, struct ifreq)     /* get p-p address */
    76 #define OSIOCGIFDSTADDR SIOCGIFDSTADDR
    77 #define SIOCSIFFLAGS    _IOW('i', 16, struct ifreq)     /* set ifnet flags */
    78 #define SIOCGIFFLAGS    _IOWR('i',17, struct ifreq)     /* get ifnet flags */
    79 #define SIOCGIFBRDADDR  _IOWR('i',18, struct ifreq)     /* get broadcast addr */
    80 #define OSIOCGIFBRDADDR SIOCGIFBRDADDR
    81 #define SIOCSIFBRDADDR  _IOW('i', 19, struct ifreq)     /* set broadcast addr */
    82 #define SIOCGIFCONF     _IOWR('i',20, struct ifreq)     /* get ifnet list */
    83 #define OSIOCGIFCONF    SIOCGIFCONF
    84 #define SIOCGIFNETMASK  _IOWR('i',21, struct ifreq)     /* get net addr mask */
    85 #define OSIOCGIFNETMASK SIOCGIFNETMASK
    86 #define SIOCSIFNETMASK  _IOW('i', 22, struct ifreq)     /* set net addr mask */
    87 #define SIOCGIFMETRIC   _IOWR('i',23, struct ifreq)     /* get if metric */
    88 #define SIOCSIFMETRIC   _IOW('i', 24, struct ifreq)     /* set if metric */
    89 
    90 #define SIOCSARP        _IOW('i', 30, struct arpreq)    /* set arp entry */
    91 #define SIOCGARP        _IOWR('i',31, struct arpreq)    /* get arp entry */
    92 #define OSIOCGARP       SIOCGARP
    93 #define SIOCDARP        _IOW('i', 32, struct arpreq)    /* delete arp entry */
    94 
    95 /*hv: several SIOC* excluded - no docs, nonportable */
    96 
    97 #define SIOCADDMULTI    _IOW('i', 51, struct ifreq)     /* add m'cast addr */
    98 #define SIOCDELMULTI    _IOW('i', 52, struct ifreq)     /* del m'cast addr */
    99 #define SIOCMULTISBC    _IOC('i', 61)                   /* use broadcast for MC */
    100 #define SIOCMULTISFA    _IOC('i', 62)                   /* use functional addr for MC */
    101 
    102 /* various more ioctls (netstat, slstat, iptrace) excluded, no docs */
    103 
    104 #endif /* !defined (_SYS_SO_IOCTL_H) */
  • trunk/src/emx/include/sys/socket.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    11/* Modified for emx by hv and em 1994-1997
     2 * Modified for gcc/os2 by bird 2003
    23 *
    34 * Copyright (c) 1982,1985,1986,1988 Regents of the University of California.
     
    3940#define _SYS_SOCKET_H_
    4041
    41 #if !defined (_SYS_TYPES_H)
    42 #warning <sys/socket.h> requires <sys/types.h>
     42#include <machine/ansi.h>
     43#define _NO_NAMESPACE_POLLUTION
     44#include <machine/param.h>
     45#undef _NO_NAMESPACE_POLLUTION
     46
     47
     48/* toolkit stuff */
    4349#include <sys/types.h>
    44 #endif
    45 
    4650#include <sys/uio.h>
     51#include <sys/cdefs.h>
    4752
    4853#if defined (__cplusplus)
     
    8287#define SO_RCV_SHUTDOWN 0x0400          /* set if shut down called for rcv */
    8388#define SO_SND_SHUTDOWN 0x0800          /* set if shutdown called for send */
     89#ifndef TCPV40HDRS
     90#define SO_REUSEPORT    0x1000          /* allow local address & port reuse */
     91#define SO_TTCP         0x2000          /* allow t/tcp on socket */
     92#endif
    8493
    8594/*
     
    9099#define SO_SNDLOWAT     0x1003          /* send low-water mark */
    91100#define SO_RCVLOWAT     0x1004          /* receive low-water mark */
     101#ifndef TCPV40HDRS
    92102#define SO_SNDTIMEO     0x1005          /* send timeout */
    93103#define SO_RCVTIMEO     0x1006          /* receive timeout */
     104#endif
    94105#define SO_ERROR        0x1007          /* get error status and clear */
    95106#define SO_TYPE         0x1008          /* get socket type */
     
    119130#define AF_UNSPEC       0               /* unspecified */
    120131#define AF_UNIX         1               /* local to host (pipes, portals) */
     132#ifndef TCPV40HDRS
     133#define AF_LOCAL        AF_UNIX
     134#endif
     135#define AF_OS2          AF_UNIX
    121136#define AF_INET         2               /* internetwork: UDP, TCP, etc. */
    122137#define AF_IMPLINK      3               /* arpanet imp addresses */
     
    124139#define AF_CHAOS        5               /* mit CHAOS protocols */
    125140#define AF_NS           6               /* XEROX NS protocols */
     141#ifdef TCPV40HDRS
    126142#define AF_NBS          7               /* IBM: nbs protocols */
    127143                                        /* (hv: I think IBM is outdated here */
     144#endif
    128145#define AF_ISO          7               /* ISO protocols */
    129146#define AF_OSI          AF_ISO
     
    140157#define AF_NETBIOS      AF_NB
    141158
    142 #define AF_OS2          AF_UNIX
    143 
     159#ifdef TCPV40HDRS
    144160#define AF_MAX          18
     161#else
     162#define AF_LINK         18              /* Link layer interface */
     163#define pseudo_AF_XTP   19              /* eXpress Transfer Protocol (no AF) */
     164#define AF_COIP         20              /* connection-oriented IP, aka ST II */
     165#define AF_CNT          21              /* Computer Network Technology */
     166#define pseudo_AF_RTIP  22              /* Help Identify RTIP packets */
     167#define AF_IPX          23              /* Novell Internet Protocol */
     168#define AF_SIP          24              /* Simple Internet Protocol */
     169#define AF_INET6        24
     170#define pseudo_AF_PIP   25              /* Help Identify PIP packets */
     171#define AF_ROUTE        39              /* Internal Routing Protocol */
     172#define AF_FWIP         40              /* firewall support */
     173#define AF_IPSEC        41              /* IPSEC and encryption techniques */
     174#define AF_DES          42              /* DES */
     175#define AF_MD5          43
     176#define AF_CDMF         44
     177
     178#define AF_MAX          45
     179#endif
     180
    145181
    146182/*
     
    150186 */
    151187struct sockaddr {
     188#ifdef TCPV40HDRS
    152189        u_short sa_family;              /* address family */
    153190        char    sa_data[14];            /* up to 14 bytes of direct address */
     191#else
     192        u_char  sa_len;                 /* total length */
     193        u_char  sa_family;              /* address family */
     194        char    sa_data[14];            /* actually longer; address value */
     195#endif
    154196};
    155197
     
    168210#define PF_UNSPEC       AF_UNSPEC
    169211#define PF_UNIX         AF_UNIX
     212#ifndef TCPV40HDRS
     213#define PF_LOCAL        AF_LOCAL
     214#endif
     215#define PF_OS2          AF_UNIX
    170216#define PF_INET         AF_INET
    171217#define PF_IMPLINK      AF_IMPLINK
     
    173219#define PF_CHAOS        AF_CHAOS
    174220#define PF_NS           AF_NS
     221#ifdef TCPV40HDRS
    175222#define PF_NBS          AF_NBS
     223#endif
    176224#define PF_ISO          AF_ISO
    177 #define PF_OSI          AF_ISO
     225#define PF_OSI          AF_OSI
    178226#define PF_ECMA         AF_ECMA
    179227#define PF_DATAKIT      AF_DATAKIT
     
    185233#define PF_HYLINK       AF_HYLINK
    186234#define PF_APPLETALK    AF_APPLETALK
     235#define PF_NETBIOS      AF_NB
    187236#define PF_NB           AF_NB
    188 #define PF_NETBIOS      AF_NB
    189 #define PF_OS2          AF_UNIX
     237#ifndef TCPV40HDRS
     238#define PF_ROUTE        AF_ROUTE
     239#define PF_LINK         AF_LINK
     240#define PF_XTP          pseudo_AF_XTP   /* really just proto family, no AF */
     241#define PF_COIP         AF_COIP
     242#define PF_CNT          AF_CNT
     243#define PF_SIP          AF_SIP
     244#define PF_INET6        AF_INET6
     245#define PF_IPX          AF_IPX          /* same format as AF_NS */
     246#define PF_RTIP         pseudo_AF_FTIP  /* same format as AF_INET */
     247#define PF_PIP          pseudo_AF_PIP
     248#endif /* !TCPV40HDRS */
     249
    190250#define PF_MAX          AF_MAX
    191251
     252
     253#ifndef TCPV40HDRS
     254/*
     255 * Definitions for network related sysctl, CTL_NET.
     256 *
     257 * Second level is protocol family.
     258 * Third level is protocol number.
     259 *
     260 * Further levels are defined by the individual families below.
     261 */
     262#define NET_MAXID       AF_MAX
     263
     264#define CTL_NET_NAMES { \
     265        { 0, 0 }, \
     266        { "local", CTLTYPE_NODE }, \
     267        { "inet", CTLTYPE_NODE }, \
     268        { "implink", CTLTYPE_NODE }, \
     269        { "pup", CTLTYPE_NODE }, \
     270        { "chaos", CTLTYPE_NODE }, \
     271        { "xerox_ns", CTLTYPE_NODE }, \
     272        { "iso", CTLTYPE_NODE }, \
     273        { "emca", CTLTYPE_NODE }, \
     274        { "datakit", CTLTYPE_NODE }, \
     275        { "ccitt", CTLTYPE_NODE }, \
     276        { "ibm_sna", CTLTYPE_NODE }, \
     277        { "decnet", CTLTYPE_NODE }, \
     278        { "dec_dli", CTLTYPE_NODE }, \
     279        { "lat", CTLTYPE_NODE }, \
     280        { "hylink", CTLTYPE_NODE }, \
     281        { "appletalk", CTLTYPE_NODE }, \
     282        { "netbios", CTLTYPE_NODE }, \
     283        { "route", CTLTYPE_NODE }, \
     284        { "link_layer", CTLTYPE_NODE }, \
     285        { "xtp", CTLTYPE_NODE }, \
     286        { "coip", CTLTYPE_NODE }, \
     287        { "cnt", CTLTYPE_NODE }, \
     288        { "rtip", CTLTYPE_NODE }, \
     289        { "ipx", CTLTYPE_NODE }, \
     290        { "sip", CTLTYPE_NODE }, \
     291        { "pip", CTLTYPE_NODE }, \
     292}
     293
     294/*
     295 * PF_ROUTE - Routing table
     296 *
     297 * Three additional levels are defined:
     298 *      Fourth: address family, 0 is wildcard
     299 *      Fifth: type of info, defined below
     300 *      Sixth: flag(s) to mask with for NET_RT_FLAGS
     301 */
     302#define NET_RT_DUMP     1               /* dump; may limit to a.f. */
     303#define NET_RT_FLAGS    2               /* by flags, e.g. RESOLVING */
     304#define NET_RT_IFLIST   3               /* survey interface list */
     305#define NET_RT_MAXID    4
     306
     307#define CTL_NET_RT_NAMES { \
     308        { 0, 0 }, \
     309        { "dump", CTLTYPE_STRUCT }, \
     310        { "flags", CTLTYPE_STRUCT }, \
     311        { "iflist", CTLTYPE_STRUCT }, \
     312}
     313
     314#endif /* !TCPV40HDRS */
     315
     316
    192317/*
    193318 * Maximum queue length specifiable by listen.
    194319 */
     320#ifdef TCPV40HDRS
    195321#define SOMAXCONN       5
     322#else
     323#define SOMAXCONN       1024
     324#endif
    196325
    197326/*
     
    201330struct msghdr {
    202331        caddr_t msg_name;               /* optional address */
     332#ifdef TCPV40HDRS
    203333        int     msg_namelen;            /* size of address */
    204334        struct  iovec *msg_iov;         /* scatter/gather array */
     
    206336        caddr_t msg_accrights;          /* access rights sent/received */
    207337        int     msg_accrightslen;
     338#else
     339        u_int   msg_namelen;            /* size of address */
     340        struct  iovec *msg_iov;         /* scatter/gather array */
     341        u_int   msg_iovlen;             /* # elements in msg_iov */
     342        caddr_t msg_control;            /* ancillary data, see below */
     343        u_int   msg_controllen;         /* ancillary data buffer len */
     344        long    msg_flags;              /* flags on received message */
     345#endif
    208346};
    209347
     
    211349#define MSG_PEEK        0x2             /* peek at incoming message */
    212350#define MSG_DONTROUTE   0x4             /* send without using routing tables */
    213 #define MSG_EOR         0x8             /* data completes record */
    214 #define MSG_TRUNC       0x10            /* data discarded before delivery */
    215 #define MSG_CTRUNC      0x20            /* control data lost before delivery */
    216 #define MSG_WAITALL     0x40            /* wait for full request or error */
    217 
     351#define MSG_FULLREAD    0x8             /* send without using routing tables */
     352#ifndef TCPV40HDRS
     353#define MSG_EOR         0x10            /* data completes record */
     354#define MSG_TRUNC       0x20            /* data discarded before delivery */
     355#define MSG_CTRUNC      0x40            /* control data lost before delivery */
     356#define MSG_WAITALL     0x80            /* wait for full request or error */
     357#define MSG_DONTWAIT    0x100           /* this message should be nonblocking */
     358#ifdef TTCP
     359#define MSG_EOF         0x200
     360#endif
     361#define MSG_MAPIO       0x400           /* mem mapped io */
     362#define MSG_CLOSE       0x800           /* close connection after succesful send_file */
     363#endif
     364
     365#ifdef TCPV40HDRS
    218366#define MSG_MAXIOVLEN   16
     367#endif
    219368
    220369/*
     
    246395#define SCM_RIGHTS      0x01            /* access rights (array of int) */
    247396
    248 extern  int     accept (int, struct sockaddr *, int *);
    249 extern  int     bind (int, __const__ struct sockaddr *, int);
    250 extern  int     connect (int, __const__ struct sockaddr *, int);
    251 extern  int     gethostid (void);
    252 extern  int     getpeername (int, struct sockaddr *, int *);
    253 extern  int     getsockname (int, struct sockaddr *, int *);
    254 extern  int     getsockopt (int, int, int, void *, int *);
    255 extern  int     listen (int, int);
    256 extern  int     recv (int, void *, int, int);
    257 extern  int     recvfrom (int, void *, int, int, struct sockaddr *, int *);
    258 extern  int     recvmsg (int, struct msghdr *, int);
    259 extern  int     send (int, __const__ void *, int, int);
    260 extern  int     sendto (int, __const__ void *, int, int, __const__ struct sockaddr *, int);
    261 extern  int     sendmsg (int, __const__ struct msghdr *, int);
    262 extern  int     setsockopt (int, int, int, __const__ void *, int);
    263 extern  int     shutdown (int, int);
    264 extern  int     socket (int, int, int);
    265 extern  int     socketpair (int, int, int, int *);
    266 
    267 extern  int     _impsockhandle (int, int);
    268 
    269 /* special IBM prototypes
    270  * hv: warning: usage of these routines may interfere with EMX operation
    271  * usage is not recommended.
    272  */
    273 extern  void    psock_errno(__const__ char*);
    274 extern  int     soabort(int);
    275 extern  int     soclose(int);
    276 extern  int     sock_init(void);
    277 extern  int     sock_errno(void);
    278 extern  int     so_cancel(int);
    279 extern  int     getinetversion(char*);
    280 
    281 /* hv: these are new TCPIPV4 data structures. Consult IBM doc on that */
    282 #ifdef TCPIPV4
     397#ifndef TCPV40HDRS
     398/*
     399 * 4.3 compat sockaddr, move to compat file later
     400 */
     401struct osockaddr {
     402        u_short sa_family;              /* address family */
     403        char    sa_data[14];            /* up to 14 bytes of direct address */
     404};
     405
     406/*
     407 * 4.3-compat message header (move to compat file later).
     408 */
     409struct omsghdr {
     410        caddr_t msg_name;               /* optional address */
     411        int     msg_namelen;            /* size of address */
     412        struct  iovec *msg_iov;         /* scatter/gather array */
     413        int     msg_iovlen;             /* # elements in msg_iov */
     414        caddr_t msg_accrights;          /* access rights sent/received */
     415        int     msg_accrightslen;
     416};
     417
     418/*
     419 * send_file parameter structure
     420 */
     421struct sf_parms {
     422        void   *header_data;      /* ptr to header data */
     423        size_t header_length;     /* size of header data */
     424        int    file_handle;       /* file handle to send from */
     425        size_t file_size;         /* size of file */
     426        int    file_offset;       /* byte offset in file to send from */
     427        size_t file_bytes;        /* bytes of file to be sent */
     428        void   *trailer_data;     /* ptr to trailer data */
     429        size_t trailer_length;    /* size of trailer data */
     430        size_t bytes_sent;        /* bytes sent in this send_file call */
     431};
     432#endif
     433
     434int     _System accept (int, struct sockaddr *, int *);
     435int     _System bind (int, __const__ struct sockaddr *, int);
     436int     _System connect (int, __const__ struct sockaddr *, int);
     437int     _System gethostid (void);
     438int     _System getpeername (int, struct sockaddr *, int *);
     439int     _System getsockname (int, struct sockaddr *, int *);
     440int     _System getsockopt (int, int, int, void *, int *);
     441int     _System listen (int, int);
     442int     _System recv (int, void *, int, int);
     443int     _System recvfrom (int, void *, int, int, struct sockaddr *, int *);
     444int     _System recvmsg (int, struct msghdr *, int);
     445int     _System send (int, __const__ void *, int, int);
     446int     _System sendto (int, __const__ void *, int, int, __const__ struct sockaddr *, int);
     447int     _System sendmsg (int, __const__ struct msghdr *, int);
     448int     _System setsockopt (int, int, int, __const__ void *, int);
     449int     _System shutdown (int, int);
     450int     _System socket (int, int, int);
     451int     _System socketpair (int, int, int, int *);
     452
     453/* EMX addition */
     454int    _impsockhandle (int, int);
     455
     456#ifndef TCPV40HDRS
     457int     _System accept_and_recv (long, long*, struct sockaddr *, long*, struct sockaddr*, long*, caddr_t, size_t);
     458#endif
     459
     460/* OS/2 additions */
     461void    _System addsockettolist(int);
     462int     _System removesocketfromlist(int);
     463#include <sys/ioccom.h>
     464#ifdef TCPV40HDRS
     465#include <sys/select.h>
     466#endif
     467int     _System sock_init( void );
     468int     _System sock_errno( void );
     469void    _System psock_errno( char * );
     470int     _System soclose( int );
     471int     _System so_cancel(int);
     472int     _System Raccept(int, struct sockaddr *, int *);
     473#ifdef TCPV40HDRS
     474struct sockaddr_in;
     475int     _System Rbind(int, struct sockaddr_in *, int, struct sockaddr_in *);
     476#else
     477int     _System Rbind(int, struct sockaddr *, int, struct sockaddr *);
     478#endif
     479int     _System Rconnect(int, const struct sockaddr *, int);
     480int     _System Rgetsockname(int, struct sockaddr *, int *);
     481int     _System Rlisten(int, int);
     482#ifndef TCPV40HDRS
     483ssize_t _System send_file(int *, struct sf_parms *, int );
     484char *  _System sock_strerror(int);
     485int     _System getinetversion(char *);
     486#endif
     487
     488
     489/* more OS/2 stuff. */
     490#ifndef MAXSOCKETS
     491#define MAXSOCKETS      2048
     492#endif
     493
    283494#define MT_FREE         0
    284495#define MT_DATA         1
     
    305516};
    306517
    307 #define MAXSOCKETS      2048
    308518
    309519struct sostats {
    310520        short count;
    311         short socketdata[9*MAXSOCKETS];
    312 };
    313 #endif
     521#ifdef TCPV40HDRS
     522        short socketdata[9*MAXSOCKETS];
     523#else
     524        short socketdata[13*MAXSOCKETS];
     525#endif
     526};
    314527
    315528#if defined (__cplusplus)
  • trunk/src/emx/include/sys/sockio.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    1 /* Copyright (c)1996 by Holger Veit
    2  * May be freely used with EMX
     1/*- Modified for gcc/os2 by bird 2003
     2 *
     3 * Copyright (c) 1982, 1986, 1990, 1993, 1994
     4 *      The Regents of the University of California.  All rights reserved.
     5 *
     6 * Redistribution and use in source and binary forms, with or without
     7 * modification, are permitted provided that the following conditions
     8 * are met:
     9 * 1. Redistributions of source code must retain the above copyright
     10 *    notice, this list of conditions and the following disclaimer.
     11 * 2. Redistributions in binary form must reproduce the above copyright
     12 *    notice, this list of conditions and the following disclaimer in the
     13 *    documentation and/or other materials provided with the distribution.
     14 * 3. All advertising materials mentioning features or use of this software
     15 *    must display the following acknowledgement:
     16 *      This product includes software developed by the University of
     17 *      California, Berkeley and its contributors.
     18 * 4. Neither the name of the University nor the names of its contributors
     19 *    may be used to endorse or promote products derived from this software
     20 *    without specific prior written permission.
     21 *
     22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     25 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     32 * SUCH DAMAGE.
     33 *
     34 *      @(#)sockio.h    8.1 (Berkeley) 3/28/94
     35 * $FreeBSD: src/sys/sys/sockio.h,v 1.14.2.6 2002/02/07 15:12:37 ambrisko Exp $
    336 */
    437
    5 /* BSD uses this to declare some more ioctls */
    6 
    7 #ifndef _SYS_SOCKIO_H_
    8 #define _SYS_SOCKIO_H_
    9 
    10 #include <sys/so_ioctl.h>
     38#ifndef _SYS_SOCKIO_H_
     39#define _SYS_SOCKIO_H_
     40
     41#include <sys/ioccom.h>
     42#include "ioccom.h"
     43
     44/* Socket ioctl's. */
     45#ifdef TCPV40HDRS
     46#define SIOCSHIWAT       _IOW('s',  0, int)             /* set high watermark */
     47#define SIOCGHIWAT       _IOR('s',  1, int)             /* get high watermark */
     48#define SIOCSLOWAT       _IOW('s',  2, int)             /* set low watermark */
     49#define SIOCGLOWAT       _IOR('s',  3, int)             /* get low watermark */
     50#endif /* TCPV40HDRS */
     51#define SIOCATMARK       _IOR('s',  7, int)             /* at oob mark? */
     52#define SIOCSPGRP        _IOW('s',  8, int)             /* set process group */
     53#define SIOCGPGRP        _IOR('s',  9, int)             /* get process group */
     54
     55#define SIOCADDRT        _IOW('r', 10, struct ortentry) /* add route */
     56#define SIOCDELRT        _IOW('r', 11, struct ortentry) /* delete route */
     57#if 0 /* not on OS/2 */
     58#define SIOCGETVIFCNT   _IOWR('r', 15, struct sioc_vif_req)/* get vif pkt cnt */
     59#define SIOCGETSGCNT    _IOWR('r', 16, struct sioc_sg_req) /* get s,g pkt cnt */
     60#endif
     61
     62#define SIOCSIFADDR      _IOW('i', 12, struct ifreq)    /* set ifnet address */
     63#define OSIOCGIFADDR    _IOWR('i', 13, struct ifreq)    /* get ifnet address */
     64#ifdef TCPV40HDRS
     65#define SIOCGIFADDR     _IOWR('i', 13, struct ifreq)    /* get ifnet address */
     66#else
     67#define SIOCGIFADDR     _IOWR('i', 33, struct ifreq)    /* get ifnet address */
     68#endif /* TCPV40HDRS */
     69#define SIOCSIFDSTADDR   _IOW('i', 14, struct ifreq)    /* set p-p address */
     70#define OSIOCGIFDSTADDR _IOWR('i', 15, struct ifreq)    /* get p-p address */
     71#ifdef TCPV40HDRS
     72#define SIOCGIFDSTADDR  _IOWR('i', 15, struct ifreq)    /* get p-p address */
     73#else
     74#define SIOCGIFDSTADDR  _IOWR('i', 34, struct ifreq)    /* get p-p address */
     75#endif /* TCPV40HDRS */
     76#define SIOCSIFFLAGS     _IOW('i', 16, struct ifreq)    /* set ifnet flags */
     77#define SIOCGIFFLAGS    _IOWR('i', 17, struct ifreq)    /* get ifnet flags */
     78#define OSIOCGIFBRDADDR _IOWR('i', 18, struct ifreq)    /* get broadcast addr */
     79#ifdef TCPV40HDRS
     80#define SIOCGIFBRDADDR  _IOWR('i', 18, struct ifreq)    /* get broadcast addr */
     81#else
     82#define SIOCGIFBRDADDR  _IOWR('i', 35, struct ifreq)    /* get broadcast addr */
     83#endif /* TCPV40HDRS */
     84#define SIOCSIFBRDADDR   _IOW('i', 19, struct ifreq)    /* set broadcast addr */
     85#define OSIOCGIFCONF    _IOWR('i', 20, struct ifconf)   /* get ifnet list */
     86#ifdef TCPV40HDRS
     87#define SIOCGIFCONF     _IOWR('i', 20, struct ifconf)   /* get ifnet list */
     88#else
     89#define SIOCGIFCONF     _IOWR('i', 36, struct ifconf)   /* get ifnet list */
     90#endif /* TCPV40HDRS */
     91#define OSIOCGIFNETMASK _IOWR('i', 21, struct ifreq)    /* get net addr mask */
     92#ifdef TCPV40HDRS
     93#define SIOCGIFNETMASK  _IOWR('i', 21, struct ifreq)    /* get net addr mask */
     94#else
     95#define SIOCGIFNETMASK  _IOWR('i', 37, struct ifreq)    /* get net addr mask */
     96#endif /* TCPV40HDRS */
     97#define SIOCSIFNETMASK   _IOW('i', 22, struct ifreq)    /* set net addr mask */
     98#define SIOCGIFMETRIC   _IOWR('i', 23, struct ifreq)    /* get IF metric */
     99#define SIOCSIFMETRIC    _IOW('i', 24, struct ifreq)    /* set IF metric */
     100
     101#if 1 /* different on OS/2 */
     102#define SIOCDIFADDR      _IOW('i', 64, struct ifreq)    /* delete IF addr */
     103#define SIOCAIFADDR      _IOW('i', 63, struct ifaliasreq)/* add/chg IF alias */
     104#else /*!OS2:*/
     105#define SIOCDIFADDR      _IOW('i', 25, struct ifreq)    /* delete IF addr */
     106#define SIOCAIFADDR      _IOW('i', 26, struct ifaliasreq)/* add/chg IF alias */
     107#endif
     108
     109#if 0 /* not on OS/2 */
     110#define SIOCALIFADDR     _IOW('i', 27, struct if_laddrreq) /* add IF addr */
     111#define SIOCGLIFADDR    _IOWR('i', 28, struct if_laddrreq) /* get IF addr */
     112#define SIOCDLIFADDR     _IOW('i', 29, struct if_laddrreq) /* delete IF addr */
     113#define SIOCSIFCAP       _IOW('i', 30, struct ifreq)    /* set IF features */
     114#define SIOCGIFCAP      _IOWR('i', 31, struct ifreq)    /* get IF features */
     115#endif /*!OS2*/
     116
     117#if 1 /* different on OS/2 */
     118#define SIOCADDMULTI     _IOW('i', 51, struct ifreq)    /* add m'cast addr */
     119#define SIOCDELMULTI     _IOW('i', 52, struct ifreq)    /* del m'cast addr */
     120#else /* !OS2: */
     121#define SIOCADDMULTI     _IOW('i', 49, struct ifreq)    /* add m'cast addr */
     122#define SIOCDELMULTI     _IOW('i', 50, struct ifreq)    /* del m'cast addr */
     123#endif
     124
     125#if 1 /* different on OS/2 */
     126#define SIOCGIFMTU        _IOR('i', 57, struct ifreq)   /* get IF mtu */
     127#define SIOCSIFMTU        _IOW('i', 45, struct ifreq)   /* set IF mtu */
     128#else
     129#define SIOCGIFMTU      _IOWR('i', 51, struct ifreq)    /* get IF mtu */
     130#define SIOCSIFMTU       _IOW('i', 52, struct ifreq)    /* set IF mtu */
     131#endif
     132#if 0 /* not on OS/2 */
     133#define SIOCGIFPHYS     _IOWR('i', 53, struct ifreq)    /* get IF wire */
     134#define SIOCSIFPHYS      _IOW('i', 54, struct ifreq)    /* set IF wire */
     135#define SIOCSIFMEDIA    _IOWR('i', 55, struct ifreq)    /* set net media */
     136#define SIOCGIFMEDIA    _IOWR('i', 56, struct ifmediareq) /* get net media */
     137
     138#define SIOCSIFPHYADDR   _IOW('i', 70, struct ifaliasreq) /* set gif addres */
     139#define SIOCGIFPSRCADDR _IOWR('i', 71, struct ifreq)    /* get gif psrc addr */
     140#define SIOCGIFPDSTADDR _IOWR('i', 72, struct ifreq)    /* get gif pdst addr */
     141#define SIOCDIFPHYADDR   _IOW('i', 73, struct ifreq)    /* delete gif addrs */
     142#define SIOCSLIFPHYADDR  _IOW('i', 74, struct if_laddrreq) /* set gif addrs */
     143#define SIOCGLIFPHYADDR _IOWR('i', 75, struct if_laddrreq) /* get gif addrs */
     144
     145#define SIOCSIFGENERIC   _IOW('i', 57, struct ifreq)    /* generic IF set op */
     146#define SIOCGIFGENERIC  _IOWR('i', 58, struct ifreq)    /* generic IF get op */
     147
     148#define SIOCGIFSTATUS   _IOWR('i', 59, struct ifstat)   /* get IF status */
     149#define SIOCSIFLLADDR    _IOW('i', 60, struct ifreq)    /* set linklevel addr */
     150
     151#define SIOCGPRIVATE_0  _IOWR('i', 80, struct ifreq)    /* Linux Private + 0 */
     152#define SIOCGPRIVATE_1  _IOWR('i', 81, struct ifreq)    /* Linux Private + 1 */
     153
     154#define SIOCIFCREATE    _IOWR('i', 122, struct ifreq)   /* create clone if */
     155#define SIOCIFDESTROY    _IOW('i', 121, struct ifreq)   /* destroy clone if */
     156#define SIOCIFGCLONERS  _IOWR('i', 120, struct if_clonereq) /* get cloners */
     157#endif /*!OS2*/
     158
     159/* OS2 specific ioctls */
     160#define SIOCSHOSTID       _IOW('s', 10, long)
     161#define SIOCGNBNAME       _IOR('s', 11, long)   /* AFNB code. Not clear now */
     162#define SIOCSNBNAME       _IOW('s', 12, long)   /* AFNB                     */
     163#define SIOCGNCBFN        _IOR('s', 13, long)   /* AFNB                     */
     164#ifndef TCPV40HDRS
     165#define SIOCSSYN          _IOW('s', 14, long)   /* SYN Attack */
     166#endif /* !TCPV40HDRS */
     167#define SIOCSIFBRD        _IOW('i', 27, int)    /* SINGLE-rt bcst. using old # for bkw cmpt */
     168#ifdef TCPV40HDRS
     169#define SIOCSIFALLRTB      ioc('i', 63) /* added to configure all-route broadcst */
     170#else
     171#define SIOCSIFALLRTB     _IOW('i', 65, struct ifreq) /* added to configure all-route broadcst */
     172#endif /* TCPV40HDRS */
     173
     174#define SIOCSARP          _IOW('i', 30, struct arpreq)/* set ARP entry */
     175#define SIOCGARP          _IOR('i', 31, struct arpreq)
     176#define SIOCDARP          _IOW('i', 32, struct arpreq)
     177
     178#define SIOCSIF802_3      _IOW('i', 40, struct ifreq)
     179#define SIOCSIFNO802_3    _IOW('i', 41, struct ifreq)
     180#define SIOCSIFNOREDIR    _IOW('i', 42, struct ifreq)
     181#define SIOCSIFYESREDIR   _IOW('i', 43, struct ifreq)
     182
     183#define SIOCSIFFDDI       _IOW('i', 46, struct ifreq)
     184#define SIOCSIFNOFDDI     _IOW('i', 47, struct ifreq)
     185#define SIOCSRDBRD        _IOW('i', 48, struct ifreq)
     186
     187#define SIOCGARP_TR       _IOR('i', 50, struct arpreq_tr)
     188#define SIOCSARP_TR       _IOW('i', 49, struct arpreq_tr)
     189
     190#if defined(SLBOOTP) || defined(INCL_TCPIP_ALLIOCTLS)
     191/** Used to retreive unit number on serial interface. */
     192#define SIOCGUNIT         _IOR('i', 70, struct ifreq)
     193#endif
     194
     195/** To check if the interface is Valid or not */
     196#define SIOCGIFVALID      _IOR('i', 75, struct ifreq)
     197/** Ioctl to return bound/shld bind ifs */
     198struct bndreq { short bindings; short bound; };
     199#define SIOCGIFBOUND      _IOR('i', 76, struct bndreq)
     200
     201/** Get multicast gp. info for an interface ret list of m-cast addrs for an if */
     202#define SIOCGMCAST        _IOR('i', 81, struct addrreq)
     203#define SIOCMULTISBC      _IOW('i', 61, struct ifreq)   /* use broadcast to send IP multicast*/
     204#define SIOCMULTISFA      _IOW('i', 62, struct ifreq)   /* use functional addr to send IP multicast*/
     205
     206#ifndef TCPV40HDRS
     207/** block until intf change to running state */
     208#define SIOCSIFRUNNINGBLK _IOW('i', 77, struct ifreq)
     209#endif
     210
     211/* Interface Tracing Support */
     212#define SIOCGIFEFLAGS     _IOR('i', 150, struct ifreq)
     213#define SIOCSIFEFLAGS     _IOW('i', 151, struct ifreq)
     214#define SIOCGIFTRACE      _IOR('i', 152, struct ifreq)
     215#define SIOCSIFTRACE      _IOW('i', 153, struct ifreq)
     216
     217/* SLIP STATS */
     218#define SIOCSSTAT         _IOW('i', 154, struct ifreq)
     219#define SIOCGSTAT         _IOR('i', 155, struct ifreq)
     220
     221#ifndef TCPV40HDRS
     222#define SIOCSMSL          _IOW('t', 1, long)          /* set the msl in seconds */
     223#define SIOCGMSL          _IOR('t', 2, long)          /* get the msl in seconds */
     224#endif
     225
     226/* NETSTAT stuff */
     227#define SIOSTATMBUF       _IOR('n', 40, struct mbstat)
     228#define SIOSTATTCP        _IOR('n', 41, struct tcpstat)
     229#define SIOSTATUDP        _IOR('n', 42, struct udpstat)
     230#define SIOSTATIP         _IOR('n', 43, struct ipstat)
     231#define SIOSTATSO         _IOR('n', 44, char /*struct sockaddr*/)
     232#ifndef TCPV40HDRS
     233#define SIOSTATTCPZ       _IOR('n', 241, struct tcpstat)
     234#define SIOSTATUDPZ       _IOR('n', 242, struct udpstat)
     235#define SIOSTATIPZ        _IOR('n', 243, struct ipstat)
     236#endif
     237
     238#define SIOSTATRT         _IOR('n', 45, char /*struct rtentries*/)
     239#define SIOFLUSHRT        _IOW('n', 46, long)                     /* Backward compatibility */
     240#define SIOSTATICMP       _IOR('n', 47, struct icmpstat)
     241#ifndef TCPV40HDRS
     242#define SIOSTATICMPZ      _IOR('n', 247, struct icmpstat)
     243#endif
     244#define SIOSTATIF         _IOR('n', 48, char /*struct ifmib*/)
     245#define SIOSTATAT         _IOR('n', 49, char /*struct statatreq*/)
     246#define SIOSTATARP        _IOR('n', 50, char /*struct oarptab*/)
     247#define SIOSTATIF42       _IOR('n', 51, char /*struct ifmib*/)
     248#define SIOSTATCNTRT      _IOR('n', 52, int)
     249#define SIOSTATCNTAT      _IOR('n', 53, int)
     250
     251#ifndef TCPV40HDRS
     252#define SIOSTATIGMP       _IOR('n', 54, struct igmpstat)  /* SNMP stuff     */
     253#define SIOFLUSHRTIFP     _IOW('n', 55, long) /* delete routes on an interface */
     254#define SIOSTATIGMPZ      _IOR('n', 254, struct igmpstat) /* SNMP stuff     */
     255
     256/** adding this ioctl() to be able to send arp request using an ioctl() */
     257#define SIOCARP           _IOR('i', 156, int)
     258#endif /* !TCPV40HDRS */
     259
     260#if defined(TCPV40HDRS) || defined(INCL_TCPIP_ALLIOCTLS)
     261#define SIOMETRIC1RT    ioc('r', 12)
     262#define SIOMETRIC2RT    ioc('r', 13)
     263#define SIOMETRIC3RT    ioc('r', 14)
     264#define SIOMETRIC4RT    ioc('r', 15)
     265#define SIOCREGADDNET   ioc('r', 12)
     266#define SIOCREGDELNET   ioc('r', 13)
     267#define SIOCREGROUTES   ioc('r', 14)
     268#define SIOCFLUSHROUTES ioc('r', 15)
     269#define SIOCSIFSETSIG   ioc('i', 25)
     270#define SIOCSIFCLRSIG   ioc('i', 26)
     271#define SIOCGIFLOAD     ioc('i', 27)
     272#define SIOCSIFFILTERSRC ioc('i', 28)
     273#define SIOCGIFFILTERSRC ioc('i',29)
     274#define SIOCSIFSNMPSIG  ioc('i', 33)
     275#define SIOCSIFSNMPCLR  ioc('i', 34)
     276#define SIOCSIFSNMPCRC  ioc('i', 35)
     277#define SIOCSIFPRIORITY ioc('i', 36)
     278#define SIOCGIFPRIORITY ioc('i', 37)
     279#define SIOCSIFFILTERDST ioc('i', 38)
     280#define SIOCGIFFILTERDST ioc('i',39)
     281#define SIOCSIFSPIPE    ioc('i',71)   /* used to set pipe size on interface */
     282                                      /* this is used as tcp send buffer size */
     283#define SIOCSIFRPIPE    ioc('i',72)   /* used to set pipe size on interface */
     284                                      /* this is used as tcp recv buffer size */
     285#define SIOCSIFTCPSEG   ioc('i',73)   /* set the TCP segment size on interface*/
     286#define SIOCSIFUSE576   ioc('i',74)   /* enable/disable the automatic change of mss to 576 */
     287                                      /* if going through a router */
     288#endif  /* TCPV40HDRS || ALL */
    11289
    12290#endif /* !_SYS_SOCKIO_H_ */
  • trunk/src/emx/include/sys/syslimits.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    5757#ifndef NGROUPS_MAX
    5858/** Max supplemental group id's.
    59  * OS2: doesn't make much sens just set it high. */
    60 #define NGROUPS_MAX     256
     59 * OS2: doesn't make much sense. Redefined in limits.h btw. */
     60#define NGROUPS_MAX     0
    6161#endif
    6262
  • trunk/src/emx/include/sys/time.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    1 /* sys/time.h (emx+gcc) */
     1/* - modified for gcc/os2 by bird 2003
     2 *
     3 * Copyright (c) 1982, 1986, 1993
     4 *      The Regents of the University of California.  All rights reserved.
     5 *
     6 * Redistribution and use in source and binary forms, with or without
     7 * modification, are permitted provided that the following conditions
     8 * are met:
     9 * 1. Redistributions of source code must retain the above copyright
     10 *    notice, this list of conditions and the following disclaimer.
     11 * 2. Redistributions in binary form must reproduce the above copyright
     12 *    notice, this list of conditions and the following disclaimer in the
     13 *    documentation and/or other materials provided with the distribution.
     14 * 3. All advertising materials mentioning features or use of this software
     15 *    must display the following acknowledgement:
     16 *      This product includes software developed by the University of
     17 *      California, Berkeley and its contributors.
     18 * 4. Neither the name of the University nor the names of its contributors
     19 *    may be used to endorse or promote products derived from this software
     20 *    without specific prior written permission.
     21 *
     22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     25 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     32 * SUCH DAMAGE.
     33 *
     34 *      @(#)time.h      8.5 (Berkeley) 5/4/95
     35  */
    236
    3 #ifndef _SYS_TIME_H
    4 #define _SYS_TIME_H
     37#ifndef _SYS_TIME_H_
     38#define _SYS_TIME_H_
    539
    640#include <time.h>
     41#include <sys/types.h>
    742
    843#if defined (__cplusplus)
     
    1247#if !defined (_TIMEVAL)
    1348#define _TIMEVAL
     49/** gettimeofday return structure */
    1450struct timeval
    1551{
     52  /** seconds */
    1653  long tv_sec;
     54  /** and microseconds */
    1755  long tv_usec;
    1856};
     
    2159#if !defined (_TIMEZONE)
    2260#define _TIMEZONE
     61/** Timezone information */
    2362struct timezone
    2463{
     64  /** minutes west of Greenwich */
    2565  int tz_minuteswest;
     66  /** type of dst correction. */
    2667  int tz_dsttime;
    2768};
    2869#endif
    2970
    30 int utimes (__const__ char *, __const__ struct timeval *);
    31 int gettimeofday (struct timeval *, struct timezone *);
    32 int settimeofday (__const__ struct timeval *, __const__ struct timezone *);
     71#if !defined(TCPV40HDRS) && !defined(DST_NONE)
     72#define DST_NONE    0   /* not on dst */
     73#define DST_USA     1   /* USA style dst. */
     74#define DST_AUST    2   /* Australian style dst. */
     75#define DST_WET     3   /* Western European dst. */
     76#define DST_MET     4   /* Middle European dst. */
     77#define DST_EET     5   /* Eastern European dst. */
     78#define DST_CAN     6   /* Canada. */
     79#endif  /* !TCPV40HDRS */
     80
     81#ifndef TCPV40HDRS
     82#pragma pack(4)
     83/** POSIX.4 version of timeval. */
     84struct timespec {
     85        time_t  ts_sec;         /* seconds */
     86        long    ts_nsec;        /* and nanoseconds */
     87};
     88#pragma pack()
     89#define TIMEVAL_TO_TIMESPEC(tv, ts) {                                   \
     90        (ts)->ts_sec = (tv)->tv_sec;                                    \
     91        (ts)->ts_nsec = (tv)->tv_usec * 1000;                           \
     92}
     93#define TIMESPEC_TO_TIMEVAL(tv, ts) {                                   \
     94        (tv)->tv_sec = (ts)->ts_sec;                                    \
     95        (tv)->tv_usec = (ts)->ts_nsec / 1000;                           \
     96}
     97
     98/* Operations on timevals. */
     99#define timerclear(tvp)         ((tvp)->tv_sec = (tvp)->tv_usec = 0)
     100#define timerisset(tvp)         ((tvp)->tv_sec || (tvp)->tv_usec)
     101#ifndef timercmp
     102#define timercmp(tvp, uvp, cmp)                                         \
     103        (((tvp)->tv_sec == (uvp)->tv_sec) ?                             \
     104            ((tvp)->tv_usec cmp (uvp)->tv_usec) :                       \
     105            ((tvp)->tv_sec cmp (uvp)->tv_sec))
     106#endif
     107#ifndef timeradd
     108#define timeradd(tvp, uvp, vvp)                                         \
     109        do {                                                            \
     110                (vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec;          \
     111                (vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec;       \
     112                if ((vvp)->tv_usec >= 1000000) {                        \
     113                        (vvp)->tv_sec++;                                \
     114                        (vvp)->tv_usec -= 1000000;                      \
     115                }                                                       \
     116        } while (0)
     117#endif
     118#ifdef timersub
     119#define timersub(tvp, uvp, vvp)                                         \
     120        do {                                                            \
     121                (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec;          \
     122                (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec;       \
     123                if ((vvp)->tv_usec < 0) {                               \
     124                        (vvp)->tv_sec--;                                \
     125                        (vvp)->tv_usec += 1000000;                      \
     126                }                                                       \
     127        } while (0)
     128#endif
     129
     130/*
     131 * Getkerninfo clock information structure
     132 */
     133struct clockinfo {
     134        int     hz;             /* clock frequency */
     135        int     tick;           /* micro-seconds per hz tick */
     136        int     stathz;         /* statistics clock frequency */
     137        int     profhz;         /* profiling clock frequency */
     138};
     139
     140/*
     141 * Names of the interval timers, and structure
     142 * defining a timer setting.
     143 */
     144#define ITIMER_REAL     0
     145#define ITIMER_VIRTUAL  1
     146#define ITIMER_PROF     2
     147#endif /* !TCPV40HDRS */
     148
     149#pragma pack(4)
     150struct  itimerval {
     151        struct  timeval it_interval;    /* timer interval */
     152        struct  timeval it_value;       /* current value */
     153};
     154#pragma pack()
    33155
    34156
    35 int _utimes (__const__ char *, __const__ struct timeval *);
    36 int _gettimeofday (struct timeval *, struct timezone *);
    37 int _settimeofday (__const__ struct timeval *, __const__ struct timezone *);
     157#if defined(TCPV40HDRS) || !defined(_POSIX_SOURCE)
     158int     _System utimes (__const__ char *, __const__ struct timeval *);
     159int     _System gettimeofday (struct timeval *, struct timezone *);
     160int     _System settimeofday (__const__ struct timeval *, __const__ struct timezone *);
     161#ifndef TCPV40HDRS
     162#include <sys/cdefs.h>
     163int     _System adjtime(const struct timeval *, struct timeval *);
     164int     _System getitimer(int, struct itimerval *);
     165int     _System setitimer(int, const struct itimerval *, struct itimerval *);
     166#endif
     167#endif /* TCPV40HDRS */
     168
    38169
    39170#if defined (__cplusplus)
     
    41172#endif
    42173
    43 #endif /* not _SYS_TIME_H */
     174#endif /* not _SYS_TIME_H_ */
  • trunk/src/emx/include/sys/types.h

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r182 r183  
    44#define _SYS_TYPES_H
    55
     6/* freebsd/toolkit compatibility */
     7#include <sys/cdefs.h>
     8#include <sys/inttypes.h> /* includes machine/ansi.h */
     9#include <machine/types.h>
     10
    611#if !defined (_SIZE_T)
    712#define _SIZE_T
    813typedef unsigned long size_t;
     14#undef  _BSD_SIZE_T_
    915#endif
    1016
     
    1218#define _SSIZE_T
    1319typedef int ssize_t;
     20#undef  _BSD_SSIZE_T_
    1421#endif
    1522
     
    1724#define _TIME_T
    1825typedef unsigned long time_t;
     26#undef  _BSD_TIME_T_
    1927#endif
    2028
     
    2230#define _INO_T
    2331typedef int ino_t;
     32#undef  _BSD_INO_T_
    2433#endif
    2534
     
    2736#define _DEV_T
    2837typedef int dev_t;
     38#undef  _BSD_DEV_T_
    2939#endif
    3040
     
    3242#define _OFF_T
    3343typedef long off_t;
     44#undef  _BSD_OFF_T_
    3445#endif
    3546
     
    3748#define _MODE_T
    3849typedef int mode_t;
     50#undef  _BSD_MODE_T_
    3951#endif
    4052
     
    4254#define _NLINK_T
    4355typedef int nlink_t;
     56#undef  _BSD_NLINK_T_
    4457#endif
    4558
     
    4760#define _UID_T
    4861typedef int uid_t;
     62#undef  _BSD_UID_T_
    4963#endif
    5064
     
    5266#define _PID_T
    5367typedef int pid_t;
     68#undef  _BSD_PID_T_
    5469#endif
    5570
     
    5772#define _GID_T
    5873typedef int gid_t;
     74#undef  _BSD_GID_T_
    5975#endif
    6076
     
    6278
    6379#if !defined (FD_SETSIZE)
    64 #define FD_SETSIZE      256
    65 #else
    66 #if FD_SETSIZE < 256
    67  #error FD_SETSIZE must be at least 256
     80#define FD_SETSIZE 256
     81#elif FD_SETSIZE < 256
     82#error FD_SETSIZE must be at least 256
    6883#endif
     84
     85#ifndef _howmany
     86#define _howmany(a,b)       (((a) + ((b) - 1)) / (b))
     87#endif
     88#if defined(TCPV40HDRS) && !defined(howmany)
     89#define howmany(a,b)        (((a) + ((b) - 1)) / (b))
    6990#endif
    7091
    7192#if !defined (_FD_SET_T)
    7293#define _FD_SET_T
     94/** The base type for the select file descriptor bitmap. */
     95typedef unsigned long   __fd_mask;
     96/** Number of bits in a byte. */
     97#define NBBY        8
     98/** Number of bits in a byte. */
     99#define _NFDBITS    (sizeof(__fd_mask) * 8)     /* bits per mask */
     100/** Select set. */
     101typedef struct fd_set
     102{
     103    __fd_mask   __fds_bits[_howmany(FD_SETSIZE, _NFDBITS)];
     104} fd_set;
    73105
    74 typedef struct _fd_set
    75 {
    76   unsigned long fds_bits[(FD_SETSIZE+31) / 32];
    77 } fd_set;
     106#if defined(__BSD_VISIBLE) || defined(TCPV40HDRS)
     107typedef __fd_mask   fd_mask;
     108#define fds_bits    __fds_bits
     109#define NFDBITS     _NFDBITS
     110#endif
    78111
    79112#endif
    80113
    81 #define FD_SET(n,s)    ((s)->fds_bits[(n)/32] |=  (1L << ((n) & 0x1f)))
    82 #define FD_CLR(n,s)    ((s)->fds_bits[(n)/32] &= ~(1L << ((n) & 0x1f)))
    83 #define FD_ISSET(n,s)  ((s)->fds_bits[(n)/32] &   (1L << ((n) & 0x1f)))
    84 #define FD_ZERO(s)     (void)memset (s, 0, sizeof (*(s)))
     114#ifndef FD_SET
     115/** Set a bit in the select file descriptor bitmap. */
     116#define FD_SET(n,s)    ((s)->__fds_bits[(n)/_NFDBITS] |=  (1L << ((n) & (_NFDBITS - 1))))
     117/** Clear a bit in the select file descriptor bitmap. */
     118#define FD_CLR(n,s)    ((s)->__fds_bits[(n)/_NFDBITS] &= ~(1L << ((n) & (_NFDBITS - 1))))
     119/** Test if a bit in the select file descriptor bitmap is set. */
     120#define FD_ISSET(n,s)  ((s)->__fds_bits[(n)/_NFDBITS] &   (1L << ((n) & (_NFDBITS - 1))))
     121/** Initialize the select file descriptor bitmap clearing all bits. */
     122#define FD_ZERO(s)     (void)memset(s, 0, sizeof(*(s)))
     123#if __BSD_VISIBLE
     124/** Copy a select file descriptor bitmap. */
     125#define FD_COPY(src,trg) (void)(*(trg) = *(src))
     126#endif
     127#endif /* !FD_SET */
    85128
    86 #endif
     129#endif /* !_POSIX_SOURCE */
    87130
    88131#if !defined (_POSIX_SOURCE)
     
    94137typedef char *caddr_t;
    95138
     139/* toolkit pollution */
     140#ifdef __32BIT__
     141typedef int             long_int;       /* 32-bit compilers */
     142#else
     143typedef long int        long_int;       /* 16-bit compilers */
    96144#endif
    97145
     146#endif /* not _POSIX_SOURCE */
     147
     148typedef __uint8_t       u_int8_t;
     149typedef __uint16_t      u_int16_t;
     150typedef __uint32_t      u_int32_t;
     151typedef __uint64_t      u_int64_t;
     152
    98153#endif /* not _SYS_TYPES_H */
  • trunk/src/emx/include/sys/uio.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    33#ifndef _SYS_UIO_H
    44#define _SYS_UIO_H
     5#define _SYS_UIO_H_ /*toolkit pollution*/
    56
    67#if defined (__cplusplus)
     
    1112{
    1213  caddr_t iov_base;
     14#if defined(__32BIT__) && !defined(TCPV40HDRS)
     15  size_t  iov_len;
     16#else
    1317  int     iov_len;
     18#endif
    1419};
    1520
     21
    1622/* needed for sys\socket.h TCPIPV4 now */
    17 #ifdef TCPIPV4
     23#ifdef TCPV40HDRS
    1824struct uio {
    1925        struct iovec    *uio_iov;
     
    2329        unsigned int    uio_resid;
    2430};
    25 enum    uio_rw { UIO_READ, UIO_WRITE };
     31#ifndef FREAD
    2632#define FREAD   1
    2733#define FWRITE  2
    2834#endif
     35#endif
    2936
    30 int readv (int, __const__ struct iovec *, int);
    31 int writev (int, __const__ struct iovec *, int);
     37enum    uio_rw { UIO_READ, UIO_WRITE };
    3238
    33 int _readv (int, __const__ struct iovec *, int);
    34 int _writev (int, __const__ struct iovec *, int);
     39#ifndef TCPV40HDRS
     40/* Segment flag values. */
     41enum uio_seg {
     42        UIO_USERSPACE,          /* from user data space */
     43        UIO_SYSSPACE,           /* from system space */
     44        UIO_USERISPACE          /* from user I space */
     45};
     46#endif
     47
     48int _System readv (int, __const__ struct iovec *, int);
     49int _System writev (int, __const__ struct iovec *, int);
    3550
    3651#if defined (__cplusplus)
  • trunk/src/emx/include/sys/un.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r182 r183  
    11/* Copyright (c)1996 by Holger Veit
    2  * May be freely used with EMX
     2 * May be freely used with EMX
     3 * Modified 2003 by bird
    34 */
    45
     
    67#define _SYS_UN_H_
    78
     9/** Definitions for UNIX IPC domain. */
    810struct  sockaddr_un {
     11#ifdef TCPV40HDRS
    912        u_short sun_family;     /* socket family: AF_UNIX */
     13#else
     14        u_char  sun_len;        /* sockaddr len including null */
     15        u_char  sun_family;     /* AF_UNIX */
     16#endif
    1017        char    sun_path[108];  /* path name (not used) */
    1118};
    1219
     20#ifndef TCPV40HDRS
     21/* actual length of an initialized sockaddr_un */
     22#define SUN_LEN(su) (sizeof(*(su)) - sizeof((su)->sun_path) + strlen((su)->sun_path))
     23#endif
     24
    1325#endif /* !_SYS_UN_H_ */
  • trunk/src/emx/include/unistd.h

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r182 r183  
    33#ifndef _UNISTD_H
    44#define _UNISTD_H
     5#define _UNISTD_H_ /* toolkit compatibility */
    56
    67#if defined (__cplusplus)
     
    221222#endif
    222223
     224/* Toolkit compatibility */
     225#include <sys/cdefs.h>
     226#include <sys/types.h>
     227int     _System     soclose (int);
     228
     229#ifndef _POSIX_SOURCE
     230int     _System     gethostid (void);
     231int     _System     gethostname (char *, int);
     232int     _System     iruserok (unsigned long, int, const char *, const char *);
     233int     _System     rcmd (char **, int, const char *, const char *, const char *, int *);
     234int     _System     rresvport (int *);
     235int     _System     ruserok (const char *, int, const char *, const char *);
     236#include <sys/select.h>
     237#endif /* !_POSIX_SOURCE */
     238
    223239
    224240#if defined (__cplusplus)
Note: See TracChangeset for help on using the changeset viewer.