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/arpa
Files:
4 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
Note: See TracChangeset for help on using the changeset viewer.