FD.io VPP
v20.09-64-g4f7b92f0a
Vector Packet Processing
dhcp4_packet.h
Go to the documentation of this file.
1
#ifndef included_vnet_dhcp4_packet_h
2
#define included_vnet_dhcp4_packet_h
3
4
/*
5
* DHCP packet format
6
*
7
* Copyright (c) 2013 Cisco and/or its affiliates.
8
* Licensed under the Apache License, Version 2.0 (the "License");
9
* you may not use this file except in compliance with the License.
10
* You may obtain a copy of the License at:
11
*
12
* http://www.apache.org/licenses/LICENSE-2.0
13
*
14
* Unless required by applicable law or agreed to in writing, software
15
* distributed under the License is distributed on an "AS IS" BASIS,
16
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
* See the License for the specific language governing permissions and
18
* limitations under the License.
19
*/
20
#include <
vnet/ip/ip4_packet.h
>
21
22
typedef
struct
23
{
24
u8
option
;
25
u8
length
;
26
union
27
{
28
u8
data
[0];
29
u32
data_as_u32[0];
30
};
31
} __attribute__ ((packed))
dhcp_option_t
;
32
33
typedef
struct
34
{
35
u8
opcode
;
/* 1 = request, 2 = reply */
36
u8
hardware_type
;
/* 1 = ethernet */
37
u8
hardware_address_length
;
38
u8
hops
;
39
u32
transaction_identifier
;
40
u16
seconds
;
41
u16
flags
;
42
#define DHCP_FLAG_BROADCAST (1<<15)
43
ip4_address_t
client_ip_address
;
44
ip4_address_t
your_ip_address
;
/* use this one */
45
ip4_address_t
server_ip_address
;
46
ip4_address_t
gateway_ip_address
;
/* use option 3, not this one */
47
u8
client_hardware_address[16];
48
u8
server_name[64];
49
u8
boot_filename[128];
50
ip4_address_t
magic_cookie
;
51
dhcp_option_t
options
[0];
52
}
dhcp_header_t
;
53
54
extern
u8
*
format_dhcp_header
(
u8
* s, va_list * args);
55
56
typedef
enum
57
{
58
DHCP_PACKET_DISCOVER
= 1,
59
DHCP_PACKET_OFFER
,
60
DHCP_PACKET_REQUEST
,
61
DHCP_PACKET_ACK
= 5,
62
DHCP_PACKET_NAK
,
63
}
dhcp_packet_type_t
;
64
65
extern
u8
*
format_dhcp_packet_type
(
u8
* s, va_list * args);
66
67
typedef
enum
dhcp_packet_option_t_
68
{
69
DHCP_PACKET_OPTION_MSG_TYPE
= 53,
70
DHCP_PACKET_OPTION_END
= 0xff,
71
}
dhcp_packet_option_t
;
72
73
/* charming antique: 99.130.83.99 is the dhcp magic cookie */
74
#define DHCP_MAGIC (clib_host_to_net_u32(0x63825363))
75
76
#endif
/* included_vnet_dhcp4_packet_h */
77
78
/*
79
* fd.io coding-style-patch-verification: ON
80
*
81
* Local Variables:
82
* eval: (c-set-style "gnu")
83
* End:
84
*/
dhcp_header_t::opcode
u8 opcode
Definition:
dhcp4_packet.h:35
dhcp_option_t::length
u8 length
Definition:
dhcp4_packet.h:25
dhcp_option_t::option
u8 option
Definition:
dhcp4_packet.h:24
dhcp_header_t::seconds
u16 seconds
Definition:
dhcp4_packet.h:40
dhcp_header_t
Definition:
dhcp4_packet.h:33
DHCP_PACKET_OFFER
Definition:
dhcp4_packet.h:59
DHCP_PACKET_DISCOVER
Definition:
dhcp4_packet.h:58
dhcp_header_t::server_ip_address
ip4_address_t server_ip_address
Definition:
dhcp4_packet.h:45
format_dhcp_header
u8 * format_dhcp_header(u8 *s, va_list *args)
Definition:
dhcp4_packet.c:48
u8
unsigned char u8
Definition:
types.h:56
data
u8 data[128]
Definition:
ipsec_types.api:89
DHCP_PACKET_NAK
Definition:
dhcp4_packet.h:62
dhcp_packet_option_t
enum dhcp_packet_option_t_ dhcp_packet_option_t
u32
unsigned int u32
Definition:
types.h:88
ip4_address_t
Definition:
ip4_packet.h:50
DHCP_PACKET_OPTION_MSG_TYPE
Definition:
dhcp4_packet.h:69
ip4_packet.h
u16
unsigned short u16
Definition:
types.h:57
dhcp_header_t::hops
u8 hops
Definition:
dhcp4_packet.h:38
DHCP_PACKET_REQUEST
Definition:
dhcp4_packet.h:60
dhcp_header_t::client_ip_address
ip4_address_t client_ip_address
Definition:
dhcp4_packet.h:43
dhcp_header_t::flags
u16 flags
Definition:
dhcp4_packet.h:41
dhcp_header_t::gateway_ip_address
ip4_address_t gateway_ip_address
Definition:
dhcp4_packet.h:46
dhcp_header_t::transaction_identifier
u32 transaction_identifier
Definition:
dhcp4_packet.h:39
dhcp_header_t::hardware_address_length
u8 hardware_address_length
Definition:
dhcp4_packet.h:37
DHCP_PACKET_OPTION_END
Definition:
dhcp4_packet.h:70
format_dhcp_packet_type
u8 * format_dhcp_packet_type(u8 *s, va_list *args)
Definition:
dhcp4_packet.c:22
dhcp_header_t::magic_cookie
ip4_address_t magic_cookie
Definition:
dhcp4_packet.h:50
dhcp_option_t
Definition:
dhcp4_packet.h:22
options
static struct option options[]
Definition:
main.c:52
dhcp_packet_option_t_
dhcp_packet_option_t_
Definition:
dhcp4_packet.h:67
DHCP_PACKET_ACK
Definition:
dhcp4_packet.h:61
dhcp_packet_type_t
dhcp_packet_type_t
Definition:
dhcp4_packet.h:56
dhcp_header_t::hardware_type
u8 hardware_type
Definition:
dhcp4_packet.h:36
dhcp_header_t::your_ip_address
ip4_address_t your_ip_address
Definition:
dhcp4_packet.h:44
src
plugins
dhcp
dhcp4_packet.h
Generated on Thu Jun 3 2021 16:04:16 for FD.io VPP by
1.8.13