]>
Commit | Line | Data |
---|---|---|
1c79356b A |
1 | /* |
2 | * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
de355530 A |
6 | * The contents of this file constitute Original Code as defined in and |
7 | * are subject to the Apple Public Source License Version 1.1 (the | |
8 | * "License"). You may not use this file except in compliance with the | |
9 | * License. Please obtain a copy of the License at | |
10 | * http://www.apple.com/publicsource and read it before using this file. | |
1c79356b | 11 | * |
de355530 A |
12 | * This Original Code and all software distributed under the License are |
13 | * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
1c79356b A |
14 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
15 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
de355530 A |
16 | * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the |
17 | * License for the specific language governing rights and limitations | |
18 | * under the License. | |
1c79356b A |
19 | * |
20 | * @APPLE_LICENSE_HEADER_END@ | |
21 | */ | |
22 | /* | |
23 | * Bootstrap Protocol (BOOTP). RFC 951. | |
24 | */ | |
25 | /* | |
26 | * HISTORY | |
27 | * | |
28 | * 14 May 1992 ? at NeXT | |
29 | * Added correct padding to struct nextvend. This is | |
30 | * needed for the i386 due to alignment differences wrt | |
31 | * the m68k. Also adjusted the size of the array fields | |
32 | * because the NeXT vendor area was overflowing the bootp | |
33 | * packet. | |
34 | */ | |
35 | ||
36 | #define iaddr_t struct in_addr | |
37 | ||
38 | struct bootp { | |
39 | u_char bp_op; /* packet opcode type */ | |
40 | #define BOOTREQUEST 1 | |
41 | #define BOOTREPLY 2 | |
42 | u_char bp_htype; /* hardware addr type */ | |
43 | u_char bp_hlen; /* hardware addr length */ | |
44 | u_char bp_hops; /* gateway hops */ | |
45 | u_long bp_xid; /* transaction ID */ | |
46 | u_short bp_secs; /* seconds since boot began */ | |
47 | u_short bp_unused; | |
48 | iaddr_t bp_ciaddr; /* client IP address */ | |
49 | iaddr_t bp_yiaddr; /* 'your' IP address */ | |
50 | iaddr_t bp_siaddr; /* server IP address */ | |
51 | iaddr_t bp_giaddr; /* gateway IP address */ | |
52 | u_char bp_chaddr[16]; /* client hardware address */ | |
53 | u_char bp_sname[64]; /* server host name */ | |
54 | u_char bp_file[128]; /* boot file name */ | |
55 | u_char bp_vend[64]; /* vendor-specific area */ | |
56 | }; | |
57 | ||
58 | /* | |
59 | * UDP port numbers, server and client. | |
60 | */ | |
61 | #define IPPORT_BOOTPS 67 | |
62 | #define IPPORT_BOOTPC 68 | |
63 | ||
64 | /* | |
65 | * "vendor" data permitted for Stanford boot clients. | |
66 | */ | |
67 | struct vend { | |
68 | u_char v_magic[4]; /* magic number */ | |
69 | u_long v_flags; /* flags/opcodes, etc. */ | |
70 | u_char v_unused[56]; /* currently unused */ | |
71 | }; | |
72 | #define VM_STANFORD "STAN" /* v_magic for Stanford */ | |
73 | ||
74 | /* v_flags values */ | |
75 | #define VF_PCBOOT 1 /* an IBMPC or Mac wants environment info */ | |
76 | #define VF_HELP 2 /* help me, I'm not registered */ | |
77 | ||
78 | #define NVMAXTEXT 55 /* don't change this, it just fits RFC951 */ | |
79 | struct nextvend { | |
80 | u_char nv_magic[4]; /* Magic number for vendor specificity */ | |
81 | u_char nv_version; /* NeXT protocol version */ | |
82 | /* | |
83 | * Round the beginning | |
84 | * of the union to a 16 | |
85 | * bit boundary due to | |
86 | * struct/union alignment | |
87 | * on the m68k. | |
88 | */ | |
89 | unsigned short :0; | |
90 | union { | |
91 | u_char NV0[58]; | |
92 | struct { | |
93 | u_char NV1_opcode; /* opcode - Version 1 */ | |
94 | u_char NV1_xid; /* transcation id */ | |
95 | u_char NV1_text[NVMAXTEXT]; /* text */ | |
96 | u_char NV1_null; /* null terminator */ | |
97 | } NV1; | |
98 | } nv_U; | |
99 | }; | |
100 | #define nv_unused nv_U.NV0 | |
101 | #define nv_opcode nv_U.NV1.NV1_opcode | |
102 | #define nv_xid nv_U.NV1.NV1_xid | |
103 | #define nv_text nv_U.NV1.NV1_text | |
104 | #define nv_null nv_U.NV1.NV1_null | |
105 | ||
106 | /* Magic number */ | |
107 | #define VM_NEXT "NeXT" /* v_magic for NeXT, Inc. */ | |
108 | ||
109 | /* Opcodes */ | |
110 | #define BPOP_OK 0 | |
111 | #define BPOP_QUERY 1 | |
112 | #define BPOP_QUERY_NE 2 | |
113 | #define BPOP_ERROR 3 | |
114 | ||
115 | struct bootp_packet { | |
116 | struct ip bp_ip; | |
117 | struct udphdr bp_udp; | |
118 | struct bootp bp_bootp; | |
119 | }; | |
120 | ||
121 | #define BOOTP_PKTSIZE (sizeof (struct bootp_packet)) | |
122 | ||
123 | /* backoffs must be masks */ | |
124 | #define BOOTP_MIN_BACKOFF 0x7ff /* 2.048 sec */ | |
125 | #define BOOTP_MAX_BACKOFF 0xffff /* 65.535 sec */ | |
126 | #define BOOTP_RETRY 6 /* # retries */ | |
127 |