Barracuda Application Server C/C++ Reference
NO
HttpServCon.h
1/*
2 * ____ _________ __ _
3 * / __ \___ ____ _/ /_ __(_)___ ___ ___ / / ____ ____ _(_)____
4 * / /_/ / _ \/ __ `/ / / / / / __ `__ \/ _ \/ / / __ \/ __ `/ / ___/
5 * / _, _/ __/ /_/ / / / / / / / / / / / __/ /___/ /_/ / /_/ / / /__
6 * /_/ |_|\___/\__,_/_/ /_/ /_/_/ /_/ /_/\___/_____/\____/\__, /_/\___/
7 * /____/
8 *
9 * Barracuda Embedded Web-Server
10 *
11 ****************************************************************************
12 * HEADER
13 *
14 * $Id: HttpServCon.h 4915 2021-12-01 18:26:55Z wini $
15 *
16 * COPYRIGHT: Real Time Logic LLC, 2003-2008
17 *
18 * This software is copyrighted by and is the sole property of Real
19 * Time Logic LLC. All rights, title, ownership, or other interests in
20 * the software remain the property of Real Time Logic LLC. This
21 * software may only be used in accordance with the terms and
22 * conditions stipulated in the corresponding license agreement under
23 * which the software has been supplied. Any unauthorized use,
24 * duplication, transmission, distribution, or disclosure of this
25 * software is expressly forbidden.
26 *
27 * This Copyright notice may not be removed or modified without prior
28 * written consent of Real Time Logic LLC.
29 *
30 * Real Time Logic LLC. reserves the right to modify this software
31 * without notice.
32 *
33 * http://www.realtimelogic.com
34 ****************************************************************************
35 *
36 *
37 */
38
39#ifndef __HttpServCon_h
40#define __HttpServCon_h
41
42#include <HttpConnection.h>
43#include <SoDisp.h>
44
45
46struct HttpServer;
47struct HttpServCon;
48
49typedef void (*HttpServCon_AcceptNewCon)(
50 struct HttpServCon* scon, HttpConnection* newcon);
51
52
60typedef struct HttpServCon
61{
62#ifdef __cplusplus
63
64 void *operator new(size_t s) { return ::baMalloc(s); }
65 void operator delete(void* d) { if(d) ::baFree(d); }
66 void *operator new(size_t, void *place) { return place; }
67 void operator delete(void*, void *) { }
68
69
137 HttpServCon(HttpServer* server,
138 SoDisp* dispatcher,
139 U16 port=80,
140 BaBool setIP6=FALSE,
141 const void* interfaceName=0,
142 HttpServCon_AcceptNewCon userDefinedAccept=0);
143
148 BaBool isValid();
149
152 int setPort(U16 portNumber, bool setIp6=false,
153 const void* interfaceName=0);
154
155 ~HttpServCon();
156 HttpServCon() {}
157 private:
158#endif
159 HttpConnection con;
160 HttpServCon_AcceptNewCon userDefinedAccept;
162
163
164#ifdef __cplusplus
165extern "C" {
166#endif
167BA_API void HttpServCon_constructor(HttpServCon* o,
168 struct HttpServer* server,
169 struct SoDisp* dispatcher,
170 U16 port,
171 BaBool setIP6,
172 const void* interfaceName,
173 HttpServCon_AcceptNewCon userDefinedAccept);
174#define HttpServCon_isValid(o) \
175 SoDispCon_isValid((SoDispCon*)(o))
176BA_API int HttpServCon_setPort(HttpServCon* o, U16 portNumber,
177 BaBool setIp6, const void* interfaceName);
178BA_API void HttpServCon_destructor(HttpServCon* o);
179BA_API int HttpServCon_init(
180 HttpServCon* o,
181 struct HttpServer* server,
182 U16 port,
183 BaBool setIP6,
184 const void* interfaceName);
185
186/* Exclusively used by SoDispCon_connect */
187BA_API void HttpServCon_bindExec(SoDispCon* con);
188
189#ifdef __cplusplus
190}
192 SoDisp* dispatcher,
193 U16 port,
194 BaBool setIP6,
195 const void* interfaceName,
196 HttpServCon_AcceptNewCon userDefinedAccept) {
197 HttpServCon_constructor(this,server,dispatcher,port,setIP6,interfaceName,
198 userDefinedAccept);
199}
200inline HttpServCon::~HttpServCon() {
201 HttpServCon_destructor(this);
202}
203inline BaBool HttpServCon::isValid() { return HttpServCon_isValid(this); }
205 U16 portNumber,bool setIp6,const void* interfaceName) {
206 return HttpServCon_setPort(this,portNumber,setIp6?TRUE:FALSE,interfaceName);
207}
208
209
210#endif
211
212#endif
void * baMalloc(size_t size)
Returns pointer to uninitialized newly-allocated space for an object of size "size",...
void baFree(void *p)
Deallocates space to which it points.
Contains information about the physical socket connection.
Definition: HttpConnection.h:76
Create a server listen object.
Definition: HttpServCon.h:61
BaBool isValid()
Returns true if the constructor successfully opened the listen socket; otherwise, false is returned.
Definition: HttpServCon.h:203
int setPort(U16 portNumber, bool setIp6=false, const void *interfaceName=0)
Change the port number for the "listen" object.
Definition: HttpServCon.h:204
HttpServCon(HttpServer *server, SoDisp *dispatcher, U16 port=80, BaBool setIP6=FALSE, const void *interfaceName=0, HttpServCon_AcceptNewCon userDefinedAccept=0)
Create a Server Connection.
Definition: HttpServCon.h:191
The Web Server.
Definition: HttpServer.h:2864
Contains information about the physical socket connection.
Definition: SoDispCon.h:112
The SoDisp dispatches any socket connection that contains data by calling the SoDispCon::execute memb...
Definition: SoDisp.h:86