parent
81fd41f46a
commit
dcbe4f075a
@ -0,0 +1,35 @@
|
|||||||
|
#ifndef WF_ADAPTER_CLIENT_CALLBACK_H
|
||||||
|
#define WF_ADAPTER_CLIENT_CALLBACK_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#define WF_CLIENT_CREATED 0x0001
|
||||||
|
#define WF_CLIENT_DISPOSING 0x0002
|
||||||
|
|
||||||
|
#define WF_CLIENT_CONNECTED 0x0011
|
||||||
|
#define WF_CLIENT_DISCONNECTED 0x0012
|
||||||
|
|
||||||
|
#define WF_CLIENT_AUTHENTICATED 0x0021
|
||||||
|
#define WF_CLIENT_AUTHENTICATION_FAILED 0x0022
|
||||||
|
#define WF_CLIENT_AUTHENTICATE_GET_CREDENTIALS 0x0023
|
||||||
|
|
||||||
|
#define WF_CLIENT_FILESYSTEM_ADDED 0x0031
|
||||||
|
#define WF_CLIENT_FILESYSTEM_ADD_FAILED 0x0032
|
||||||
|
|
||||||
|
struct wf_client;
|
||||||
|
|
||||||
|
typedef void wf_client_callback_fn(
|
||||||
|
struct wf_client * client,
|
||||||
|
int reason,
|
||||||
|
void * args);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,87 @@
|
|||||||
|
#include "webfuse/adapter/impl/client.h"
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
struct wf_client
|
||||||
|
{
|
||||||
|
wf_client_callback_fn * callback;
|
||||||
|
void * user_data;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct wf_client *
|
||||||
|
wf_impl_client_create(
|
||||||
|
wf_client_callback_fn * callback,
|
||||||
|
void * user_data)
|
||||||
|
{
|
||||||
|
struct wf_client * client = malloc(sizeof(struct wf_client));
|
||||||
|
client->callback = callback;
|
||||||
|
client->user_data = user_data;
|
||||||
|
|
||||||
|
client->callback(client, WF_CLIENT_CREATED, NULL);
|
||||||
|
|
||||||
|
return client;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
wf_impl_client_dispose(
|
||||||
|
struct wf_client * client)
|
||||||
|
{
|
||||||
|
client->callback(client, WF_CLIENT_DISPOSING, NULL);
|
||||||
|
free(client);
|
||||||
|
}
|
||||||
|
|
||||||
|
void *
|
||||||
|
wf_impl_client_get_userdata(
|
||||||
|
struct wf_client * client)
|
||||||
|
{
|
||||||
|
return client->user_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
wf_impl_client_service(
|
||||||
|
struct wf_client * client)
|
||||||
|
{
|
||||||
|
(void) client;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
wf_impl_client_interrupt(
|
||||||
|
struct wf_client * client)
|
||||||
|
{
|
||||||
|
(void) client;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
wf_impl_client_connect(
|
||||||
|
struct wf_client * client,
|
||||||
|
char const * url)
|
||||||
|
{
|
||||||
|
(void) url;
|
||||||
|
client->callback(client, WF_CLIENT_DISCONNECTED, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
wf_impl_client_disconnect(
|
||||||
|
struct wf_client * client)
|
||||||
|
{
|
||||||
|
(void) client;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
wf_impl_client_authenticate(
|
||||||
|
struct wf_client * client)
|
||||||
|
{
|
||||||
|
client->callback(client, WF_CLIENT_AUTHENTICATION_FAILED, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
wf_impl_client_add_filesystem(
|
||||||
|
struct wf_client * client,
|
||||||
|
char const * local_path,
|
||||||
|
char const * name)
|
||||||
|
{
|
||||||
|
(void) local_path;
|
||||||
|
(void) name;
|
||||||
|
|
||||||
|
client->callback(client, WF_CLIENT_FILESYSTEM_ADD_FAILED, NULL);
|
||||||
|
}
|
@ -0,0 +1,57 @@
|
|||||||
|
#ifndef WF_ADAPTER_IMPL_CLIENT_H
|
||||||
|
#define WF_ADAPTER_IMPL_CLIENT_H
|
||||||
|
|
||||||
|
|
||||||
|
#include "webfuse/adapter/client_callback.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern struct wf_client *
|
||||||
|
wf_impl_client_create(
|
||||||
|
wf_client_callback_fn * callback,
|
||||||
|
void * user_data);
|
||||||
|
|
||||||
|
extern void
|
||||||
|
wf_impl_client_dispose(
|
||||||
|
struct wf_client * client);
|
||||||
|
|
||||||
|
extern void *
|
||||||
|
wf_impl_client_get_userdata(
|
||||||
|
struct wf_client * client);
|
||||||
|
|
||||||
|
extern void
|
||||||
|
wf_impl_client_service(
|
||||||
|
struct wf_client * client);
|
||||||
|
|
||||||
|
extern void
|
||||||
|
wf_impl_client_interrupt(
|
||||||
|
struct wf_client * client);
|
||||||
|
|
||||||
|
extern void
|
||||||
|
wf_impl_client_connect(
|
||||||
|
struct wf_client * client,
|
||||||
|
char const * url);
|
||||||
|
|
||||||
|
extern void
|
||||||
|
wf_impl_client_disconnect(
|
||||||
|
struct wf_client * client);
|
||||||
|
|
||||||
|
extern void
|
||||||
|
wf_impl_client_authenticate(
|
||||||
|
struct wf_client * client);
|
||||||
|
|
||||||
|
extern void
|
||||||
|
wf_impl_client_add_filesystem(
|
||||||
|
struct wf_client * client,
|
||||||
|
char const * local_path,
|
||||||
|
char const * name);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
Loading…
Reference in new issue