diff options
Diffstat (limited to 'private/inc/sys')
27 files changed, 3736 insertions, 0 deletions
diff --git a/private/inc/sys/poll.h b/private/inc/sys/poll.h new file mode 100644 index 000000000..e2599db6c --- /dev/null +++ b/private/inc/sys/poll.h @@ -0,0 +1,75 @@ +/*++ + +Copyright (c) 1991 Microsoft Corporation + +Module Name: + + poll.h + +Abstract: + + Contains #defines, types, and macros for poll + +Author: + + Sam Patton (sampa) July 26, 1991 + +Revision History: + +--*/ + +#ifndef SYS_POLL_INCLUDED +#define SYS_POLL_INCLUDED + +/* + * Structure of file descriptor/event pairs supplied in + * the poll arrays. + */ +struct pollfd { +#ifndef _POSIX_SOURCE + HANDLE fd; /* file handle to poll */ +#else + int fd; /* file desc to poll */ +#endif + short events; /* events of interest on fd */ + short revents; /* events that occurred on fd */ +}; + +/* + * Testable select events + */ +#define POLLIN 01 /* fd is readable */ +#define POLLPRI 02 /* priority info at fd */ +#define POLLOUT 04 /* fd is writeable (won't block) */ +#define POLLMSG 0100 /* M_SIG or M_PCSIG arrived */ + +/* + * Non-testable poll events (may not be specified in events field, + * but may be returned in revents field). + */ +#define POLLERR 010 /* fd has error condition */ +#define POLLHUP 020 /* fd has been hung up on */ +#define POLLNVAL 040 /* invalid pollfd entry */ + +/* + * Number of pollfd entries to read in at a time in poll. + * The larger the value the better the performance, up to the + * maximum number of open files allowed. Large numbers will + * use excessive amounts of kernel stack space. + */ +#define NPOLLFILE 20 + + +/* + * Poll function prototype + * + */ + +int +poll( + IN OUT struct pollfd *, + IN unsigned int, + IN int); + + +#endif //SYS_POLL_INCLUDED diff --git a/private/inc/sys/snet/adp_ctrl.h b/private/inc/sys/snet/adp_ctrl.h new file mode 100644 index 000000000..f8b8d7149 --- /dev/null +++ b/private/inc/sys/snet/adp_ctrl.h @@ -0,0 +1,20 @@ +/* + * /redknee10/projects/spare/PBRAIN/SCCS/pbrainG/dev/src/include/sys/snet/0/s.adp_control.h + * @(#)adp_control.h 1.1 + * + * Last delta created 09:32:52 11/13/91 + * This file extracted 09:26:04 3/18/92 + * + * Modifications: + * + * RAE 13 Nov 1991 New File + */ + +#define ADP_SETSNID (('A'<<8) | 1) /* set ADP snid */ + +struct adp_snioc { + uint8 adp_snid; + uint32 adp_index; +}; + + diff --git a/private/inc/sys/snet/arp_ctrl.h b/private/inc/sys/snet/arp_ctrl.h new file mode 100644 index 000000000..4dfee02b1 --- /dev/null +++ b/private/inc/sys/snet/arp_ctrl.h @@ -0,0 +1,153 @@ +/*++ + +Copyright (c) 1991 Microsoft Corporation + +Module Name: + + arp_ctrl.h + +Abstract: + + This file defines the user-level IOCTL interface to the ARP driver. + +Author: + + Mike Massa (mikemas) Jan 18, 1992 + +Revision History: + + Who When What + -------- -------- ---------------------------------------------- + mikemas 01-18-92 created + +Notes: + +--*/ + +/****************************************************************** + * + * SpiderTCP ARP Interface Primitives + * + * Copyright 1988 Spider Systems Limited + * + * arp_control.h + * + * ARP Streams ioctl primitives for SpiderTCP + * + ******************************************************************/ + +/* + * /usr/projects/spare/PBRAIN/SCCS/pbrainG/dev/src/include/sys/snet/0/s.arp_control.h + * @(#)arp_control.h 1.5 + * + * Last delta created 19:19:24 11/1/91 + * This file extracted 16:49:13 12/23/91 + * + * Modifications: + * + * + */ + +#ifndef _SYS_SNET_ARP_CTRL_INCLUDED +#define _SYS_SNET_ARP_CTRL_INCLUDED + + +#define MAXHWLEN 6 /* max size of a hardware address */ +#define MAXANAMLEN 64 /* max size of adaptername */ + + + +/* + * M_IOCTL types + */ +#define ARP_INS (('A'<<8) | 1) /* put arp entry into table */ +#define ARP_DEL (('A'<<8) | 2) /* delete entry from table */ +#define ARP_GET (('A'<<8) | 3) /* return table entry */ +#define ARP_MGET (('A'<<8) | 4) /* return all table entries */ +#define ARP_TYPE (('A'<<8) | 5) /* cause a DL_TYPE transfer */ + +/* + * IOCTL structure definitions + */ + +#ifdef COMPILE_UP_TCPIP + +/* + * Uniprocessor stack-specific definitions + */ + +#define LONGLIFE 1 /* entry is permanent */ +#define ARP_PENDING 2 /* ARP request pending */ + +struct arp_ins { + long in_addr; + char dl_add[6]; + short life; /* lifetime in minutes; LONGLIFE for permanent */ +}; + +struct arp_get { + long in_addr; + char dl_add[6]; + int life; + int flag; +}; + +#else /* COMPILE_UP_TCPIP */ + +/* + * Multiprocessor stack-specific definitions + */ + +struct arp_ins { + long in_addr; + char hw_len; + char dl_add[MAXHWLEN]; + time_t expiry; /* relative expiration time in seconds */ +}; + + +struct arp_get { + long in_addr; + char hw_len; + short hardware_type; + char dl_add[MAXHWLEN]; + time_t expiry; /* relative expiration time in seconds */ +}; + +#endif /* COMPILE_UP_TCPIP */ + + +struct arp_del { + long in_addr; +}; + + +struct arp_mget { + long network; + int num; +}; + + +/* + * IOCTL structure + */ +struct arp_req { + int prim_type; + union req { + struct arp_ins arp_ins; + struct arp_del arp_del; + struct arp_get arp_get; + struct arp_mget arp_mget; + } req; +}; + +typedef struct arp_type { + short trailers; /* are trailers used? */ + char aname[MAXANAMLEN]; /* name of adapter, used by snmp */ +} ARP_TYPES; + +#define MAX_EXPIRY 0xFFFFFFFF /* expiry time for permanent entries */ +#define TIME_TIL_REUSE 15 /* time (secs) until entry reused */ + +#endif // _SYS_SNET_ARP_CTRL_INCLUDED + diff --git a/private/inc/sys/snet/bsd_type.h b/private/inc/sys/snet/bsd_type.h new file mode 100644 index 000000000..2e4dfb7ae --- /dev/null +++ b/private/inc/sys/snet/bsd_type.h @@ -0,0 +1,89 @@ +/*++ + +Copyright (c) 1991 Microsoft Corporation + +Module Name: + + bsd_type.h.h + +Abstract: + + This module contains definitions for BSD compatibility for + STREAMS drivers. + +Author: + + Eric Chin (ericc) July 18, 1991 + +Revision History: + +--*/ + +/************************************************************************* + * + * SpiderTCP/SNMP + * + * Copyright 1990 Spider Systems Limited + * + * BSD_TYPES.H + * + * some #defines for BSD compatibility + * + * + *************************************************************************/ + +/* + * /usr/projects/spare/PBRAIN/SCCS/pbrainG/dev/src/include/sys/snet/0/s.bsd_types.h + * @(#)bsd_types.h 1.3 + * + * Last delta created 11:54:01 10/16/90 + * This file extracted 08:53:46 7/10/91 + * + * Modifications: + * + * GSS 01/03/90 put in Pbrain + */ + +#ifndef _SYS_SNET_BSD_TYPE_ +#define _SYS_SNET_BSD_TYPE_ + + +#ifndef u_char +#define u_char unsigned char +#define u_short unsigned short +#define u_long unsigned long +#define u_int unsigned int +#endif + + +/* + * Select uses bit masks of file descriptors in integers. + * These macros manipulate such bit fields (the filesystem macros use chars). + * FD_SETSIZE may be defined by the user, but the default here + * should be >= NOFILE (param.h). In the current implementation it should + * not exceed 32 (sizeof int). + */ +#ifndef FD_SETSIZE +#define FD_SETSIZE 32 +#endif + +/* number of bits in a byte */ +#define NBBY 8 + +typedef int fd_mask; +#define NFDBITS (sizeof(fd_mask) * NBBY) /* bits per mask */ +#ifndef howmany +#define howmany(x, y) (((x)+((y)-1))/(y)) +#endif + +typedef struct fd_set { + fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)]; +} fd_set; + + +#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS))) +#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS))) +#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS))) +#define FD_ZERO(p) bzero((char *)(p), sizeof(*(p))) + +#endif /* _SYS_SNET_BSD_TYPE_ */ diff --git a/private/inc/sys/snet/dl_ctrl.h b/private/inc/sys/snet/dl_ctrl.h new file mode 100644 index 000000000..5516706d0 --- /dev/null +++ b/private/inc/sys/snet/dl_ctrl.h @@ -0,0 +1,131 @@ +/*++ + +Copyright (c) 1991 Microsoft Corporation + +Module Name: + + dl_proto.h + +Abstract: + + This module defines some of the data types and manifests for the + Spider Generic Ethernet Interface. + +Author: + + Eric Chin (ericc) August 9, 1991 + +Revision History: + + Sam Patton (sampa) July 31, 1992 merge for snap/token ring + +--*/ +/* + * Spider STREAMS Data Link Interface Primitives + * + * Copyright (c) 1989 Spider Systems Limited + * + * This Source Code is furnished under Licence, and may not be + * copied or distributed without express written agreement. + * + * All rights reserved. + * + * Written by Mark Valentine + * + * Made in Scotland. + * + * @(#)dl_control.h 1.6 + * + * Last delta created 14:58:43 2/12/92 + * This file extracted 09:26:06 3/18/92 + * + * Modifications: + * + * 28 Jan 1992 Modified for datalink version 2 + * + */ + +#ifndef DL_CTRL_INCLUDED +#define DL_CTRL_INCLUDED + +#include <sys\snet\uint.h> + +/* + * This defines Version 2 of Spider's STREAMS Data Link protocol. + * Its main feature is its ability to cope with hardware addresses + * of length not equal to 6. + */ + +/* + * Data Link ioctl commands. + * + * To determine the version of the protocol in use, use the DATAL_VERSION + * command, and assume Version 0 if this fails with EINVAL. (Yuk.) + * + * The ETH_* commands will work for any current version of the protocol, + * but only for Ethernet drivers (hw_type == HW_ETHER). + * + * Hardware types are defined in dl_proto.h. + */ + +#define DATAL_STAT ('E'<<8|1) /* gather data link statistics */ +#define DATAL_ZERO ('E'<<8|2) /* reset data link statistics */ +#define DATAL_REGISTER ('E'<<8|3) /* register data link type range */ +#define DATAL_GPARM ('E'<<8|4) /* determine data link parameters */ +#define DATAL_VERSION ('E'<<8|5) /* interrogate protocol version */ +#define DATAL_SET_ADDR ('E'<<8|6) /* set hardware address */ +#define DATAL_DFLT_ADDR ('E'<<8|7) /* restore default hardware address */ +#define DATAL_IBIND ('D'<<8|1) /* bind card to stream */ + +/* + * Data Link statistics structure. + */ + +struct datal_stat +{ + uint32 dl_tx; /* packets transmitted */ + uint32 dl_rx; /* packets received */ + uint32 dl_coll; /* collisions detected */ + uint32 dl_lost; /* packets lost */ + uint32 dl_txerr; /* transmission errors */ + uint32 dl_rxerr; /* receive errors */ + uint32 dl_pool_quota; /* receive pool quota */ + uint32 dl_pool_used; /* receive pool used */ +}; + +struct datal_register +{ + uint8 version; /* protocol version */ + uint8 hw_type; /* hardware type */ + uint8 addr_len; /* hardware address length */ + uint8 align; /* don't use */ + uint16 lwb; /* data link type (lower bound) */ + uint16 upb; /* data link type (upper bound) */ +}; + +struct datal_gparm +{ + uint8 version; /* protocol version */ + uint8 hw_type; /* hardware type */ + uint8 addr_len; /* hardware address length */ + uint8 align; /* don't use */ + uint16 frgsz; /* max. packet size on net */ + uint8 addr[1]; /* hardware address (variable length) */ +}; + +struct datal_version +{ + uint8 version; /* protocol version number */ + uint8 hw_type; /* hardware type */ +}; + +struct datal_ibind +{ + ULONG UseRawArcnet; /* 0 if this open should use Encapsulated */ + /* Ethernet over arcnet */ + /* 1 if it should use raw arcnet frames */ + STRING adapter_name; /* adapter device driver string */ + char buffer[80]; /* buffer to contain the name */ +}; + +#endif //DL_CTRL_INCLUDED diff --git a/private/inc/sys/snet/eth_prot.h b/private/inc/sys/snet/eth_prot.h new file mode 100644 index 000000000..7599f7ad8 --- /dev/null +++ b/private/inc/sys/snet/eth_prot.h @@ -0,0 +1,253 @@ +/*++ + +Copyright (c) 1991 Microsoft Corporation + +Module Name: + + eth_prot.h + +Abstract: + + Definitions for the SNDIS upper protocol interface. + +Author: + + Mike Massa (mikemas) Jan 31, 1992 + +Revision History: + + Who When What + -------- -------- ---------------------------------------------- + mikemas 01-31-92 created + +Notes: + +--*/ + +/****************************************************************** + * + * SpiderTCP Interface Primitives + * + * Copyright (c) 1988 Spider Systems Limited + * + * This Source Code is furnished under Licence, and may not be + * copied or distributed without express written agreement. + * + * All rights reserved. + * + * Written by Nick Felisiak, Ian Heavens, Peter Reid, + * Gavin Shearer, Mark Valentine + * + * ETH_PROTO.H + * + * Ethernet Streams proto primitives for TCP/IP on V.3 Streams + * + ******************************************************************/ + +/* + * /usr/projects/spare/PBRAIN/SCCS/pbrainG/dev/src/include/sys/snet/0/s.eth_proto.h + * @(#)eth_proto.h 1.9 + * + * Last delta created 11:03:25 10/29/90 + * This file extracted 08:53:41 7/10/91 + */ + +#ifdef GENERICE + +/* + * Primitive type values. + */ + +#define DL_TYPE ETH_TYPE /* ethernet registration (old style) */ +#define ETH_TYPE 'R' /* ethernet registration */ +#define ETH_PARAMS 'P' /* ethernet parameters */ +/*efine ETH_PACKET 'p' /* ethernet packet */ +#define ETH_TX 't' /* packet for transmission */ +#define ETH_RX 'r' /* incoming packet */ + +/* + * Ethernet Type registration. + */ + +#define dl_type eth_type +#define dl_lwb lwb +#define dl_upb upb +#define dl_ethaddr ethaddr +#define dl_frgsz frgsz +#define S_DL_TYPE S_ETH_TYPE + +typedef struct eth_type { + uint8 prim_type; /* i.e. ETH_TYPE */ + uint8 aux_type; /* unused in Ethernet Driver */ + uint16 pad; /* compatibility with previous interface */ + uint16 lwb; /* lower bound of type range */ + uint16 upb; /* upper bound of type range */ + uint8 ethaddr[6]; /* ethernet address */ + uint16 frgsz; /* max. packet size on net */ +} S_ETH_TYPE; + +typedef struct eth_params { + uint8 prim_type; /* i.e. ETH_PARAMS */ + uint8 aux_type; /* unused in Ethernet Driver */ + uint16 pad; /* compatibility with previous interface */ + uint8 ethaddr[6]; /* ethernet address */ + uint16 frgsz; /* max. packet size on net */ +} S_ETH_PARAMS; + +/* + * Packet header data. + */ + +typedef struct eth_packet { + uint8 prim_type; /* i.e. ETH_PACKET */ + uint8 aux_type; /* unused in Ethernet Driver */ + uint16 pad; /* compatibility with previous interface */ + uint16 eth_type; /* ethernet type field */ + uint8 eth_src[6]; /* source ethernet address */ + uint8 eth_dst[6]; /* destination ethernet address */ +} S_ETH_PACKET; + +typedef struct eth_rx { + uint8 prim_type; /* i.e. ETH_RX */ + uint8 aux_type; /* unused in Ethernet Driver */ + uint16 pad; /* compatibility with previous interface */ + uint16 eth_type; /* ethernet type field */ + uint8 eth_src[6]; /* source ethernet address */ +} S_ETH_RX; + +typedef struct eth_tx { + uint8 prim_type; /* i.e. ETH_TX */ + uint8 aux_type; /* unused in Ethernet Driver */ + uint16 pad; /* compatibility with previous interface */ + uint16 eth_type; /* ethernet type field */ + uint8 eth_dst[6]; /* destination ethernet address */ +} S_ETH_TX; + +/* + * Generic ethernet protocol primitive + */ + +typedef union eth_proto +{ + uint8 type; /* variant tag */ + struct eth_type etype; /* if type == ETH_TYPE */ + struct eth_params eparm; /* if type == ETH_PARAMS */ + struct eth_rx erx; /* if type == ETH_RX */ + struct eth_tx etx; /* if type == ETH_TX */ +} S_ETH_PROTO; + +#else /* GENERICE */ + +/* type range we want to receive from ethernet */ +typedef struct dl_type { + int prim_type; + unsigned short dl_lwb; + unsigned short dl_upb; +} S_DL_TYPE; + +/* M_PROTO Message primitives */ + +#define DL_RX 4 /* arp receives from eth */ +#define DL_TYPE 5 /* arp send type field to eth */ +#ifdef PROJ4 +#define ETH_TX 1 /* packet for transmission */ +#define ETH_RX 2 /* incoming packet */ +#else +#define ETH_TX 6 /* packet for transmission */ +#define ETH_RX 7 /* incoming packet */ +#endif + +/* + * M_PROTO message formats + */ +#ifdef EMD +struct eth_tx { + char dl_dst[6]; + char dl_src[6]; + short dl_type; +}; +#else +struct eth_tx { + int prim_type; + short dl_type; + char dl_dst[6]; +}; +#endif + +struct eth_rx { + int prim_type; + struct ethmessage *eth_msg; +}; + + +union eth_proto { + int type; + struct eth_tx eth_tx; + struct eth_rx eth_rx; + struct dl_type dl_type; +}; + +/* + * errors generated + */ +#define EFRGSZ 1 +#define EDLTYPE 2 +#define EPRIM 3 +#define EBUF 4 +#define EMSG 5 + +/* + * arp receives datalink pkt from eth + */ +typedef struct dl_rx { + int prim_type; + unsigned short dl_type; + char dl_src[6]; +} S_DL_RX; + +#endif /* GENERICE */ + + +#ifdef PROJ4 + +/* + * PROJ4 Attachment values + */ +#define A_LAN 9 +#define A_IP 20 +#define A_UDP 23 +#define A_ARP 24 + +#define ATTACH 13 /* attach to driver */ + +/* + * ATTACH struct - for communication with the lower + * Driver + */ +typedef struct attach { + int prim_type; + unsigned short fromid; + unsigned short toid; + unsigned int fromvers; + unsigned int tovers; + int result; + unsigned short type_upb0; + unsigned short type_lwb0; + unsigned short type_upb1; + unsigned short type_lwb1; + unsigned short type_upb2; + unsigned short type_lwb2; + unsigned short type_upb3; + unsigned short type_lwb3; +} S_ATTACH; + +#define DATAL_TX ETH_TX +#define S_DATAL_TX struct eth_tx +#define datal_tx eth_tx + +/* + * Hardware types + */ + +#define HW_ETHERNET 1 +#endif diff --git a/private/inc/sys/snet/inet_var.h b/private/inc/sys/snet/inet_var.h new file mode 100644 index 000000000..83e142ba7 --- /dev/null +++ b/private/inc/sys/snet/inet_var.h @@ -0,0 +1,485 @@ +/*++ + +Copyright (c) 1991 Microsoft Corporation + +Module Name: + + inet_var.h + +Abstract: + + This module contains definitions for variable finding functions for + the Internet MIB. Used by STREAMS drivers. + +Author: + + Eric Chin (ericc) July 18, 1991 + +Revision History: + +--*/ + +/* + * Copyright (c) 1988 Spider Systems Limited + * + * /usr/users/bridge/sccs/appln/snmp/corecode/s.inet_var.h + * @(#)inet_var.h 1.4 + * + * Last delta created 10:33:41 12/13/90 + * This file extracted 19:57:15 12/20/90 + */ +/************************************************************************* + * + * SpiderSNMP + * + * Copyright 1989 Spider Systems Limited + * + * INET_VAR.H + * + * Definitions for variable finding functions for the Internet + * MIB + * + * Peter Reid @ Spider Systems Limited + * Ted Socolofsky @ Spider Systems Limited + * + *************************************************************************/ + +/* + * Modifications: + * + * /usr/projects/spare/PBRAIN/SCCS/pbrainG/dev/src/include/sys/snet/0/s.inet_var.h + * @(#)inet_var.h 1.24 + * + * Last delta created 12:10:30 1/9/91 + * This file extracted 08:53:47 7/10/91 + * + * PR 1 Jun 89 Built simulator + * PR/TS 31 Jun 89 Built remote box simulation + * GSS 2 Mar 90 Put in Pbrain + */ + + +#ifndef _SYS_SNET_INET_VAR_ +#define _SYS_SNET_INET_VAR_ + + +#ifndef SPIDER_ROUTER +#ifndef SPIDER_BRIDGE +#ifdef SNMP +#define SPIDER_TCP +#define SYSTEM_MIB +#define IF_MIB2 +#define AT_MIB +#define IP_MIB +#define ICMP_MIB +#define TCP_MIB +#define UDP_MIB +#endif /* SNMP */ +#endif /* ~SPIDER_BRIDGE */ +#endif /* SPIDER_ROUTER */ + +#ifdef SYSTEM_MIB +#ifndef SHMEM + + +/* + * Internet variables + */ +#define SYSDESCRLEN 80 + +#ifndef SYSOBJLEN +#define SYSOBJLEN 32 +#endif + +extern char sysDescr[]; +#ifdef SID_T +extern SID_T sysObjectID[]; +#endif + +#ifdef DOS_COMPILE +#ifdef SPIDER_PROBE +#define sysUpTime tod_tick +extern u_long tod_tick; +#endif /* SPIDER_PROBE */ +#endif /* DOS_COMPILE */ + +#ifndef SPIDER_PROBE +extern int sysObjectIDLen; +#endif + +#endif /* ~SHMEM */ + +#endif /* SYSTEM_MIB */ + +#ifdef IF_MIB2 + +struct mib_interface { + long version; /* version number of the MIB */ + long ifNumber; /* number of interfaces */ +}; + +#define IFDESCRLEN 64 +#define IFPHYSADDRLEN 64 + +struct mib_ifEntry { + long version; /* version number of the MIB */ + long ifIndex; /* index of this interface */ + char ifDescr[IFDESCRLEN]; /* English description of interface */ + long ifType; /* network type of device */ + long ifMtu; /* size of largest packet in bytes */ + u_long ifSpeed; /* bandwidth in bits/sec */ + u_char ifPhysAddress[IFPHYSADDRLEN]; /* interface's address */ + u_char PhysAddrLen; /* length of physAddr */ + long ifAdminStatus; /* desired state of interface */ + long ifOperStatus; /* current operational status */ + u_long ifLastChange; /* sysUpTime when curr state entered */ + u_long ifInOctets; /* # octets received on interface */ + u_long ifInUcastPkts; /* # unicast packets delivered */ + u_long ifInNUcastPkts; /* # broadcasts or multicasts */ + u_long ifInDiscards; /* # packets discarded with no error */ + u_long ifInErrors; /* # packets containing errors */ + u_long ifInUnknownProtos; /* # packets with unknown protocol */ + u_long ifOutOctets; /* # octets transmittedwn protocol */ + u_long ifOutUcastPkts; /* # unicast packets sent protocol */ + u_long ifOutNUcastPkts; /* # broadcast or multicast pkts */ + u_long ifOutDiscards; /* # packets discarded with no error */ + u_long ifOutErrors; /* # pkts discarded with an error */ + u_long ifOutQLen; /* # packets in output queue */ + u_char ifSpecificLen; /* length of object ID */ + u_long ifSpecific[SYSOBJLEN]; /* object ID of product specific stuf*/ +}; + +#ifndef SPIDER_TCP +#define MAX_INTERFACES 2 +#define MAXDATA 630 +#endif /* SPIDER_TCP */ + +#endif /* IF_MIB2 */ + +#ifdef AT_MIB + +#ifdef SPIDER_TCP +#define ATPHYSADDRLEN 64 + +#endif +struct mib_atEntry { +#ifdef SPIDER_TCP + long version; /* version number of the MIB */ +#endif /* SPIDER_TCP */ + long atIfIndex; /* interface on which entry maps */ +#ifdef SPIDER_TCP + u_char atPhysAddress[ATPHYSADDRLEN]; /* physical address of destination */ +#else + u_char atPhysAddress[IFPHYSADDRLEN]; /* physical address of destination */ +#endif + u_char PhysAddressLen; /* length of atPhysAddress */ + u_long atNetAddress; /* IP address of physical address */ + long atType; /* Type of Entry */ +}; +#endif /* AT_MIB */ + +#ifdef IP_MIB + +struct mib_ip { +#ifdef SPIDER_TCP + long version; /* version number of the MIB */ +#endif /* SPIDER_TCP */ + long ipForwarding; /* 1 if gateway, 2 if host */ + long ipDefaultTTL; /* default TTL for pkts from here */ + u_long ipInReceives; /* # IP packets rcvd from interfaces */ + u_long ipInHdrErrors; /* # pkts discarded - header errors */ + u_long ipInAddrErrors; /* # pkts discarded - bad address */ + u_long ipForwDatagrams; /* # pkts forwarded through entity */ + u_long ipInUnknownProtos; /* # local-addr pkts w/unknown proto */ + u_long ipInDiscards; /* # error-free packets discarded */ + u_long ipInDelivers; /* # pkts delivered to upper level */ + u_long ipOutRequests; /* # IP pkts originating locally */ + u_long ipOutDiscards; /* # valid output IP pkts dropped */ + u_long ipOutNoRoutes; /* # IP pkts discarded - no route */ + long ipReasmTimeout; /* fragment reassembly time (secs) */ + u_long ipReasmReqds; /* # fragments needing reassembly */ + u_long ipReasmOKs; /* # fragments reassembled */ + u_long ipReasmFails; /* # failures in IP reassembly */ + u_long ipFragOKs; /* # datagrams fragmented here */ + u_long ipFragFails; /* # pkts unable to be fragmented */ + u_long ipFragCreates; /* # IP fragments created here */ + u_long ipRoutingDiscards; /* # IP Routing Discards */ +}; + +struct mib_ipAddrEntry { +#ifdef SPIDER_TCP + long version; /* version number of the MIB */ +#endif /* SPIDER_TCP */ + u_long ipAdEntAddr; /* IP address of this entry */ + long ipAdEntIfIndex; /* IF for this entry */ + u_long ipAdEntNetMask; /* subnet mask of this entry */ + long ipAdEntBcastAddr; /* read the MIB for this one */ + u_long ipAdEntReasmMaxSize; /* and this one */ +}; + +struct mib_ipRouteEntry { +#ifdef SPIDER_TCP + long version; /* version number of the MIB */ +#endif /* SPIDER_TCP */ + u_long ipRouteDest; /* destination IP addr for this route */ + long ipRouteIfIndex; /* index of local IF for this route */ + long ipRouteMetric1; /* Primary routing metric */ + long ipRouteMetric2; /* Alternate routing metric */ + long ipRouteMetric3; /* Alternate routing metric */ + long ipRouteMetric4; /* Alternate routing metric */ + u_long ipRouteNextHop; /* IP addr of next hop */ + long ipRouteType; /* Type of this route */ + long ipRouteProto; /* How this route was learned */ + long ipRouteAge; /* No. of seconds since updating this route */ + u_long ipRouteMask; /* */ + long ipRouteMetric5; /* Alternate routing metric */ + u_char ipRouteInfoLen; /* length of object ID */ + u_long ipRouteInfo[SYSOBJLEN]; /* object ID of product specific stuf*/ +}; + +#if 0 /* MIB_II */ +#define IPNTOMPHYSADDRLEN 16 +struct mib_ipNetToMediaEntry { + long ipNtoMIfIndex; /* interface on which entry maps */ + u_char ipNtoMPhysAddress[IPNTOMPHYSADDRLEN]; /* physical address of destination */ + u_char NtoMPhysAddressLen; /* length of atPhysAddress */ + u_long ipNtoMNetAddress; /* IP address of physical address */ + u_long ipNtoMMediaType; /* */ +}; +#endif /* MIB_II */ + +#ifndef SPIDER_TCP +#define IPFRAGTTL 15 +#define ROUTE_ENTRIES 2 +#endif /* SPIDER_TCP */ + +#endif /* IP_MIB */ +#ifdef ICMP_MIB + + +struct mib_icmp { +#ifdef SPIDER_TCP + long version; /* version number of the MIB */ +#endif /* SPIDER_TCP */ + u_long icmpInMsgs; /* Total of ICMP msgs received */ + u_long icmpInErrors; /* Total ICMP msgs rcvd with errors */ + u_long icmpInDestUnreachs; /* */ + u_long icmpInTimeExcds; /* */ + u_long icmpInParmProbs; /* */ + u_long icmpInSrcQuenchs; /* */ + u_long icmpInRedirects; /* */ + u_long icmpInEchos; /* */ + u_long icmpInEchoReps; /* */ + u_long icmpInTimestamps; /* */ + u_long icmpInTimestampReps; /* */ + u_long icmpInAddrMasks; /* */ + u_long icmpInAddrMaskReps; /* */ + u_long icmpOutMsgs; /* */ + u_long icmpOutErrors; /* */ + u_long icmpOutDestUnreachs; /* */ + u_long icmpOutTimeExcds; /* */ + u_long icmpOutParmProbs; /* */ + u_long icmpOutSrcQuenchs; /* */ + u_long icmpOutRedirects; /* */ + u_long icmpOutEchos; /* */ + u_long icmpOutEchoReps; /* */ + u_long icmpOutTimestamps; /* */ + u_long icmpOutTimestampReps; /* */ + u_long icmpOutAddrMasks; /* */ + u_long icmpOutAddrMaskReps; /* */ +}; + +#define ICMP_MAXTYPE 18 + +#endif /* ICMP_MIB */ +#ifdef TCP_MIB + +struct mib_tcp { +#ifdef SPIDER_TCP + long version; /* version number of the MIB */ +#endif /* SPIDER_TCP */ + long tcpRtoAlgorithm;/* retransmission timeout algorithm */ + long tcpRtoMin; /* minimum retransmission timeout (mS) */ + long tcpRtoMax; /* maximum retransmission timeout (mS) */ + long tcpMaxConn; /* maximum tcp connections possible */ + u_long tcpActiveOpens; /* number of SYN-SENT -> CLOSED transitions */ + u_long tcpPassiveOpens;/* number of SYN-RCVD -> LISTEN transitions */ + u_long tcpAttemptFails;/* (SYNSENT,SYNRCV)->CLOSED, SYN-RCV->LISTEN */ + u_long tcpEstabResets; /* (ESTABLISHED,CLOSE-WAIT) -> CLOSED */ + u_long tcpCurrEstab; /* number in ESTABLISHED or CLOSE-WAIT state */ + u_long tcpInSegs; /* number of segments received */ + u_long tcpOutSegs; /* number of segments sent */ + u_long tcpRetransSegs; /* number of retransmitted segments */ + u_long tcpInErrs; /* # rcved in err */ + u_long tcpOutRsts; /* # segs sent with RST flag */ +}; + +struct mib_tcpConnEntry { +#ifdef SPIDER_TCP + long version; /* version number of the MIB */ +#endif /* SPIDER_TCP */ + long tcpConnState; /* State of this conn */ + u_long tcpConnLocalAddress; /* local IP address for this conn */ + long tcpConnLocalPort; /* local port for this conn */ + u_long tcpConnRemAddress; /* remote IP address for this conn */ + long tcpConnRemPort; /* remote port for this conn */ +}; + +#endif /* TCP_MIB */ +#ifdef UDP_MIB + +struct mib_udp { +#ifdef SPIDER_TCP + long version; /* version number of the MIB */ +#endif /* SPIDER_TCP */ + u_long udpInDatagrams; /* # UDP pkts delivered to users */ + u_long udpNoPorts; /* # UDP pkts to unbound port */ + u_long udpInErrors; /* # UDP pkts unable to be delivered */ + u_long udpOutDatagrams; /* # UDP pkts sent from this entity */ +}; + +struct mib_udpEntry { +#ifdef SPIDER_TCP + long version; /* version number of the MIB */ +#endif /* SPIDER_TCP */ + u_long udpLocalAddress; /* local IP adress */ + u_long udpLocalPort; /* local port */ +}; +#endif /* UDP_MIB */ +#ifdef EGP_MIB + +struct mib_egp { +#ifdef SPIDER_TCP + long version; /* version number of the MIB */ +#endif /* SPIDER_TCP */ + u_long egpInMsgs; /* No. of EGP msgs received without error */ + u_long egpInErrors; /* No. of EGP msgs received with error */ + u_long egpOutMsgs; /* No. of EGP msgs sent */ + u_long egpOutErrors; /* No. of EGP TX msgs dropped due to error */ +}; + +struct mib_egpNeighEntry { +#ifdef SPIDER_TCP + long version; /* version number of the MIB */ +#endif /* SPIDER_TCP */ + long egpNeighState; /* local EGP state with entry's neighbor */ + u_long egpNeighAddr; /* IP address of this entry's neighbor */ +}; + +#endif /* EGP_MIB */ + +#ifdef SYSTEM_MIB +#define SYS_SERVICE_PHYS 1 +#define SYS_SERVICE_DATALINK 2 +#define SYS_SERVICE_INTERNET 3 +#define SYS_SERVICE_ENDTOEND 4 +#define SYS_SERVICE_APPLIC 7 +#endif + +#ifdef IF_MIB2 +#define MIB_IFTYPE_OTHER 1 +#define MIB_IFTYPE_REGULAR1822 2 +#define MIB_IFTYPE_HDH1822 3 +#define MIB_IFTYPE_DDNX25 4 +#define MIB_IFTYPE_RFC877X25 5 +#define MIB_IFTYPE_ETHERNETCSMACD 6 +#define MIB_IFTYPE_ISO88023CSMACD 7 +#define MIB_IFTYPE_ISO88024TOKENBUS 8 +#define MIB_IFTYPE_ISO88025TOKENRING 9 +#define MIB_IFTYPE_ISO88026MAN 10 +#define MIB_IFTYPE_STARLAN 11 +#define MIB_IFTYPE_PROTEON10MBIT 12 +#define MIB_IFTYPE_PROTEON80MBIT 13 +#define MIB_IFTYPE_HYPERCHANNEL 14 +#define MIB_IFTYPE_FDDI 15 +#define MIB_IFTYPE_LAPB 16 +#define MIB_IFTYPE_SDLC 17 +#define MIB_IFTYPE_T1CARRIER 18 +#define MIB_IFTYPE_CEPT 19 +#define MIB_IFTYPE_BASICISDN 20 +#define MIB_IFTYPE_PRIMARYISDN 21 +#define MIB_IFTYPE_PROPPNTTOPNTSERIAL 22 +#define MIB_IFTYPE_PPP 23 +#define MIB_IFTYPE_SOFTWARELOOPBACK 24 +#define MIB_IFTYPE_EON 25 +#define MIB_IFTYPE_ETHERNET3MBIT 26 +#define MIB_IFTYPE_NSIP 27 +#define MIB_IFTYPE_SLIP 28 +#define MIB_IFTYPE_ULTRA 29 +#define MIB_IFTYPE_DS3 30 +#define MIB_IFTYPE_SIP 31 +#define MIB_IFTYPE_FRAMERELAY 32 + + +#define MIB_IFMTU_ETH 1514 + +#define MIB_IFSPEED_ETH 10000000L + +#define MIB_PHYADDRLEN_ETH 6 + +#define MIB_IFSTATUS_UP 1 +#define MIB_IFSTATUS_DOWN 2 +#define MIB_IFSTATUS_TESTING 3 + +#endif /* IF_MIB2 */ + +#define AT_OTHER 1 +#define AT_INVALID 2 +#define AT_DYNAMIC 3 +#define AT_STATIC 4 + +#ifdef IP_MIB +#define MIB_FORWARD_GATEWAY 1 +#define MIB_FORWARD_HOST 2 + +#define MIB_IPROUTETYPE_OTHER 1 +#define MIB_IPROUTETYPE_INVALID 2 +#define MIB_IPROUTETYPE_DIRECT 3 +#define MIB_IPROUTETYPE_REMOTE 4 + +#define MIB_IPROUTEPROTO_OTHER 1 +#define MIB_IPROUTEPROTO_LOCAL 2 +#define MIB_IPROUTEPROTO_NETMGMT 3 +#define MIB_IPROUTEPROTO_ICMP 4 +#define MIB_IPROUTEPROTO_EGP 5 +#define MIB_IPROUTEPROTO_GGP 6 +#define MIB_IPROUTEPROTO_HELLO 7 +#define MIB_IPROUTEPROTO_RIP 8 +#define MIB_IPROUTEPROTO_ISIS 9 +#define MIB_IPROUTEPROTO_ESIS 10 +#define MIB_IPROUTEPROTO_CISCOIGRP 11 +#define MIB_IPROUTEPROTO_BBNSPFIGP 12 +#define MIB_IPROUTEPROTO_OIGP 13 + +#endif /* IP_MIB */ +#ifdef TCP_MIB + +#define MIB_TCPRTOALG_OTHER 1 +#define MIB_TCPRTOALG_CONSTANT 2 +#define MIB_TCPRTOALG_RSRE 3 +#define MIB_TCPRTOALG_VANJ 4 + +#define MIB_TCPCONNSTATE_CLOSED 1 +#define MIB_TCPCONNSTATE_LISTEN 2 +#define MIB_TCPCONNSTATE_SYNSENT 3 +#define MIB_TCPCONNSTATE_SYNRECEIVED 4 +#define MIB_TCPCONNSTATE_ESTABLISHED 5 +#define MIB_TCPCONNSTATE_FINWAIT1 6 +#define MIB_TCPCONNSTATE_FINWAIT2 7 +#define MIB_TCPCONNSTATE_CLOSEWAIT 8 +#define MIB_TCPCONNSTATE_LASTACK 9 +#define MIB_TCPCONNSTATE_CLOSING 10 +#define MIB_TCPCONNSTATE_TIMEWAIT 11 + +#endif /* TCP_MIB */ +#ifdef EGP_MIB + +#define MIB_EGPNEIGHSTATE_IDLE 1 +#define MIB_EGPNEIGHSTATE_AQUISITION 2 +#define MIB_EGPNEIGHSTATE_DOWN 3 +#define MIB_EGPNEIGHSTATE_UP 4 +#define MIB_EGPNEIGHSTATE_CEASE 5 + +#endif /* EGP_MIB */ + +#endif /* _SYS_SNET_INET_VAR_ */ diff --git a/private/inc/sys/snet/ip_ctrl.h b/private/inc/sys/snet/ip_ctrl.h new file mode 100644 index 000000000..8abfaef8f --- /dev/null +++ b/private/inc/sys/snet/ip_ctrl.h @@ -0,0 +1,253 @@ +/*++ + +Copyright (c) 1991 Microsoft Corporation + +Module Name: + + ip_ctrl.h + +Abstract: + + This file contains the user-level STREAMS ioctl interface definitions + for the IP driver. + +Author: + + Eric Chin (ericc) July 18, 1991 + +Revision History: + +--*/ + +/****************************************************************** + * + * SpiderTCP Interface Primitives + * + * Copyright (c) 1988 Spider Systems Limited + * + * This Source Code is furnished under Licence, and may not be + * copied or distributed without express written agreement. + * + * All rights reserved. + * + * Written by Nick Felisiak, Ian Heavens, Peter Reid, + * Gavin Shearer, Mark Valentine + * + * IP_CONTROL.H + * + * IP Streams ioctl primitives for TCP/IP on V.3/V.4 Streams + * + ******************************************************************/ + +#ifndef _SYS_SNET_IP_CTRL_ +#define _SYS_SNET_IP_CTRL_ + +#ifndef SYSOBJLEN +#define SYSOBJLEN 32 +#endif + + +#define IP_NET_ADDR (('I'<<8)+1) /* IP registration from netd */ +#define ICMP_CTRL (('I'<<8)+2) /* control ICMP redirects */ +#define SET_IP_CTRL (('I'<<8)+3) /* set IP control information */ +#define GET_IP_CTRL (('I'<<8)+4) /* get IP control information */ +#ifdef MULTIH +#define ADD_IPNET IP_NET_ADDR /* add IP network to this interface */ +#define SHOW_IPNET (('I'<<8)+5) /* dump IP network information */ +#define DEL_IPNET (('I'<<8)+6) /* delete IP network from interface */ +#define ADD_IPADDR (('I'<<8)+7) /* add IP address to this interface */ +#define SHOW_IPADDR (('I'<<8)+8) /* dump IP address information */ +#define DEL_IPADDR (('I'<<8)+9) /* delete IP address from interface */ +#endif + +#define GET_ALL_INTERFACES 1 +#define GET_INTERFACE_INFO 2 +#ifdef HOSTREQ_MAYBE +#define SET_INTERFACE_INFO 3 +#endif +#define GATE_ACCESS 4 + + + +/* + * ** netd registration ** + */ + +typedef struct net_addr { + int muxid; + long inaddr; + long subnet_mask; + char forward_bdcst; + char keepalive; + short mtu; + short router_mtu; + char if_broadcast; +} NET_ADDRS; + + + +/* + * ** routing cache access ** + */ + +/* + * Gateway access structures etc. + */ +struct gate_access { + char flush; + char smart; + short command; + long dest; + long gate; +}; + + +/* + * routing cache access command values (subcodes of GATE_ACCESS) + */ + +#define GATE_PRINT 1 +#define GATE_ADD 2 +#define GATE_DEL 3 +#define GATE_CHANGE 4 + +#define WILD_CARD -1L /* to indicate that all networks should be acted on */ + +/* + * routing cache definitions + */ + +#ifdef COMPILE_UP_TCPIP + +#define GWAY_TIMEOUT 30 + +typedef struct gw_hashentry { + long from; /* network */ + long to; /* default gateway, if it exists */ + long redirect; /* ICMP Redirect gateway, if it exists */ + long active_gw; /* 1 = gateway is active, 0 = not active */ + short count; /* Counter for timer */ + /* + * "from" is equivalent to "ipRouteDest", + * and "to" or "redirect" is equivalent to "ipRouteNextHop" + */ + long saveProto; /* saved protocol when doing a redirect */ + long ipRouteIfIndex; /* index of local IF for this route */ + long ipRouteMetric1; /* Primary routing metric */ + long ipRouteMetric2; /* Alternate routing metric */ + long ipRouteMetric3; /* Alternate routing metric */ + long ipRouteMetric4; /* Alternate routing metric */ + long ipRouteMetric5; /* Alternate routing metric */ + long ipRouteType; /* Type of this route */ + long ipRouteProto; /* How this route was learned */ + long ipRouteAge; /* time this route was updated */ + long ipRouteMask; /* Subnet Mask for Route */ + unsigned char ipRouteInfoLen; /* length of object ID */ + unsigned long ipRouteInfo[SYSOBJLEN]; /* object ID of product specific stuf*/ +} GW_HASHENTRY; + +#else /* COMPILE_UP_TCPIP */ + +#define GWAY_LIFE 300 /* 5 minute timeout in seconds */ + +typedef struct gw_hashentry { + long from; /* network */ + long to; /* default gateway, if it exists */ + long redirect; /* ICMP Redirect gateway, if it exists */ + long active_gw; /* 1 = gateway is active, 0 = not active */ + /* + * "from" is equivalent to "ipRouteDest", + * and "to" or "redirect" is equivalent to "ipRouteNextHop" + */ + long saveProto; /* saved protocol when doing a redirect */ + long ipRouteIfIndex; /* index of local IF for this route */ + long ipRouteMetric1; /* Primary routing metric */ + long ipRouteMetric2; /* Alternate routing metric */ + long ipRouteMetric3; /* Alternate routing metric */ + long ipRouteMetric4; /* Alternate routing metric */ + long ipRouteMetric5; /* Alternate routing metric */ + long ipRouteType; /* Type of this route */ + long ipRouteProto; /* How this route was learned */ + long ipRouteAge; /* time this route was updated */ + long ipRouteMask; /* Subnet Mask for Route */ + unsigned char ipRouteInfoLen; /* length of object ID */ + unsigned long ipRouteInfo[SYSOBJLEN]; /* object ID of product specific stuf*/ +} GW_HASHENTRY; + +#endif /* COMPILE_UP_TCPIP */ + + + +/* + * Subnet mux table entry data. This structure is a subset of the + * kernel-level structure. They must match. This is a maintenance + * headache, but to remedy it, the IP code would have to be modified + * to make this structure a subfield of the real table structure. + */ + +#ifdef COMPILE_UP_TCPIP + +typedef struct net_interface_data { + long inaddr; /* network internet address */ + long net_num; /* network number */ + long subnet_num; /* subnet number */ + long subnet_mask; /* subnet mask */ + long sn_bdcst1; /* subnet broadcast :all zeroes */ + long sn_bdcst2; /* subnet broadcast :all 1's */ + long net_bdcst1; /* network broadcast :all zeroes */ + long net_bdcst2; /* network broadcast :all 1's */ + int frag_size; /* max allowable fragment size for subnet */ + int opt_size; /* optimum size (may be same as frag_size) */ + short int_flags; /* interface flags (see below) */ + short blocked; /* true if interface is blocked */ +#ifdef HOSTREQ_MAYBE + union { + long bdcast_addr; + long dst_addr; + } addr; /* broadcast address, or dest address for SLIP */ +# define if_broadcast addr.bdcast_addr +# define if_destination addr.dst_addr +#endif + int lower_snmp; /* true if lower interface supports SNMP */ + long status; /* status: up, down, or testing */ + time_t change; /* time state was entered */ + long if_broadcast; /* preferred network broadcast */ + long if_snbroadcast; /* preferred subnet broadcast */ +} NET_INTERFACE_DATA; + +#else /* COMPILE_UP_TCPIP */ + +typedef struct net_interface_data { + long inaddr; /* network internet address */ + long net_num; /* network number */ + long subnet_num; /* subnet number */ + long subnet_mask; /* subnet mask */ + long sn_bdcst1; /* subnet broadcast :all zeroes */ + long sn_bdcst2; /* subnet broadcast :all 1's */ + long net_bdcst1; /* network broadcast :all zeroes */ + long net_bdcst2; /* network broadcast :all 1's */ + int frag_size; /* max allowable fragment size for subnet */ + int opt_size; /* optimum size (may be same as frag_size) */ + short int_flags; /* interface flags */ + short user_flags; /* user flags */ + short blocked; /* true if interface is blocked */ + +#ifdef HOSTREQ_MAYBE + union { + long bdcast_addr; + long dst_addr; + } addr; /* broadcast address, or dest address for SLIP */ +# define if_broadcast addr.bdcast_addr +# define if_destination addr.dst_addr +#endif + + int lower_snmp; /* true if lower interface supports SNMP */ + long status; /* status: up, down, or testing */ + time_t change; /* time state was entered */ + long if_broadcast; /* preferred network broadcast */ + long if_snbroadcast; /* preferred subnet broadcast */ +} NET_INTERFACE_DATA; + +#endif /* COMPILE_UP_TCPIP */ + +#endif /* _SYS_SNET_IP_CTRL_ */ diff --git a/private/inc/sys/snet/ip_proto.h b/private/inc/sys/snet/ip_proto.h new file mode 100644 index 000000000..aa42742ed --- /dev/null +++ b/private/inc/sys/snet/ip_proto.h @@ -0,0 +1,317 @@ +/*++ + +Copyright (c) 1991 Microsoft Corporation + +Module Name: + + ip_proto.h + +Abstract: + + This module contains definitions for STREAMS IP + +Author: + + Eric Chin (ericc) July 18, 1991 + +Revision History: + +--*/ + +/****************************************************************** + * + * SpiderTCP Interface Primitives + * + * Copyright (c) 1988 Spider Systems Limited + * + * This Source Code is furnished under Licence, and may not be + * copied or distributed without express written agreement. + * + * All rights reserved. + * + * Written by Nick Felisiak, Ian Heavens, Peter Reid, + * Gavin Shearer, Mark Valentine + * + * IP_PROTO.H + * + * IP Streams proto primitives for TCP/IP on V.3/V.4 Streams + * + ******************************************************************/ + +#ifndef _SYS_SNET_IP_PROTO_ +#define _SYS_SNET_IP_PROTO_ + + +#ifndef IPOPTS +#define IPOPTS +#endif + +#define IP_TX 6 /* tcp/udp send pkt to ip */ +#define PROT_RX 8 /* tcp/udp get pkt from ip */ +#define IP_PROTQ 9 /* tcp/udp send prot q to ip */ +#define ICMP_RX 12 /* upper layer rcv icmp pkt from ip */ +#define ICMP_TX 13 /* upper layer send icmp pkt to ip */ +#define ENQ_LOCAL 14 /* validate local address enquiry */ +#define ENQ_REMOTE 15 /* validate remote address enquiry */ +#define IP_FLOW 16 /* flow control interface to upper layers */ +#define IP_PROT_REMOVEQ 17 /* tcp/udp deregister prot q to ip */ + +#ifdef TESTOPT +/* + * TESTOPT driver field + */ +#define TCPTEST 1 +#define UDPTEST TCPTEST +#define IPTEST 2 + +/* + * TESTOPT type field + */ + +#define NEXT 1 /* carry out for next num packets */ +#define ALL 2 /* carry out for all packets */ +#define OFF 3 /* turn off option */ +#define RANDOM 4 /* carry out for random packets, prob 1/num */ + +/* + * TESTOPT option field + */ + +#define BAD_CKSUM 1 +#define SHORT_HDR 2 +#define DROP 3 /* drop packet or fragment */ +#define CONTROL 4 /* OR ctl field with subopt, TCP only */ +#define BAD_TYPE 5 /* bad multiplexing type: port for TCP, + protocol for IP */ + +typedef struct testopt { + char driver; /* option for which driver: TCP/UDP, IP */ + char option; /* option */ + char subopt; /* suboption if applicable */ + char type; /* next, on, off */ + int num; /* number of packets - depends on */ +} TEST_OPT; + +#endif + +/* + * 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; + +/* + * IP Option values + */ +#define OPT_EOL 0 +#define OPT_NOP 1 +#define OPT_SECURITY 130 +#define OPT_LSRR 131 +#define OPT_SSRR 137 +#define OPT_RR 7 +#define OPT_STRID 136 +#define OPT_TIMESTAMP 68 + +/* + * structure of pseudo-header used for communication + * between IP and higher level processes + */ +typedef struct { + short ps_pktid; /* id to be used in inet header */ + short ps_status; /* indicates status of requested action */ +#define OK 0 /* status for non-ICMP packet */ + IN_ADDRESS ps_src; /* source address */ + IN_ADDRESS ps_dst; /* destination address */ + unsigned short ps_txtlen; /* length of text */ + short ps_offset; /* Fragment Offset */ + short ps_if; /* IP Interface number */ + unsigned char ps_prot; /* Internet protocol number */ + char ps_df; /* Don't Fragment flag */ + char ps_ttl; /* Time to Live flag */ +#ifdef TESTOPT + int test; /* testing on for this packet */ + TEST_OPT testopt; /* options for testing */ +#endif +#ifdef IPOPTS + char ps_pkt_type; /* What's this packet doing? */ + char ps_optlen; /* Length of options (in words) */ + char ps_tos; /* Type of service */ + int ps_options[1]; /* Options */ +#endif +} PSEUDO_HDR; + +#define SIZ_PSEUDOHDR sizeof(PSEUDO_HDR) + + +/* + * Types of pkt_type + */ + +#define PS_FROM_ME 1 /* Started here */ +#define PS_FOR_ME 2 /* Dest is this machine */ +#define PS_THRU_ME 3 /* Just passing through */ +#define PS_SS_ROUTING 4 /* Being strict source routed */ +#define PS_LS_ROUTING 5 /* Being loose source routed */ +#define PS_REPLY 6 /* response to another pkt (ie echo reply) */ + +typedef struct ip_protq { + int prim_type; + unsigned char prot; +} S_IP_PROTQ; + +/* + * status returned to upper layer in prot + */ +#define VALID 0 +#define IN_USE 1 +#define INVALID 2 + +/* + * received from transport protocol when it sends a packet + */ +typedef struct ip_tx { + int prim_type; + short hdr_cnt; + short unused1; /* ensure structure is same size as S_PROT_RX */ + BOOLEAN unused2; /* ensure structure is same size as S_PROT_RX */ + PSEUDO_HDR uph; +} S_IP_TX; + +/* + * sent to transport protocol when we receive a packet + */ +typedef struct prot_rx { + int prim_type; + IN_ADDRESS if_addr; + BOOLEAN is_broadcast; + PSEUDO_HDR uph; +} S_PROT_RX; + + +/* + * The ICMP_RX struct + */ +struct icmp_rx { + int prim_type; + IN_ADDRESS if_addr; + BOOLEAN is_broadcast; + unsigned char type; + unsigned char code; + long src; + long dst; + unsigned long misc; + PSEUDO_HDR uph; +}; + + +/* + * The ICMP_TX struct + */ +struct icmp_tx { + int prim_type; + unsigned char type; + unsigned char code; + long src; + long dst; + unsigned long misc; + PSEUDO_HDR ph; +}; + + + +/* + * The IP_ADDRENQ struct + */ + +struct ip_addrenq { + int prim_type; /* ENQ_LOCAL or ENQ_REMOTE */ + char *handle; /* Place holder for TCP */ + long addr; /* Remote address */ + long local; /* Returned local address */ + int error; /* Zero if OK, else errno */ + int mss; /* Max seg size for this transfer */ + int flags; /* See below */ + int ifno; /* IP's interface number for this addr */ + int broadcast; /* Set if remote address is broadcast */ + unsigned long link_speed; /* adapter link speed in kbits/second */ + unsigned long receive_buffer_size; /* bytes of adapter receive space */ +}; + + +#define ENQ_NO_KEEPALIVE 1 /* No keep-alives for this net */ + + +/* + * IP Flow control structure + */ + +struct ip_flow_info { + int prim_type; /* IP_FLOW */ + int index; /* IP Interface number */ + int info; /* Blocked or unblocked */ +}; + +/************************************************************** + * ICMP constants: types & codes + **************************************************************/ + +#define ECHO_REPLY 0 /* echo reply */ + +#define DEST_UNR 3 /* destination unreachable: */ + +/* codes for DEST_UNR */ +#define NET_UNR 0 /* net unreachable */ +#define HOST_UNR 1 /* host unreachable */ +#define PROT_UNR 2 /* protocol unreachable */ +#define PORT_UNR 3 /* port unreachable */ +#define FRAG_DF 4 /* fragmentation needed + DF */ +#define SR_FAIL 5 /* source route failed */ +#define DST_NET_UNKNOWN 6 /* dest network unknown */ +#define DST_HOST_UNKNOWN 7 /* dest host unknown */ +#define SRC_HOST_ISOLATED 8 /* source host isolated */ +#define NET_PROHIBITED 9 /* communication with dest + network administratively + prohibited */ +#define HOST_PROHIBITED 10 /* communication with dest + host administratively + prohibited */ +#define NET_UNR_FOR_TOS 11 /* network unreachable + for type of service */ +#define HOST_UNR_FOR_TOS 12 /* host unreachable + for type of service */ + +#define SRC_QUENCH 4 /* source quench */ + +#define REDIRECT 5 /* redirect message: */ +#define NET_RE 0 /* redirect for network */ +#define HOST_RE 1 /* redirect for host */ +#define TOSN_RE 2 /* redirect for TOS/network */ +#define TOSH_RE 3 /* redirect for TOS/host */ + +#define ICMP_ECHO 8 /* echo request */ + +#define TIME_EXCEEDED 11 /* time exceeded: */ +#define TTL_X 0 /* time-to-live exceeded */ +#define FRAG_X 1 /* frag reassem time excluded */ + +#define PARAMETER 12 /* parameter problem */ +#define PARAM_POINTER 0 /* pointer indicates error */ +#define PARAM_OPTION 1 /* required option missing */ + +#define TIME_STAMP 13 /* timestamp request */ +#define STAMP_REPLY 14 /* timestamp reply */ + +#define INFO_REQ 15 /* information request */ +#define INFO_REPLY 16 /* information reply */ + +#define MASK_REQ 17 /* address mask request */ +#define MASK_REPLY 18 /* address mask reply */ + +#endif /* _SYS_SNET_IP_PROTO_ */ + diff --git a/private/inc/sys/snet/ipdl_pro.h b/private/inc/sys/snet/ipdl_pro.h new file mode 100644 index 000000000..6c8ccb3d6 --- /dev/null +++ b/private/inc/sys/snet/ipdl_pro.h @@ -0,0 +1,93 @@ +#ident "@(#)ipdl_proto.h 1.7 3/18/92" + +/****************************************************************** + * + * SpiderTCP Interface Primitives + * + * Copyright (c) 1988 Spider Systems Limited + * + * This Source Code is furnished under Licence, and may not be + * copied or distributed without express written agreement. + * + * All rights reserved. + * + * Written by Nick Felisiak, Ian Heavens, Peter Reid, + * Gavin Shearer, Mark Valentine + * + * DL_PROTO.H + * + * Datalink Streams proto primitives for TCP/IP on V.3 Streams + * + ******************************************************************/ + +/* + * /redknee10/projects/spare/PBRAIN/SCCS/pbrainG/dev/src/include/sys/snet/0/s.ipdl_proto.h + * @(#)ipdl_proto.h 1.7 + * + * Last delta created 17:44:27 10/22/91 + * This file extracted 09:25:54 3/18/92 + * + * Modifications: + * + */ + +#define NET_TX 3 /* send ip pkt to sub-net */ +#define BROAD_TX 15 /* send ip broadcast pkt to sub-net */ +#define SN_FRGSZ 10 /* ip request sub net frag size */ +#define IP_NETREG 11 /* ip send sub net addr to sub-net */ +#define IP_RX 7 /* ip receives from sub net */ +#define ARP_SNADDR IP_NETREG /* old, ARP specific defintion */ +#define SNMP_TRAP 1 /* trap info from lower driver */ + +/* + * - IP sends data pkt to datalink module for transmission + */ +typedef struct net_tx { + int prim_type; + long src_inaddr; + long dst_inaddr; + short hdr_cnt; +#ifdef EMD + char padding[2]; /* make sizeof(net_tx) >= sizeof(eth_tx) */ +#endif +} S_NET_TX; + +/* + * ip receives only primitive type, data unknown to lower layer + */ +typedef struct ip_rx { + int prim_type; +} S_IP_RX; + +union dl_proto { + int type; + S_NET_TX net_tx; +}; + +/* + * datalink layer registration + */ +typedef struct ip_dl_reg { + int prim_type; + long inaddr; + long subnet_mask; + short int_flags; /* flags to be filled in by lower module */ +} IP_DL_REG; + +/* + * the old, ARP specific interface definition + */ +#define arp_snaddr ip_dl_reg +#define S_ARP_SNADDR IP_DL_REG + +/* + * datalink layer information (received after a IP_DLL_REG sent down) + */ +typedef struct sn_frgsz { + int prim_type; + int frgsz; + int opt_size; + short int_flags; + unsigned long link_speed; + unsigned long receive_buffer_size; +} S_SN_FRGSZ; diff --git a/private/inc/sys/snet/ll_ctrl.h b/private/inc/sys/snet/ll_ctrl.h new file mode 100644 index 000000000..31eb29191 --- /dev/null +++ b/private/inc/sys/snet/ll_ctrl.h @@ -0,0 +1,91 @@ +/* + * /redknee10/projects/spare/PBRAIN/SCCS/pbrainG/dev/src/include/sys/snet/35/s.ll_control.h + * @(#)ll_control.h 1.2 + * + * Last delta created 15:48:28 11/18/91 + * This file extracted 09:26:04 3/18/92 + * + * Modifications: + * + * IS Oct 1991 Ported for LLC1 + */ + + +/* IOCTL commands */ +#define L_SETSNID ('L'<<8 | 1) /* Set subnet identifier (use ll_snioc) */ +#define L_GETSNID ('L'<<8 | 2) /* Get subnet identifier (use ll_snioc) */ +#define L_SETTUNE ('L'<<8 | 3) /* Set tuning parameters (use ll_tnioc) */ +#define L_GETTUNE ('L'<<8 | 4) /* Get tuning parameters (use ll_tnioc) */ +#define L_GETSTATS ('L'<<8 | 5) /* Get statistics counts (use ll_stioc) */ +#define L_ZEROSTATS ('L'<<8 | 6) /* Zero statistics (use ll_hdioc) */ + +/* Values for 'lli_type' (with names of corresponding structures) */ +#define LI_PLAIN 0x01 /* Indicates 'struct ll_hdioc' */ +#define LI_SNID 0x02 /* Indicates 'struct ll_snioc' */ +#define LI_STATS 0x04 /* Indicates 'struct ll_stioc' */ + + +#define LI_LLC2TUNE 0x23 /* Indicates 'struct llc2_tnioc'*/ + + +/* LLC1 tuning structure */ +typedef struct llc2tune { + uint16 Tbusy; /* Remote busy check time (unit 0.1 sec) */ + uint16 Tidle; /* Idle P/F cycle time (unit 0.1 sec) */ + uint16 tx_window; /* Transmit window (if no XID received) */ + uint16 tx_probe; /* P-bit position before end of Tx window */ + uint16 xid_window; /* XID window size (receive window) */ + uint16 xid_Ndup; /* Duplicate MAC XID count (0 => no test) */ + uint16 xid_Tdup; /* Duplicate MAC XID time (unit 0.1 sec) */ +} llc2tune_t; + +/* LLC2/LAPB stats structure */ +typedef struct ll_stats { + uint32 lls_txU; /* Number of 'U' frames sent */ + uint32 lls_rxU; /* Number of good 'U' frames received */ + uint32 lls_rxign; /* Number of frames ignored */ + uint32 lls_rxbad; /* Number of erroneous frames received */ + uint32 lls_rxdud; /* Number of received and discarded frames */ +} llstats_t; + +/* Header alone (for decoding and L_ZEROSTATS commands) */ +struct ll_hdioc { + uint8 lli_type; /* Table type = LI_PLAIN */ + uint8 lli_snid; /* Subnet ID character */ + uint16 lli_spare; /* (for alignment) */ +}; + +/* Ioctl block for L_SETSNID and L_GETSNID commands */ +struct ll_snioc { + uint8 lli_type; /* Table type = LI_SNID */ + uint8 lli_snid; /* Subnet ID character */ + uint16 lli_spare; /* (for alignment) */ + + uint32 lli_index; /* Link index */ +}; + + +/* Ioctl block for LLC1 L_SETTUNE and L_GETTUNE commands */ +struct llc2_tnioc { + uint8 lli_type; /* Table type = LI_LLC2TUNE */ + uint8 lli_snid; /* Subnet ID character ('*' => 'all') */ + uint16 lli_spare; /* (for alignment) */ + + llc2tune_t llc2_tune; /* Table of tuning values */ +}; + +/* Ioctl block for L_GETSTATS command */ +struct ll_stioc { + uint8 lli_type; /* Table type = LI_STATS */ + uint8 lli_snid; /* Subnet ID character */ + uint16 lli_spare; /* (for alignment) */ + llstats_t lli_stats; /* Table of stats values */ +}; + +/* Union of ioctl blocks */ +typedef union lli_union { + struct ll_hdioc ll_hd; /* Parameter-less command */ + struct ll_snioc ll_sn; /* Set/get subnet identifier */ + struct llc2_tnioc llc2_tn; /* Set/get LLC1 tuning */ + struct ll_stioc ll_st; /* Get statistics */ +} lliun_t; diff --git a/private/inc/sys/snet/ll_proto.h b/private/inc/sys/snet/ll_proto.h new file mode 100644 index 000000000..3fe33b812 --- /dev/null +++ b/private/inc/sys/snet/ll_proto.h @@ -0,0 +1,105 @@ + +/****************************************************************** + * + * Copyright 1991 Spider Systems Limited + * + * LL_PROTO.C + * + ******************************************************************/ +/* + * /redknee10/projects/spare/PBRAIN/SCCS/pbrainG/dev/src/include/sys/snet/35/s.ll_proto.h + * @(#)ll_proto.h 1.2 + * + * Last delta created 18:43:07 1/28/92 + * This file extracted 09:26:05 3/18/92 + * +#ifdef MOD_HISTORY + * + * Modifications: + * + * JS 25 Sep 90 Added LAP classes. + * JS 17 Oct 90 Renamed LC_LAPB as LC_LAPBDTE and LC_LAPBX + * as LC_LAPBXDTE. + * JS 21 Nov 90 Moved ll_mymacaddr field in ll_reg structure + * to start on 4 byte boundary. + * IS Oct 1991 Changed for LLC1 +#endif + */ + + +#define MAXHWLEN 6 +#define LL_MAXADDRLEN 8 + +/* Interface structures */ +struct ll_reg { + uint8 ll_type; + uint8 ll_class; + uint8 ll_regstatus; + uint8 ll_snid; + uint8 ll_normalSAP; + uint8 ll_loopbackSAP; + uint8 ll_mactype; /* type of hardware interface */ + uint8 ll_addrsize; /* size of hardware address */ + uint16 ll_frgsz; /* max fragment size of HW */ + uint8 ll_mymacaddr[LL_MAXADDRLEN]; /* hardware address */ +}; + +struct ll_msg { + uint8 ll_type; + uint8 ll_command; + uint16 ll_connID; + uint32 ll_yourhandle; + uint32 ll_status; +}; + +struct ll_msgc { + uint8 ll_type; + uint8 ll_command; + uint16 ll_connID; + uint32 ll_yourhandle; + uint32 ll_myhandle; + uint16 ll_service_class; + uint8 ll_remsize; /* semi-octect size of remote address */ + uint8 ll_locsize; /* semi-octect size of local address */ + uint8 ll_route_length; /* size of routing information */ + uint8 ll_locaddr[LL_MAXADDRLEN]; /* local address */ + uint8 ll_remaddr[LL_MAXADDRLEN]; /* remote address */ + uint8 ll_route_info[1]; /* optional routing info field MUST */ + /* follow ll_remaddr field */ +}; + +/* Values for 'll_type' */ +#define LL_REG 50 +#define LL_DAT 52 + +/* Values for 'll_command' */ + +#define LC_UDATA 4 +#define LC_DISC 5 +#define LC_DISCNF 6 +#define LC_RESET 7 +#define LC_RSTCNF 8 +#define LC_REPORT 9 + + +/* Values of 'll_class' in 'll_reg' */ +#define LC_LLC1 15 + +/* Values in 'll_regstatus' and 'll_status' */ +#define LS_SUCCESS 1 +#define LS_RESETTING 2 +#define LS_RESETDONE 3 +#define LS_DISCONNECT 4 +#define LS_FAILED 5 +#define LS_CONFLICT 6 +#define LS_RST_FAILED 7 +#define LS_RST_REFUSED 8 +#define LS_RST_DECLINED 9 +#define LS_REM_BUSY 12 +#define LS_REM_NOT_BUSY 13 +#define LS_EXHAUSTED 14 +#define LS_SSAPINUSE 15 +#define LS_LSAPINUSE 16 +#define LS_DUPLICATED 17 +#define LS_LSAPWRONG 18 + diff --git a/private/inc/sys/snet/nbdebug.h b/private/inc/sys/snet/nbdebug.h new file mode 100644 index 000000000..810c9fc1a --- /dev/null +++ b/private/inc/sys/snet/nbdebug.h @@ -0,0 +1,41 @@ +/* + * /usr/projects/spare/PBRAIN/SCCS/pbrainD/dev/src/include/sys/snet/0/s.nbdebug.h + * @(#)nbdebug.h 1.3 + * + * Last delta created 12:37:27 3/11/91 + * This file extracted 15:16:57 4/1/91 + * + * Modifications: + * + * 6 Feb 1991 (RAE) Ported to SpiderTCP + */ + +#ifndef _NBDEBUG_INCLUDED +#define _NBDEBUG_INCLUDED + +extern int nbtraceflag; + +#define I_NBDEBUG 0x8000 + +/* debug_cmd */ + +#define DTRACE 1 + +/* flags for debug_cmd DTRACE */ + +#define D_STRM 0x0001 +#define D_DEP 0x0002 +#define D_SEP 0x0004 +#define D_SIB 0x0008 +#define D_NSRV 0x0010 +#define D_SSRV 0x0020 +#define D_DSRV 0x0040 +#define D_CTRL 0x0080 +#define D_LMH 0x0100 + +struct nb_debug { + int debug_cmd; + int debugflag; +}; + +#endif // _NBDEBUG_INCLUDED diff --git a/private/inc/sys/snet/nbt_ctrl.h b/private/inc/sys/snet/nbt_ctrl.h new file mode 100644 index 000000000..8f78167c0 --- /dev/null +++ b/private/inc/sys/snet/nbt_ctrl.h @@ -0,0 +1,193 @@ +/*++ + +Copyright (c) 1991 Microsoft Corporation + +Module Name: + + nbt_ctrl.h + +Abstract: + + This file contains structure definitions for the user-level interface to + the NBT driver. + +Author: + + Mike Massa (mikemas) Jan 30, 1992 + +Revision History: + + Who When What + -------- -------- ---------------------------------------------- + mikemas 01-30-92 created + +Notes: + +--*/ + +/* + * /usr/projects/spare/PBRAIN/SCCS/pbrainG/dev/src/include/sys/snet/0/s.nbt_control.h + * @(#)nbt_control.h 1.9 + * + * Last delta created 15:54:26 10/25/91 + * This file extracted 16:49:25 12/23/91 + * + * Modifications: + * + * 6 Feb 1991 (RAE) Ported to SpiderTCP + */ + +#ifndef _NBT_CTRL_INCLUDED_ +#define _NBT_CTRL_INCLUDED_ + + +typedef unsigned short word; +typedef unsigned char byte; +typedef unsigned int dword; + +// +// #defines for debugging reference count problems +// + +#if DBG + +#define REFCOUNT_TRACE 1 + +#endif + +#define REFCOUNT_TRACE_UNUSENAME 0 +#define REFCOUNT_TRACE_USENAME 1 +#define REFCOUNT_TRACE_FINDNAME 2 +#define REFCOUNT_TRACE_PUTNEXT 3 +#define REFCOUNT_TRACE_LINKREQ 4 +#define REFCOUNT_TRACE_ACTIVE 5 + +#define NUM_REFCOUNT_TRACE 6 + +/* + * XEB (Standard Object Block) + */ + +#ifdef COMPILE_UP_TCPIP + +typedef struct xeb { + struct msgb *msg; /* the allocated stream msg */ + char blockname[4]; /* Debug name information */ + struct xeb *dnlink; /* Debug link to next block) */ + struct xeb *dplink; /* Debug link to previous block */ + struct xeb *nlink; /* link to next block) */ + struct xeb *plink; /* link to previous block */ + struct queue *uqptrRD; + struct queue *uqptrWR; + struct queue *lqptrRD; + struct queue *lqptrWR; + int state; + int (*init_object)(); /* init_object procedure */ + void (*in_object)(); /* in_object procedure */ + int (*out_object)(); /* out_object procedure */ + int (*close_object)(); /* close_object procedure */ + int (*test_resource)(); /* procedure, test buf resources */ + int bufcall_flag; /* object wait on buf resources */ + struct xeb *nmptr; /* pointer to bound name */ + struct msgb *work_q; /* queue of work to do */ +} XEB; + +#else /* COMPILE_UP_TCPIP */ + +typedef struct xeb { + struct msgb **msg; /* the allocated stream msg */ + char blockname[4]; /* Debug name information */ + struct xeb *nlink; /* link to next block) */ + struct xeb *plink; /* link to previous block */ + struct queue *uqptrRD; + struct queue *uqptrWR; + struct queue *lqptrRD; + struct queue *lqptrWR; + int state; + int ref_count; /* reference count for the object */ + /* each pending operation references the */ + /* object and the completion deref's it */ + /* when the ref count goes to zero, the */ + /* object can be safely closed */ +#ifdef REFCOUNT_TRACE + int trace_count[NUM_REFCOUNT_TRACE]; + /* each type of reference has a trace entry */ + /* when a reference is made, it is made with */ + /* a reference type that is incremented for */ + /* the entry */ + int FindNamesAdded; /* number of findname requests added to the */ + /* FASTTIMQ for this xeb */ + int FindNamesRemoved; /* number of findname requests taken from the */ + /* FASTTIMQ for this xeb */ +#endif + KEVENT close_event; /* This event is signalled when the ref count */ + /* goes to zero. It is waited on in nbtclose */ + int (*init_object)(); /* init_object procedure */ + void (*in_object)(); /* in_object procedure */ + int (*out_object)(); /* out_object procedure */ + int (*close_object)(); /* close_object procedure */ + int (*test_resource)(); /* procedure, test buf resources */ + int spl; /* level at which per xeb lock was acquired */ + struct msgb *work_q; /* work to do queue for deferred actions */ + int bufcall_flag; /* object wait on buf resources */ + struct xeb *nmptr; /* pointer to bound name */ +} XEB; + +#endif /* COMPILE_UP_TCPIP */ + + +typedef struct linkreq { + unsigned int primtype; + XEB *xeb; + struct queue *toq; /* who have asked */ + struct queue *l_qbot; + int l_index; + struct msgb * mconind; /* msg pointer to message which have started */ + /* this request */ +} LINKREQ; + + + +typedef struct confreq { + unsigned int primtype; + + /* General */ + + unsigned char this_scope[240]; /* SCOPE_ID */ + unsigned char name[17]; /* permanent nb name */ + unsigned long broadcast_inaddr; /* ip broadcast addr */ + unsigned long subnet_mask; /* subnet mask for the ip addr */ + unsigned long this_inaddr; /* ip addr for the nbt */ + unsigned short bcast_req_retry_timeout; /* 250 ms */ + unsigned short bcast_req_retry_count; /* 3 */ + + /* Name service */ + + unsigned short conflict_timer; /* 1000 ms */ + unsigned short namesrv_udpport; /* 137 */ + + /* Session service */ + + unsigned short sessionsrv_tcpport; /* 139 */ + unsigned short ssn_retry_count; /* 4 */ + unsigned short ssn_close_timeout; /* 30 sek */ + unsigned short ssn_keep_alive_timeout; /* 60 sek */ + + /* Datagram service */ + + unsigned short datagramsrv_udpport; /* 138 */ + unsigned short dgr_frag_timeout; /* 2 sec */ +} CONFREQ; + + +#define CONF_REQ 3001 +#define NBT_LINK_REQ 3016 +#define NBT_LINK_ACK 3017 +#define NBT_LINK_NACK 3018 +#define NBT_UNLINK_REQ 3019 +#define NBT_UNLINK_ACK 3020 +#define NBT_UNLINK_NACK 3021 + + +#endif // _NBT_CTRL_INCLUDED_ + diff --git a/private/inc/sys/snet/nbt_stat.h b/private/inc/sys/snet/nbt_stat.h new file mode 100644 index 000000000..a54e92204 --- /dev/null +++ b/private/inc/sys/snet/nbt_stat.h @@ -0,0 +1,129 @@ +/*++ + +Copyright (c) 1991 Microsoft Corporation + +Module Name: + + nbt_stat.h + +Abstract: + + This file contains statistics structure declarations for the user- + level interface to the NBT driver. + +Author: + + Mike Massa (mikemas) Jan 30, 1992 + +Revision History: + + Who When What + -------- -------- ---------------------------------------------- + mikemas 01-30-92 created + +Notes: + +--*/ + +/* + * /usr/projects/spare/PBRAIN/SCCS/pbrainG/dev/src/include/sys/snet/0/s.nbt_stat.h + * @(#)nbt_stat.h 1.2 + * + * Last delta created 14:05:19 10/2/91 + * This file extracted 16:49:25 12/23/91 + * + * Modifications: + * + * 6 Feb 1991 (RAE) Ported to SpiderTCP + */ + +#ifndef _NBT_STAT_INCLUDED_ +#define _NBT_STAT_INCLUDED_ + +#define MAX_XEB 32 /* max. no. of xebinfos in a message */ + +/* structure passed/returned in NBT_STAT/NBT_NAME ioctl command */ +struct nbt_stat +{ + int xeb_count; + char perm_name[17]; /* Permanent name of node */ + char scope_id[240]; /* Scope identifier of node */ +}; + + +#define NBT_XEBINFO 1 /* primtype of nbt_xebinfo struct */ +#define NBT_NAMEINFO 2 /* primtype of nbt_nameinfo struct */ +#define NBT_CACHEINFO 3 /* primtype of nbt_cacheinfo struct */ + +struct nbt_info { + int prim_type; /* NBT_XEBINFO or _NAMEINFO or _CACHEINFO */ + int count; /* number of entries in message */ +}; + +/* + * Per-Endpoint (XEB) Data. + */ +struct xebinfo +{ + long addr; /* XEB address */ + char type[4]; /* type of XEB */ + int xeb_state; /* internal xeb state */ + char local_name[17]; /* NetBIOS name of endpoint */ + char remote_name[17]; /* NetBIOS name of endpoint */ + int dev; /* minor device number of endpoint */ + unsigned int in_data; /* received data bytes to endpoint */ + unsigned int out_data; /* transmitted data bytes from endpoint */ +}; + +/* + * Name Data. + */ +struct nameinfo +{ + long addr; /* NEB address */ + int type; /* type of name */ + int status; /* name status */ + char name[17]; /* NetBIOS name of endpoint */ +}; + +/* + * Cache Data. + */ +struct cacheinfo +{ + long addr; /* CACHE_ELEM address */ + unsigned int type; /* type of name */ + unsigned char name[17]; /* NetBIOS name */ + unsigned long ip_addr; /* Internet Address of name */ + unsigned int ttl; /* Time To Live */ +}; + + +/* + * Ioctl(2) commands for NetBIOS Device. + */ +#define NBT_STAT ('B'<<8|1) /* generic status gathering */ +#define NBT_RESET ('B'<<8|2) /* generic status reset */ +#define NBT_NAME ('B'<<8|3) /* generic name gathering */ +#define NBT_CACHE ('B'<<8|4) /* generic cache gathering */ +#define NBT_RESYNC ('B'<<8|5) /* reread the lmhosts file */ + + +/* + * Name types and status + */ +#define UNIQUE 0x0000 +#define GROUP 0x8000 + + +#define INFINITE_TTL ((unsigned int) -1)/* CACHE_ELEM.timeout, cacheinfo.ttl */ + + +#define CONFLICT 1 +#define REGISTERING 2 +#define DEREGISTERING 3 +#define REGISTERED 4 + + +#endif // _NBT_STAT_INCLUDED_ + diff --git a/private/inc/sys/snet/nbtuser.h b/private/inc/sys/snet/nbtuser.h new file mode 100644 index 000000000..90e88fb7e --- /dev/null +++ b/private/inc/sys/snet/nbtuser.h @@ -0,0 +1,43 @@ +/* + * /usr/projects/spare/PBRAIN/SCCS/pbrainD/dev/src/include/sys/snet/0/s.nbtuser.h + * @(#)nbtuser.h 1.3 + * + * Last delta created 14:57:27 2/22/91 + * This file extracted 15:16:56 4/1/91 + * + * Modifications: + * + * 6 Feb 1991 (RAE) Ported to SpiderTCP + */ + +/* + * NetBIOS specific error codes + */ +#define PROTO_SESSIONCLOSED 1 +#define PROTO_SESSIONABORTED 2 +#define ENAMEUNR 3 + +/* Netbios interface definitions */ + +/* nbt open types */ +#define O_CLTS 0x4000 /* flag used in open to specify a + * connectionless transport endpoint */ + +//#define TLI_NBT "/dev/nbt" + +/* Netbios names */ +#define NBNAMSZ 16 +#define MAXNBDG 512 /* maximum datagram size */ +#define NBUNIQUENM 0x00 /* unique name flag, nb_type */ +#define NBGROUPNM 0x01 /* group name flag, nb_type */ +#define NBBROADCAST 0x40 /* broadcast flag, nb_type */ + +struct nbaddr { + USHORT nb_type; /* name type: group, unique */ + UCHAR nb_name[NBNAMSZ]; +// char nb_res; /* reserved, unused */ +}; + +/* Length's are passed as ioctl's: */ +#define NBSTR ('N'<<8) +#define NBIOCTL_TSDUSZ (NBSTR|0x1) diff --git a/private/inc/sys/snet/net_stat.h b/private/inc/sys/snet/net_stat.h new file mode 100644 index 000000000..c9f46d507 --- /dev/null +++ b/private/inc/sys/snet/net_stat.h @@ -0,0 +1,159 @@ +/*++ + +Copyright (c) 1991 Microsoft Corporation + +Module Name: + + net_stat.h + +Abstract: + + This file defines the IOCTL interface to the TCP/IP drivers used by + the netstat program. + +Author: + + Mike Massa (mikemas) Jan 31, 1992 + +Revision History: + + Who When What + -------- -------- ---------------------------------------------- + mikemas 01-31-92 created + +Notes: + +--*/ + +/* + * /usr/projects/spare/PBRAIN/SCCS/pbrainG/dev/src/include/sys/snet/0/s.net_stat.h + * @(#)net_stat.h 1.9 + * + * Last delta created 12:04:31 3/6/90 + * This file extracted 16:49:18 12/23/91 + * + * MV 08/06/88 Mods for Generic Ethernet Driver (GENERICE). + * + * MV 18/07/88 To get over limits on STREAMS ioctl size, we now + * get connection information send up in separate + * messages, with the number of connections to expect + * passed up (along with protocol stats) in the initial + * ioctl. + */ + +/* + * TCP statistics. + */ + +struct tcp_stat +{ + long net; /* net to get stats on, 0L -> all nets */ + + /* protocol statistics */ + int tcp_small; /* incomplete headers */ + int tcp_cksum; /* header checksum errors */ + + /* connection information */ + int tcp_conns; /* number of active TCBs */ +}; + +#define MAX_TCB 32 /* max. no. of tcp_conns in a message */ + +/* + * Per-Connection (TCB) Data. + */ + +struct tcp_conn +{ + long tcp_addr; /* TCB address */ + int tcp_rcvq; /* packets on receive queue */ + int tcp_sndq; /* packets on send queue */ + long tcp_laddr; /* local address */ + long tcp_faddr; /* foreign address */ + short tcp_lport; /* local port */ + short tcp_fport; /* foreign port */ + int tcp_state; /* connection state */ +}; + +/* possible values for tcp_state */ + +#define CLOSED 0 /* connection not in use */ +#define LISTEN 1 /* listening for requests */ +#define SYN_SEND 2 /* sent SYN, awaiting ACK */ +#define SYN_RECV 3 /* received SYN, not ACKed */ +#define ESTABLISHED 4 /* connection established */ +#define FIN_WAIT_1 5 /* sent FIN, awaiting ACK */ +#define FIN_WAIT_2 6 /* sent FIN, got ACK not FIN */ +#define CLOSE_WAIT 7 /* received FIN, not ACKed */ +#define LAST_ACK 8 /* waiting for final ACK */ + +/* + * UDP statistics. + */ + +struct udp_stat +{ + long net; /* net to get stats on, 0L -> all nets */ + + /* protocol statistics */ + int udp_small; /* packets smaller than minimum */ + int udp_cksum; /* header checksum errors */ + int udp_header; /* bad data length fields */ + + /* connection information */ + int udp_conns; /* number of active UCBs */ +}; + +#define MAX_UCB 32 /* max. no. of udp_conns in a message */ + +/* + * Per-Connection (UCB) Data. + */ + +struct udp_conn +{ + long udp_addr; /* UCB address */ + int udp_rcvq; /* packets on receive queue */ + int udp_sndq; /* packets on send queue */ + long udp_laddr; /* local address */ + int udp_lport; /* local port */ + long udp_faddr; /* foreign address */ + int udp_fport; /* foreign port */ +}; + +/* + * IP statistics + */ + +struct ip_stat +{ + long net; /* net to get stats on, 0L -> all nets */ + + int ip_small; /* packets smaller than minimum */ + int ip_cksum; /* header checksum errors */ + int ip_header; /* bad data length fields */ +}; + +#ifndef GENERICE +/* + * Ethernet statistics + */ + +struct eth_stat +{ + long eth_tx; /* packets transmitted */ + long eth_rx; /* packets received */ + long eth_lost; /* packets discarded */ + int eth_crc; /* CRC error packets */ + int eth_align; /* alignment error packets */ + int eth_res; /* 82586 resource errors */ + int eth_over; /* overrun error packets */ +}; +#endif /*~GENERICE*/ + +/* + * Ioctl(2) commands for Network Devices. + */ + +#define NET_STAT ('N'<<8|1) /* generic statistics gathering */ +#define NET_RESET ('N'<<8|2) /* generic statistics reset */ diff --git a/private/inc/sys/snet/s_socket.h b/private/inc/sys/snet/s_socket.h new file mode 100644 index 000000000..a91e293c4 --- /dev/null +++ b/private/inc/sys/snet/s_socket.h @@ -0,0 +1,105 @@ +/*++ + +Copyright (c) 1991 Microsoft Corporation + +Module Name: + + s_socket.h + +Abstract: + + This module contains socket definitions for STREAMS TCP/IP sockets. + +Author: + + Eric Chin (ericc) July 18, 1991 + +Revision History: + +--*/ + +/****************************************************************** + * + * S-TCP Socket Library + * + * Copyright 1987 Spider Systems Limited + * + * S_SOCKET.H + * + * Contains socket definitions for SpiderTCP In-kernel socket + * code + * + * + ******************************************************************/ + +/* + * /usr/projects/spare/PBRAIN/SCCS/pbrainG/dev/src/include/sys/snet/0/s.s_socket.h + * @(#)s_socket.h 1.4 + * + * Last delta created 15:05:38 6/20/89 + * This file extracted 08:53:44 7/10/91 + * + * Modifications: + * + * NCF 00/00/00 Written + * + * PR 01/12/87 Integrated into Admin System II, all + * projects + */ + + +#ifndef _SYS_SNET_S_SOCKET_ +#define _SYS_SNET_S_SOCKET_ + + +/* + * IOCTL types + */ +#define SO_IOCTL 'S'<<8 +#define SO_ACCEPT (SO_IOCTL | 'a') +#define SO_BIND (SO_IOCTL | 'b') +#define SO_CONNECT (SO_IOCTL | 'c') +#define SO_GETPEER (SO_IOCTL | 'p') +#define SO_GETSOCK (SO_IOCTL | 'h') +#define SO_GETSOPT (SO_IOCTL | 'o') +#define SO_SETSOPT (SO_IOCTL | 't') +#define SO_LISTEN (SO_IOCTL | 'l') +#define SO_SHUTDOWN (SO_IOCTL | 'x') + + +/* + * Message types + */ +#define SO_DO_ACCEPT (SO_IOCTL | 'A') +#define SO_EXRCV (SO_IOCTL | 'U') +#define SO_EXSEND (SO_IOCTL | 'X') +#define SO_RECV (SO_IOCTL | 'r') +#define SO_RECVFROM (SO_IOCTL | 'R') +#define SO_SEND (SO_IOCTL | 's') +#define SO_SENDTO (SO_IOCTL | 'S') + +/* + * Socket options structure + */ +struct s_sockopt { + int level; + int optnam; + int optval; /* May be extended */ +}; + +struct s_ctlhdr { + long prim_type; + int addrlen; + char addr[32]; +}; + +/* + * Socket SO_DO_ACCEPT structure + */ +struct acc_str { + int type; + int pad; + int *ptr; +}; + +#endif /* _SYS_SNET_S_SOCKET_ */ diff --git a/private/inc/sys/snet/snmp.h b/private/inc/sys/snet/snmp.h new file mode 100644 index 000000000..b903daea7 --- /dev/null +++ b/private/inc/sys/snet/snmp.h @@ -0,0 +1,132 @@ +/*++ + +Copyright (c) 1991 Microsoft Corporation + +Module Name: + + snmp.h + +Abstract: + + This module contains SNMP definitions for STREAMS TCP/IP drivers. + +Author: + + Eric Chin (ericc) July 18, 1991 + +Revision History: + +--*/ + +/************************************************************************* + * + * SpiderSNMP + * + * Copyright 1990 Spider Systems Limited + * + * SNMP.H + * + * Daemon/kernel interface + * + * + *************************************************************************/ + +/* + * /usr/projects/spare/PBRAIN/SCCS/pbrainG/dev/src/include/sys/snet/0/s.snmp.h + * @(#)snmp.h 1.1 + * + * Last delta created 10:15:32 3/1/90 + * This file extracted 08:53:47 7/10/91 + * + * Modifications: + * + * GSS 01/03/90 put in Pbrain + */ + +#ifndef _SYS_SNET_SNMP_ +#define _SYS_SNET_SNMP_ + + +/* + * Values for the 'ic_cmd' field of I_STR ioctls. + * These indicate the request to be performed. + * These should be ored with the constants below, which specify + * the variables on which the request should be performed. + */ + +#define SNMPIOC ('M' << 8) + +#define SNMP_GET_REQ (SNMPIOC | (0 << 5)) +#define SNMP_GETNEXT_REQ (SNMPIOC | (1 << 5)) +#define SNMP_SET_REQ (SNMPIOC | (3 << 5)) + +#define SNMP_REQ_MASK (SNMPIOC | (7 << 5)) + +/* + * Values for the 'ic_cmd' field of I_STR ioctls. + * These indicate the variables to be affected. + * These should be ored with the constants above, which specify + * the type of request. + */ + +#define SNMP_IF 0 +#define SNMP_IFENTRY 1 +#define SNMP_ATENTRY 2 +#define SNMP_IP 3 +#define SNMP_IPADDRENTRY 4 +#define SNMP_IPROUTEENTRY 5 +#define SNMP_ICMP 6 +#define SNMP_TCP 7 +#define SNMP_TCPCONNENTRY 8 +#define SNMP_UDP 9 +#define SNMP_UDPENTRY 10 + +#define SNMP_VAR_MASK 31 + +/* + * Values for the 'ic_cmd' field of I_STR ioctls. + * This indicates that an SNMP control message + * is being sent. + */ + +#define SNMP_CONTROL (SNMPIOC | (7 << 5) | 0) + +/* + * init structure for SNMP + */ + +struct snmp_init +{ + uint8 prim_type; + u_long since; +}; + +#define SNMP_INIT 1 + +/* + * trap structure for SNMP; + * currently this is only used between drivers + */ + +struct snmp_trap +{ + int prim_type; + long generic_trap; + long specific_trap; + int info_len; /* length of info in bytes */ + char info[1]; /* "interesting" information */ +}; + +/* + * values for "generic_trap" + */ + +#define SNMP_TRAP_ENTSPEC 6 + +/* + * values for "specific_trap" are the same as the interface status field + * i.e. up(1), down(2), testing(3). + */ + +#endif /* _SYS_SNET_SNMP_ */ + diff --git a/private/inc/sys/snet/stcp_opt.h b/private/inc/sys/snet/stcp_opt.h new file mode 100644 index 000000000..42f5c859a --- /dev/null +++ b/private/inc/sys/snet/stcp_opt.h @@ -0,0 +1,87 @@ +/*++ + +Copyright (c) 1991 Microsoft Corporation + +Module Name: + + stcp_opt.h + +Abstract: + + This module contains TCP/IP user options definitions for STREAMS TCP/IP. + +Author: + + Eric Chin (ericc) July 18, 1991 + +Revision History: + +--*/ + +/****************************************************************** + * + * SpiderTCP Application Definitions + * + * Copyright 1987 Spider Systems Limited + * + * STCP_OPT.H + * + * User options for TCP/IP on V.3 Streams + * + * PR@Spider /\oo/\ + * + ******************************************************************/ + +/* + * /usr/projects/spare/PBRAIN/SCCS/pbrainG/dev/src/include/sys/snet/0/s.stcp_opt.h + * @(#)stcp_opt.h 1.9 + * + * Last delta created 19:24:09 2/21/90 + * This file extracted 08:53:45 7/10/91 + * + * Modifications: + * + * PR 01/12/87 Integrated into Admin System II, all + * projects + */ + +#ifndef _SYS_SNET_STCP_OPT_ +#define _SYS_SNET_STCP_OPT_ + + +/* + * TCP Top level option. These may be or'ed together in + * the option word. opt_level should be set to TOL_TLI + * to set these parameters + */ + +#define TOL_TLI 0xffff + +#define TO_NO_OPTS 0x0000 +#define TO_REUSE_ADDR 0x0001 +#define TO_KEEPALIVE 0x0004 +#define TO_DEBUG 0x0002 +#define TO_LINGER 0x0008 +#define TO_RDWR 0x0010 +#define TO_NODELAY 0x0020 + +#ifdef TESTOPT +#define TO_TESTOPT 0x0040 +#endif + +#define TOL_RCVBUF 0x0001 + +/* + * TCP/IP Option struct for use with the T_OPTMGMT + * function. + */ + +typedef struct tcp_opt { + int opt_level; + int opt_name; + int opt_data[1]; + +} TOPT; + +#endif /* _SYS_SNET_STCP_OPT_ */ + diff --git a/private/inc/sys/snet/tcp_ctrl.h b/private/inc/sys/snet/tcp_ctrl.h new file mode 100644 index 000000000..ef99e3424 --- /dev/null +++ b/private/inc/sys/snet/tcp_ctrl.h @@ -0,0 +1,78 @@ +/*++ + +Copyright (c) 1991 Microsoft Corporation + +Module Name: + + tcp_ctrl.h + +Abstract: + + TCP interface declarations. + +Author: + + Mike Massa (mikemas) Jan 30, 1992 + +Revision History: + + Who When What + -------- -------- ---------------------------------------------- + mikemas 01-30-92 created + +Notes: + +--*/ + +/****************************************************************** + * + * SpiderTCP Interface Primitives + * + * Copyright (c) 1988 Spider Systems Limited + * + * This Source Code is furnished under Licence, and may not be + * copied or distributed without express written agreement. + * + * All rights reserved. + * + * Written by Nick Felisiak, Ian Heavens, Peter Reid, + * Gavin Shearer, Mark Valentine + * + * TCP_CONTROL.H + * + * TCP Streams ioctl primitives for TCP/IP on V.3 Streams + * + ******************************************************************/ + +/* + * /usr/projects/spare/PBRAIN/SCCS/pbrainG/dev/src/include/sys/snet/0/s.tcp_control.h + * @(#)tcp_control.h 1.4 + * + * Last delta created 11:56:46 11/1/91 + * This file extracted 16:49:20 12/23/91 + * + * Modifications: + * + * 20/07/88 MV Added tcp_proto to hold tcp_pcbinfo. + */ + +#ifndef _SYS_SNET_TCP_CTRL_INCLUDED +#define _SYS_SNET_TCP_CTRL_INCLUDED + + +struct tcp_pcbinfo { + int prim_type; + int tcbcount; +}; + +typedef union tcp_proto { + int type; + struct tcp_pcbinfo pcbinfo; +} S_TCP_PROTO; + +#define TCP_PCBINFO 1 +#define TCP_TCBINFO 2 + + +#endif // _SYS_SNET_TCP_CTRL_INCLUDED + diff --git a/private/inc/sys/snet/tftp.h b/private/inc/sys/snet/tftp.h new file mode 100644 index 000000000..a9e96fcd7 --- /dev/null +++ b/private/inc/sys/snet/tftp.h @@ -0,0 +1,203 @@ +/*++ + +Copyright (c) 1991 Microsoft Corporation + +Module Name: + + tftp.h + +Abstract: + + Definitions for the tftp program. + +Author: + + Mike Massa (mikemas) Jan 31, 1992 + +Revision History: + + Who When What + -------- -------- ---------------------------------------------- + mikemas 01-31-92 created + +Notes: + +--*/ + +/****************************************************************** + * + * SpiderTCP Socket Utilities + * + * Copyright 1988 Spider Systems Limited + * + * TFTP.H + * + * Tftp and tftpd includes + * + * CN_RQ, CN_LSTN, CN_RCV, CN_WAIT, CN_MKWRT, STRSAVE, UDP_ALLOC + * CN_ACK, LOGPKT, CN_SWAB, CN_CLOSE, CN_SEND, CN_RCVF, CN_ERR + * CN_LOG, CN_INFORM, TST_AND_CLR + * + * + ******************************************************************/ + +/* + * /usr/projects/tcp/SCCS.rel3/rel/src/include/sys/snet/0/s.tftp.h + * @(#)tftp.h 5.3 + * + * Last delta created 14:07:57 3/4/91 + * This file extracted 11:19:46 3/8/91 + * + * Modifications: + * + * GSS 12/04/88 Integrated into Admin System II, all + * projects + */ + +/* This file contains the definitions for the TFTP connection control + * block, which contains all the information pertaining to a connection. + * A conn structure is allocated at connection open time and retained + * until the connection is closed. The routines in the file conn.c + * are sufficient for dealing with connections. + * It also contains the structure definition for tftp packets. + */ + + +/* A connection control block */ + +struct conn { + SOCKET netfd; /* network file descriptor */ + int type; /* user or server connection */ + int synced; /* conn synchronized flag */ + unsigned int block_num; /* next block number */ + char * last_sent; /* previous packet sent */ + int last_len; /* size of previous packet */ + time_t nxt_retrans; /* when to retransmit */ + int retrans; /* number of retransmits */ + int timeout; /* retransmit timeout */ + char * cur_pkt; /* current packet (send or rcv) */ + int cur_len; /* current packet len */ + char * last_rcv; /* last received packet */ + int rcv_len; /* size of last rcvd. packet */ + char *file; /* file name */ + int dir; /* direction */ + int mode; /* transfer mode */ + char *c_mode; /* char. string mode */ + struct in_addr fhost; /* foreign host */ + int fport; /* foreign port for connection */ + int lport; /* local port for connection */ + int intrace; /* input packet trace flag */ + int outtrace; /* output packet trace flag */ + int logging; /* connection logging flag */ +}; + +/* connection constants */ + +#define TIMEOUT 1 /* initial retransmit timeout */ +#define INITTIMEOUT 1 /* initial connection timeout */ +#define MAX_TIMEOUT 30 /* max. retransmit timeout */ +#define MAX_RETRANS 5 /* max. no. of retransmits */ +#define DAEMON 0 /* a daemon connection */ +#define USER 1 /* a user connection */ +#define TMO 0 /* retransmitting due to timeout */ +#define DUP 1 /* retransmitting due to duplicate */ + +#define DATALEN 512 /* size of data portion of tftp pkt */ + +/* tftp packet structure */ + +struct tftp { + unsigned short fp_opcode; /* header */ + unsigned short fp_blkno; /* Block number */ + char fp_blk[DATALEN];/* Data */ +}; + +/* values for fp_opcode */ + +#define RRQ 1 /* Read Request */ +#define WRQ 2 /* Write Request */ +#define DATA 3 /* Data block */ +#define DACK 4 /* Data Acknowledge */ +#define ERROR 5 /* Error */ + +/* values for error codes in ERROR packets */ + +#define TEUNDEF 0 /* Not defined, see message (if any) */ +#define TEFNF 1 /* File not found */ +#define TEACESS 2 /* Access violation */ +#define TEFULL 3 /* Disc full or allocation exceeded */ +#define TETFTP 4 /* Illegal TFTP operation */ +#define TETID 5 /* Unknown transfer ID */ + +/* Random constants */ + +#define TFTPLEN sizeof(struct tftp) /* max inet packet size */ + +#define READ RRQ /* read requested */ +#define WRITE WRQ /* write requested */ + +#define NETASCII 0 /* netascii transfer mode */ +#define IMAGE 1 /* image transfer mode */ + +#define INPKT 0 /* input packet */ +#define OUTPKT 1 /* output packet */ + +#define TRUE 1 +#define FALSE 0 + +/* extern declarations */ + + +#include <stdio.h> + +extern struct conn *cn_rq(); +extern struct conn *cn_lstn(); +extern struct tftp *cn_rcv(); +extern struct tftp *cn_mkwrt(); +extern void cn_ack(); +extern void logpkt(); +extern void cn_swab(); +extern void cn_close(); +extern void cn_send(); +extern void cn_rcvf(); +extern void _CRTAPI2 cn_log(const char *, int, ...); +extern void _CRTAPI2 cn_inform(const char *, ...); +extern void cn_err (register struct conn *, struct in_addr, + int, int, char *); +extern char *strsave(); +extern char tst_and_clr(); +extern char * udp_alloc(); + +struct tftp * +cn_wait( + struct conn *cn, + unsigned short opcode); + +int +cn_parse( + struct conn *, + struct in_addr, + int, + char *, + int); + +int +cn_retrans( + struct conn *, + int + ); + +int +cn_wrt( + struct conn *, + int); + +int +cn_wrtf( + struct conn *); + +int +do_cmd( + struct conn *); + + diff --git a/private/inc/sys/snet/timer.h b/private/inc/sys/snet/timer.h new file mode 100644 index 000000000..f8868d1d1 --- /dev/null +++ b/private/inc/sys/snet/timer.h @@ -0,0 +1,41 @@ + + +/********************************************************/ +/* */ +/* /redknee10/projects/spare/PBRAIN/SCCS/pbrainG/dev/src/include/sys/snet/0/s.timer.h */ +/* @(#)timer.h 1.2 */ +/* */ +/* Copyright (c) 1991 Spider Systems Limited */ +/* */ +/* TIMER.H - Multiple timer module heade */ +/* */ +/* Last delta created 12:22:12 3/12/91 */ +/* This file extracted 09:26:06 3/18/92 */ +/* */ +/* Modifications: */ +/* */ +/* */ +/********************************************************/ + + +/* Lock out clock ISR */ +#define splclock() splhi() + +/* Timers header, used to process expiries */ +typedef struct thead +{ + void (*th_expfunc)(); + void * th_exparg; + struct timer *th_expired; +} thead_t; + +/* Individual timer */ +typedef struct timer +{ + unsigned char tm_id; + unsigned char tm_offset; + unsigned short tm_left; + struct timer *tm_next; + struct timer **tm_back; +} timer_t; + diff --git a/private/inc/sys/snet/udp_ctrl.h b/private/inc/sys/snet/udp_ctrl.h new file mode 100644 index 000000000..ad4c16906 --- /dev/null +++ b/private/inc/sys/snet/udp_ctrl.h @@ -0,0 +1,77 @@ +/*++ + +Copyright (c) 1991 Microsoft Corporation + +Module Name: + + udp_ctrl.h + +Abstract: + + UDP interface declarations + +Author: + + Mike Massa (mikemas) Jan 30, 1992 + +Revision History: + + Who When What + -------- -------- ---------------------------------------------- + mikemas 01-30-92 created + +Notes: + +--*/ + +/****************************************************************** + * + * SpiderTCP Interface Primitives + * + * Copyright (c) 1988 Spider Systems Limited + * + * This Source Code is furnished under Licence, and may not be + * copied or distributed without express written agreement. + * + * All rights reserved. + * + * Written by Nick Felisiak, Ian Heavens, Peter Reid, + * Gavin Shearer, Mark Valentine + * + * UDP_CONTROL.H + * + * UDP Streams ioctl primitives for TCP/IP on V.3 Streams + * + ******************************************************************/ + + +/* + * /usr/projects/spare/PBRAIN/SCCS/pbrainG/dev/src/include/sys/snet/0/s.udp_control.h + * @(#)udp_control.h 1.1 + * + * Last delta created 16:21:22 1/16/89 + * This file extracted 16:49:20 12/23/91 + * + * Modifications: + * + * 20/07/88 MV New file for netstat protocol message. + */ + +#ifndef _SYS_SNET_UDP_CTRL_INCLUDED +#define _SYS_SNET_UDP_CTRL_INCLUDED + + +struct udp_pcbinfo { + int prim_type; + int ucbcount; +}; + +typedef union udp_proto { + int type; + struct udp_pcbinfo pcbinfo; +} S_UDP_PROTO; + +#define UDP_PCBINFO 1 + +#endif // _SYS_SNET_UDP_CTRL_INCLUDED + diff --git a/private/inc/sys/snet/uint.h b/private/inc/sys/snet/uint.h new file mode 100644 index 000000000..013292254 --- /dev/null +++ b/private/inc/sys/snet/uint.h @@ -0,0 +1,63 @@ +/*++ + +Copyright (c) 1991 Microsoft Corporation + +Module Name: + + uint.h + +Abstract: + + This file contains type definitions used by STREAMS drivers. + +Author: + + Eric Chin (ericc) July 18, 1991 + +Revision History: + +--*/ + + +/****************************************************************** + * + * Copyright 1991 Spider Systems Limited + * + * UINT.H + * + ******************************************************************/ + +/* + * /usr/projects/spare/PBRAIN/SCCS/pbrainG/dev/src/include/sys/snet/0/s.uint.h + * @(#)uint.h 1.2 + * + * UINT.H + * + * Last delta created 12:22:31 3/12/91 + * This file extracted 08:53:39 7/10/91 + * +#ifdef MOD_HISTORY + * + * Modifications: + * + * JS 14 Jan 91 Added signed types. +#endif + */ + +#ifndef _SYS_SNET_UINT_ +#define _SYS_SNET_UINT_ + + +/* + * Fixed-length types + */ + +typedef unsigned char uint8; +typedef unsigned short uint16; +typedef unsigned long uint32; + +typedef char int8; +typedef short int16; +typedef long int32; + +#endif /* _SYS_SNET_UINT_ */ diff --git a/private/inc/sys/stropts.h b/private/inc/sys/stropts.h new file mode 100644 index 000000000..12ab512f3 --- /dev/null +++ b/private/inc/sys/stropts.h @@ -0,0 +1,236 @@ +/*++ + +Copyright (c) 1991 Microsoft Corporation + +Module Name: + + stropts.h + +Abstract: + + This module defines the STREAMS ioctl message interface. + +Author: + + Eric Chin (ericc) July 18, 1991 + +Revision History: + +--*/ + +/* + * Streams ioctl message interface + * + * @(#)stropts.h 1.19 (Spider) 91/11/27 + */ + +#ifndef _SYS_STROPTS_ +#define _SYS_STROPTS_ + + +/* + * Read options + */ + +#define RNORM 0x00 /* Normal - bytes stream */ +#define RMSGD 0x01 /* Message, non-discard mode */ +#define RMSGN 0x02 /* Message, discard mode */ + +#define RMASK 0x0F /* mask for read options */ + +/* + * Protocol read options + */ + +#define RPROTNORM 0x00 /* Fail reads with EBADMSG */ +#define RPROTDIS 0x10 /* Discard proto part */ +#define RPROTDAT 0x20 /* Turn proto part into data */ + +#define RPROTMASK 0xF0 /* mask for protocol read options */ + +/* + * Values for I_ATMARK argument + */ + +#define ANYMARK 0 /* check if message is marked */ +#define LASTMARK 1 /* check if last one marked */ + +/* + * Value for I_SWROPT argument + */ + +#define NOSNDZERO 0 /* disallow zero length sends */ +#define SNDZERO 1 /* permit zero length sends */ + +/* + * STREAMS ioctl defines + */ + +#define STR ('S'<<8) +#define I_NREAD (STR|1) +#define I_PUSH (STR|2) +#define I_POP (STR|3) +#define I_LOOK (STR|4) +#define I_FLUSH (STR|5) +#define I_SRDOPT (STR|6) +#define I_GRDOPT (STR|7) +#define I_STR (STR|8) +#define I_SETSIG (STR|9) +#define I_GETSIG (STR|10) +#define I_FIND (STR|11) +#define I_LINK (STR|12) +#define I_UNLINK (STR|13) +#define I_PEEK (STR|15) +#define I_FDINSERT (STR|16) +#define I_SENDFD (STR|17) +#define I_RECVFD (STR|18) +#ifdef SVR2 +#define I_GETMSG (STR|19) +#define I_PUTMSG (STR|20) +#define I_GETID (STR|21) +#define I_POLL (STR|22) +#endif /*SVR2*/ +#define I_SWROPT (STR|23) +#define I_GWROPT (STR|24) +#define I_LIST (STR|25) +#define I_ATMARK (STR|26) +#define I_SETCLTIME (STR|27) +#define I_GETCLTIME (STR|28) +#define I_PLINK (STR|29) +#define I_PUNLINK (STR|30) +#define I_DEBUG (STR|31) +#define I_CLOSE (STR|32) + + +#define MUXID_ALL -1 + + +/* + * General buffer structure (putmsg, getmsg, etc) + */ + +struct strbuf { + int maxlen; /* no. of bytes in buffer */ + int len; /* no. of bytes returned */ + char *buf; /* pointer to data */ +}; + +/* + * General ioctl + */ + +struct strioctl { + int ic_cmd; /* command */ + int ic_timout; /* timeout value */ + int ic_len; /* length of data */ + char *ic_dp; /* pointer to data */ +}; + +/* + * Structure for I_FDINSERT ioctl + */ + +struct strfdinsert { + struct strbuf ctlbuf; + struct strbuf databuf; + long flags; + HANDLE fildes; + int offset; +}; + + +/* + * Structures for I_DEBUG ioctl + */ +typedef enum _str_trace_options { + MSG_TRACE_PRINT = 0x00000001, + MSG_TRACE_FLUSH = 0x00000002, + MSG_TRACE_ON = 0x00000004, + MSG_TRACE_OFF = 0x00000008, + POOL_TRACE_PRINT = 0x00000010, + POOL_TRACE_FLUSH = 0x00000020, + POOL_TRACE_ON = 0x00000040, + POOL_TRACE_OFF = 0x00000080, + POOL_FAIL_ON = 0x00000100, + POOL_FAIL_OFF = 0x00000200, + LOCK_TRACE_ON = 0x00000400, + LOCK_TRACE_OFF = 0x00000800, + QUEUE_PRINT = 0x00001000, + BUFFER_PRINT = 0x00002000, + POOL_LOGGING_ON = 0x00004000, + POOL_LOGGING_OFF = 0x00008000 +} str_trace_options; + + +struct strdebug { + ULONG trace_cmd; +}; + + +/* + * stream I_PEEK ioctl format + */ + +struct strpeek { + struct strbuf ctlbuf; + struct strbuf databuf; + long flags; +}; + +/* + * receive file descriptor structure + */ +struct strrecvfd { +#ifdef INKERNEL + union { + struct file *fp; + int fd; + } f; +#else + int fd; +#endif + unsigned short uid; + unsigned short gid; + char fill[8]; +}; + +#define FMNAMESZ 8 + +struct str_mlist { + char l_name[FMNAMESZ+1]; +}; + +struct str_list { + int sl_nmods; + struct str_mlist *sl_modlist; +}; + +/* + * get/putmsg flags + */ + +#define RS_HIPRI 1 /* High priority message */ + +#define MORECTL 1 +#define MOREDATA 2 + + +/* + * M_SETSIG flags + */ + +#define S_INPUT 1 +#define S_HIPRI 2 +#define S_OUTPUT 4 +#define S_MSG 8 +#define S_ERROR 16 +#define S_HANGUP 32 + +/* + * Flags for MFLUSH messages + */ +#define FLUSHW 01 /* flush downstream */ +#define FLUSHR 02 /* flush upstream */ +#define FLUSHRW (FLUSHR | FLUSHW) + +#endif /* _SYS_STROPTS_ */ diff --git a/private/inc/sys/uio.h b/private/inc/sys/uio.h new file mode 100644 index 000000000..afe3d5c96 --- /dev/null +++ b/private/inc/sys/uio.h @@ -0,0 +1,84 @@ +/*++ + +Copyright (c) 1991 Microsoft Corporation + +Module Name: + + uio.h + +Abstract: + + I/O structure definitions for compatibility with BSD. + +Author: + + Mike Massa (mikemas) Jan 31, 1992 + +Revision History: + + Who When What + -------- -------- ---------------------------------------------- + mikemas 01-31-92 created + +Notes: + +--*/ + +/****************************************************************** + * + * Spider BSD Compatibility + * + * Copyright 1990 Spider Systems Limited + * + * UIO.H + * + ******************************************************************/ + +/* + * /usr/projects/tcp/SCCS.rel3/rel/src/include/bsd/sys/0/s.uio.h + * @(#)uio.h 5.3 + * + * Last delta created 14:41:47 3/4/91 + * This file extracted 11:24:29 3/8/91 + * + * Modifications: + * + * GSS 19 Jun 90 New File + */ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)uio.h 7.1 (Berkeley) 6/4/86 + */ + +#ifndef _UIO_ +#define _UIO_ + +typedef long daddr_t; +typedef char FAR * caddr_t; + +struct iovec { + caddr_t iov_base; + int iov_len; +}; + +struct uio { + struct iovec *uio_iov; + int uio_iovcnt; + int uio_offset; + int uio_segflg; + int uio_resid; +}; + +enum uio_rw { UIO_READ, UIO_WRITE }; + +/* + * Segment flag values (should be enum). + */ +#define UIO_USERSPACE 0 /* from user data space */ +#define UIO_SYSSPACE 1 /* from system space */ +#define UIO_USERISPACE 2 /* from user I space */ +#endif |