libqb  1.0.6
IPC Overview
Overview
libqb provides a generically reusable very high performance shared memory IPC system for client and service applications. It supports many features including:
  • Multiple transport implementations
    1. Shared memory implementation for very high performance.
    2. Unix sockets
  • A synchronous request/response channel and asynchronous response channel per ipc connection.
  • User defined private data per IPC connection.
  • Ability to call a function per service on ipc connection and disconnection.
  • Authenticated IPC connection with ability for developer to define which UIDs and GIDs are valid at connection time.
  • Fully abstracted poll system so that any poll library may be used.
  • User defined selector for determining the proper function to call per service and id.
Security
The ipc system uses default operating system security mechanics to ensure ipc connections are validated. A callback used with qb_ipcs_create() is called for every new ipc connection with the parameters of UID and GID. The callback then determines if the UID and GID are authenticated for communication.
Performance
For performance, QB_IPC_SHM (shared memory) is recommended. It is tuned for very high performance.
Multithreading
There are not many guarantees about the ipc system being thread-safe. It is essential that all sends and all receives are in their own thread, though having separate threads for each is supported.

If you need to send on multiple threads then either use locking around the calls or create a separate connection for each thread.

IPC sockets (Linux only)
On Linux IPC, abstract (non-filesystem) sockets are used by default. If you need to override this (say in a net=host container) and use sockets that reside in the filesystem, then you need to create a file called /etc/libqb/force-filesystem-sockets
  • this is the default name and can be changed at ./configure time. The file does not need to contain any content, it's not a configuration file as such, just its presence will activate the feature.

Note that this is a global option and read each time a new IPC connection (client or server) is created. So, to avoid having clients that cannot connect to running servers it is STRONGLY recommended to only create or remove this file prior to a system reboot or container restart.

Client API
See also
qbipcc.h
Server API
See also
qbipcs.h