*/
int messageport_register_trusted_local_port(const char* local_port, messageport_message_cb callback);
-
-/**
- * @brief Unregisters the local message port.
- *
- * @param [in] id The message port id returned by messageport_register_local_port() or messageport_register_trusted_local_port()
- * @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
- */
-int messageport_unregister_local_port(int id);
-
/**
* @brief Checks if the message port of a remote application is registered.
*
IpcClient* pIpcClient = new (std::nothrow) IpcClient();
if (pIpcClient == NULL)
{
+ _LOGE("Out of memory");
return MESSAGEPORT_ERROR_OUT_OF_MEMORY;
}
delete pIpcClient;
_LOGE("Failed to create ipc client: %d.", ret);
-
return MESSAGEPORT_ERROR_IO_ERROR;
}
pthread_mutex_t* pMutex = (pthread_mutex_t*) malloc(sizeof(pthread_mutex_t));
if (pMutex == NULL)
{
+ _LOGE("Out of memory");
return MESSAGEPORT_ERROR_OUT_OF_MEMORY;
}
if (pMsg == NULL)
{
bundle_free(b);
+
+ _LOGE("Out of memory");
return MESSAGEPORT_ERROR_OUT_OF_MEMORY;
}
{
bundle_free(b);
+ _LOGE("Out of memory");
return MESSAGEPORT_ERROR_OUT_OF_MEMORY;
}
if (ret < 0)
{
_LOGE("Failed to send a request: %d.", ret);
-
return MESSAGEPORT_ERROR_IO_ERROR;
}
IPC::Message* pMsg = new MessagePort_sendMessage(metadata, buffer, &return_value);
if (pMsg == NULL)
{
+ _LOGE("Out of memory");
return MESSAGEPORT_ERROR_OUT_OF_MEMORY;
}
if (ret < 0)
{
_LOGE("Failed to send a request: %d.", ret);
-
return MESSAGEPORT_ERROR_IO_ERROR;
}
it = __trustedIds.find(id);
if (it == __ids.end())
{
+ _LOGE("Invalid value %d", id);
return NULL;
}
else
it = __trustedIds.find(id);
if (it == __ids.end())
{
+ _LOGE("Invalid value %d", id);
return MESSAGEPORT_ERROR_INVALID_PARAMETER;
}
else
MessagePortProxy* p = new MessagePortProxy();
if (p == NULL)
{
+ _LOGE("Out of memory");
return NULL;
}
{
char* pName = pProxy->GetLocalPortNameN(id);
bool trusted = false;
- pProxy->CheckTrustedLocalPort(id, &trusted);
+ ret = pProxy->CheckTrustedLocalPort(id, &trusted);
+ if (ret < 0)
+ {
+ return MESSAGEPORT_ERROR_INVALID_PARAMETER;
+ }
ret = pProxy->SendMessage(pName, trusted, remote_app_id, remote_port, false, message);