#include <bundle.h>
#include <glib.h>
-typedef gboolean bool;
-
G_BEGIN_DECLS
/**
* @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
* @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
* @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.
* @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.
* @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.
* 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
* @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.
* 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.
* @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.
* @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