Represents a single CListener from a client.
#include <CListener.hpp>
|
boost::asio::ip::udp::socket & | GetSocket () |
| Gets the listener socket. More...
|
|
void | Start (boost::asio::ip::udp::endpoint &endpoint) |
| Bind the listener to the specified endpoint and listen for datagrams. More...
|
|
void | Stop () |
| Stop any current async read and close the socket. More...
|
|
|
| CListener () |
| Private constructor for the singleton instance. More...
|
|
void | HandleRead (const boost::system::error_code &e, std::size_t bytes_transferred) |
| Handle completion of a read operation. More...
|
|
void | ScheduleListen () |
| Asynchronously listen for a new message. More...
|
|
freedm::broker::CListener::CListener |
( |
| ) |
|
|
private |
CListener::CListener
- Description:
- Constructor. Creates the socket that will be used to listen for incoming messages.
- Precondition:
- None.
- Postcondition:
- A socket is created using the Broker's io service.
boost::asio::ip::udp::socket& freedm::broker::CListener::GetSocket |
( |
| ) |
|
|
inline |
void freedm::broker::CListener::HandleRead |
( |
const boost::system::error_code & |
e, |
|
|
std::size_t |
bytes_transferred |
|
) |
| |
|
private |
CListener::HandleRead
- Description:
- The callback which accepts messages from the remote sender.
- Parameters
-
e | The errorcode if any associated. |
bytes_transferred | The size of the datagram being read. |
- Precondition:
- The connection has had start called and some message has been placed in the buffer by the receive call.
- Postcondition:
- The message is scheduled for delivery by the dispatcher to one or more modules. The message has been processed by the CConnection that manages messages between this process and the sender. ScheduleListen() is waiting for another datagram to arrive.
We can make the remote host from the endpoint:
Make sure the hostname is registered:
Get the pointer to the connection:
CListener & freedm::broker::CListener::Instance |
( |
| ) |
|
|
static |
void freedm::broker::CListener::ScheduleListen |
( |
| ) |
|
|
private |
CListener::ScheduleListen
- Description:
- Makes a call to the Broker's ioservice and requests that the HandleRead function is called when a datagram arrives on the Listener's socket.
- Precondition:
- The m_socket is bound to an endpoint
- Postcondition:
- HandleRead will be called when a datagram arrives at the socket
void freedm::broker::CListener::Start |
( |
boost::asio::ip::udp::endpoint & |
endpoint | ) |
|
CListener::Start
- Description:
- Causes the listener to start listening for new messages
- Precondition:
- endpoint is a valid endpoint for the lister to listen on
- Postcondition:
- The listener is not listening for incoming messages on the socket bound to endpoint
- Parameters
-
endpoint | the endpoint for the listener to listen on |
void freedm::broker::CListener::Stop |
( |
| ) |
|
CListener::Stop
- Description:
- Closes the listening socket.
- Precondition:
- None
- Postcondition:
- The socket used to listen for messages is closed.
boost::asio::ip::udp::endpoint freedm::broker::CListener::m_recv_from |
|
private |
boost::asio::ip::udp::socket freedm::broker::CListener::m_socket |
|
private |
The documentation for this class was generated from the following files:
- /home/docs/checkouts/readthedocs.org/user_builds/freedm/checkouts/latest/Broker/src/CListener.hpp
- /home/docs/checkouts/readthedocs.org/user_builds/freedm/checkouts/latest/Broker/src/CListener.cpp