2020-02-17 20:53:42 +00:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
2020-06-28 13:51:34 +00:00
|
|
|
/// \file webfuse/server.h
|
2020-02-17 20:53:42 +00:00
|
|
|
/// \brief Adapter server.
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2020-06-28 13:51:34 +00:00
|
|
|
#ifndef WF_SERVER_H
|
|
|
|
#define WF_SERVER_H
|
2019-03-26 22:04:53 +00:00
|
|
|
|
2020-06-28 13:51:34 +00:00
|
|
|
#include "webfuse/api.h"
|
2019-03-26 22:04:53 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
#endif
|
|
|
|
|
2020-02-17 20:53:42 +00:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
/// \struct wf_server
|
|
|
|
/// \brief Webfuse adapter server object.
|
|
|
|
//------------------------------------------------------------------------------
|
2019-03-26 22:04:53 +00:00
|
|
|
struct wf_server;
|
2020-02-17 20:53:42 +00:00
|
|
|
|
2019-03-26 22:04:53 +00:00
|
|
|
struct wf_server_config;
|
|
|
|
|
2020-02-17 20:53:42 +00:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
/// \brief Creates a new server.
|
|
|
|
///
|
|
|
|
/// \param config pointer to server configuration.
|
|
|
|
/// \return newly created server or NULL in case of an error
|
|
|
|
//------------------------------------------------------------------------------
|
2019-03-26 22:04:53 +00:00
|
|
|
extern WF_API struct wf_server * wf_server_create(
|
|
|
|
struct wf_server_config * config);
|
|
|
|
|
2020-02-17 20:53:42 +00:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
/// \brief Disposes a server.
|
|
|
|
///
|
|
|
|
/// \note server configuration is not managed by server.
|
|
|
|
///
|
|
|
|
/// \param server pointer to server
|
|
|
|
//------------------------------------------------------------------------------
|
2019-03-26 22:04:53 +00:00
|
|
|
extern WF_API void wf_server_dispose(
|
|
|
|
struct wf_server * server);
|
|
|
|
|
2020-02-17 20:53:42 +00:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
/// \brief Triggers the server.
|
|
|
|
///
|
|
|
|
/// This function must be invoked in a loop while the server is running. It
|
|
|
|
/// makes the server wait for the next event and processes it.
|
|
|
|
///
|
|
|
|
/// \param server pointer to server
|
2020-03-07 14:27:04 +00:00
|
|
|
///
|
|
|
|
/// \see wf_server_interrupt
|
2020-02-17 20:53:42 +00:00
|
|
|
//------------------------------------------------------------------------------
|
2019-04-26 18:51:24 +00:00
|
|
|
extern WF_API void wf_server_service(
|
2020-04-06 18:44:18 +00:00
|
|
|
struct wf_server * server);
|
2019-03-26 22:04:53 +00:00
|
|
|
|
2020-03-07 14:27:04 +00:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
/// \brief Interrupts wf_server_service
|
|
|
|
///
|
|
|
|
/// This function can be used from another thread.
|
|
|
|
///
|
|
|
|
/// \param server pointer to server
|
|
|
|
///
|
|
|
|
/// \see wf_server_service
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
extern WF_API void wf_server_interrupt(
|
|
|
|
struct wf_server * server);
|
|
|
|
|
2020-06-12 11:32:31 +00:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
/// \brief Returns the port number used by the server
|
|
|
|
///
|
|
|
|
/// This function can be used to determine the port number of the server,
|
|
|
|
/// if it was configured to let the system choose a free port.
|
|
|
|
//
|
|
|
|
/// \param server pointer to server
|
|
|
|
/// \return Port number used by the server.
|
|
|
|
///
|
|
|
|
/// \see wf_server_config_set_port
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
extern WF_API int wf_server_get_port(
|
|
|
|
struct wf_server const * server);
|
|
|
|
|
2019-03-26 22:04:53 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|