restore old (working) version
[unix-history] / usr / src / sys / netinet / in.h
... / ...
CommitLineData
1/* in.h 6.1 83/07/29 */
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 */
12#define IPPROTO_GGP 2 /* gateway^2 (deprecated) */
13#define IPPROTO_TCP 6 /* tcp */
14#define IPPROTO_PUP 12 /* pup */
15#define IPPROTO_UDP 17 /* user datagram protocol */
16#define IPPROTO_ND 77 /* UNOFFICIAL net disk proto */
17
18#define IPPROTO_RAW 255 /* raw IP packet */
19#define IPPROTO_MAX 256
20
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
46/*
47 * UNIX TCP sockets
48 */
49#define IPPORT_EXECSERVER 512
50#define IPPORT_LOGINSERVER 513
51#define IPPORT_CMDSERVER 514
52#define IPPORT_EFSSERVER 520
53
54/*
55 * UNIX UDP sockets
56 */
57#define IPPORT_BIFFUDP 512
58#define IPPORT_WHOSERVER 513
59#define IPPORT_ROUTESERVER 520 /* 520+1 also used */
60
61/*
62 * Ports < IPPORT_RESERVED are reserved for
63 * privileged processes (e.g. root).
64 */
65#define IPPORT_RESERVED 1024
66
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 */
77struct in_addr {
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;
81 u_long S_addr;
82 } S_un;
83#define s_addr S_un.S_addr /* can be used for most tcp & ip code */
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 */
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 */
89};
90
91/*
92 * Definitions of bits in internet address integers.
93 */
94#define IN_CLASSA(i) ((((long)(i))&0x80000000)==0)
95#define IN_CLASSA_NET 0xff000000
96#define IN_CLASSA_NSHIFT 24
97#define IN_CLASSA_HOST 0x00ffffff
98
99#define IN_CLASSB(i) ((((long)(i))&0xc0000000)==0x80000000)
100#define IN_CLASSB_NET 0xffff0000
101#define IN_CLASSB_NSHIFT 16
102#define IN_CLASSB_HOST 0x0000ffff
103
104#define IN_CLASSC(i) ((((long)(i))&0xc0000000)==0xc0000000)
105#define IN_CLASSC_NET 0xffffff00
106#define IN_CLASSC_NSHIFT 8
107#define IN_CLASSC_HOST 0x000000ff
108
109#define INADDR_ANY 0x00000000
110
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};
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
130
131#ifdef KERNEL
132extern struct domain inetdomain;
133extern struct protosw inetsw[];
134#endif