1
0
mirror of https://github.com/falk-werner/webfuse-provider synced 2024-09-29 13:20:46 +00:00
falk-werner_webfuse-provider/include/webfuse/provider/client_config.h

261 lines
9.8 KiB
C
Raw Normal View History

2020-02-17 20:53:42 +00:00
////////////////////////////////////////////////////////////////////////////////
/// \file provider/client_config.h
/// \brief Client configuration of webfuse provider.
////////////////////////////////////////////////////////////////////////////////
2019-03-26 22:04:53 +00:00
#ifndef WF_PROVIDER_CLIENT_CONFIG_H
#define WF_PROVIDER_CLIENT_CONFIG_H
#include <webfuse/provider/api.h>
#include <webfuse/provider/operation/lookup.h>
#include <webfuse/provider/operation/getattr.h>
#include <webfuse/provider/operation/readdir.h>
#include <webfuse/provider/operation/open.h>
#include <webfuse/provider/operation/close.h>
#include <webfuse/provider/operation/read.h>
2020-02-25 21:05:48 +00:00
#include <webfuse/provider/credentials.h>
2019-03-26 22:04:53 +00:00
#ifdef __cplusplus
extern "C"
{
#endif
2020-02-17 20:53:42 +00:00
//------------------------------------------------------------------------------
/// \struct wfp_client_config
/// \brief Provider client configuration object.
///
/// Holds configuration of webfuse provider client.
//------------------------------------------------------------------------------
2019-03-26 22:04:53 +00:00
struct wfp_client_config;
2020-02-17 20:53:42 +00:00
//------------------------------------------------------------------------------
/// \brief Callback to signal when the client's connection is established.
///
/// \param user_data user defined context
//------------------------------------------------------------------------------
2019-03-26 22:04:53 +00:00
typedef void wfp_connected_fn(
void * user_data);
2020-02-17 20:53:42 +00:00
//------------------------------------------------------------------------------
/// \brief Callback to signal when a client's connection is disconnected.
///
/// \param user_data user defined context
//------------------------------------------------------------------------------
2019-03-26 22:04:53 +00:00
typedef void wfp_disconnected_fn(
void * user_data);
2020-02-17 20:53:42 +00:00
//------------------------------------------------------------------------------
/// \brief Callback to signal when a timer event occued.
///
/// \param user_data user defined context
//------------------------------------------------------------------------------
2019-03-26 22:04:53 +00:00
typedef void wfp_ontimer_fn(
void * user_data);
2020-02-17 20:53:42 +00:00
//------------------------------------------------------------------------------
/// \brief Creates a new client configuration.
///
/// \return newly created client configuration
//------------------------------------------------------------------------------
2019-03-26 22:04:53 +00:00
extern WFP_API struct wfp_client_config * wfp_client_config_create(void);
2020-02-17 20:53:42 +00:00
//------------------------------------------------------------------------------
/// \brief Disposes a client configuration.
///
/// \note The user defined context is not managed by the client configuration.
///
/// \param config pointer to client configuration
//------------------------------------------------------------------------------
2019-03-26 22:04:53 +00:00
extern WFP_API void wfp_client_config_dispose(
struct wfp_client_config * config);
2020-02-17 20:53:42 +00:00
//------------------------------------------------------------------------------
/// \brief Sets a user defined context.
///
/// \note The user is responsible to manage the lifetime of user data.
///
/// \param config pointer to client configuration
/// \param user_data user defined context
//------------------------------------------------------------------------------
2019-03-26 22:04:53 +00:00
extern WFP_API void wfp_client_config_set_userdata(
struct wfp_client_config * config,
void * user_data);
2020-02-17 20:53:42 +00:00
//------------------------------------------------------------------------------
/// \brief Sets the path to clients private key.
///
/// \note To enable TLS both, private key and certificate, must be specified.
/// Otherwise, TLS is not used.
///
/// \param config pointer to client configuration
/// \param key_path path of clients private key (pem file)
//------------------------------------------------------------------------------
2019-03-26 22:04:53 +00:00
extern WFP_API void wfp_client_config_set_keypath(
struct wfp_client_config * config,
char const * key_path);
2020-02-17 20:53:42 +00:00
//------------------------------------------------------------------------------
/// \brief Sets the path of clients certificate.
///
/// \note To enable TLS both, private key and certificate, must be specified.
/// Otherwise, TLS is not used.
///
/// \param config pointer to client configuration
/// \param cert_path path of the clients certificate (pem file)
//------------------------------------------------------------------------------
2019-03-26 22:04:53 +00:00
extern WFP_API void wfp_client_config_set_certpath(
struct wfp_client_config * config,
char const * cert_path);
2020-04-01 19:42:50 +00:00
//------------------------------------------------------------------------------
/// \brief Sets the path of ca file to verify servers.
///
/// \note To enable TLS both, private key and certificate, must be specified.
/// Otherwise, TLS is not used.
///
/// \param config pointer to client configuration
/// \param ca_filepath path of the ca file (pem file)
//------------------------------------------------------------------------------
extern WFP_API void wfp_client_config_set_ca_filepath(
struct wfp_client_config * config,
char const * ca_filepath);
2020-02-17 20:53:42 +00:00
//------------------------------------------------------------------------------
/// \brief Sets the onconnected handler.
///
/// The handler is invoked, when the client's conntection is established.
///
/// \param config pointer to client configuration
/// \param handler pointer to handler
//------------------------------------------------------------------------------
2019-03-26 22:04:53 +00:00
extern WFP_API void wfp_client_config_set_onconnected(
struct wfp_client_config * config,
wfp_connected_fn * handler);
2020-02-17 20:53:42 +00:00
//------------------------------------------------------------------------------
/// \brief Sets ondisconnected handler
///
/// The handler is invoked, when the client's conntection is lost.
///
/// \param config pointer to client configuration
/// \param handler pointer to handler
//------------------------------------------------------------------------------
2019-03-26 22:04:53 +00:00
extern WFP_API void wfp_client_config_set_ondisconnected(
struct wfp_client_config * config,
wfp_disconnected_fn * handler);
2020-02-17 20:53:42 +00:00
//------------------------------------------------------------------------------
/// \brief Sets ontimer handler.
///
/// The handler is invoked, when a timer event occured.
///
/// \param config pointer to client configuration
/// \param handler pointer to handler
//------------------------------------------------------------------------------
2019-03-26 22:04:53 +00:00
extern WFP_API void wfp_client_config_set_ontimer(
struct wfp_client_config * config,
wfp_ontimer_fn * handler);
2020-02-17 20:53:42 +00:00
//------------------------------------------------------------------------------
/// \brief Sets onlookup handler.
///
/// The handler is invoked, when the identifier of a file is requested.
///
/// \param config pointer to client configuration
/// \param handler pointer to handler
///
/// \see wfp_lookup_fn
//------------------------------------------------------------------------------
2019-03-26 22:04:53 +00:00
extern WFP_API void wfp_client_config_set_onlookup(
struct wfp_client_config * config,
wfp_lookup_fn * handler);
2020-02-17 20:53:42 +00:00
//------------------------------------------------------------------------------
/// \brief Sets ongetattr handler.
///
/// The handler is invoked, when attributes of a file are requested.
///
/// \param config pointer to client configuration
/// \param handler pointer to handler
///
/// \see wfp_getattr_fn
//------------------------------------------------------------------------------
2019-03-26 22:04:53 +00:00
extern WFP_API void wfp_client_config_set_ongetattr(
struct wfp_client_config * config,
wfp_getattr_fn * handler);
2020-02-17 20:53:42 +00:00
//------------------------------------------------------------------------------
/// \brief Sets onreaddir handler.
///
/// The handler is invoked, when the contents of directory are requested-
///
/// \param config pointer to client configuration
/// \param handler pointer to handler
///
/// \see wfp_readdir_fn
//------------------------------------------------------------------------------
2019-03-26 22:04:53 +00:00
extern WFP_API void wfp_client_config_set_onreaddir(
struct wfp_client_config * config,
wfp_readdir_fn * handler);
2020-02-17 20:53:42 +00:00
//------------------------------------------------------------------------------
/// \brief Sets onopen handler.
///
/// The handler is invoked, whe a file should be opened.
///
/// \param config pointer to client configuration
/// \param handler pointer to handler
///
/// \see wfp_open_fn
//------------------------------------------------------------------------------
2019-03-26 22:04:53 +00:00
extern WFP_API void wfp_client_config_set_onopen(
struct wfp_client_config * config,
wfp_open_fn * handler);
2020-02-17 20:53:42 +00:00
//------------------------------------------------------------------------------
/// \brief Sets onclose handler.
///
/// The handler is invoked, when a file is closed.
///
/// \param config pointer to client configuration
/// \param handler pointer to handler
///
/// \see wfp_close_fn
//------------------------------------------------------------------------------
2019-03-26 22:04:53 +00:00
extern WFP_API void wfp_client_config_set_onclose(
struct wfp_client_config * config,
wfp_close_fn * handler);
2020-02-17 20:53:42 +00:00
//------------------------------------------------------------------------------
/// \brief Sets onread handler.
///
/// The handler is invoked, when a files content is requested.
///
/// \param config pointer to client configuration
/// \param handler pointer to handler
///
/// \see wfp_read_fn
//------------------------------------------------------------------------------
2019-03-26 22:04:53 +00:00
extern WFP_API void wfp_client_config_set_onread(
struct wfp_client_config * config,
wfp_read_fn * handler);
2020-02-25 14:36:28 +00:00
//------------------------------------------------------------------------------
2020-02-25 21:05:48 +00:00
/// \brief Enabled authentication.
2020-02-25 14:36:28 +00:00
///
/// \param config pointer to client configuration
2020-02-25 21:05:48 +00:00
/// \param get_credentials pointer to function providing credentials when
// needed.
2020-02-25 14:36:28 +00:00
//------------------------------------------------------------------------------
2020-02-25 21:05:48 +00:00
extern WFP_API void wfp_client_config_enable_authentication(
2020-02-25 14:36:28 +00:00
struct wfp_client_config * config,
2020-02-25 21:05:48 +00:00
wfp_get_credentials_fn * get_credentials);
2020-02-25 14:36:28 +00:00
2019-03-26 22:04:53 +00:00
#ifdef __cplusplus
}
#endif
#endif