#include <sys/socket.h>#include <arpa/inet.h>#include <netinet/in.h>#include <netdb.h>#include <sys/un.h>#include <unistd.h>#include <sys/time.h>#include <pthread.h>#include "config.h"#include <stdlib.h>#include "include/acc.h"#include "macros.h"#include "agent_datastate.h"#include "agent_task.h"#include "libmc.h"#include "message.h"#include <sys/types.h>#include <semaphore.h>#include <errno.h>#include "acc.h"#include "ams.h"#include "barrier.h"#include "cmd_prompt.h"#include "connection.h"#include "df.h"#include "../mc_sync/sync_list.h"#include "../mc_list/list.h"#include "../security/asm.h"#include "mtp_http.h"#include <mxml.h>#include <stdio.h>#include <string.h>#include <sys/stat.h>#include "xyssl-0.9/include/xyssl/havege.h"#include "xyssl-0.9/include/xyssl/bignum.h"#include "xyssl-0.9/include/xyssl/rsa.h"#include "xyssl-0.9/include/xyssl/sha2.h"#include "xyssl-0.9/include/xyssl/sha1.h"#include "xyssl-0.9/include/xyssl/aes.h"#include "xyssl-0.9/include/xyssl/md5.h"#include "agent.h"#include "fipa_acl.h"Go to the source code of this file.
Defines | |
| #define | BACKLOG 200 |
| #define | CONN_THREADS 40 |
| #define | CONNECT_THREAD_EXIT() |
| #define | BUFLEN 512 |
| #define | UDPPORT 8866 |
Functions | |
| acc_p | acc_Initialize (struct mc_platform_s *mc_platform) |
| int | acc_Destroy (acc_p acc) |
| void * | acc_MessageHandlerThread (void *arg) |
| void * | acc_Thread (void *arg) |
| void * | acc_connection_Thread (void *arg) |
| void | acc_Start (mc_platform_p mc_platform) |
| int | auth_conn_rece_key (int sockfd, char *peer_name, int *nonce, unsigned char *aes_key, char *privkey, char *known_host_filename) |
| void * | listen_Thread (void *arg) |
| void * | udplisten_Thread (void *arg) |
| #define BACKLOG 200 |
Definition at line 74 of file acc.c.
Referenced by listen_Thread().
| #define BUFLEN 512 |
Definition at line 934 of file acc.c.
Referenced by udplisten_Thread().
| #define CONN_THREADS 40 |
Definition at line 304 of file acc.c.
Referenced by acc_Thread().
| #define CONNECT_THREAD_EXIT | ( | ) |
free(arg); \
MUTEX_LOCK(&acc->conn_thread_lock); \
acc->num_conn_threads--; \
COND_SIGNAL(&acc->conn_thread_cond); \
MUTEX_UNLOCK(&acc->conn_thread_lock); \
THREAD_EXIT();
Definition at line 395 of file acc.c.
Referenced by acc_connection_Thread().
| #define UDPPORT 8866 |
Definition at line 935 of file acc.c.
Referenced by udplisten_Thread().
| void* acc_connection_Thread | ( | void * | arg | ) |
Definition at line 405 of file acc.c.
References mc_platform_s::acc, fipa_agent_identifier_s::addresses, agent_CmpName(), mc_platform_s::agent_queue, AGENT_UPDATE, CANCEL, CONNECT_THREAD_EXIT, connection_Destroy(), mtp_http_s::content, mtp_http_content_s::data, FIPA_ACL, fipa_acl_envelope_Destroy(), fipa_acl_envelope_New(), fipa_acl_message_Destroy(), fipa_acl_message_New(), fipa_acl_Parse(), fipa_agent_identifier_set_s::fipa_agent_identifiers, fipa_envelope_Parse(), fipa_message_string_Destroy(), fipa_message_string_New(), mtp_http_s::http_performative, HTTP_POST, HTTP_PUT, ListAdd(), ListRDLock(), ListRDUnlock(), ListSearchCB(), ListWRLock(), ListWRUnlock(), agent_s::mailbox, agent_s::mc_platform, fipa_message_string_s::message, message_s::message_body, message_Destroy(), message_New(), mtp_http_s::message_parts, mc_platform_s::message_queue, message_s::message_type, message_xml_parse(), MOBILE_AGENT, mtp_http_Destroy(), mtp_http_InitializeFromConnection(), mtp_http_New(), MXML_NO_CALLBACK, mxmlLoadString(), N_UNDRSTD, fipa_agent_identifier_s::name, fipa_agent_identifier_set_s::num, fipa_acl_envelope_s::num_params, fipa_acl_envelope_s::params, fipa_message_string_s::parse, mc_platform_s::port, mc_platform_s::private_key, QUER_IF, QUER_REF, RELAY, REQUEST, RETURN_MSG, fipa_url_s::str, strdup, SUBSCRIBE, mtp_http_s::target, fipa_acl_Param_s::to, fipa_url_sequence_s::urls, and message_s::xml_root.
Referenced by acc_Thread().
| int acc_Destroy | ( | acc_p | acc | ) |
Definition at line 102 of file acc.c.
References COND_DESTROY, MC_SUCCESS, and MUTEX_DESTROY.
Referenced by mc_platform_Destroy().
| acc_p acc_Initialize | ( | struct mc_platform_s * | mc_platform | ) |
Definition at line 77 of file acc.c.
References COND_INIT, COND_T, MUTEX_INIT, and MUTEX_T.
Referenced by mc_platform_Initialize().
| void* acc_MessageHandlerThread | ( | void * | arg | ) |
Definition at line 118 of file acc.c.
References mc_platform_s::acc, agent_CmpName(), agent_Initialize(), mc_platform_s::agent_queue, agent_s::agent_status, agent_s::agent_status_cond, agent_s::agent_status_lock, AGENT_UPDATE, mc_platform_s::ams, CANCEL, COND_BROADCAST, COND_WAIT, agent_s::datastate, FIPA_ACL, mc_platform_s::giant, mc_platform_s::giant_cond, mc_platform_s::giant_lock, ListAdd(), ListPop(), ListSearchCB(), ListWRLock(), ListWRUnlock(), ListWRWait(), agent_s::lock, MC_AGENT_NEUTRAL, MC_RECV_AGENT, MC_RECV_MESSAGE, MC_RECV_RETURN, mc_platform_s::MC_signal, mc_platform_s::MC_signal_cond, mc_platform_s::MC_signal_lock, message_Destroy(), mc_platform_s::message_queue, message_Send(), message_s::message_type, MOBILE_AGENT, MUTEX_LOCK, MUTEX_UNLOCK, N_UNDRSTD, agent_s::name, agent_datastate_s::persistent, QUER_IF, QUER_REF, mc_platform_s::quit, mc_platform_s::quit_lock, RELAY, REQUEST, RETURN_MSG, SUBSCRIBE, THREAD_EXIT, and message_s::to_address.
Referenced by acc_Start().
| void acc_Start | ( | mc_platform_p | mc_platform | ) |
Definition at line 589 of file acc.c.
References mc_platform_s::acc, acc_MessageHandlerThread(), acc_Thread(), listen_Thread(), MC_THREAD_ACC, mc_platform_s::stack_size, THREAD_CREATE, and udplisten_Thread().
Referenced by mc_platform_Initialize().
| void* acc_Thread | ( | void * | arg | ) |
Definition at line 307 of file acc.c.
References mc_platform_s::acc, acc_connection_Thread(), COND_BROADCAST, COND_WAIT, CONN_THREADS, mc_platform_s::connection_queue, mc_platform_s::giant, mc_platform_s::giant_cond, mc_platform_s::giant_lock, ListGetSize(), ListPop(), ListRDLock(), ListRDtoWR(), ListRDUnlock(), ListRDWait(), ListWRUnlock(), MC_RECV_CONNECTION, mc_platform_s::MC_signal, mc_platform_s::MC_signal_cond, mc_platform_s::MC_signal_lock, MUTEX_LOCK, MUTEX_UNLOCK, mc_platform_s::quit, mc_platform_s::quit_lock, THREAD_CREATE, THREAD_DETACH, and THREAD_EXIT.
Referenced by acc_Start().
| int auth_conn_rece_key | ( | int | sockfd, | |
| char * | peer_name, | |||
| int * | nonce, | |||
| unsigned char * | aes_key, | |||
| char * | privkey, | |||
| char * | known_host_filename | |||
| ) |
Definition at line 638 of file acc.c.
References read_known_host_file(), and reply_migration_process().
Referenced by listen_Thread().
| void* listen_Thread | ( | void * | arg | ) |
Definition at line 677 of file acc.c.
References mc_platform_s::acc, connection_s::addr, connection_s::AES_key, mc_platform_s::agency, auth_conn_rece_key(), BACKLOG, mc_platform_s::bluetooth, connection_s::clientfd, COND_BROADCAST, connection_s::connect_id, connection_New(), mc_platform_s::connection_queue, agency_s::known_host_filename, ListAdd(), ListWRLock(), ListWRUnlock(), MUTEX_LOCK, MUTEX_UNLOCK, connection_s::nonce, mc_platform_s::port, agency_s::portno, mc_platform_s::private_key, mc_platform_s::quit, connection_s::remote_hostname, connection_s::serverfd, SOCKET_ERROR, mc_platform_s::sockfd, and THREAD_EXIT.
Referenced by acc_Start().
| void* udplisten_Thread | ( | void * | arg | ) |
Definition at line 938 of file acc.c.
References buf, BUFLEN, mc_platform_s::hostname, PACKAGE_VERSION, mc_platform_s::port, and UDPPORT.
Referenced by acc_Start().
1.6.3