LK_NOPAUSE no longer serves a purpose, scrap it.
[dragonfly.git] / libexec / bootpd / bootp.h
1 /************************************************************************
2           Copyright 1988, 1991 by Carnegie Mellon University
3
4                           All Rights Reserved
5
6 Permission to use, copy, modify, and distribute this software and its
7 documentation for any purpose and without fee is hereby granted, provided
8 that the above copyright notice appear in all copies and that both that
9 copyright notice and this permission notice appear in supporting
10 documentation, and that the name of Carnegie Mellon University not be used
11 in advertising or publicity pertaining to distribution of the software
12 without specific, written prior permission.
13
14 CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
15 SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
16 IN NO EVENT SHALL CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
17 DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
18 PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
19 ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
20 SOFTWARE.
21 ************************************************************************/
22
23 /*
24  * Bootstrap Protocol (BOOTP).  RFC951 and RFC1395.
25  *
26  * $FreeBSD: src/libexec/bootpd/bootp.h,v 1.5.2.1 2001/10/14 21:20:12 iedowse Exp $
27  * $DragonFly: src/libexec/bootpd/bootp.h,v 1.2 2003/06/17 04:27:07 dillon Exp $
28  *
29  *
30  * This file specifies the "implementation-independent" BOOTP protocol
31  * information which is common to both client and server.
32  *
33  */
34
35 #include "bptypes.h"    /* for int32, u_int32 */
36
37 #define BP_CHADDR_LEN    16
38 #define BP_SNAME_LEN     64
39 #define BP_FILE_LEN     128
40 #define BP_VEND_LEN      64
41 #define BP_MINPKTSZ     300     /* to check sizeof(struct bootp) */
42 /* Overhead to fit a bootp message into an Ethernet packet. */
43 #define BP_MSG_OVERHEAD (14 + 20 + 8)   /* Ethernet + IP + UDP headers */
44
45 struct bootp {
46     unsigned char    bp_op;                     /* packet opcode type */
47     unsigned char    bp_htype;                  /* hardware addr type */
48     unsigned char    bp_hlen;                   /* hardware addr length */
49     unsigned char    bp_hops;                   /* gateway hops */
50     u_int32          bp_xid;                    /* transaction ID */
51     unsigned short   bp_secs;                   /* seconds since boot began */
52     unsigned short   bp_flags;                  /* RFC1532 broadcast, etc. */
53     struct in_addr   bp_ciaddr;                 /* client IP address */
54     struct in_addr   bp_yiaddr;                 /* 'your' IP address */
55     struct in_addr   bp_siaddr;                 /* server IP address */
56     struct in_addr   bp_giaddr;                 /* gateway IP address */
57     unsigned char    bp_chaddr[BP_CHADDR_LEN];  /* client hardware address */
58     char             bp_sname[BP_SNAME_LEN];    /* server host name */
59     char             bp_file[BP_FILE_LEN];      /* boot file name */
60     unsigned char    bp_vend[BP_VEND_LEN];      /* vendor-specific area */
61     /* note that bp_vend can be longer, extending to end of packet. */
62 };
63
64 /*
65  * UDP port numbers, server and client.
66  */
67 #define IPPORT_BOOTPS           67
68 #define IPPORT_BOOTPC           68
69
70 #define BOOTREPLY               2
71 #define BOOTREQUEST             1
72
73 /*
74  * Hardware types from Assigned Numbers RFC.
75  */
76 #define HTYPE_ETHERNET            1
77 #define HTYPE_EXP_ETHERNET        2
78 #define HTYPE_AX25                3
79 #define HTYPE_PRONET              4
80 #define HTYPE_CHAOS               5
81 #define HTYPE_IEEE802             6
82 #define HTYPE_ARCNET              7
83
84 /*
85  * Vendor magic cookie (v_magic) for CMU
86  */
87 #define VM_CMU          "CMU"
88
89 /*
90  * Vendor magic cookie (v_magic) for RFC1048
91  */
92 #define VM_RFC1048      { 99, 130, 83, 99 }
93
94 \f
95
96 /*
97  * Tag values used to specify what information is being supplied in
98  * the vendor (options) data area of the packet.
99  */
100 /* RFC 1048 */
101 #define TAG_END                 ((unsigned char) 255)
102 #define TAG_PAD                 ((unsigned char)   0)
103 #define TAG_SUBNET_MASK         ((unsigned char)   1)
104 #define TAG_TIME_OFFSET         ((unsigned char)   2)
105 #define TAG_GATEWAY             ((unsigned char)   3)
106 #define TAG_TIME_SERVER         ((unsigned char)   4)
107 #define TAG_NAME_SERVER         ((unsigned char)   5)
108 #define TAG_DOMAIN_SERVER       ((unsigned char)   6)
109 #define TAG_LOG_SERVER          ((unsigned char)   7)
110 #define TAG_COOKIE_SERVER       ((unsigned char)   8)
111 #define TAG_LPR_SERVER          ((unsigned char)   9)
112 #define TAG_IMPRESS_SERVER      ((unsigned char)  10)
113 #define TAG_RLP_SERVER          ((unsigned char)  11)
114 #define TAG_HOST_NAME           ((unsigned char)  12)
115 #define TAG_BOOT_SIZE           ((unsigned char)  13)
116 /* RFC 1395 */
117 #define TAG_DUMP_FILE           ((unsigned char)  14)
118 #define TAG_DOMAIN_NAME         ((unsigned char)  15)
119 #define TAG_SWAP_SERVER         ((unsigned char)  16)
120 #define TAG_ROOT_PATH           ((unsigned char)  17)
121 /* RFC 1497 */
122 #define TAG_EXTEN_FILE          ((unsigned char)  18)
123 /* RFC 1533 */
124 #define TAG_NIS_DOMAIN          ((unsigned char)  40)
125 #define TAG_NIS_SERVER          ((unsigned char)  41)
126 #define TAG_NTP_SERVER          ((unsigned char)  42)
127 /* DHCP maximum message size. */
128 #define TAG_MAX_MSGSZ           ((unsigned char)  57)
129
130 /* XXX - Add new tags here */
131
132
133 /*
134  * "vendor" data permitted for CMU bootp clients.
135  */
136
137 struct cmu_vend {
138         char            v_magic[4];     /* magic number */
139         u_int32         v_flags;        /* flags/opcodes, etc. */
140         struct in_addr  v_smask;        /* Subnet mask */
141         struct in_addr  v_dgate;        /* Default gateway */
142         struct in_addr  v_dns1, v_dns2; /* Domain name servers */
143         struct in_addr  v_ins1, v_ins2; /* IEN-116 name servers */
144         struct in_addr  v_ts1, v_ts2;   /* Time servers */
145         int32           v_unused[6];    /* currently unused */
146 };
147
148
149 /* v_flags values */
150 #define VF_SMASK        1       /* Subnet mask field contains valid data */