]> git.lizzy.rs Git - plan9front.git/blob - sys/src/cmd/ip/dhcp.h
audiohda: fix syntax error
[plan9front.git] / sys / src / cmd / ip / dhcp.h
1 /* Dynamic Host Configuration Protocol / BOOTP */
2 enum
3 {
4         OfferTimeout=   60,             /* when an offer times out */
5         MaxLease=       60*60,          /* longest lease for dynamic binding */
6         MinLease=       15*60,          /* shortest lease for dynamic binding */
7         StaticLease=    30*60,          /* lease for static binding */
8
9         IPUDPHDRSIZE=   28,             /* size of an IP plus UDP header */
10         MINSUPPORTED=   576,            /* biggest IP message the client must support */
11
12         /* lengths of some bootp fields */
13         Maxhwlen=       16,
14         Maxfilelen=     128,
15         Maxoptlen=      312-4,
16
17         /* bootp types */
18         Bootrequest=    1,
19         Bootreply=      2,
20
21         /* bootp flags */
22         Fbroadcast=     1<<15,
23
24         /* dhcp v4 types */
25         Discover=       1,
26         Offer=          2,
27         Request=        3,
28         Decline=        4,
29         Ack=            5,
30         Nak=            6,
31         Release=        7,
32         Inform=         8,
33
34         /* bootp option types */
35         OBend=                  255,
36         OBpad=                  0,
37         OBmask=                 1,
38         OBtimeoff=              2,
39         OBrouter=               3,
40         OBtimeserver=           4,
41         OBnameserver=           5,
42         OBdnserver=             6,
43         OBlogserver=            7,
44         OBcookieserver=         8,
45         OBlprserver=            9,
46         OBimpressserver=        10,
47         OBrlserver=             11,
48         OBhostname=             12,     /* 0x0c */
49         OBbflen=                13,
50         OBdumpfile=             14,
51         OBdomainname=           15,
52         OBrootserver=           16,     /* 0x10 */
53         OBrootpath=             17,
54         OBextpath=              18,
55         OBipforward=            19,
56         OBnonlocal=             20,
57         OBpolicyfilter=         21,
58         OBmaxdatagram=          22,
59         OBttl=                  23,
60         OBpathtimeout=          24,
61         OBpathplateau=          25,
62         OBmtu=                  26,
63         OBsubnetslocal=         27,
64         OBbaddr=                28,
65         OBdiscovermask=         29,
66         OBsupplymask=           30,
67         OBdiscoverrouter=       31,
68         OBrsserver=             32,     /* 0x20 */
69         OBstaticroutes=         33,
70         OBtrailerencap=         34,
71         OBarptimeout=           35,
72         OBetherencap=           36,
73         OBtcpttl=               37,
74         OBtcpka=                38,
75         OBtcpkag=               39,
76         OBnisdomain=            40,
77         OBniserver=             41,
78         OBntpserver=            42,
79         OBvendorinfo=           43,     /* 0x2b */
80         OBnetbiosns=            44,
81         OBnetbiosdds=           45,
82         OBnetbiostype=          46,
83         OBnetbiosscope=         47,
84         OBxfontserver=          48,     /* 0x30 */
85         OBxdispmanager=         49,
86         OBnisplusdomain=        64,     /* 0x40 */
87         OBnisplusserver=        65,
88         OBhomeagent=            68,
89         OBsmtpserver=           69,
90         OBpop3server=           70,
91         OBnntpserver=           71,
92         OBwwwserver=            72,
93         OBfingerserver=         73,
94         OBircserver=            74,
95         OBstserver=             75,
96         OBstdaserver=           76,
97
98         /* dhcp v4 options */
99         ODipaddr=               50,     /* 0x32 */
100         ODlease=                51,
101         ODoverload=             52,
102         ODtype=                 53,     /* 0x35 */
103         ODserverid=             54,     /* 0x36 */
104         ODparams=               55,     /* 0x37 */
105         ODmessage=              56,
106         ODmaxmsg=               57,
107         ODrenewaltime=          58,
108         ODrebindingtime=        59,
109         ODvendorclass=          60,
110         ODclientid=             61,     /* 0x3d */
111         ODtftpserver=           66,
112         ODbootfile=             67,
113
114         ODdnsdomain=            119,
115         ODclasslessroutes=      121,
116
117         /* plan9 vendor info options, v4 addresses only (deprecated) */
118         OP9fsv4=                128,    /* plan9 file servers */
119         OP9authv4=              129,    /* plan9 auth servers */
120
121         /* plan9 vendor info options, textual addresses, thus v4 or v6 */
122         OP9fs=                  130,    /* plan9 file servers */
123         OP9auth=                131,    /* plan9 auth servers */
124         OP9ipaddr=              132,    /* client's address */
125         OP9ipmask=              133,    /* client's subnet mask */
126         OP9ipgw=                134,    /* client's gateway */
127 /*      OP9dns=                 135,    /* dns servers */
128 };
129
130 /* a lease that never expires */
131 #define Lforever        ~0UL
132
133 /* dhcp states */
134 enum {
135         Sinit,
136         Sselecting,
137         Srequesting,
138         Sbound,
139         Srenewing,
140         Srebinding,
141 };
142
143 typedef struct Bootp    Bootp;
144 struct Bootp
145 {
146         /* Udphdr (included because of structure alignment on the alpha) */
147         uchar   udphdr[Udphdrsize];
148
149         uchar   op;                     /* opcode */
150         uchar   htype;                  /* hardware type */
151         uchar   hlen;                   /* hardware address len */
152         uchar   hops;                   /* hops */
153         uchar   xid[4];                 /* a random number */
154         uchar   secs[2];                /* elapsed since client started booting */
155         uchar   flags[2];
156         uchar   ciaddr[IPv4addrlen];    /* client IP address (client tells server) */
157         uchar   yiaddr[IPv4addrlen];    /* client IP address (server tells client) */
158         uchar   siaddr[IPv4addrlen];    /* server IP address */
159         uchar   giaddr[IPv4addrlen];    /* gateway IP address */
160         uchar   chaddr[Maxhwlen];       /* client hardware address */
161         char    sname[64];              /* server host name (optional) */
162         char    file[Maxfilelen];       /* boot file name */
163         uchar   optmagic[4];
164         uchar   optdata[Maxoptlen];
165 };