qbipcs.h.3   qbipcs.h.3 
qbipcs.h(3) libqb qbipcs .h(3) qbipcs.h(3) libqb qbipcs .h(3)
NAME NAME
qbipcs.h - qbipcs.h -
Server IPC API'.
SYNOPSIS SYNOPSIS
#include <stdlib.h> #include <stdlib.h>
#include <qb/qbipc_common.h> #include <qb/qbipc_common.h>
#include <qb/qbhdb.h> #include <qb/qbhdb.h>
#include <qb/qbloop.h> #include <qb/qbloop.h>
Data Structures Data Structures
struct qb_ipcs_stats struct qb_ipcs_stats
struct qb_ipcs_connection_stats struct qb_ipcs_connection_stats
struct qb_ipcs_poll_handlers struct qb_ipcs_poll_handlers
skipping to change at line 27 skipping to change at line 29
Typedefs Typedefs
typedef struct qb_ipcs_connection qb_ipcs_connection_t typedef struct qb_ipcs_connection qb_ipcs_connection_t
typedef struct qb_ipcs_service qb_ipcs_service_t typedef struct qb_ipcs_service qb_ipcs_service_t
typedef int32_t(* qb_ipcs_dispatch_fn_t )(int32_t fd, int32_t revent s, void *data) typedef int32_t(* qb_ipcs_dispatch_fn_t )(int32_t fd, int32_t revent s, void *data)
typedef int32_t(* qb_ipcs_dispatch_add_fn )(enum qb_loop_priority p, int32_t fd, int32_t events, void *data, qb_ipcs_dispatch_fn_t fn) typedef int32_t(* qb_ipcs_dispatch_add_fn )(enum qb_loop_priority p, int32_t fd, int32_t events, void *data, qb_ipcs_dispatch_fn_t fn)
typedef int32_t(* qb_ipcs_dispatch_mod_fn )(enum qb_loop_priority p, int32_t fd, int32_t events, void *data, qb_ipcs_dispatch_fn_t fn) typedef int32_t(* qb_ipcs_dispatch_mod_fn )(enum qb_loop_priority p, int32_t fd, int32_t events, void *data, qb_ipcs_dispatch_fn_t fn)
typedef int32_t(* qb_ipcs_dispatch_del_fn )(int32_t fd) typedef int32_t(* qb_ipcs_dispatch_del_fn )(int32_t fd)
typedef int32_t(* qb_ipcs_job_add_fn )(enum qb_loop_priority p, void *data, qb_loop_job_dispatch_fn dispatch_fn) typedef int32_t(* qb_ipcs_job_add_fn )(enum qb_loop_priority p, void *data, qb_loop_job_dispatch_fn dispatch_fn)
typedef int32_t(* qb_ipcs_connection_accept_fn )(qb_ipcs_connection_ t *c, uid_t uid, gid_t gid) typedef int32_t(* qb_ipcs_connection_accept_fn )(qb_ipcs_connection_ t *c, uid_t uid, gid_t gid)
This callback is to check wether you want to accept a new connec tion. This callback is to check wether you want to accept a new connec tion'.
typedef void(* qb_ipcs_connection_created_fn )(qb_ipcs_connection_t *c) typedef void(* qb_ipcs_connection_created_fn )(qb_ipcs_connection_t *c)
This is called after a new connection has been created. This is called after a new connection has been created'.
typedef int32_t(* qb_ipcs_connection_closed_fn )(qb_ipcs_connection_ t *c) typedef int32_t(* qb_ipcs_connection_closed_fn )(qb_ipcs_connection_ t *c)
This is called after a connection has been disconnected. This is called after a connection has been disconnected'.
typedef void(* qb_ipcs_connection_destroyed_fn )(qb_ipcs_connection_ t *c) typedef void(* qb_ipcs_connection_destroyed_fn )(qb_ipcs_connection_ t *c)
This is called just before a connection is freed. This is called just before a connection is freed'.
typedef int32_t(* qb_ipcs_msg_process_fn )(qb_ipcs_connection_t *c, void *data, size_t size) typedef int32_t(* qb_ipcs_msg_process_fn )(qb_ipcs_connection_t *c, void *data, size_t size)
This is the message processing calback. This is the message processing calback'.
Enumerations Enumerations
enum qb_ipcs_rate_limit { QB_IPCS_RATE_FAST, QB_IPCS_RATE_NORMAL, QB _IPCS_RATE_SLOW, QB_IPCS_RATE_OFF } enum qb_ipcs_rate_limit { QB_IPCS_RATE_FAST, QB_IPCS_RATE_NORMAL, QB _IPCS_RATE_SLOW, QB_IPCS_RATE_OFF, QB_IPCS_RATE_OFF_2 }
Functions Functions
qb_ipcs_service_t * qb_ipcs_create (const char *name, int32_t servic e_id, enum qb_ipc_type type, struct qb_ipcs_service_handlers *handlers) qb_ipcs_service_t * qb_ipcs_create (const char *name, int32_t servic e_id, enum qb_ipc_type type, struct qb_ipcs_service_handlers *handlers)
Create a new IPC server. Create a new IPC server'.
void qb_ipcs_ref (qb_ipcs_service_t *s) void qb_ipcs_ref (qb_ipcs_service_t *s)
Increase the reference counter on the service object. Increase the reference counter on the service object'.
void qb_ipcs_unref (qb_ipcs_service_t *s) void qb_ipcs_unref (qb_ipcs_service_t *s)
Decrease the reference counter on the service object. Decrease the reference counter on the service object'.
void qb_ipcs_poll_handlers_set (qb_ipcs_service_t *s, struct qb_ipcs _poll_handlers *handlers) void qb_ipcs_poll_handlers_set (qb_ipcs_service_t *s, struct qb_ipcs _poll_handlers *handlers)
Set your poll callbacks. Set your poll callbacks'.
int32_t qb_ipcs_run (qb_ipcs_service_t *s) int32_t qb_ipcs_run (qb_ipcs_service_t *s)
run the new IPC server. run the new IPC server'.
void qb_ipcs_destroy (qb_ipcs_service_t *s) void qb_ipcs_destroy (qb_ipcs_service_t *s)
Destroy the IPC server. Destroy the IPC server'.
void qb_ipcs_request_rate_limit (qb_ipcs_service_t *s, enum qb_ipcs_ rate_limit rl) void qb_ipcs_request_rate_limit (qb_ipcs_service_t *s, enum qb_ipcs_ rate_limit rl)
Limit the incomming request rate. Limit the incomming request rate'.
ssize_t qb_ipcs_response_send (qb_ipcs_connection_t *c, const void * data, size_t size) ssize_t qb_ipcs_response_send (qb_ipcs_connection_t *c, const void * data, size_t size)
Send a response to a incomming request. Send a response to a incomming request'.
ssize_t qb_ipcs_response_sendv (qb_ipcs_connection_t *c, const struc t iovec *iov, size_t iov_len) ssize_t qb_ipcs_response_sendv (qb_ipcs_connection_t *c, const struc t iovec *iov, size_t iov_len)
Send a response to a incomming request. Send a response to a incomming request'.
ssize_t qb_ipcs_event_send (qb_ipcs_connection_t *c, const void *dat a, size_t size) ssize_t qb_ipcs_event_send (qb_ipcs_connection_t *c, const void *dat a, size_t size)
Send an asyncronous event message to the client. Send an asyncronous event message to the client'.
ssize_t qb_ipcs_event_sendv (qb_ipcs_connection_t *c, const struct i ovec *iov, size_t iov_len) ssize_t qb_ipcs_event_sendv (qb_ipcs_connection_t *c, const struct i ovec *iov, size_t iov_len)
Send an asyncronous event message to the client. Send an asyncronous event message to the client'.
void qb_ipcs_connection_ref (qb_ipcs_connection_t *c) void qb_ipcs_connection_ref (qb_ipcs_connection_t *c)
Increment the connection's reference counter. Increment the connection's reference counter'.
void qb_ipcs_connection_unref (qb_ipcs_connection_t *c) void qb_ipcs_connection_unref (qb_ipcs_connection_t *c)
Decrement the connection's reference counter. Decrement the connection's reference counter'.
void qb_ipcs_disconnect (qb_ipcs_connection_t *c) void qb_ipcs_disconnect (qb_ipcs_connection_t *c)
Disconnect from this client. Disconnect from this client'.
int32_t qb_ipcs_service_id_get (qb_ipcs_connection_t *c) int32_t qb_ipcs_service_id_get (qb_ipcs_connection_t *c)
Get the service id related to this connection's service. Get the service id related to this connection's service'.
void qb_ipcs_context_set (qb_ipcs_connection_t *c, void *context) void qb_ipcs_context_set (qb_ipcs_connection_t *c, void *context)
Associate a 'user' pointer with this connection. Associate a 'user' pointer with this connection'.
void * qb_ipcs_context_get (qb_ipcs_connection_t *c) void * qb_ipcs_context_get (qb_ipcs_connection_t *c)
Get the context (set previously). Get the context (set previously)
int32_t qb_ipcs_connection_stats_get (qb_ipcs_connection_t *c, struc t qb_ipcs_connection_stats *stats, int32_t clear_after_read) int32_t qb_ipcs_connection_stats_get (qb_ipcs_connection_t *c, struc t qb_ipcs_connection_stats *stats, int32_t clear_after_read)
Get the connection statistics. Get the connection statistics'.
int32_t qb_ipcs_stats_get (qb_ipcs_service_t *pt, struct qb_ipcs_sta ts *stats, int32_t clear_after_read) int32_t qb_ipcs_stats_get (qb_ipcs_service_t *pt, struct qb_ipcs_sta ts *stats, int32_t clear_after_read)
Get the service statistics. Get the service statistics'.
qb_ipcs_connection_t * qb_ipcs_connection_first_get (qb_ipcs_service _t *pt) qb_ipcs_connection_t * qb_ipcs_connection_first_get (qb_ipcs_service _t *pt)
Get the first connection. Get the first connection'.
qb_ipcs_connection_t * qb_ipcs_connection_next_get (qb_ipcs_service_ t *pt, qb_ipcs_connection_t *current) qb_ipcs_connection_t * qb_ipcs_connection_next_get (qb_ipcs_service_ t *pt, qb_ipcs_connection_t *current)
Get the next connection. Get the next connection'.
Detailed Description
Server IPC API'.
Typedef Documentation Typedef Documentation
typedef int32_t(* qb_ipcs_connection_accept_fn)(qb_ipcs_connection_t *c, uid_t uid, gid_t gid) typedef int32_t(* qb_ipcs_connection_accept_fn)(qb_ipcs_connection_t *c, uid_t uid, gid_t gid)
This callback is to check wether you want to accept a new connection . The type of checks you should do are authentication, service availabilty or process resource constraints. This callback is to check wether you want to accept a new connection '. The type of checks you should do are authentication, service availabilty or process resource constraints'.
Returns: Returns:
0 to accept or -errno to indicate a failure (sent back to the cl ient) 0 to accept or -errno to indicate a failure (sent back to the cl ient)
typedef int32_t(* qb_ipcs_connection_closed_fn)(qb_ipcs_connection_t *c) typedef int32_t(* qb_ipcs_connection_closed_fn)(qb_ipcs_connection_t *c)
This is called after a connection has been disconnected. Note: This is called after a connection has been disconnected'. Note:
if you return anything but 0 this function will be repeativily c if you return anything but 0 this function will be repeativily c
alled (until 0 is returned). alled (until 0 is returned)'.
typedef void(* qb_ipcs_connection_created_fn)(qb_ipcs_connection_t *c) typedef void(* qb_ipcs_connection_created_fn)(qb_ipcs_connection_t *c)
This is called after a new connection has been created. This is called after a new connection has been created'.
typedef void(* qb_ipcs_connection_destroyed_fn)(qb_ipcs_connection_t *c) typedef void(* qb_ipcs_connection_destroyed_fn)(qb_ipcs_connection_t *c)
This is called just before a connection is freed. This is called just before a connection is freed'.
typedef struct qb_ipcs_connection qb_ipcs_connection_t typedef struct qb_ipcs_connection qb_ipcs_connection_t
typedef int32_t(* qb_ipcs_dispatch_add_fn)(enum qb_loop_priority p, int3 2_t fd, int32_t events, void *data, qb_ipcs_dispatch_fn_t fn) typedef int32_t(* qb_ipcs_dispatch_add_fn)(enum qb_loop_priority p, int3 2_t fd, int32_t events, void *data, qb_ipcs_dispatch_fn_t fn)
typedef int32_t(* qb_ipcs_dispatch_del_fn)(int32_t fd) typedef int32_t(* qb_ipcs_dispatch_del_fn)(int32_t fd)
typedef int32_t(* qb_ipcs_dispatch_fn_t)(int32_t fd, int32_t revents, vo id *data) typedef int32_t(* qb_ipcs_dispatch_fn_t)(int32_t fd, int32_t revents, vo id *data)
typedef int32_t(* qb_ipcs_dispatch_mod_fn)(enum qb_loop_priority p, int3 2_t fd, int32_t events, void *data, qb_ipcs_dispatch_fn_t fn) typedef int32_t(* qb_ipcs_dispatch_mod_fn)(enum qb_loop_priority p, int3 2_t fd, int32_t events, void *data, qb_ipcs_dispatch_fn_t fn)
typedef int32_t(* qb_ipcs_job_add_fn)(enum qb_loop_priority p, void *dat a, qb_loop_job_dispatch_fn dispatch_fn) typedef int32_t(* qb_ipcs_job_add_fn)(enum qb_loop_priority p, void *dat a, qb_loop_job_dispatch_fn dispatch_fn)
typedef int32_t(* qb_ipcs_msg_process_fn)(qb_ipcs_connection_t *c, void *data, size_t size) typedef int32_t(* qb_ipcs_msg_process_fn)(qb_ipcs_connection_t *c, void *data, size_t size)
This is the message processing calback. It is called with the messag e data. This is the message processing calback'. It is called with the messa ge data'.
typedef struct qb_ipcs_service qb_ipcs_service_t typedef struct qb_ipcs_service qb_ipcs_service_t
Enumeration Type Documentation Enumeration Type Documentation
enum qb_ipcs_rate_limit enum qb_ipcs_rate_limit
Enumerator: Enumerator:
QB_IPCS_RATE_FAST QB_IPCS_RATE_FAST
QB_IPCS_RATE_NORMAL QB_IPCS_RATE_NORMAL
QB_IPCS_RATE_SLOW QB_IPCS_RATE_SLOW
QB_IPCS_RATE_OFF QB_IPCS_RATE_OFF
QB_IPCS_RATE_OFF_2
Function Documentation Function Documentation
qb_ipcs_connection_t* qb_ipcs_connection_first_get (qb_ipcs_service_t * qb_ipcs_connection_t* qb_ipcs_connection_first_get (qb_ipcs_service_t *p
pt) t)
Get the first connection. Note: Get the first connection'. Note:
call qb_ipcs_connection_ref_dec() after using the connection. call qb_ipcs_connection_ref_dec() after using the connection'.
Parameters: Parameters:
pt service instance pt service instance
Returns: Returns:
first connection first connection
qb_ipcs_connection_t* qb_ipcs_connection_next_get (qb_ipcs_service_t * p qb_ipcs_connection_t* qb_ipcs_connection_next_get (qb_ipcs_service_t *pt
t, qb_ipcs_connection_t * current) , qb_ipcs_connection_t *current)
Get the next connection. Note: Get the next connection'. Note:
call qb_ipcs_connection_ref_dec() after using the connection. call qb_ipcs_connection_ref_dec() after using the connection'.
Parameters: Parameters:
pt service instance pt service instance
current current connection current current connection
Returns: Returns:
next connection next connection
void qb_ipcs_connection_ref (qb_ipcs_connection_t * c) void qb_ipcs_connection_ref (qb_ipcs_connection_t *c)
Increment the connection's reference counter. Parameters: Increment the connection's reference counter'. Parameters:
c connection instance c connection instance
int32_t qb_ipcs_connection_stats_get (qb_ipcs_connection_t * c, struct q int32_t qb_ipcs_connection_stats_get (qb_ipcs_connection_t *c, struct qb
b_ipcs_connection_stats * stats, int32_t clear_after_read) _ipcs_connection_stats *stats, int32_tclear_after_read)
Get the connection statistics. Parameters: Get the connection statistics'. Parameters:
stats (out) the statistics structure stats (out) the statistics structure
clear_after_read clear stats after copying them into stats clear_after_read clear stats after copying them into stats
c connection instance c connection instance
Returns: Returns:
0 == ok; -errno to indicate a failure 0 == ok; -errno to indicate a failure
void qb_ipcs_connection_unref (qb_ipcs_connection_t * c) void qb_ipcs_connection_unref (qb_ipcs_connection_t *c)
Decrement the connection's reference counter. Parameters: Decrement the connection's reference counter'. Parameters:
c connection instance c connection instance
void* qb_ipcs_context_get (qb_ipcs_connection_t * c) void* qb_ipcs_context_get (qb_ipcs_connection_t *c)
Get the context (set previously). Parameters: Get the context (set previously) Parameters:
c connection instance c connection instance
Returns: Returns:
the context the context
See also: See also:
qb_ipcs_context_set() qb_ipcs_context_set()
void qb_ipcs_context_set (qb_ipcs_connection_t * c, void * context) void qb_ipcs_context_set (qb_ipcs_connection_t *c, void *context)
Associate a 'user' pointer with this connection. Parameters: Associate a 'user' pointer with this connection'. Parameters:
context the point to associate with this connection. context the point to associate with this connection'.
c connection instance c connection instance
See also: See also:
qb_ipcs_context_get() qb_ipcs_context_get()
qb_ipcs_service_t* qb_ipcs_create (const char * name, int32_t service_id qb_ipcs_service_t* qb_ipcs_create (const char *name, int32_tservice_id,
, enum qb_ipc_type type, struct qb_ipcs_service_handlers * handlers) enum qb_ipc_typetype, struct qb_ipcs_service_handlers *handlers)
Create a new IPC server. Parameters: Create a new IPC server'. Parameters:
name for clients to connect to. name for clients to connect to'.
service_id an integer to associate with the service service_id an integer to associate with the service
type transport type. type transport type'.
handlers callbacks. handlers callbacks'.
Returns: Returns:
the new service instance. the new service instance'.
void qb_ipcs_destroy (qb_ipcs_service_t * s) void qb_ipcs_destroy (qb_ipcs_service_t *s)
Destroy the IPC server. Parameters: Destroy the IPC server'. Parameters:
s service instance to destroy s service instance to destroy
void qb_ipcs_disconnect (qb_ipcs_connection_t * c) void qb_ipcs_disconnect (qb_ipcs_connection_t *c)
Disconnect from this client. Parameters: Disconnect from this client'. Parameters:
c connection instance c connection instance
ssize_t qb_ipcs_event_send (qb_ipcs_connection_t * c, const void * data, ssize_t qb_ipcs_event_send (qb_ipcs_connection_t *c, const void *data, s
size_t size) ize_tsize)
Send an asyncronous event message to the client. Parameters: Send an asyncronous event message to the client'. Parameters:
c connection instance c connection instance
data the message to send data the message to send
size the size of the message size the size of the message
Returns: Returns:
size sent or -errno for errors size sent or -errno for errors
ssize_t qb_ipcs_event_sendv (qb_ipcs_connection_t * c, const struct iove ssize_t qb_ipcs_event_sendv (qb_ipcs_connection_t *c, const struct iovec
c * iov, size_t iov_len) *iov, size_tiov_len)
Send an asyncronous event message to the client. Parameters: Send an asyncronous event message to the client'. Parameters:
c connection instance c connection instance
iov the iovec struct that points to the message to send iov the iovec struct that points to the message to send
iov_len the number of iovecs. iov_len the number of iovecs'.
Returns: Returns:
size sent or -errno for errors size sent or -errno for errors
void qb_ipcs_poll_handlers_set (qb_ipcs_service_t * s, struct qb_ipcs_po void qb_ipcs_poll_handlers_set (qb_ipcs_service_t *s, struct qb_ipcs_pol
ll_handlers * handlers) l_handlers *handlers)
Set your poll callbacks. Parameters: Set your poll callbacks'. Parameters:
s service instance s service instance
handlers the handlers that you want ipcs to use. handlers the handlers that you want ipcs to use'.
void qb_ipcs_ref (qb_ipcs_service_t * s) void qb_ipcs_ref (qb_ipcs_service_t *s)
Increase the reference counter on the service object. Parameters: Increase the reference counter on the service object'. Parameters:
s service instance s service instance
void qb_ipcs_request_rate_limit (qb_ipcs_service_t * s, enum qb_ipcs_rat void qb_ipcs_request_rate_limit (qb_ipcs_service_t *s, enum qb_ipcs_rate
e_limit rl) _limitrl)
Limit the incomming request rate. Parameters: Limit the incomming request rate'. Parameters:
s service instance s service instance
rl the new rate rl the new rate
ssize_t qb_ipcs_response_send (qb_ipcs_connection_t * c, const void * da ssize_t qb_ipcs_response_send (qb_ipcs_connection_t *c, const void *data
ta, size_t size) , size_tsize)
Send a response to a incomming request. Parameters: Send a response to a incomming request'. Parameters:
c connection instance c connection instance
data the message to send data the message to send
size the size of the message size the size of the message
Returns: Returns:
size sent or -errno for errors size sent or -errno for errors
ssize_t qb_ipcs_response_sendv (qb_ipcs_connection_t * c, const struct i ssize_t qb_ipcs_response_sendv (qb_ipcs_connection_t *c, const struct io
ovec * iov, size_t iov_len) vec *iov, size_tiov_len)
Send a response to a incomming request. Parameters: Send a response to a incomming request'. Parameters:
c connection instance c connection instance
iov the iovec struct that points to the message to send iov the iovec struct that points to the message to send
iov_len the number of iovecs. iov_len the number of iovecs'.
Returns: Returns:
size sent or -errno for errors size sent or -errno for errors
int32_t qb_ipcs_run (qb_ipcs_service_t * s) int32_t qb_ipcs_run (qb_ipcs_service_t *s)
run the new IPC server. Parameters: run the new IPC server'. Parameters:
s service instance s service instance
Returns: Returns:
0 == ok; -errno to indicate a failure 0 == ok; -errno to indicate a failure
int32_t qb_ipcs_service_id_get (qb_ipcs_connection_t * c) int32_t qb_ipcs_service_id_get (qb_ipcs_connection_t *c)
Get the service id related to this connection's service. (as passed Get the service id related to this connection's service'. (as passed
into qb_ipcs_create() into qb_ipcs_create()
Returns: Returns:
service id. service id'.
int32_t qb_ipcs_stats_get (qb_ipcs_service_t * pt, struct qb_ipcs_stats int32_t qb_ipcs_stats_get (qb_ipcs_service_t *pt, struct qb_ipcs_stats *
* stats, int32_t clear_after_read) stats, int32_tclear_after_read)
Get the service statistics. Parameters: Get the service statistics'. Parameters:
stats (out) the statistics structure stats (out) the statistics structure
clear_after_read clear stats after copying them into stats clear_after_read clear stats after copying them into stats
pt service instance pt service instance
Returns: Returns:
0 == ok; -errno to indicate a failure 0 == ok; -errno to indicate a failure
void qb_ipcs_unref (qb_ipcs_service_t * s) void qb_ipcs_unref (qb_ipcs_service_t *s)
Decrease the reference counter on the service object. Parameters: Decrease the reference counter on the service object'. Parameters:
s service instance s service instance
Author Author
Generated automatically by Doxygen for libqb from the source code. Generated automatically by Doxygen for libqb from the source code'.
Version 0.4.1 Mon Jan 31 2011 qbipcs .h(3) Version 0.8.1 Thu Jan 5 2012 qbipcs .h(3)
 End of changes. 63 change blocks. 
100 lines changed or deleted 107 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/