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