From e611b132f9b8abe35b362e5870b74bce94a1e58e Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 16 May 2020 20:51:50 -0700 Subject: initial commit --- private/inc/sockets/arpa/bootp.h | 74 +++++++ private/inc/sockets/arpa/ftp.h | 109 ++++++++++ private/inc/sockets/arpa/inet.h | 91 ++++++++ private/inc/sockets/arpa/nameser.h | 298 +++++++++++++++++++++++++ private/inc/sockets/arpa/telnet.h | 148 +++++++++++++ private/inc/sockets/netdb.h | 209 ++++++++++++++++++ private/inc/sockets/netinet/in.h | 433 +++++++++++++++++++++++++++++++++++++ private/inc/sockets/resolv.h | 156 +++++++++++++ private/inc/sockets/sock_err.h | 159 ++++++++++++++ private/inc/sockets/sys/psxsock.h | 222 +++++++++++++++++++ private/inc/sockets/sys/socket.h | 158 ++++++++++++++ private/inc/sockets/sys/winsock.h | 216 ++++++++++++++++++ 12 files changed, 2273 insertions(+) create mode 100644 private/inc/sockets/arpa/bootp.h create mode 100644 private/inc/sockets/arpa/ftp.h create mode 100644 private/inc/sockets/arpa/inet.h create mode 100644 private/inc/sockets/arpa/nameser.h create mode 100644 private/inc/sockets/arpa/telnet.h create mode 100644 private/inc/sockets/netdb.h create mode 100644 private/inc/sockets/netinet/in.h create mode 100644 private/inc/sockets/resolv.h create mode 100644 private/inc/sockets/sock_err.h create mode 100644 private/inc/sockets/sys/psxsock.h create mode 100644 private/inc/sockets/sys/socket.h create mode 100644 private/inc/sockets/sys/winsock.h (limited to 'private/inc/sockets') diff --git a/private/inc/sockets/arpa/bootp.h b/private/inc/sockets/arpa/bootp.h new file mode 100644 index 000000000..484be4227 --- /dev/null +++ b/private/inc/sockets/arpa/bootp.h @@ -0,0 +1,74 @@ +/*++ + +Copyright (c) 1991 Microsoft Corporation + +Module Name: + + bootp.h + +Abstract: + + Include file for the bootp daemon. + +Author: + + Sam Patton (sampa) July 26, 1991 + +Revision History: + + when who what + ---- --- ---- + 7-26-91 sampa initial version + +--*/ + +/****************************************************************** + * + * SpiderTCP Include Files + * + * Copyright 1989 Spider Systems Limited + * + * BOOTP.H + * + * Include file for the booting daemon, + * which uses BOOTP (bootstrap protocol). + * See [SRI-NIC]RFC951.TXT for a description of the protocol. + * + ******************************************************************/ + +/* + * /usr/projects/spare/PBRAIN/SCCS/pbrainG/dev/src/include/arpa/0/s.bootp.h + * @(#)bootp.h 1.1 + * + * Last delta created 16:45:42 6/14/89 + * This file extracted 08:53:49 7/10/91 + * + * Modifications: + * + * GSS 23 May 89 New File + */ + +#ifndef BOOTP_INCLUDED +#define BOOTP_INCLUDED + +struct bootp { + unchar bp_op; /* packet opcode type */ +#define BOOTREQUEST 1 +#define BOOTREPLY 2 + unchar bp_htype; /* hardware addr type */ + unchar bp_hlen; /* hardware addr length */ + unchar bp_hops; /* gateway hops */ + ulong bp_xid; /* transaction ID */ + ushort bp_secs; /* seconds since boot began */ + ushort bp_unused; + iaddr_t bp_ciaddr; /* client IP address */ + iaddr_t bp_yiaddr; /* 'your' IP address */ + iaddr_t bp_siaddr; /* server IP address */ + iaddr_t bp_giaddr; /* gateway IP address */ + unchar bp_chaddr[16]; /* client hardware address */ + unchar bp_sname[64]; /* server host name */ + unchar bp_file[128]; /* boot file name */ + unchar bp_vend[64]; /* vendor-specific area */ +}; + +#endif //BOOTP_INCLUDED diff --git a/private/inc/sockets/arpa/ftp.h b/private/inc/sockets/arpa/ftp.h new file mode 100644 index 000000000..4433e87ec --- /dev/null +++ b/private/inc/sockets/arpa/ftp.h @@ -0,0 +1,109 @@ +/*++ + +Copyright (c) 1991 Microsoft Corporation + +Module Name: + + ftp.h + +Abstract: + + ftp daemon definitions + +Author: + + Sam Patton (sampa) July 26, 1991 + +Revision History: + + when who what + ---- --- ---- + 7-26-91 sampa initial version + +--*/ + +/****************************************************************** + * + * SpiderTCP Socket Utilities + * + * Copyright 1987 Spider Systems Limited + * + * FTP.H + * + * FTP Daemon - Definitions (see RFC-765) + * + * + ******************************************************************/ + +/* + * /usr/projects/spare/PBRAIN/SCCS/pbrainG/dev/src/include/arpa/0/s.ftp.h + * @(#)ftp.h 1.2 + * + * Last delta created 20:46:15 6/24/88 + * This file extracted 08:53:49 7/10/91 + * + * Modifications: + * + * PR 01/12/87 Integrated into Admin System II, all + * projects + */ + +#ifndef FTP_INCLUDED +#define FTP_INCLUDED + +/* + * Reply codes. + */ +#define PRELIM 1 /* positive preliminary */ +#define COMPLETE 2 /* positive completion */ +#define CONTINUE 3 /* positive intermediate */ +#define TRANSIENT 4 /* transient negative completion */ +#define FTP_ERROR 5 /* permanent negative completion */ + +/* + * Type codes + */ +#define TYPE_A 1 /* ASCII */ +#define TYPE_E 2 /* EBCDIC */ +#define TYPE_I 3 /* image */ +#define TYPE_L 4 /* local byte size */ + +/* + * Form codes + */ +#define FORM_N 1 /* non-print */ +#define FORM_T 2 /* telnet format effectors */ +#define FORM_C 3 /* carriage control (ASA) */ + +/* + * Structure codes + */ +#define STRU_F 1 /* file (no record structure) */ +#define STRU_R 2 /* record structure */ +#define STRU_P 3 /* page structure */ + +/* + * Mode types + */ +#define MODE_S 1 /* stream */ +#define MODE_B 2 /* block */ +#define MODE_C 3 /* compressed */ + +/* + * Record Tokens + */ +#define REC_ESC '\377' /* Record-mode Escape */ +#define REC_EOR '\001' /* Record-mode End-of-Record */ +#define REC_EOF '\002' /* Record-mode End-of-File */ + +/* + * Block Header + */ +#define BLK_EOR 0x80 /* Block is End-of-Record */ +#define BLK_EOF 0x40 /* Block is End-of-File */ +#define BLK_ERRORS 0x20 /* Block is suspected of containing errors */ +#define BLK_RESTART 0x10 /* Block is Restart Marker */ + +#define BLK_BYTECOUNT 2 /* Bytes in this block */ + +#endif //FTP_INCLUDED diff --git a/private/inc/sockets/arpa/inet.h b/private/inc/sockets/arpa/inet.h new file mode 100644 index 000000000..d64dc631b --- /dev/null +++ b/private/inc/sockets/arpa/inet.h @@ -0,0 +1,91 @@ +/*++ + +Copyright (c) 1991 Microsoft Corporation + +Module Name: + + inet.h + +Abstract: + + ARPANet include file - network address defines and macros + +Author: + + Sam Patton (sampa) July 26, 1991 + +Revision History: + + when who what + ---- --- ---- + 7-26-91 sampa initial version + +--*/ + +/****************************************************************** + * + * SpiderTCP Net Utilities + * + * Copyright 1987 Spider Systems Limited + * + * INET.H + * + * ARPANet include file - network address defines and macros + * + ******************************************************************/ + +/* + * /usr/projects/spare/PBRAIN/SCCS/pbrainG/dev/src/include/arpa/0/s.inet.h + * @(#)inet.h 1.5 + * + * Last delta created 19:04:03 4/17/89 + * This file extracted 08:53:50 7/10/91 + * + * Modifications: + * + * IPH - 24/09/86 extend protocol table entries to include the + * protocol number and the protocol receive & + * transmit queues. + * PR - 01/12/87 Integrated into Admin System II, all projects + */ + +#ifndef INET_INCLUDED +#define INET_INCLUDED + +/* + * External definitions for + * functions in inet(3N) + */ + +unsigned long +inet_netof( + IN struct in_addr in + ); + +unsigned long PASCAL +inet_addr( + IN const char *cp + ); + +unsigned long +inet_network( + IN char *cp + ); + +unsigned long +inet_lnaof( + IN struct in_addr in + ); + +char FAR * +PASCAL FAR inet_ntoa( + IN struct in_addr in + ); + +struct in_addr +inet_makeaddr( + IN unsigned long net, + IN unsigned long host + ); + +#endif //INET_INCLUDED diff --git a/private/inc/sockets/arpa/nameser.h b/private/inc/sockets/arpa/nameser.h new file mode 100644 index 000000000..73e0489a6 --- /dev/null +++ b/private/inc/sockets/arpa/nameser.h @@ -0,0 +1,298 @@ +/*++ + +Copyright (c) 1991 Microsoft Corporation + +Module Name: + + nameser.h + +Abstract: + + Definitions for the DNS resolver and nameserver. + +Author: + + Mike Massa (mikemas) Jan 31, 1992 + +Revision History: + + Who When What + -------- -------- ---------------------------------------------- + mikemas 01-31-92 created + +Notes: + +--*/ + +/****************************************************************** + * + * SpiderTCP BIND + * + * Copyright 1990 Spider Systems Limited + * + * NAMESER.H + * + ******************************************************************/ + +/* + * /usr/projects/tcp/SCCS.rel3/rel/src/include/arpa/0/s.nameser.h + * @(#)nameser.h 5.3 + * + * Last delta created 14:06:04 3/4/91 + * This file extracted 11:19:28 3/8/91 + * + * Modifications: + * + * GSS 20 Jul 90 New File + */ + +/* + * Copyright (c) 1983, 1989 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that: (1) source distributions retain this entire copyright + * notice and comment, and (2) distributions including binaries display + * the following acknowledgement: ``This product includes software + * developed by the University of California, Berkeley and its contributors'' + * in the documentation or other materials provided with the distribution + * and in all advertising materials mentioning features or use of this + * software. Neither the name of the University nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * @(#)nameser.h 5.24 (Berkeley) 6/1/90 + */ + +#ifndef _NAMESER_INCLUDED +#define _NAMESER_INCLUDED + + +/* + * Define constants based on rfc883 + */ +#define PACKETSZ 512 /* maximum packet size */ +#define MAXDNAME 256 /* maximum domain name */ +#define MAXCDNAME 255 /* maximum compressed domain name */ +#define MAXLABEL 63 /* maximum length of domain label */ + /* Number of bytes of fixed size data in query structure */ +#define QFIXEDSZ 4 + /* number of bytes of fixed size data in resource record */ +#define RRFIXEDSZ 10 + +/* + * Internet nameserver port number + */ +#define NAMESERVER_PORT 53 + +/* + * Currently defined opcodes + */ +#define QUERY 0x0 /* standard query */ +#define IQUERY 0x1 /* inverse query */ +#define STATUS 0x2 /* nameserver status query */ +/*#define xxx 0x3 /* 0x3 reserved */ + /* non standard */ +#define UPDATEA 0x9 /* add resource record */ +#define UPDATED 0xa /* delete a specific resource record */ +#define UPDATEDA 0xb /* delete all nemed resource record */ +#define UPDATEM 0xc /* modify a specific resource record */ +#define UPDATEMA 0xd /* modify all named resource record */ + +#define ZONEINIT 0xe /* initial zone transfer */ +#define ZONEREF 0xf /* incremental zone referesh */ + +/* + * Currently defined response codes + */ +#ifndef NOERROR +#define NOERROR 0 /* no error */ +#endif +#define FORMERR 1 /* format error */ +#define SERVFAIL 2 /* server failure */ +#define NXDOMAIN 3 /* non existent domain */ +#define NOTIMP 4 /* not implemented */ +#define REFUSED 5 /* query refused */ + /* non standard */ +#define NOCHANGE 0xf /* update failed to change db */ + +/* + * Type values for resources and queries + */ +#define T_A 1 /* host address */ +#define T_NS 2 /* authoritative server */ +#define T_MD 3 /* mail destination */ +#define T_MF 4 /* mail forwarder */ +#define T_CNAME 5 /* connonical name */ +#define T_SOA 6 /* start of authority zone */ +#define T_MB 7 /* mailbox domain name */ +#define T_MG 8 /* mail group member */ +#define T_MR 9 /* mail rename name */ +#define T_NULL 10 /* null resource record */ +#define T_WKS 11 /* well known service */ +#define T_PTR 12 /* domain name pointer */ +#define T_HINFO 13 /* host information */ +#define T_MINFO 14 /* mailbox information */ +#define T_MX 15 /* mail routing information */ +#define T_TXT 16 /* text strings */ +#define T_AFSDB 18 /* AFS database servers */ + /* non standard */ +#define T_UINFO 100 /* user (finger) information */ +#define T_UID 101 /* user ID */ +#define T_GID 102 /* group ID */ +#define T_UNSPEC 103 /* Unspecified format (binary data) */ + /* Query type values which do not appear in resource records */ +#define T_AXFR 252 /* transfer zone of authority */ +#define T_MAILB 253 /* transfer mailbox records */ +#define T_MAILA 254 /* transfer mail agent records */ +#define T_ANY 255 /* wildcard match */ + +/* + * Values for class field + */ + +#define C_IN 1 /* the arpa internet */ +#define C_CHAOS 3 /* for chaos net at MIT */ +#define C_HS 4 /* for Hesiod name server at MIT */ + /* Query class values which do not appear in resource records */ +#define C_ANY 255 /* wildcard match */ + +/* + * Status return codes for T_UNSPEC conversion routines + */ +#define CONV_SUCCESS 0 +#define CONV_OVERFLOW -1 +#define CONV_BADFMT -2 +#define CONV_BADCKSUM -3 +#define CONV_BADBUFLEN -4 + +#ifndef BYTE_ORDER +#define LITTLE_ENDIAN 1234 /* least-significant byte first (vax) */ +#define BIG_ENDIAN 4321 /* most-significant byte first (IBM, net) */ +#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long (pdp) */ + +#if defined(vax) || defined(ns32000) || defined(sun386) || defined(MIPSEL) || \ + defined(BIT_ZERO_ON_RIGHT) +#define BYTE_ORDER LITTLE_ENDIAN + +#endif +#if defined(sel) || defined(pyr) || defined(mc68000) || defined(sparc) || \ + defined(is68k) || defined(tahoe) || defined(ibm032) || defined(ibm370) || \ + defined(MIPSEB) || defined (BIT_ZERO_ON_LEFT) +#define BYTE_ORDER BIG_ENDIAN +#endif +#ifndef BYTE_ORDER /* still not defined */ +#if defined(u3b2) || defined(m68k) +#define BYTE_ORDER BIG_ENDIAN +#endif +#if defined(i286) || defined(i386) || defined(_MIPS_) || defined(_ALPHA_) || defined(_PPC_) +#define BYTE_ORDER LITTLE_ENDIAN +#endif +#endif /* ~BYTE_ORDER */ +#endif /* BYTE_ORDER */ + +#ifndef BYTE_ORDER + /* you must determine what the correct bit order is for your compiler */ + UNDEFINED_BIT_ORDER; +#endif +/* + * Structure for query header, the order of the fields is machine and + * compiler dependent, in our case, the bits within a byte are assignd + * least significant first, while the order of transmition is most + * significant first. This requires a somewhat confusing rearrangement. + */ + +typedef struct { + unsigned short id; /* query identification number */ +#if BYTE_ORDER == BIG_ENDIAN + /* fields in third byte */ + unsigned char qr:1; /* response flag */ + unsigned char opcode:4; /* purpose of message */ + unsigned char aa:1; /* authoritive answer */ + unsigned char tc:1; /* truncated message */ + unsigned char rd:1; /* recursion desired */ + /* fields in fourth byte */ + unsigned char ra:1; /* recursion available */ + unsigned char pr:1; /* primary server required (non standard) */ + unsigned char unused:2; /* unused bits */ + unsigned char rcode:4; /* response code */ +#endif +#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN + /* fields in third byte */ + unsigned char rd:1; /* recursion desired */ + unsigned char tc:1; /* truncated message */ + unsigned char aa:1; /* authoritive answer */ + unsigned char opcode:4; /* purpose of message */ + unsigned char qr:1; /* response flag */ + /* fields in fourth byte */ + unsigned char rcode:4; /* response code */ + unsigned char unused:2; /* unused bits */ + unsigned char pr:1; /* primary server required (non standard) */ + unsigned char ra:1; /* recursion available */ +#endif + /* remaining bytes */ + unsigned short qdcount; /* number of question entries */ + unsigned short ancount; /* number of answer entries */ + unsigned short nscount; /* number of authority entries */ + unsigned short arcount; /* number of resource entries */ +} HEADER; + +/* + * Defines for handling compressed domain names + */ +#define INDIR_MASK 0xc0 + +/* + * Structure for passing resource records around. + */ +struct rrec { + short r_zone; /* zone number */ + short r_class; /* class number */ + short r_type; /* type number */ + unsigned long r_ttl; /* time to live */ + int r_size; /* size of data area */ + char *r_data; /* pointer to data */ +}; + +extern unsigned short _getshort(); +extern unsigned long _getlong(); + +/* + * Inline versions of get/put short/long. + * Pointer is advanced; we assume that both arguments + * are lvalues and will already be in registers. + * cp MUST be unsigned char *. + */ +#define GETSHORT(s, cp) { \ + (s) = *(cp)++ << 8; \ + (s) |= *(cp)++; \ +} + +#define GETLONG(l, cp) { \ + (l) = *(cp)++ << 8; \ + (l) |= *(cp)++; (l) <<= 8; \ + (l) |= *(cp)++; (l) <<= 8; \ + (l) |= *(cp)++; \ +} + + +#define PUTSHORT(s, cp) { \ + *(cp)++ = (s) >> 8; \ + *(cp)++ = (s); \ +} + +/* + * Warning: PUTLONG destroys its first argument. + */ +#define PUTLONG(l, cp) { \ + (cp)[3] = l; \ + (cp)[2] = (l >>= 8); \ + (cp)[1] = (l >>= 8); \ + (cp)[0] = l >> 8; \ + (cp) += sizeof(unsigned long); \ +} + +#endif // _NAMESER_INCLUDED diff --git a/private/inc/sockets/arpa/telnet.h b/private/inc/sockets/arpa/telnet.h new file mode 100644 index 000000000..c9e18c11f --- /dev/null +++ b/private/inc/sockets/arpa/telnet.h @@ -0,0 +1,148 @@ +/*++ + +Copyright (c) 1991 Microsoft Corporation + +Module Name: + + telnet.h + +Abstract: + + User telnet, remote login utility - includes. Taken directly from Spider's + sources + +Author: + + Sam Patton (sampa) July 26, 1991 + +Revision History: + + when who what + ---- --- ---- + 7-26-91 sampa initial version + +--*/ + +/****************************************************************** + * + * SpiderTCP Socket Utilities + * + * Copyright 1987 Spider Systems Limited + * + * TELNET.H + * + * User telnet, remote login utility - includes + * + * + ******************************************************************/ + +/* + * /usr/projects/spare/PBRAIN/SCCS/pbrainG/dev/src/include/arpa/0/s.telnet.h + * @(#)telnet.h 1.2 + * + * Last delta created 20:46:00 6/24/88 + * This file extracted 08:53:50 7/10/91 + * + * Modifications: + * + * PR 01/12/87 Integrated into Admin System II, all + * projects + */ + +#ifndef TELNET_INCLUDED +#define TELNET_INCLUDED + +/* + * Definitions for the TELNET protocol. + */ +#define IAC 255 /* interpret as command: */ +#define DONT 254 /* you are not to use option */ +#define DO 253 /* please, you use option */ +#define WONT 252 /* I won't use option */ +#define WILL 251 /* I will use option */ +#define SB 250 /* interpret as subnegotiation */ +#define GA 249 /* you may reverse the line */ +#define EL 248 /* erase the current line */ +#define EC 247 /* erase the current character */ +#define AYT 246 /* are you there */ +#define AO 245 /* abort output--but let prog finish */ +#define IP 244 /* interrupt process--permanently */ +#define BREAK 243 /* break */ +#define DM 242 /* data mark--for connect. cleaning */ +#define NOP 241 /* nop */ +#define SE 240 /* end sub negotiation */ + +#define SYNCH 242 /* for telfunc calls */ + +/* Telnet options - Names have been truncated to be unique in 7 chars */ + + +#define TO_BINARY 0 /* 8-bit data path */ +#define TO_ECHO 1 /* echo */ +#define TO_RCP 2 /* prepare to reconnect */ +#define TO_SGA 3 /* suppress go ahead */ +#define TO_NAMS 4 /* approximate message size */ +#define TO_STATUS 5 /* give status */ +#define TO_TM 6 /* timing mark */ +#define TO_RCTE 7 /* remote controlled transmission and echo */ +#define TO_NL 8 /* negotiate about output line width */ +#define TO_NP 9 /* negotiate about output page size */ +#define TO_NCRD 10 /* negotiate about CR disposition */ +#define TO_NHTS 11 /* negotiate about horizontal tabstops */ +#define TO_NHTD 12 /* negotiate about horizontal tab disposition */ +#define TO_NFFD 13 /* negotiate about formfeed disposition */ +#define TO_NVTS 14 /* negotiate about vertical tab stops */ +#define TO_NVTD 15 /* negotiate about vertical tab disposition */ +#define TO_NLFD 16 /* negotiate about output LF disposition */ +#define TO_XASCII 17 /* extended ascic character set */ +#define TO_LOGOUT 18 /* force logout */ +#define TO_BM 19 /* byte macro */ +#define TO_DET 20 /* data entry terminal */ +#define TO_SUPDUP 21 /* supdup protocol */ +#define TO_TERM_TYPE 24 /* terminal type */ +#define TO_EXOPL 255 /* extended-options-list */ + +/* Define (real) long names to be the shorter ones */ + +#define TELOPT_BINARY TO_BINARY +#define TELOPT_ECHO TO_ECHO +#define TELOPT_RCP TO_RCP +#define TELOPT_SGA TO_SGA +#define TELOPT_NAMS TO_NAMS +#define TELOPT_STATUS TO_STATUS +#define TELOPT_TM TO_TM +#define TELOPT_RCTE TO_RCTE +#define TELOPT_NAOL TO_NL +#define TELOPT_NAOP TO_NP +#define TELOPT_NAOCRD TO_NCRD +#define TELOPT_NAOHTS TO_NHTS +#define TELOPT_NAOHTD TO_NHTD +#define TELOPT_NAOFFD TO_NFFD +#define TELOPT_NAOVTS TO_NVTS +#define TELOPT_NAOVTD TO_NVTD +#define TELOPT_NAOLFD TO_NLFD +#define TELOPT_XASCII TO_XASCII +#define TELOPT_LOGOUT TO_LOGOUT +#define TELOPT_BM TO_BM +#define TELOPT_DET TO_DET +#define TELOPT_SUPDUP TO_SUPDUP +#define TELOPT_EXOPL TO_EXOPL + +#ifdef TELCMDS +char *telcmds[] = { + "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC", + "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", +}; +#endif + +#ifdef TELOPTS +char *telopts[] = { + "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME", + "STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP", + "NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS", + "NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO", + "DATA ENTRY TERMINAL", "SUPDUP" +}; +#endif + +#endif //TELNET_INCLUDED diff --git a/private/inc/sockets/netdb.h b/private/inc/sockets/netdb.h new file mode 100644 index 000000000..468b2daec --- /dev/null +++ b/private/inc/sockets/netdb.h @@ -0,0 +1,209 @@ +/*++ + +Copyright (c) 1991 Microsoft Corporation + +Module Name: + + netdb.h + +Abstract: + + This contains the #defines for the tcp/ip net database operations + +Author: + + Sam Patton (sampa) July 26, 1991 + +Revision History: + + when who what + ---- --- ---- + 7-26-91 sampa initial version + +--*/ + +/*- + * Copyright (c) 1980, 1983, 1988 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that: (1) source distributions retain this entire copyright + * notice and comment, and (2) distributions including binaries display + * the following acknowledgement: ``This product includes software + * developed by the University of California, Berkeley and its contributors'' + * in the documentation or other materials provided with the distribution + * and in all advertising materials mentioning features or use of this + * software. Neither the name of the University nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * @(#)netdb.h 5.11 (Berkeley) 5/21/90 + */ + +#ifndef NETDB_INCLUDED +#define NETDB_INCLUDED + +#define _PATH_HEQUIV "/etc/hosts.equiv" +#define _PATH_HOSTS "/etc/hosts" +#define _PATH_NETWORKS "/etc/networks" +#define _PATH_PROTOCOLS "/etc/protocols" +#define _PATH_SERVICES "/etc/services" + +/* + * Structures returned by network data base library. All addresses are + * supplied in host order, and returned in network order (suitable for + * use in system calls). + */ +struct hostent { + char *h_name; /* official name of host */ + char **h_aliases; /* alias list */ + int h_addrtype; /* host address type */ + int h_length; /* length of address */ + char **h_addr_list; /* list of addresses from name server */ +#define h_addr h_addr_list[0] /* address, for backward compatiblity */ +}; + +/* + * Assumption here is that a network number + * fits in 32 bits -- probably a poor one. + */ +struct netent { + char *n_name; /* official name of net */ + char **n_aliases; /* alias list */ + int n_addrtype; /* net address type */ + unsigned long n_net; /* network # */ +}; + +struct servent { + char *s_name; /* official service name */ + char **s_aliases; /* alias list */ + int s_port; /* port # */ + char *s_proto; /* protocol to use */ +}; + +struct protoent { + char *p_name; /* official protocol name */ + char **p_aliases; /* alias list */ + int p_proto; /* protocol # */ +}; + + +// +// Network table access function prototypes +// + +struct hostent * +gethostbyname( + char *name + ); + +struct hostent * +gethostbyaddr( + char *addr, + int len, + int type + ); + +void +sethostent( + int stayopen + ); + +void +endhostent( + void + ); + +struct netent * +getnetent( + void + ); + +struct netent * +getnetbyaddr( + unsigned long net, + int type + ); + +struct netent * +getnetbyname( + char *name + ); + +void +setnetent( + int stayopen + ); + +void +endnetent( + void + ); + +struct protoent * +getprotoent( + void + ); + +struct protoent * +getprotobynumber( + int proto + ); + +struct protoent * +getprotobyname( + char *name + ); + +void +setprotoent( + int stayopen + ); + +void +endprotoent( + void + ); + +struct servent * +getservent( + void + ); + +struct servent * +getservbyport( + int port, + char *proto + ); + +struct servent * +getservbyname( + char *name, + char *proto + ); + +void +setservent( + int stayopen + ); + +void +endservent( + void + ); + +/* + * Error return codes from gethostbyname() and gethostbyaddr() + * (left in extern int h_errno). + */ + +#define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */ +#define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */ +#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */ +#define NO_DATA 4 /* Valid name, no data record of requested type */ +#define NO_ADDRESS NO_DATA /* no address, look for MX record */ + +#endif //NETDB_INCLUDED diff --git a/private/inc/sockets/netinet/in.h b/private/inc/sockets/netinet/in.h new file mode 100644 index 000000000..53c264937 --- /dev/null +++ b/private/inc/sockets/netinet/in.h @@ -0,0 +1,433 @@ +/*++ + +Copyright (c) 1991 Microsoft Corporation + +Module Name: + + in.h + +Abstract: + + A version of the BSD 4.2 file for NT tcp + +Author: + + Sam Patton (sampa) July 26, 1991 + +Revision History: + + when who what + ---- --- ---- + 7-26-91 sampa initial version + +--*/ + +/****************************************************************** + * + * SpiderTCP Application Include Files + * + * Spider Systems Limited + * + * IN.H + * + * A version of the BSD 4.2 file + * for SpiderTCP + * + * + ******************************************************************/ + +/* + * /usr/projects/spare/PBRAIN/SCCS/pbrainG/dev/src/include/netinet/0/s.in.h + * @(#)in.h 1.31 + * + * Last delta created 13:33:59 8/27/90 + * This file extracted 08:53:51 7/10/91 + * + * Modifications: + * + */ + +#ifndef IN_INCLUDED +#define IN_INCLUDED + + +#ifdef PROJ8 +/* + * BYTESWAP should be undef'ed if the machine's byte order + * is the same as network byte order - if it is the reverse + * it should be set to 1. + */ +#define BYTESWAP 1 +#endif +#ifdef PROJ11 +/* + * BYTESWAP should be undef'ed if the machine's byte order + * is the same as network byte order - if it is the reverse + * it should be set to 1. + */ +#define BYTESWAP 1 +#endif + +#ifdef PROJ9 +/* + * BYTESWAP should be undef'ed if the machine's byte order + * is the same as network byte order - if it is the reverse + * it should be set to 1. + */ +#if m68k +#undef BYTESWAP +#define EMBED 1 +#else +#define BYTESWAP 1 +#undef EMBED +#endif +#endif + + +#ifndef BYTESWAP +# ifdef i386 +# define BYTESWAP 1 +# endif +# ifdef MIPS +# define BYTESWAP 1 +# endif +# ifdef ALPHA +# define BYTESWAP 1 +# endif +# ifdef PPC +# define BYTESWAP 1 +# endif +#endif + + +#define TLI_TCP "/dev/tcp" /* or else */ +#define TLI_UDP "/dev/udp" /* or else */ + +/* + * Protocols + */ +#define IPPROTO_IP 256 /* IP (for socket options etc) */ +#define IPPROTO_ICMP 1 /* control message protocol */ +#define IPPROTO_GGP 2 /* gateway^2 (deprecated) */ +#define IPPROTO_TCP 6 /* tcp */ +#define IPPROTO_EGP 8 /* exterior gateway protocol */ +#define IPPROTO_PUP 12 /* pup */ +#define IPPROTO_UDP 17 /* user datagram protocol */ + +#define IPPROTO_RAW 255 /* raw IP packet */ +#define IPPROTO_MAX 256 + + +#define ICMP_PROT IPPROTO_ICMP +#define GWAY_PROT 3 +#define TCP_PROT IPPROTO_TCP +#define UDP_PROT IPPROTO_UDP + + +#include + +#if 0 +/* + * define structure for DARPA internet address + * usually use "longs" to access but sometimes need to split into + * components + */ + +typedef union { + char typea[4]; /* 4 x 8 bit version */ + short typeb[2]; /* 2 x 16 bit */ + long typec; /* 1 x 32 bit */ +} IN_ADDRESS; +#endif + + +/* + * Port/socket numbers: network standard functions + */ +#define IPPORT_ECHO 7 +#define IPPORT_DISCARD 9 +#define IPPORT_SYSTAT 11 +#define IPPORT_DAYTIME 13 +#define IPPORT_NETSTAT 15 +#define IPPORT_FTP 21 +#define IPPORT_TELNET 23 +#define IPPORT_SMTP 25 +#define IPPORT_TIMESERVER 37 +#define IPPORT_NAMESERVER 42 +#define IPPORT_WHOIS 43 +#define IPPORT_MTP 57 + +/* + * Port/socket numbers: host specific functions + */ +#define IPPORT_TFTP 69 +#define IPPORT_RJE 77 +#define IPPORT_FINGER 79 +#define IPPORT_TTYLINK 87 +#define IPPORT_SUPDUP 95 + +#define IPPORT_BIFFUDP 512 +#define IPPORT_EXECSERVER 512 +#define IPPORT_LOGINSERVER 513 +#define IPPORT_WHOSERVER 513 +#define IPPORT_CMDSERVER 514 + +/* + * Ports < IPPORT_RESERVED are reserved for + * privileged processes (e.g. root). + */ +#define IPPORT_RESERVED 1024 + +/* + * Link numbers + */ +#define IMPLINK_IP 155 +#define IMPLINK_LOWEXPER 156 +#define IMPLINK_HIGHEXPER 158 + + +/* + * Internet address + */ +struct in_addr { + union { + struct { unsigned char s_b1,s_b2,s_b3,s_b4; } S_un_b; + struct { unsigned short s_w1,s_w2; } S_un_w; + unsigned long S_addr; + } S_un; +#define s_addr S_un.S_addr /* can be used for most tcp & ip code */ +#define s_host S_un.S_un_b.s_b2 /* host on imp */ +#define s_net S_un.S_un_b.s_b1 /* network */ +#define s_imp S_un.S_un_w.s_w2 /* imp */ +#define s_impno S_un.S_un_b.s_b4 /* imp # */ +#define s_lh S_un.S_un_b.s_b3 /* logical host */ +}; + +/* + * Definitions of bits in internet address integers. + */ +#define IN_CLASSA(i) ((((long)(i))&0x80000000)==0) +#define IN_CLASSA_NET 0xff000000 +#define IN_CLASSA_NSHIFT 24 +#define IN_CLASSA_HOST 0x00ffffff +#define IN_CLASSA_MAX 128 + +#define IN_CLASSB(i) ((((long)(i))&0xc0000000)==0x80000000) +#define IN_CLASSB_NET 0xffff0000 +#define IN_CLASSB_NSHIFT 16 +#define IN_CLASSB_HOST 0x0000ffff +#define IN_CLASSB_MAX 65536 + +#define IN_CLASSC(i) ((((long)(i))&0xe0000000)==0xc0000000) +#define IN_CLASSC_NET 0xffffff00 +#define IN_CLASSC_NSHIFT 8 +#define IN_CLASSC_HOST 0x000000ff + +#define INADDR_ANY 0x00000000 +#define INADDR_BROADCAST 0xffffffff + +/* + * Socket address, internet style. + */ +struct sockaddr_in { + short sin_family; + unsigned short sin_port; + struct in_addr sin_addr; + char sin_zero[8]; +}; + +/* Length of a SOCKADDR or SOCKADDR_IN structure */ +#define SOCAD_LEN 16 + +#ifdef BYTESWAP + +#define htons(x) ((((x) >> 8) & 0x00FF) | (((x) << 8) & 0xFF00)) + +// +//BUGBUG - we need to investigate this +// + +#define FUTURE 1 +#ifdef FUTURE +/* + * this macro should be used if its faster than the function + * - measure it on the target machine + */ +#ifndef i386 +#define htonl(x) ((((x) >> 24) & 0x000000FFL) | \ + (((x) >> 8) & 0x0000FF00L) | \ + (((x) << 8) & 0x00FF0000L) | \ + (((x) << 24) & 0xFF000000L)) +#else + +__inline long +htonl(long x) +{ + return((((x) >> 24) & 0x000000FFL) | + (((x) >> 8) & 0x0000FF00L) | + (((x) << 8) & 0x00FF0000L) | + (((x) << 24) & 0xFF000000L)); +} + +#endif /* i386 */ +#else +extern long htonl(); +#endif +#undef FUTURE + +#define ntohs(x) htons(x) +#define ntohl(x) htonl(x) + +#define MASKA 0x000000FFL +#define MASKB 0x0000FFFFL +#define MASKC 0x00FFFFFFL +#define CLSHFT 5 /* Make C generate hyper-optimized case */ + +#else +/* + * Macros for number representation conversion. + */ +#define ntohl(x) (x) +#define ntohs(x) (x) +#define htonl(x) (x) +#define htons(x) (x) + +#define MASKA 0xFF000000L +#define MASKB 0xFFFF0000L +#define MASKC 0xFFFFFF00L +#define CLSHFT 29 +#endif + +#define CLA0 0 /* It takes the same arg; you mask it off, */ +#define CLA1 1 /* shift, and then do a case statment with */ +#define CLA2 2 /* some code having more than one label. */ +#define CLA3 3 /* Values for class A */ +#define CLB0 4 +#define CLB1 5 /* B */ +#define CLC 6 /* C */ +#define CLI 7 /* Illegal */ + +#define BROADCAST 0x00000000L + +#define CASTA 0x00FFFFFFL +#define CASTB 0x0000FFFFL +#define CASTC 0x000000FFL + + +/****************************************************************** + * + * Type Codes for Ethernet packets + * + ******************************************************************/ + +#define TY_ETHER 1 +#ifndef TYPE_HACK +#define TY_PUP 0x0200 +#define TY_IDP 0x0600 +#define TY_IP 0x0800 +#define TY_X25 0x0805 +#define TY_ARP 0x0806 +#define TY_RARP 0x8035 +#ifndef NOTRAILER +#define TY_TRAIL 0x1000 +#define TY_TRAIL_LO 0x1001 +#define TY_TRAIL_HI 0x1002 +#endif +#define TY_ECHO 0x9000 +#else /*TYPE_HACK*/ +#define TY_PUP 0x0200 +#define TY_IDP 0x0600 +#define TY_IP 0x0807 /* modified */ +#define TY_X25 0x0805 +#define TY_ARP 0x0808 /* modified */ +#ifndef NOTRAILER +#define TY_TRAIL 0x2000 /* modified */ +#define TY_TRAIL_LO 0x2001 /* modified */ +#define TY_TRAIL_HI 0x2002 /* modified */ +#endif +#define TY_ECHO 0x9000 +#endif /*TYPE_HACK*/ + +/****************************************************************** + * + * Type Codes for Arcnet packets + * + ******************************************************************/ + +#define ARCNET_TY_IP 0xd4 +#define ARCNET_TY_ARP 0xd5 +#define ARCNET_TY_RARP 0xd6 + +/* + * LOOPBACK Address - in host and network byte order + */ +#define LOOPBACK 0x7F000001L +#ifdef BYTESWAP +#define NLOOPBACK 0x0100007FL +#else +#define NLOOPBACK 0x7F000001L +#endif + +/* + * interface flags + */ +#define IFF_UP 0x01 +#define IFF_BROADCAST 0x02 +#define IFF_LOOPBACK 0x04 +#define IFF_POINTOPOINT 0x08 +#define IFF_FORWARDBROADCAST 0x10 +#define IFF_NOKEEPALIVE 0x20 +#define IFF_SLOWLINK 0x40 + + +/* + * IP Options + */ + +#define IPO_TTL 103 +#define IPO_TOS 104 +#define IPO_OPTS 105 +#define IPO_RDOPTION 106 +#define IPO_RDROUTE IPO_RDOPTION +#define IPO_OPTCOUNT 107 +#define IPO_RRCOUNT IPO_OPTCOUNT + + +/* + * IP Option values + */ + +#define OPT_SECURITY 130 +#define OPT_LSRR 131 +#define OPT_SSRR 137 +#define OPT_RR 7 +#define OPT_STRID 136 +#define OPT_TIMESTAMP 68 + +/* + * Default Time to Live + */ + +#define IHTTL 60 + +/* + * Maximum number of hops stored in a recorded route packet + */ + +#define TCP_RR_MAX 16 + +#define MAXOPTLEN 256 + +#ifndef GENERICE +/* + * errors generated + */ +#define EFRGSZ 1 +#define EDLTYPE 2 +#define EPRIM 3 +#define EBUF 4 +#define EMSG 5 +#endif /*~GENERICE*/ + +#endif //IN_INCLUDED + diff --git a/private/inc/sockets/resolv.h b/private/inc/sockets/resolv.h new file mode 100644 index 000000000..5edc854c4 --- /dev/null +++ b/private/inc/sockets/resolv.h @@ -0,0 +1,156 @@ +/****************************************************************** + * + * SpiderTCP BIND + * + * Copyright 1990 Spider Systems Limited + * + * RESOLV.H + * + ******************************************************************/ + +/* + * /usr/projects/tcp/SCCS.rel3/rel/src/include/0/s.resolv.h + * @(#)resolv.h 5.3 + * + * Last delta created 14:05:35 3/4/91 + * This file extracted 11:19:25 3/8/91 + * + * Modifications: + * + * GSS 20 Jul 90 New File + */ + +/* + * Copyright (c) 1983, 1987, 1989 The Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that: (1) source distributions retain this entire copyright + * notice and comment, and (2) distributions including binaries display + * the following acknowledgement: ``This product includes software + * developed by the University of California, Berkeley and its contributors'' + * in the documentation or other materials provided with the distribution + * and in all advertising materials mentioning features or use of this + * software. Neither the name of the University nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * @(#)resolv.h 5.10 (Berkeley) 6/1/90 + */ + +#ifndef _RESOLV_INCLUDED +#define _RESOLV_INCLUDED + +/* + * Global defines and variables for resolver stub. + */ +#define MAXNS 8 /* max # name servers we'll track per list */ +#define MAXNSLIST 4 /* max # name servers lists we'll track */ +#define MAXDFLSRCH 3 /* # default domain levels to try */ +#define MAXDNSRCH 6 /* max # domains in search path */ +#define LOCALDOMAINPARTS 2 /* min levels in name that is "local" */ +#define RES_TIMEOUT 5 /* min. seconds between retries */ + +typedef struct _ADDR_LIST { + u_long ServerCount; + u_long Servers[MAXNS]; + +} ADDR_LIST, FAR * LPADDR_LIST; + +struct state { + long options; /* option flags - see below. */ + int retrans; /* retransmition time interval */ + u_short retry; /* number of times to retransmit */ + u_short id; /* current packet id */ + ADDR_LIST nslist[MAXNSLIST]; /* the server lists */ + char defdname[MAXDNAME]; /* default domain */ + char *dnsrch[MAXDNSRCH+1]; /* components of domain to search */ +}; + +/* + * Resolver options + */ +#define RES_INIT 0x0001 /* address initialized */ +#define RES_DEBUG 0x0002 /* print debug messages */ +#define RES_AAONLY 0x0004 /* authoritative answers only */ +#define RES_USEVC 0x0008 /* use virtual circuit */ +#define RES_PRIMARY 0x0010 /* query primary server only */ +#define RES_IGNTC 0x0020 /* ignore trucation errors */ +#define RES_RECURSE 0x0040 /* recursion desired */ +#define RES_DEFNAMES 0x0080 /* use default domain name */ +#define RES_STAYOPEN 0x0100 /* Keep TCP socket open */ +#define RES_DNSRCH 0x0200 /* search up local domain tree */ + +#define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH) + + +// +// Resolver function prototypes +// + +int +dn_expand( + IN unsigned char *msg, + IN unsigned char *eomorig, + IN unsigned char *comp_dn, + OUT unsigned char *exp_dn, + IN int length + ); + +int +dn_comp( + IN unsigned char *exp_dn, + OUT unsigned char *comp_dn, + IN int length, + IN unsigned char **dnptrs, OPTIONAL + IN OUT unsigned char **lastdnptr OPTIONAL + ); + +int +res_init( + void + ); + +int +res_send( + IN char *buf, + IN int buflen, + OUT char *answer, + IN int anslen + ); + +int +res_query( + IN char *name, /* domain name */ + IN int class, /* class of query */ + IN int type, /* type of query */ + OUT unsigned char *answer, /* buffer to put answer */ + IN int anslen /* size of answer buffer */ + ); + +int +res_search( + IN char *name, /* domain name */ + IN int class, /* class of query */ + IN int type, /* type of query */ + OUT unsigned char *answer, /* buffer to put answer */ + IN int anslen /* size of answer */ + ); + +int +res_mkquery( + IN int op, // opcode of query + IN char *dname, // domain name + IN int class, // class of query + IN int type, // type of query + IN char *data, OPTIONAL // resource record data + IN int datalen, OPTIONAL // length of data + IN struct rrec *newrr, OPTIONAL // new rr for modify or append + OUT char *buf, // buffer to put query + IN int buflen // size of buffer + ); + +#endif // _RESOLV_INCLUDED diff --git a/private/inc/sockets/sock_err.h b/private/inc/sockets/sock_err.h new file mode 100644 index 000000000..2934efbd2 --- /dev/null +++ b/private/inc/sockets/sock_err.h @@ -0,0 +1,159 @@ +/*++ + +Copyright (c) 1991 Microsoft Corporation + +Module Name: + + sock_err.h + +Abstract: + + This module contains error codes for sockets and STREAMS sources. + +Author: + + Sam Patton (sampa) July 26, 1991 + +Revision History: + + when who what + ---- --- ---- + 7-26-91 sampa initial version (in posix\sys\errno.h) + 9-19-91 mikemas extracted these codes from posix\sys\errno.h + +Notes: + +--*/ +/* + * Copyright (c) 1984 AT&T + * Copyright (c) 1987 Fairchild Semiconductor Corporation + * Copyright 1987 Lachman Associates, Incorporated (LAI) + * All Rights Reserved + * + * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T, + * FAIRCHILD SEMICONDUCTOR CORPORATION, + * (AND LACHMAN ASSOCIATES) + * AND SPIDER SYSTEMS. + * + * stcp copyright above and this notice must be preserved in all + * copies of this source code. The copyright above does not + * evidence any actual or intended publication of this source + * code + */ + +#ifndef SOCK_ERR_INCLUDED +#define SOCK_ERR_INCLUDED + + +// in CRT #define ENOTBLK 54 /* Block device required */ +// in CRT #define ETXTBSY 55 /* Text file busy */ +#define ENOMSG 56 /* No message of desired type */ +#define EIDRM 57 /* Identifier removed */ +#define ECHRNG 58 /* Channel number out of range */ +#define EL2NSYNC 59 /* Level 2 not synchronized */ +#define EL3HLT 60 /* Level 3 halted */ +#define EL3RST 61 /* Level 3 reset */ +#define ELNRNG 62 /* Link number out of range */ +#define EUNATCH 63 /* Protocol driver not attached */ +#define ENOCSI 64 /* No CSI structure available */ +#define EL2HLT 65 /* Level 2 halted */ + +/* Convergent Error Returns */ +#define EBADE 66 /* invalid exchange */ +#define EBADR 67 /* invalid request descriptor */ +#define EXFULL 68 /* exchange full */ +#define ENOANO 69 /* no anode */ +#define EBADRQC 70 /* invalid request code */ +#define EBADSLT 71 /* invalid slot */ +// in CRT #define EDEADLOCK 72 /* file locking deadlock error */ + +#define EBFONT 73 /* bad font file fmt */ + +/* stream problems */ +#define ENOSTR 74 /* Device not a stream */ +#define ENODATA 75 /* no data (for no delay io) */ +#define ETIME 76 /* timer expired */ +#define ENOSR 77 /* out of streams resources */ + +#define ENONET 78 /* Machine is not on the network */ +#define ENOPKG 79 /* Package not installed */ +#define EREMOTE 80 /* The object is remote */ +#define ENOLINK 81 /* the link has been severed */ +#define EADV 82 /* advertise error */ +#define ESRMNT 83 /* srmount error */ + +#define ECOMM 84 /* Communication error on send */ +#define EPROTO 85 /* Protocol error */ +#define EMULTIHOP 86 /* multihop attempted */ +#define ELBIN 87 /* Inode is remote (not really error)*/ +#define EDOTDOT 88 /* Cross mount point (not really error)*/ +#define EBADMSG 89 /* trying to read unreadable message */ + +#define ENOTUNIQ 90 /* given log. name not unique */ +#define EREMCHG 91 /* Remote address changed */ + +/* shared library problems */ +#define ELIBACC 92 /* Can't access a needed shared lib. */ +#define ELIBBAD 93 /* Accessing a corrupted shared lib. */ +#define ELIBSCN 94 /* .lib section in a.out corrupted. */ +#define ELIBMAX 95 /* Attempting to link in too many libs. */ +#define ELIBEXEC 96 /* Attempting to exec a shared library. */ + + +/* + * Additional error codes for the socket library + */ + +#define EWOULDBLOCK EAGAIN /* Operation would block */ + +#define ENOTSOCK 100 /* Socket operation on non-socket */ +#define EADDRNOTAVAIL 101 /* Can't assign requested address */ +#define EADDRINUSE 102 /* Address already in use */ +#define EAFNOSUPPORT 103 + /* Address family not supported by protocol family */ +#define ESOCKTNOSUPPORT 104 /* Socket type not supported */ +#define EPROTONOSUPPORT 105 /* Protocol not supported */ +#define ENOBUFS 106 /* No buffer space available */ +#define ETIMEDOUT 107 /* Connection timed out */ +#define EISCONN 108 /* Socket is already connected */ +#define ENOTCONN 109 /* Socket is not connected */ +#define ENOPROTOOPT 110 /* Bad protocol option */ +#define ECONNRESET 111 /* Connection reset by peer */ +#define ECONNABORT 112 /* Software caused connection abort */ +#define ENETDOWN 113 /* Network is down */ +#define ECONNREFUSED 114 /* Connection refused */ +#define EHOSTUNREACH 115 /* Host is unreachable */ +#define EPROTOTYPE 116 /* Protocol wrong type for socket */ +#define EOPNOTSUPP 117 /* Operation not supported on socket */ + +#define ETIMEOUT ETIMEDOUT + +/* + * these originate from the Internet Module + */ +#define ESUBNET 118 /* IP subnet table full */ +#define ENETNOLNK 119 /* Subnet module not linked */ +#define EBADIOCTL 120 /* Unknown ioctl call */ +#define ERESOURCE 121 /* Failure in Streams buffer allocn */ + +#define EPROTUNR 122 /* ICMP Protocol unreachable */ +#define EPORTUNR 123 /* ICMP Port unreachable */ +#define ENETUNR 124 /* ICMP Network unreachable */ + +#define ENETUNREACH ENETUNR /* ICMP Network unreachable */ + +/* + * Ethernet Driver Errors + */ + +#define EPACKET 150 /* Invalid Ethernet Packet */ +#define ETYPEREG 151 /* Type registration error */ + +/* + * Socket library call + */ + +#define ENOTINIT 152 /* Sockets library not initialized */ + + +#endif //SOCK_ERR_INCLUDED diff --git a/private/inc/sockets/sys/psxsock.h b/private/inc/sockets/sys/psxsock.h new file mode 100644 index 000000000..5c30fe35b --- /dev/null +++ b/private/inc/sockets/sys/psxsock.h @@ -0,0 +1,222 @@ +/*++ + +Copyright (c) 1991 Microsoft Corporation + +Module Name: + + psxsock.h + +Abstract: + + Types, prototypes and definitions for Win32 sockets. + +Author: + + Sam Patton (sampa) September 11, 1991 + +Revision History: + + when who what + ---- --- ---- + 11-21-91 mikemas intitial version - cloned from winsock.h + +--*/ + +#ifndef PSXSOCK_INCLUDED +#define PSXSOCK_INCLUDED + +// +// POSIX includes +// +// #include + + +// +// POSIX-specific defintions +// +#define INVALID_SOCKET_HANDLE ((int) -1) +#define SOCKET_HANDLE int + + +// +// common sockets include file +// +#include + + +// +// Prototypes for all exported socket functions +// + +SOCKET_HANDLE +accept( + IN SOCKET_HANDLE, //socket to accept on + OUT struct sockaddr *, //peer address + OUT int *); //size of peer address + +int +bind( + IN SOCKET_HANDLE, //socket to bind + IN struct sockaddr *, //address to bind to + IN int); //size of address + +int +connect( + IN SOCKET_HANDLE, //socket to connect from + IN struct sockaddr *, //address to connect to + IN int); //size of address + +int +listen( + IN SOCKET_HANDLE, //socket to listen with + IN int); //length of listen queue + +int +getpeername( + IN SOCKET_HANDLE, //connected socket to get peer of + OUT struct sockaddr *, //buffer to put peer address into + OUT int *); //length of buffer + +int +getsockname( + IN SOCKET_HANDLE, //socket to get the address of + OUT struct sockaddr *, //buffer to put my address into + OUT int *); //length of buffer + + +int +poll( + IN OUT struct pollfd *, + IN unsigned int, + IN int); + +int +recv( + IN SOCKET_HANDLE, //socket to receive with + IN char *, //buffer to receive into + IN int, //size of buffer + IN int); //receive flags + +int +recvfrom( + IN SOCKET_HANDLE, //socket to receive with + OUT char *, //buffer to receive into + IN int, //size of buffer + IN int, //receive flags + OUT struct sockaddr *, //address received from + OUT int *); //size of address + +int +send( + IN SOCKET_HANDLE, //socket to send from + IN char *, //buffer to send + IN int, //size of buffer + IN int); //send flags + +int +sendto( + IN SOCKET_HANDLE, //socket to send from + IN char *, //buffer to send + IN int, //size of buffer + IN int, //send flags + IN struct sockaddr *, //address to send to + IN int); //size of address + +SOCKET_HANDLE +socket( + IN int, //address family + IN int, //socket type + IN int); //protocol + +int +so_recv( + IN SOCKET_HANDLE, //socket to receive with + OUT char *, //buffer to receive into + IN int, //size of buffer + OUT int *); //receive flags + +int +setsockopt( + IN SOCKET_HANDLE, + int, + int, + char *, + int); + +int +getsockopt( + IN SOCKET_HANDLE, + int, + int, + char *, + int *); + +int +shutdown( + IN SOCKET_HANDLE, + IN int); + + +// +// Host name control +// + +int +gethostname( + OUT char *name, + IN int namelen + ); + +int +sethostname ( + IN char *name, + IN int namelen + ); + + +// +// Remote execution utilities +// + +SOCKET_HANDLE +rcmd( + IN OUT char **ahost, + IN unsigned short inport, + IN char *locuser, + IN char *remuser, + IN char *cmd, + IN OUT SOCKET_HANDLE *fd2p OPTIONAL + ); + +SOCKET_HANDLE +rresvport( + IN OUT unsigned short *port + ); + +SOCKET_HANDLE +rexec( + IN char **ahost, + IN unsigned short rport, + IN char *name, + IN char *pass, + IN char *cmd, + OUT SOCKET_HANDLE *fd2p OPTIONAL + ); + + +// +// Resolver error return utilities +// + +DWORD +GetLastHError( + VOID + ); + +VOID +SetLastHError( + DWORD ErrCode + ); + + +#endif //PSXSOCK_INCLUDED diff --git a/private/inc/sockets/sys/socket.h b/private/inc/sockets/sys/socket.h new file mode 100644 index 000000000..7216c7b49 --- /dev/null +++ b/private/inc/sockets/sys/socket.h @@ -0,0 +1,158 @@ +/*++ + +Copyright (c) 1991 Microsoft Corporation + +Module Name: + + socket.h + +Abstract: + + contains types and #defines for sockets. + +Author: + + Sam Patton (sampa) July 26, 1991 + +Revision History: + + when who what + ---- --- ---- + 7-26-91 sampa initial version + +--*/ + +/****************************************************************** + * + * SpiderTCP System Include Files + * + * Copyright 1987 Spider Systems Limited + * + * SOCKET.H + * + * Definitions related to sockets: + * types, address families, options. + * + * + ******************************************************************/ + + +#ifndef SYS_SOCKET_INCLUDED +#define SYS_SOCKET_INCLUDED +/* + * Types + */ +#define SOCK_STREAM 1 /* stream socket */ +#define SOCK_DGRAM 2 /* datagram socket */ +#define SOCK_RAW 3 /* raw-protocol interface */ +#define SOCK_RDM 4 /* reliably-delivered message */ +#define SOCK_SEQPACKET 5 /* sequenced packet stream */ + +/* + * Option flags per-socket. + */ +#define SO_DEBUG 0x01 /* turn on debugging info recording */ +#define SO_ACCEPTCONN 0x02 /* socket has had listen() */ +#define SO_REUSEADDR 0x04 /* allow local address reuse */ +#define SO_KEEPALIVE 0x08 /* keep connections alive */ +#define SO_DONTROUTE 0x10 /* just use interface addresses */ +#define SO_BROADCAST 0x20 /* permit sending of broadcast msgs */ +#define SO_USELOOPBACK 0x40 /* bypass hardware when possible */ +#define SO_LINGER 0x80 /* linger on close if data present */ +#define SO_RDWR 0x100 /* User read/write for datagram sockets */ +#define SO_NODELAY 0x200 /* Forward data expediently */ +#define SO_URGENT 0x400 /* Notify urgent data */ + +#ifdef TESTOPT +#define SO_TESTOPT 0x800 /* option for testing internals */ +#endif +#ifdef UNDEF + /* + * I don't think we use these?? NCF + */ + +/* + * Additional options, not kept in so_options. + */ +#define SO_SNDBUF 0x1001 /* send buffer size */ +#define SO_RCVBUF 0x1002 /* receive buffer size */ +#define SO_SNDLOWAT 0x1003 /* send low-water mark */ +#define SO_RCVLOWAT 0x1004 /* receive low-water mark */ +#define SO_SNDTIMEO 0x1005 /* send timeout */ +#define SO_RCVTIMEO 0x1006 /* receive timeout */ +#endif + +/* + * Structure used for manipulating linger option. + */ +struct linger { + int l_onoff; /* option on/off */ + int l_linger; /* linger time */ +}; + +/* + * Level number for (get/set)sockopt() to apply to socket itself. + */ +#define SOL_SOCKET 0xffff /* options for socket level */ + +/* + * Address families. + */ +#define AF_UNSPEC 0 /* unspecified */ +#define AF_UNIX 1 /* local to host (pipes, portals) */ +#define AF_INET 2 /* internetwork: UDP, TCP, etc. */ +#define AF_NS 3 /* XNS -- not implemented */ +#define AF_IMPLINK 4 /* IMP link layer -- not implemented */ +#define AF_NETBIOS 5 /* NetBios, unique to NT */ +#define AF_LOOPBACK 6 /* for testing only */ + +#ifdef ROUTED +#define AF_MAX 6 /* must be > 2 for ROUTED */ +#else +#define AF_MAX 6 +#endif + +/* + * Structure used by kernel to store most + * addresses. + */ +struct sockaddr { + unsigned short sa_family; /* address family */ + char sa_data[14]; /* up to 14 bytes of direct address */ +}; + +/* + * Structure used by kernel to pass protocol + * information in raw sockets. + */ +struct sockproto { + unsigned short sp_family; /* address family */ + unsigned short sp_protocol; /* protocol */ +}; + +/* + * Protocol families, same as address families for now. + */ +#define PF_UNSPEC AF_UNSPEC +#define PF_UNIX AF_UNIX +#define PF_INET AF_INET + +#define PF_MAX 2 + +/* + * Maximum queue length specifiable by listen. + */ +#define SOMAXCONN 5 + +#define MSG_OOB 0x1 /* process out-of-band data */ +#define MSG_DONTROUTE 0x4 /* send without using routing tables */ +#ifdef UNDEF +#define MSG_PEEK 0x2 /* peek at incoming message */ +#endif + +#define OOB_PEND 0x08 /* Urgent data pending */ + +#define MSG_MAXIOVLEN 16 + + +#endif //SYS_SOCKET_INCLUDED diff --git a/private/inc/sockets/sys/winsock.h b/private/inc/sockets/sys/winsock.h new file mode 100644 index 000000000..b7ab434cc --- /dev/null +++ b/private/inc/sockets/sys/winsock.h @@ -0,0 +1,216 @@ +/*++ + +Copyright (c) 1991 Microsoft Corporation + +Module Name: + + winsock.h + +Abstract: + + Types, prototypes and definitions for Win32 sockets. + +Author: + + Sam Patton (sampa) September 11, 1991 + +Revision History: + + when who what + ---- --- ---- + 9-11-91 sampa initial version + 11-21-91 mikemas introduced socket type definitions, moved prototypes + into socket.h + +--*/ + +#ifndef WINSOCK_INCLUDED +#define WINSOCK_INCLUDED + + +// Windows includes +#include + + +// +// Windows-specific defintions +// +#define INVALID_SOCKET_HANDLE INVALID_HANDLE_VALUE +#define SOCKET_HANDLE HANDLE + + +// +// common sockets include file +// +#include + + +// +// Prototypes for all exported socket functions +// + +SOCKET_HANDLE +accept( + IN SOCKET_HANDLE, //socket to accept on + OUT struct sockaddr *, //peer address + OUT int *); //size of peer address + +int +bind( + IN SOCKET_HANDLE, //socket to bind + IN struct sockaddr *, //address to bind to + IN int); //size of address + +int +connect( + IN SOCKET_HANDLE, //socket to connect from + IN struct sockaddr *, //address to connect to + IN int); //size of address + +int +listen( + IN SOCKET_HANDLE, //socket to listen with + IN int); //length of listen queue + +int +getpeername( + IN SOCKET_HANDLE, //connected socket to get peer of + OUT struct sockaddr *, //buffer to put peer address into + OUT int *); //length of buffer + +int +getsockname( + IN SOCKET_HANDLE, //socket to get the address of + OUT struct sockaddr *, //buffer to put my address into + OUT int *); //length of buffer + +int +recv( + IN SOCKET_HANDLE, //socket to receive with + IN char *, //buffer to receive into + IN int, //size of buffer + IN int); //receive flags + +int +recvfrom( + IN SOCKET_HANDLE, //socket to receive with + OUT char *, //buffer to receive into + IN int, //size of buffer + IN int, //receive flags + OUT struct sockaddr *, //address received from + OUT int *); //size of address + +int +send( + IN SOCKET_HANDLE, //socket to send from + IN char *, //buffer to send + IN int, //size of buffer + IN int); //send flags + +int +sendto( + IN SOCKET_HANDLE, //socket to send from + IN char *, //buffer to send + IN int, //size of buffer + IN int, //send flags + IN struct sockaddr *, //address to send to + IN int); //size of address + +SOCKET_HANDLE +socket( + IN int, //address family + IN int, //socket type + IN int); //protocol + +int +so_recv( + IN SOCKET_HANDLE, //socket to receive with + OUT char *, //buffer to receive into + IN int, //size of buffer + OUT int *); //receive flags + +int +setsockopt( + IN SOCKET_HANDLE, + int, + int, + char *, + int); + +int +getsockopt( + IN SOCKET_HANDLE, + int, + int, + char *, + int *); + +int +shutdown( + IN SOCKET_HANDLE, + IN int); + + +// +// Host name control +// + +int +gethostname( + OUT char *name, + IN int namelen + ); + +int +sethostname ( + IN char *name, + IN int namelen + ); + + +// +// Remote execution utilities +// + +SOCKET_HANDLE +rcmd( + IN OUT char **ahost, + IN unsigned short inport, + IN char *locuser, + IN char *remuser, + IN char *cmd, + IN OUT SOCKET_HANDLE *fd2p OPTIONAL + ); + +SOCKET_HANDLE +rresvport( + IN OUT unsigned short *port + ); + +SOCKET_HANDLE +rexec( + IN char **ahost, + IN unsigned short rport, + IN char *name, + IN char *pass, + IN char *cmd, + OUT SOCKET_HANDLE *fd2p OPTIONAL + ); + + +// +// Resolver error return utilities +// + +DWORD +GetLastHError( + VOID + ); + +VOID +SetLastHError( + DWORD ErrCode + ); + + +#endif //WINSOCK_INCLUDED -- cgit v1.2.3