Kea 2.7.5
|
This class implements the communication between the DHCPv4 and DHCPv6 servers to allow for transmission of the DHCPv4 query and DHCPv4 response messages. More...
#include <dhcp4o6_ipc.h>
Public Types | |
enum | EndpointType { ENDPOINT_TYPE_V4 = 4 , ENDPOINT_TYPE_V6 = 6 } |
Endpoint type: DHCPv4 or DHCPv6 server. More... | |
Public Member Functions | |
void | close () |
Close communication socket. | |
virtual void | open ()=0 |
Open communication socket (for derived classes). | |
Pkt6Ptr | receive () |
Receive message over IPC. | |
void | send (const Pkt6Ptr &pkt) |
Send message over IPC. | |
Protected Member Functions | |
Dhcp4o6IpcBase () | |
Constructor. | |
virtual | ~Dhcp4o6IpcBase () |
Destructor. | |
int | open (uint16_t port, EndpointType endpoint_type) |
Open communication socket (from base class). | |
Protected Attributes | |
uint16_t | port_ |
Port number configured for IPC communication. | |
int | socket_fd_ |
Socket descriptor. | |
This class implements the communication between the DHCPv4 and DHCPv6 servers to allow for transmission of the DHCPv4 query and DHCPv4 response messages.
When the DHCPv6 server receives the DHCPv4 query message it needs to forward it to the DHCPv4 server for processing. The DHCPv4 server processes the message and answers with the DHCPv4 response message to the DHCPv6 server. The server forwards it back to the client. This class implements the communication between the DHCPv4 and DHCPv6 servers to allow for transmission of the DHCPv4 query and DHCPv6 response messages.
This class creates a socket (when open
is called) and binds it to a port, depending on the configuration. The port number is explicitly specified in the server configuration. This explicit port value is used directly on the DHCPv6 server side. The DHCPv4 server uses the port specified + 1.
The DHCPv4 and DHCPv6 servers use distinct instances of classes derived from this base class. Each of these instances is used to send and receive messages sent by the other server.
In order to make address allocation decisions, the DHCPv4 server requires information about the interface and the source address of the original DHCPv4 query message sent by the client. This information is known by the DHCPv6 server and needs to be conveyed to the DHCPv4 server. The IPC conveys it in the ISC_V6_4O6_INTERFACE
, ISC_V6_4O6_SRC_ADDRESS
and ISC_V6_4O6_SRC_PORT
options within the Vendor Specific Information option, with ISC enterprise id. These options are added by the IPC sender and removed by the IPC receiver.
Definition at line 61 of file dhcp4o6_ipc.h.
Endpoint type: DHCPv4 or DHCPv6 server.
Enumerator | |
---|---|
ENDPOINT_TYPE_V4 | |
ENDPOINT_TYPE_V6 |
Definition at line 65 of file dhcp4o6_ipc.h.
|
protected |
|
protectedvirtual |
Destructor.
Definition at line 35 of file dhcp4o6_ipc.cc.
References close().
void isc::dhcp::Dhcp4o6IpcBase::close | ( | ) |
Close communication socket.
Definition at line 118 of file dhcp4o6_ipc.cc.
References close(), isc::dhcp::IfaceMgr::instance(), port_, and socket_fd_.
Referenced by ~Dhcp4o6IpcBase(), close(), isc::dhcp::Dhcp4to6Ipc::open(), isc::dhcp::Dhcp6to4Ipc::open(), and open().
|
pure virtual |
Open communication socket (for derived classes).
Implemented in isc::dhcp::Dhcp4to6Ipc, and isc::dhcp::Dhcp6to4Ipc.
Referenced by isc::dhcp::Dhcp4to6Ipc::open(), and isc::dhcp::Dhcp6to4Ipc::open().
|
protected |
Open communication socket (from base class).
port | Port number to use. The socket is bound to this port if the endpoint type is DHCPv6 server, otherwise the port + 1 value is used. |
endpoint_type | Endpoint type (DHCPv4 or DHCPv6 server). |
isc::dhcp::Dhcp4o6IpcError | on system call errors. |
Definition at line 39 of file dhcp4o6_ipc.cc.
References close(), ENDPOINT_TYPE_V6, isc_throw, port_, and socket_fd_.
Pkt6Ptr isc::dhcp::Dhcp4o6IpcBase::receive | ( | ) |
Receive message over IPC.
isc::dhcp::Dhcp4o6IpcError | on system call error or malformed packets. |
Definition at line 127 of file dhcp4o6_ipc.cc.
References D6O_VENDOR_OPTS, isc::dhcp::DHCPSRV_DHCP4O6_RECEIVED_BAD_PACKET, isc::dhcp::dhcpsrv_logger, isc::dhcp::IfaceMgr::instance(), isc_throw, LOG_WARN, and socket_fd_.
void isc::dhcp::Dhcp4o6IpcBase::send | ( | const Pkt6Ptr & | pkt | ) |
Send message over IPC.
The IPC uses ISC_V6_4O6_INTERFACE
, ISC_V6_4O6_SRC_ADDRESS
and ISC_V6_4O6_SRC_PORT
options conveyed within the Vendor Specific Information option, with ISC enterprise id, to communicate the client remote address and the interface on which the DHCPv4 query was received. These options will be removed by the receiver.
pkt | Pointer to a DHCPv6 message with interface and remote address. |
isc::dhcp::Dhcp4o6IpcError. |
Definition at line 225 of file dhcp4o6_ipc.cc.
References isc::util::OutputBuffer::clear(), D6O_VENDOR_OPTS, isc_throw, send(), socket_fd_, and isc::dhcp::Option::V6.
Referenced by send().
|
protected |
Port number configured for IPC communication.
Definition at line 122 of file dhcp4o6_ipc.h.
|
protected |
Socket descriptor.
Definition at line 125 of file dhcp4o6_ipc.h.
Referenced by close(), isc::dhcp::Dhcp4to6Ipc::open(), isc::dhcp::Dhcp6to4Ipc::open(), open(), receive(), and send().