|
Barracuda Application Server C/C++ Reference
Native APIs, integration guides, and platform interfaces
|
Create a server listen object.
The object binds itself to the SoDisp object and makes the web-server listen for new connections on the port specified. The default port is 80. You can create several of these objects and bind to the dispatcher if you want the web-server to listen to more than one port.
#include <HttpServCon.h>
Public Member Functions | |
| HttpServCon (HttpServer *server, SoDisp *dispatcher, U16 port=80, BaBool setIP6=FALSE, const void *interfaceName=0, HttpServCon_AcceptNewCon userDefinedAccept=0) | |
| Create a Server Connection. More... | |
| BaBool | isValid () |
| int | setPort (U16 portNumber, bool setIp6=false, const void *interfaceName=0) |
| Open a replacement listening endpoint before closing the old one. More... | |
| ~HttpServCon () | |
| Close and unregister the listener; accepted connections are separate. More... | |
| HttpServCon () | |
| Uninitialized storage; initialize before use or destruction. More... | |
| HttpServCon::HttpServCon | ( | HttpServer * | server, |
| SoDisp * | dispatcher, | ||
| U16 | port = 80, |
||
| BaBool | setIP6 = FALSE, |
||
| const void * | interfaceName = 0, |
||
| HttpServCon_AcceptNewCon | userDefinedAccept = 0 |
||
| ) |
Create a Server Connection.
| server | Borrowed server, valid throughout listener use. Required for the default HTTP handler and for setPort. |
| dispatcher | Required borrowed dispatcher, valid throughout use. |
| port | TCP port in host byte order, default 80. Zero requests an OS-assigned port if supported by the socket port. |
| setIP6 | TRUE selects IPv6, FALSE IPv4 (default). This parameter is ignored unless the underlying TCP/IP stack is a dual IP V4 and IP V6 stack. |
| interfaceName | Borrowed platform binding address/interface, used during construction; normally a NUL-terminated textual address. NULL binds the wildcard address. Accepted representation is port-specific. |
| userDefinedAccept | The default (argument is NULL) is to accept connections for the web-server. A custom callback is required in NO_BA_SERVER builds; omitting it calls baFatalE. |
A ServerConnection object is normally used for accepting new connections for the web-server. It is possible to redirect new connections to the "userDefinedAccept" callback function. This makes it possible to use the socket dispatcher logic in the web-server for implementing other services such as a telnet server.
The "user defined accept" callback function is called when a new connection is established. The HttpConnection object passed in as the argument to the callback function is a temporary object that will be destroyed as soon as the callback function returns. You must, therefore, move the connection into an initialized application object.
Example C code:
| HttpServCon::~HttpServCon | ( | ) |
Close and unregister the listener; accepted connections are separate.
Does not destroy the borrowed server or dispatcher.
| HttpServCon::HttpServCon | ( | ) |
Uninitialized storage; initialize before use or destruction.
| BaBool HttpServCon::isValid | ( | ) |
| int HttpServCon::setPort | ( | U16 | portNumber, |
| bool | setIp6 = false, |
||
| const void * | interfaceName = 0 |
||
| ) |
Open a replacement listening endpoint before closing the old one.
| [in] | portNumber | New TCP port, in host byte order. |
| [in] | setIp6 | True selects IPv6, false IPv4 (default). |
| [in] | interfaceName | Platform binding address/interface, or NULL for wildcard; borrowed for this call only. |