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