Allow creation of listener at runtime

Listeners can now be created and started at runtime. If SSL is to be used,
the required parameters must be present.
This commit is contained in:
Markus Makela
2016-11-23 10:00:15 +02:00
parent b24a28285c
commit e8af6908c1
5 changed files with 151 additions and 46 deletions

View File

@ -506,25 +506,25 @@ serviceStart(SERVICE *service)
* Start an individual listener
*
* @param service The service to start the listener for
* @param protocol The name of the protocol
* @param port The port number
*/
void
serviceStartProtocol(SERVICE *service, char *protocol, int port)
bool serviceListen(SERVICE *service, unsigned short port)
{
SERV_LISTENER *ptr;
ptr = service->ports;
while (ptr)
bool rval = false;
for (SERV_LISTENER *ptr = service->ports; ptr; ptr = ptr->next)
{
if (strcmp(ptr->protocol, protocol) == 0 && ptr->port == port)
if (ptr->port == port)
{
serviceStartPort(service, ptr);
if (serviceStartPort(service, ptr))
{
rval = true;
}
break;
}
ptr = ptr->next;
}
}
return rval;
}
/**
* Start all the services