Main Page | Modules | Namespace List | Class Hierarchy | Data Structures | Directories | File List | Namespace Members | Data Fields | Globals

ipc.h

Go to the documentation of this file.
00001 /********************************************************************
00002 
00003 Copyright 2006, ACCESS Systems Americas, Inc. All rights reserved.
00004 
00005 The contents of this file are subject to the Mozilla Public License Version
00006 1.1 (the "License"); you may not use this file except in compliance with
00007 the License. You may obtain a copy of the License at
00008 http://www.mozilla.org/MPL/
00009 
00010 Software distributed under the License is distributed on an "AS IS" basis,
00011 WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012 for the specific language governing rights and limitations under the
00013 License.
00014 
00015 The Original Code is the entire contents of this file.
00016 
00017 The Initial Developer of the Original Code is ACCESS Systems Americas, Inc.
00018 
00019 Portions created by ACCESS Systems Americas, Inc. are Copyright © 2006. All
00020 Rights Reserved.
00021 
00022 Contributor(s): none.
00023 
00024 ********************************************************************/
00031 #ifndef ALP_IPC_H_
00032 #define ALP_IPC_H_ 1
00033 
00034 #include <glib.h>
00035 
00036 #include <hiker/config.h>
00037 #include <hiker/sysclass.h>
00038 #include <hiker/types.h>
00039 
00040 #define ALP_STATUS_IPC_ERROR    ((alp_status_t)ALP_CLASS_IPC | 0x00010000)
00041 #define ALP_STATUS_IPC_TIMEOUT  ((alp_status_t)ALP_CLASS_IPC | 0x00020000)
00042 #define ALP_STATUS_IPC_BROKEN_CONNECTION ((alp_status_t)ALP_CLASS_IPC | 0x00030000)
00043 #define ALP_STATUS_IPC_NOT_CONNECTED ((alp_status_t)ALP_CLASS_IPC | 0x00040000)
00044 #define ALP_STATUS_IPC_NO_SERVER ((alp_status_t)ALP_CLASS_IPC | 0x00050000)
00045 #define ALP_STATUS_IPC_INVALID_RESPONSE ((alp_status_t)ALP_CLASS_IPC | 0x00060000)
00046 
00047 #define ALP_IPC_RECEIVE_ANY -1
00048 
00049 #ifdef __cplusplus
00050 extern "C" {
00051 #endif
00052 
00059 // 
00060 // Opaque typedef's
00061 //
00062 
00066 typedef struct _AlpChannel AlpChannel;          
00067 
00072 typedef struct _AlpConnection AlpConnection;
00073 
00077 typedef struct _AlpMessage AlpMessage;
00078 
00082 typedef enum {
00083         ALP_IPC_CHANNEL_ACCESS_OWNER,
00084         ALP_IPC_CHANNEL_ACCESS_ALL,
00085 } AlpIpcChannelAccessMode;
00086 
00090 typedef enum {
00091         ALP_IPC_CONNECTION_USAGE_HINT_NONE = 0x0,
00092         ALP_IPC_CONNECTION_USAGE_HINT_SYNCH_ONLY = 0x1,
00093 } AlpConnectionUsageHint;
00094 
00095 //
00096 // Callback function signatures
00097 //
00098 
00099 // typedef's for connect, disconnect, and message receive callback functions
00100 
00104 typedef void (*AlpChannelConnectCB) (AlpConnection* connection, 
00105                                      gpointer cbData);
00106 
00110 typedef void (*AlpChannelDisconnectCB) (AlpConnection* connection, 
00111                                         gpointer cbData);
00112 
00116 typedef void (*AlpMessageReceiveCB) (AlpConnection* connection,
00117                                                           AlpMessage* message,
00118                                                           gpointer cbData);
00119 
00120 
00138 AlpChannel*     
00139 alp_ipc_channel_create(const gchar* channelName, AlpIpcChannelAccessMode accessMode);
00140 
00141 
00155 alp_status_t
00156 alp_ipc_channel_destroy(AlpChannel* channel);   
00157 
00158 
00173 alp_status_t
00174 alp_ipc_channel_register_connect_callback(AlpChannel* channel,
00175                                                                   AlpChannelConnectCB callback,
00176                                                                   gpointer cbData);
00177 
00178 
00191 alp_status_t
00192 alp_ipc_channel_register_disconnect_callback(AlpChannel* channel,
00193                                                                         AlpChannelDisconnectCB callback,
00194                                                                         gpointer cbData);
00195 
00209 AlpConnection*
00210 alp_ipc_channel_connect(const gchar* channelName, 
00211                                     AlpConnectionUsageHint hint,
00212                                     AlpChannelConnectCB callback, 
00213                                     gpointer cbData);
00214 
00239 alp_status_t
00240 alp_ipc_channel_connect_synch(const gchar* channelName, 
00241                                                 AlpConnectionUsageHint usageHint,
00242                                                 guint timeout,
00243                                                 AlpConnection** connection);
00244 
00245 
00246 
00262 alp_status_t
00263 alp_ipc_channel_disconnect(AlpConnection* connection); 
00264 
00265 
00274 void
00275 alp_ipc_channel_set_custom_data(AlpChannel* channel,
00276                                                   gpointer customData);
00277 
00287 gpointer
00288 alp_ipc_channel_get_custom_data(AlpChannel* channel);
00289 
00290 
00302 alp_status_t
00303 alp_ipc_connection_register_disconnect_callback(AlpConnection* connection, 
00304                                                                            AlpChannelDisconnectCB callback, 
00305                                                                            gpointer cbData);
00306 
00314 gint
00315 alp_ipc_connection_get_peer_pid(const AlpConnection* connection);
00316 
00324 gint
00325 alp_ipc_connection_get_peer_uid(const AlpConnection* connection);
00326 
00334 gint
00335 alp_ipc_connection_get_peer_gid(const AlpConnection* connection);
00336 
00337 
00344 AlpMessage* 
00345 alp_ipc_message_create();
00346 
00353 alp_status_t
00354 alp_ipc_message_destroy(AlpMessage* message);
00355 
00356 
00367 gint 
00368 alp_ipc_message_get_message_ID(AlpMessage* message);
00369 
00370 
00381 alp_status_t
00382 alp_ipc_connection_send(AlpConnection* connection, AlpMessage* message);
00383 
00414 alp_status_t
00415 alp_ipc_connection_send_with_response(AlpConnection* connection, 
00416                                                            AlpMessage* message,
00417                                                            guint timeout, 
00418                                                            AlpMessage** response);
00419 
00442 alp_status_t
00443 alp_ipc_connection_receive(AlpConnection* connection, gint messageID, 
00444                                           guint timeout, AlpMessage** message);
00445 
00446 
00468 alp_status_t
00469 alp_ipc_connection_register_receive_callback(AlpConnection* connection,
00470                                                                         AlpMessageReceiveCB callback, 
00471                                                                         gpointer cbData);
00472 
00481 void
00482 alp_ipc_connection_set_custom_data(AlpConnection* connection,
00483                                                         gpointer customData);
00484 
00494 gpointer
00495 alp_ipc_connection_get_custom_data(AlpConnection* connection);
00496 
00515 alp_status_t
00516 alp_ipc_message_pack_start(AlpMessage* message, gint messageID);
00517 
00538 alp_status_t
00539 alp_ipc_message_response_pack_start(AlpMessage* message, gint messageID,
00540                                                          AlpMessage* messageToRespondTo);
00541 
00542 
00550 alp_status_t
00551 alp_ipc_message_pack_end(AlpMessage* message);
00552 
00553 
00562 alp_status_t
00563 alp_ipc_message_pack_int32(AlpMessage* message, gint32 val);
00564 
00565 
00574 alp_status_t
00575 alp_ipc_message_pack_uint32(AlpMessage* message, guint32 val);
00576 
00577 
00586 alp_status_t
00587 alp_ipc_message_pack_float(AlpMessage* message, gfloat val);
00588 
00589 
00590 
00599 alp_status_t
00600 alp_ipc_message_pack_string(AlpMessage* message, const gchar* val);
00601 
00602 
00612 alp_status_t
00613 alp_ipc_message_pack_byte_array(AlpMessage* message, 
00614                                                   guchar* byteArray, 
00615                                                   guint numElements);
00616 
00617 
00634 alp_status_t
00635 alp_ipc_message_unpack_start(AlpMessage* message);
00636 
00637 
00645 alp_status_t
00646 alp_ipc_message_unpack_end(AlpMessage* message);
00647 
00648 
00657 alp_status_t
00658 alp_ipc_message_unpack_int32(AlpMessage* message, gint32* val);
00659 
00660 
00661 
00670 alp_status_t
00671 alp_ipc_message_unpack_uint32(AlpMessage* message, guint32* val);
00672 
00673 
00674 
00683 alp_status_t
00684 alp_ipc_message_unpack_float(AlpMessage* message, gfloat* val);
00685 
00686 
00697 alp_status_t
00698 alp_ipc_message_unpack_string(AlpMessage* message, gchar** val);
00699 
00700 
00712 alp_status_t
00713 alp_ipc_message_unpack_byte_array(AlpMessage* message, 
00714                                                     guchar** array, 
00715                                                     guint* numElements);
00716 
00722 #ifdef __cplusplus
00723 }       // extern "C"
00724 #endif
00725 
00726 #endif // #ifndef ALP_IPC_H_
00727 

Generated on Sat Dec 16 20:29:47 2006 for hiker-0.9 by  doxygen 1.4.4