Skip to content

Commit

Permalink
Add missing modules
Browse files Browse the repository at this point in the history
  • Loading branch information
Coles authored and Coles committed Nov 3, 2020
1 parent 74237df commit 2c200d6
Show file tree
Hide file tree
Showing 8 changed files with 418 additions and 0 deletions.
97 changes: 97 additions & 0 deletions modules/net/in.e
Original file line number Diff line number Diff line change
@@ -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 */

Binary file added modules/net/in.m
Binary file not shown.
97 changes: 97 additions & 0 deletions modules/net/netdb.e
Original file line number Diff line number Diff line change
@@ -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 # */
};
*/

Binary file added modules/net/netdb.m
Binary file not shown.
Loading

0 comments on commit 2c200d6

Please sign in to comment.