]> git.ipfire.org Git - thirdparty/u-boot.git/blame - net/bootp.h
Gitlab CI: Rework our tag usage again
[thirdparty/u-boot.git] / net / bootp.h
CommitLineData
4800a6a0 1/* SPDX-License-Identifier: GPL-2.0-only */
efee1709
WD
2/*
3 * Copied from LiMon - BOOTP.
4 *
5 * Copyright 1994, 1995, 2000 Neil Russell.
efee1709
WD
6 * Copyright 2000 Paolo Scaffardi
7 */
8
9#ifndef __BOOTP_H__
10#define __BOOTP_H__
11
12#ifndef __NET_H__
3090b7e3 13#include <net.h>
efee1709
WD
14#endif /* __NET_H__ */
15
16/**********************************************************************/
17
7ccc6044
SA
18#define PORT_BOOTPS 67 /* BOOTP server UDP port */
19#define PORT_BOOTPC 68 /* BOOTP client UDP port */
20
efee1709
WD
21/*
22 * BOOTP header.
23 */
643d1ab2 24#if defined(CONFIG_CMD_DHCP)
3090b7e3 25/* Minimum DHCP Options size per RFC2131 - results in 576 byte pkt */
f8315731 26#define OPT_FIELD_SIZE 312
efee1709 27#else
f8315731 28#define OPT_FIELD_SIZE 64
efee1709
WD
29#endif
30
7044c6bb 31struct bootp_hdr {
717234e0 32 u8 bp_op; /* Operation */
efee1709
WD
33# define OP_BOOTREQUEST 1
34# define OP_BOOTREPLY 2
717234e0 35 u8 bp_htype; /* Hardware type */
efee1709 36# define HWT_ETHER 1
717234e0 37 u8 bp_hlen; /* Hardware address length */
efee1709 38# define HWL_ETHER 6
717234e0 39 u8 bp_hops; /* Hop count (gateway thing) */
5917e7d1 40 u32 bp_id; /* Transaction ID */
717234e0
ST
41 u16 bp_secs; /* Seconds since boot */
42 u16 bp_spare1; /* Alignment */
049a95a7
JH
43 struct in_addr bp_ciaddr; /* Client IP address */
44 struct in_addr bp_yiaddr; /* Your (client) IP address */
45 struct in_addr bp_siaddr; /* Server IP address */
46 struct in_addr bp_giaddr; /* Gateway IP address */
717234e0 47 u8 bp_chaddr[16]; /* Client hardware address */
3090b7e3
JH
48 char bp_sname[64]; /* Server host name */
49 char bp_file[128]; /* Boot file name */
f8315731 50 char bp_vend[OPT_FIELD_SIZE]; /* Vendor information */
704f3acf 51} __attribute__((packed));
3090b7e3 52
7044c6bb 53#define BOOTP_HDR_SIZE sizeof(struct bootp_hdr)
efee1709
WD
54
55/**********************************************************************/
56/*
57 * Global functions and variables.
58 */
59
60/* bootp.c */
5917e7d1 61extern u32 bootp_id; /* ID of cur BOOTP request */
7044c6bb 62extern int bootp_try;
efee1709 63
efee1709 64/* Send a BOOTP request */
7044c6bb
JH
65void bootp_reset(void);
66void bootp_request(void);
efee1709
WD
67
68/****************** DHCP Support *********************/
7044c6bb 69void dhcp_request(void);
efee1709
WD
70
71/* DHCP States */
72typedef enum { INIT,
73 INIT_REBOOT,
74 REBOOTING,
75 SELECTING,
76 REQUESTING,
77 REBINDING,
78 BOUND,
79 RENEWING } dhcp_state_t;
80
81#define DHCP_DISCOVER 1
82#define DHCP_OFFER 2
83#define DHCP_REQUEST 3
84#define DHCP_DECLINE 4
85#define DHCP_ACK 5
86#define DHCP_NAK 6
87#define DHCP_RELEASE 7
88
c867045e
SE
89#define DHCP_OPTION_PXE_CONFIG_FILE 209 /* "ConfigFile" option according to rfc5071 */
90
efee1709
WD
91/**********************************************************************/
92
93#endif /* __BOOTP_H__ */