00001 /******************************************************************** 00002 * 00003 * Copyright (c) 1999-2008 ACCESS CO., LTD. All rights reserved. 00004 * Copyright 2006, 2007, ACCESS Systems Americas, Inc. All rights reserved. 00005 * 00006 * Version: MPL 1.1/LGPL 2.1 00007 * 00008 * The contents of this file are subject to the Mozilla Public License Version 00009 * 1.1 (the "License"); you may not use this file except in compliance with 00010 * the License. You may obtain a copy of the License at 00011 * http://www.mozilla.org/MPL/ 00012 * 00013 * Software distributed under the License is distributed on an "AS IS" basis, 00014 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 00015 * for the specific language governing rights and limitations under the 00016 * License. 00017 * 00018 * The Original Code is hikerproject.org code. 00019 * 00020 * The Initial Developer of the Original Code is ACCESS Systems Americas, Inc. 00021 * Portions created by the Initial Developer are 00022 * Copyright 2006-2007 the Initial Developer. All Rights Reserved. 00023 * 00024 * Contributor(s): 00025 * 00026 * Alternatively, the contents of this file may be used under the terms of 00027 * the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which 00028 * case the provisions of the LGPL are applicable instead of those above. 00029 * If you wish to allow use of your version of this file only under the terms 00030 * of the LGPL, and not to allow others to use your version of this file under 00031 * the terms of the MPL, indicate your decision by deleting the provisions 00032 * above and replace them with the notice and other provisions required by 00033 * the LGPL. If you do not delete the provisions above, a recipient may use 00034 * your version of this file under the terms of either the MPL or the LGPL. 00035 * You may obtain a copy of the LGPL at http://www.gnu.org/licenses/lgpl.txt. 00036 * 00037 ********************************************************************/ 00038 00046 #ifndef ALP_EXGMGR2_H_ 00047 #define ALP_EXGMGR2_H_ 00048 00049 #include <sys/types.h> 00050 #include <hiker/types.h> 00051 #include <hiker/sysclass.h> 00052 00053 #ifdef __cplusplus 00054 extern "C" 00055 { 00056 #endif 00057 00118 00119 #define ALP_EXG2_OUTOFMEMORY_ERR ((alp_status_t) (ALP_CLASS_EXCHANGE2 | 0x00010000)) 00120 00121 #define ALP_EXG2_NOTRANSPORTS_ERR ((alp_status_t) (ALP_CLASS_EXCHANGE2 | 0x00020000)) 00122 00123 #define ALP_EXG2_DAEMONFAILURE_ERR ((alp_status_t) (ALP_CLASS_EXCHANGE2 | 0x00030000)) 00124 00125 #define ALP_EXG2_LIBRARYFAILURE_ERR ((alp_status_t) (ALP_CLASS_EXCHANGE2 | 0x00040000)) 00126 00127 #define ALP_EXG2_PARAMNOTFOUND_ERR ((alp_status_t) (ALP_CLASS_EXCHANGE2 | 0x00050000)) 00128 00130 #define ALP_EXG2_INVALIDAPIPARAM_ERR ((alp_status_t) (ALP_CLASS_EXCHANGE2 | 0x00060000)) 00131 00132 #define ALP_EXG2_CREATESOCKET_ERR ((alp_status_t) (ALP_CLASS_EXCHANGE2 | 0x00070000)) 00133 00134 #define ALP_EXG2_BINDSOCKET_ERR ((alp_status_t) (ALP_CLASS_EXCHANGE2 | 0x00080000)) 00135 00136 #define ALP_EXG2_LISTENSOCKET_ERR ((alp_status_t) (ALP_CLASS_EXCHANGE2 | 0x00090000)) 00137 00138 #define ALP_EXG2_CONNECTSOCKET_ERR ((alp_status_t) (ALP_CLASS_EXCHANGE2 | 0x000A0000)) 00139 00140 #define ALP_EXG2_WRITESOCKET_ERR ((alp_status_t) (ALP_CLASS_EXCHANGE2 | 0x000B0000)) 00141 00142 #define ALP_EXG2_READSOCKET_ERR ((alp_status_t) (ALP_CLASS_EXCHANGE2 | 0x000C0000)) 00143 00144 #define ALP_EXG2_FCNTLSOCKET_ERR ((alp_status_t) (ALP_CLASS_EXCHANGE2 | 0x000D0000)) 00145 00147 #define ALP_EXG2_VERBTOOLONG_ERR ((alp_status_t) (ALP_CLASS_EXCHANGE2 | 0x000E0000)) 00148 00149 #define ALP_EXG2_LOCALIZEDVERBTOOLONG_ERR ((alp_status_t) (ALP_CLASS_EXCHANGE2 | 0x000F0000)) 00150 00151 #define ALP_EXG2_SUBJECTTOOLONG_ERR ((alp_status_t) (ALP_CLASS_EXCHANGE2 | 0x00100000)) 00152 00153 #define ALP_EXG2_MIMETYPETOOLONG_ERR ((alp_status_t) (ALP_CLASS_EXCHANGE2 | 0x00110000)) 00154 00155 #define ALP_EXG2_BUNDLENAMETOOLONG_ERR ((alp_status_t) (ALP_CLASS_EXCHANGE2 | 0x00120000)) 00156 00158 #define ALP_EXG2_HANDLERALREADYREGISTERED_ERR ((alp_status_t) (ALP_CLASS_EXCHANGE2 | 0x00140000)) 00159 00160 #define ALP_EXG2_HANDLERREGISTEREDINACTIVE_ERR ((alp_status_t) (ALP_CLASS_EXCHANGE2 | 0x00150000)) 00161 00162 #define ALP_EXG2_HANDLERNOTFOUND_ERR ((alp_status_t) (ALP_CLASS_EXCHANGE2 | 0x00160000)) 00163 00164 #define ALP_EXG2_HANDLERISLOCALONLY_ERR ((alp_status_t) (ALP_CLASS_EXCHANGE2 | 0x00170000)) 00165 00166 #define ALP_EXG2_HANDLERTIMEOUT_ERR ((alp_status_t) (ALP_CLASS_EXCHANGE2 | 0x00180000)) 00167 00168 #define ALP_EXG2_REGCACHE_ERR ((alp_status_t) (ALP_CLASS_EXCHANGE2 | 0x00190000)) 00169 00170 #define ALP_EXG2_CREATEFILE_ERR ((alp_status_t) (ALP_CLASS_EXCHANGE2 | 0x00200000)) 00171 00172 #define ALP_EXG2_ACCESSFILE_ERR ((alp_status_t) (ALP_CLASS_EXCHANGE2 | 0x00210000)) 00173 00174 #define ALP_EXG2_WRITEFILE_ERR ((alp_status_t) (ALP_CLASS_EXCHANGE2 | 0x00220000)) 00175 00176 #define ALP_EXG2_READFILE_ERR ((alp_status_t) (ALP_CLASS_EXCHANGE2 | 0x00230000)) 00177 00179 #define ALP_EXG2_GSOURCE_ERR ((alp_status_t) (ALP_CLASS_EXCHANGE2 | 0x00240000)) 00180 00181 #define ALP_EXG2_BROKENPIPE_ERR ((alp_status_t) (ALP_CLASS_EXCHANGE2 | 0x00250000)) 00182 00184 #define ALP_EXG2_REQUESTNOTFOUND_ERR ((alp_status_t) (ALP_CLASS_EXCHANGE2 | 0x00300000)) 00185 00186 #define ALP_EXG2_REQUESTALREADYRECEIVED_ERR ((alp_status_t) (ALP_CLASS_EXCHANGE2 | 0x00310000)) 00187 00188 #define ALP_EXG2_CANNOTSENDFD_ERR ((alp_status_t) (ALP_CLASS_EXCHANGE2 | 0x00320000)) 00189 00190 #define ALP_EXG2_CANNOTRCVFD_ERR ((alp_status_t) (ALP_CLASS_EXCHANGE2 | 0x00330000)) 00191 00193 #define ALP_EXG2_OBJECTNOTREADY_ERR ((alp_status_t) (ALP_CLASS_EXCHANGE2 | 0x00340000)) 00194 00195 #define ALP_EXG2_NOMOREOBJECTS_ERR ((alp_status_t) (ALP_CLASS_EXCHANGE2 | 0x00350000)) 00196 00197 #define ALP_EXG2_USERCANCEL_ERR ((alp_status_t) (ALP_CLASS_EXCHANGE2 | 0x00360000)) 00198 00200 #define ALP_EXG2_UNKNOWN_ERR ((alp_status_t) (ALP_CLASS_EXCHANGE2 | 0x00370000)) 00201 00202 #define ALP_EXG2_TIMEOUT_ERR ((alp_status_t) (ALP_CLASS_EXCHANGE2 | 0x00380000)) 00203 00205 #define ALP_EXG2_PROGRAM_ERR ((alp_status_t) (ALP_CLASS_EXCHANGE2 | 0x00500000)) 00206 00208 #define ALP_EXG2_FIRST_EXT_ERR ((alp_status_t) (ALP_CLASS_EXCHANGE2 | 0x00800000)) 00209 00210 00211 // ------------------------------------------------------------------------------------------------------------------------- 00225 00226 #define ALP_EXG2_SEND_ACTIONCLASS "exg_send_predef" 00227 00229 #define ALP_EXG2_GET_ACTIONCLASS "exg_get_predef" 00230 00232 #define ALP_EXG2_PRINT_ACTIONCLASS "exg_print_predef" 00233 00235 #define ALP_EXG2_EDIT_ACTIONCLASS "exg_edit_predef" 00236 00238 #define ALP_EXG2_VIEW_ACTIONCLASS "exg_view_predef" 00239 00241 #define ALP_EXG2_DIAL_ACTIONCLASS "exg_dial_predef" 00242 00244 #define ALP_EXG2_IMPORT_ACTIONCLASS "exg_import_predef" 00245 00247 #define ALP_EXG2_EXPORT_ACTIONCLASS "exg_export_predef" 00248 00250 00251 // ------------------------------------------------------------------------------------------------------------------------- 00259 00260 #define ALP_EXG2_BUNDLE_LOCALE_VERB_PREFIX "RSC=^t/" 00261 00262 #define ALP_EXG2_BUNDLE_LOCALE_VERB_BUNDLE_PREFIX(bundle) "RSC=" bundle "/^t/" 00263 00264 00265 // ------------------------------------------------------------------------------------------------------------------------- 00272 00273 #define ALP_EXG2_NOWILDCARD_PREFIX "nowcp_" 00274 00276 #define ALP_EXG2_PHONESTRING_SUBJECT ALP_EXG2_NOWILDCARD_PREFIX"phonestr_predef" 00277 00278 #define ALP_EXG2_EXTENDEDPHONESTRING_SUBJECT ALP_EXG2_NOWILDCARD_PREFIX"extphonestr_predef" 00279 00280 #define ALP_EXG2_CONTACT_IDENTIFIER_STRING_SUBJECT ALP_EXG2_NOWILDCARD_PREFIX"contactidstr_predef" 00281 00282 #define ALP_EXG2_URLSTRING_SUBJECT ALP_EXG2_NOWILDCARD_PREFIX"urlstr_predef" 00283 00284 #define ALP_EXG2_RTSPURLSTRING_SUBJECT ALP_EXG2_NOWILDCARD_PREFIX"rtspstr_predef" 00285 00286 #define ALP_EXG2_EMAILSTRING_SUBJECT ALP_EXG2_NOWILDCARD_PREFIX"emailstr_predef" 00287 00288 00289 // ------------------------------------------------------------------------------------------------------------------------- 00294 00295 typedef void *AlpExg2Request; 00297 typedef void *AlpExg2RequestId; 00299 00300 // ------------------------------------------------------------------------------------------------------------------------- 00305 00306 #define ALP_EXG2_VERB_MAXLEN 30 00307 00308 #define ALP_EXG2_LOCALIZED_VERB_MAXLEN 60 00309 00310 #define ALP_EXG2_SUBJECT_MAXLEN 50 00311 00312 #define ALP_EXG2_BUNDLENAME_MAXLEN 150 00313 00314 00315 // ------------------------------------------------------------------------------------------------------------------------- 00322 00323 typedef int alp_exg_async_execute_event_t; 00325 #define ALP_EXG2_ASYNC_EXECUTE_EVENT_COMPLETE 1 00326 00328 typedef struct _AlpExgAsyncExecuteEventInfoType 00329 { 00330 alp_exg_async_execute_event_t event; 00331 union 00332 { 00333 struct _evtcomplete 00334 { 00335 alp_status_t completeStatus; 00336 } evtcomplete; 00337 } params; 00338 } AlpExgAsyncExecuteEventInfoType; 00340 00341 // ------------------------------------------------------------------------------------------------------------------------- 00352 00353 #define ALP_EXG2_HINT_MEDIA_TYPE_INT_PARAM "exg_mediatype" 00354 #define ALP_EXG2_HINT_MEDIA_TYPE_LOCAL 1 00355 #define ALP_EXG2_HINT_MEDIA_TYPE_BLUETOOTH 2 00356 #define ALP_EXG2_HINT_MEDIA_TYPE_IRDA 3 00357 #define ALP_EXG2_HINT_MEDIA_TYPE_ETH 4 00358 #define ALP_EXG2_HINT_MEDIA_TYPE_WIFI 5 00359 #define ALP_EXG2_HINT_MEDIA_TYPE_GPRS 6 00360 #define ALP_EXG2_HINT_MEDIA_TYPE_EDGE 7 00361 #define ALP_EXG2_HINT_MEDIA_TYPE_3G 8 00362 00364 #define ALP_EXG2_HINT_MEDIA_SPEED_INT_PARAM "exg_mediaspeed" 00365 00367 #define ALP_EXG2_HINT_OBJECTS_TOTAL_SIZE_INT_PARAM "exg_objtotalsize" 00368 00370 #define ALP_EXG2_HINT_SLOW_MEDIA_INT_PARAM "exg_slowmedia" 00371 00372 00373 // ------------------------------------------------------------------------------------------------------------------------- 00415 typedef int alp_exg_handler_localonly_t; 00416 #define ALP_EXG2_HANDLER_LOCAL_ONLY 1 00417 #define ALP_EXG2_HANDLER_LOCAL_AND_REMOTE 0 00418 00419 typedef int alp_exg_handler_reentrant_t; 00420 #define ALP_EXG2_HANDLER_IS_REENTRANT 1 00421 #define ALP_EXG2_HANDLER_IS_NOT_REENTRANT 0 00422 00456 alp_status_t alp_exg2_handler_register_launch (const char *iVerb, const char *iLocalizedVerb, const char *iSubject, const char *iBundle, alp_exg_handler_localonly_t iLocalOnly, alp_exg_handler_reentrant_t iReentrant); 00457 00466 typedef void (*alp_exg2_handler_callback_func) (AlpExg2RequestId iRequestId); 00467 00492 alp_status_t alp_exg2_handler_register_callback (const char *iVerb, const char *iLocalizedVerb, const char *iSubject, alp_exg2_handler_callback_func iHandlerCallbackFunc, alp_exg_handler_localonly_t iLocalOnly, alp_exg_handler_reentrant_t iReentrant); 00493 00505 alp_status_t alp_exg2_handler_unregister_launch (const char *iVerb, const char *iSubject, const char *iBundle); 00506 00518 alp_status_t alp_exg2_handler_unregister_callback (const char *iVerb, const char *iSubject, alp_exg2_handler_callback_func iHandlerCallbackFunc); 00519 00534 alp_status_t alp_exg2_handler_check_registration (const char *iVerb, const char *iSubject); 00535 00537 00538 // ------------------------------------------------------------------------------------------------------------------------- 00594 alp_status_t alp_exg2_handler_query_methods (const char *iAction, const char *iSubject, const char *iExcludeInvokeName, uint32_t *oEntryCount, char **oDataP); 00595 00597 00598 // ------------------------------------------------------------------------------------------------------------------------- 00620 alp_status_t alp_exg2_request_create (AlpExg2Request *oRequest, const char *iVerb, const char *iSubject); 00621 00636 alp_status_t alp_exg2_request_delete (AlpExg2Request iRequest); 00637 00649 alp_status_t alp_exg2_request_set_verb (AlpExg2Request iRequest, const char *iVerb); 00650 00666 alp_status_t alp_exg2_request_set_subject (AlpExg2Request iRequest, const char *iSubject); 00667 00669 00670 // ------------------------------------------------------------------------------------------------------------------------- 00697 alp_status_t alp_exg2_request_int_parameter_set (AlpExg2Request iRequest, const char *iParamTag, int iParamValue); 00698 00712 alp_status_t alp_exg2_request_string_parameter_set (AlpExg2Request iRequest, const char *iParamTag, const char *iParamValue); 00713 00730 alp_status_t alp_exg2_request_blob_parameter_set (AlpExg2Request iRequest, const char *iParamTag, const uint8_t *iBlob, size_t iBlobSize); 00731 00733 00734 // ------------------------------------------------------------------------------------------------------------------------- 00775 alp_status_t alp_exg2_request_object_add_by_file (AlpExg2Request iRequest, const char *iObjectFile, int iDeleteWhenDone, const char *iObjectName, const char *iObjectType, const char *iObjectDscr); 00776 00794 alp_status_t alp_exg2_request_object_add_by_fd (AlpExg2Request iRequest, int iFd, size_t iObjectSize, const char *iObjectName, const char *iObjectType, const char *iObjectDscr); 00795 00815 alp_status_t alp_exg2_request_object_add_by_ptr (AlpExg2Request iRequest, uint8_t *iObjectP, size_t iObjectSize, int iFreeWhenDone, const char *iObjectName, const char *iObjectType, const char *iObjectDscr); 00816 00832 alp_status_t alp_exg2_request_object_add_undefined (AlpExg2Request iRequest, uint32_t *oObjectId); 00833 00851 alp_status_t alp_exg2_request_object_define_by_fd (AlpExg2Request iRequest, uint32_t iObjectId, int iFd, size_t iObjectSize, const char *iObjectName, const char *iObjectType, const char *iObjectDscr); 00852 00871 alp_status_t alp_exg2_request_object_define_by_file (AlpExg2Request iRequest, uint32_t iObjectId, const char *iObjectFile, int iDeleteWhenDone, const char *iObjectName, const char *iObjectType, const char *iObjectDscr); 00872 00891 alp_status_t alp_exg2_request_object_define_by_ptr (AlpExg2Request iRequest, uint32_t iObjectId, uint8_t *iObjectP, size_t iObjectSize, int iFreeWhenDone, const char *iObjectName, const char *iObjectType, const char *iObjectDscr); 00892 00905 alp_status_t alp_exg2_request_object_set_count_undefined (AlpExg2Request iRequest); 00906 00918 alp_status_t alp_exg2_request_object_set_count_final (AlpExg2Request iRequest); 00919 00921 00922 // ------------------------------------------------------------------------------------------------------------------------- 00954 alp_status_t alp_exg2_request_execute_sync (AlpExg2Request iRequest); 00955 00994 typedef void (*alp_exg2_execute_event_info_func) (AlpExg2Request iRequest, void *iUserData, AlpExgAsyncExecuteEventInfoType *iExecuteEventInfo); 00995 01014 alp_status_t alp_exg2_request_execute_async (AlpExg2Request iRequest, alp_exg2_execute_event_info_func iExecuteEventInfoFunc, void *iUserData); 01015 01036 alp_status_t alp_exg2_request_execute_cancel (AlpExg2Request iRequest, alp_status_t iCancelErr); 01037 01039 01040 // ------------------------------------------------------------------------------------------------------------------------- 01067 alp_status_t alp_exg2_request_receive_start (AlpExg2Request *oRequest, AlpExg2RequestId iRequestId); 01068 01090 alp_status_t alp_exg2_request_receive_complete (AlpExg2Request iRequest, alp_status_t iResult); 01091 01102 alp_status_t alp_exg2_request_get_verb (AlpExg2Request iRequest, char **oVerb); 01103 01116 alp_status_t alp_exg2_request_get_verb_const (AlpExg2Request iRequest, const char **oVerb); 01117 01128 alp_status_t alp_exg2_request_get_subject (AlpExg2Request iRequest, char **oSubject); 01129 01142 alp_status_t alp_exg2_request_get_subject_const (AlpExg2Request iRequest, const char **oSubject); 01143 01145 01146 // ------------------------------------------------------------------------------------------------------------------------- 01165 alp_status_t alp_exg2_request_int_parameter_get (AlpExg2Request iRequest, const char *iParamTag, int *oParamValue); 01166 01179 alp_status_t alp_exg2_request_string_parameter_get (AlpExg2Request iRequest, const char *iParamTag, char **oParamValue); 01180 01194 alp_status_t alp_exg2_request_string_parameter_get_const (AlpExg2Request iRequest, const char *iParamTag, const char **oParamValue); 01195 01210 alp_status_t alp_exg2_request_blob_parameter_get (AlpExg2Request iRequest, const char *iParamTag, uint8_t **oBlob, size_t *oBlobSize); 01211 01213 01214 // ------------------------------------------------------------------------------------------------------------------------- 01251 alp_status_t alp_exg2_request_receive_progress_disable (AlpExg2Request iRequest); 01252 01267 alp_status_t alp_exg2_request_object_rcv_count (AlpExg2Request iRequest, uint32_t *oObjectCount); 01268 01298 alp_status_t alp_exg2_request_object_rcv_info (AlpExg2Request iRequest, uint32_t iObjectId, size_t *oObjectSize, const char **oObjectName, const char **oObjectType, const char **oObjectDscr); 01299 01319 alp_status_t alp_exg2_request_object_rcv_by_file (AlpExg2Request iRequest, uint32_t iObjectId, const char *iDestFile); 01320 01346 alp_status_t alp_exg2_request_object_rcv_by_fd (AlpExg2Request iRequest, uint32_t iObjectId, int *oFd); 01347 01366 alp_status_t alp_exg2_request_object_rcv_by_ptr (AlpExg2Request iRequest, uint32_t iObjectId, uint8_t **oObjectP, size_t *oObjectSize); 01367 01386 alp_status_t alp_exg2_request_check_still_active (AlpExg2Request iRequest); 01387 01389 01390 // ------------------------------------------------------------------------------------------------------------------------- 01409 alp_status_t alp_exg2_transport_set (AlpExg2Request iRequest, const char *iParamsValue); 01410 01422 alp_status_t alp_exg2_transport_get (AlpExg2Request iRequest, char **oParamsValue); 01423 01435 alp_status_t alp_exg2_transport_get_const (AlpExg2Request iRequest, const char **oParamsValue); 01436 01438 01439 // ------------------------------------------------------------------------------------------------------------------------- 01463 alp_status_t alp_exg2_request_set_local_peer_name (AlpExg2Request iRequest, const char *iPeerName); 01464 01477 alp_status_t alp_exg2_request_get_remote_peer_name (AlpExg2Request iRequest, char **oPeerName); 01478 01491 alp_status_t alp_exg2_request_get_remote_peer_name_const (AlpExg2Request iRequest, const char **oPeerName); 01492 01494 01496 01497 #ifdef __cplusplus 01498 } 01499 #endif 01500 01501 #endif /*ALP_EXGMGR2_H_*/ 01502
Copyright © 1999-2008 ACCESS CO., LTD. All rights reserved.