Chameleon

Chameleon Svn Source Tree

Root/branches/JrCs/i386/include/netinet/bootp.h

1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/*
29 * Bootstrap Protocol (BOOTP). RFC 951.
30 */
31/*
32 * HISTORY
33 *
34 * 14 May 1992 ? at NeXT
35 *Added correct padding to struct nextvend. This is
36 *needed for the i386 due to alignment differences wrt
37 *the m68k. Also adjusted the size of the array fields
38 *because the NeXT vendor area was overflowing the bootp
39 *packet.
40 */
41
42#include <netinet/udp.h>
43
44#define iaddr_t struct in_addr
45
46struct bootp {
47u_charbp_op;/* packet opcode type */
48#defineBOOTREQUEST1
49#defineBOOTREPLY2
50u_charbp_htype;/* hardware addr type */
51u_charbp_hlen;/* hardware addr length */
52u_charbp_hops;/* gateway hops */
53u_int32_t bp_xid;/* transaction ID */
54u_shortbp_secs;/* seconds since boot began */
55u_shortbp_unused;
56iaddr_tbp_ciaddr;/* client IP address */
57iaddr_tbp_yiaddr;/* 'your' IP address */
58iaddr_tbp_siaddr;/* server IP address */
59iaddr_tbp_giaddr;/* gateway IP address */
60u_charbp_chaddr[16];/* client hardware address */
61u_charbp_sname[64];/* server host name */
62u_charbp_file[128];/* boot file name */
63u_charbp_vend[64];/* vendor-specific area */
64};
65
66/*
67 * UDP port numbers, server and client.
68 */
69#defineIPPORT_BOOTPS67
70#defineIPPORT_BOOTPC68
71
72/*
73 * "vendor" data permitted for Stanford boot clients.
74 */
75struct vend {
76u_charv_magic[4];/* magic number */
77u_int32_t v_flags;/* flags/opcodes, etc. */
78u_charv_unused[56];/* currently unused */
79};
80#defineVM_STANFORD"STAN"/* v_magic for Stanford */
81
82/* v_flags values */
83#defineVF_PCBOOT1/* an IBMPC or Mac wants environment info */
84#defineVF_HELP2/* help me, I'm not registered */
85
86#defineNVMAXTEXT55/* don't change this, it just fits RFC951 */
87struct nextvend {
88u_char nv_magic[4];/* Magic number for vendor specificity */
89u_char nv_version;/* NeXT protocol version */
90/*
91 * Round the beginning
92 * of the union to a 16
93 * bit boundary due to
94 * struct/union alignment
95 * on the m68k.
96 */
97unsigned short:0;
98union {
99u_char NV0[58];
100struct {
101u_char NV1_opcode;/* opcode - Version 1 */
102u_char NV1_xid;/* transcation id */
103u_char NV1_text[NVMAXTEXT];/* text */
104u_char NV1_null;/* null terminator */
105} NV1;
106} nv_U;
107};
108#definenv_unusednv_U.NV0
109#definenv_opcodenv_U.NV1.NV1_opcode
110#definenv_xidnv_U.NV1.NV1_xid
111#definenv_textnv_U.NV1.NV1_text
112#define nv_nullnv_U.NV1.NV1_null
113
114/* Magic number */
115#define VM_NEXT"NeXT"/* v_magic for NeXT, Inc. */
116
117/* Opcodes */
118#defineBPOP_OK0
119#define BPOP_QUERY1
120#defineBPOP_QUERY_NE2
121#defineBPOP_ERROR3
122
123struct bootp_packet {
124 struct ip bp_ip;
125 struct udphdr bp_udp;
126 struct bootp bp_bootp;
127};
128
129#defineBOOTP_PKTSIZE (sizeof (struct bootp_packet))
130
131/* backoffs must be masks */
132#defineBOOTP_MIN_BACKOFF0x7ff/* 2.048 sec */
133#defineBOOTP_MAX_BACKOFF0xffff/* 65.535 sec */
134#defineBOOTP_RETRY6/* # retries */
135
136

Archive Download this file

Revision: 1466