diff --git a/CMakeLists.txt b/CMakeLists.txt index 1a84153..611a0cd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/README.md b/README.md index 43eca27..499022e 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/example/main.c b/example/daemon/main.c similarity index 100% rename from example/main.c rename to example/daemon/main.c diff --git a/example/www/index.html b/example/daemon/www/index.html similarity index 100% rename from example/www/index.html rename to example/daemon/www/index.html diff --git a/example/www/js/connection.js b/example/daemon/www/js/connection.js similarity index 100% rename from example/www/js/connection.js rename to example/daemon/www/js/connection.js diff --git a/example/www/js/connection_view.js b/example/daemon/www/js/connection_view.js similarity index 100% rename from example/www/js/connection_view.js rename to example/daemon/www/js/connection_view.js diff --git a/example/www/js/filesystem.js b/example/daemon/www/js/filesystem.js similarity index 100% rename from example/www/js/filesystem.js rename to example/daemon/www/js/filesystem.js diff --git a/example/www/js/filesystem_handler.js b/example/daemon/www/js/filesystem_handler.js similarity index 100% rename from example/www/js/filesystem_handler.js rename to example/daemon/www/js/filesystem_handler.js diff --git a/example/www/js/startup.js b/example/daemon/www/js/startup.js similarity index 100% rename from example/www/js/startup.js rename to example/daemon/www/js/startup.js diff --git a/example/www/style/main.css b/example/daemon/www/style/main.css similarity index 100% rename from example/www/style/main.css rename to example/daemon/www/style/main.css diff --git a/example/provider/main.c b/example/provider/main.c new file mode 100644 index 0000000..141ea80 --- /dev/null +++ b/example/provider/main.c @@ -0,0 +1,12 @@ +#include +#include + +#include "wsfs_provider.h" + +int main(int argc, char* argv[]) +{ + (void) argc; + (void) argv; + + return EXIT_FAILURE; +} \ No newline at end of file diff --git a/include/wsfsp/client_protocol.h b/include/wsfsp/client_protocol.h index 1929b3e..119e905 100644 --- a/include/wsfsp/client_protocol.h +++ b/include/wsfsp/client_protocol.h @@ -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 diff --git a/include/wsfsp/provider.h b/include/wsfsp/provider.h index 8556f4e..5ab34fe 100644 --- a/include/wsfsp/provider.h +++ b/include/wsfsp/provider.h @@ -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,