#include <datagram.h>
Public Member Functions | |
| datagram (kernel::module &module) | |
| virtual | ~datagram () |
| virtual void | started (void) |
| virtual void | shutdown (void) |
| void | stop (void) |
| void | set_timer (uint64_t milliseconds) |
| virtual void | timer_expired (void) |
| void | run_now (void) |
| virtual void | run (void) |
| virtual size_t | receive (uint8_t *buffer, size_t size, struct sockaddr &peer, socklen_t peer_size)=0 |
| void | consume (size_t size) |
| size_t | send (uint8_t *buffer, size_t size, const struct sockaddr &peer, socklen_t peer_size) |
| size_t | send (uint8_t *buffer, size_t size) |
| virtual void | flush_send (void)=0 |
Protected Attributes | |
| kernel::module & | _module |
Private Member Functions | |
| datagram (const datagram &) | |
| datagram & | operator= (const datagram &) |
Private Attributes | |
| datagram_provider * | _datagram_provider |
Friends | |
| class | datagram_provider |
This is the base class for classes using datagrams.
Definition at line 48 of file datagram.h.
| scalestack::network::datagram::datagram | ( | kernel::module & | module | ) | [inline] |
Reimplemented in scalestack::echo::server::datagram.
Definition at line 286 of file datagram.h.
| scalestack::network::datagram::~datagram | ( | ) | [inline, virtual] |
Reimplemented in scalestack::echo::flood::datagram.
Definition at line 292 of file datagram.h.
| scalestack::network::datagram::datagram | ( | const datagram & | ) | [private] |
Don't allow copying of objects.
| void scalestack::network::datagram::started | ( | void | ) | [inline, virtual] |
See event::handler::started().
Reimplemented in scalestack::echo::flood::datagram.
Definition at line 296 of file datagram.h.
| void scalestack::network::datagram::shutdown | ( | void | ) | [inline, virtual] |
See event::handler::shutdown().
Definition at line 300 of file datagram.h.
| void scalestack::network::datagram::stop | ( | void | ) | [inline] |
Definition at line 305 of file datagram.h.
| void scalestack::network::datagram::set_timer | ( | uint64_t | milliseconds | ) | [inline] |
See event::handler::set_timer().
Definition at line 310 of file datagram.h.
| void scalestack::network::datagram::timer_expired | ( | void | ) | [inline, virtual] |
See event::handler::timer_expired().
Definition at line 315 of file datagram.h.
| void scalestack::network::datagram::run_now | ( | void | ) | [inline] |
See event::handler::run_now().
Definition at line 319 of file datagram.h.
| void scalestack::network::datagram::run | ( | void | ) | [inline, virtual] |
Definition at line 324 of file datagram.h.
| virtual size_t scalestack::network::datagram::receive | ( | uint8_t * | buffer, | |
| size_t | size, | |||
| struct sockaddr & | peer, | |||
| socklen_t | peer_size | |||
| ) | [pure virtual] |
This is called when data has been received and needs to be handled by derived classes.
| [in] | buffer | Data that was read. |
| [in] | size | Size of data available in buffer. |
| [in] | peer | Socket address the packet was received from. |
| [in] | peer_size | Socket address length. |
Implemented in scalestack::echo::flood::datagram, and scalestack::echo::server::datagram.
| void scalestack::network::datagram::consume | ( | size_t | size | ) | [inline] |
Notify the socket that the receive buffer has been consumed. This is required after a receive() call was not able to consume all the data. This can be called at a later time to remove the data from the read buffer, such as in flush_send(). After the receive buffer has been flushed, the socket will start watching for new data.
| [in] | size | The amount of data to consume. |
Definition at line 328 of file datagram.h.
| size_t scalestack::network::datagram::send | ( | uint8_t * | buffer, | |
| size_t | size, | |||
| const struct sockaddr & | peer, | |||
| socklen_t | peer_size | |||
| ) | [inline] |
Send data to the socket. This is not buffered. If data could not be written, flush_send() will be called when the socket is ready for writing.
| [in] | buffer | Buffer to write. |
| [in] | size | Size of buffer. |
| [in] | peer | Socket address to send to. |
| [in] | peer_size | Socket address length. |
Definition at line 333 of file datagram.h.
| size_t scalestack::network::datagram::send | ( | uint8_t * | buffer, | |
| size_t | size | |||
| ) | [inline] |
Same as send(), but use the peer address this datagram was created with. or was last set to with set_peer().
| [in] | buffer | Buffer to write. |
| [in] | size | Size of buffer. |
Definition at line 341 of file datagram.h.
| virtual void scalestack::network::datagram::flush_send | ( | void | ) | [pure virtual] |
This is called to notify derived classes that they should trying sending data again by calling send(). This is called when the socket is ready for writing after a call to send() could not write data.
Implemented in scalestack::echo::flood::datagram, and scalestack::echo::server::datagram.
Don't allow assignment of objects.
friend class datagram_provider [friend] |
Definition at line 168 of file datagram.h.
kernel::module& scalestack::network::datagram::_module [protected] |
Definition at line 152 of file datagram.h.
Definition at line 166 of file datagram.h.
1.6.3