00001 #ifndef _ERIPC_ 00002 #define _ERIPC_ 00003 00004 /** 00005 * @defgroup eripc Inter-Process Communication Library 00006 * @{ 00007 * @file eripc.h 00008 * @brief Public header for liberipc. 00009 */ 00010 00011 /* 00012 * This file is part of liberipc. 00013 * 00014 * liberipc is free software: you can redistribute it and/or modify 00015 * it under the terms of the GNU General Public License as published by 00016 * the Free Software Foundation, either version 2 of the License, or 00017 * (at your option) any later version. 00018 * 00019 * liberipc is distributed in the hope that it will be useful, 00020 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00021 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00022 * GNU General Public License for more details. 00023 * 00024 * You should have received a copy of the GNU General Public License 00025 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00026 */ 00027 00028 /** 00029 * Copyright (C) 2008 iRex Technologies B.V. 00030 * All rights reserved. 00031 * 00032 * Based on code found in libosso library by Kimmo Hämäläinen <kimmo.hamalainen@nokia.com> 00033 */ 00034 00035 #include <glib.h> 00036 00037 G_BEGIN_DECLS 00038 00039 typedef enum { 00040 ERIPC_ERROR_SUCCESS = 0, /* success (not an error) */ 00041 ERIPC_ERROR_INVALID, /* invalid arguments */ 00042 ERIPC_ERROR_OOM, /* out of memory */ 00043 ERIPC_ERROR, /* generic error code */ 00044 ERIPC_ERROR_TIMEOUT, /* timeout happened */ 00045 } eripc_error_t; 00046 00047 typedef enum { 00048 ERIPC_TYPE_INVALID = 0, 00049 ERIPC_TYPE_BOOL, 00050 ERIPC_TYPE_BYTE, 00051 ERIPC_TYPE_INT, 00052 ERIPC_TYPE_UINT, 00053 ERIPC_TYPE_DOUBLE, 00054 ERIPC_TYPE_STRING, 00055 ERIPC_TYPE_DATA 00056 } eripc_data_t; 00057 00058 typedef enum { 00059 ERIPC_BUS_IRRELEVANT = 0, 00060 ERIPC_BUS_SYSTEM, 00061 ERIPC_BUS_SESSION, 00062 ERIPC_BUS_BOTH 00063 } eripc_bus_t; 00064 00065 typedef enum { 00066 ERIPC_EVENT_NONE = 0, /* non-event, event type is not relevant */ 00067 ERIPC_EVENT_MESSAGE, /* message received */ 00068 ERIPC_EVENT_SIGNAL, /* signal received */ 00069 ERIPC_EVENT_MESSAGE_OR_SIGNAL, /* message or signal received */ 00070 ERIPC_EVENT_REPLY, /* reply received */ 00071 ERIPC_EVENT_ERROR, /* error reply received */ 00072 ERIPC_EVENT_REPLY_OR_ERROR, /* reply or error received */ 00073 } eripc_event_t; 00074 00075 typedef struct _eripc_context_t eripc_context_t; 00076 00077 typedef struct { 00078 int type; /* type of argument */ 00079 int data_len; /* only used with ERIPC_TYPE_DATA to tell 00080 the length of the data */ 00081 union { 00082 int b; /* ERIPC_TYPE_BOOL */ 00083 char by; /* ERIPC_TYPE_BYTE */ 00084 int i; /* ERIPC_TYPE_INT */ 00085 unsigned int u; /* ERIPC_TYPE_UINT */ 00086 double d; /* ERIPC_TYPE_DOUBLE */ 00087 char *s; /* ERIPC_TYPE_STRING */ 00088 void *data; /* ERIPC_TYPE_DATA */ 00089 } value; 00090 } eripc_arg_t; 00091 00092 typedef struct { 00093 const char *service; /* service name or NULL */ 00094 const char *path; /* object path or NULL */ 00095 const char *interface; /* interface name or NULL */ 00096 const char *name; /* name of message/signal or NULL */ 00097 00098 /* Received event type, in case it is one of the 00099 * pre-defined events */ 00100 eripc_event_t event_type; 00101 00102 /* Message bus type. The type may be ERIPC_BUS_IRRELEVANT 00103 * for e.g. pre-defined events. */ 00104 eripc_bus_t bus_type; 00105 00106 /* This can be an ID string of the reply or a received message. */ 00107 const char *message_id; 00108 00109 /* Received error message, or NULL */ 00110 const char *error; 00111 00112 /* Array of arguments (coming or going), terminating to 00113 * argument of type #ERIPC_TYPE_INVALID. args is NULL if the 00114 * message has no arguments. 00115 * Note that this is ignored in case of a vararg function. */ 00116 const eripc_arg_t *args; 00117 00118 /* Pointer to the DBus message related ot this event */ 00119 char *dbus_message; 00120 } eripc_event_info_t; 00121 00122 /** 00123 * This is the type for the callback handlers of events and messages. 00124 * 00125 * This function is called when the asynchronous function returns a 00126 * reply or when a registered event occurs. 00127 * 00128 * @param context IPC context returned by #eripc_init. 00129 * @param info Structure specifying the type of event and its arguments. 00130 * @param user_data Optional user data passed when the handler was 00131 registered. 00132 */ 00133 typedef void (eripc_handler_t)(eripc_context_t *context, 00134 const eripc_event_info_t *info, 00135 void *user_data); 00136 00137 typedef struct osso_af_context_t osso_context_t; 00138 00139 00140 /**********************************/ 00141 /* FUNCTIONS */ 00142 /**********************************/ 00143 00144 void *eripc_get_system_connection (eripc_context_t *context); 00145 void *eripc_get_session_connection (eripc_context_t *context); 00146 00147 /** 00148 * This function initialises the library, connects to both the D-Bus session 00149 * and system busses, integrates with the GLib main loop, and 00150 * initialises the library for use. #eripc_init should be called 00151 * only once by the program. 00152 * @param program_name The name of the program. 00153 * This name forms the last part of the default (D-Bus) service name of the 00154 * program. Note that the D-Bus service name will be 00155 * 'com.irexnet.program_name', where 'program_name' is the value you gave as 00156 * the parameter. The only valid characters that the name may contain are 00157 * letters a-z and the underscore '_'. 00158 * However, you can give a name such as 'org.foo.bar' to 00159 * have 'bar' as your program's name and 'org.foo.bar' as the D-Bus service 00160 * name. 00161 * @param program_version The version string of the application. This will 00162 * be used to determine if a saved UI state is still valid for the program. 00163 * @param context The GLib main loop context to connect to, or NULL for 00164 * the default context. 00165 * @return A context to use in later calls to this library, or NULL if an 00166 * error happened. 00167 */ 00168 eripc_context_t *eripc_init(const char *program_name, 00169 const char *program_version, 00170 GMainContext *context); 00171 00172 /** 00173 * This function registers a handler for a signal. 00174 * 00175 * @param context IPC context returned by #eripc_init. 00176 * @param handler The handler function to call when the event happens. 00177 * @param user_data Optional user data to pass to the handler when it 00178 * is called. 00179 * @param bus_type The bus type (session or system bus). 00180 * @param source Interface name to receive signal/message from. 00181 * @param signal_name Name of the signal. 00182 * @param handler_id Return location for the handler ID, which is used 00183 * to unregister the handler. 00184 * 00185 * @return #ERIPC_ERROR_SUCCESS on success. 00186 */ 00187 eripc_error_t eripc_set_signal_handler(eripc_context_t *context, 00188 eripc_handler_t *handler, 00189 void *user_data, 00190 eripc_bus_t bus_type, 00191 const char *source, 00192 const char *signal_name, 00193 int *handler_id); 00194 00195 /** 00196 * This function registers a handler for a message. 00197 * 00198 * @param context IPC context returned by #eripc_init. 00199 * @param handler The handler function to call when the event happens. 00200 * @param user_data Optional user data to pass to the handler when it 00201 * is called. 00202 * @param bus_type The bus type (session or system bus). 00203 * @param source Interface name of message to receive. 00204 * @param message_name Name of the message/method. 00205 * @param handler_id Return location for the handler ID, which is used 00206 * to unregister the handler. 00207 * 00208 * @return #ERIPC_ERROR_SUCCESS on success. 00209 */ 00210 eripc_error_t eripc_set_message_handler(eripc_context_t *context, 00211 eripc_handler_t *handler, 00212 void *user_data, 00213 eripc_bus_t bus_type, 00214 const char *source, 00215 const char *message_name, 00216 int *handler_id); 00217 00218 /** 00219 * This function registers a custom handler for event, message, or signal. 00220 * 00221 * @param context IPC context returned by #eripc_init. 00222 * @param info Structure specifying the type of events to handle. 00223 * @param handler The handler function to call when the event happens. 00224 * @param user_data Optional user data to pass to the handler when it 00225 * is called. 00226 * @param handler_id Return location for the handler ID, which is used 00227 * to unregister the handler. 00228 * 00229 * @return #ERIPC_ERROR_SUCCESS on success. 00230 */ 00231 eripc_error_t eripc_set_event_handler(eripc_context_t *context, 00232 const eripc_event_info_t *info, 00233 eripc_handler_t *handler, 00234 void *user_data, 00235 int *handler_id); 00236 00237 /** 00238 * This function unregisters a handler for event, message, or signal. 00239 * 00240 * @param context IPC context returned by #eripc_init. 00241 * @param handler_id Handler to unregister. The handler will not be 00242 * called after it has been successfully unregistered. 00243 * 00244 * @return #ERIPC_ERROR_SUCCESS on success. 00245 */ 00246 eripc_error_t eripc_unset_handler(eripc_context_t *context, 00247 int handler_id); 00248 00249 00250 /** 00251 * Returns the current RPC timeout value. 00252 * @param context IPC context returned by #eripc_init. 00253 * @param timeout A pointer where to return the timeout value in milliseconds. 00254 * @return #ERIPC_ERROR_SUCCESS on success. 00255 */ 00256 eripc_error_t eripc_get_timeout (eripc_context_t *context, int *timeout); 00257 00258 /** 00259 * Sets the timeout value used by the RPC functions. 00260 * @param context IPC context returned by #eripc_init. 00261 * @param timeout The new timeout value in milliseconds. 00262 * @return #ERIPC_ERROR_SUCCESS on success. 00263 */ 00264 eripc_error_t eripc_set_timeout(eripc_context_t *context, int timeout); 00265 00266 /** 00267 * This function sends a variable message and registers a reply handler. 00268 * 00269 * The variable arguments work in a type-value pairs. The type argument 00270 * defines the type of the following value. If the type is G_TYPE_STRING, 00271 * then the value is a pointer to a string. The list must end in a 00272 * ERIPC_TYPE_INVALID. The supported types are: 00273 * - ERIPC_TYPE_BOOL 00274 * - The value is a gboolean. 00275 * - ERIPC_TYPE_BYTE, ERIPC_TYPE_INT, ERIPC_TYPE_UINT 00276 * - The value is an byte, int or an unsigned int. 00277 * - ERIPC_TYPE_DOUBLE 00278 * - The value is a float. 00279 * - ERIPC_TYPE_STRING 00280 * - The value is a pointer to a string. 00281 * - ERIPC_TYPE_DATA 00282 * - Two values are expected: first an integer indicating length of 00283 * the data block (e.g. array), second a pointer to the data block. 00284 * 00285 * @param context IPC context returned by #eripc_init. 00286 * @param reply_handler The handler function to call when a reply is 00287 * returned. Set to NULL for no reply. 00288 * @param user_data Optional user data to pass to the handler when it 00289 * is called. 00290 * @param bus_type The bus type (session or system bus). 00291 * @param destination Interface name to send message to. 00292 * @param message_name Name of the message/method to call. 00293 * @param arg_type The type of the first argument. 00294 * @param ... The first argument value, and then a type-value list of other 00295 * arguments. This list must end in a #ERIPC_TYPE_INVALID type. 00296 * @return #ERIPC_ERROR_SUCCESS on success. 00297 */ 00298 eripc_error_t eripc_send_varargs(eripc_context_t *context, 00299 eripc_handler_t *reply_handler, 00300 const void *user_data, 00301 eripc_bus_t bus_type, 00302 const char *destination, 00303 const char *message_name, 00304 eripc_data_t arg_type, ...); 00305 00306 /** 00307 * This function sends a string message and registers a reply handler. 00308 * 00309 * Instead of the variable arguments of #eripc_send_varargs, this 00310 * function has single string as argument. 00311 * 00312 * @param context IPC context returned by #eripc_init. 00313 * @param reply_handler The handler function to call when a reply is 00314 * returned. Set to NULL for no reply. 00315 * @param user_data Optional user data to pass to the handler when it 00316 * is called. 00317 * @param bus_type The bus type (session or system bus). 00318 * @param destination Interface name to send message to. 00319 * @param message_name Name of the message/method to call. 00320 * @param string The argument string. 00321 * @return #ERIPC_ERROR_SUCCESS on success. 00322 */ 00323 eripc_error_t eripc_send_string(eripc_context_t *context, 00324 eripc_handler_t *reply_handler, 00325 const void *user_data, 00326 eripc_bus_t bus_type, 00327 const char *destination, 00328 const char *message_name, 00329 const char *string); 00330 00331 /** 00332 * This function sends an integer message and registers a reply handler. 00333 * 00334 * Instead of the variable arguments of #eripc_send_varargs, this 00335 * function has single integer as argument. 00336 * 00337 * @param context IPC context returned by #eripc_init. 00338 * @param reply_handler The handler function to call when a reply is 00339 * returned. Set to NULL for no reply. 00340 * @param user_data Optional user data to pass to the handler when it 00341 * is called. 00342 * @param bus_type The bus type (session or system bus). 00343 * @param destination Interface name to send message to. 00344 * @param message_name Name of the message/method to call. 00345 * @param value The argument value. 00346 * @return #ERIPC_ERROR_SUCCESS on success. 00347 */ 00348 eripc_error_t eripc_send_int(eripc_context_t *context, 00349 eripc_handler_t *reply_handler, 00350 const void *user_data, 00351 eripc_bus_t bus_type, 00352 const char *destination, 00353 const char *message_name, 00354 int value); 00355 00356 /** 00357 * This function sends a boolean message and registers a reply handler. 00358 * 00359 * Instead of the variable arguments of #eripc_send_varargs, this 00360 * function has single boolean as argument. 00361 * 00362 * @param context IPC context returned by #eripc_init. 00363 * @param reply_handler The handler function to call when a reply is 00364 * returned. Set to NULL for no reply. 00365 * @param user_data Optional user data to pass to the handler when it 00366 * is called. 00367 * @param bus_type The bus type (session or system bus). 00368 * @param destination Interface name to send message to. 00369 * @param message_name Name of the message/method to call. 00370 * @param value The argument value. 00371 * @return #ERIPC_ERROR_SUCCESS on success. 00372 */ 00373 eripc_error_t eripc_send_bool(eripc_context_t *context, 00374 eripc_handler_t *reply_handler, 00375 const void *user_data, 00376 eripc_bus_t bus_type, 00377 const char *destination, 00378 const char *message_name, 00379 gboolean value); 00380 00381 /** 00382 * This function sends a variable message and return reply immediately. 00383 * This call is blocking. 00384 * 00385 * The variable arguments work in a type-value pairs. The type argument 00386 * defines the type of the following value. If the type is G_TYPE_STRING, 00387 * then the value is a pointer to a string. The list must end in a 00388 * ERIPC_TYPE_INVALID. The supported types are: 00389 * - ERIPC_TYPE_BOOL 00390 * - The value is a gboolean. 00391 * - ERIPC_TYPE_BYTE, ERIPC_TYPE_INT, ERIPC_TYPE_UINT 00392 * - The value is an byte, int or an unsigned int. 00393 * - ERIPC_TYPE_DOUBLE 00394 * - The value is a float. 00395 * - ERIPC_TYPE_STRING 00396 * - The value is a pointer to a string. 00397 * - ERIPC_TYPE_DATA 00398 * - Two values are expected: first an integer indicating length of 00399 * the data block (e.g. array), second a pointer to the data block. 00400 * 00401 * @param [in] context IPC context returned by #eripc_init. 00402 * @param [out] reply A pointer pointer to the event info structure where 00403 * the return info goes. Set to NULL for no reply arguments. 00404 * If the expected reply does not come within the RPC timeout 00405 * value set with the #eripc_set_timeout function. Caller 00406 * must free the reply structure using #eripc_event_info_free. 00407 * @param [in] bus_type The bus type (session or system bus). 00408 * @param [in] destination Interface name to send message to. 00409 * @param [in] message_name Name of the message/method to call. 00410 * @param [in] arg_type The type of the first argument. 00411 * @param [in] ... The first argument value, and then a type-value list of 00412 * other arguments. This list must end in a #ERIPC_TYPE_INVALID type. 00413 * @return #ERIPC_ERROR_SUCCESS on success. 00414 */ 00415 eripc_error_t eripc_send_varargs_and_wait(eripc_context_t *context, 00416 eripc_event_info_t **reply, 00417 eripc_bus_t bus_type, 00418 const char *destination, 00419 const char *message_name, 00420 eripc_data_t arg_type, ...); 00421 00422 /** 00423 * This function sends a string message and return reply immediately. 00424 * This call is blocking. 00425 * 00426 * Instead of the variable arguments of #eripc_send_varargs_and_wait, 00427 * this function has single string as argument. 00428 * 00429 * @param [in] context IPC context returned by #eripc_init. 00430 * @param [out] reply A pointer pointer to the event info structure where 00431 * the return info goes. Set to NULL for no reply arguments. 00432 * If the expected reply does not come within the RPC timeout 00433 * value set with the #eripc_set_timeout function. Caller 00434 * must free the reply structure using #eripc_event_info_free. 00435 * @param [in] bus_type The bus type (session or system bus). 00436 * @param [in] destination Interface name to send message to. 00437 * @param [in] message_name Name of the message/method to call. 00438 * @param [in] string The argument string. 00439 * @return #ERIPC_ERROR_SUCCESS on success. 00440 */ 00441 eripc_error_t eripc_send_string_and_wait(eripc_context_t *context, 00442 eripc_event_info_t **reply, 00443 eripc_bus_t bus_type, 00444 const char *destination, 00445 const char *message_name, 00446 const char *string); 00447 00448 /** 00449 * This function sends an integer message and return reply immediately. 00450 * This call is blocking. 00451 * 00452 * Instead of the variable arguments of #eripc_send_varargs_and_wait, 00453 * this function has single integer as argument. 00454 * 00455 * @param [in] context IPC context returned by #eripc_init. 00456 * @param [out] reply A pointer pointer to the event info structure where 00457 * the return info goes. Set to NULL for no reply arguments. 00458 * If the expected reply does not come within the RPC timeout 00459 * value set with the #eripc_set_timeout function. Caller 00460 * must free the reply structure using #eripc_event_info_free. 00461 * @param [in] bus_type The bus type (session or system bus). 00462 * @param [in] destination Interface name to send message to. 00463 * @param [in] message_name Name of the message/method to call. 00464 * @param [in] value The argument value. 00465 * @return #ERIPC_ERROR_SUCCESS on success. 00466 */ 00467 eripc_error_t eripc_send_int_and_wait(eripc_context_t *context, 00468 eripc_event_info_t **reply, 00469 eripc_bus_t bus_type, 00470 const char *destination, 00471 const char *message_name, 00472 int value); 00473 00474 /** 00475 * This function sends a boolean message and return reply immediately. 00476 * This call is blocking. 00477 * 00478 * Instead of the variable arguments of #eripc_send_varargs_and_wait, 00479 * this function has single boolean as argument. 00480 * 00481 * @param [in] context IPC context returned by #eripc_init. 00482 * @param [out] reply A pointer pointer to the event info structure where 00483 * the return info goes. Set to NULL for no reply arguments. 00484 * If the expected reply does not come within the RPC timeout 00485 * value set with the #eripc_set_timeout function. Caller 00486 * must free the reply structure using #eripc_event_info_free. 00487 * @param [in] bus_type The bus type (session or system bus). 00488 * @param [in] destination Interface name to send message to. 00489 * @param [in] message_name Name of the message/method to call. 00490 * @param [in] value The argument value. 00491 * @return #ERIPC_ERROR_SUCCESS on success. 00492 */ 00493 eripc_error_t eripc_send_bool_and_wait(eripc_context_t *context, 00494 eripc_event_info_t **reply, 00495 eripc_bus_t bus_type, 00496 const char *destination, 00497 const char *message_name, 00498 gboolean value); 00499 00500 /** 00501 * This function sends a signal with optional string argument. 00502 * 00503 * The signal defaults to the path and interface in the 00504 * context. For more flexibility, use #eripc_send_signal_varargs. 00505 * 00506 * @param context IPC context returned by #eripc_init. 00507 * @param bus_type The bus type (session or system bus). 00508 * @param signal_name Name of the signal to send. 00509 * @param argument The argument string or NULL for no argument. 00510 * @return #ERIPC_ERROR_SUCCESS on success. 00511 */ 00512 eripc_error_t eripc_send_signal(eripc_context_t *context, 00513 eripc_bus_t bus_type, 00514 const char *signal_name, 00515 const char *argument); 00516 00517 /** 00518 * This function sends a signal with variable arguments. 00519 * 00520 * The variable arguments work in a type-value pairs. The type argument 00521 * defines the type of the following value. If the type is G_TYPE_STRING, 00522 * then the value is a pointer to a string. The list must end in a 00523 * ERIPC_TYPE_INVALID. The supported types are: 00524 * - ERIPC_TYPE_BOOL 00525 * - The value is a gboolean. 00526 * - ERIPC_TYPE_BYTE, ERIPC_TYPE_INT, ERIPC_TYPE_UINT 00527 * - The value is an byte, int or an unsigned int. 00528 * - ERIPC_TYPE_DOUBLE 00529 * - The value is a float. 00530 * - ERIPC_TYPE_STRING 00531 * - The value is a pointer to a string. 00532 * - ERIPC_TYPE_DATA 00533 * - Two values are expected: first an integer indicating length of 00534 * the data block (e.g. array), second a pointer to the data block. 00535 * 00536 * @param context IPC context returned by #eripc_init. 00537 * @param bus_type The bus type (session or system bus). 00538 * @param signal_path The object path of the signal to send. 00539 * @param signal_interface The interface name of the signal to send. 00540 * @param signal_name Name of the signal to send. 00541 * @param arg_type The type of the first argument. 00542 * @param ... The first argument value, and then a type-value list of other 00543 * arguments. This list must end in a #ERIPC_TYPE_INVALID type. 00544 * @return #ERIPC_ERROR_SUCCESS on success. 00545 */ 00546 eripc_error_t eripc_send_signal_varargs(eripc_context_t *context, 00547 eripc_bus_t bus_type, 00548 const char *signal_path, 00549 const char *signal_interface, 00550 const char *signal_name, 00551 eripc_data_t arg_type, ...); 00552 00553 /** 00554 * This function frees the event info structure and associated message. 00555 * 00556 * @param context IPC context returned by #eripc_init. 00557 * @param reply A pointer to the event info structure where the return 00558 * info is stored. 00559 * 00560 * @return #ERIPC_ERROR_SUCCESS on success. 00561 */ 00562 eripc_error_t eripc_event_info_free(eripc_context_t *context, 00563 eripc_event_info_t *reply); 00564 00565 00566 /**********************/ 00567 /* reply to a message */ 00568 /**********************/ 00569 00570 /** 00571 * This function returns a reply to a message with variable arguments. 00572 * 00573 * The variable arguments work in a type-value pairs. The type argument 00574 * defines the type of the following value. If the type is G_TYPE_STRING, 00575 * then the value is a pointer to a string. The list must end in a 00576 * ERIPC_TYPE_INVALID. The supported types are: 00577 * - ERIPC_TYPE_BOOL 00578 * - The value is a gboolean. 00579 * - ERIPC_TYPE_BYTE, ERIPC_TYPE_INT, ERIPC_TYPE_UINT 00580 * - The value is an byte, int or an unsigned int. 00581 * - ERIPC_TYPE_DOUBLE 00582 * - The value is a float. 00583 * - ERIPC_TYPE_STRING 00584 * - The value is a pointer to a string. 00585 * - ERIPC_TYPE_DATA 00586 * - Two values are expected: first an integer indicating length of 00587 * the data block (e.g. array), second a pointer to the data block. 00588 * 00589 * @param context IPC context returned by #eripc_init. 00590 * @param message_id ID string of the received message to reply to. 00591 * @param arg_type The type of the first argument. 00592 * @param ... The first argument value, and then a type-value list of other 00593 * arguments. This list must end in a #ERIPC_TYPE_INVALID type. 00594 * @return #ERIPC_ERROR_SUCCESS on success. 00595 */ 00596 eripc_error_t eripc_reply_varargs(eripc_context_t *context, 00597 const char *message_id, 00598 eripc_data_t arg_type, ...); 00599 00600 /** 00601 * This function returns a reply to a message with a string argument. 00602 * 00603 * Instead of the variable arguments of #eripc_reply_varargs, 00604 * this function has single string as argument. 00605 * 00606 * @param context IPC context returned by #eripc_init. 00607 * @param message_id ID string of the received message to reply to. 00608 * @param string The argument string. 00609 * @return #ERIPC_ERROR_SUCCESS on success. 00610 */ 00611 eripc_error_t eripc_reply_string(eripc_context_t *context, 00612 const char *message_id, 00613 const char *string); 00614 00615 /** 00616 * This function returns a reply to a message with an integer argument. 00617 * 00618 * Instead of the variable arguments of #eripc_reply_varargs, 00619 * this function has single integer as argument. 00620 * 00621 * @param context IPC context returned by #eripc_init. 00622 * @param message_id ID string of the received message to reply to. 00623 * @param value The argument value. 00624 * @return #ERIPC_ERROR_SUCCESS on success. 00625 */ 00626 eripc_error_t eripc_reply_int(eripc_context_t *context, 00627 const char *message_id, 00628 int value); 00629 00630 /** 00631 * This function returns a reply to a message with a boolean argument. 00632 * 00633 * Instead of the variable arguments of #eripc_reply_varargs, 00634 * this function has single boolean as argument. 00635 * 00636 * @param context IPC context returned by #eripc_init. 00637 * @param message_id ID string of the received message to reply to. 00638 * @param value The argument value. 00639 * @return #ERIPC_ERROR_SUCCESS on success. 00640 */ 00641 eripc_error_t eripc_reply_bool(eripc_context_t *context, 00642 const char *message_id, 00643 gboolean value); 00644 00645 /** 00646 * This function return an error in reply to a message. 00647 * 00648 * The error_name indicates the error which can be fully-qualitfied. 00649 * When the service is omitted from the error name, the service 00650 * of the given context is used. 00651 * 00652 * @param context IPC context returned by #eripc_init. 00653 * @param message_id ID string of the received message to reply to. 00654 * @param error_name The name of the error to return. 00655 * @param error_message Text string with error description. 00656 * @return #ERIPC_ERROR_SUCCESS on success. 00657 */ 00658 eripc_error_t eripc_reply_error(eripc_context_t *context, 00659 const char *message_id, 00660 const char *error_name, 00661 const char *error_message); 00662 00663 G_END_DECLS 00664 00665 /** @} */ 00666 00667 #endif /* _ERIPC_ */