Diag-Client-Lib
|
Class used to create a udp socket for handling transmission and reception of udp message from driver. More...
#include <udp_socket_handler.h>
Public Types | |
using | PortType = boost_support::socket::udp::UdpClientSocket::PortType |
Type alias for port type. More... | |
using | UdpMessage = boost_support::socket::udp::UdpMessage |
Type alias for Udp message. More... | |
using | UdpMessagePtr = boost_support::socket::udp::UdpMessagePtr |
Type alias for Udp message pointer. More... | |
using | UdpMessageConstPtr = boost_support::socket::udp::UdpMessageConstPtr |
Type alias for Udp message const pointer. More... | |
using | DoipUdpChannel = channel::udp_channel::DoipUdpChannel |
Type alias for Udp message. More... | |
Public Member Functions | |
UdpSocketHandler (std::string_view local_ip_address, std::uint16_t port_num, PortType port_type, DoipUdpChannel &channel) | |
Constructs an instance of UdpSocketHandler. More... | |
~UdpSocketHandler ()=default | |
Destruct an instance of UdpSocketHandler. More... | |
void | Start () |
Function to start the socket handler. More... | |
void | Stop () |
Function to stop the socket handler. More... | |
core_type::Result< void > | Transmit (UdpMessageConstPtr udp_message) |
Function to transmit the provided udp message. More... | |
Private Types | |
using | UdpSocket = boost_support::socket::udp::UdpClientSocket |
Type alias for tcp client socket. More... | |
Private Attributes | |
std::string | local_ip_address_ |
Store the local ip address. More... | |
std::uint16_t | local_port_num_ |
Store the local port number. More... | |
UdpSocket::PortType | port_type_ |
Store the port type. More... | |
std::unique_ptr< UdpSocket > | udp_socket_ |
Store the socket object. More... | |
DoipUdpChannel & | channel_ |
Store the reference to tcp channel. More... | |
Class used to create a udp socket for handling transmission and reception of udp message from driver.
Definition at line 30 of file udp_socket_handler.h.
Type alias for Udp message.
Definition at line 55 of file udp_socket_handler.h.
using doip_client::sockets::UdpSocketHandler::PortType = boost_support::socket::udp::UdpClientSocket::PortType |
Type alias for port type.
Definition at line 35 of file udp_socket_handler.h.
Type alias for Udp message.
Definition at line 40 of file udp_socket_handler.h.
using doip_client::sockets::UdpSocketHandler::UdpMessageConstPtr = boost_support::socket::udp::UdpMessageConstPtr |
Type alias for Udp message const pointer.
Definition at line 50 of file udp_socket_handler.h.
using doip_client::sockets::UdpSocketHandler::UdpMessagePtr = boost_support::socket::udp::UdpMessagePtr |
Type alias for Udp message pointer.
Definition at line 45 of file udp_socket_handler.h.
|
private |
Type alias for tcp client socket.
Definition at line 95 of file udp_socket_handler.h.
doip_client::sockets::UdpSocketHandler::UdpSocketHandler | ( | std::string_view | local_ip_address, |
std::uint16_t | port_num, | ||
PortType | port_type, | ||
DoipUdpChannel & | channel | ||
) |
Constructs an instance of UdpSocketHandler.
[in] | local_ip_address | The local ip address |
[in] | channel | The reference to tcp transport handler |
Definition at line 15 of file udp_socket_handler.cpp.
References channel_, boost_support::socket::udp::UdpClientSocket::kUdp_Broadcast, local_ip_address_, local_port_num_, port_type_, doip_client::channel::udp_channel::DoipUdpChannel::ProcessReceivedUdpBroadcast(), doip_client::channel::udp_channel::DoipUdpChannel::ProcessReceivedUdpUnicast(), and udp_socket_.
|
default |
Destruct an instance of UdpSocketHandler.
void doip_client::sockets::UdpSocketHandler::Start | ( | ) |
Function to start the socket handler.
Definition at line 33 of file udp_socket_handler.cpp.
References udp_socket_.
Referenced by doip_client::channel::udp_channel::DoipUdpChannel::Start().
void doip_client::sockets::UdpSocketHandler::Stop | ( | ) |
Function to stop the socket handler.
Definition at line 35 of file udp_socket_handler.cpp.
References udp_socket_.
Referenced by doip_client::channel::udp_channel::DoipUdpChannel::Stop().
core_type::Result< void > doip_client::sockets::UdpSocketHandler::Transmit | ( | UdpMessageConstPtr | udp_message | ) |
Function to transmit the provided udp message.
[in] | udp_message | The udp message |
Definition at line 37 of file udp_socket_handler.cpp.
References doip_client::error_domain::kGenericError, doip_client::error_domain::MakeErrorCode(), and udp_socket_.
|
private |
Store the reference to tcp channel.
Definition at line 120 of file udp_socket_handler.h.
Referenced by UdpSocketHandler().
|
private |
Store the local ip address.
Definition at line 100 of file udp_socket_handler.h.
Referenced by UdpSocketHandler().
|
private |
Store the local port number.
Definition at line 105 of file udp_socket_handler.h.
Referenced by UdpSocketHandler().
|
private |
Store the port type.
Definition at line 110 of file udp_socket_handler.h.
Referenced by UdpSocketHandler().
|
private |
Store the socket object.
Definition at line 115 of file udp_socket_handler.h.
Referenced by Start(), Stop(), Transmit(), and UdpSocketHandler().