lint cleanup
[unix-history] / usr / src / sys / netinet / in.h
CommitLineData
40f07a3b 1/* in.h 4.14 82/06/30 */
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 */
16
13ab51b7 17#define IPPROTO_RAW 255 /* raw IP packet */
eb44bfb2
BJ
18#define IPPROTO_MAX 256
19
8958351e
BJ
20/*
21 * Port/socket numbers: network standard functions
22 */
23#define IPPORT_ECHO 7
24#define IPPORT_DISCARD 9
25#define IPPORT_SYSTAT 11
26#define IPPORT_DAYTIME 13
27#define IPPORT_NETSTAT 15
28#define IPPORT_FTP 21
29#define IPPORT_TELNET 23
30#define IPPORT_SMTP 25
31#define IPPORT_TIMESERVER 37
32#define IPPORT_NAMESERVER 42
33#define IPPORT_WHOIS 43
34#define IPPORT_MTP 57
35
36/*
37 * Port/socket numbers: host specific functions
38 */
39#define IPPORT_TFTP 69
40#define IPPORT_RJE 77
41#define IPPORT_FINGER 79
42#define IPPORT_TTYLINK 87
43#define IPPORT_SUPDUP 95
44
becdab37
BJ
45/*
46 * UNIX TCP sockets
47 */
48#define IPPORT_EXECSERVER 512
49#define IPPORT_LOGINSERVER 513
50#define IPPORT_CMDSERVER 514
40f07a3b 51#define IPPORT_EFSSERVER 520
becdab37
BJ
52
53/*
54 * UNIX UDP sockets
55 */
56#define IPPORT_BIFFUDP 512
57#define IPPORT_WHOSERVER 513
40f07a3b 58#define IPPORT_ROUTESERVER 520 /* 520+1 also used */
becdab37
BJ
59
60/*
61 * Ports < IPPORT_RESERVED are reserved for
62 * privileged processes (e.g. root).
63 */
1aa87517
BJ
64#define IPPORT_RESERVED 1024
65
8958351e
BJ
66/*
67 * Link numbers
68 */
69#define IMPLINK_IP 155
70#define IMPLINK_LOWEXPER 156
71#define IMPLINK_HIGHEXPER 158
72
73/*
74 * Internet address (old style... should be updated)
75 */
2b4b57cd 76struct in_addr {
8958351e
BJ
77 union {
78 struct { u_char s_b1,s_b2,s_b3,s_b4; } S_un_b;
79 struct { u_short s_w1,s_w2; } S_un_w;
1a88ef94 80 u_long S_addr;
8958351e 81 } S_un;
1a88ef94
SL
82#define s_addr S_un.S_addr /* can be used for most tcp & ip code */
83#ifdef vax
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 */
1a88ef94 89#endif
8958351e 90};
2b4b57cd 91
ae34128e
BJ
92/*
93 * Macros for dealing with Class A/B/C network
94 * numbers. High 3 bits of uppermost byte indicates
95 * how to interpret the remainder of the 32-bit
6187f8f4
SL
96 * Internet address. The macros may be used in time
97 * time critical sections of code, while subroutine
98 * versions also exist use in other places.
ae34128e 99 */
6187f8f4
SL
100#if vax || pdp11
101#define IN_CLASSA 0x00000080
ae34128e
BJ
102#define IN_CLASSA_NET 0x000000ff /* 8 bits of net # */
103#define IN_CLASSA_LNA 0xffffff00
6187f8f4 104#define IN_CLASSB 0x00000040
ae34128e
BJ
105#define IN_CLASSB_NET 0x0000ffff /* 16 bits of net # */
106#define IN_CLASSB_LNA 0xffff0000
ae34128e
BJ
107#define IN_CLASSC_NET 0x00ffffff /* 24 bits of net # */
108#define IN_CLASSC_LNA 0xff000000
109#endif
110
6187f8f4
SL
111#define IN_NETOF(in) \
112 (((in).s_addr&IN_CLASSA) == 0 ? (in).s_addr&IN_CLASSA_NET : \
113 ((in).s_addr&IN_CLASSB) == 0 ? (in).s_addr&IN_CLASSB_NET : \
114 (in).s_addr&IN_CLASSC_NET)
115#define IN_LNAOF(in) \
116 (((in).s_addr&IN_CLASSA) == 0 ? (in).s_addr&IN_CLASSA_LNA : \
117 ((in).s_addr&IN_CLASSB) == 0 ? (in).s_addr&IN_CLASSB_LNA : \
118 (in).s_addr&IN_CLASSC_LNA)
ae34128e 119
1aa87517
BJ
120#define INADDR_ANY 0x00000000
121
2b4b57cd
BJ
122/*
123 * Socket address, internet style.
124 */
125struct sockaddr_in {
126 short sin_family;
127 u_short sin_port;
128 struct in_addr sin_addr;
129 char sin_zero[8];
130};