Serialize created listeners to disk

The created listeners are now stored to disk like created servers
are. This allows them to be used even after a restart.

Currently, the listeners cannot be deleted and need to be manually
removed.
This commit is contained in:
Markus Makela
2016-11-24 11:53:40 +02:00
parent dd63253261
commit e31afa28e4
7 changed files with 176 additions and 33 deletions

View File

@ -49,6 +49,7 @@ typedef struct servlistener
unsigned short port; /**< Port to listen on */
char *address; /**< Address to listen with */
char *authenticator; /**< Name of authenticator */
char *auth_options; /**< Authenticator options */
void *auth_instance; /**< Authenticator instance created in GWAUTHENTICATOR::initialize() */
SSL_LISTENER *ssl; /**< Structure of SSL data or NULL */
struct dcb *listener; /**< The DCB for the listener */
@ -59,6 +60,18 @@ typedef struct servlistener
struct servlistener *next; /**< Next service protocol */
} SERV_LISTENER;
/**
* @brief Serialize a listener to a file
*
* This converts @c listener into an INI format file. This allows created listeners
* to be persisted to disk. This will replace any existing files with the same
* name.
*
* @param listener Listener to serialize
* @return True if the serialization of the listener was successful, false if it fails
*/
bool listener_serialize(const SERV_LISTENER *listener);
SERV_LISTENER* listener_alloc(struct service* service, const char* name, const char *protocol,
const char *address, unsigned short port, const char *authenticator,
const char* auth_options, SSL_LISTENER *ssl);