00001 /* SVN FILE INFO 00002 * $Revision: 316 $ : Last Committed Revision 00003 * $Date: 2009-04-29 16:40:54 -0700 (Wed, 29 Apr 2009) $ : Last Committed Date */ 00004 /*[ 00005 * Copyright (c) 2007 Integration Engineering Laboratory 00006 University of California, Davis 00007 * 00008 * Permission to use, copy, and distribute this software and its 00009 * documentation for any purpose with or without fee is hereby granted, 00010 * provided that the above copyright notice appear in all copies and 00011 * that both that copyright notice and this permission notice appear 00012 * in supporting documentation. 00013 * 00014 * Permission to modify the software is granted, but not the right to 00015 * distribute the complete modified source code. Modifications are to 00016 * be distributed as patches to the released version. Permission to 00017 * distribute binaries produced by compiling modified sources is granted, 00018 * provided you 00019 * 1. distribute the corresponding source modifications from the 00020 * released version in the form of a patch file along with the binaries, 00021 * 2. add special version identification to distinguish your version 00022 * in addition to the base release version number, 00023 * 3. provide your name and address as the primary contact for the 00024 * support of your modified version, and 00025 * 4. retain our contact information in regard to use of the base 00026 * software. 00027 * Permission to distribute the released version of the source code along 00028 * with corresponding source modifications in the form of a patch file is 00029 * granted with same provisions 2 through 4 for binary distributions. 00030 * 00031 * This software is provided "as is" without express or implied warranty 00032 * to the extent permitted by applicable law. 00033 ]*/ 00034 00035 #ifndef _CONNECTION_H_ 00036 #define _CONNECTION_H_ 00037 #include <sys/types.h> 00038 #ifndef _WIN32 00039 #include <netinet/in.h> 00040 #else 00041 #include <windows.h> 00042 #endif 00043 00044 struct mc_platform_s; 00045 00046 typedef struct connection_s { 00047 00048 /* the primary id of the connection */ 00049 int connect_id; 00050 /* session identifier */ 00051 int nonce; 00052 00053 /* socket - Network Variables */ 00054 char *remote_hostname; 00055 00056 struct sockaddr_in addr; 00057 00058 /* file descriptors */ 00059 u_long clientfd; 00060 u_long serverfd; 00061 00062 /* connection key */ 00063 unsigned char *AES_key; 00064 00065 }connection_t; 00066 typedef connection_t* connection_p; 00067 00068 /* glocal functions - basic */ 00069 connection_p 00070 connection_New(void); 00071 00072 int 00073 connection_Destroy(connection_p connection); 00074 00075 connection_p 00076 connection_Copy(connection_p connection); 00077 00078 void connection_Close(connection_p connection); 00079 void connection_SetHosts(connection_p connection, char* remote_host, char *local_host); 00080 00081 /* global functions special */ 00082 int connection_CreateMessage(connection_p connection); 00083 int connection_SendtoConnection(connection_p connection, char * send_buffer); 00084 int connection_RecvFromConnection(connection_p connection, 00085 struct mc_platform_s *global); 00086 00087 00088 #endif