void qb_rb_chunk_reclaim(qb_ringbuffer_t *rb)
Reclaim the oldest chunk.
struct qb_ipcs_service qb_ipcs_service_t
Definition: qbipcs.h:64
void qb_util_set_log_function(qb_util_log_fn_t fn)
Use this function to output libqb internal log message as you wish.
qb_map_t * qb_hashtable_create(size_t max_size)
Create an unsorted map based on a hashtable.
uint32_t targets
Definition: qblog.h:283
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...
void qb_ipcs_ref(qb_ipcs_service_t *s)
Increase the reference counter on the service object.
#define QB_ATTR_SECTION_START
Definition: qblog.h:296
int32_t qb_loop_signal_mod(qb_loop_t *l, enum qb_loop_priority p, int32_t sig, void *data, qb_loop_signal_dispatch_fn dispatch_fn, qb_loop_signal_handle handle)
Modify the signal job.
int32_t state
Definition: qbhdb.h:61
char * qb_strerror_r(int errnum, char *buf, size_t buflen)
strerror_r replacement.
@ QB_LOG_FILTER_FUNCTION
Definition: qblog.h:587
int32_t qb_hdb_handle_refcount_get(struct qb_hdb *hdb, qb_handle_t handle_in)
Get the current refcount.
ssize_t qb_ipcs_event_sendv(qb_ipcs_connection_t *c, const struct iovec *iov, size_t iov_len)
Send an asynchronous event message to the client.
uint64_t qb_util_stopwatch_split(qb_util_stopwatch_t *sw)
Create a new time split (or lap time)
qb_map_t * qb_skiplist_create(void)
Create a sorted map using a skiplist.
int32_t qb_hdb_handle_destroy(struct qb_hdb *hdb, qb_handle_t handle_in)
Request the destruction of the object.
qb_log_filter_type
Definition: qblog.h:585
int32_t qb_log_custom_open(qb_log_logger_fn log_fn, qb_log_close_fn close_fn, qb_log_reload_fn reload_fn, void *user_data)
Open a custom log target.
@ QB_LOG_TARGET_STATIC_MAX
Definition: qblog.h:555
void qb_ipcs_unref(qb_ipcs_service_t *s)
Decrease the reference counter on the service object.
@ QB_IPCS_RATE_OFF
Definition: qbipcs.h:56
int32_t qb_hdb_iterator_next(struct qb_hdb *hdb, void **instance, qb_handle_t *handle)
Get the next object and increament it's refcount.
int32_t(* qb_ipcs_dispatch_del_fn)(int32_t fd)
Definition: qbipcs.h:107
void struct qb_log_callsite * qb_log_callsite_get(const char *function, const char *filename, const char *format, uint8_t priority, uint32_t lineno, uint32_t tags)
Get or create a callsite at the given position.
uint64_t qb_util_stopwatch_time_split_get(qb_util_stopwatch_t *sw, uint32_t receint, uint32_t older)
Read the time split (in us) from "receint" to "older".
@ QB_LOOP_HIGH
Definition: qbloop.h:69
int32_t(* qb_ipcs_connection_closed_fn)(qb_ipcs_connection_t *c)
This is called after a connection has been disconnected.
Definition: qbipcs.h:168
qb_ipcs_dispatch_add_fn dispatch_add
Definition: qbipcs.h:131
qb_log_target_slot
Definition: qblog.h:546
void qb_ipcc_disconnect(qb_ipcc_connection_t *c)
Disconnect an IPC connection.
int32_t qb_loop_poll_add(qb_loop_t *l, enum qb_loop_priority p, int32_t fd, int32_t events, void *data, qb_loop_poll_dispatch_fn dispatch_fn)
Add a poll job to the mainloop.
ssize_t qb_rb_chunk_write(qb_ringbuffer_t *rb, const void *data, size_t len)
Write a chunk to the ring buffer.
void qb_loop_stop(qb_loop_t *l)
Stop the main loop.
int32_t qb_loop_timer_add(qb_loop_t *l, enum qb_loop_priority p, uint64_t nsec_duration, void *data, qb_loop_timer_dispatch_fn dispatch_fn, qb_loop_timer_handle *timer_handle_out)
Add a timer to the mainloop.
qb_ipcs_connection_accept_fn connection_accept
Definition: qbipcs.h:183
ssize_t qb_rb_space_free(qb_ringbuffer_t *rb)
The amount of free space in the ring buffer.
uint64_t qb_util_nano_current_get(void)
Get the current number of nano secounds produced by the systems incrementing clock (CLOCK_MONOTOMIC i...
@ QB_LOG_CONF_PRIORITY_BUMP
Definition: qblog.h:578
@ QB_LOG_TARGET_STATIC_END
Definition: qblog.h:556
void(* qb_util_log_fn_t)(const char *file_name, int32_t file_line, int32_t severity, const char *msg)
Definition: qbutil.h:151
void qb_ipcs_enforce_buffer_size(qb_ipcs_service_t *s, uint32_t max_buf_size)
Enforce the max buffer size clients must use from the server side.
qb_ipcs_connection_closed_fn connection_closed
Definition: qbipcs.h:186
int32_t qb_ipcc_is_connected(qb_ipcc_connection_t *c)
Is the connection connected?
qb_loop_t * qb_loop_create(void)
Create a new main loop.
void(* qb_map_notify_fn)(uint32_t event, char *key, void *old_value, void *value, void *user_data)
Definition: qbmap.h:111
int32_t client_pid
Definition: qbipcs.h:72
int32_t qb_hdb_handle_get(struct qb_hdb *hdb, qb_handle_t handle_in, void **instance)
Get the instance associated with this handle and increase it's refcount.
uint32_t first_run
Definition: qbhdb.h:72
qb_loop_priority
Priorites for jobs, timers & poll.
Definition: qbloop.h:66
void qb_util_stopwatch_stop(qb_util_stopwatch_t *sw)
Stop the stopwatch.
#define QB_GNUC_MAY_ALIAS
Definition: qbdefs.h:108
void qb_log_init(const char *name, int32_t facility, uint8_t priority)
Init the logging system.
int32_t qb_hdb_handle_put(struct qb_hdb *hdb, qb_handle_t handle_in)
Put the instance associated with this handle and decrease it's refcount.
int32_t qb_rb_chunk_commit(qb_ringbuffer_t *rb, size_t len)
Finalize the chunk.
int32_t qb_loop_timer_del(qb_loop_t *l, qb_loop_timer_handle th)
Delete a timer that is still outstanding.
void * qb_ipcs_connection_service_context_get(qb_ipcs_connection_t *c)
Get the context previously set on the service backing this connection.
void * qb_ipcs_context_get(qb_ipcs_connection_t *c)
Get the context (set previously)
@ QB_LOG_FILTER_FILE_REGEX
Definition: qblog.h:589
void * qb_rb_shared_user_data_get(qb_ringbuffer_t *rb)
Get a point to user shared data area.
qb_map_iter_t * qb_map_iter_create(qb_map_t *map)
Create an iterator.
int32_t qb_map_rm(qb_map_t *map, const char *key)
Removes a key/value pair from a map.
@ QB_LOG_FILTER_REMOVE
Definition: qblog.h:596
qb_ipcs_connection_t * qb_ipcs_connection_first_get(qb_ipcs_service_t *pt)
Get the first connection.
void * qb_ipcc_context_get(qb_ipcc_connection_t *c)
Get the context (set previously)
void qb_log_format_set(int32_t t, const char *format)
Set the format specifiers.
char * qb_rb_name_get(qb_ringbuffer_t *rb)
Get the name of the ringbuffer.
struct qb_ipcs_connection_stats_2 * qb_ipcs_connection_stats_get_2(qb_ipcs_connection_t *c, int32_t clear_after_read)
Get (and allocate) the connection statistics.
@ QB_LOG_TAG_CLEAR
Definition: qblog.h:599
struct qb_util_stopwatch qb_util_stopwatch_t
Definition: qbutil.h:198
void qb_log_blackbox_print_from_file(const char *filename)
Read the blackbox for file and print it out.
@ QB_LOG_CONF_FACILITY
Definition: qblog.h:574
void(* qb_log_close_fn)(int32_t t)
Definition: qblog.h:612
uint64_t send_retries
Definition: qbipcs.h:76
uint64_t flow_control_count
Definition: qbipcs.h:79
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.
const char * rest
Rest (pertaining the mid-release-point)
Definition: qbutil.h:297
uint32_t closed_connections
Definition: qbipcs.h:68
size_t qb_array_elems_per_bin_get(qb_array_t *a)
Get the number of elements per bin.
int32_t qb_thread_unlock(qb_thread_lock_t *tl)
Calls either pthread_mutex_unlock() or pthread_spin_unlock.
ssize_t qb_rb_write_to_file(qb_ringbuffer_t *rb, int32_t fd)
Write the contents of the Ring Buffer to file.
int32_t qb_thread_trylock(qb_thread_lock_t *tl)
Calls either pthread_mutex_trylock() or pthread_spin_trylock().
uint64_t qb_loop_timer_expire_time_get(struct qb_loop *l, qb_loop_timer_handle th)
Get the time remaining before it expires.
qb_array_t * qb_array_create(size_t max_elements, size_t element_size)
Create an array with fixed sized elements.
int32_t qb_atomic_int_exchange_and_add(volatile int32_t *atomic, int32_t val)
Atomically adds val to the integer pointed to by atomic.
void qb_map_iter_free(qb_map_iter_t *i)
free the iterator
int32_t qb_rb_chmod(qb_ringbuffer_t *rb, mode_t mode)
Like 'chmod', it changes the mode of the ringbuffer's resources.
static int qb_list_is_last(const struct qb_list_head *list, const struct qb_list_head *head)
Tests whether list is the last entry in list head.
Definition: qblist.h:131
#define qb_atomic_pointer_get(atomic)
Definition: qbatomic.h:175
uint32_t qb_util_stopwatch_split_last(qb_util_stopwatch_t *sw)
Get the last split index to be used by qb_util_stopwatch_time_split_get()
enum qb_ipc_type __attribute__
@ QB_LOG_TARGET_END
Definition: qblog.h:563
qb_thread_lock_t * qb_thread_lock_create(qb_thread_lock_type_t type)
Create a new lock of the given type.
uint64_t qb_loop_timer_handle
Definition: qbloop.h:77
qb_map_t * qb_trie_create(void)
Create a sorted map using a Patricia trie or "Radix tree".
size_t qb_map_count_get(qb_map_t *map)
Get the number of items in the map.
void qb_loop_run(qb_loop_t *l)
Run the main loop.
void qb_atomic_int_add(volatile int32_t *atomic, int32_t val)
Atomically adds val to the integer pointed to by atomic.
void(* qb_log_filter_fn)(struct qb_log_callsite *cs)
Definition: qblog.h:287
int32_t flow_control_state
Definition: qbipcs.h:89
int32_t qb_rb_refcount_get(qb_ringbuffer_t *rb)
Get the reference count.
static int32_t qb_list_empty(const struct qb_list_head *head)
A quick test to see if the list is empty (pointing to it's self).
Definition: qblist.h:142
static void qb_list_splice_tail(struct qb_list_head *list, struct qb_list_head *head)
Join two lists, each list being a queue.
Definition: qblist.h:175
@ QB_LOG_CONF_DEBUG
Definition: qblog.h:575
uint8_t major
Major component.
Definition: qbutil.h:294
int32_t qb_util_stopwatch_split_ctl(qb_util_stopwatch_t *sw, uint32_t max_splits, uint32_t options)
@ QB_LOG_TARGET_DYNAMIC_START
Definition: qblog.h:559
qb_ringbuffer_t * qb_rb_open(const char *name, size_t size, uint32_t flags, size_t shared_user_data_size)
Create the ring buffer with the given type.
const char *const qb_ver_str
Complete library versioning info as a string.
int32_t ref_count
Definition: qbhdb.h:64
@ QB_LOG_FILTER_FORMAT_REGEX
Definition: qblog.h:591
uint64_t responses
Definition: qbipcs.h:85
@ QB_LOG_STATE_DISABLED
Definition: qblog.h:568
struct qb_ringbuffer_s qb_ringbuffer_t
Definition: qbrb.h:110
int32_t qb_array_new_bin_cb_set(qb_array_t *a, qb_array_new_bin_cb_fn fn)
Get a callback when a new bin is allocated.
void qb_ipcs_service_context_set(qb_ipcs_service_t *s, void *context)
Associate a "user" pointer with this service.
void qb_atomic_init(void)
uint32_t lineno
Definition: qblog.h:282
@ QB_IPC_POSIX_MQ
Definition: qbipc_common.h:53
@ QB_LOG_STATE_ENABLED
Definition: qblog.h:569
uint8_t priority
Definition: qblog.h:281
@ QB_LOG_TAG_SET
Definition: qblog.h:598
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)
Definition: qbipcs.h:97
uint64_t responses
Definition: qbipcs.h:74
uint64_t requests
Definition: qbipcs.h:84
int32_t qb_loop_job_add(qb_loop_t *l, enum qb_loop_priority p, void *data, qb_loop_job_dispatch_fn dispatch_fn)
Add a job to the mainloop.
void * qb_log_target_user_data_get(int32_t t)
Retrieve the user data set by either qb_log_custom_open or qb_log_target_user_data_set.
int32_t qb_log_ctl2(int32_t target, enum qb_log_conf conf_type, qb_log_ctl2_arg_t arg)
Extension of main logging control function accepting also strings.
struct qb_list_head * prev
Definition: qblist.h:43
uint32_t event_q_length
Definition: qbipcs.h:91
const char * qb_log_facility2str(int32_t fnum)
Convert number "LOG_AUTH" to equivalent string "auth" etc.
void qb_util_stopwatch_start(qb_util_stopwatch_t *sw)
Start the stopwatch.
void qb_ipcs_connection_ref(qb_ipcs_connection_t *c)
Increment the connection's reference counter.
void qb_hdb_create(struct qb_hdb *hdb)
Create a new database.
int32_t qb_ipcs_service_id_get(qb_ipcs_connection_t *c)
Get the service id related to this connection's service.
void qb_log_tags_stringify_fn_set(qb_log_tags_stringify_fn fn)
Set the callback to map the 'tags' bit map to a string.
qb_ipcs_job_add_fn job_add
Definition: qbipcs.h:130
qb_log_conf
Definition: qblog.h:572
void(* qb_log_reload_fn)(int32_t t)
Definition: qblog.h:613
qb_array_t * qb_array_create_2(size_t max_elements, size_t element_size, size_t autogrow_elements)
Create an array with fixed sized elements.
@ QB_LOG_FILTER_FUNCTION_REGEX
Definition: qblog.h:590
uint32_t handle_count
Definition: qbhdb.h:68
uint8_t minor
Minor component.
Definition: qbutil.h:295
int32_t(* qb_ipcs_connection_accept_fn)(qb_ipcs_connection_t *c, uid_t uid, gid_t gid)
This callback is to check whether you want to accept a new connection.
Definition: qbipcs.h:149
void qb_log_file_close(int32_t t)
Close a log file and release is resources.
qb_util_stopwatch_t * qb_util_stopwatch_create(void)
Create a Stopwatch (to time operations)
void qb_rb_close(qb_ringbuffer_t *rb)
Dereference the ringbuffer and, if we are the last user, destroy it.
uint64_t qb_util_nano_from_epoch_get(void)
Get the time in nano seconds since epoch.
qb_map_iter_t * qb_map_pref_iter_create(qb_map_t *map, const char *prefix)
Create a prefix iterator.
int32_t qb_loop_job_del(struct qb_loop *l, enum qb_loop_priority p, void *data, qb_loop_job_dispatch_fn dispatch_fn)
Delete a job from the mainloop.
uint64_t recv_retries
Definition: qbipcs.h:77
int32_t(* qb_map_transverse_fn)(const char *key, void *value, void *user_data)
Definition: qbmap.h:117
static void qb_list_init(struct qb_list_head *head)
Initialize the list entry.
Definition: qblist.h:63
static void qb_list_add_tail(struct qb_list_head *element, struct qb_list_head *head)
Add to the list (but at the end of the list).
Definition: qblist.h:91
ssize_t qb_rb_space_used(qb_ringbuffer_t *rb)
The total amount of data in the buffer.
ssize_t qb_ipcc_send(qb_ipcc_connection_t *c, const void *msg_ptr, size_t msg_len)
Send a message.
void qb_ipcs_poll_handlers_set(qb_ipcs_service_t *s, struct qb_ipcs_poll_handlers *handlers)
Set your poll callbacks.
int32_t(* qb_ipcs_dispatch_fn_t)(int32_t fd, int32_t revents, void *data)
Definition: qbipcs.h:94
Structured library versioning info.
Definition: qbutil.h:293
const char * filename
Definition: qblog.h:279
int32_t qb_loop_poll_del(qb_loop_t *l, int32_t fd)
Delete a poll job.
void(* destructor)(void *)
Definition: qbhdb.h:71
@ QB_LOG_CONF_EXTENDED
Definition: qblog.h:581
@ QB_IPCS_RATE_FAST
Definition: qbipcs.h:53
int32_t qb_log_filter_fn_set(qb_log_filter_fn fn)
Instead of using the qb_log_filter_ctl() functions you can apply the filters manually by defining a c...
qb_ipc_type
Definition: qbipc_common.h:50
@ QB_LOG_TAG_CLEAR_ALL
Definition: qblog.h:600
@ QB_LOG_STATE_UNUSED
Definition: qblog.h:567
static void qb_list_splice(struct qb_list_head *list, struct qb_list_head *head)
Join two lists.
Definition: qblist.h:154
void qb_log_real_(struct qb_log_callsite *cs,...)
Internal function: use qb_log() or qb_logt()
void qb_log_from_external_source(const char *function, const char *filename, const char *format, uint8_t priority, uint32_t lineno, uint32_t tags,...) __attribute__((format(printf
This function is to import logs from other code (like libraries) that provide a callback with their l...
const char * format
Definition: qblog.h:2
struct qb_array qb_array_t
This is an opaque data type representing an instance of an array.
Definition: qbarray.h:68
qb_array_t * handles
Definition: qbhdb.h:69
@ QB_THREAD_LOCK_LONG
Definition: qbutil.h:117
enum qb_log_target_slot __attribute__
qb_ipcs_service_t * qb_ipcs_create(const char *name, int32_t service_id, enum qb_ipc_type type, struct qb_ipcs_service_handlers *handlers)
Create a new IPC server.
uint32_t tags
Definition: qblog.h:284
@ QB_IPCS_RATE_SLOW
Definition: qbipcs.h:55
@ QB_LOG_CONF_STATE_GET
Definition: qblog.h:579
void qb_trie_dump(qb_map_t *m)
print out the nodes in the trie
@ QB_LOOP_MED
Definition: qbloop.h:68
static void qb_list_replace(struct qb_list_head *old_one, struct qb_list_head *new_one)
Replace old entry by new one.
Definition: qblist.h:116
#define QB_ATTR_SECTION_STOP
Definition: qblog.h:297
int32_t qb_thread_lock(qb_thread_lock_t *tl)
Calls either pthread_mutex_lock() or pthread_spin_lock().
qb_ipcc_connection_t * qb_ipcc_connect(const char *name, size_t max_msg_size)
Create a connection to an IPC service.
struct qb_loop qb_loop_t
An opaque data type representing the main loop.
Definition: qbloop.h:75
int32_t qb_map_notify_del(qb_map_t *m, const char *key, qb_map_notify_fn fn, int32_t events)
Delete a notifier from the map.
void qb_ipcs_destroy(qb_ipcs_service_t *s)
Destroy the IPC server.
int32_t qb_array_index(qb_array_t *a, int32_t idx, void **element_out)
Get an element at a particular index.
int32_t qb_ipcs_run(qb_ipcs_service_t *s)
run the new IPC server.
struct qb_ipcc_connection qb_ipcc_connection_t
Definition: qbipcc.h:62
@ QB_THREAD_LOCK_SHORT
Definition: qbutil.h:116
void qb_loop_destroy(struct qb_loop *l)
@ QB_LOG_SYSLOG
Definition: qblog.h:551
int32_t(* qb_ipcs_msg_process_fn)(qb_ipcs_connection_t *c, void *data, size_t size)
This is the message processing calback.
Definition: qbipcs.h:179
void(* qb_array_new_bin_cb_fn)(qb_array_t *a, uint32_t bin)
Definition: qbarray.h:120
void qb_util_stopwatch_free(qb_util_stopwatch_t *sw)
Free the stopwatch.
float qb_util_stopwatch_sec_elapsed_get(qb_util_stopwatch_t *sw)
Get the elapsed time in seconds.
int32_t qb_log_callsites_register(struct qb_log_callsite *_start, struct qb_log_callsite *_stop)
If you are using dynamically loadable modules via dlopen() and you load them after qb_log_init() then...
qb_log_target_state
Definition: qblog.h:566
qb_ipcs_msg_process_fn msg_process
Definition: qbipcs.h:185
qb_ipcs_dispatch_del_fn dispatch_del
Definition: qbipcs.h:133
int32_t check
Definition: qbhdb.h:63
@ QB_LOG_TARGET_MAX
Definition: qblog.h:561
ssize_t qb_ipcc_sendv(qb_ipcc_connection_t *c, const struct iovec *iov, size_t iov_len)
Send a message (iovec).
int32_t qb_log_facility2int(const char *fname)
Convert string "auth" to equivalent number "LOG_AUTH" etc.
@ QB_IPCS_RATE_OFF_2
Definition: qbipcs.h:57
@ QB_LOG_CONF_ENABLED
Definition: qblog.h:573
void qb_log_from_external_source_va(const char *function, const char *filename, const char *format, uint8_t priority, uint32_t lineno, uint32_t tags, va_list ap) __attribute__((format(printf
int32_t(* qb_loop_signal_dispatch_fn)(int32_t rsignal, void *data)
Definition: qbloop.h:84
uint64_t requests
Definition: qbipcs.h:73
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)
Definition: qbipcs.h:102
@ QB_LOG_TARGET_START
Definition: qblog.h:547
int32_t qb_ipcc_fc_enable_max_set(qb_ipcc_connection_t *c, uint32_t max)
Set the maximum allowable flowcontrol value.
const char * function
Definition: qblog.h:0
uint8_t micro
Micro component.
Definition: qbutil.h:296
const char * filename
Definition: qblog.h:1
@ QB_LOG_CONF_FILE_SYNC
Definition: qblog.h:580
int32_t qb_log_file_open(const char *filename)
Open a log file.
void qb_ipcs_connection_unref(qb_ipcs_connection_t *c)
Decrement the connection's reference counter.
ssize_t qb_ipcc_recv(qb_ipcc_connection_t *c, void *msg_ptr, size_t msg_len, int32_t ms_timeout)
Receive a response.
int32_t qb_log_filter_ctl2(int32_t value, enum qb_log_filter_conf c, enum qb_log_filter_type type, const char *text, uint8_t high_priority, uint8_t low_priority)
This extends qb_log_filter_ctl() by been able to provide a high_priority.
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.
@ QB_IPC_NATIVE
Definition: qbipc_common.h:55
int32_t qb_map_notify_del_2(qb_map_t *m, const char *key, qb_map_notify_fn fn, int32_t events, void *user_data)
Delete a notifier from the map (including the userdata).
void qb_log_target_format(int32_t target, struct qb_log_callsite *cs, time_t timestamp, const char *formatted_message, char *output_buffer)
Format the callsite and timestamp info according to the format.
uint32_t iterator
Definition: qbhdb.h:70
@ QB_LOG_FILTER_CLEAR_ALL
Definition: qblog.h:597
qb_ipcs_connection_t * qb_ipcs_connection_next_get(qb_ipcs_service_t *pt, qb_ipcs_connection_t *current)
Get the next connection.
void qb_log_custom_close(int32_t t)
Close a custom log target and release is resources.
int32_t qb_atomic_pointer_compare_and_exchange(volatile void **atomic, void *oldval, void *newval)
Compares oldval with the pointer pointed to by atomic and if they are equal, atomically exchanges *at...
int32_t qb_hdb_handle_get_always(struct qb_hdb *hdb, qb_handle_t handle_in, void **instance)
Get the instance associated with this handle and increase it's refcount.
void qb_ipcs_context_set(qb_ipcs_connection_t *c, void *context)
Associate a "user" pointer with this connection.
@ QB_IPC_SYSV_MQ
Definition: qbipc_common.h:54
uint64_t qb_util_stopwatch_us_elapsed_get(qb_util_stopwatch_t *sw)
Get the elapsed time in micro seconds.
void qb_hdb_destroy(struct qb_hdb *hdb)
Destroy a handle database.
void * qb_map_get(qb_map_t *map, const char *key)
Gets the value corresponding to the given key.
@ QB_IPC_SHM
Definition: qbipc_common.h:52
int32_t client_pid
Definition: qbipcs.h:83
void qb_array_free(qb_array_t *a)
Free all the memory used by the array.
#define qb_list_for_each(pos, head)
Iterate over a list.
Definition: qblist.h:214
ssize_t qb_ipcs_response_sendv(qb_ipcs_connection_t *c, const struct iovec *iov, size_t iov_len)
Send a response to a incoming request.
int32_t qb_thread_lock_destroy(qb_thread_lock_t *tl)
Calls either pthread_mutex_destro() or pthread_spin_destroy().
void qb_log_real_va_(struct qb_log_callsite *cs, va_list ap)
int32_t qb_ipcs_connection_get_buffer_size(qb_ipcs_connection_t *conn)
Retrieve the connection ipc buffer size.
void(* qb_loop_job_dispatch_fn)(void *data)
Definition: qbloop.h:82
qb_ringbuffer_t * qb_rb_create_from_file(int32_t fd, uint32_t flags)
Load the saved ring buffer from file into temporary memory.
#define QB_GNUC_DEPRECATED
Definition: qbdefs.h:95
uint32_t lineno
Definition: qblog.h:4
const char *(* qb_log_tags_stringify_fn)(uint32_t tags)
Definition: qblog.h:270
const char * format
Definition: qblog.h:280
size_t qb_array_num_bins_get(qb_array_t *a)
Get the number of bins used by the array.
uint64_t qb_hdb_nocheck_convert(uint32_t handle)
@ QB_LOG_TARGET_STATIC_START
Definition: qblog.h:550
A set of callbacks that need to be provided (only job_add can be #NULL) whenever the IPC server is to...
Definition: qbipcs.h:129
int32_t qb_log_thread_start(void)
Start the logging pthread.
ssize_t qb_rb_chunks_used(qb_ringbuffer_t *rb)
The total number of chunks in the buffer.
void(* qb_ipcs_connection_created_fn)(qb_ipcs_connection_t *c)
This is called after a new connection has been created.
Definition: qbipcs.h:158
void qb_ipcc_context_set(qb_ipcc_connection_t *c, void *context)
Associate a "user" pointer with this connection.
void qb_timespec_add_ms(struct timespec *ts, int32_t ms)
Add milliseconds onto the timespec.
void * instance
Definition: qbhdb.h:62
int32_t qb_loop_signal_add(qb_loop_t *l, enum qb_loop_priority p, int32_t sig, void *data, qb_loop_signal_dispatch_fn dispatch_fn, qb_loop_signal_handle *handle)
Add a signal job.
static int32_t qb_list_length(struct qb_list_head *head)
Count the number of items in the list.
Definition: qblist.h:298
void qb_map_put(qb_map_t *map, const char *key, const void *value)
Inserts a new key and value into a qb_map_t.
#define qb_atomic_pointer_set(atomic, newval)
Definition: qbatomic.h:178
#define qb_atomic_int_set(atomic, newval)
Definition: qbatomic.h:172
void qb_ipcs_request_rate_limit(qb_ipcs_service_t *s, enum qb_ipcs_rate_limit rl)
Limit the incoming request rate.
struct qb_map qb_map_t
This is an opaque data type representing an instance of a map.
Definition: qbmap.h:98
int32_t qb_ipcs_connection_stats_get(qb_ipcs_connection_t *c, struct qb_ipcs_connection_stats *stats, int32_t clear_after_read)
Get the connection statistics.
qb_ipcs_connection_created_fn connection_created
Definition: qbipcs.h:184
void(* qb_loop_timer_dispatch_fn)(void *data)
Definition: qbloop.h:83
int32_t qb_loop_timer_is_running(qb_loop_t *l, qb_loop_timer_handle th)
Check to see if a timer that is still outstanding.
int32_t qb_ipcc_fd_get(qb_ipcc_connection_t *c, int32_t *fd)
Get the file descriptor to poll.
int32_t qb_array_grow(qb_array_t *a, size_t max_elements)
Grow the array.
ssize_t qb_ipcs_response_send(qb_ipcs_connection_t *c, const void *data, size_t size)
Send a response to a incoming request.
uint64_t qb_handle_t
Generic handle type is 64 bits.
Definition: qbhdb.h:52
ssize_t qb_log_blackbox_write_to_file(const char *filename)
Write the blackbox to file.
uint64_t events
Definition: qbipcs.h:86
void qb_util_timespec_from_epoch_get(struct timespec *ts)
Get the time in timespec since epoch.
@ QB_LOG_CONF_THREADED
Definition: qblog.h:577
int32_t qb_loop_poll_mod(qb_loop_t *l, enum qb_loop_priority p, int32_t fd, int32_t events, void *data, qb_loop_poll_dispatch_fn dispatch_fn)
Modify a poll job.
int32_t flow_control_state
Definition: qbipcs.h:78
int32_t qb_atomic_int_compare_and_exchange(volatile int32_t *atomic, int32_t oldval, int32_t newval)
Compares oldval with the integer pointed to by atomic and if they are equal, atomically exchanges *at...
@ QB_LOG_TARGET_DYNAMIC_END
Definition: qblog.h:562
static void qb_list_del(struct qb_list_head *_remove)
Delete an entry from the list.
Definition: qblist.h:105
@ QB_LOG_FILTER_FILE
Definition: qblog.h:586
qb_ipcs_connection_destroyed_fn connection_destroyed
Definition: qbipcs.h:187
@ QB_LOG_STDOUT
Definition: qblog.h:554
void(* qb_loop_poll_low_fds_event_fn)(int32_t not_enough, int32_t fds_available)
Definition: qbloop.h:86
int32_t(* qb_loop_poll_dispatch_fn)(int32_t fd, int32_t revents, void *data)
Definition: qbloop.h:81
struct qb_ipcs_connection qb_ipcs_connection_t
Definition: qbipcs.h:61
int32_t(* qb_ipcs_job_add_fn)(enum qb_loop_priority p, void *data, qb_loop_job_dispatch_fn dispatch_fn)
Definition: qbipcs.h:109
@ QB_LOG_FILTER_ADD
Definition: qblog.h:595
int32_t qb_loop_signal_del(qb_loop_t *l, qb_loop_signal_handle handle)
Delete the signal job.
void qb_log_fini(void)
Logging system finalization function.
uint64_t recv_retries
Definition: qbipcs.h:88
int32_t qb_log_thread_priority_set(int32_t policy, int32_t priority)
When using threaded logging set the pthread policy and priority.
qb_thread_lock_type_t
Definition: qbutil.h:115
int32_t qb_hdb_handle_create(struct qb_hdb *hdb, int32_t instance_size, qb_handle_t *handle_id_out)
Create a new handle.
void qb_ipcs_disconnect(qb_ipcs_connection_t *c)
Disconnect from this client.
int32_t qb_log_filter_ctl(int32_t value, enum qb_log_filter_conf c, enum qb_log_filter_type type, const char *text, uint8_t low_priority)
This allows you modify the 'tags' and 'targets' callsite fields at runtime.
An instance of this structure is created in a special ELF section at every dynamic debug callsite.
Definition: qblog.h:277
uint32_t tags
Definition: qblog.h:6
uint32_t qb_hdb_base_convert(qb_handle_t handle)
void(* qb_ipcs_connection_destroyed_fn)(qb_ipcs_connection_t *c)
This is called just before a connection is freed.
Definition: qbipcs.h:173
void * qb_loop_signal_handle
Definition: qbloop.h:79
static void qb_list_add(struct qb_list_head *element, struct qb_list_head *head)
Add this element to the list.
Definition: qblist.h:75
void qb_hdb_iterator_reset(struct qb_hdb *hdb)
Reset the iterator.
void qb_map_foreach(qb_map_t *map, qb_map_transverse_fn func, void *user_data)
Calls the given function for each of the key/value pairs in the map.
ssize_t qb_ipcs_event_send(qb_ipcs_connection_t *c, const void *data, size_t size)
Send an asynchronous event message to the client.
int32_t qb_ipcs_stats_get(qb_ipcs_service_t *pt, struct qb_ipcs_stats *stats, int32_t clear_after_read)
Get the service statistics.
void(* qb_log_vlogger_fn)(int32_t t, struct qb_log_callsite *cs, time_t timestamp, va_list ap)
Definition: qblog.h:607
int32_t qb_loop_poll_low_fds_event_set(qb_loop_t *l, qb_loop_poll_low_fds_event_fn fn)
Set a callback to receive events on file descriptors getting low.
@ QB_LOG_CONF_SIZE
Definition: qblog.h:576
@ QB_LOG_FILTER_FORMAT
Definition: qblog.h:588
struct qb_thread_lock_s qb_thread_lock_t
Definition: qbutil.h:121
void(* qb_log_logger_fn)(int32_t t, struct qb_log_callsite *cs, time_t timestamp, const char *msg)
Definition: qblog.h:603
uint64_t send_retries
Definition: qbipcs.h:87
@ QB_IPCS_RATE_NORMAL
Definition: qbipcs.h:54
void qb_map_destroy(qb_map_t *map)
Destroy the map, removes all the items from the map.
#define qb_atomic_int_get(atomic)
Definition: qbatomic.h:169
@ QB_LOOP_LOW
Definition: qbloop.h:67
uint64_t qb_util_nano_monotonic_hz(void)
Get the frequence of the clock used in qb_util_nano_current_get().
void qb_log_callsites_dump(void)
Dump the callsite info to stdout.
@ QB_LOG_BLACKBOX
Definition: qblog.h:553
uint8_t priority
Definition: qblog.h:3
int32_t qb_log_ctl(int32_t target, enum qb_log_conf conf_type, int32_t arg)
Main logging control function.
const struct qb_version qb_ver
uint64_t events
Definition: qbipcs.h:75
qb_ipcs_dispatch_mod_fn dispatch_mod
Definition: qbipcs.h:132
void * qb_ipcs_service_context_get(qb_ipcs_service_t *s)
Get the context (set previously)
@ QB_LOG_CONF_IDENT
Definition: qblog.h:582
qb_log_filter_conf
Definition: qblog.h:594
void qb_ipcs_connection_auth_set(qb_ipcs_connection_t *conn, uid_t uid, gid_t gid, mode_t mode)
Set the permissions on and shared memory files so that both processes can read and write to them.
int32_t qb_rb_chown(qb_ringbuffer_t *rb, uid_t owner, gid_t group)
Like 'chown', it changes the owner and group of the ringbuffer's resources.
int32_t qb_map_notify_add(qb_map_t *m, const char *key, qb_map_notify_fn fn, int32_t events, void *user_data)
Add a notifier to the map.
int32_t qb_log_target_user_data_set(int32_t t, void *user_data)
Associate user data with this log target.
struct qb_list_head * next
Definition: qblist.h:42
@ QB_IPC_SOCKET
Definition: qbipc_common.h:51
const char * qb_map_iter_next(qb_map_iter_t *i, void **value)
Get the next item.
struct qb_map_iter qb_map_iter_t
This is an opaque data type representing an iterator instance.
Definition: qbmap.h:103
@ QB_LOG_STDERR
Definition: qblog.h:552
ssize_t qb_rb_chunk_read(qb_ringbuffer_t *rb, void *data_out, size_t len, int32_t ms_timeout)
Read the oldest chunk into data_out.
uint32_t active_connections
Definition: qbipcs.h:67
int32_t qb_ipcc_get_buffer_size(qb_ipcc_connection_t *c)
What is the actual buffer size used after the connection.
void * qb_rb_chunk_alloc(qb_ringbuffer_t *rb, size_t len)
Allocate space for a chunk of the given size.
ssize_t qb_rb_chunk_peek(qb_ringbuffer_t *rb, void **data_out, int32_t ms_timeout)
Read (without reclaiming) the last chunk.
qb_ipcs_rate_limit
Rates to be passed to qb_ipcs_request_rate_limit.
Definition: qbipcs.h:52
uint64_t flow_control_count
Definition: qbipcs.h:90