OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [redboot/] [current/] [include/] [net/] [bootp.h] - Blame information for rev 868

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
//==========================================================================
2
//
3
//      net/bootp.h
4
//
5
//      Stand-alone BOOTP support for RedBoot
6
//
7
//==========================================================================
8
// ####ECOSGPLCOPYRIGHTBEGIN####                                            
9
// -------------------------------------------                              
10
// This file is part of eCos, the Embedded Configurable Operating System.   
11
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
12
//
13
// eCos is free software; you can redistribute it and/or modify it under    
14
// the terms of the GNU General Public License as published by the Free     
15
// Software Foundation; either version 2 or (at your option) any later      
16
// version.                                                                 
17
//
18
// eCos is distributed in the hope that it will be useful, but WITHOUT      
19
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or    
20
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License    
21
// for more details.                                                        
22
//
23
// You should have received a copy of the GNU General Public License        
24
// along with eCos; if not, write to the Free Software Foundation, Inc.,    
25
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.            
26
//
27
// As a special exception, if other files instantiate templates or use      
28
// macros or inline functions from this file, or you compile this file      
29
// and link it with other works to produce a work based on this file,       
30
// this file does not by itself cause the resulting work to be covered by   
31
// the GNU General Public License. However the source code for this file    
32
// must still be made available in accordance with section (3) of the GNU   
33
// General Public License v2.                                               
34
//
35
// This exception does not invalidate any other reasons why a work based    
36
// on this file might be covered by the GNU General Public License.         
37
// -------------------------------------------                              
38
// ####ECOSGPLCOPYRIGHTEND####                                              
39
//==========================================================================
40
//#####DESCRIPTIONBEGIN####
41
//
42
// Author(s):    gthomas
43
// Contributors: gthomas
44
// Date:         2000-07-14
45
// Purpose:      
46
// Description:  
47
//              
48
// This code is part of RedBoot (tm).
49
//
50
//####DESCRIPTIONEND####
51
//
52
//==========================================================================
53
 
54
/************************************************************************
55
          Copyright 1988, 1991 by Carnegie Mellon University
56
 
57
                          All Rights Reserved
58
 
59
Permission to use, copy, modify, and distribute this software and its
60
documentation for any purpose and without fee is hereby granted, provided
61
that the above copyright notice appear in all copies and that both that
62
copyright notice and this permission notice appear in supporting
63
documentation, and that the name of Carnegie Mellon University not be used
64
in advertising or publicity pertaining to distribution of the software
65
without specific, written prior permission.
66
 
67
CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
68
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
69
IN NO EVENT SHALL CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
70
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
71
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
72
ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
73
SOFTWARE.
74
************************************************************************/
75
 
76
#ifndef _BOOTP_H_
77
#define _BOOTP_H_
78
 
79
/*
80
 * Bootstrap Protocol (BOOTP).  RFC951 and RFC1395.
81
 *
82
 * This file specifies the "implementation-independent" BOOTP protocol
83
 * information which is common to both client and server.
84
 *
85
 */
86
 
87
#define BP_CHADDR_LEN    16
88
#define BP_SNAME_LEN     64
89
#define BP_FILE_LEN     128
90
#define BP_VEND_LEN     312
91
#define BP_MINPKTSZ     300     /* to check sizeof(struct bootp) */
92
#define BP_MIN_VEND_SIZE 64     /* minimum actual vendor area */
93
 
