#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <dlfcn.h>
#include <sys/un.h>
#include <sys/socket.h>
#include <errno.h>
#include <fcntl.h>
#include <glib/gmain.h>
#include <hiker/sysclass.h>
#include <hiker/traces.h>
#include <hiker/exgmgr.h>
#include <exgtransport.h>
#include "prvexgmgr.h"
#include <hiker/prv/exgmgr_prv.h>
#include <hiker/bundlemgr.h>
Data Structures | |
union | CMsgHdrUnion |
Defines | |
#define | TRANSPORTPARAMSMAXLEN 200 |
Typedefs | |
typedef msghdr | MsgHdr |
typedef cmsghdr | CMsgHdr |
typedef iovec | IOVec |
Functions | |
void | alp_exg_request_prv_get_version (AlpExgRequest iRequest, int *oVersion) |
void | alp_ext_request_prv_get_info (AlpExgRequest iRequest, char **oInfo, size_t *oInfoLen) |
void | alp_exg_request_prv_set_info (AlpExgRequest iRequest, char *iInfo, size_t iInfoLen) |
alp_status_t | alp_exg_request_prv_alloc_init_info (AlpExgRequest iRequest, size_t iInfoLen) |
alp_status_t | alp_exg_prv_sync_full_write (int iSocket, void *iBuf, size_t iBufLen) |
alp_status_t | alp_exg_prv_sync_full_read (int iSocket, void *iBuf, size_t iBufLen) |
ssize_t | alp_exg_prv_read_fd (int sockFD, void *payload, size_t maxPL, int *recvFD) |
ssize_t | alp_exg_prv_write_fd (int sockFD, void *payload, size_t nPL, int sendFD) |
char * | alp_exg_make_tmpfile (char *iPrefix, int *oFd) |
alp_status_t | alp_exg_prv_fd_to_file (int iDataFd, char *iPrefix, char **oFilename) |
int | alp_exg_prv_daemon_is_alive () |
alp_status_t | alp_exg_prv_extract_transport_params_item_value (char *iTransportParams, char *iItemName, char *oValue, size_t iValueLen) |
alp_status_t | alp_exg_handler_register (char *iVerb, char *iLocalizedVerb, char *iMIMEType, char *iHandlerBundleName, int iLocalOnly, int iSerializeMe, int iMustBeUnique, int iAcceptGenericInvocation) |
Declare an action handler for a specific verb/type of data combination. | |
alp_status_t | alp_exg_handler_register_notification (char *iVerb, char *iLocalizedVerb, char *iMIMEType, char *iNotificationType, int iLocalOnly, int iSerializeMe, int iMustBeUnique, int iAcceptGenericInvocation) |
Declare an action handler for a specific verb/type of data combination. | |
alp_status_t | alp_exg_handler_unregister (char *iVerb, char *iMIMEType, char *iHandlerBundleName) |
Undeclare a previously registered action handler. | |
alp_status_t | alp_exg_handler_unregister_notification (char *iVerb, char *iMIMEType, char *iNotificationType) |
Undeclare a previously registered action handler by notification. | |
alp_status_t | alp_exg_handler_check_registration (char *iVerb, char *iMIMEType) |
Determine if a handler exist for a verb/data type pair. | |
alp_status_t | alp_exg_handler_query_verbs (char *iMIMEType, int *oEntryCount, char **oDataP) |
Query a list of verbs that can handle a given data type in a generic mode. | |
alp_status_t | alp_exg_request_create (AlpExgRequest *oRequest) |
Create an empty request object. | |
alp_status_t | alp_exg_request_delete (AlpExgRequest iRequest) |
Delete a request object. | |
alp_status_t | alp_exg_request_set_verb (AlpExgRequest iRequest, char *iVerb) |
Set the request verb. | |
alp_status_t | alp_exg_request_set_data_fd (AlpExgRequest iRequest, int iFd) |
Set the request data source using a file descriptor. | |
alp_status_t | alp_exg_request_set_data_url (AlpExgRequest iRequest, char *iURL) |
Description Set the request data source using an url. | |
alp_status_t | alp_exg_request_set_data_type (AlpExgRequest iRequest, char *iMIMEType) |
Set the request data type. | |
alp_status_t | alp_exg_request_set_int_parameter (AlpExgRequest iRequest, char *iParamTag, int iParamValue) |
Create/Set a request integer parameter. | |
alp_status_t | alp_exg_request_set_string_parameter (AlpExgRequest iRequest, char *iParamTag, char *iParamValue) |
Create/Set a request string parameter. | |
alp_status_t | alp_exg_request_set_blob_parameter (AlpExgRequest iRequest, char *iParamTag, uint8_t *iBlob, size_t iBlobSize) |
Create/Set a request blob parameter. | |
alp_status_t | alp_exg_transport_get_params (AlpExgRequest iRequest, char *oParamsValue, size_t iParamsValueBufLen) |
Retrieve all the transport parameters at once. | |
alp_status_t | alp_exg_transport_set_params (AlpExgRequest iRequest, char *iParamsValue) |
Set all the transport parameters at once. | |
alp_status_t | alp_exg_request_set_generic_mode (AlpExgRequest iRequest) |
Indicate this request is to be executed in generic mode. | |
alp_status_t | alp_exg_request_get_generic_mode (AlpExgRequest iRequest, int *oGenericMode) |
ask whether the request is in generic mode or not. | |
alp_status_t | alp_exg_request_execute (AlpExgRequest iRequest) |
Hand the request to the system and execute it. | |
alp_status_t | alp_exg_request_execute_async (AlpExgRequest iRequest, alp_exg_execute_complete_func iExecuteCompleteFunc) |
Hand the request to the system and execute it asynchronously. | |
alp_status_t | alp_exg_request_activate_progress (AlpExgRequest iRequest) |
Activate Progress Dialog. | |
alp_status_t | alp_exg_request_get_verb (AlpExgRequest iRequest, char *oVerb, size_t iVerbBufLen) |
Get the verb associated to the request. | |
alp_status_t | alp_exg_request_get_data_type (AlpExgRequest iRequest, char *oMIMEType, size_t iMIMETypeBufLen) |
Get the data type of the data. | |
alp_status_t | alp_exg_request_get_int_parameter (AlpExgRequest iRequest, char *iParamTag, int *oParamValue) |
Get an integer parameter from the request. | |
alp_status_t | alp_exg_request_get_string_parameter (AlpExgRequest iRequest, char *iParamTag, char *oParamValue, size_t iParamValueBufLen) |
Get a string parameter from the request. | |
alp_status_t | alp_exg_request_get_string_parameter_const (AlpExgRequest iRequest, char *iParamTag, const char **oParamValue) |
Get a string parameter from the request. | |
alp_status_t | alp_exg_request_get_blob_parameter (AlpExgRequest iRequest, char *iParamTag, uint8_t **oBlob, size_t *oBlobSize) |
Get a binary blob parameter from the request. | |
alp_status_t | alp_exg_request_get_data_fd (AlpExgRequest iRequest, int *oFd) |
Get the data source file descriptor. | |
alp_status_t | alp_exg_request_get_data_url (AlpExgRequest iRequest, char *oUrl, size_t iUrlBufLen) |
Get the data source url. | |
alp_status_t | alp_exg_request_receive (AlpExgRequest *oRequest, AlpExgRequestId iRequestId) |
Receive the request for which we have declared to be the handler. | |
alp_status_t | alp_exg_request_complete (AlpExgRequest iRequest, alp_status_t iResult) |
Tell the exchange manager the handler has completed execution. | |
alp_status_t | alp_exg_request_cancel (AlpExgRequest iRequest) |
Cancel request while execution in progress. | |
alp_status_t | alp_exg_prv_cancel_incoming (int iGuid) |
void | __attribute__ ((constructor)) |
void | __attribute__ ((destructor)) |
Variables | |
alp_status_t | g_synchronous_call_result |
|
|
|
|
|
|
|
|
|
|
|
|
|
Determine if a handler exist for a verb/data type pair. An application can use this function to determine if the specified handler is registered on the local device.
|
|
Query a list of verbs that can handle a given data type in a generic mode. An application can use this function to build a dynamic menu of actions that can be performed on some data that it knows the type. Only the verbs that can handle generic requests will be returned.
|
|
Declare an action handler for a specific verb/type of data combination. An application must register with the exchange manager for all the verb/MIMEtype combinations it knows how to handle. The package specified will be launched (or relauched) when there is an incoming request ready to be handled. Only ALP Packages can be launched this way.
|
|
Declare an action handler for a specific verb/type of data combination. An application must register with the exchange manager for all the verb/MIMEtype combinations it knows how to handle. The notification type specified will be broadcasted when there is an incoming request ready to be handled. The notification type must have been previsouly registered with the notification manager. Using this handler registration mechanism allows daemons or other non ALP Packages to be called to process incoming exchange requests.
|
|
Undeclare a previously registered action handler. If an application registers a handler for its own usage, it will need to unregister it when it quits.
|
|
Undeclare a previously registered action handler by notification. If an application or daemon registers a handler by notification, it will need to unregister it when it quits.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Activate Progress Dialog. Call this function to activate a modal progress dialog that will appear when applicable. Currently, this is only for sending over OBEX using Bluetooth or Irda.
|
|
Cancel request while execution in progress. This function lets you cancel a request while it is executing. When cancel completes, the matching alp_exg_request_execute or execute completion function will return ALP_EXGMGR_ERR_USER_CANCEL_ERROR.
|
|
Tell the exchange manager the handler has completed execution. This function must be called by the handler application when it is finished with execution of the requested operation.
|
|
Create an empty request object. Everything works around the request. You must always create a request before you can do anything useful.
|
|
Delete a request object.
|
|
Hand the request to the system and execute it. When the request if formed, go execute it. This is a synchronous function. No UI is displayed. If the client wants to execute this function asynchronously (e.g. phone app first displays incoming phone number, and then handle the phone call while the request is being executed), it must call it from another thread Upon return of this function, you can get returned parameters from the request, and also retrieve a file descriptor to returned data if any.
|
|
Hand the request to the system and execute it asynchronously. This is the asynchronous request execution function. See alp_exg_request_execute for general information. To use this function, you need to provide a main GMainLoop running in the current context. The exchange mgr will use it to handle its own events and callback your completion routine when execution has finished.
|
|
Get a binary blob parameter from the request. This function will allocate (malloc) a chunk of memory and fill it with the binary data that was passed in this parameter. The caller is responsible to free the chunk.
|
|
Get the data source file descriptor. This function should be called from the action handler or from the request initiator after it has been executed.
|
|
Get the data type of the data. This function will mostly be used from the handler to dispatch execution to the right event handler.
|
|
Get the data source url.
|
|
ask whether the request is in generic mode or not. This function is used by the handler. When a handler has registered itself by indicating it supports generic mode, it must check each request it receives to determine if it must perform a full treatment or just the generic action.
|
|
Get an integer parameter from the request.
|
|
Get a string parameter from the request.
|
|
Get a string parameter from the request. Lets you get a pointer to the string value directly in the request storage. It is much easier and cheaper to use this function than to use alp_exg_request_get_string_parameter. The retrieved pointer will be valid until you use one of the "set" function on the same request, or you delete the request.
|
|
Get the verb associated to the request. This function will mostly be used from the application main loop to dispatch execution to the right event handler.
|
|
|
|
|
|
|
|
Receive the request for which we have declared to be the handler. This function must be called by the handler application in response to the invocation of its ExchangeHandler() function.
|
|
Create/Set a request blob parameter. The parameter is replaced if it was already existing
|
|
Set the request data source using a file descriptor. This function can be used by the request initiator as well as by the action handler to return data.
|
|
Set the request data type.
|
|
Description Set the request data source using an url.
|
|
Indicate this request is to be executed in generic mode. The generic mode is a very simplified mode. When using this mode, the client can only specify a data file descriptor and nothing else. The handler must also have specified that it accepts generic requests. When presented such a request, the handler will perform a default action.
|
|
Create/Set a request integer parameter. The parameter is replaced if it was already existing
|
|
Create/Set a request string parameter. The parameter is replaced if it was already existing
|
|
Set the request verb.
|
|
Retrieve all the transport parameters at once. This function lets you retrieve the transport params string from the current request. This can be useful if you want to save this string somewhere in order to be able to use it unchanged in subsequent requests.
|
|
Set all the transport parameters at once. This function can be used to specify the transport to use and destination device where the request shall be executed. You can either either construct the string yourself if you know the syntax, or use a saved string that you previously built using alp_exg_transport_select(). For the built in transports, the syntax is the following: local : "local;" internet : "inet;destaddr:address_name_or_ip;" where address_name_or_ip is either a name that can be resolved through DNS or a decimal-dotted IP address irda : "irda;" bluetooth : TBD If no transport parameters are set, the request will be executed locally.
|
|
|
|
|