Wrapper for different types of connections.
More...
#include <hicn/hicn-light/config.h>
#include <hicn/core/connectionState.h>
#include <hicn/io/ioOperations.h>
#include <hicn/utils/address.h>
Go to the source code of this file.
|
|
typedef struct connection | Connection |
| |
|
| Connection * | connection_Create (IoOperations *ops) |
| |
| void | connection_Release (Connection **connectionPtr) |
| |
| Connection * | connection_Acquire (Connection *connection) |
| |
| bool | connection_Send (const Connection *conn, Message *message) |
| |
| bool | connection_SendIOVBuffer (const Connection *conn, struct iovec *msg, size_t size) |
| |
| bool | connection_SendBuffer (const Connection *conn, u8 *buffer, size_t length) |
| |
| IoOperations * | connection_GetIoOperations (const Connection *conn) |
| |
| unsigned | connection_GetConnectionId (const Connection *conn) |
| |
| const AddressPair * | connection_GetAddressPair (const Connection *conn) |
| |
| bool | connection_IsUp (const Connection *conn) |
| |
| bool | connection_IsLocal (const Connection *conn) |
| |
| const void * | connection_Class (const Connection *conn) |
| |
|
bool | connection_ReSend (const Connection *conn, Message *message, bool notification) |
| |
|
void | connection_Probe (Connection *conn, uint8_t *probe) |
| |
|
void | connection_HandleProbe (Connection *conn, uint8_t *message) |
| |
|
void | connection_AllowWldrAutoStart (Connection *conn, bool allow) |
| |
|
void | connection_EnableWldr (Connection *conn) |
| |
|
void | connection_DisableWldr (Connection *conn) |
| |
|
bool | connection_HasWldr (const Connection *conn) |
| |
|
bool | connection_WldrAutoStartAllowed (const Connection *conn) |
| |
|
void | connection_DetectLosses (Connection *conn, Message *message) |
| |
|
void | connection_HandleWldrNotification (Connection *conn, Message *message) |
| |
|
connection_state_t | connection_GetState (const Connection *conn) |
| |
|
void | connection_SetState (Connection *conn, connection_state_t state) |
| |
|
connection_state_t | connection_GetAdminState (const Connection *conn) |
| |
|
void | connection_SetAdminState (Connection *conn, connection_state_t admin_state) |
| |
|
const char * | connection_GetInterfaceName (const Connection *conn) |
| |
Wrapper for different types of connections.
A connection wraps a specific set of IoOperations. Those operations allow for input and output. Connections get stored in the Connection Table.
◆ connection_Acquire()
| Connection* connection_Acquire |
( |
Connection * |
connection | ) |
|
@function connection_Acquire @abstract A reference counted copy. @discussion A shallow copy, they share the same memory.
◆ connection_Class()
| const void* connection_Class |
( |
const Connection * |
conn | ) |
|
Returns an opaque pointer representing the class of the Io Operations
Returns an opaque pointer that an implementation can use to detect if the connection is based on that class.
- Parameters
-
| [in] | conn | The Connection to analyze |
- Returns
- non-null An opaque pointer for each concrete implementation
◆ connection_Create()
Creates a connection object.
◆ connection_GetAddressPair()
| const AddressPair* connection_GetAddressPair |
( |
const Connection * |
conn | ) |
|
Returns the (remote, local) address pair that describes the connection
- Parameters
-
| [in] | connection | The allocated connection |
- Returns
- non-null The connection's remote and local address
-
null Should never return NULL
◆ connection_GetConnectionId()
| unsigned connection_GetConnectionId |
( |
const Connection * |
conn | ) |
|
Returns the unique identifier of the connection Calls the underlying IoOperations to fetch the connection id
- Parameters
-
| [in] | connection | The allocated connection |
- Returns
- unsigned The unique connection id
◆ connection_GetIoOperations()
| IoOperations* connection_GetIoOperations |
( |
const Connection * |
conn | ) |
|
Return the IoOperations instance associated with the specified Connection instance.
- Parameters
-
| [in] | connection | The allocated connection |
- Returns
- a pointer to the IoOperations instance associated by th specified connection.
◆ connection_IsLocal()
| bool connection_IsLocal |
( |
const Connection * |
conn | ) |
|
Checks if the connection is to a Local/Loopback address
A local connection is PF_LOCAL (PF_UNIX) and a loopback connection is 127.0.0.0/8 or ::1 for IPv6.
- Parameters
-
| [in] | connection | The allocated connection |
- Return values
-
| true | The connection is local or loopback |
| false | The connection is not local or loopback |
◆ connection_IsUp()
| bool connection_IsUp |
( |
const Connection * |
conn | ) |
|
Checks if the connection is in the "up" state
- Parameters
-
| [in] | connection | The allocated connection |
- Returns
- true The connection is in the "up" state
-
false The connection is not in the "up" state
◆ connection_Release()
| void connection_Release |
( |
Connection ** |
connectionPtr | ) |
|
@function connection_Release @abstract Releases a reference count, destroying on last release @discussion Only frees the memory on the final reference count. The pointer will always be NULL'd.
◆ connection_Send()
| bool connection_Send |
( |
const Connection * |
conn, |
|
|
Message * |
message |
|
) |
| |
@function connection_Send @abstract Sends the message on the connection
- Returns
- true if message sent, false if connection not up
◆ connection_SendBuffer()
| bool connection_SendBuffer |
( |
const Connection * |
conn, |
|
|
u8 * |
buffer, |
|
|
size_t |
length |
|
) |
| |
@function connection_SendBuffer @abstract Sends a buffer
◆ connection_SendIOVBuffer()
| bool connection_SendIOVBuffer |
( |
const Connection * |
conn, |
|
|
struct iovec * |
msg, |
|
|
size_t |
size |
|
) |
| |
@function connection_SendIOVBuffer @abstract Sends an IOV buffer