|
C/C++ Reference
|
00001 /* 00002 * ____ _________ __ _ 00003 * / __ \___ ____ _/ /_ __(_)___ ___ ___ / / ____ ____ _(_)____ 00004 * / /_/ / _ \/ __ `/ / / / / / __ `__ \/ _ \/ / / __ \/ __ `/ / ___/ 00005 * / _, _/ __/ /_/ / / / / / / / / / / / __/ /___/ /_/ / /_/ / / /__ 00006 * /_/ |_|\___/\__,_/_/ /_/ /_/_/ /_/ /_/\___/_____/\____/\__, /_/\___/ 00007 * /____/ 00008 * 00009 * Barracuda Embedded Web-Server 00010 * 00011 **************************************************************************** 00012 * HEADER 00013 * 00014 * $Id: HttpServCon.h 1977 2010-01-27 12:37:51Z wini $ 00015 * 00016 * COPYRIGHT: Real Time Logic LLC, 2003-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 __HttpServCon_h 00030 #define __HttpServCon_h 00031 00032 #include <HttpConnection.h> 00033 #include <SoDisp.h> 00034 00035 00036 struct HttpServer; 00037 struct HttpServCon; 00038 00039 typedef void (*HttpServCon_AcceptNewCon)( 00040 struct HttpServCon* scon, HttpConnection* newcon); 00041 00042 00050 typedef struct HttpServCon 00051 { 00052 #ifdef __cplusplus 00053 00054 void *operator new(size_t s) { return ::baMalloc(s); } 00055 void operator delete(void* d) { if(d) ::baFree(d); } 00056 void *operator new(size_t, void *place) { return place; } 00057 void operator delete(void*, void *) { } 00058 00059 00127 HttpServCon(HttpServer* server, 00128 SoDisp* dispatcher, 00129 U16 port=80, 00130 BaBool setIP6=FALSE, 00131 const void* interfaceName=0, 00132 HttpServCon_AcceptNewCon userDefinedAccept=0); 00133 00138 BaBool isValid(); 00139 00142 int setPort(U16 portNumber, bool setIp6=false, 00143 const void* interfaceName=0); 00144 00145 ~HttpServCon(); 00146 HttpServCon() {} 00147 private: 00148 #endif 00149 HttpConnection con; 00150 HttpServCon_AcceptNewCon userDefinedAccept; 00151 } HttpServCon; 00152 00153 00154 #ifdef __cplusplus 00155 extern "C" { 00156 #endif 00157 BA_API void HttpServCon_constructor(HttpServCon* o, 00158 struct HttpServer* server, 00159 struct SoDisp* dispatcher, 00160 U16 port, 00161 BaBool setIP6, 00162 const void* interfaceName, 00163 HttpServCon_AcceptNewCon userDefinedAccept); 00164 #define HttpServCon_isValid(o) \ 00165 SoDispCon_isValid((SoDispCon*)(o)) 00166 BA_API int HttpServCon_setPort(HttpServCon* o, U16 portNumber, 00167 BaBool setIp6, const void* interfaceName); 00168 BA_API void HttpServCon_destructor(HttpServCon* o); 00169 BA_API int HttpServCon_init( 00170 HttpServCon* o, 00171 struct HttpServer* server, 00172 U16 port, 00173 BaBool setIP6, 00174 const void* interfaceName); 00175 00176 /* Exclusively used by ClientConnection*/ 00177 void HttpServCon_bindExec(SoDispCon* con); 00178 00179 #ifdef __cplusplus 00180 } 00181 inline HttpServCon::HttpServCon(HttpServer* server, 00182 SoDisp* dispatcher, 00183 U16 port, 00184 BaBool setIP6, 00185 const void* interfaceName, 00186 HttpServCon_AcceptNewCon userDefinedAccept) { 00187 HttpServCon_constructor(this,server,dispatcher,port,setIP6,interfaceName, 00188 userDefinedAccept); 00189 } 00190 inline HttpServCon::~HttpServCon() { 00191 HttpServCon_destructor(this); 00192 } 00193 inline BaBool HttpServCon::isValid() { return HttpServCon_isValid(this); } 00194 inline int HttpServCon::setPort( 00195 U16 portNumber,bool setIp6,const void* interfaceName) { 00196 return HttpServCon_setPort(this,portNumber,setIp6?TRUE:FALSE,interfaceName); 00197 } 00198 00199 00200 #endif 00201 00202 #endif