00001 /* SVN FILE INFO 00002 * $Revision: 199 $ : Last Committed Revision 00003 * $Date: 2008年07月11日 10:33:31 -0700 (2008年7月11日) $ : Last Committed Date */ 00004 #ifndef _ASM_NODE_H_ 00005 #define _ASM_NODE_H_ 00006 00007 00008 #include <mxml.h> 00009 #ifndef _WIN32 00010 #include <netinet/in.h> 00011 #else 00012 #include <windows.h> 00013 #include <winsock.h> 00014 #endif 00015 #include "../include/macros.h" 00016 #include "../include/message.h" 00017 #include "xyssl-0.9/include/xyssl/dhm.h" 00018 #include "xyssl-0.9/include/xyssl/rsa.h" 00019 #include "xyssl-0.9/include/xyssl/aes.h" 00020 #ifndef _WIN32 00021 #include "config.h" 00022 #else 00023 #include "../winconfig.h" 00024 #endif 00025 00026 #ifdef MC_SECURITY 00027 00028 typedef enum asm_encryption_type_e 00029 { 00030 NONE, /* No Encryption */ 00031 DH, /* Diffie-Hellman */ 00032 NUM_ENCRYPT_METHODS 00033 } asm_encryption_type_t; 00034 00035 /* 00036 * Holds data for a Diffie-Hellman encrypted data exchange session 00037 * */ 00038 typedef struct dh_data_s 00039 { 00040 dhm_context dhm; 00041 rsa_context rsa; 00042 aes_context aes; 00043 } dh_data_t; 00044 typedef dh_data_t* dh_data_p; 00045 00046 /* Use a union here in case we want to support multiple methods of 00047 * authentication / encryption */ 00048 typedef union asm_encryption_data_u 00049 { 00050 struct dh_data_s* dh_data; /* Diffie-Hellman Data */ 00051 /* Add other structs here for other protocols */ 00052 } asm_encryption_data_t; 00053 typedef asm_encryption_data_t* asm_encryption_data_p; 00054 00055 typedef struct asm_node_s 00056 { 00057 int id; 00058 struct sockaddr_in* remote_addr; /* hostname:port */ 00059 asm_encryption_type_t type; 00060 union asm_encryption_data_u data; 00061 mxml_node_t* xml_encrypt_root; 00062 } asm_node_t; 00063 typedef asm_node_t* asm_node_p; 00064 00065 int 00066 asm_node_Destroy 00067 ( 00068 asm_node_p asm_node 00069 ); 00070 00071 struct mc_asm_s; 00072 asm_node_p 00073 asm_node_Initialize(message_p message, struct mc_asm_s* security_manager); 00074 00075 #endif /*MC_SECURITY*/ 00076 #endif