added example for provider

pull/2/head
Falk Werner 5 years ago
parent 561a9f4eb5
commit 4396dddd2b

@ -131,18 +131,32 @@ install(DIRECTORY include/wsfsp DESTINATION include)
install(FILES "${PROJECT_BINARY_DIR}/libwsfs-provider.pc" DESTINATION lib${LIB_SUFFIX}/pkgconfig)
# app
# examples
if(NOT WITHOUT_EXAMPLE)
# daemon
add_executable(wsfsd
example/main.c
example/daemon/main.c
)
target_link_libraries(wsfsd PUBLIC wsfs ${EXTRA_LIBS})
target_include_directories(wsfsd PUBLIC ${EXTRA_INCLUDE_DIRS})
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)
# tests

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

@ -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;
}

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

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

Loading…
Cancel
Save