/home/dko/projects/mobilec/trunk/src/security/asm_node.h

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

Generated on Fri May 16 14:49:55 2008 for Mobile-C by  doxygen 1.5.4