Barracuda Application Server C/C++ Reference
Native APIs, integration guides, and platform interfaces
HttpServCon.h
Go to the documentation of this file.
1/*
2 * ____ _________ __ _
3 * / __ \___ ____ _/ /_ __(_)___ ___ ___ / / ____ ____ _(_)____
4 * / /_/ / _ \/ __ `/ / / / / / __ `__ \/ _ \/ / / __ \/ __ `/ / ___/
5 * / _, _/ __/ /_/ / / / / / / / / / / / __/ /___/ /_/ / /_/ / / /__
6 * /_/ |_|\___/\__,_/_/ /_/ /_/_/ /_/ /_/\___/_____/\____/\__, /_/\___/
7 * /____/
8 *
9 * Barracuda Embedded Web-Server
10 *
11 ****************************************************************************
12 * HEADER
13 *
14 * $Id: HttpServCon.h 5978 2026-09-11 16:13:48Z 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
41#ifndef __HttpServCon_h
42#define __HttpServCon_h
43
44#include <HttpConnection.h>
45#include <SoDisp.h>
46
47
48struct HttpServer;
49struct HttpServCon;
50
59 struct HttpServCon* scon, HttpConnection* newcon);
60
61
69typedef struct HttpServCon
70{
71#ifdef __cplusplus
72
73 void *operator new(size_t s) { return ::baMalloc(s); }
74 void operator delete(void* d) { if(d) ::baFree(d); }
75 void *operator new(size_t, void *place) { return place; }
76 void operator delete(void*, void *) { }
77
78
145 HttpServCon(HttpServer* server,
146 SoDisp* dispatcher,
147 U16 port=80,
148 BaBool setIP6=FALSE,
149 const void* interfaceName=0,
150 HttpServCon_AcceptNewCon userDefinedAccept=0);
151
156 BaBool isValid();
157
168 int setPort(U16 portNumber, bool setIp6=false,
169 const void* interfaceName=0);
170
173 ~HttpServCon();
176 private:
177#endif
178 HttpConnection con;
179 HttpServCon_AcceptNewCon userDefinedAccept;
181
182
183#ifdef __cplusplus
184extern "C" {
185#endif
189 struct HttpServer* server,
190 struct SoDisp* dispatcher,
191 U16 port,
192 BaBool setIP6,
193 const void* interfaceName,
194 HttpServCon_AcceptNewCon userDefinedAccept);
197#define HttpServCon_isValid(o) \
198 SoDispCon_isValid((SoDispCon*)(o))
201BA_API int HttpServCon_setPort(HttpServCon* o, U16 portNumber,
202 BaBool setIp6, const void* interfaceName);
206BA_API int HttpServCon_init(
207 HttpServCon* o,
208 struct HttpServer* server,
209 U16 port,
210 BaBool setIP6,
211 const void* interfaceName);
212
213/* Exclusively used by SoDispCon_connect */
214BA_API void HttpServCon_bindExec(SoDispCon* con);
215
216#ifdef __cplusplus
217}
219 SoDisp* dispatcher,
220 U16 port,
221 BaBool setIP6,
222 const void* interfaceName,
223 HttpServCon_AcceptNewCon userDefinedAccept) {
224 HttpServCon_constructor(this,server,dispatcher,port,setIP6,interfaceName,
225 userDefinedAccept);
226}
229}
232 U16 portNumber,bool setIp6,const void* interfaceName) {
233 return HttpServCon_setPort(this,portNumber,setIp6?TRUE:FALSE,interfaceName);
234}
235
236
237#endif
238
239#endif
struct HttpServCon HttpServCon
Create a server listen object.
void(* HttpServCon_AcceptNewCon)(struct HttpServCon *scon, HttpConnection *newcon)
Handle a newly accepted connection while the dispatcher mutex is held.
Definition: HttpServCon.h:58
BA_API void HttpServCon_destructor(HttpServCon *o)
Close and unregister a listener; does not close its accepted connections.
#define HttpServCon_isValid(o)
Definition: HttpServCon.h:197
BA_API int HttpServCon_setPort(HttpServCon *o, U16 portNumber, BaBool setIp6, const void *interfaceName)
Open a replacement listening endpoint before closing the old one.
BA_API void HttpServCon_constructor(HttpServCon *o, struct HttpServer *server, struct SoDisp *dispatcher, U16 port, BaBool setIP6, const void *interfaceName, HttpServCon_AcceptNewCon userDefinedAccept)
Create a Server Connection.
void * baMalloc(size_t size)
Allocate uninitialized storage using the target's configured allocator.
void baFree(void *p)
Release storage using the target's configured allocator.
uint16_t U16
Unsigned 16-bit integer.
Definition: GenPrimT.h:91
U8 BaBool
Boolean stored in an unsigned byte; FALSE is zero and TRUE is one.
Definition: GenPrimT.h:118
Contains information about the physical socket connection.
Definition: HttpConnection.h:80
Create a server listen object.
Definition: HttpServCon.h:70
BaBool isValid()
Definition: HttpServCon.h:230
~HttpServCon()
Close and unregister the listener; accepted connections are separate.
Definition: HttpServCon.h:227
int setPort(U16 portNumber, bool setIp6=false, const void *interfaceName=0)
Open a replacement listening endpoint before closing the old one.
Definition: HttpServCon.h:231
HttpServCon()
Uninitialized storage; initialize before use or destruction.
Definition: HttpServCon.h:175
The Web Server.
Definition: HttpServer.h:3393
Contains information about the physical socket connection.
Definition: SoDispCon.h:120
The SoDisp dispatches any socket connection that contains data by calling the SoDispCon::execute memb...
Definition: SoDisp.h:91