#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <netdb.h>
#include <errno.h>
#include "config.h"
#include <mxml.h>
#include "include/libmc.h"
#include "include/agent.h"
#include "include/mc_platform.h"
#include "include/message.h"
#include "include/mtp_http.h"
#include "include/xml_compose.h"
#include "include/xml_parser.h"
#include "include/macros.h"
#include "../include/macros.h"
#include "../include/message.h"
#include "xyssl-0.9/include/xyssl/dhm.h"
#include "xyssl-0.9/include/xyssl/rsa.h"
#include "xyssl-0.9/include/xyssl/aes.h"
Go to the source code of this file.
Defines | |
#define | SOCKET_INPUT_SIZE 4096 |
#define | MSG_THREADS 40 |
#define | MSG_THREAD_EXIT() |
Functions | |
message_p | message_New (void) |
message_p | message_Copy (message_p src) |
int | message_InitializeFromAgent (mc_platform_p mc_platform, message_p message, agent_p agent) |
int | message_InitializeFromConnection (mc_platform_p mc_platform, message_p message, connection_p connection) |
int | http_to_hostport (const char *http_str, char **host, int *port, char **target) |
int | message_InitializeFromString (mc_platform_p mc_platform, message_p message, const char *string, const char *destination_host, int destination_port, const char *target) |
int | message_Destroy (message_p message) |
int | auth_rece_send_msg (int sockfd, char *hostname, char *message, char *privkey, char *known_host_filename) |
int | message_Send (mc_platform_t *mc_platform, message_p message, char *privatekey) |
void * | message_send_Thread (void *arg) |
#define MSG_THREAD_EXIT | ( | ) |
free(arg); \ message_Destroy(message); \ MUTEX_LOCK(&mc_platform->acc->msg_thread_lock); \ mc_platform->acc->num_msg_threads--; \ COND_SIGNAL(&mc_platform->acc->msg_thread_cond); \ MUTEX_UNLOCK(&mc_platform->acc->msg_thread_lock); \ THREAD_EXIT()
Definition at line 637 of file message.c.
Referenced by message_send_Thread().
#define MSG_THREADS 40 |
Definition at line 574 of file message.c.
Referenced by message_Send().
int auth_rece_send_msg | ( | int | sockfd, | |
char * | hostname, | |||
char * | message, | |||
char * | privkey, | |||
char * | known_host_filename | |||
) |
Definition at line 453 of file message.c.
References aes_en_de(), initiate_migration_process(), read_known_host_file(), and send_AES_en_MA().
Referenced by message_send_Thread().
Definition at line 414 of file message.c.
References message_s::addr, message_s::agent_xml_flag, message_s::from_address, MC_SUCCESS, message_s::message_body, mxmlDelete(), message_s::target, message_s::to_address, message_s::update_name, and message_s::xml_root.
Referenced by acc_connection_Thread(), acc_MessageHandlerThread(), ams_ManageAgentList(), MC_LoadAgentFromFile(), MC_SendAgent(), MC_SendAgentFile(), MC_SendAgentMigrationMessage(), MC_SendAgentMigrationMessageFile(), and message_InitializeFromConnection().
int message_InitializeFromAgent | ( | mc_platform_p | mc_platform, | |
message_p | message, | |||
agent_p | agent | |||
) |
Definition at line 105 of file message.c.
References message_s::addr, agent_xml_compose(), message_s::agent_xml_flag, mc_platform_s::bluetooth, buf, CHECK_NULL, agent_s::datastate, mc_platform_s::err, message_s::from_address, agent_s::home, mc_platform_s::hostname, MC_ERR_MEMORY, MC_SUCCESS, message_s::message_body, message_s::message_id, message_s::message_type, MOBILE_AGENT, MXML_NO_CALLBACK, mxmlSaveAllocString(), agent_s::name, agent_datastate_s::number_of_tasks, mc_platform_s::port, message_s::sending_agent_name, agent_task_s::server_name, strdup, strtok_r, message_s::target, agent_datastate_s::task_progress, agent_datastate_s::tasks, message_s::to_address, message_s::update_name, WARN, and message_s::xml_root.
int message_InitializeFromConnection | ( | mc_platform_p | mc_platform, | |
message_p | message, | |||
connection_p | connection | |||
) |
Definition at line 207 of file message.c.
References connection_s::addr, message_s::addr, CHECK_NULL, connection_s::clientfd, connection_s::connect_id, message_s::connect_id, message_s::from_address, MC_ERR_CONNECT, MC_ERR_PARSE, MC_SUCCESS, message_s::message_body, message_Destroy(), message_s::message_id, message_xml_parse(), MXML_NO_CALLBACK, mxmlLoadString(), SOCKET_ERROR, SOCKET_INPUT_SIZE, message_s::target, message_s::to_address, and message_s::xml_root.
int message_InitializeFromString | ( | mc_platform_p | mc_platform, | |
message_p | message, | |||
const char * | string, | |||
const char * | destination_host, | |||
int | destination_port, | |||
const char * | target | |||
) |
Definition at line 333 of file message.c.
References message_s::addr, CHECK_NULL, message_s::connect_id, mc_platform_s::err, message_s::from_address, mc_platform_s::hostname, MC_ERR_MEMORY, MC_ERR_PARSE, MC_SUCCESS, message_s::message_body, message_s::message_id, message_s::message_type, message_xml_parse(), MOBILE_AGENT, MXML_NO_CALLBACK, mxmlLoadString(), mc_platform_s::port, message_s::target, message_s::to_address, message_s::update_name, and message_s::xml_root.
message_p message_New | ( | void | ) |
Definition at line 73 of file message.c.
References message_s::addr, message_s::agent_xml_flag, CHECK_NULL, message_s::connect_id, message_s::from_address, message_s::http_type, message_s::isHTTP, message_s::message_body, message_s::message_id, message_s::message_type, message_s::target, message_s::to_address, message_s::update_name, message_s::update_num, message_s::xml_payload, and message_s::xml_root.
Referenced by acc_connection_Thread(), ams_ManageAgentList(), MC_LoadAgentFromFile(), MC_SendAgent(), MC_SendAgentFile(), MC_SendAgentMigrationMessage(), MC_SendAgentMigrationMessageFile(), and mtp_http_CreateMessage().
int message_Send | ( | mc_platform_t * | mc_platform, | |
message_p | message, | |||
char * | privatekey | |||
) |
Definition at line 575 of file message.c.
References mc_platform_s::acc, COND_WAIT, message_send_arg_s::mc_platform, message_send_arg_s::message, message_send_Thread(), MSG_THREADS, MUTEX_LOCK, MUTEX_UNLOCK, message_send_arg_s::privatekey, THREAD_CREATE, and THREAD_DETACH.
Referenced by acc_MessageHandlerThread(), MC_AclSend(), and message_queue_SendOutgoing().
void* message_send_Thread | ( | void * | arg | ) |
Definition at line 648 of file message.c.
References mc_platform_s::agency, auth_rece_send_msg(), mc_platform_s::bluetooth, buf, CHECK_NULL, dynstring_Append(), dynstring_Destroy(), dynstring_New(), agency_s::known_host_filename, mc_platform, dynstring_s::message, message_s::message_body, MSG_THREAD_EXIT, mtp_http_ComposeMessage(), mtp_http_Destroy(), mtp_http_New(), mtp_http_Parse(), port, send, SOCKET_ERROR, SOCKET_INPUT_SIZE, strtok_r, and message_s::to_address.
Referenced by message_Send().