Hybrid ICN (hICN) plugin  v21.06-rc0-4-g18fa668
Typedefs | Functions
connection.h File Reference

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>
Include dependency graph for connection.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct connection Connection
 

Functions

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)
 
IoOperationsconnection_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)
 

Detailed Description

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.

Function Documentation

◆ 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]connThe Connection to analyze
Returns
non-null An opaque pointer for each concrete implementation

◆ connection_Create()

Connection* connection_Create ( IoOperations ops)

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]connectionThe 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]connectionThe 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]connectionThe 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]connectionThe allocated connection
Return values
trueThe connection is local or loopback
falseThe 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]connectionThe 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