![]() |
kinetic-c
v0.12.0
Seagate Kinetic Protocol Client Library for C
|
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... | |
bool Bus_Init | ( | bus_config * | config, |
struct bus_result * | res | ||
) |
Initialize a bus, based on configuration in *config.
Returns a bool indicating whether the construction succeeded, and the bus pointer and/or a status code indicating the cause of failure in *res.
Definition at line 64 of file bus.c.
References attempt_to_increase_resource_limits(), bus_result::bus, BUS_INIT_ERROR_ALLOC_FAIL, BUS_INIT_ERROR_LISTENER_INIT_FAIL, BUS_INIT_ERROR_MISSING_SINK_CB, BUS_INIT_ERROR_MISSING_UNPACK_CB, BUS_INIT_ERROR_MUTEX_INIT_FAIL, BUS_INIT_ERROR_NULL, BUS_INIT_ERROR_PTHREAD_INIT_FAIL, BUS_INIT_ERROR_THREADPOOL_INIT_FAIL, BUS_LOG, BUS_LOG_SNPRINTF, bus_config::bus_udata, BusSSL_Init(), DEF_FD_SET_SIZE2, bus::error_cb, bus_config::error_cb, bus::fd_set, bus::fd_set_lock, bus::joined, bus::listener_count, bus_config::listener_count, Listener_Free(), Listener_Init(), bus::listeners, ListenerTask_MainLoop(), bus::log_cb, bus_config::log_cb, LOG_INITIALIZATION, bus::log_level, bus_config::log_level, noop_error_cb(), noop_log_cb(), set_defaults(), bus::sink_cb, bus_config::sink_cb, bus_result::status, bus::threadpool, bus_config::threadpool_cfg, Threadpool_Free(), Threadpool_Init(), threadpool::threads, bus::threads, bus::udata, bus::unexpected_msg_cb, bus_config::unexpected_msg_cb, bus::unpack_cb, bus_config::unpack_cb, Yacht_Free(), and Yacht_Init().
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 | ||
) |
Free metadata about a socket that has been disconnected.
Definition at line 420 of file bus.c.
References BUS_LOG_SNPRINTF, BUS_NO_SSL, BusPoll_OnCompletion(), BusSSL_Disconnect(), bus::fd_set, bus::fd_set_lock, listener_id_of_socket(), Listener_RemoveSocket(), bus::listeners, LOG_SOCKET_REGISTERED, connection_info::ssl, bus::udata, connection_info::udata, and Yacht_Remove().
bool Bus_Shutdown | ( | struct bus * | b | ) |
Begin shutting the system down.
Returns true once everything pending has resolved.
Definition at line 494 of file bus.c.
References ATOMIC_BOOL_COMPARE_AND_SWAP, BUS_LOG, BUS_LOG_SNPRINTF, BusPoll_OnCompletion(), bus::fd_set, free_connection_cb(), bus::joined, bus::listener_count, Listener_Shutdown(), bus::listeners, LOG_SHUTDOWN, bus::shutdown_state, SHUTDOWN_STATE_HALTED, SHUTDOWN_STATE_RUNNING, SHUTDOWN_STATE_SHUTTING_DOWN, syscall_pthread_join(), bus::threads, bus::udata, and Yacht_Free().
void Bus_Free | ( | struct bus * | b | ) |
Free internal data structures for the bus.
Definition at line 599 of file bus.c.
References BUS_LOG, BUS_LOG_SNPRINTF, Bus_Shutdown(), BusSSL_CtxFree(), bus::fd_set_lock, bus::joined, limit, bus::listener_count, Listener_Free(), bus::listeners, LOG_SHUTDOWN, bus::shutdown_state, SHUTDOWN_STATE_HALTED, syscall_poll(), THREAD_SHUTDOWN_SECONDS, bus::threadpool, Threadpool_Free(), Threadpool_Shutdown(), bus::threads, and bus::udata.