bidirectional messages implemented, updated the example code
[profile/ivi/message-port.git] / lib / message-port.h
index 31a94b8..ed823f8 100644 (file)
@@ -12,8 +12,6 @@
 #include <bundle.h>
 #include <glib.h>
 
-typedef gboolean bool;
-
 G_BEGIN_DECLS
 
 /**
@@ -41,7 +39,7 @@ typedef enum _messageport_error_e
  * @remarks @a data must be released with bundle_free() by you
  * @remark @a remote_app_id and @a remote_port will be set if the remote application sends a bidirectional message, otherwise they are NULL.
  */
-typedef void (*messageport_message_cb)(int id, const char* remote_app_id, const char* remote_port, bool trusted_message, bundle* data);
+typedef void (*messageport_message_cb)(int id, const char* remote_app_id, const char* remote_port, gboolean trusted_message, bundle* data);
 
 /**
  * @brief Registers the local message port. @n
@@ -55,7 +53,8 @@ typedef void (*messageport_message_cb)(int id, const char* remote_app_id, const
  * @retval #MESSAGEPORT_ERROR_OUT_OF_MEMORY Out of memory
  * @retval #MESSAGEPORT_ERROR_IO_ERROR Internal I/O error
  */
-EXPORT_API int messageport_register_local_port(const char* local_port, messageport_message_cb callback);
+EXPORT_API int
+messageport_register_local_port(const char* local_port, messageport_message_cb callback);
 
 /**
  * @brief Registers the trusted local message port. @n
@@ -70,7 +69,8 @@ EXPORT_API int messageport_register_local_port(const char* local_port, messagepo
  * @retval #MESSAGEPORT_ERROR_OUT_OF_MEMORY Out of memory
  * @retval #MESSAGEPORT_ERROR_IO_ERROR Internal I/O error
  */
-EXPORT_API int messageport_register_trusted_local_port(const char* local_port, messageport_message_cb callback);
+EXPORT_API int
+messageport_register_trusted_local_port(const char* local_port, messageport_message_cb callback);
 
 /**
  * @brief Checks if the message port of a remote application is registered.
@@ -84,7 +84,8 @@ EXPORT_API int messageport_register_trusted_local_port(const char* local_port, m
  * @retval #MESSAGEPORT_ERROR_OUT_OF_MEMORY Out of memory
  * @retval #MESSAGEPORT_ERROR_IO_ERROR Internal I/O error
  */
-EXPORT_API int messageport_check_remote_port(const char* remote_app_id, const char *remote_port, bool* exist);
+EXPORT_API messageport_error_e
+messageport_check_remote_port(const char* remote_app_id, const char *remote_port, gboolean *exist);
 
 /**
  * @brief Checks if the trusted message port of a remote application is registered.
@@ -99,7 +100,8 @@ EXPORT_API int messageport_check_remote_port(const char* remote_app_id, const ch
  * @retval #MESSAGEPORT_ERROR_CERTIFICATE_NOT_MATCH The remote application is not signed with the same certificate
  * @retval #MESSAGEPORT_ERROR_IO_ERROR Internal I/O error
  */
-EXPORT_API int messageport_check_trusted_remote_port(const char* remote_app_id, const char *remote_port, bool* exist);
+EXPORT_API messageport_error_e
+messageport_check_trusted_remote_port(const char* remote_app_id, const char *remote_port, gboolean *exist);
 
 /**
  * @brief Sends a message to the message port of a remote application.
@@ -127,7 +129,8 @@ EXPORT_API int messageport_check_trusted_remote_port(const char* remote_app_id,
  * bundle_free(b);
  * @endcode
  */
-EXPORT_API int messageport_send_message(const char* remote_app_id, const char* remote_port, bundle* message);
+EXPORT_API messageport_error_e
+messageport_send_message(const char* remote_app_id, const char* remote_port, bundle* message);
 
 /**
  * @brief Sends a trusted message to the message port of a remote application. @n
@@ -145,7 +148,8 @@ EXPORT_API int messageport_send_message(const char* remote_app_id, const char* r
  * @retval #MESSAGEPORT_ERROR_MAX_EXCEEDED The size of message has exceeded the maximum limit
  * @retval #MESSAGEPORT_ERROR_IO_ERROR Internal I/O error
  */
-EXPORT_API int messageport_send_trusted_message(const char* remote_app_id, const char* remote_port, bundle* message);
+EXPORT_API messageport_error_e
+messageport_send_trusted_message(const char* remote_app_id, const char* remote_port, bundle* message);
 
 /**
  * @brief Sends a message to the message port of a remote application. This method is used for the bidirectional communication.
@@ -183,7 +187,8 @@ EXPORT_API int messageport_send_trusted_message(const char* remote_app_id, const
  *   bundle_free(b);
  * }
  */
-EXPORT_API int messageport_send_bidirectional_message(int id, const char* remote_app_id, const char* remote_port, bundle* data);
+EXPORT_API messageport_error_e
+messageport_send_bidirectional_message(int id, const char* remote_app_id, const char* remote_port, bundle* data);
 
 /**
  * @brief Sends a trusted message to the message port of a remote application. This method is used for the bidirectional communication.
@@ -202,7 +207,8 @@ EXPORT_API int messageport_send_bidirectional_message(int id, const char* remote
  * @retval #MESSAGEPORT_ERROR_MAX_EXCEEDED The size of message has exceeded the maximum limit
  * @retval #MESSAGEPORT_ERROR_IO_ERROR Internal I/O error
  */
-EXPORT_API int messageport_send_bidirectional_trusted_message(int id, const char* remote_app_id, const char* remote_port, bundle* data);
+EXPORT_API messageport_error_e
+messageport_send_bidirectional_trusted_message(int id, const char* remote_app_id, const char* remote_port, bundle* data);
 
 /**
  * @brief Gets the name of the local message port.
@@ -215,19 +221,21 @@ EXPORT_API int messageport_send_bidirectional_trusted_message(int id, const char
  * @retval #MESSAGEPORT_ERROR_OUT_OF_MEMORY Out of memory
  * @remarks @a name must be released with free() by you
  */
-EXPORT_API int messageport_get_local_port_name(int id, char **name);
+EXPORT_API messageport_error_e
+messageport_get_local_port_name(int id, char **name);
 
 /**
  * @brief Checks if the local message port is trusted.
  *
  * @param [in] id The message port id returned by messageport_register_local_port() or messageport_register_trusted_local_port()
- * @param [out] @c true if the local message port is trusted
+ * @param [out] is_trusted true if the local message port is trusted
  * @return 0 on success, otherwise a negative error value.
  * @retval #MESSAGEPORT_ERROR_NONE Successful
  * @retval #MESSAGEPORT_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #MESSAGEPORT_ERROR_OUT_OF_MEMORY Out of memory
  */
-EXPORT_API int messageport_check_trusted_local_port(int id, bool *trusted);
+EXPORT_API messageport_error_e
+messageport_check_trusted_local_port(int id, gboolean *is_trusted);
 
 G_END_DECLS