|
AES-DH Implementation
|
The namespace for communication along a socket. More...
Classes | |
| struct | packet |
Enumerations | |
| enum | meta { ERROR , EMPTY , DATA , HMAC , NONCE , IV , FINAL , MESSAGE , ACK , REFUSED , REEXCHANGE } |
Functions | |
| int | send_packet (const packet &p, const size_t &timeout=5) |
| Send a packet. | |
| packet | recv_packet (const size_t &timeout=5) |
| Receive a packet. | |
| template<typename T > | |
| int | send_value (const T &value, const network::meta &type=DATA, const size_t &timeout=5) |
| Send a value. | |
| template<typename T > | |
| const T | recv_value (const size_t &timeout=5) |
| Receive a value. | |
| int | send_string (const std::string &message, const network::meta &type=DATA, const size_t &timeout=5) |
| Send a string of any size. | |
| std::string | recv_string (const size_t &timeout=5) |
| Receive a string. | |
| void | get_client (const int &port) |
| Listen on the socket for a client to initiate a connection. | |
| void | get_server (const size_t &port, const char address[]="127.0.0.1") |
| Try and connect to the server. | |
Variables | |
| int | sock = -1 |
| The FD sock for when the program is in Listen mode. | |
| int | connection = -1 |
| the FD sock that peers communicate over. | |
The namespace for communication along a socket.
| void network::get_client | ( | const int & | port | ) |
Listen on the socket for a client to initiate a connection.
| port | The port to listen on. |
| void network::get_server | ( | const size_t & | port, |
| const char | address[] = "127.0.0.1" ) |
Try and connect to the server.
| port | The port to connect to |
| address | The address of the server |
| packet network::recv_packet | ( | const size_t & | timeout = 5 | ) |
Receive a packet.
| timeout | How long to wait (seconds) before throwing an error. |
|
inline |
Receive a string.
| timeout | A listening timeout before aborting. |
|
inline |
Receive a value.
| T | The datatype of the value. |
| timeout | A listening timeout before aborting. |
| std::runtime_error | if an ERROR packet is sent. |
| int network::send_packet | ( | const packet & | p, |
| const size_t & | timeout = 5 ) |
Send a packet.
| p | The packet to send. |
| timeout | How long to wait (seconds) before throwing an error. |
|
inline |
Send a string of any size.
| message | The string to send. |
| type | Whether you want to tag this data with something other than DATA. |
| timeout | A listening timeout before aborting. |
|
inline |
Send a value.
| T | The datatype of the value. |
| value | The value to send. |
| type | Whether to tag the data with something. |
| timeout | A listening timeout before aborting. |
| int network::sock = -1 |
The FD sock for when the program is in Listen mode.