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

exgmgr_prv.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 ********************************************************************/
00034 #ifndef EXGMGR_PRV_H_
00035 #define EXGMGR_PRV_H_
00036 
00037 #include <unistd.h>
00038 #include <hiker/exgmgr.h>
00039 
00040 #ifdef __cplusplus
00041  extern "C"
00042  {
00043 #endif
00044 
00045 // name of AFUNIX socket listening for connections from exgmgr lib.
00046 #define ALP_EXG_DAEMON_SOCKET_NAME "/tmp/alp_exg_mgr_daemon_socket"
00047 
00048 // Opcodes for messages to the daemon
00049 #define ALP_EXG_DAEMON_MSG_OPCODE_REGISTER_HANDLER 1
00050 #define ALP_EXG_DAEMON_MSG_OPCODE_UNREGISTER_HANDLER 2
00051 #define ALP_EXG_DAEMON_MSG_OPCODE_RECEIVE_REQUEST 3
00052 #define ALP_EXG_DAEMON_MSG_OPCODE_IS_ALIVE 4
00053 #define ALP_EXG_DAEMON_MSG_OPCODE_REGISTER_HANDLER_NOTIFICATION 5
00054 #define ALP_EXG_DAEMON_MSG_OPCODE_UNREGISTER_HANDLER_NOTIFICATION 6
00055 #define ALP_EXG_DAEMON_MSG_OPCODE_QUERY_GENERIC_VERBS 7
00056 #define ALP_EXG_DAEMON_MSG_OPCODE_CHECK_HANDLER_REGISTRATION 8
00057 #define ALP_EXG_DAEMON_MSG_OPCODE_CANCEL_REQUEST 9
00058 #define ALP_EXG_DAEMON_MSG_OPCODE_GET_GUID 10
00059 
00060 // Message passing between the exgmgr lib and daemon
00061 typedef struct _AlpExgMgrdMessageType AlpExgMgrdMessageType;
00062 struct _AlpExgMgrdMessageType {
00063         int itsOpcode;
00064         union
00065         {
00066                 struct _register_handler_bundle
00067                 {
00068                         char itsVerb[ALP_EXGMGR_VERB_MAXLEN + 1];
00069                         char itsLocalizedVerb[ALP_EXGMGR_LOCALIZED_VERB_MAXLEN + 1];
00070                         char itsMIMEType[ALP_EXGMGR_MIMETYPE_MAXLEN + 1];
00071                         char itsHandlerBundleName[ALP_EXGMGR_PACKAGENAME_MAXLEN + 1];
00072                         int itsLocalOnly;
00073                         int itsSerializeMe;
00074                         int itsMustBeUnique;
00075                         int itsAcceptGenericInvocation;
00076                 } register_handler_bundle;
00077                 
00078                 struct _register_handler_notification
00079                 {
00080                         char itsVerb[ALP_EXGMGR_VERB_MAXLEN + 1];
00081                         char itsLocalizedVerb[ALP_EXGMGR_LOCALIZED_VERB_MAXLEN + 1];
00082                         char itsMIMEType[ALP_EXGMGR_MIMETYPE_MAXLEN + 1];
00083                         char itsHandlerNotificationType[ALP_EXGMGR_NOTIFICATIONTYPE_MAXLEN + 1];
00084                         int itsLocalOnly;
00085                         int itsSerializeMe;
00086                         int itsMustBeUnique;
00087                         int itsAcceptGenericInvocation;
00088                 } register_handler_notification;
00089                 
00090                 struct _unregister_handler
00091                 {
00092                         char itsVerb[ALP_EXGMGR_VERB_MAXLEN + 1];
00093                         char itsMIMEType[ALP_EXGMGR_MIMETYPE_MAXLEN + 1];
00094                         char itsHandlerBundleName[ALP_EXGMGR_PACKAGENAME_MAXLEN + 1];
00095                 } unregister_handler;
00096                 
00097                 struct _unregister_handler_notification
00098                 {
00099                         char itsVerb[ALP_EXGMGR_VERB_MAXLEN + 1];
00100                         char itsMIMEType[ALP_EXGMGR_MIMETYPE_MAXLEN + 1];
00101                         char itsHandlerNotificationType[ALP_EXGMGR_NOTIFICATIONTYPE_MAXLEN + 1];
00102                 } unregister_handler_notification;
00103 
00104                 struct _check_handler_registration
00105                 {
00106                         char itsVerb[ALP_EXGMGR_VERB_MAXLEN + 1];
00107                         char itsMIMEType[ALP_EXGMGR_MIMETYPE_MAXLEN + 1];
00108                 } check_handler_registration;
00109                 
00110                 struct _query_generic_verbs
00111                 {
00112                         char itsMIMEType[ALP_EXGMGR_MIMETYPE_MAXLEN + 1];
00113                 } query_generic_verbs;
00114                                 
00115                 struct _receive_request
00116                 {
00117                         AlpExgRequest itsRequestId;     // this was passed to the handler at invoke time, and the handler sends it back to us when it connects
00118                 } receive_request;
00119 
00120                 struct _cancel_request
00121                 {
00122                         int itsGuid;
00123                 } cancel_request;
00124         } params;
00125 };
00126 
00127 // Message passing between the exgmgr lib and daemon
00128 typedef struct _AlpExgMgrdMessageReplyType AlpExgMgrdMessageReplyType;
00129 struct _AlpExgMgrdMessageReplyType {
00130         alp_status_t itsReplyStatus;
00131         union
00132         {
00133                 struct _get_request_guid
00134                 {
00135                         int itsRequestGuid;
00136                 } get_request_guid;
00137         } params;
00138 };
00139 
00140 // This structure is just there to calculate the size needed to store any of the Msg or reply types above
00141 typedef struct _AlpExgMgrdMessageOrReplyType AlpExgMgrdMessageOrReplyType;
00142 struct _AlpExgMgrdMessageOrReplyType {
00143         union
00144         {
00145                 AlpExgMgrdMessageType itsMsg;
00146                 AlpExgMgrdMessageReplyType itsReply;
00147         } params;
00148 };
00149 
00150 // These are private parameter names used with the special store request. The request client
00151 // or request handler should not use them directly (Look at alp_exg_utils_store_requestxxx in exgmgrutils.h)
00152 
00153 // When specifying obex compatible data by filename, this variable contains the number of objects in the array
00154 #define ALP_EXGMGR_OBEX_OBJECT_COUNT "obex_legacy_count"
00155 // This is the basename of the first filename. Subsequent filename must increment the last character
00156 #define ALP_EXGMGR_OBEX_OBJECT_FILE_BASE "obex_legacy_file0"
00157 #define ALP_EXGMGR_OBEX_OBJECT_FILE_2ND "obex_legacy_file1"
00158 // This is the basename of the first mime type. Subsequent mime type must increment the last character
00159 #define ALP_EXGMGR_OBEX_OBJECT_TYPE_BASE "obex_legacy_type0"
00160 // This is the basename of the first description. Subsequent description must increment the last character
00161 #define ALP_EXGMGR_OBEX_OBJECT_DESC_BASE "obex_legacy_desc0"
00162 // This is the basename of the first object name. Subsequent object name must increment the last character
00163 #define ALP_EXGMGR_OBEX_OBJECT_NAME_BASE "obex_legacy_name0"
00164 
00165 // Private parameter to hold the request progress notification type
00166 #define ALP_EXGMGR_PROGRESS_NOTIF_PARAM_NAME "priv_progress_param"
00167 #define ALP_EXGMGR_DEFAULT_PROGRESS_NOTIF "AlpProgressNotifType"
00168 
00169 // Private parameter to hold the guid (system wide unique request id)
00170 #define ALP_EXGMGR_REQUEST_GLOBAL_UID_PARAM_NAME "AlpPrivGlobalUid"
00171 #define EXG_MGR_BT_INCOMING_UID 1       // special UID used to cancel an incoming BT object.
00172 #define EXG_MGR_IR_INCOMING_UID 2
00173 #define EXG_MGR_FIRST_GUID 20
00174 
00175 // Private parameter to hold the 'progress dialog active' value
00176 #define ALP_EXGMGR_REQUEST_PROGRESS_ACTIVE_PARAM_NAME "AlpPrivProgressActive"
00177 
00178 
00179 int alp_exg_prv_daemon_is_alive ();
00180 alp_status_t alp_exg_prv_extract_transport_params_item_value (char *iTransportParams, char *iItemName, char *oValue, size_t iValueLen);
00181 void alp_exg_request_prv_get_version (AlpExgRequest iRequest, int *oVersion);
00182 void alp_ext_request_prv_get_info (AlpExgRequest iRequest, char **oInfo, size_t *oInfoLen);
00183 void alp_exg_request_prv_set_info (AlpExgRequest iRequest, char *iInfo, size_t iInfoLen);
00184 alp_status_t alp_exg_request_prv_alloc_init_info (AlpExgRequest iRequest, size_t iInfoLen);
00185 
00186 alp_status_t alp_exg_prv_sync_full_write (int iSocket, void *iBuf, size_t iBufLen);
00187 alp_status_t alp_exg_prv_sync_full_read (int iSocket, void *iBuf, size_t iBufLen);
00188 ssize_t alp_exg_prv_read_fd(int sockFD, void* payload, size_t maxPL, int* recvFD);
00189 ssize_t alp_exg_prv_write_fd(int sockFD, void* payload, size_t nPL, int sendFD);
00190 char *alp_exg_make_tmpfile (char *iPrefix, int *oFd);
00191 alp_status_t alp_exg_prv_fd_to_file (int iFd, char *iPrefix, char **oFilename);
00192 alp_status_t alp_exg_prv_cancel_incoming (int iGuid);
00193 
00195 
00196 #ifdef __cplusplus
00197  }
00198 #endif
00199 
00200 #endif /*EXGMGR_PRV_H_*/

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