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