Librasta & Libsci
A C implementation of the RaSTA protocol stack
Typedefs | Functions
rasta.h File Reference
#include <stdbool.h>
#include <stddef.h>
#include "config.h"
#include "events.h"
#include "notification.h"
#include "rastarole.h"
Include dependency graph for rasta.h:

Go to the source code of this file.

Typedefs

typedef struct rasta rasta
 
typedef struct rasta_connection rasta_connection
 
typedef struct rasta_cancellation rasta_cancellation
 

Functions

rastarasta_lib_init_configuration (rasta_config_info *config, log_level log_level, logger_type logger_type)
 
bool rasta_bind (rasta *r)
 
void rasta_listen (rasta *r)
 
rasta_connectionrasta_accept (rasta *r)
 
rasta_cancellationrasta_prepare_cancellation (rasta *r)
 
rasta_connectionrasta_accept_with_cancel (rasta *r, rasta_cancellation *cancel)
 
void rasta_cancel_operation (rasta *r, rasta_cancellation *cancel)
 
rasta_connectionrasta_connect (rasta *r)
 
int rasta_recv (rasta *r, rasta_connection *connection, void *buf, size_t len)
 
int rasta_send (rasta *r, rasta_connection *connection, void *buf, size_t len)
 
void rasta_disconnect (rasta_connection *connection)
 
void rasta_cleanup (rasta *r)
 

Typedef Documentation

◆ rasta

typedef struct rasta rasta

◆ rasta_cancellation

◆ rasta_connection

Function Documentation

◆ rasta_accept()

rasta_connection* rasta_accept ( rasta r)

Wait for incoming connections.

Parameters
rastathe user configuration containing the socket information

◆ rasta_accept_with_cancel()

rasta_connection* rasta_accept_with_cancel ( rasta r,
rasta_cancellation cancel 
)

Wait for incoming connections with the ability to cancel from another thread.

Parameters
rastathe user configuration containing the socket information

◆ rasta_bind()

bool rasta_bind ( rasta r)

binds a RaSTA instance to the configured IP addresses and ports for the transport channels

Parameters
rastathe user configuration to be used

◆ rasta_cancel_operation()

void rasta_cancel_operation ( rasta r,
rasta_cancellation cancel 
)

Performs cancellation of a blocking operation.

◆ rasta_cleanup()

void rasta_cleanup ( rasta r)

Cleanup a connection after a disconnect and free assigned ressources. Always use this when a programm terminates, otherwise it may not start again.

Parameters
rastathe RaSTA lib configuration

◆ rasta_connect()

rasta_connection* rasta_connect ( rasta r)

Connect to another rasta instance

Parameters
rastathe user configuration of the local RaSTA instance
idthe ID of the remote RaSTA instance to connect to

◆ rasta_disconnect()

void rasta_disconnect ( rasta_connection connection)

disconnect a connection on request by the user

Parameters
connectionthe connection that should be disconnected

◆ rasta_lib_init_configuration()

rasta* rasta_lib_init_configuration ( rasta_config_info config,
log_level  log_level,
logger_type  logger_type 
)

initializes the RaSTA handle and all configured connections

Parameters
rastathe user configuration containing the handle to initialize
configthe configuration to initialize the handle with
loggerthe logger to use

◆ rasta_listen()

void rasta_listen ( rasta r)

Listen on all sockets specified by the given RaSTA handle.

Parameters
rastathe user configuration containing the socket information

◆ rasta_prepare_cancellation()

rasta_cancellation* rasta_prepare_cancellation ( rasta r)

Prepares cancellation of a blocking operation.

◆ rasta_recv()

int rasta_recv ( rasta r,
rasta_connection connection,
void *  buf,
size_t  len 
)

Receive data on a given RaSTA connection

Parameters
rastathe user configuration of the local RaSTA instance
connectionthe connection from which to receive the data
bufthe buffer into which to save the received data
lenthe size of buf in bytes

◆ rasta_send()

int rasta_send ( rasta r,
rasta_connection connection,
void *  buf,
size_t  len 
)

Send data on a given RaSTA connection

Parameters
rastathe user configuration of the local RaSTA instance
connectionthe connection on which to send the data
bufthe buffer from which to read the data to be sent
lenthe size of buf in bytes