94
typedef struct bootp {
95
    unsigned char    bp_op;                     /* packet opcode type */
96
    unsigned char    bp_htype;                  /* hardware addr type */
97
    unsigned char    bp_hlen;                   /* hardware addr length */
98
    unsigned char    bp_hops;                   /* gateway hops */
99
    unsigned int     bp_xid;                    /* transaction ID */
100
    unsigned short   bp_secs;                   /* seconds since boot began */
101
    unsigned short   bp_flags;                  /* RFC1532 broadcast, etc. */
102
    struct in_addr   bp_ciaddr;                 /* client IP address */
103
    struct in_addr   bp_yiaddr;                 /* 'your' IP address */
104
    struct in_addr   bp_siaddr;                 /* server IP address */
105
    struct in_addr   bp_giaddr;                 /* gateway IP address */
106
    unsigned char    bp_chaddr[BP_CHADDR_LEN];  /* client hardware address */
107
    char             bp_sname[BP_SNAME_LEN];    /* server host name */
108
    char             bp_file[BP_FILE_LEN];      /* boot file name */
109
    unsigned char    bp_vend[BP_VEND_LEN];      /* vendor-specific area */
110
    /* note that bp_vend can be longer, extending to end of packet. */
111
} bootp_header_t;
112
 
113
/*
114
 * UDP port numbers, server and client.
115
 */
116
#define IPPORT_BOOTPS           67
117
#define IPPORT_BOOTPC           68
118
 
119
#define BOOTREPLY               2
120
#define BOOTREQUEST             1
121
 
122
/*
123
 * Hardware types from Assigned Numbers RFC.
124
 */
125
#define HTYPE_ETHERNET            1
126
#define HTYPE_EXP_ETHERNET        2
127
#define HTYPE_AX25                3
128
#define HTYPE_PRONET              4
129
#define HTYPE_CHAOS               5
130
#define HTYPE_IEEE802             6
131
#define HTYPE_ARCNET              7
132
 
133
/*
134
 * Vendor magic cookie (v_magic) for CMU
135
 */
136
#define VM_CMU          "CMU"
137
 
138
/*
139
 * Vendor magic cookie (v_magic) for RFC1048
140
 */
141
#define VM_RFC1048      { 99, 130, 83, 99 }
142
 
143
 
144
 
145
/*
146
 * Tag values used to specify what information is being supplied in
147
 * the vendor (options) data area of the packet.
148
 */
