OpenVPN 3 Core Library
Loading...
Searching...
No Matches
dhcp.hpp
Go to the documentation of this file.
1
// OpenVPN -- An application to securely tunnel IP networks
2
// over a single port, with support for SSL/TLS-based
3
// session authentication and key exchange,
4
// packet encryption, packet authentication, and
5
// packet compression.
6
//
7
// Copyright (C) 2012- OpenVPN Inc.
8
//
9
// SPDX-License-Identifier: MPL-2.0 OR AGPL-3.0-only WITH openvpn3-openssl-exception
10
//
11
12
#ifndef OPENVPN_IP_DHCP_H
13
#define OPENVPN_IP_DHCP_H
14
15
#include <
openvpn/ip/eth.hpp
>
16
#include <
openvpn/ip/ip4.hpp
>
17
#include <
openvpn/ip/udp.hpp
>
18
19
#pragma pack(push)
20
#pragma pack(1)
21
22
namespace
openvpn
{
23
struct
DHCP
24
{
25
enum
26
{
27
/* DHCP Option types */
28
DHCP_PAD
= 0,
29
DHCP_NETMASK
= 1,
30
DHCP_ROUTER
= 3,
31
DHCP_DNS
= 6,
32
DHCP_MSG_TYPE
= 53
/* message type (u8) */
,
33
DHCP_END
= 255,
34
35
/* DHCP Messages types */
36
DHCPDISCOVER
= 1,
37
DHCPOFFER
= 2,
38
DHCPREQUEST
= 3,
39
DHCPDECLINE
= 4,
40
DHCPACK
= 5,
41
DHCPNAK
= 6,
42
DHCPRELEASE
= 7,
43
DHCPINFORM
= 8,
44
45
/* DHCP UDP port numbers */
46
BOOTPS_PORT
= 67,
47
BOOTPC_PORT
= 68,
48
49
/* DHCP message op */
50
BOOTREQUEST
= 1,
51
BOOTREPLY
= 2,
52
};
53
54
std::uint8_t
op
;
/* message op */
55
std::uint8_t
htype
;
/* hardware address type (e.g. '1' = 10Mb Ethernet) */
56
std::uint8_t
hlen
;
/* hardware address length (e.g. '6' for 10Mb Ethernet) */
57
std::uint8_t
hops
;
/* client sets to 0, may be used by relay agents */
58
std::uint32_t
xid
;
/* transaction ID, chosen by client */
59
std::uint16_t
secs
;
/* seconds since request process began, set by client */
60
std::uint16_t
flags
;
61
std::uint32_t
ciaddr
;
/* client IP address, client sets if known */
62
std::uint32_t
yiaddr
;
/* 'your' IP address -- server's response to client */
63
std::uint32_t
siaddr
;
/* server IP address */
64
std::uint32_t
giaddr
;
/* relay agent IP address */
65
std::uint8_t
chaddr
[16];
/* client hardware address */
66
std::uint8_t
sname
[64];
/* optional server host name */
67
std::uint8_t
file
[128];
/* boot file name */
68
std::uint32_t
magic
;
/* must be 0x63825363 (network order) */
69
};
70
71
struct
DHCPPacket
72
{
73
EthHeader
eth
;
74
IPv4Header
ip
;
75
UDPHeader
udp
;
76
DHCP
dhcp
;
77
std::uint8_t
options
[];
78
};
79
}
// namespace openvpn
80
81
#pragma pack(pop)
82
83
#endif
eth.hpp
ip4.hpp
openvpn
Definition
ovpncli.cpp:97
openvpn::DHCPPacket
Definition
dhcp.hpp:72
openvpn::DHCPPacket::options
std::uint8_t options[]
Definition
dhcp.hpp:77
openvpn::DHCPPacket::ip
IPv4Header ip
Definition
dhcp.hpp:74
openvpn::DHCPPacket::eth
EthHeader eth
Definition
dhcp.hpp:73
openvpn::DHCPPacket::dhcp
DHCP dhcp
Definition
dhcp.hpp:76
openvpn::DHCPPacket::udp
UDPHeader udp
Definition
dhcp.hpp:75
openvpn::DHCP
Definition
dhcp.hpp:24
openvpn::DHCP::secs
std::uint16_t secs
Definition
dhcp.hpp:59
openvpn::DHCP::sname
std::uint8_t sname[64]
Definition
dhcp.hpp:66
openvpn::DHCP::ciaddr
std::uint32_t ciaddr
Definition
dhcp.hpp:61
openvpn::DHCP::htype
std::uint8_t htype
Definition
dhcp.hpp:55
openvpn::DHCP::file
std::uint8_t file[128]
Definition
dhcp.hpp:67
openvpn::DHCP::chaddr
std::uint8_t chaddr[16]
Definition
dhcp.hpp:65
openvpn::DHCP::yiaddr
std::uint32_t yiaddr
Definition
dhcp.hpp:62
openvpn::DHCP::magic
std::uint32_t magic
Definition
dhcp.hpp:68
openvpn::DHCP::siaddr
std::uint32_t siaddr
Definition
dhcp.hpp:63
openvpn::DHCP::giaddr
std::uint32_t giaddr
Definition
dhcp.hpp:64
openvpn::DHCP::flags
std::uint16_t flags
Definition
dhcp.hpp:60
openvpn::DHCP::DHCPRELEASE
@ DHCPRELEASE
Definition
dhcp.hpp:42
openvpn::DHCP::DHCPACK
@ DHCPACK
Definition
dhcp.hpp:40
openvpn::DHCP::DHCP_NETMASK
@ DHCP_NETMASK
Definition
dhcp.hpp:29
openvpn::DHCP::DHCPINFORM
@ DHCPINFORM
Definition
dhcp.hpp:43
openvpn::DHCP::DHCPDECLINE
@ DHCPDECLINE
Definition
dhcp.hpp:39
openvpn::DHCP::DHCP_MSG_TYPE
@ DHCP_MSG_TYPE
Definition
dhcp.hpp:32
openvpn::DHCP::DHCP_PAD
@ DHCP_PAD
Definition
dhcp.hpp:28
openvpn::DHCP::DHCP_END
@ DHCP_END
Definition
dhcp.hpp:33
openvpn::DHCP::DHCPNAK
@ DHCPNAK
Definition
dhcp.hpp:41
openvpn::DHCP::BOOTREPLY
@ BOOTREPLY
Definition
dhcp.hpp:51
openvpn::DHCP::DHCPREQUEST
@ DHCPREQUEST
Definition
dhcp.hpp:38
openvpn::DHCP::BOOTREQUEST
@ BOOTREQUEST
Definition
dhcp.hpp:50
openvpn::DHCP::DHCPOFFER
@ DHCPOFFER
Definition
dhcp.hpp:37
openvpn::DHCP::DHCP_ROUTER
@ DHCP_ROUTER
Definition
dhcp.hpp:30
openvpn::DHCP::DHCP_DNS
@ DHCP_DNS
Definition
dhcp.hpp:31
openvpn::DHCP::BOOTPS_PORT
@ BOOTPS_PORT
Definition
dhcp.hpp:46
openvpn::DHCP::BOOTPC_PORT
@ BOOTPC_PORT
Definition
dhcp.hpp:47
openvpn::DHCP::DHCPDISCOVER
@ DHCPDISCOVER
Definition
dhcp.hpp:36
openvpn::DHCP::hops
std::uint8_t hops
Definition
dhcp.hpp:57
openvpn::DHCP::hlen
std::uint8_t hlen
Definition
dhcp.hpp:56
openvpn::DHCP::op
std::uint8_t op
Definition
dhcp.hpp:54
openvpn::DHCP::xid
std::uint32_t xid
Definition
dhcp.hpp:58
openvpn::EthHeader
Definition
eth.hpp:24
openvpn::IPv4Header
Definition
ip4.hpp:24
openvpn::UDPHeader
Definition
udp.hpp:25
udp.hpp
openvpn
ip
dhcp.hpp
Generated by
1.9.8