00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef _MESSAGE_H_
00036 #define _MESSAGE_H_
00037 #include "config.h"
00038 #include "mtp_http.h"
00039 #include <mxml.h>
00040 #ifndef _WIN32
00041 #include <netinet/in.h>
00042 #else
00043 #include <windows.h>
00044 #endif
00045
00046
00047 #include "security/interface.h"
00048 struct asm_node_s;
00049
00050
00051 typedef enum message_type_e {
00052 RELAY,
00053 REQUEST,
00054 SUBSCRIBE,
00055 CANCEL,
00056 N_UNDRSTD,
00057 MOBILE_AGENT,
00058 QUER_IF,
00059 QUER_REF,
00060 AGENT_UPDATE,
00061 RETURN_MSG,
00062 FIPA_ACL,
00063 ENCRYPTED_DATA,
00064 ENCRYPTION_INITIALIZE,
00065 REQUEST_ENCRYPTION_INITIALIZE,
00066 NUM_MESSAGE_TYPE,
00067 MSG_SEC
00068 } message_type_t;
00069
00070
00071
00072
00073
00074
00075
00076
00077 typedef struct message_s{
00078
00079 struct sockaddr_in* addr;
00080
00081
00082 int connect_id;
00083 int message_id;
00084
00085
00086 int isHTTP;
00087
00088
00089 enum message_type_e message_type;
00090 enum http_performative_e http_type;
00091
00092 mxml_node_t* xml_root;
00093 mxml_node_t* xml_payload;
00094
00095
00096 char* message_body;
00097
00098 char *update_name;
00099 int update_num;
00100
00101 char* from_address;
00102 char* to_address;
00103
00104 char* target;
00105
00106
00107
00108
00109
00110
00111 int agent_xml_flag;
00112 } message_t;
00113 typedef message_t* message_p;
00114
00115 #ifdef MC_SECURITY
00116 int
00117 message_Decrypt(message_p message, struct asm_node_s* asm_node);
00118
00119 int
00120 message_Encrypt(message_p message, struct asm_node_s* asm_node);
00121 #endif
00122
00123 message_p
00124 message_New(void);
00125
00126 message_p
00127 message_Copy(message_p src);
00128
00129 struct agent_s;
00130 struct mc_platform_s;
00131 int
00132 message_InitializeFromAgent(
00133 struct mc_platform_s* mc_platform,
00134 message_p message,
00135 struct agent_s* agent);
00136
00137 struct connection_s;
00138 int
00139 message_InitializeFromConnection(
00140 struct mc_platform_s* mc_platform,
00141 message_p message,
00142 struct connection_s* connection);
00143
00144 int
00145 message_InitializeFromString(
00146 struct mc_platform_s* mc_platform,
00147 message_p message,
00148 const char* string,
00149 const char* destination_host,
00150 int destination_port,
00151 const char* target);
00152
00153 int
00154 message_Destroy(message_p message);
00155
00156 int
00157 auth_rece_send_msg(int sockfd, char *hostname, char *message, char *privkey, char *known_host_filename);
00158
00159 int
00160 message_Send(struct mc_platform_s* mc_platform, message_p message, char *privatekey);
00161
00162 int
00163 http_to_hostport(const char* http_str, char** host, int* port, char** target);
00164 #endif