join 1.0
lightweight network framework library
Loading...
Searching...
No Matches
dhcp_protocol.hpp
Go to the documentation of this file.
1
25#ifndef JOIN_FABRIC_DHCP_PROTOCOL_HPP
26#define JOIN_FABRIC_DHCP_PROTOCOL_HPP
27
28// libjoin.
29#include <join/socket.hpp>
30
31namespace join
32{
33 template <class Protocol>
34 class BasicDhcp;
35
36 template <class Protocol>
38
39 template <class Protocol>
41
45 class Dhcp
46 {
47 public:
48 using Transport = Raw;
49 using Endpoint = typename Transport::Endpoint;
50 using Socket = typename Transport::Socket;
53
57 constexpr Dhcp () noexcept = default;
58
63 constexpr int family () const noexcept
64 {
65 return _transport.family ();
66 }
67
72 constexpr int type () const noexcept
73 {
74 return _transport.type ();
75 }
76
81 constexpr int protocol () const noexcept
82 {
83 return _transport.protocol ();
84 }
85
87 static constexpr uint16_t clientPort = 68;
88
90 static constexpr uint16_t serverPort = 67;
91
93 static constexpr size_t maxMsgSize = 1472;
94
95 private:
97 Transport _transport;
98 };
99
106 constexpr bool operator== (const Dhcp& a, const Dhcp& b) noexcept
107 {
108 return a.family () == b.family ();
109 }
110
117 constexpr bool operator!= (const Dhcp& a, const Dhcp& b) noexcept
118 {
119 return !(a == b);
120 }
121}
122
123#endif
DHCP client.
Definition dhcp_protocol.hpp:37
DHCP server.
Definition dhcp_protocol.hpp:40
carries DHCP messages over a packet socket.
Definition dhcp_protocol.hpp:34
dynamic host configuration protocol class.
Definition dhcp_protocol.hpp:46
typename Transport::Socket Socket
Definition dhcp_protocol.hpp:50
static constexpr uint16_t serverPort
port a server listens on.
Definition dhcp_protocol.hpp:90
typename Transport::Endpoint Endpoint
Definition dhcp_protocol.hpp:49
constexpr int family() const noexcept
get the protocol IP address family.
Definition dhcp_protocol.hpp:63
constexpr int type() const noexcept
get the protocol communication semantic.
Definition dhcp_protocol.hpp:72
static constexpr uint16_t clientPort
port a client listens on.
Definition dhcp_protocol.hpp:87
constexpr Dhcp() noexcept=default
construct the DHCP protocol instance.
static constexpr size_t maxMsgSize
maximum DHCP message size.
Definition dhcp_protocol.hpp:93
constexpr int protocol() const noexcept
get the protocol type.
Definition dhcp_protocol.hpp:81
RAW protocol class.
Definition protocol.hpp:101
constexpr int type() const noexcept
get the protocol communication semantic.
Definition protocol.hpp:125
constexpr int family() const noexcept
get the protocol ip address family.
Definition protocol.hpp:116
BasicLinkLayerEndpoint< Raw > Endpoint
Definition protocol.hpp:103
constexpr int protocol() const noexcept
get the protocol type.
Definition protocol.hpp:134
BasicRawSocket< Raw > Socket
Definition protocol.hpp:104
Definition acceptor.hpp:32
bool operator==(const BasicLinkLayerEndpoint< Protocol > &a, const BasicLinkLayerEndpoint< Protocol > &b) noexcept
compare if endpoints are equal.
Definition endpoint.hpp:186
bool operator!=(const BasicLinkLayerEndpoint< Protocol > &a, const BasicLinkLayerEndpoint< Protocol > &b) noexcept
compare if endpoints are not equal.
Definition endpoint.hpp:198