149
/* RFC 1048 */
150
/* End of cookie */
151
#define TAG_END                 ((unsigned char) 255)
152
/* padding for alignment */
153
#define TAG_PAD                 ((unsigned char)   0)
154
/* Subnet mask */
155
#define TAG_SUBNET_MASK         ((unsigned char)   1)
156
/* Time offset from UTC for this system */
157
#define TAG_TIME_OFFSET         ((unsigned char)   2)
158
/* List of routers on this subnet */
159
#define TAG_GATEWAY             ((unsigned char)   3)
160
/* List of rfc868 time servers available to client */
161
#define TAG_TIME_SERVER         ((unsigned char)   4)
162
/* List of IEN 116 name servers */
163
#define TAG_NAME_SERVER         ((unsigned char)   5)
164
/* List of DNS name servers */
165
#define TAG_DOMAIN_SERVER       ((unsigned char)   6)
166
/* List of MIT-LCS UDL log servers */
167
#define TAG_LOG_SERVER          ((unsigned char)   7)
168
/* List of rfc865 cookie servers */
169
#define TAG_COOKIE_SERVER       ((unsigned char)   8)
170
/* List of rfc1179 printer servers (in order to try) */
171
#define TAG_LPR_SERVER          ((unsigned char)   9)
172
/* List of Imagen Impress servers (in prefered order) */
173
#define TAG_IMPRESS_SERVER      ((unsigned char)  10)
174
/* List of rfc887 Resourse Location servers */
175
#define TAG_RLP_SERVER          ((unsigned char)  11)
176
/* Hostname of client */
177
#define TAG_HOST_NAME           ((unsigned char)  12)
178
/* boot file size */
179
#define TAG_BOOT_SIZE           ((unsigned char)  13)
180
/* RFC 1395 */
181
/* path to dump to in case of crash */
182
#define TAG_DUMP_FILE           ((unsigned char)  14)
183
/* domain name for use with the DNS */
184
#define TAG_DOMAIN_NAME         ((unsigned char)  15)
185
/* IP address of the swap server for this machine */
186
#define TAG_SWAP_SERVER         ((unsigned char)  16)
187
/* The path name to the root filesystem for this machine */
188
#define TAG_ROOT_PATH           ((unsigned char)  17)
189
/* RFC 1497 */
190
/* filename to tftp with more options in it */
191
#define TAG_EXTEN_FILE          ((unsigned char)  18)
192
/* RFC 1533 */
193
/* The following are in rfc1533 and may be used by BOOTP/DHCP */
194
/* IP forwarding enable/disable */
195
#define TAG_IP_FORWARD          ((unsigned char)  19)
196
/* Non-Local source routing enable/disable */
197
#define TAG_IP_NLSR             ((unsigned char)  20)
198
/* List of pairs of addresses/masks to allow non-local source routing to */
199
#define TAG_IP_POLICY_FILTER    ((unsigned char)  21)
200
/* Maximum size of datagrams client should be prepared to reassemble */
201
#define TAG_IP_MAX_DRS          ((unsigned char)  22)
202
/* Default IP TTL */
203
#define TAG_IP_TTL              ((unsigned char)  23)
204
/* Timeout in seconds to age path MTU values found with rfc1191 */
205
#define TAG_IP_MTU_AGE          ((unsigned char)  24)
206
/* Table of MTU sizes to use when doing rfc1191 MTU discovery */
207
#define TAG_IP_MTU_PLAT         ((unsigned char)  25)
208
/* MTU to use on this interface */
209
#define TAG_IP_MTU              ((unsigned char)  26)
210
/* All subnets are local option */
211
#define TAG_IP_SNARL            ((unsigned char)  27)
212
/* broadcast address */
213
#define TAG_IP_BROADCAST        ((unsigned char)  28)
214
/* perform subnet mask discovery using ICMP */
215
#define TAG_IP_SMASKDISC        ((unsigned char)  29)
216
/* act as a subnet mask server using ICMP */
217
#define TAG_IP_SMASKSUPP        ((unsigned char)  30)
218
/* perform rfc1256 router discovery */
219
#define TAG_IP_ROUTERDISC       ((unsigned char)  31)
220
/* address to send router solicitation requests */
221
#define TAG_IP_ROUTER_SOL_ADDR  ((unsigned char)  32)
222
/* list of static routes to addresses (addr, router) pairs */
223
#define TAG_IP_STATIC_ROUTES    ((unsigned char)  33)
224
/* use trailers (rfc893) when using ARP */
225
#define TAG_IP_TRAILER_ENC      ((unsigned char)  34)
226
/* timeout in seconds for ARP cache entries */
227
#define TAG_ARP_TIMEOUT         ((unsigned char)  35)
228
/* use either Ethernet version 2 (rfc894) or IEEE 802.3 (rfc1042) */
229
#define TAG_ETHER_IEEE          ((unsigned char)  36)
230
/* default TCP TTL when sending TCP segments */
231
#define TAG_IP_TCP_TTL          ((unsigned char)  37)
232
/* time for client to wait before sending a keepalive on a TCP connection */
233
#define TAG_IP_TCP_KA_INT       ((unsigned char)  38)
234
/* don't send keepalive with an octet of garbage for compatability */
235
#define TAG_IP_TCP_KA_GARBAGE   ((unsigned char)  39)
236
/* NIS domainname */
237
#define TAG_NIS_DOMAIN          ((unsigned char)  40)
238
/* list of NIS servers */
239
#define TAG_NIS_SERVER          ((unsigned char)  41)
240
/* list of NTP servers */
241
#define TAG_NTP_SERVER          ((unsigned char)  42)
242
/* and stuff vendors may want to add */
243
#define TAG_VEND_SPECIFIC       ((unsigned char)  43)
244
/* NetBios over TCP/IP name server */
245
#define TAG_NBNS_SERVER         ((unsigned char)  44)
246
/* NetBios over TCP/IP NBDD servers (rfc1001/1002) */
247
#define TAG_NBDD_SERVER         ((unsigned char)  45)
248
/* NetBios over TCP/IP node type option for use with above */
249
#define TAG_NBOTCP_OTPION       ((unsigned char)  46)
250
/* NetBios over TCP/IP scopt option for use with above */
251
#define TAG_NB_SCOPE            ((unsigned char)  47)
252
/* list of X Window system font servers */
253
#define TAG_XFONT_SERVER        ((unsigned char)  48)
254
/* list of systems running X Display Manager (xdm) available to this client */
255
#define TAG_XDISPLAY_SERVER     ((unsigned char)  49)
256
 
