Annotation of sys/lib/libsa/bootp.h, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: bootp.h,v 1.5 2003/08/11 06:23:09 deraadt Exp $ */
2: /* $NetBSD: bootp.h,v 1.3 1996/09/26 23:22:01 cgd Exp $ */
3:
4: /*
5: * Bootstrap Protocol (BOOTP). RFC951 and RFC1048.
6: *
7: * This file specifies the "implementation-independent" BOOTP protocol
8: * information which is common to both client and server.
9: *
10: * Copyright 1988 by Carnegie Mellon.
11: *
12: * Permission to use, copy, modify, and distribute this program for any
13: * purpose and without fee is hereby granted, provided that this copyright
14: * and permission notice appear on all copies and supporting documentation,
15: * the name of Carnegie Mellon not be used in advertising or publicity
16: * pertaining to distribution of the program without specific prior
17: * permission, and notice be given in supporting documentation that copying
18: * and distribution is by permission of Carnegie Mellon and Stanford
19: * University. Carnegie Mellon makes no representations about the
20: * suitability of this software for any purpose. It is provided "as is"
21: * without express or implied warranty.
22: */
23:
24: #define BP_CHADDR_LEN 16
25: #define BP_SNAME_LEN 64
26: #define BP_FILE_LEN 128
27: #define BP_VEND_LEN 64
28: #define BP_MINPKTSZ 300 /* to check sizeof(struct bootp) */
29:
30:
31: struct bootp {
32: u_char bp_op; /* packet opcode type */
33: u_char bp_htype; /* hardware addr type */
34: u_char bp_hlen; /* hardware addr length */
35: u_char bp_hops; /* gateway hops */
36: u_int bp_xid; /* transaction ID */
37: u_short bp_secs; /* seconds since boot began */
38: u_short bp_flags; /* RFC1532 broadcast, etc. */
39: struct in_addr bp_ciaddr; /* client IP address */
40: struct in_addr bp_yiaddr; /* 'your' IP address */
41: struct in_addr bp_siaddr; /* server IP address */
42: struct in_addr bp_giaddr; /* gateway IP address */
43: u_char bp_chaddr[BP_CHADDR_LEN];/* client hardware address */
44: u_char bp_sname[BP_SNAME_LEN]; /* server host name */
45: u_char bp_file[BP_FILE_LEN]; /* boot file name */
46: u_char bp_vend[BP_VEND_LEN]; /* vendor-specific area */
47: };
48:
49: /*
50: * UDP port numbers, server and client.
51: */
52: #define IPPORT_BOOTPS 67
53: #define IPPORT_BOOTPC 68
54:
55: #define BOOTREPLY 2
56: #define BOOTREQUEST 1
57:
58: /*
59: * Hardware types from Assigned Numbers RFC.
60: */
61: #define HTYPE_ETHERNET 1
62: #define HTYPE_EXP_ETHERNET 2
63: #define HTYPE_AX25 3
64: #define HTYPE_PRONET 4
65: #define HTYPE_CHAOS 5
66: #define HTYPE_IEEE802 6
67: #define HTYPE_ARCNET 7
68:
69: /*
70: * Vendor magic cookie (v_magic) for CMU
71: */
72: #define VM_CMU "CMU"
73:
74: /*
75: * Vendor magic cookie (v_magic) for RFC1048
76: */
77: #define VM_RFC1048 { 99, 130, 83, 99 }
78:
79:
80:
81: /*
82: * RFC1048 tag values used to specify what information is being supplied in
83: * the vendor field of the packet.
84: */
85:
86: #define TAG_PAD ((unsigned char) 0)
87: #define TAG_SUBNET_MASK ((unsigned char) 1)
88: #define TAG_TIME_OFFSET ((unsigned char) 2)
89: #define TAG_GATEWAY ((unsigned char) 3)
90: #define TAG_TIME_SERVER ((unsigned char) 4)
91: #define TAG_NAME_SERVER ((unsigned char) 5)
92: #define TAG_DOMAIN_SERVER ((unsigned char) 6)
93: #define TAG_LOG_SERVER ((unsigned char) 7)
94: #define TAG_COOKIE_SERVER ((unsigned char) 8)
95: #define TAG_LPR_SERVER ((unsigned char) 9)
96: #define TAG_IMPRESS_SERVER ((unsigned char) 10)
97: #define TAG_RLP_SERVER ((unsigned char) 11)
98: #define TAG_HOSTNAME ((unsigned char) 12)
99: #define TAG_BOOTSIZE ((unsigned char) 13)
100: #define TAG_DUMPFILE ((unsigned char) 14)
101: #define TAG_DOMAINNAME ((unsigned char) 15)
102: #define TAG_SWAPSERVER ((unsigned char) 16)
103: #define TAG_ROOTPATH ((unsigned char) 17)
104: #define TAG_EXTEN_FILE ((unsigned char) 18)
105: #define TAG_NIS_DOMAIN ((unsigned char) 40)
106: #define TAG_NIS_SERVER ((unsigned char) 41)
107: #define TAG_NTP_SERVER ((unsigned char) 42)
108: #define TAG_MAX_MSGSZ ((unsigned char) 57)
109: #define TAG_END ((unsigned char) 255)
110:
111:
112:
113: /*
114: * "vendor" data permitted for CMU bootp clients.
115: */
116:
117: struct cmu_vend {
118: unsigned char v_magic[4]; /* magic number */
119: unsigned int v_flags; /* flags/opcodes, etc. */
120: struct in_addr v_smask; /* Subnet mask */
121: struct in_addr v_dgate; /* Default gateway */
122: struct in_addr v_dns1, v_dns2; /* Domain name servers */
123: struct in_addr v_ins1, v_ins2; /* IEN-116 name servers */
124: struct in_addr v_ts1, v_ts2; /* Time servers */
125: unsigned char v_unused[25]; /* currently unused */
126: };
127:
128: /* v_flags values */
129: #define VF_SMASK 1 /* Subnet mask field contains valid data */
130:
131: void bootp(int);
CVSweb