C/C++ Reference
SoDisp.h
00001 /*
00002  *     ____             _________                __                _     
00003  *    / __ \___  ____ _/ /_  __(_)___ ___  ___  / /   ____  ____ _(_)____
00004  *   / /_/ / _ \/ __ `/ / / / / / __ `__ \/ _ \/ /   / __ \/ __ `/ / ___/
00005  *  / _, _/  __/ /_/ / / / / / / / / / / /  __/ /___/ /_/ / /_/ / / /__  
00006  * /_/ |_|\___/\__,_/_/ /_/ /_/_/ /_/ /_/\___/_____/\____/\__, /_/\___/  
00007  *                                                       /____/          
00008  *
00009  *                  Barracuda Embedded Web-Server
00010  *
00011  ****************************************************************************
00012  *                            HEADER
00013  *
00014  *   $Id: SoDisp.h 2564 2012-01-19 18:51:31Z wini $
00015  *
00016  *   COPYRIGHT:  Real Time Logic LLC, 2002-2008
00017  *               http://www.realtimelogic.com
00018  *
00019  *   The copyright to the program herein is the property of
00020  *   Real Time Logic. The program may be used or copied only
00021  *   with the written permission from Real Time Logic LLC or
00022  *   in accordance with the terms and conditions stipulated in
00023  *   the agreement under which the program has been supplied.
00024  ****************************************************************************
00025  *
00026  *
00027  */
00028 
00029 #ifndef _SoDisp_h
00030 #define _SoDisp_h
00031 
00032 #include <HttpCfg.h>
00033 #include <ThreadLib.h>
00034 
00035 
00036 struct SoDispCon;
00037 struct HttpServer;
00038 
00076 typedef struct SoDisp
00077 {
00078 #ifdef __cplusplus
00079 
00080       void *operator new(size_t s) { return ::baMalloc(s); }
00081       void operator delete(void* d) { if(d) ::baFree(d); }
00082       void *operator new(size_t, void *place) { return place; }
00083       void operator delete(void*, void *) { }
00084 
00088       SoDisp(ThreadMutex* mutex);
00089 
00095       void mutexSet();
00096 
00100       void mutexRelease();
00101 
00104       ThreadMutex* getMutex();
00105 
00106       void addConnection(SoDispCon* con);
00107       void activateRec(SoDispCon* con);
00108       void deactivateRec(SoDispCon* con);
00109       void activateSend(SoDispCon* con);
00110       void deactivateSend(SoDispCon* con);
00111       void removeConnection(SoDispCon* con);
00112 
00115       void setExit();
00116 
00131       void run(S32 timeout=-1);
00132 #ifdef OSE
00133       union SIGNAL* receive(S32 timeout=-1, SIGSELECT* sel=0);
00134 #endif
00135 #endif
00136       DISPATCHER_DATA;
00137       ThreadMutex* mutex;
00138       void* timeoutO;
00139       BaBool doExit;
00140 } SoDisp;
00141 
00142 #ifdef __cplusplus
00143 extern "C" {
00144 #endif
00145 BA_API void SoDisp_constructor(SoDisp* o, ThreadMutex* mutex);
00146 BA_API void SoDisp_addConnection(SoDisp* o, struct SoDispCon* con);
00147 BA_API void SoDisp_activateRec(SoDisp* o, struct SoDispCon* con);
00148 BA_API void SoDisp_deactivateRec(SoDisp* o, struct SoDispCon* con);
00149 #ifdef NO_ASYNCH_RESP
00150 #define SoDisp_activateSend(o, con)
00151 #define SoDisp_deactivateSend(o, con)
00152 #else
00153 BA_API void SoDisp_activateSend(SoDisp* o, struct SoDispCon* con);
00154 BA_API void SoDisp_deactivateSend(SoDisp* o, struct SoDispCon* con);
00155 #endif
00156 BA_API void SoDisp_removeConnection(SoDisp* o, struct SoDispCon* con);
00157 BA_API void SoDisp_run(SoDisp* o, S32 timeout);
00158 #ifdef OSE
00159 union SIGNAL* SoDisp_receive(SoDisp* o, S32 time, SIGSELECT* sel);
00160 #endif
00161 #define SoDisp_getMutex(o) ((o) ? ((o)->mutex) : 0)
00162 #define SoDisp_mutexSet(o) ThreadMutex_set((o)->mutex)
00163 #define SoDisp_mutexRelease(o) ThreadMutex_release((o)->mutex)
00164 #define SoDisp_setExit(o) (o)->doExit=TRUE
00165 
00166 BA_API void SoDisp_newCon(SoDisp*, struct SoDispCon*);
00167 
00168 #ifdef __cplusplus
00169 }
00170 inline SoDisp::SoDisp(ThreadMutex* mutex) {
00171    SoDisp_constructor(this, mutex); }
00172 inline void SoDisp::addConnection(SoDispCon* con) {
00173    SoDisp_addConnection(this, con); }
00174 inline void SoDisp::activateRec(SoDispCon* con) {
00175    SoDisp_activateRec(this, con); }
00176 inline void SoDisp::deactivateRec(SoDispCon* con) {
00177    SoDisp_deactivateRec(this, con); }
00178 inline void SoDisp::activateSend(SoDispCon* con) {
00179    SoDisp_activateSend(this, con); }
00180 inline void SoDisp::deactivateSend(SoDispCon* con) {
00181    SoDisp_deactivateSend(this, con); }
00182 inline void SoDisp::removeConnection(SoDispCon* con) {
00183    SoDisp_removeConnection(this, con); }
00184 inline void SoDisp::run(S32 timeout) {
00185    SoDisp_run(this, timeout); }
00186 inline ThreadMutex* SoDisp::getMutex() {
00187    return SoDisp_getMutex(this); }
00188 #ifdef OSE
00189 inline union SIGNAL* SoDisp::receive(S32 time, SIGSELECT* sel) {
00190    return SoDisp_receive(this, time, sel); }
00191 #endif
00192 inline void SoDisp::mutexSet() { SoDisp_mutexSet(this); }
00193 inline void SoDisp::mutexRelease() {SoDisp_mutexRelease(this);}
00194 inline void SoDisp::setExit() { SoDisp_setExit(this); }
00195 
00196 #endif
00197 
00198 void SoDisp_setTimeout(
00199    SoDisp* o, BaTime t, void (*cb)(void* object), void* object);
00200 
00201 
00202 #endif