restore old (working) version
[unix-history] / usr / src / sys / netinet / in.h
CommitLineData
b11be056 1/* in.h 6.1 83/07/29 */
8958351e
BJ
2
3/*
4 * Constants and structures defined by the internet system,
5 * Per RFC 790, September 1981.
6 */
7
8/*
9 * Protocols
10 */
11#define IPPROTO_ICMP 1 /* control message protocol */
1aa87517 12#define IPPROTO_GGP 2 /* gateway^2 (deprecated) */
8958351e
BJ
13#define IPPROTO_TCP 6 /* tcp */
14#define IPPROTO_PUP 12 /* pup */
15#define IPPROTO_UDP 17 /* user datagram protocol */
3d7e280a 16#define IPPROTO_ND 77 /* UNOFFICIAL net disk proto */
8958351e 17
13ab51b7 18#define IPPROTO_RAW 255 /* raw IP packet */
eb44bfb2
BJ
19#define IPPROTO_MAX 256
20
8958351e
BJ
21/*
22 * Port/socket numbers: network standard functions
23 */
24#define IPPORT_ECHO 7
25#define IPPORT_DISCARD 9
26#define IPPORT_SYSTAT 11
27#define IPPORT_DAYTIME 13
28#define IPPORT_NETSTAT 15
29#define IPPORT_FTP 21
30#define IPPORT_TELNET 23
31#define IPPORT_SMTP 25
32#define IPPORT_TIMESERVER 37
33#define IPPORT_NAMESERVER 42
34#define IPPORT_WHOIS 43
35#define IPPORT_MTP 57
36
37/*
38 * Port/socket numbers: host specific functions
39 */
40#define IPPORT_TFTP 69
41#define IPPORT_RJE 77
42#define IPPORT_FINGER 79
43#define IPPORT_TTYLINK 87
44#define IPPORT_SUPDUP 95
45
becdab37
BJ
46/*
47 * UNIX TCP sockets
48 */
49#define IPPORT_EXECSERVER 512
50#define IPPORT_LOGINSERVER 513
51#define IPPORT_CMDSERVER 514
40f07a3b 52#define IPPORT_EFSSERVER 520
becdab37
BJ
53
54/*
55 * UNIX UDP sockets
56 */
57#define IPPORT_BIFFUDP 512
58#define IPPORT_WHOSERVER 513
40f07a3b 59#define IPPORT_ROUTESERVER 520 /* 520+1 also used */
becdab37
BJ
60
61/*
62 * Ports < IPPORT_RESERVED are reserved for
63 * privileged processes (e.g. root).
64 */
1aa87517
BJ
65#define IPPORT_RESERVED 1024
66
8958351e
BJ
67/*
68 * Link numbers
69 */
70#define IMPLINK_IP 155
71#define IMPLINK_LOWEXPER 156
72#define IMPLINK_HIGHEXPER 158
73
74/*
75 * Internet address (old style... should be updated)
76 */
2b4b57cd 77struct in_addr {
8958351e
BJ
78 union {
79 struct { u_char s_b1,s_b2,s_b3,s_b4; } S_un_b;
80 struct { u_short s_w1,s_w2; } S_un_w;
1a88ef94 81 u_long S_addr;
8958351e 82 } S_un;
1a88ef94 83#define s_addr S_un.S_addr /* can be used for most tcp & ip code */
8958351e
BJ
84#define s_host S_un.S_un_b.s_b2 /* host on imp */
85#define s_net S_un.S_un_b.s_b1 /* network */
86#define s_imp S_un.S_un_w.s_w2 /* imp */
1e25d807
BJ
87#define s_impno S_un.S_un_b.s_b4 /* imp # */
88#define s_lh S_un.S_un_b.s_b3 /* logical host */
8958351e 89};
2b4b57cd 90
ae34128e 91/*
a8d3bf7f 92 * Definitions of bits in internet address integers.
ae34128e 93 */
6e7edb25 94#define IN_CLASSA(i) ((((long)(i))&0x80000000)==0)
a8d3bf7f
BJ
95#define IN_CLASSA_NET 0xff000000
96#define IN_CLASSA_NSHIFT 24
97#define IN_CLASSA_HOST 0x00ffffff
98
6e7edb25 99#define IN_CLASSB(i) ((((long)(i))&0xc0000000)==0x80000000)
a8d3bf7f
BJ
100#define IN_CLASSB_NET 0xffff0000
101#define IN_CLASSB_NSHIFT 16
102#define IN_CLASSB_HOST 0x0000ffff
ae34128e 103
6e7edb25 104#define IN_CLASSC(i) ((((long)(i))&0xc0000000)==0xc0000000)
a8d3bf7f
BJ
105#define IN_CLASSC_NET 0xffffff00
106#define IN_CLASSC_NSHIFT 8
107#define IN_CLASSC_HOST 0x000000ff
ae34128e 108
1aa87517
BJ
109#define INADDR_ANY 0x00000000
110
2b4b57cd
BJ
111/*
112 * Socket address, internet style.
113 */
114struct sockaddr_in {
115 short sin_family;
116 u_short sin_port;
117 struct in_addr sin_addr;
118 char sin_zero[8];
119};
eb2e4af9
BJ
120
121#if !defined(vax)
122/*
123 * Macros for number representation conversion.
124 */
125#define ntohl(x) (x)
126#define ntohs(x) (x)
127#define htonl(x) (x)
128#define htons(x) (x)
129#endif
59965020
BJ
130
131#ifdef KERNEL
132extern struct domain inetdomain;
133extern struct protosw inetsw[];
134#endif