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 struct asm_node_s;
00046
00047
00048 typedef enum message_type_e {
00049 RELAY,
00050 REQUEST,
00051 SUBSCRIBE,
00052 CANCEL,
00053 N_UNDRSTD,
00054 MOBILE_AGENT,
00055 QUER_IF,
00056 QUER_REF,
00057 AGENT_UPDATE,
00058 RETURN_MSG,
00059 FIPA_ACL,
00060 ENCRYPTED_DATA,
00061 ENCRYPTION_INITIALIZE,
00062 REQUEST_ENCRYPTION_INITIALIZE,
00063 NUM_MESSAGE_TYPE
00064 } message_type_t;
00065
00066
00067
00068
00069
00070
00071
00072
00073 typedef struct message_s{
00074
00075 struct sockaddr_in* addr;
00076
00077
00078 int connect_id;
00079 int message_id;
00080
00081
00082 int isHTTP;
00083
00084
00085 enum message_type_e message_type;
00086 enum http_performative_e http_type;
00087
00088 mxml_node_t* xml_root;
00089 mxml_node_t* xml_payload;
00090
00091
00092 char* message_body;
00093
00094 char *update_name;
00095 int update_num;
00096
00097 char* from_address;
00098 char* to_address;
00099
00100 char* target;
00101
00102
00103
00104
00105
00106
00107 int agent_xml_flag;
00108 } message_t;
00109 typedef message_t* message_p;
00110
00111 #ifdef MC_SECURITY
00112 int
00113 message_Decrypt(message_p message, struct asm_node_s* asm_node);
00114
00115 int
00116 message_Encrypt(message_p message, struct asm_node_s* asm_node);
00117 #endif
00118
00119 message_p
00120 message_New(void);
00121
00122 message_p
00123 message_Copy(message_p src);
00124
00125 struct agent_s;
00126 struct mc_platform_s;
00127 int
00128 message_InitializeFromAgent(
00129 struct mc_platform_s* mc_platform,
00130 message_p message,
00131 struct agent_s* agent);
00132
00133 struct connection_s;
00134 int
00135 message_InitializeFromConnection(
00136 struct mc_platform_s* mc_platform,
00137 message_p message,
00138 struct connection_s* connection);
00139
00140 int
00141 message_InitializeFromString(
00142 struct mc_platform_s* mc_platform,
00143 message_p message,
00144 const char* string,
00145 const char* destination_host,
00146 int destination_port,
00147 const char* target);
00148
00149 int
00150 message_Destroy(message_p message);
00151
00152 int
00153 message_Send(message_p message);
00154
00155 int
00156 http_to_hostport(const char* http_str, char** host, int* port, char** target);
00157 #endif