Client IPC API. More...
#include <qb/qbconfig.h>
#include <pthread.h>
#include <sys/poll.h>
#include <sys/socket.h>
#include <qb/qbhdb.h>
#include <qb/qbipc_common.h>
Typedefs | |
typedef struct qb_ipcc_connection | qb_ipcc_connection_t |
Functions | |
qb_ipcc_connection_t * | qb_ipcc_connect (const char *name, size_t max_msg_size) |
Create a connection to an IPC service. | |
int32_t | qb_ipcc_verify_dgram_max_msg_size (size_t max_msg_size) |
Test kernel dgram socket buffers to verify the largest size up to the max_msg_size value a single msg can be. | |
void | qb_ipcc_disconnect (qb_ipcc_connection_t *c) |
Disconnect an IPC connection. | |
int32_t | qb_ipcc_fd_get (qb_ipcc_connection_t *c, int32_t *fd) |
Get the file descriptor to poll. | |
int32_t | qb_ipcc_fc_enable_max_set (qb_ipcc_connection_t *c, uint32_t max) |
Set the maximum allowable flowcontrol value. | |
ssize_t | qb_ipcc_send (qb_ipcc_connection_t *c, const void *msg_ptr, size_t msg_len) |
Send a message. | |
ssize_t | qb_ipcc_sendv (qb_ipcc_connection_t *c, const struct iovec *iov, size_t iov_len) |
Send a message (iovec). | |
ssize_t | qb_ipcc_recv (qb_ipcc_connection_t *c, void *msg_ptr, size_t msg_len, int32_t ms_timeout) |
Receive a response. | |
ssize_t | qb_ipcc_sendv_recv (qb_ipcc_connection_t *c, const struct iovec *iov, uint32_t iov_len, void *msg_ptr, size_t msg_len, int32_t ms_timeout) |
This is a convenience function that simply sends and then recvs. | |
ssize_t | qb_ipcc_event_recv (qb_ipcc_connection_t *c, void *msg_ptr, size_t msg_len, int32_t ms_timeout) |
Receive an event. | |
void | qb_ipcc_context_set (qb_ipcc_connection_t *c, void *context) |
Associate a "user" pointer with this connection. | |
void * | qb_ipcc_context_get (qb_ipcc_connection_t *c) |
Get the context (set previously). | |
int32_t | qb_ipcc_is_connected (qb_ipcc_connection_t *c) |
Is the connection connected? | |
int32_t | qb_ipcc_get_buffer_size (qb_ipcc_connection_t *c) |
What is the actual buffer size used after the connection. |
Client IPC API.
typedef struct qb_ipcc_connection qb_ipcc_connection_t |
qb_ipcc_connection_t* qb_ipcc_connect | ( | const char * | name, | |
size_t | max_msg_size | |||
) |
Create a connection to an IPC service.
name | name of the service. | |
max_msg_size | biggest msg size. |
void* qb_ipcc_context_get | ( | qb_ipcc_connection_t * | c | ) |
Get the context (set previously).
c | connection instance |
void qb_ipcc_context_set | ( | qb_ipcc_connection_t * | c, | |
void * | context | |||
) |
Associate a "user" pointer with this connection.
context | the point to associate with this connection. | |
c | connection instance |
void qb_ipcc_disconnect | ( | qb_ipcc_connection_t * | c | ) |
ssize_t qb_ipcc_event_recv | ( | qb_ipcc_connection_t * | c, | |
void * | msg_ptr, | |||
size_t | msg_len, | |||
int32_t | ms_timeout | |||
) |
Receive an event.
c | connection instance | |
msg_ptr | pointer to a message buffer to receive into | |
msg_len | the size of the buffer | |
ms_timeout | time in milli seconds to wait for a message 0 == no wait, negative == block, positive == wait X ms. | |
ms_timeout | max time to wait for a response |
int32_t qb_ipcc_fc_enable_max_set | ( | qb_ipcc_connection_t * | c, | |
uint32_t | max | |||
) |
Set the maximum allowable flowcontrol value.
c | connection instance | |
max | the max allowable flowcontrol value (1 or 2) |
int32_t qb_ipcc_fd_get | ( | qb_ipcc_connection_t * | c, | |
int32_t * | fd | |||
) |
Get the file descriptor to poll.
c | connection instance | |
fd | (out) file descriptor to poll |
int32_t qb_ipcc_get_buffer_size | ( | qb_ipcc_connection_t * | c | ) |
What is the actual buffer size used after the connection.
c | connection instance |
connection | size in bytes or -error code |
int32_t qb_ipcc_is_connected | ( | qb_ipcc_connection_t * | c | ) |
Is the connection connected?
c | connection instance |
QB_TRUE | when connected | |
QB_FALSE | when not connected |
ssize_t qb_ipcc_recv | ( | qb_ipcc_connection_t * | c, | |
void * | msg_ptr, | |||
size_t | msg_len, | |||
int32_t | ms_timeout | |||
) |
Receive a response.
c | connection instance | |
msg_ptr | pointer to a message buffer to receive into | |
msg_len | the size of the buffer | |
ms_timeout | max time to wait for a response |
ssize_t qb_ipcc_send | ( | qb_ipcc_connection_t * | c, | |
const void * | msg_ptr, | |||
size_t | msg_len | |||
) |
Send a message.
c | connection instance | |
msg_ptr | pointer to a message to send | |
msg_len | the size of the message |
ssize_t qb_ipcc_sendv | ( | qb_ipcc_connection_t * | c, | |
const struct iovec * | iov, | |||
size_t | iov_len | |||
) |
Send a message (iovec).
c | connection instance | |
iov | pointer to an iovec struct to send | |
iov_len | the number of iovecs used |
ssize_t qb_ipcc_sendv_recv | ( | qb_ipcc_connection_t * | c, | |
const struct iovec * | iov, | |||
uint32_t | iov_len, | |||
void * | msg_ptr, | |||
size_t | msg_len, | |||
int32_t | ms_timeout | |||
) |
This is a convenience function that simply sends and then recvs.
c | connection instance | |
iov | pointer to an iovec struct to send | |
iov_len | the number of iovecs used | |
msg_ptr | pointer to a message buffer to receive into | |
msg_len | the size of the buffer | |
ms_timeout | max time to wait for a response |
int32_t qb_ipcc_verify_dgram_max_msg_size | ( | size_t | max_msg_size | ) |
Test kernel dgram socket buffers to verify the largest size up to the max_msg_size value a single msg can be.
Rounds down to the nearest 1k.
max_msg_size | biggest msg size. |