From 2c200d6ce44afbf22c3de59fcd27422df3e031a8 Mon Sep 17 00:00:00 2001 From: Coles Date: Tue, 3 Nov 2020 11:28:12 +0000 Subject: [PATCH] Add missing modules --- modules/net/in.e | 97 +++++++++++++++++++ modules/net/in.m | Bin 0 -> 1396 bytes modules/net/netdb.e | 97 +++++++++++++++++++ modules/net/netdb.m | Bin 0 -> 550 bytes modules/net/socket.e | 224 +++++++++++++++++++++++++++++++++++++++++++ modules/net/socket.m | Bin 0 -> 1664 bytes modules/socket.m | Bin 0 -> 609 bytes modules/xpr_lib.m | Bin 0 -> 128 bytes 8 files changed, 418 insertions(+) create mode 100644 modules/net/in.e create mode 100644 modules/net/in.m create mode 100644 modules/net/netdb.e create mode 100644 modules/net/netdb.m create mode 100644 modules/net/socket.e create mode 100644 modules/net/socket.m create mode 100644 modules/socket.m create mode 100644 modules/xpr_lib.m diff --git a/modules/net/in.e b/modules/net/in.e new file mode 100644 index 0000000..a2db1c1 --- /dev/null +++ b/modules/net/in.e @@ -0,0 +1,97 @@ + +OPT MODULE +OPT EXPORT + +CONST IPPROTO_IP=0 /* dummy for IP */ +CONST IPPROTO_ICMP=1 /* control message protocol */ +CONST IPPROTO_GGP=3 /* gateway^2 (deprecated) */ +CONST IPPROTO_TCP=6 /* tcp */ +CONST IPPROTO_EGP=8 /* exterior gateway protocol */ +CONST IPPROTO_PUP=12 /* pup */ +CONST IPPROTO_UDP=17 /* user datagram protocol */ +CONST IPPROTO_IDP=22 /* xns idp */ +CONST IPPROTO_TP=29 /* tp-4 w/ class negotiation */ +CONST IPPROTO_EON=80 /* ISO cnlp */ + +CONST IPPROTO_RAW=255 /* raw IP packet */ +CONST IPPROTO_MAX=256 + + +CONST IPPORT_RESERVED=1024 +CONST IPPORT_USERRESERVED=5000 + +/*OBJECT in_addr + s_addr:LONG +ENDOBJECT*/ + +->CONST IN_CLASSA(i) (((long)(i) & 0x80000000) == 0) +PROC in_classa(i) IS IF (i AND $80000000) THEN FALSE ELSE TRUE +CONST IN_CLASSA_NET=$ff000000 +CONST IN_CLASSA_NSHIFT=4 +CONST IN_CLASSA_HOST=$00ffffff +CONST IN_CLASSA_MAX=128 + +->CONST IN_CLASSB(i) (((long)(i) & 0xc0000000) == 0x80000000) +PROC in_classb(i) IS IF (i AND $c0000000)=$80000000 THEN TRUE ELSE FALSE +CONST IN_CLASSB_NET=$ffff0000 +CONST IN_CLASSB_NSHIFT=16 +CONST IN_CLASSB_HOST=$0000ffff +CONST IN_CLASSB_MAX=65536 + +->CONST IN_CLASSC(i) (((long)(i) & 0xe0000000) == 0xc0000000) +PROC in_classc(i) IS IF (i AND $e0000000)=$c0000000 THEN TRUE ELSE FALSE +CONST IN_CLASSC_NET=$ffffff00 +CONST IN_CLASSC_NSHIFT=8 +CONST IN_CLASSC_HOST=$000000ff + +->CONST IN_CLASSD(i) (((long)(i) & 0xf0000000) == 0xe0000000) +PROC in_classd(i) IS IF (i AND $f0000000)=$e0000000 THEN TRUE ELSE FALSE +->CONST IN_MULTICAST(i) IN_CLASSD(i) +PROC in_multicast(i) IS in_classd(i) + +->CONST IN_EXPERIMENTAL(i) (((long)(i) & 0xe0000000) == 0xe0000000) +PROC in_experimental(i) IS IF (i AND $e0000000)=$e0000000 THEN TRUE ELSE FALSE +->CONST IN_BADCLASS(i) (((long)(i) & 0xf0000000) == 0xf0000000) +PROC in_badclass(i) IS IF (i AND $f0000000)=$f0000000 THEN TRUE ELSE FALSE + +CONST INADDR_ANY=0 +CONST INADDR_BROADCAST=$ffffffff /* must be masked */ +CONST INADDR_NONE=$ffffffff /* -1 return */ +CONST IN_LOOPBACKNET=127 /* official! */ + +/* + * Socket address, internet style. + */ +OBJECT sockaddr_in + sin_len:CHAR + sin_family:CHAR + sin_port:INT + sin_addr:LONG + sin_zero[8]:ARRAY OF CHAR +ENDOBJECT + +/* + * Structure used to describe IP options. + * Used to store options internally, to pass them to a process, + * or to restore options retrieved earlier. + * The ip_dst is used for the first-hop gateway when using a source route + * (this gets put into the header proper). + */ +OBJECT ip_opts + ip_dst:LONG; /* first hop, 0 w/o src rt */ + ip_opts[40]:ARRAY OF CHAR; /* actually variable in size */ +ENDOBJECT + +/* + * Options for use with [gs]etsockopt at the IP level. + * First word of comment is data type; bool is stored in int. + */ +CONST IP_OPTIONS=1 /* buf/ip_opts; set/get IP per-packet options */ +CONST IP_HDRINCL=2 /* int; header is included with data (raw) */ +CONST IP_TOS=3 /* int; IP type of service and precedence */ +CONST IP_TTL=4 /* int; IP time to live */ +CONST IP_RECVOPTS=5 /* bool; receive all IP options w/datagram */ +CONST IP_RECVRETOPTS=6 /* bool; receive IP options for response */ +CONST IP_RECVDSTADDR=7 /* bool; receive IP dst addr w/datagram */ +CONST IP_RETOPTS=8 /* ip_opts; set/get IP per-packet options */ + diff --git a/modules/net/in.m b/modules/net/in.m new file mode 100644 index 0000000000000000000000000000000000000000..95189b3123c2e935d9f88e3d6b8432a5a0153ecd GIT binary patch literal 1396 zcmZ{iO>Wab7>2*PE`%tGLP6}1asUu}c8+ZtL*lV)r@#UYZjypUeyk*wfDKu);1C>u zLv+CjShMI2;0EUX#-2Dq$wZ!bp7;HJ#xrhTICMhg2-@Y#9rb^V`Kdo3YCoo$v0h{O zeEp87meE@xGt2!q{#B)4LvJY8C3|w^piAvN&Ez~=Epal~DX&Il z%^E!BM&%tp!o!g`PL5p8haZyBXd%-XN5ip1>B$%?IJhFOFOz9H`NW9oh&GsI^F^_* zI%=9sI8W(8E+(JHi#Z6_Z598%b;Q6abC4#Uu45po>x7N0#cPhwFpKV z){!McV(qgE#{C4kA6NKAKex-CohY^(CxnN64ebjC_*hJiH96B~g8UpIE&nz2Q#>_Y z(UyMH^`7zWn71@XciY_5935(oyU6=inSJ5A#c89ujDu>yQEzFeQ+a+ KdmP*73F9BY=Op_8 literal 0 HcmV?d00001 diff --git a/modules/net/netdb.e b/modules/net/netdb.e new file mode 100644 index 0000000..5b04797 --- /dev/null +++ b/modules/net/netdb.e @@ -0,0 +1,97 @@ +OPT MODULE +OPT EXPORT + +->MODULE 'socket' +->MODULE 'usergroup' + +/*CONST _PATH_DB="AmiTCP:db" +CONST _PATH_AMITCP_CONFIG="AmiTCP:db/AmiTCP.config" +CONST _PATH_HEQUIV="AmiTCP:db/hosts.equiv" +CONST _PATH_INETDCONF="AmiTCP:db/inetd.conf" */ +CONST HOST_NOT_FOUND=1 /* Authoritative Answer Host not found */ +CONST TRY_AGAIN=2 /* Non-Authoritive Host not found, or SERVERFAIL */ +CONST NO_RECOVERY=3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */ +CONST NO_DATA=4 /* Valid name, no data record of requested type */ +CONST NO_ADDRESS=NO_DATA /* no address, look for MX record */ + +/* + * Structures returned by network data base library. All addresses are + * supplied in host order, and returned in network order (suitable for + * use in system calls). + */ + +EXPORT OBJECT namearray + names[15]:ARRAY OF LONG +ENDOBJECT + +EXPORT OBJECT hostent + h_name:LONG + h_aliases:LONG + h_addrtype:LONG + h_length:LONG + h_addr_list:LONG +ENDOBJECT + + +/* +struct hostent { + char *h_name; /* official name of host */ + char **h_aliases; /* alias list */ + int h_addrtype; /* host address type */ + int h_length; /* length of address */ + char **h_addr_list; /* list of addresses from name server */ +#define h_addr h_addr_list[0] /* address, for backward compatiblity */ +}; +*/ + +/* + * Assumption here is that a network number + * fits in 32 bits -- probably a poor one. + */ + +EXPORT OBJECT netent + n_name:LONG + n_aliases:LONG + n_addrtype:INT + n_net:LONG +ENDOBJECT + +/* +struct netent { + char *n_name; /* official name of net */ + char **n_aliases; /* alias list */ + int n_addrtype; /* net address type */ + unsigned long n_net; /* network # */ +}; +*/ + +EXPORT OBJECT servent + s_name:LONG + s_aliases:LONG + s_port:INT + s_proto:LONG +ENDOBJECT + +/* +struct servent { + char *s_name; /* official service name */ + char **s_aliases; /* alias list */ + int s_port; /* port # */ + char *s_proto; /* protocol to use */ +}; +*/ + +OBJECT protoent + p_name:LONG + p_aliases:LONG + p_proto:INT +ENDOBJECT + +/* +struct protoent { + char *p_name; /* official protocol name */ + char **p_aliases; /* alias list */ + int p_proto; /* protocol # */ +}; +*/ + diff --git a/modules/net/netdb.m b/modules/net/netdb.m new file mode 100644 index 0000000000000000000000000000000000000000..92c6ff7d11403dafb82ab530c6cc6745145bd490 GIT binary patch literal 550 zcmZXR-D-p|5QWFBT|}hpMIWa(Qti)0O;KCe-UMMoU9eFSDeUX?MYm^0TdWO)AH+F;{Q3$PV^I_yw3>^-->5h#zo~?*B6b)Kp zd=ty7|8R%w=%c~wElAJpYur}yb&L9~MxJgBPH Zg{t+PdMPqE9Craqncu3{yxc<)eFM<~V|D-l literal 0 HcmV?d00001 diff --git a/modules/net/socket.e b/modules/net/socket.e new file mode 100644 index 0000000..6dbee6e --- /dev/null +++ b/modules/net/socket.e @@ -0,0 +1,224 @@ +OPT MODULE +OPT EXPORT + +MODULE 'exec/types' +MODULE 'socket' + +CONST FD_ACCEPT=$001 /* there is a connection to accept() */ +CONST FD_CONNECT=$002 /* connect() completed */ +CONST FD_OOB=$004 /* socket has out-of-band data */ +CONST FD_READ=$008 /* socket is readable */ +CONST FD_WRITE=$010 /* socket is writeable */ +CONST FD_ERROR=$020 /* asynchronous error on socket */ +CONST FD_CLOSE=$040 /* connection closed (graceful or not) */ + +CONST UNIQUE_ID=-1 + +CONST SOCK_STREAM=1 /* stream socket */ +CONST SOCK_DGRAM=2 /* datagram socket */ +CONST SOCK_RAW=3 /* raw-protocol interface */ +CONST SOCK_RDM=4 /* reliably-delivered message */ +CONST SOCK_SEQPACKET=5 /* sequenced packet stream */ + +CONST SO_DEBUG=$0001 /* turn on debugging info recording */ +CONST SO_ACCEPTCONN=$0002 /* socket has had listen() */ +CONST SO_REUSEADDR=$0004 /* allow local address reuse */ +CONST SO_KEEPALIVE=$0008 /* keep connections alive */ +CONST SO_DONTROUTE=$0010 /* just use interface addresses */ +CONST SO_BROADCAST=$0020 /* permit sending of broadcast msgs */ +CONST SO_USELOOPBACK=$0040 /* bypass hardware when possible */ +CONST SO_LINGER=$0080 /* linger on close if data present */ +CONST SO_OOBINLINE=$0100 /* leave received OOB data in line */ + +CONST SO_SNDBUF=$1001 /* send buffer size */ +CONST SO_RCVBUF=$1002 /* receive buffer size */ +CONST SO_SNDLOWAT=$1003 /* send low-water mark */ +CONST SO_RCVLOWAT=$1004 /* receive low-water mark */ +CONST SO_SNDTIMEO=$1005 /* send timeout */ +CONST SO_RCVTIMEO=$1006 /* receive timeout */ +CONST SO_ERROR=$1007 /* get error status and clear */ +CONST SO_TYPE=$1008 /* get socket type */ + +CONST SO_EVENTMASK=$2001 /* socket event mask, */ + +/* + * Structure used for manipulating linger option. + */ +OBJECT linger /* option on/off */ + l_onoff:INT /* linger time */ + l_linger:INT +ENDOBJECT + +/* + * Level number for (get/set)sockopt() to apply to socket itself. + */ +CONST SOL_SOCKET=$ffff /* options for socket level */ + +/* + * Address families. + */ +CONST AF_UNSPEC=0 /* unspecified */ +CONST AF_UNIX=1 /* local to host (pipes, portals) */ +CONST AF_INET=2 /* internetwork: UDP, TCP, etc. */ +CONST AF_IMPLINK=3 /* arpanet imp addresses */ +CONST AF_PUP=4 /* pup protocols: e.g. BSP */ +CONST AF_CHAOS=5 /* mit CHAOS protocols */ +CONST AF_NS=6 /* XEROX NS protocols */ +CONST AF_ISO=7 /* ISO protocols */ +CONST AF_OSI=AF_ISO +CONST AF_ECMA=8 /* european computer manufacturers */ +CONST AF_DATAKIT=9 /* datakit protocols */ +CONST AF_CCITT=10 /* CCITT protocols, X.25 etc */ +CONST AF_SNA=11 /* IBM SNA */ +CONST AF_DECnet=12 /* DECnet */ +CONST AF_DLI=13 /* DEC Direct data link interface */ +CONST AF_LAT=14 /* LAT */ +CONST AF_HYLINK=15 /* NSC Hyperchannel */ +CONST AF_APPLETALK=16 /* Apple Talk */ +CONST AF_ROUTE=17 /* Internal Routing Protocol */ +CONST AF_LINK=18 /* Link layer interface */ +CONST PSEUDO_AF_XTP=19 /* eXpress Transfer Protocol (no AF) */ +CONST AF_MAX=20 + +/* + * Structure used by kernel to store most + * addresses. + */ + +OBJECT sockaddr + sa_len:CHAR /* total length */ + sa_family:CHAR /* address family */ + sa_data[14]:ARRAY OF CHAR; /* actually longer; address value */ +ENDOBJECT + +/* + * Structure used by kernel to pass protocol + * information in raw sockets. + */ +OBJECT sockproto + sp_family:INT /* address family */ + sp_protocol:INT /* protocol */ +ENDOBJECT + +/* + * Protocol families, same as address families for now. + */ +CONST PF_UNSPEC=AF_UNSPEC +CONST PF_UNIX=AF_UNIX +CONST PF_INET=AF_INET +CONST PF_IMPLINK=AF_IMPLINK +CONST PF_PUP=AF_PUP +CONST PF_CHAOS=AF_CHAOS +CONST PF_NS=AF_NS +CONST PF_ISO=AF_ISO +CONST PF_OSI=AF_ISO +CONST PF_ECMA=AF_ECMA +CONST PF_DATAKIT=AF_DATAKIT +CONST PF_CCITT=AF_CCITT +CONST PF_SNA=AF_SNA +CONST PF_DECnet=AF_DECnet +CONST PF_DLI=AF_DLI +CONST PF_LAT=AF_LAT +CONST PF_HYLINK=AF_HYLINK +CONST PF_APPLETALK=AF_APPLETALK +CONST PF_ROUTE=AF_ROUTE +CONST PF_LINK=AF_LINK +CONST PF_XTP=PSEUDO_AF_XTP /* really just proto family, no AF */ + +CONST PF_MAX=AF_MAX + +/* + * Maximum queue length specifiable by listen. + */ +CONST SOMAXCONN=5 + +/* + * Message header for recvmsg and sendmsg calls. + * Used value-result for recvmsg, value only for sendmsg. + */ +OBJECT iovec + iov_base:LONG + iov_len:INT +ENDOBJECT +/* +OBJECT msghdr + msg_name:LONG /* optional address */ + msg_namelen:INT /* size of address */ + struct iovec *msg_iov; /* scatter/gather array */ + u_int msg_iovlen; /* # elements in msg_iov */ + caddr_t msg_control; /* ancillary data, see below */ + u_int msg_controllen; /* ancillary data buffer len */ + int msg_flags; /* flags on received message */ +}; +*/ +CONST MSG_OOB=$1 /* process out-of-band data */ +CONST MSG_PEEK=$2 /* peek at incoming message */ +CONST MSG_DONTROUTE=$4 /* send without using routing tables */ +CONST MSG_EOR=$8 /* data completes record */ +CONST MSG_TRUNC=$10 /* data discarded before delivery */ +CONST MSG_CTRUNC=$20 /* control data lost before delivery */ +CONST MSG_WAITALL=$40 /* wait for full request or error */ + +/* +/* + * Header for ancillary data objects in msg_control buffer. + * Used for additional information with/about a datagram + * not expressible by flags. The format is a sequence + * of message elements headed by cmsghdr structures. + */ +struct cmsghdr { + u_int cmsg_len; /* data byte count, including hdr */ + int cmsg_level; /* originating protocol */ + int cmsg_type; /* protocol-specific type */ +/* followed by u_char cmsg_data[]; */ +}; + +/* given pointer to struct adatahdr, return pointer to data */ +CONST CMSG_DATA(cmsg) ((u_char *)((cmsg) + 1)) + +/* given pointer to struct adatahdr, return pointer to next adatahdr */ +CONST CMSG_NXTHDR(mhdr, cmsg) \ + (((caddr_t)(cmsg) + (cmsg)->cmsg_len + sizeof(struct cmsghdr) > \ + (mhdr)->msg_control + (mhdr)->msg_controllen) ? \ + (struct cmsghdr *)NULL : \ + (struct cmsghdr *)((caddr_t)(cmsg) + ALIGN((cmsg)->cmsg_len))) + +CONST CMSG_FIRSTHDR(mhdr) ((struct cmsghdr *)(mhdr)->msg_control) + +/* "Socket"-level control message types: */ +CONST SCM_RIGHTS $01 /* access rights (array of int) */ + +/* + * 4.3 compat sockaddr, move to compat file later + */ +struct osockaddr { + u_short sa_family; /* address family */ + char sa_data[14]; /* up to 14 bytes of direct address */ +}; + +/* + * 4.3-compat message header (move to compat file later). + */ +struct omsghdr { + caddr_t msg_name; /* optional address */ + int msg_namelen; /* size of address */ + struct iovec *msg_iov; /* scatter/gather array */ + int msg_iovlen; /* # elements in msg_iov */ + caddr_t msg_accrights; /* access rights sent/received */ + int msg_accrightslen; +}; + +#ifndef KERNEL + +/* + * Include socket protos/inlines/pragmas + */ +#ifndef BSDSOCKET_H +#include +#endif + +#endif /* !KERNEL */ + +#endif /* !SYS_SOCKET_H */ + +*/ \ No newline at end of file diff --git a/modules/net/socket.m b/modules/net/socket.m new file mode 100644 index 0000000000000000000000000000000000000000..7286546a0d00e937af085616d02a29a1eb179fd3 GIT binary patch literal 1664 zcmZWp(Q?`_5EKp&hmh1w`vH7Pgsl({w&hqhBu^fikWQu)GJ)w#-}>itSF!_Xc|m)( zx3@Y;R;i9ePc*-L)GW^Izb8aTi2i;r#LMQ_@==I^=-PGtZLwWijxRjXMYdio*RHsa zKUCs3VC8o6_~Z3$v)iy5@$GB> z1KUj~DfXs?7`AvOa=2%@?WKtlP zMk-t{cP>9f^$`wuqtMNsDAhgi<4nPeMPNI`{SJ@|!?;A!_8K62jIkHaCrXiL^(pw; z#4Q5bA$d-KxcETap+DotIW91~jq7Mdul||^{ z5N>TpfQxTRoS}gGrqdDcSXdTS24hw+V5A99C9=a3`h`zyw-hO?{j$o%d)V(1+?sLhpyl zCeN`4TX(Hiz2#19wb-kw2ibkYw5UjRI(m)9J1*wkV<6xh&-daGgG*yHPI-JUN;0Wf zX`s(7VLqt5X-w*4YpseyNCQQ=QAcp!h-4@Px}iCyJlZ>2n%&)=5Atpz;p`UvBs~l+ zoRVO!q0qmb#}W-+hqI+Y!iR6f%c%k*CU*ZE#J(YZct%BKb{D% bYNkWUjNfgqTKAW@mP2rP1x+^n5kmX|3MRmQ literal 0 HcmV?d00001 diff --git a/modules/xpr_lib.m b/modules/xpr_lib.m new file mode 100644 index 0000000000000000000000000000000000000000..c7f7af8c37ea69dcdcaf41ce0501a5fb3f25ed75 GIT binary patch literal 128 zcmZ?u^><-lW2h)7$}h=J&d*6oEKX&JfbpDjQWNt^3pn5c!Ko#v+`JToWKe2yYGzp~ dLck-xxWqR^}no0|3EdEoT4# literal 0 HcmV?d00001