Typedefs | |
typedef _AlpChannel | AlpChannel |
Opaque type for representing a particular IPC channel (i.e. server). | |
typedef _AlpConnection | AlpConnection |
Opaque type representing a connection between the server and a single client. | |
typedef _AlpMessage | AlpMessage |
Opaque type used to contain the data for a message. | |
typedef void(* | AlpChannelConnectCB )(AlpConnection *connection, gpointer cbData) |
Signature for connect callback function. | |
typedef void(* | AlpChannelDisconnectCB )(AlpConnection *connection, gpointer cbData) |
Signature for disconnect callback function. | |
typedef void(* | AlpMessageReceiveCB )(AlpConnection *connection, AlpMessage *message, gpointer cbData) |
Signature for message receive callback function. | |
Enumerations | |
enum | AlpIpcChannelAccessMode { ALP_IPC_CHANNEL_ACCESS_OWNER, ALP_IPC_CHANNEL_ACCESS_ALL } |
Settings for channel access mode. More... | |
enum | AlpConnectionUsageHint { ALP_IPC_CONNECTION_USAGE_HINT_NONE = 0x0, ALP_IPC_CONNECTION_USAGE_HINT_SYNCH_ONLY = 0x1 } |
Connection usage hints. More... | |
Functions | |
AlpChannel * | alp_ipc_channel_create (const gchar *channelName, AlpIpcChannelAccessMode accessMode) |
Creates an AlpChannel. | |
alp_status_t | alp_ipc_channel_destroy (AlpChannel *channel) |
Destroys an AlpChannel. | |
alp_status_t | alp_ipc_channel_register_connect_callback (AlpChannel *channel, AlpChannelConnectCB callback, gpointer cbData) |
Registers a callback for the server process whenever a client connects. | |
alp_status_t | alp_ipc_channel_register_disconnect_callback (AlpChannel *channel, AlpChannelDisconnectCB callback, gpointer cbData) |
Registers a callback for the server process whenever a client disconnects or exits without disconnecting. | |
AlpConnection * | alp_ipc_channel_connect (const gchar *channelName, AlpConnectionUsageHint hint, AlpChannelConnectCB callback, gpointer cbData) |
Requests a connection to a AlpChannel. | |
alp_status_t | alp_ipc_channel_connect_synch (const gchar *channelName, AlpConnectionUsageHint usageHint, guint timeout, AlpConnection **connection) |
Requests a connection to a AlpChannel. | |
alp_status_t | alp_ipc_channel_disconnect (AlpConnection *connection) |
Disconnects process from an AlpChannel. | |
void | alp_ipc_channel_set_custom_data (AlpChannel *channel, gpointer customData) |
Assigns a pointer to a custom block of data to be stored with this AlpChannel. | |
gpointer | alp_ipc_channel_get_custom_data (AlpChannel *channel) |
Retrieves the pointer to a custom block of data stored with this AlpChannel. | |
alp_status_t | alp_ipc_connection_register_disconnect_callback (AlpConnection *connection, AlpChannelDisconnectCB callback, gpointer cbData) |
Registers to receive a callback when the server disconnects by destroying the channel or exiting. | |
gint | alp_ipc_connection_get_peer_pid (const AlpConnection *connection) |
Returns the process ID of the peer process for this connection. | |
gint | alp_ipc_connection_get_peer_uid (const AlpConnection *connection) |
Returns the user ID of the peer process for this connection. | |
gint | alp_ipc_connection_get_peer_gid (const AlpConnection *connection) |
Returns the group ID of the peer process for this connection. | |
AlpMessage * | alp_ipc_message_create () |
Allocates a AlpMessage structure. | |
alp_status_t | alp_ipc_message_destroy (AlpMessage *message) |
Cleans up and frees all memory associated with the message. | |
gint | alp_ipc_message_get_message_ID (AlpMessage *message) |
Returns the message ID of the message. | |
alp_status_t | alp_ipc_connection_send (AlpConnection *connection, AlpMessage *message) |
Sends a message to the other end of a connection. | |
alp_status_t | alp_ipc_connection_send_with_response (AlpConnection *connection, AlpMessage *message, guint timeout, AlpMessage **response) |
Sends a message to the other end of a connection, then waits for a response message. | |
alp_status_t | alp_ipc_connection_receive (AlpConnection *connection, gint messageID, guint timeout, AlpMessage **message) |
Synchronously receive a message from the other end of a connection. | |
alp_status_t | alp_ipc_connection_register_receive_callback (AlpConnection *connection, AlpMessageReceiveCB callback, gpointer cbData) |
Registers to receive an asynchronous callback when a message is received by the connection. | |
void | alp_ipc_connection_set_custom_data (AlpConnection *connection, gpointer customData) |
Assigns a pointer to a custom block of data to be stored with this AlpConnection. | |
gpointer | alp_ipc_connection_get_custom_data (AlpConnection *connection) |
Retrieves the pointer to a custom block of data stored with this AlpConnection. | |
alp_status_t | alp_ipc_message_pack_start (AlpMessage *message, gint messageID) |
Call to begin to pack a message into an existing AlpMessage struct. | |
alp_status_t | alp_ipc_message_response_pack_start (AlpMessage *message, gint messageID, AlpMessage *messageToRespondTo) |
Call to begin to pack a response message into an existing AlpMessage struct. | |
alp_status_t | alp_ipc_message_pack_end (AlpMessage *message) |
Call to finish packing a message into an existing AlpMessage struct. | |
alp_status_t | alp_ipc_message_pack_int32 (AlpMessage *message, gint32 val) |
Adds an int32 value to the message. | |
alp_status_t | alp_ipc_message_pack_uint32 (AlpMessage *message, guint32 val) |
Adds an uint32 value to the message. | |
alp_status_t | alp_ipc_message_pack_float (AlpMessage *message, gfloat val) |
Adds a float value to the message. | |
alp_status_t | alp_ipc_message_pack_string (AlpMessage *message, const gchar *val) |
Adds a null-terminated string value to the message. | |
alp_status_t | alp_ipc_message_pack_byte_array (AlpMessage *message, guchar *byteArray, guint numElements) |
Adds a array of bytes (i.e. unsigned chars) to the message. | |
alp_status_t | alp_ipc_message_unpack_start (AlpMessage *message) |
Call to begin unpacking a message from an AlpMessage struct. | |
alp_status_t | alp_ipc_message_unpack_end (AlpMessage *message) |
Call to finish unpacking a message from an AlpMessage struct. | |
alp_status_t | alp_ipc_message_unpack_int32 (AlpMessage *message, gint32 *val) |
Unpacks an int32 value from the message. | |
alp_status_t | alp_ipc_message_unpack_uint32 (AlpMessage *message, guint32 *val) |
Unpacks an uint32 value from the message. | |
alp_status_t | alp_ipc_message_unpack_float (AlpMessage *message, gfloat *val) |
Unpacks a float value from the message. | |
alp_status_t | alp_ipc_message_unpack_string (AlpMessage *message, gchar **val) |
Unpacks a null-terminated string from the message. | |
alp_status_t | alp_ipc_message_unpack_byte_array (AlpMessage *message, guchar **array, guint *numElements) |
Unpacks an array of bytes (i.e. unsigned chars) from the message. |
|
Opaque type for representing a particular IPC channel (i.e. server).
|
|
Signature for connect callback function.
|
|
Signature for disconnect callback function.
|
|
Opaque type representing a connection between the server and a single client.
|
|
Opaque type used to contain the data for a message.
|
|
Signature for message receive callback function.
|
|
Connection usage hints.
|
|
Settings for channel access mode.
|
|
Requests a connection to a AlpChannel. Can be called by one or more processes to connect as clients of the channel Does not block, rather a callback is invoked when the connection is ready
|
|
Requests a connection to a AlpChannel. Can be called by one or more processes to connect as clients of the channel The call blocks until the connection is ready or until the number of milliseconds specified by the timeout parameter have elapsed. The caller passes in an AlpConnection** to receive the pointer to the new connection. A valid AlpConnection* is returned only if the function's return status is ALP_STATUS_OK. Otherwise, the returned connection parameter is set to NULL. The caller is responsible for destroying the returned connection with alp_ipc_connection_destory. NOTE: If the server has crashed unexpectedly, there may be cases where ALP_STATUS_IPC_ERROR is returned instead of ALP_STATUS_IPC_NO_SERVER.
|
|
Creates an AlpChannel. Should only be called by the server for a given channel name The process that makes the call (i.e. the server for the channel) is responsible for calling alp_ipc_channel_destroy to clean-up the channel and its connections when finished.
|
|
Destroys an AlpChannel. Should only be called by the process that creating the channel by calling alp_ipc_channel_create() Notifies clients that have registered a disconnect callback, then destroys all memory and closes any file descriptors used internally by the channel
|
|
Disconnects process from an AlpChannel. This should only be called by the client processes that connected to the channel using alp_ipc_channel_connect(). This will trigger any registered disconnect callback in the server process when any client disconnects. This also destroys all memory and closes any file descriptors used internally by the connection.
|
|
Retrieves the pointer to a custom block of data stored with this AlpChannel. The user owns the block of memory referenced by the custom data pointer and must free it when it is no longer needed.
|
|
Registers a callback for the server process whenever a client connects. Only one connect callback function can be registered at any time. If a second call to register a callback is made, it replaces the first call. Passing NULL as the callback function deletes the callback. NOTE: If the server process wishes to send messages to the client who's connecting, it must store the AlpConnection* passed to it in the callback when the client connects.
|
|
Registers a callback for the server process whenever a client disconnects or exits without disconnecting. Only one disconnect callback function can be registered at any time. If a second call to register a callback is made, it replaces the first call. Passing NULL as the callback function deletes the callback.
|
|
Assigns a pointer to a custom block of data to be stored with this AlpChannel. The user owns the block of memory referenced by the custom data pointer and must free it when it is no longer needed.
|
|
Retrieves the pointer to a custom block of data stored with this AlpConnection. The user owns the block of memory referenced by the custom data pointer and must free it when it is no longer needed.
|
|
Returns the group ID of the peer process for this connection.
|
|
Returns the process ID of the peer process for this connection.
|
|
Returns the user ID of the peer process for this connection.
|
|
Synchronously receive a message from the other end of a connection. The caller passes in an AlpMessage** to receive the pointer to the received message. The caller is responsible for deleting the AlpMessage* when finished. A valid AlpMessage* is returned only if the function's return status is ALP_STATUS_OK. Otherwise, the returned message parameter is set to NULL. The caller can specify to wait for a message that matches a particular message ID or can wait for any message to be received on the connection by setting the messageID parameter to ALP_IPC_RECEIVE_ANY. If you specify a messageID of ALP_IPC_RECEIVE_ANY, alp_ipc_connection_receive will unblock and return the first message received on the connection. If you specify any other value for messageID, alp_ipc_connection_receive will block until a message with the specified messageID has been received. In either case, the function will return if the specified timeout interval is reached before a message is received. Any messages received while blocked that do not correspond to the requested message ID are automatically queued and delivered once alp_ipc_connection_receive returns. The caller is responsible for deleting the AlpMessage struct returned by callingalp_ipc_message_destroy.
|
|
Registers to receive a callback when the server disconnects by destroying the channel or exiting. Only one disconnect callback function can be registered at any time. If a second call to register a callback is made, it replaces the first call. Passing NULL as the callback function deletes the callback.
|
|
Registers to receive an asynchronous callback when a message is received by the connection. Only one receive callback function can be registered at any time. If a second call to register a callback is made, it replaces the first call. Passing NULL as the callback function deletes the callback. The cbData structure specified is passed to the callback along with a pointer to the AlpMessage. The message ID and the format of the message are available when the callback is made, but the other data in the message must be unpacked using the various alp_ipc_message_unpack_* functions. The caller is responsible for deleting the AlpMessage structure returned by calling alp_ipc_message_destroy(); Requires that a GMainLoop is running in the process
|
|
Sends a message to the other end of a connection. The send is asynchronous (i.e. non-blocking)
|
|
Sends a message to the other end of a connection, then waits for a response message. The caller passes in an AlpMessage** to receive the pointer to the response message. The caller is responsible for deleting both the original and the response AlpMessage*'s when finished. The receiver is also responsible for deleting the AlpMessage* it receives and the AlpMessage* response is returns. A valid AlpMessage* is returned only if the function's return status is ALP_STATUS_OK. Otherwise, the returned message parameter is set to NULL. alp_ipc_connection_send_with_response blocks until a response message for the sent message has been received. The function will return if the specified timeout interval is reached before a message is received. Any messages received while blocked that do not correspond to the requested message ID are automatically queued and delivered once alp_ipc_connection_send_with_response returns. The receiver of the message should should a response to the message, using alp_message_response_pack_start() instead of alp_message_pack_start() when creating the message. The caller is responsible for deleting the response AlpMessage struct returned by calling alp_ipc_message_destroy.
|
|
Assigns a pointer to a custom block of data to be stored with this AlpConnection. The user owns the block of memory referenced by the custom data pointer and must free it when it is no longer needed.
|
|
Allocates a AlpMessage structure.
|
|
Cleans up and frees all memory associated with the message.
|
|
Returns the message ID of the message. The message ID is a integer value that can be any non-negative value agreed upon by the clients and server of a particular channel. Negative values are reserved for internal use by the IPC module. It is set by the sender of the message in the call to alp_ipc_message_start_pack().
|
|
Adds a array of bytes (i.e. unsigned chars) to the message.
|
|
Call to finish packing a message into an existing AlpMessage struct.
|
|
Adds a float value to the message.
|
|
Adds an int32 value to the message.
|
|
Call to begin to pack a message into an existing AlpMessage struct. Sets the message ID and prepares internal buffers for packing the message data. If reusing an AlpMessage struct, calling alp_ipc_message_pack_start() causes any old message info to be discarded. Packing a message involves calling alp_ipc_message_pack_start, followed by zero or more calls to alp_ipc_message_pack_<type> where type is the value type being added to the message (e.g. int32, string, etc.), followed by alp_ipc_message_pack_end.
|
|
Adds a null-terminated string value to the message.
|
|
Adds an uint32 value to the message.
|
|
Call to begin to pack a response message into an existing AlpMessage struct. Sets the message ID and response identifier and prepares internal buffers for packing the message data. If reusing an AlpMessage struct, calling alp_ipc_response_pack_start() causes any old message info to be discarded. Packing a response message involves calling alp_ipc_response_pack_start, followed by zero or more calls to alp_ipc_message_pack_<type> where type is the value type being added to the message (e.g. int32, string, etc.), followed by alp_ipc_message_pack_end.
|
|
Unpacks an array of bytes (i.e. unsigned chars) from the message. Storage for the byte array is allocated and must be freed by the caller with g_free()
|
|
Call to finish unpacking a message from an AlpMessage struct.
|
|
Unpacks a float value from the message.
|
|
Unpacks an int32 value from the message.
|
|
Call to begin unpacking a message from an AlpMessage struct. Unpacking a message involves calling alp_ipc_message_unpack_start, followed by zero or more calls to alp_ipc_message_unpack_<type> where type is the value type being added to the message (e.g. int32, string, etc.), followed by alp_ipc_message_unpack_end. Messages can be unpacked more than once by calling alp_ipc_message_unpack_start() a second time to reset the internal state
|
|
Unpacks a null-terminated string from the message. Storage for the unpacked string is allocated and must be freed by the caller with g_free()
|
|
Unpacks an uint32 value from the message.
|