257
/* While the following are only allowed for DHCP */
258
/* DHCP requested IP address */
259
#define TAG_DHCP_REQ_IP         ((unsigned char)  50)
260
/* DHCP time for lease of IP address */
261
#define TAG_DHCP_LEASE_TIME     ((unsigned char)  51)
262
/* DHCP options overload */
263
#define TAG_DHCP_OPTOVER        ((unsigned char)  52)
264
/* DHCP message type */
265
#define TAG_DHCP_MESS_TYPE      ((unsigned char)  53)
266
/* DHCP server identification */
267
#define TAG_DHCP_SERVER_ID      ((unsigned char)  54)
268
/* DHCP ordered list of requested parameters */
269
#define TAG_DHCP_PARM_REQ_LIST  ((unsigned char)  55)
270
/* DHCP reply message */
271
#define TAG_DHCP_TEXT_MESSAGE   ((unsigned char)  56)
272
/* DHCP maximum packet size willing to accept */
273
#define TAG_DHCP_MAX_MSGSZ      ((unsigned char)  57)
274
/* DHCP time 'til client needs to renew */
275
#define TAG_DHCP_RENEWAL_TIME   ((unsigned char)  58)
276
/* DHCP  time 'til client needs to rebind */
277
#define TAG_DHCP_REBIND_TIME    ((unsigned char)  59)
278
/* DHCP class identifier */
279
#define TAG_DHCP_CLASSID        ((unsigned char)  60)
280
/* DHCP client unique identifier */
281
#define TAG_DHCP_CLIENTID       ((unsigned char)  61)
282
 
283
/* XXX - Add new tags here */
284
 
285
/* DHCP Message Types */
286
#define DHCP_MESS_TYPE_DISCOVER  ((unsigned char) 1)
287
#define DHCP_MESS_TYPE_OFFER     ((unsigned char) 2)
288
#define DHCP_MESS_TYPE_REQUEST   ((unsigned char) 3)
289
#define DHCP_MESS_TYPE_DECLINE   ((unsigned char) 4)
290
#define DHCP_MESS_TYPE_ACK       ((unsigned char) 5)
291
#define DHCP_MESS_TYPE_NAK       ((unsigned char) 6)
292
#define DHCP_MESS_TYPE_RELEASE   ((unsigned char) 7)
293
 
294
/*
295
 * "vendor" data permitted for CMU bootp clients.
296
 */
297
 
298
struct cmu_vend {
299
        char            v_magic[4];     /* magic number */
300
        unsigned int    v_flags;        /* flags/opcodes, etc. */
301
        struct in_addr  v_smask;        /* Subnet mask */
302
        struct in_addr  v_dgate;        /* Default gateway */
303
        struct in_addr  v_dns1, v_dns2; /* Domain name servers */
304
        struct in_addr  v_ins1, v_ins2; /* IEN-116 name servers */
305
        struct in_addr  v_ts1, v_ts2;   /* Time servers */
306
        int             v_unused[6];    /* currently unused */
307
};
308
 
309
 
310
/* v_flags values */
311
#define VF_SMASK        1       /* Subnet mask field contains valid data */
312
 
313
#define IPPORT_BOOTPS           67
314
#define IPPORT_BOOTPC           68
315
 
316
#endif // _BOOTP_H_

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.