1
0
mirror of https://github.com/falk-werner/webfuse synced 2024-10-27 20:34:10 +00:00

added example for provider

This commit is contained in:
Falk Werner 2019-02-16 16:28:14 +01:00
parent 561a9f4eb5
commit 4396dddd2b
13 changed files with 36 additions and 10 deletions

View File

@ -131,18 +131,32 @@ install(DIRECTORY include/wsfsp DESTINATION include)
install(FILES "${PROJECT_BINARY_DIR}/libwsfs-provider.pc" DESTINATION lib${LIB_SUFFIX}/pkgconfig) install(FILES "${PROJECT_BINARY_DIR}/libwsfs-provider.pc" DESTINATION lib${LIB_SUFFIX}/pkgconfig)
# app # examples
if(NOT WITHOUT_EXAMPLE) if(NOT WITHOUT_EXAMPLE)
# daemon
add_executable(wsfsd add_executable(wsfsd
example/main.c example/daemon/main.c
) )
target_link_libraries(wsfsd PUBLIC wsfs ${EXTRA_LIBS}) target_link_libraries(wsfsd PUBLIC wsfs ${EXTRA_LIBS})
target_include_directories(wsfsd PUBLIC ${EXTRA_INCLUDE_DIRS}) target_include_directories(wsfsd PUBLIC ${EXTRA_INCLUDE_DIRS})
target_compile_options(wsfsd PUBLIC ${EXTRA_CFLAGS}) target_compile_options(wsfsd PUBLIC ${EXTRA_CFLAGS})
# provider
add_executable(wsfs-provider-app
example/provider/main.c
)
set_target_properties(wsfs-provider-app PROPERTIES OUTPUT_NAME wsfs-provider)
target_link_libraries(wsfs-provider-app PUBLIC wsfs-provider ${EXTRA_LIBS})
target_include_directories(wsfs-provider-app PUBLIC ${EXTRA_INCLUDE_DIRS})
target_compile_options(wsfs-provider-app PUBLIC ${EXTRA_CFLAGS})
endif(NOT WITHOUT_EXAMPLE) endif(NOT WITHOUT_EXAMPLE)
# tests # tests

View File

@ -279,7 +279,7 @@ To install dependencies, see below.
cd .build cd .build
cmake .. cmake ..
mkdir test mkdir test
./wsfsd -m test --document_root=../exmaple/www --port=4711 ./wsfsd -m test --document_root=../exmaple/daemon/www --port=4711
### Build options ### Build options

12
example/provider/main.c Normal file
View File

@ -0,0 +1,12 @@
#include <stdio.h>
#include <stdlib.h>
#include "wsfs_provider.h"
int main(int argc, char* argv[])
{
(void) argc;
(void) argv;
return EXIT_FAILURE;
}

View File

@ -16,11 +16,11 @@ extern WSFSP_API struct wsfsp_client_protocol * wsfsp_client_protocol_create(
struct wsfsp_provider const * provider, struct wsfsp_provider const * provider,
void * user_data); void * user_data);
extern WSFSÜ_API void wsfsp_client_protocol_dispose( extern WSFSP_API void wsfsp_client_protocol_dispose(
struct wsfsp_client_protocol * protocol); struct wsfsp_client_protocol * protocol);
extern WSFSÜ_API void wsfsp_client_protocol_init_lws( extern WSFSP_API void wsfsp_client_protocol_init_lws(
struct wsfs_provider_client_protocol * protocol, struct wsfsp_client_protocol * protocol,
struct lws_protocols * lws_protocol); struct lws_protocols * lws_protocol);
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -16,7 +16,7 @@ using std::size_t;
struct wsfsp_request; struct wsfsp_request;
struct wsfs_dirbuffer; struct wsfsp_dirbuffer;
typedef void wsfsp_lookup_fn( typedef void wsfsp_lookup_fn(
struct wsfsp_request * request, struct wsfsp_request * request,
@ -64,10 +64,10 @@ void * user_data);
typedef void wsfsp_ontimer_fn( typedef void wsfsp_ontimer_fn(
void * user_data); void * user_data);
struct wsfsüp struct wsfsp_provider
{ {
wsfsp_connected_fn * connected; wsfsp_connected_fn * connected;
wsfsp_disconnected_fn * connected; wsfsp_disconnected_fn * disconnected;
wsfsp_ontimer_fn * ontimer; wsfsp_ontimer_fn * ontimer;
wsfsp_lookup_fn * lookup; wsfsp_lookup_fn * lookup;
wsfsp_getattr_fn * getattr; wsfsp_getattr_fn * getattr;
@ -88,7 +88,7 @@ extern void wsfsp_respond_error(
extern void wsfsp_respond_lookup( extern void wsfsp_respond_lookup(
struct wsfsp_request * request, struct wsfsp_request * request,
struct wsfs_stat const * stat); struct stat const * stat);
extern void wsfsp_respond_getattr( extern void wsfsp_respond_getattr(
struct wsfsp_request * request, struct wsfsp_request * request,