kinetic-c  v0.12.0
Seagate Kinetic Protocol Client Library for C
Functions
bus.h File Reference
#include "bus_types.h"
#include "bus_inward.h"

Go to the source code of this file.

Functions

bool Bus_Init (bus_config *config, struct bus_result *res)
 Initialize a bus, based on configuration in *config. More...
 
bool Bus_SendRequest (struct bus *b, bus_user_msg *msg)
 Send a request. More...
 
bool Bus_RegisterSocket (struct bus *b, bus_socket_t type, int fd, void *socket_udata)
 Register a socket connected to an endpoint, and data that will be passed to all interactions on that socket. More...
 
bool Bus_ReleaseSocket (struct bus *b, int fd, void **socket_udata_out)
 Free metadata about a socket that has been disconnected. More...
 
bool Bus_Shutdown (struct bus *b)
 Begin shutting the system down. More...
 
void Bus_Free (struct bus *b)
 Free internal data structures for the bus. More...
 

Function Documentation

bool Bus_Init ( bus_config config,
struct bus_result res 
)
bool Bus_SendRequest ( struct bus b,
bus_user_msg msg 
)

Send a request.

Blocks until the request has been transmitted.

Assumes the FD has been registered with Bus_register_socket; sending to an unregistered socket is an error.

Returns true if the request has been accepted and the bus will attempt to handle the request and response. They can still fail, but the error status will be passed to the result handler callback.

Returns false if the request has been rejected, due to a memory allocation error or invalid arguments.

Definition at line 297 of file bus.c.

References box_msg(), BUS_LOG_SNPRINTF, bus_user_msg::fd, LOG_SENDING_REQUEST, Send_DoBlockingSend(), bus_user_msg::seq_id, and bus::udata.

bool Bus_RegisterSocket ( struct bus b,
bus_socket_t  type,
int  fd,
void *  socket_udata 
)

Register a socket connected to an endpoint, and data that will be passed to all interactions on that socket.

The socket will have request -> response messages with timeouts, as well as unsolicited status messages.

If USES_SSL is true, then the function will block until the initial SSL/TLS connection handshake has completed.

Definition at line 350 of file bus.c.

References BUS_LOG, BUS_LOG_SNPRINTF, BUS_NO_SEQ_ID, BUS_NO_SSL, BUS_SOCKET_SSL, BusPoll_OnCompletion(), BusSSL_Connect(), connection_info::fd, bus::fd_set, bus::fd_set_lock, connection_info::largest_wr_seq_id_seen, Listener_AddSocket(), listener_id_of_socket(), bus::listeners, LOG_SOCKET_REGISTERED, connection_info::ssl, connection_info::type, bus::udata, connection_info::udata, and Yacht_Set().

bool Bus_ReleaseSocket ( struct bus b,
int  fd,
void **  socket_udata_out 
)
bool Bus_Shutdown ( struct bus b)
void Bus_Free ( struct bus b)