Adds a listening socket and application specific event handlers, for UNIX socket connections.

Return TypeFunction nameArguments
hzEcodehzIpServer::AddPortUNIX(hzTcpCode(*)(hzChain&,hzIpConnex*),hzTcpCode(*)(hzIpConnex*),hzTcpCode(*)(hzIpConnex*),const char*,uint32_t,uint32_t,)

Declared in file: hzIpServer.h
Defined in file : hzIpServer.cpp

Function Logic:

0:START 1:unknown 2:Return hzerr(E_ARGUMENT,Each listening port must have a 'OnIngress' handler) 3:unknown 4:Return hzerr(E_ARGUMENT,UNIX Sockets require a name) 5:unknown 6:Return hzerr(E_MEMORY,SERIOUS ERROR - Could not allocate an LS for server) 7:opflags 8:unknown 9:Return hzerr(E_INITFAIL,SERIOUS ERROR - Could not initialize an LS for server) 10:unknown 11:Return hzerr(E_INITFAIL,SERIOUS ERROR - Could not insert an LS for server) 12:Return E_OK

Function body:

hzEcode hzIpServer::AddPortUNIX (hzTcpCode(*)(hzChain&,hzIpConnex*) OnIngress)hzTcpCode(*)(hzIpConnex*) OnConnect, hzTcpCode(*)(hzIpConnex*) OnDisconn, const char* sockFile, uint32_t nTimeout, uint32_t nMaxConn, 
{
   //  Category: Internet Server
   //  
   //  Adds a listening socket and application specific event handlers, for UNIX socket connections.
   //  
   //  Arguments: 1) OnIngress  Application Specific 'Do Something' function to be called each time data has come in from a connected client.
   //     2) OnConnect  Application Specific 'Server Hello' function - only required if the protocol used dictates that the server
   //          speaks first.
   //     3) nTimeout  Timeout for connections to the port in seconds
   //     4) nPort   Listening port number
   //     5) nMaxClients  Max number of connections on the port (before server blocks listening socket)
   //     6) bSecure   Flag to indicate SSL
   //  
   //  Returns: E_ARGUMENT If the 'OnIngress' function pointer is null.
   //     E_RANGE  If the port number is out of range
   //     E_INITDUP If there is already a listening socket on the supplied port number
   //     E_MEMORY If the is insufficient memory to allocate the hzIpListen for the port
   //     E_INITFIAL If the hzIpListen could not be initialized
   //     E_OK  If the operation was successful.
   _hzfunc("hzIpServer::AddPortUNIX") ;
   if (!OnIngress)
       return hzerr(E_ARGUMENT, "Each listening port must have a 'OnIngress' handler") ;
   if (!sockFile || !sockFile[0])
       return hzerr(E_ARGUMENT, "UNIX Sockets require a name") ;
   //  Check that we are not already using port
   hzList<hzIpListen*>::Iter   I ;     //  Listening socket iterator
   hzIpListen* pLS ;           //  Listening socket
   uint32_t    opflags ;       //  Operational flags
   if (!(pLS = new hzIpListen(m_pLog)))
       return hzerr(E_MEMORY, "SERIOUS ERROR - Could not allocate an LS for server") ;
   opflags = HZ_LISTEN_UNIX ;
   if (pLS->InitUNIX(this, OnIngress, OnConnect, OnDisconn, sockFile, nTimeout, nMaxConn, opflags) != E_OK)
       return hzerr(E_INITFAIL, "SERIOUS ERROR - Could not initialize an LS for server") ;
   if (m_LS.Add(pLS) != E_OK)
       return hzerr(E_INITFAIL, "SERIOUS ERROR - Could not insert an LS for server") ;
   return E_OK ;
}