/home/dko/projects/mobilec/trunk/src/include/connection.h

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

Generated on Mon Jun 23 16:01:09 2008 for Mobile-C by  doxygen 1.5.4