parent
767bafcd01
commit
c6ca2e14bd
@ -0,0 +1,30 @@
|
||||
#ifndef WF_PROVIDER_CREDENTIALS_H
|
||||
#define WF_PROVIDER_CREDENTIALS_H
|
||||
|
||||
#include <webfuse/provider/api.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
struct wfp_credentials;
|
||||
|
||||
typedef void wfp_get_credentials_fn(
|
||||
struct wfp_credentials * credentials,
|
||||
void * user_data);
|
||||
|
||||
extern WFP_API void wfp_credentials_set_type(
|
||||
struct wfp_credentials * credentials,
|
||||
char const * type);
|
||||
|
||||
extern WFP_API void wfp_credentials_add(
|
||||
struct wfp_credentials * credentials,
|
||||
char const * key,
|
||||
char const * value);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -0,0 +1,34 @@
|
||||
#include "webfuse/provider/impl/credentials.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
void wfp_impl_credentials_init(
|
||||
struct wfp_credentials * credentials)
|
||||
{
|
||||
credentials->type = NULL;
|
||||
credentials->contents = json_object();
|
||||
}
|
||||
|
||||
void wfp_impl_credentials_cleanup(
|
||||
struct wfp_credentials * credentials)
|
||||
{
|
||||
free(credentials->type);
|
||||
json_decref(credentials->contents);
|
||||
}
|
||||
|
||||
void wfp_impl_credentials_set_type(
|
||||
struct wfp_credentials * credentials,
|
||||
char const * type)
|
||||
{
|
||||
free(credentials->type);
|
||||
credentials->type = strdup(type);
|
||||
}
|
||||
|
||||
void wfp_impl_credentials_add(
|
||||
struct wfp_credentials * credentials,
|
||||
char const * key,
|
||||
char const * value)
|
||||
{
|
||||
json_object_set_new(credentials->contents, key, json_string(value));
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
#ifndef WF_PROVIDER_IMPL_CREDENTIALS_H
|
||||
#define WF_PROVIDER_IMPL_CREDENTIALS_H
|
||||
|
||||
#include "webfuse/provider/credentials.h"
|
||||
#include <jansson.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
struct wfp_credentials
|
||||
{
|
||||
char * type;
|
||||
json_t * contents;
|
||||
};
|
||||
|
||||
extern void wfp_impl_credentials_init(
|
||||
struct wfp_credentials * credentials);
|
||||
|
||||
extern void wfp_impl_credentials_cleanup(
|
||||
struct wfp_credentials * credentials);
|
||||
|
||||
extern void wfp_impl_credentials_set_type(
|
||||
struct wfp_credentials * credentials,
|
||||
char const * type);
|
||||
|
||||
extern void wfp_impl_credentials_add(
|
||||
struct wfp_credentials * credentials,
|
||||
char const * key,
|
||||
char const * value);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
Loading…
Reference in new issue