/home/dko/projects/mobilec/trunk/src/include/acc.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 _ACC_H_
00033 #define _ACC_H_
00034 #ifndef _WIN32
00035 #include <sys/socket.h>
00036 #else
00037 #include <windows.h>
00038 #include <winsock.h>
00039 #endif
00040 #include "macros.h"
00041 
00042 struct mc_platform_s;
00043 
00044 
00045 STRUCT(
00046     acc,
00047     struct mc_platform_s* mc_platform;
00048     THREAD_T thread;
00049     THREAD_T message_handler_thread;
00050     THREAD_T listen_thread;
00051 
00052     /* waiting flag: Note that this flag only applies to the listen_thread */
00053     int waiting;
00054     MUTEX_T* waiting_lock;
00055     COND_T* waiting_cond;
00056     )
00057 
00058 STRUCT(
00059     listen_thread_arg,
00060     u_long port;
00061     struct sockaddr_in *addr;
00062     unsigned long int client_fd;
00063     unsigned long int server_fd;
00064     );
00065 
00066 acc_p 
00067 acc_Initialize(struct mc_platform_s* mc_platform);
00068 
00069 int
00070 acc_Destroy(acc_p acc);
00071 
00072 void
00073 acc_Start(struct mc_platform_s*  mc_platform);
00074 
00075 #ifndef _WIN32
00076 void* 
00077 acc_MessageHandlerThread(void* arg);
00078 
00079 void* 
00080 acc_Thread(void* arg);
00081 
00082 void* 
00083 listen_Thread(void* arg);
00084 #else
00085 DWORD WINAPI 
00086 acc_MessageHandlerThread( LPVOID arg );
00087 
00088 DWORD WINAPI 
00089 acc_Thread( LPVOID arg );
00090 
00091 DWORD WINAPI 
00092 listen_Thread( LPVOID arg );
00093 #endif /* _WIN32 */
00094 
00095 #endif 

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