From 83b76a1a5a383b03c3750ecd35d36cc9a490465d Mon Sep 17 00:00:00 2001 From: Falk Werner Date: Tue, 16 Jun 2020 23:57:41 +0200 Subject: [PATCH] switched prefix to wfp for old wf stuff --- examples/provider/main.c | 14 +- .../static_filesystem/static_filesystem.c | 12 +- include/webfuse_provider/client.h | 4 +- include/webfuse_provider/client_config.h | 4 +- include/webfuse_provider/client_protocol.h | 4 +- include/webfuse_provider/credentials.h | 4 +- include/webfuse_provider/dirbuffer.h | 4 +- include/webfuse_provider/operation/error.h | 2 +- include/webfuse_provider/protocol_names.h | 20 +- include/webfuse_provider/status.h | 22 +-- include/webfuse_provider/webfuse_provider.h | 4 +- lib/webfuse_provider/api.c | 2 +- lib/webfuse_provider/impl/base64.c | 20 +- lib/webfuse_provider/impl/base64.h | 14 +- lib/webfuse_provider/impl/client.c | 2 +- lib/webfuse_provider/impl/client.h | 4 +- lib/webfuse_provider/impl/client_config.h | 4 +- lib/webfuse_provider/impl/client_protocol.c | 62 +++---- lib/webfuse_provider/impl/client_protocol.h | 14 +- lib/webfuse_provider/impl/container_of.h | 8 +- lib/webfuse_provider/impl/credentials.h | 4 +- lib/webfuse_provider/impl/dirbuffer.h | 4 +- lib/webfuse_provider/impl/json_util.c | 10 +- lib/webfuse_provider/impl/json_util.h | 10 +- lib/webfuse_provider/impl/jsonrpc/error.c | 8 +- lib/webfuse_provider/impl/jsonrpc/error.h | 10 +- lib/webfuse_provider/impl/jsonrpc/method.c | 10 +- lib/webfuse_provider/impl/jsonrpc/method.h | 20 +- .../impl/jsonrpc/method_invoke_fn.h | 10 +- lib/webfuse_provider/impl/jsonrpc/proxy.c | 92 ++++----- lib/webfuse_provider/impl/jsonrpc/proxy.h | 34 ++-- .../impl/jsonrpc/proxy_finished_fn.h | 6 +- .../impl/jsonrpc/proxy_intern.h | 40 ++-- .../impl/jsonrpc/proxy_variadic.c | 14 +- lib/webfuse_provider/impl/jsonrpc/request.c | 36 ++-- lib/webfuse_provider/impl/jsonrpc/request.h | 30 +-- lib/webfuse_provider/impl/jsonrpc/response.c | 14 +- lib/webfuse_provider/impl/jsonrpc/response.h | 6 +- .../impl/jsonrpc/response_intern.h | 14 +- lib/webfuse_provider/impl/jsonrpc/send_fn.h | 6 +- lib/webfuse_provider/impl/jsonrpc/server.c | 84 ++++----- lib/webfuse_provider/impl/jsonrpc/server.h | 26 +-- lib/webfuse_provider/impl/lws_log.c | 12 +- lib/webfuse_provider/impl/lws_log.h | 6 +- lib/webfuse_provider/impl/message.c | 14 +- lib/webfuse_provider/impl/message.h | 14 +- lib/webfuse_provider/impl/message_queue.c | 14 +- lib/webfuse_provider/impl/message_queue.h | 10 +- lib/webfuse_provider/impl/operation/close.c | 10 +- lib/webfuse_provider/impl/operation/close.h | 4 +- lib/webfuse_provider/impl/operation/error.h | 2 +- lib/webfuse_provider/impl/operation/getattr.c | 6 +- lib/webfuse_provider/impl/operation/getattr.h | 4 +- lib/webfuse_provider/impl/operation/lookup.c | 8 +- lib/webfuse_provider/impl/operation/lookup.h | 4 +- lib/webfuse_provider/impl/operation/open.c | 8 +- lib/webfuse_provider/impl/operation/open.h | 4 +- lib/webfuse_provider/impl/operation/read.c | 16 +- lib/webfuse_provider/impl/operation/read.h | 4 +- lib/webfuse_provider/impl/operation/readdir.c | 6 +- lib/webfuse_provider/impl/operation/readdir.h | 4 +- lib/webfuse_provider/impl/provider.h | 4 +- lib/webfuse_provider/impl/request.c | 2 +- lib/webfuse_provider/impl/request.h | 6 +- lib/webfuse_provider/impl/slist.c | 32 ++-- lib/webfuse_provider/impl/slist.h | 42 ++--- lib/webfuse_provider/impl/status.c | 34 ++-- lib/webfuse_provider/impl/status_intern.h | 8 +- lib/webfuse_provider/impl/timer/manager.c | 50 ++--- lib/webfuse_provider/impl/timer/manager.h | 18 +- .../impl/timer/manager_intern.h | 18 +- lib/webfuse_provider/impl/timer/on_timer_fn.h | 10 +- lib/webfuse_provider/impl/timer/timepoint.c | 20 +- lib/webfuse_provider/impl/timer/timepoint.h | 18 +- lib/webfuse_provider/impl/timer/timer.c | 38 ++-- lib/webfuse_provider/impl/timer/timer.h | 28 +-- .../impl/timer/timer_intern.h | 24 +-- lib/webfuse_provider/impl/url.c | 44 ++--- lib/webfuse_provider/impl/url.h | 14 +- lib/webfuse_provider/impl/util.h | 8 +- meson.build | 20 +- test/webfuse_provider/json_matcher.hpp | 2 +- .../webfuse_provider/mocks/lookup_matcher.hpp | 4 +- .../mocks/mock_invokation_handler.hpp | 4 +- .../mocks/mock_jsonrpc_proxy.cc | 10 +- .../mocks/mock_jsonrpc_proxy.hpp | 10 +- .../mocks/mock_operation_context.cc | 6 +- .../mocks/mock_operation_context.hpp | 4 +- test/webfuse_provider/mocks/mock_provider.hpp | 4 +- .../mocks/mock_provider_client.cc | 14 +- .../mocks/mock_provider_client.hpp | 10 +- test/webfuse_provider/mocks/mock_request.hpp | 4 +- .../tests/core/jsonrpc/mock_timer.cc | 22 +-- .../tests/core/jsonrpc/mock_timer.hpp | 42 ++--- .../tests/core/jsonrpc/mock_timer_callback.cc | 12 +- .../core/jsonrpc/mock_timer_callback.hpp | 10 +- .../tests/core/jsonrpc/test_is_request.cc | 40 ++-- .../tests/core/jsonrpc/test_is_response.cc | 36 ++-- .../tests/core/jsonrpc/test_proxy.cc | 174 +++++++++--------- .../tests/core/jsonrpc/test_request.cc | 40 ++-- .../tests/core/jsonrpc/test_response.cc | 76 ++++---- .../core/jsonrpc/test_response_parser.cc | 16 +- .../tests/core/jsonrpc/test_server.cc | 84 ++++----- .../tests/core/test_base64.cc | 54 +++--- .../tests/core/test_container_of.cc | 4 +- .../tests/core/test_message.cc | 10 +- .../tests/core/test_message_queue.cc | 42 ++--- .../webfuse_provider/tests/core/test_slist.cc | 122 ++++++------ .../tests/core/test_status.cc | 40 ++-- test/webfuse_provider/tests/core/test_url.cc | 42 ++--- test/webfuse_provider/tests/core/test_util.cc | 10 +- .../tests/core/timer/test_timepoint.cc | 24 +-- .../tests/core/timer/test_timer.cc | 102 +++++----- .../tests/integration/file.hpp | 4 +- .../tests/integration/provider.hpp | 4 +- .../tests/integration/server.cc | 46 ++--- .../tests/integration/server.hpp | 4 +- .../tests/integration/test_integration.cc | 2 +- .../tests/integration/test_lowlevel.cc | 40 ++-- .../tests/provider/test_client_protocol.cc | 2 +- test/webfuse_provider/utils/adapter_client.cc | 22 +-- .../webfuse_provider/utils/adapter_client.hpp | 6 +- test/webfuse_provider/utils/file_utils.hpp | 4 +- test/webfuse_provider/utils/path.c | 38 ++-- test/webfuse_provider/utils/path.h | 26 +-- .../utils/static_filesystem.c | 26 +-- test/webfuse_provider/utils/tempdir.hpp | 4 +- .../utils/timeout_watcher.hpp | 4 +- test/webfuse_provider/utils/wrap.hpp | 22 +-- test/webfuse_provider/utils/ws_server.cc | 6 +- test/webfuse_provider/utils/ws_server.h | 4 +- test/webfuse_provider/utils/ws_server2.cc | 6 +- test/webfuse_provider/utils/ws_server2.hpp | 4 +- 133 files changed, 1324 insertions(+), 1324 deletions(-) diff --git a/examples/provider/main.c b/examples/provider/main.c index e0dbd69..97e41a5 100644 --- a/examples/provider/main.c +++ b/examples/provider/main.c @@ -193,7 +193,7 @@ static void fs_lookup( } else { - wfp_respond_error(request, WF_BAD_NOENTRY); + wfp_respond_error(request, WFP_BAD_NOENTRY); } } @@ -215,7 +215,7 @@ static void fs_getattr( } else { - wfp_respond_error(request, WF_BAD_NOENTRY); + wfp_respond_error(request, WFP_BAD_NOENTRY); } } @@ -247,7 +247,7 @@ static void fs_readdir( } else { - wfp_respond_error(request, WF_BAD_NOENTRY); + wfp_respond_error(request, WFP_BAD_NOENTRY); } } @@ -268,12 +268,12 @@ static void fs_open( } else { - wfp_respond_error(request, WF_BAD_ACCESS_DENIED); + wfp_respond_error(request, WFP_BAD_ACCESS_DENIED); } } else { - wfp_respond_error(request, WF_BAD_NOENTRY); + wfp_respond_error(request, WFP_BAD_NOENTRY); } } @@ -305,12 +305,12 @@ static void fs_read( } else { - wfp_respond_error(request, WF_BAD); + wfp_respond_error(request, WFP_BAD); } } else { - wfp_respond_error(request, WF_BAD_NOENTRY); + wfp_respond_error(request, WFP_BAD_NOENTRY); } } diff --git a/examples/static_filesystem/static_filesystem.c b/examples/static_filesystem/static_filesystem.c index 5c9b999..87b5829 100644 --- a/examples/static_filesystem/static_filesystem.c +++ b/examples/static_filesystem/static_filesystem.c @@ -255,7 +255,7 @@ static void static_filesystem_lookup( } else { - wfp_respond_error(request, WF_BAD_NOENTRY); + wfp_respond_error(request, WFP_BAD_NOENTRY); } } @@ -276,7 +276,7 @@ static void static_filesystem_getattr( } else { - wfp_respond_error(request, WF_BAD_NOENTRY); + wfp_respond_error(request, WFP_BAD_NOENTRY); } } @@ -308,7 +308,7 @@ static void static_filesystem_readdir( } else { - wfp_respond_error(request, WF_BAD_NOENTRY); + wfp_respond_error(request, WFP_BAD_NOENTRY); } } @@ -329,12 +329,12 @@ static void static_filesystem_open( } else { - wfp_respond_error(request, WF_BAD_ACCESS_DENIED); + wfp_respond_error(request, WFP_BAD_ACCESS_DENIED); } } else { - wfp_respond_error(request, WF_BAD_NOENTRY); + wfp_respond_error(request, WFP_BAD_NOENTRY); } } @@ -361,7 +361,7 @@ static void static_filesystem_read( } else { - wfp_respond_error(request, WF_BAD_NOENTRY); + wfp_respond_error(request, WFP_BAD_NOENTRY); } } diff --git a/include/webfuse_provider/client.h b/include/webfuse_provider/client.h index 0d27e49..438fd1e 100644 --- a/include/webfuse_provider/client.h +++ b/include/webfuse_provider/client.h @@ -3,8 +3,8 @@ /// \brief Webfuse provider client. //////////////////////////////////////////////////////////////////////////////// -#ifndef WF_PROVIDER_CLIENT_H -#define WF_PROVIDER_CLIENT_H +#ifndef WFP_PROVIDER_CLIENT_H +#define WFP_PROVIDER_CLIENT_H #include "webfuse_provider/api.h" diff --git a/include/webfuse_provider/client_config.h b/include/webfuse_provider/client_config.h index ba3e7b0..ca2468b 100644 --- a/include/webfuse_provider/client_config.h +++ b/include/webfuse_provider/client_config.h @@ -3,8 +3,8 @@ /// \brief Client configuration of webfuse provider. //////////////////////////////////////////////////////////////////////////////// -#ifndef WF_PROVIDER_CLIENT_CONFIG_H -#define WF_PROVIDER_CLIENT_CONFIG_H +#ifndef WFP_PROVIDER_CLIENT_CONFIG_H +#define WFP_PROVIDER_CLIENT_CONFIG_H #include diff --git a/include/webfuse_provider/client_protocol.h b/include/webfuse_provider/client_protocol.h index e9d5b55..05090b5 100644 --- a/include/webfuse_provider/client_protocol.h +++ b/include/webfuse_provider/client_protocol.h @@ -8,8 +8,8 @@ /// libwebsockets applications. //////////////////////////////////////////////////////////////////////////////// -#ifndef WF_PROVIDER_CLIENT_PROTOCOL_H -#define WF_PROVIDER_CLIENT_PROTOCOL_H +#ifndef WFP_PROVIDER_CLIENT_PROTOCOL_H +#define WFP_PROVIDER_CLIENT_PROTOCOL_H #include "webfuse_provider/api.h" diff --git a/include/webfuse_provider/credentials.h b/include/webfuse_provider/credentials.h index 0a49173..24934bf 100644 --- a/include/webfuse_provider/credentials.h +++ b/include/webfuse_provider/credentials.h @@ -1,5 +1,5 @@ -#ifndef WF_PROVIDER_CREDENTIALS_H -#define WF_PROVIDER_CREDENTIALS_H +#ifndef WFP_PROVIDER_CREDENTIALS_H +#define WFP_PROVIDER_CREDENTIALS_H #include diff --git a/include/webfuse_provider/dirbuffer.h b/include/webfuse_provider/dirbuffer.h index 9a6efb4..7972b90 100644 --- a/include/webfuse_provider/dirbuffer.h +++ b/include/webfuse_provider/dirbuffer.h @@ -3,8 +3,8 @@ /// \brief Buffer used for directory listing. //////////////////////////////////////////////////////////////////////////////// -#ifndef WF_PROVIDER_DIRBUFFER_H -#define WF_PROVIDER_DIRBUFFER_H +#ifndef WFP_PROVIDER_DIRBUFFER_H +#define WFP_PROVIDER_DIRBUFFER_H #include #include diff --git a/include/webfuse_provider/operation/error.h b/include/webfuse_provider/operation/error.h index d90ec30..a5e223f 100644 --- a/include/webfuse_provider/operation/error.h +++ b/include/webfuse_provider/operation/error.h @@ -27,7 +27,7 @@ struct wfp_request; //------------------------------------------------------------------------------ extern WFP_API void wfp_respond_error( struct wfp_request * request, - wf_status status); + wfp_status status); #ifdef __cplusplus } diff --git a/include/webfuse_provider/protocol_names.h b/include/webfuse_provider/protocol_names.h index aa9abfe..7a3b251 100644 --- a/include/webfuse_provider/protocol_names.h +++ b/include/webfuse_provider/protocol_names.h @@ -2,32 +2,32 @@ /// \file protocol_names.h /// \brief Names of websocket protocol. //////////////////////////////////////////////////////////////////////////////// -#ifndef WF_PROTOCOL_NAMES_H -#define WF_PROTOCOL_NAMES_H +#ifndef WFP_PROTOCOL_NAMES_H +#define WFP_PROTOCOL_NAMES_H //------------------------------------------------------------------------------ -/// \def WF_PROTOCOL_NAME_ADAPTER_SERVER +/// \def WFP_PROTOCOL_NAME_ADAPTER_SERVER /// \brief Name of the websocket protocol an adapter server is running. //------------------------------------------------------------------------------ -#define WF_PROTOCOL_NAME_ADAPTER_SERVER ("webfuse-adapter-server") +#define WFP_PROTOCOL_NAME_ADAPTER_SERVER ("webfuse-adapter-server") //------------------------------------------------------------------------------ -/// \def WF_PROTOCOL_NAME_ADAPTER_CLIENT +/// \def WFP_PROTOCOL_NAME_ADAPTER_CLIENT /// \brief Name of the websocket protocol an adapter client is running. //------------------------------------------------------------------------------ -#define WF_PROTOCOL_NAME_ADAPTER_CLIENT ("webfuse-adapter-client") +#define WFP_PROTOCOL_NAME_ADAPTER_CLIENT ("webfuse-adapter-client") //------------------------------------------------------------------------------ -/// \def WF_PROTOCOL_NAME_PROVIDER_CLIENT +/// \def WFP_PROTOCOL_NAME_PROVIDER_CLIENT /// \brief Name of the websocket protocol an provider client is running. //------------------------------------------------------------------------------ -#define WF_PROTOCOL_NAME_PROVIDER_CLIENT ("webfuse-provider-client") +#define WFP_PROTOCOL_NAME_PROVIDER_CLIENT ("webfuse-provider-client") //------------------------------------------------------------------------------ -/// \def WF_PROTOCOL_NAME_PROVIDER_SERVER +/// \def WFP_PROTOCOL_NAME_PROVIDER_SERVER /// \brief Name of the websocket protocol an provider server is running. //------------------------------------------------------------------------------ -#define WF_PROTOCOL_NAME_PROVIDER_SERVER ("webfuse-provider-server") +#define WFP_PROTOCOL_NAME_PROVIDER_SERVER ("webfuse-provider-server") #endif diff --git a/include/webfuse_provider/status.h b/include/webfuse_provider/status.h index 49e53e5..094f13d 100644 --- a/include/webfuse_provider/status.h +++ b/include/webfuse_provider/status.h @@ -3,21 +3,21 @@ /// \brief Generic status code. //////////////////////////////////////////////////////////////////////////////// -#ifndef WF_STATUS_H -#define WF_STATUS_H +#ifndef WFP_STATUS_H +#define WFP_STATUS_H -#define WF_GOOD 0 ///< Positive status code. -#define WF_BAD 1 ///< Generic negative status code. +#define WFP_GOOD 0 ///< Positive status code. +#define WFP_BAD 1 ///< Generic negative status code. -#define WF_BAD_NOTIMPLEMENTED 2 ///< The called function is not implemented (yet). -#define WF_BAD_TIMEOUT 3 ///< A timeout occured. -#define WF_BAD_BUSY 4 ///< Resource is busy, try again later. -#define WF_BAD_FORMAT 5 ///< Invalid format. +#define WFP_BAD_NOTIMPLEMENTED 2 ///< The called function is not implemented (yet). +#define WFP_BAD_TIMEOUT 3 ///< A timeout occured. +#define WFP_BAD_BUSY 4 ///< Resource is busy, try again later. +#define WFP_BAD_FORMAT 5 ///< Invalid format. -#define WF_BAD_NOENTRY 101 ///< Entry not found. -#define WF_BAD_ACCESS_DENIED 102 ///< Access is denied. +#define WFP_BAD_NOENTRY 101 ///< Entry not found. +#define WFP_BAD_ACCESS_DENIED 102 ///< Access is denied. /// Status code. -typedef int wf_status; +typedef int wfp_status; #endif diff --git a/include/webfuse_provider/webfuse_provider.h b/include/webfuse_provider/webfuse_provider.h index cf48e91..e042601 100644 --- a/include/webfuse_provider/webfuse_provider.h +++ b/include/webfuse_provider/webfuse_provider.h @@ -3,8 +3,8 @@ /// \brief Convenience header to include all functionality of libfuse_provider. //////////////////////////////////////////////////////////////////////////////// -#ifndef WF_PROVIDER_H -#define WF_PROVIDER_H +#ifndef WFP_PROVIDER_H +#define WFP_PROVIDER_H #include #include diff --git a/lib/webfuse_provider/api.c b/lib/webfuse_provider/api.c index 060c1fa..4c07d2c 100644 --- a/lib/webfuse_provider/api.c +++ b/lib/webfuse_provider/api.c @@ -19,7 +19,7 @@ void wfp_respond_error( struct wfp_request * request, - wf_status status) + wfp_status status) { wfp_impl_respond_error(request, status); } diff --git a/lib/webfuse_provider/impl/base64.c b/lib/webfuse_provider/impl/base64.c index e53aff5..fdb22f1 100644 --- a/lib/webfuse_provider/impl/base64.c +++ b/lib/webfuse_provider/impl/base64.c @@ -1,6 +1,6 @@ #include "webfuse_provider/impl/base64.h" -static const uint8_t wf_base64_decode_table[256] = { +static const uint8_t wfp_base64_decode_table[256] = { // 0 1 2 3 4 5 6 7 8 9 A B C D E F 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, // 0 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, // 1 @@ -22,12 +22,12 @@ static const uint8_t wf_base64_decode_table[256] = { -size_t wf_base64_encoded_size(size_t length) +size_t wfp_base64_encoded_size(size_t length) { return ((length + 2) / 3) * 4; } -size_t wf_base64_encode( +size_t wfp_base64_encode( uint8_t const * data, size_t length, char * buffer, @@ -36,7 +36,7 @@ size_t wf_base64_encode( // 0 1 2 3 4 5 6 // 0123456789012345678901234567890123456789012345678901234567890123 static char const table[64] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - size_t const length_needed = wf_base64_encoded_size(length); + size_t const length_needed = wfp_base64_encoded_size(length); if (buffer_size < length_needed) { return 0; @@ -78,7 +78,7 @@ size_t wf_base64_encode( return out_pos; } -size_t wf_base64_decoded_size(char const * data, size_t length) +size_t wfp_base64_decoded_size(char const * data, size_t length) { size_t result = 0; if ((length > 0) && ((length % 4) == 0)) @@ -98,14 +98,14 @@ size_t wf_base64_decoded_size(char const * data, size_t length) return result; } -size_t wf_base64_decode( +size_t wfp_base64_decode( char const * data, size_t length, uint8_t * buffer, size_t buffer_size) { - uint8_t const * table = wf_base64_decode_table; - size_t needed_size = wf_base64_decoded_size(data, length); + uint8_t const * table = wfp_base64_decode_table; + size_t needed_size = wfp_base64_decoded_size(data, length); if ((0 == needed_size) || (buffer_size < needed_size)) { return 0; @@ -146,9 +146,9 @@ size_t wf_base64_decode( return out_pos; } -extern bool wf_base64_isvalid(char const * data, size_t length) +extern bool wfp_base64_isvalid(char const * data, size_t length) { - uint8_t const * table = wf_base64_decode_table; + uint8_t const * table = wfp_base64_decode_table; if ((length == 0) || ((length % 4) != 0)) { diff --git a/lib/webfuse_provider/impl/base64.h b/lib/webfuse_provider/impl/base64.h index 6803afb..a959668 100644 --- a/lib/webfuse_provider/impl/base64.h +++ b/lib/webfuse_provider/impl/base64.h @@ -1,5 +1,5 @@ -#ifndef WF_BASE64_H -#define WF_BASE64_H +#ifndef WFP_BASE64_H +#define WFP_BASE64_H #ifndef __cplusplus #include @@ -15,23 +15,23 @@ extern "C" { #endif -extern size_t wf_base64_encoded_size(size_t length); +extern size_t wfp_base64_encoded_size(size_t length); -extern size_t wf_base64_encode( +extern size_t wfp_base64_encode( uint8_t const * data, size_t length, char * buffer, size_t buffer_size); -extern size_t wf_base64_decoded_size(char const * data, size_t length); +extern size_t wfp_base64_decoded_size(char const * data, size_t length); -extern size_t wf_base64_decode( +extern size_t wfp_base64_decode( char const * data, size_t length, uint8_t * buffer, size_t buffer_size); -extern bool wf_base64_isvalid(char const * data, size_t length); +extern bool wfp_base64_isvalid(char const * data, size_t length); #ifdef __cplusplus } diff --git a/lib/webfuse_provider/impl/client.c b/lib/webfuse_provider/impl/client.c index 0e64e18..2233cef 100644 --- a/lib/webfuse_provider/impl/client.c +++ b/lib/webfuse_provider/impl/client.c @@ -27,7 +27,7 @@ struct wfp_client struct wfp_client * wfp_impl_client_create( struct wfp_client_config * config) { - wf_lwslog_disable(); + wfp_lwslog_disable(); struct wfp_client * client = malloc(sizeof(struct wfp_client)); wfp_impl_client_protocol_init(&client->protocol, &config->provider, config->user_data); diff --git a/lib/webfuse_provider/impl/client.h b/lib/webfuse_provider/impl/client.h index 0dfc64e..dee2f9f 100644 --- a/lib/webfuse_provider/impl/client.h +++ b/lib/webfuse_provider/impl/client.h @@ -1,5 +1,5 @@ -#ifndef WF_PROVIDER_IMPL_CLIENT_H -#define WF_PROVIDER_IMPL_CLIENT_H +#ifndef WFP_PROVIDER_IMPL_CLIENT_H +#define WFP_PROVIDER_IMPL_CLIENT_H #ifndef __cplusplus #include diff --git a/lib/webfuse_provider/impl/client_config.h b/lib/webfuse_provider/impl/client_config.h index 1fc1a55..51ddaef 100644 --- a/lib/webfuse_provider/impl/client_config.h +++ b/lib/webfuse_provider/impl/client_config.h @@ -1,5 +1,5 @@ -#ifndef WF_PROVIDER_IMPL_CLIENT_CONFIG_H -#define WF_PROVIDER_IMPL_CLIENT_CONFIG_H +#ifndef WFP_PROVIDER_IMPL_CLIENT_CONFIG_H +#define WFP_PROVIDER_IMPL_CLIENT_CONFIG_H #include "webfuse_provider/client_config.h" #include "webfuse_provider/impl/provider.h" diff --git a/lib/webfuse_provider/impl/client_protocol.c b/lib/webfuse_provider/impl/client_protocol.c index 481f07d..3fe2237 100644 --- a/lib/webfuse_provider/impl/client_protocol.c +++ b/lib/webfuse_provider/impl/client_protocol.c @@ -22,7 +22,7 @@ #include "webfuse_provider/impl/jsonrpc/request.h" #include "webfuse_provider/impl/jsonrpc/proxy.h" -#define WF_DEFAULT_TIMEOUT (10 * 1000) +#define WFP_DEFAULT_TIMEOUT (10 * 1000) static void wfp_impl_client_protocol_respond( json_t * response, @@ -30,10 +30,10 @@ static void wfp_impl_client_protocol_respond( { struct wfp_client_protocol * protocol = (struct wfp_client_protocol *) user_data; - struct wf_message * message = wf_message_create(response); + struct wfp_message * message = wfp_message_create(response); if (NULL != message) { - wf_slist_append(&protocol->messages, &message->item); + wfp_slist_append(&protocol->messages, &message->item); lws_callback_on_writable(protocol->wsi); } } @@ -46,12 +46,12 @@ static void wfp_impl_client_protocol_process( json_t * message = json_loadb(data, length, 0, NULL); if (NULL != message) { - if (wf_jsonrpc_is_response(message)) + if (wfp_jsonrpc_is_response(message)) { - wf_jsonrpc_proxy_onresult(protocol->proxy, message); + wfp_jsonrpc_proxy_onresult(protocol->proxy, message); } - if (wf_jsonrpc_is_request(message)) + if (wfp_jsonrpc_is_request(message)) { struct wfp_impl_invokation_context context = { @@ -71,7 +71,7 @@ static void wfp_impl_client_protocol_on_add_filesystem_finished( void * user_data, json_t const * result, - json_t const * WF_UNUSED_PARAM(error)) + json_t const * WFP_UNUSED_PARAM(error)) { struct wfp_client_protocol * protocol = user_data; if (NULL == protocol->wsi) { return; } @@ -91,7 +91,7 @@ wfp_impl_client_protocol_on_add_filesystem_finished( static void wfp_impl_client_protocol_add_filesystem( struct wfp_client_protocol * protocol) { - wf_jsonrpc_proxy_invoke( + wfp_jsonrpc_proxy_invoke( protocol->proxy, &wfp_impl_client_protocol_on_add_filesystem_finished, protocol, @@ -104,7 +104,7 @@ static void wfp_impl_client_protocol_on_authenticate_finished( void * user_data, json_t const * result, - json_t const * WF_UNUSED_PARAM(error)) + json_t const * WFP_UNUSED_PARAM(error)) { struct wfp_client_protocol * protocol = user_data; if (NULL == protocol->wsi) { return; } @@ -132,7 +132,7 @@ static void wfp_impl_client_protocol_authenticate( json_t * creds = wfp_impl_credentials_get(&credentials); json_incref(creds); - wf_jsonrpc_proxy_invoke( + wfp_jsonrpc_proxy_invoke( protocol->proxy, &wfp_impl_client_protocol_on_authenticate_finished, protocol, @@ -159,7 +159,7 @@ static void wfp_impl_client_protocol_handshake( static int wfp_impl_client_protocol_callback( struct lws * wsi, enum lws_callback_reasons reason, - void * WF_UNUSED_PARAM(user), + void * WFP_UNUSED_PARAM(user), void * in, size_t len) { @@ -169,7 +169,7 @@ static int wfp_impl_client_protocol_callback( if (NULL != protocol) { - wf_timer_manager_check(protocol->timer_manager); + wfp_timer_manager_check(protocol->timer_manager); switch (reason) { @@ -197,14 +197,14 @@ static int wfp_impl_client_protocol_callback( { result = 1; } - else if (!wf_slist_empty(&protocol->messages)) + else if (!wfp_slist_empty(&protocol->messages)) { - struct wf_slist_item * item = wf_slist_remove_first(&protocol->messages); - struct wf_message * message = wf_container_of(item, struct wf_message, item); + struct wfp_slist_item * item = wfp_slist_remove_first(&protocol->messages); + struct wfp_message * message = wfp_container_of(item, struct wfp_message, item); lws_write(wsi, (unsigned char*) message->data, message->length, LWS_WRITE_TEXT); - wf_message_dispose(message); + wfp_message_dispose(message); - if (!wf_slist_empty(&protocol->messages)) + if (!wfp_slist_empty(&protocol->messages)) { lws_callback_on_writable(wsi); } @@ -226,10 +226,10 @@ static bool wfp_impl_client_protocol_send( bool result = false; struct wfp_client_protocol * protocol = user_data; - struct wf_message * message = wf_message_create(request); + struct wfp_message * message = wfp_message_create(request); if (NULL != message) { - wf_slist_append(&protocol->messages, &message->item); + wfp_slist_append(&protocol->messages, &message->item); lws_callback_on_writable(protocol->wsi); result = true; } @@ -244,15 +244,15 @@ void wfp_impl_client_protocol_init( { protocol->is_connected = false; protocol->is_shutdown_requested = false; - wf_slist_init(&protocol->messages); + wfp_slist_init(&protocol->messages); protocol->wsi = NULL; protocol->request.respond = &wfp_impl_client_protocol_respond; protocol->request.user_data = protocol; - protocol->timer_manager = wf_timer_manager_create(); - protocol->proxy = wf_jsonrpc_proxy_create(protocol->timer_manager, WF_DEFAULT_TIMEOUT, &wfp_impl_client_protocol_send, protocol); + protocol->timer_manager = wfp_timer_manager_create(); + protocol->proxy = wfp_jsonrpc_proxy_create(protocol->timer_manager, WFP_DEFAULT_TIMEOUT, &wfp_impl_client_protocol_send, protocol); protocol->user_data = user_data; wfp_impl_provider_init_from_prototype(&protocol->provider, provider); @@ -261,9 +261,9 @@ void wfp_impl_client_protocol_init( void wfp_impl_client_protocol_cleanup( struct wfp_client_protocol * protocol) { - wf_jsonrpc_proxy_dispose(protocol->proxy); - wf_timer_manager_dispose(protocol->timer_manager); - wf_message_queue_cleanup(&protocol->messages); + wfp_jsonrpc_proxy_dispose(protocol->proxy); + wfp_timer_manager_dispose(protocol->timer_manager); + wfp_message_queue_cleanup(&protocol->messages); } struct wfp_client_protocol * wfp_impl_client_protocol_create( @@ -286,7 +286,7 @@ void wfp_impl_client_protocol_init_lws( struct wfp_client_protocol * protocol, struct lws_protocols * lws_protocol) { - lws_protocol->name = WF_PROTOCOL_NAME_PROVIDER_CLIENT; + lws_protocol->name = WFP_PROTOCOL_NAME_PROVIDER_CLIENT; lws_protocol->callback = &wfp_impl_client_protocol_callback; lws_protocol->per_session_data_size = 0; lws_protocol->user = protocol; @@ -297,8 +297,8 @@ void wfp_impl_client_protocol_connect( struct lws_context * context, char const * url) { - struct wf_url url_data; - bool const success = wf_url_init(&url_data, url); + struct wfp_url url_data; + bool const success = wfp_url_init(&url_data, url); if (success) { struct lws_client_connect_info info; @@ -310,13 +310,13 @@ void wfp_impl_client_protocol_connect( info.host = info.address; info.origin = info.address; info.ssl_connection = (url_data.use_tls) ? LCCSCF_USE_SSL : 0; - info.protocol = WF_PROTOCOL_NAME_ADAPTER_SERVER; - info.local_protocol_name = WF_PROTOCOL_NAME_PROVIDER_CLIENT; + info.protocol = WFP_PROTOCOL_NAME_ADAPTER_SERVER; + info.local_protocol_name = WFP_PROTOCOL_NAME_PROVIDER_CLIENT; info.pwsi = &protocol->wsi; lws_client_connect_via_info(&info); - wf_url_cleanup(&url_data); + wfp_url_cleanup(&url_data); } else { diff --git a/lib/webfuse_provider/impl/client_protocol.h b/lib/webfuse_provider/impl/client_protocol.h index 39c3fa0..320fad1 100644 --- a/lib/webfuse_provider/impl/client_protocol.h +++ b/lib/webfuse_provider/impl/client_protocol.h @@ -1,5 +1,5 @@ -#ifndef WF_PROVIDER_IMPL_CLIENT_PROTOCOL_H -#define WF_PROVIDER_IMPL_CLIENT_PROTOCOL_H +#ifndef WFP_PROVIDER_IMPL_CLIENT_PROTOCOL_H +#define WFP_PROVIDER_IMPL_CLIENT_PROTOCOL_H #include "webfuse_provider/impl/provider.h" #include "webfuse_provider/impl/request.h" @@ -14,8 +14,8 @@ extern "C" struct wfp_client_config; struct lws_protocols; struct lws_context; -struct wf_jsonrpc_proxy; -struct wf_timer_manager; +struct wfp_jsonrpc_proxy; +struct wfp_timer_manager; struct wfp_client_protocol { @@ -25,9 +25,9 @@ struct wfp_client_protocol struct wfp_provider provider; void * user_data; struct lws * wsi; - struct wf_timer_manager * timer_manager; - struct wf_jsonrpc_proxy * proxy; - struct wf_slist messages; + struct wfp_timer_manager * timer_manager; + struct wfp_jsonrpc_proxy * proxy; + struct wfp_slist messages; }; extern void wfp_impl_client_protocol_init( diff --git a/lib/webfuse_provider/impl/container_of.h b/lib/webfuse_provider/impl/container_of.h index d22bc34..1cc416f 100644 --- a/lib/webfuse_provider/impl/container_of.h +++ b/lib/webfuse_provider/impl/container_of.h @@ -1,5 +1,5 @@ -#ifndef WF_CONTAINER_OF_H -#define WF_CONTAINER_OF_H +#ifndef WFP_CONTAINER_OF_H +#define WFP_CONTAINER_OF_H #ifndef __cplusplus #include @@ -8,13 +8,13 @@ #endif #ifdef __GNUC__ -#define wf_container_of(pointer, type, member) \ +#define wfp_container_of(pointer, type, member) \ ({ \ const typeof( ((type *)0)->member ) * __member = (pointer); \ (type *)( (char *)__member - offsetof(type, member) ); \ }) #else -#define wf_container_of(pointer, type, member) \ +#define wfp_container_of(pointer, type, member) \ (type *) (((char *) pointer) - offsetof(type, member)) #endif diff --git a/lib/webfuse_provider/impl/credentials.h b/lib/webfuse_provider/impl/credentials.h index 2ec8ae9..26586d9 100644 --- a/lib/webfuse_provider/impl/credentials.h +++ b/lib/webfuse_provider/impl/credentials.h @@ -1,5 +1,5 @@ -#ifndef WF_PROVIDER_IMPL_CREDENTIALS_H -#define WF_PROVIDER_IMPL_CREDENTIALS_H +#ifndef WFP_PROVIDER_IMPL_CREDENTIALS_H +#define WFP_PROVIDER_IMPL_CREDENTIALS_H #include "webfuse_provider/credentials.h" #include diff --git a/lib/webfuse_provider/impl/dirbuffer.h b/lib/webfuse_provider/impl/dirbuffer.h index 8118ed1..79bfcf2 100644 --- a/lib/webfuse_provider/impl/dirbuffer.h +++ b/lib/webfuse_provider/impl/dirbuffer.h @@ -1,5 +1,5 @@ -#ifndef WF_PROVIDER_IMPL_DIRBUFFER_H -#define WF_PROVIDER_IMPL_DIRBUFFER_H +#ifndef WFP_PROVIDER_IMPL_DIRBUFFER_H +#define WFP_PROVIDER_IMPL_DIRBUFFER_H #include #include diff --git a/lib/webfuse_provider/impl/json_util.c b/lib/webfuse_provider/impl/json_util.c index bbbbc4e..27de867 100644 --- a/lib/webfuse_provider/impl/json_util.c +++ b/lib/webfuse_provider/impl/json_util.c @@ -1,6 +1,6 @@ #include "webfuse_provider/impl/json_util.h" -int wf_impl_json_get_int(json_t const * object, char const * key, int default_value) +int wfp_impl_json_get_int(json_t const * object, char const * key, int default_value) { int result = default_value; @@ -13,14 +13,14 @@ int wf_impl_json_get_int(json_t const * object, char const * key, int default_va return result; } -wf_status -wf_impl_jsonrpc_get_status( +wfp_status +wfp_impl_jsonrpc_get_status( json_t const * error) { - wf_status status = WF_GOOD; + wfp_status status = WFP_GOOD; if (NULL != error) { - status = wf_impl_json_get_int(error, "code", WF_BAD_FORMAT); + status = wfp_impl_json_get_int(error, "code", WFP_BAD_FORMAT); } return status; diff --git a/lib/webfuse_provider/impl/json_util.h b/lib/webfuse_provider/impl/json_util.h index 61ec378..fcc47df 100644 --- a/lib/webfuse_provider/impl/json_util.h +++ b/lib/webfuse_provider/impl/json_util.h @@ -1,5 +1,5 @@ -#ifndef WF_JSON_UTIL_H -#define WF_JSON_UTIL_H +#ifndef WFP_JSON_UTIL_H +#define WFP_JSON_UTIL_H #include #include "webfuse_provider/status.h" @@ -10,13 +10,13 @@ extern "C" #endif extern int -wf_impl_json_get_int( +wfp_impl_json_get_int( json_t const * object, char const * key, int default_value); -extern wf_status -wf_impl_jsonrpc_get_status( +extern wfp_status +wfp_impl_jsonrpc_get_status( json_t const * error); #ifdef __cplusplus diff --git a/lib/webfuse_provider/impl/jsonrpc/error.c b/lib/webfuse_provider/impl/jsonrpc/error.c index 97ec33b..abe8a71 100644 --- a/lib/webfuse_provider/impl/jsonrpc/error.c +++ b/lib/webfuse_provider/impl/jsonrpc/error.c @@ -1,7 +1,7 @@ #include "webfuse_provider/impl/jsonrpc/error.h" json_t * -wf_jsonrpc_error( +wfp_jsonrpc_error( int code, char const * message) { @@ -13,13 +13,13 @@ wf_jsonrpc_error( } void -wf_jsonrpc_propate_error( - wf_jsonrpc_proxy_finished_fn * finised, +wfp_jsonrpc_propate_error( + wfp_jsonrpc_proxy_finished_fn * finised, void * user_data, int code, char const * message) { - json_t * error = wf_jsonrpc_error(code, message); + json_t * error = wfp_jsonrpc_error(code, message); finised(user_data, NULL, error); json_decref(error); diff --git a/lib/webfuse_provider/impl/jsonrpc/error.h b/lib/webfuse_provider/impl/jsonrpc/error.h index 4577589..dd54f0a 100644 --- a/lib/webfuse_provider/impl/jsonrpc/error.h +++ b/lib/webfuse_provider/impl/jsonrpc/error.h @@ -1,5 +1,5 @@ -#ifndef WF_JSONRPC_ERROR_H -#define WF_JSONRPC_ERROR_H +#ifndef WFP_JSONRPC_ERROR_H +#define WFP_JSONRPC_ERROR_H #include #include "webfuse_provider/impl/jsonrpc/proxy_finished_fn.h" @@ -10,13 +10,13 @@ extern "C" #endif extern json_t * -wf_jsonrpc_error( +wfp_jsonrpc_error( int code, char const * message); extern void -wf_jsonrpc_propate_error( - wf_jsonrpc_proxy_finished_fn * finised, +wfp_jsonrpc_propate_error( + wfp_jsonrpc_proxy_finished_fn * finised, void * user_data, int code, char const * message); diff --git a/lib/webfuse_provider/impl/jsonrpc/method.c b/lib/webfuse_provider/impl/jsonrpc/method.c index 9d6ddd6..dc3d1b9 100644 --- a/lib/webfuse_provider/impl/jsonrpc/method.c +++ b/lib/webfuse_provider/impl/jsonrpc/method.c @@ -2,12 +2,12 @@ #include #include -struct wf_jsonrpc_method * wf_jsonrpc_method_create( +struct wfp_jsonrpc_method * wfp_jsonrpc_method_create( char const * method_name, - wf_jsonrpc_method_invoke_fn * invoke, + wfp_jsonrpc_method_invoke_fn * invoke, void * user_data) { - struct wf_jsonrpc_method * method = malloc(sizeof(struct wf_jsonrpc_method)); + struct wfp_jsonrpc_method * method = malloc(sizeof(struct wfp_jsonrpc_method)); method->next = NULL; method->name = strdup(method_name); method->invoke = invoke; @@ -16,8 +16,8 @@ struct wf_jsonrpc_method * wf_jsonrpc_method_create( return method; } -void wf_jsonrpc_method_dispose( - struct wf_jsonrpc_method * method) +void wfp_jsonrpc_method_dispose( + struct wfp_jsonrpc_method * method) { free(method->name); free(method); diff --git a/lib/webfuse_provider/impl/jsonrpc/method.h b/lib/webfuse_provider/impl/jsonrpc/method.h index 00d9c53..e6e2551 100644 --- a/lib/webfuse_provider/impl/jsonrpc/method.h +++ b/lib/webfuse_provider/impl/jsonrpc/method.h @@ -1,5 +1,5 @@ -#ifndef WF_JSONRPC_METHOD_H -#define WF_JSONRPC_METHOD_H +#ifndef WFP_JSONRPC_METHOD_H +#define WFP_JSONRPC_METHOD_H #include "webfuse_provider/impl/jsonrpc/method_invoke_fn.h" @@ -8,23 +8,23 @@ extern "C" { #endif -struct wf_jsonrpc_method +struct wfp_jsonrpc_method { - struct wf_jsonrpc_method * next; + struct wfp_jsonrpc_method * next; char * name; - wf_jsonrpc_method_invoke_fn * invoke; + wfp_jsonrpc_method_invoke_fn * invoke; void * user_data; }; -extern struct wf_jsonrpc_method * -wf_jsonrpc_method_create( +extern struct wfp_jsonrpc_method * +wfp_jsonrpc_method_create( char const * method_name, - wf_jsonrpc_method_invoke_fn * invoke, + wfp_jsonrpc_method_invoke_fn * invoke, void * user_data); extern void -wf_jsonrpc_method_dispose( - struct wf_jsonrpc_method * method); +wfp_jsonrpc_method_dispose( + struct wfp_jsonrpc_method * method); #ifdef __cplusplus } diff --git a/lib/webfuse_provider/impl/jsonrpc/method_invoke_fn.h b/lib/webfuse_provider/impl/jsonrpc/method_invoke_fn.h index 046dfb6..853438f 100644 --- a/lib/webfuse_provider/impl/jsonrpc/method_invoke_fn.h +++ b/lib/webfuse_provider/impl/jsonrpc/method_invoke_fn.h @@ -1,5 +1,5 @@ -#ifndef WF_JSONRPC_METHOD_INVOKE_FN_H -#define WF_JSONRPC_METHOD_INVOKE_FN_H +#ifndef WFP_JSONRPC_METHOD_INVOKE_FN_H +#define WFP_JSONRPC_METHOD_INVOKE_FN_H #include @@ -8,10 +8,10 @@ extern "C" { #endif -struct wf_jsonrpc_request; +struct wfp_jsonrpc_request; -typedef void wf_jsonrpc_method_invoke_fn( - struct wf_jsonrpc_request * request, +typedef void wfp_jsonrpc_method_invoke_fn( + struct wfp_jsonrpc_request * request, char const * method_name, json_t * params, void * user_data); diff --git a/lib/webfuse_provider/impl/jsonrpc/proxy.c b/lib/webfuse_provider/impl/jsonrpc/proxy.c index b45a5eb..cd6f64d 100644 --- a/lib/webfuse_provider/impl/jsonrpc/proxy.c +++ b/lib/webfuse_provider/impl/jsonrpc/proxy.c @@ -8,47 +8,47 @@ #include #include -struct wf_jsonrpc_proxy * -wf_jsonrpc_proxy_create( - struct wf_timer_manager * manager, +struct wfp_jsonrpc_proxy * +wfp_jsonrpc_proxy_create( + struct wfp_timer_manager * manager, int timeout, - wf_jsonrpc_send_fn * send, + wfp_jsonrpc_send_fn * send, void * user_data) { - struct wf_jsonrpc_proxy * proxy = malloc(sizeof(struct wf_jsonrpc_proxy)); - wf_jsonrpc_proxy_init(proxy, manager, timeout, send, user_data); + struct wfp_jsonrpc_proxy * proxy = malloc(sizeof(struct wfp_jsonrpc_proxy)); + wfp_jsonrpc_proxy_init(proxy, manager, timeout, send, user_data); return proxy; } -void wf_jsonrpc_proxy_dispose( - struct wf_jsonrpc_proxy * proxy) +void wfp_jsonrpc_proxy_dispose( + struct wfp_jsonrpc_proxy * proxy) { - wf_jsonrpc_proxy_cleanup(proxy); + wfp_jsonrpc_proxy_cleanup(proxy); free(proxy); } -static void wf_jsonrpc_proxy_on_timeout( - struct wf_timer * timer, void * proxy_ptr) +static void wfp_jsonrpc_proxy_on_timeout( + struct wfp_timer * timer, void * proxy_ptr) { - struct wf_jsonrpc_proxy * proxy = proxy_ptr; + struct wfp_jsonrpc_proxy * proxy = proxy_ptr; if (proxy->request.is_pending) { - wf_jsonrpc_proxy_finished_fn * finished = proxy->request.finished; + wfp_jsonrpc_proxy_finished_fn * finished = proxy->request.finished; void * user_data = proxy->request.user_data; proxy->request.is_pending = false; proxy->request.id = 0; proxy->request.user_data = NULL; proxy->request.finished = NULL; - wf_timer_cancel(timer); + wfp_timer_cancel(timer); - wf_jsonrpc_propate_error(finished, user_data, WF_BAD_TIMEOUT, "Timeout"); + wfp_jsonrpc_propate_error(finished, user_data, WFP_BAD_TIMEOUT, "Timeout"); } } -static json_t * wf_jsonrpc_request_create( +static json_t * wfp_jsonrpc_request_create( char const * method, int id, char const * param_info, @@ -98,44 +98,44 @@ static json_t * wf_jsonrpc_request_create( return request; } -void wf_jsonrpc_proxy_init( - struct wf_jsonrpc_proxy * proxy, - struct wf_timer_manager * timeout_manager, +void wfp_jsonrpc_proxy_init( + struct wfp_jsonrpc_proxy * proxy, + struct wfp_timer_manager * timeout_manager, int timeout, - wf_jsonrpc_send_fn * send, + wfp_jsonrpc_send_fn * send, void * user_data) { proxy->send = send; proxy->timeout = timeout; proxy->user_data = user_data; proxy->request.is_pending = false; - proxy->request.timer = wf_timer_create(timeout_manager, - &wf_jsonrpc_proxy_on_timeout, proxy); + proxy->request.timer = wfp_timer_create(timeout_manager, + &wfp_jsonrpc_proxy_on_timeout, proxy); } -void wf_jsonrpc_proxy_cleanup( - struct wf_jsonrpc_proxy * proxy) +void wfp_jsonrpc_proxy_cleanup( + struct wfp_jsonrpc_proxy * proxy) { if (proxy->request.is_pending) { void * user_data = proxy->request.user_data; - wf_jsonrpc_proxy_finished_fn * finished = proxy->request.finished; + wfp_jsonrpc_proxy_finished_fn * finished = proxy->request.finished; proxy->request.is_pending = false; proxy->request.finished = NULL; proxy->request.user_data = NULL; proxy->request.id = 0; - wf_timer_cancel(proxy->request.timer); + wfp_timer_cancel(proxy->request.timer); - wf_jsonrpc_propate_error(finished, user_data, WF_BAD, "Bad: cancelled pending request during shutdown"); + wfp_jsonrpc_propate_error(finished, user_data, WFP_BAD, "Bad: cancelled pending request during shutdown"); } - wf_timer_dispose(proxy->request.timer); + wfp_timer_dispose(proxy->request.timer); } -void wf_jsonrpc_proxy_vinvoke( - struct wf_jsonrpc_proxy * proxy, - wf_jsonrpc_proxy_finished_fn * finished, +void wfp_jsonrpc_proxy_vinvoke( + struct wfp_jsonrpc_proxy * proxy, + wfp_jsonrpc_proxy_finished_fn * finished, void * user_data, char const * method_name, char const * param_info, @@ -147,9 +147,9 @@ void wf_jsonrpc_proxy_vinvoke( proxy->request.finished = finished; proxy->request.user_data = user_data; proxy->request.id = 42; - wf_timer_start(proxy->request.timer, proxy->timeout); + wfp_timer_start(proxy->request.timer, proxy->timeout); - json_t * request = wf_jsonrpc_request_create(method_name, proxy->request.id, param_info, args); + json_t * request = wfp_jsonrpc_request_create(method_name, proxy->request.id, param_info, args); bool const is_send = ((NULL != request) && (proxy->send(request, proxy->user_data))); if (!is_send) @@ -158,9 +158,9 @@ void wf_jsonrpc_proxy_vinvoke( proxy->request.finished = NULL; proxy->request.user_data = NULL; proxy->request.id = 0; - wf_timer_cancel(proxy->request.timer); + wfp_timer_cancel(proxy->request.timer); - wf_jsonrpc_propate_error(finished, user_data, WF_BAD, "Bad: requenst is not sent"); + wfp_jsonrpc_propate_error(finished, user_data, WFP_BAD, "Bad: requenst is not sent"); } if (NULL != request) @@ -170,17 +170,17 @@ void wf_jsonrpc_proxy_vinvoke( } else { - wf_jsonrpc_propate_error(finished, user_data, WF_BAD_BUSY, "Busy"); + wfp_jsonrpc_propate_error(finished, user_data, WFP_BAD_BUSY, "Busy"); } } -extern void wf_jsonrpc_proxy_vnotify( - struct wf_jsonrpc_proxy * proxy, +extern void wfp_jsonrpc_proxy_vnotify( + struct wfp_jsonrpc_proxy * proxy, char const * method_name, char const * param_info, va_list args) { - json_t * request = wf_jsonrpc_request_create(method_name, 0, param_info, args); + json_t * request = wfp_jsonrpc_request_create(method_name, 0, param_info, args); if (NULL != request) { @@ -190,27 +190,27 @@ extern void wf_jsonrpc_proxy_vnotify( } -void wf_jsonrpc_proxy_onresult( - struct wf_jsonrpc_proxy * proxy, +void wfp_jsonrpc_proxy_onresult( + struct wfp_jsonrpc_proxy * proxy, json_t * message) { - struct wf_jsonrpc_response response; - wf_jsonrpc_response_init(&response, message); + struct wfp_jsonrpc_response response; + wfp_jsonrpc_response_init(&response, message); if ((proxy->request.is_pending) && (response.id == proxy->request.id)) { - wf_jsonrpc_proxy_finished_fn * finished = proxy->request.finished; + wfp_jsonrpc_proxy_finished_fn * finished = proxy->request.finished; void * user_data = proxy->request.user_data; proxy->request.is_pending = false; proxy->request.id = 0; proxy->request.user_data = NULL; proxy->request.finished = NULL; - wf_timer_cancel(proxy->request.timer); + wfp_timer_cancel(proxy->request.timer); finished(user_data, response.result, response.error); } - wf_jsonrpc_response_cleanup(&response); + wfp_jsonrpc_response_cleanup(&response); } diff --git a/lib/webfuse_provider/impl/jsonrpc/proxy.h b/lib/webfuse_provider/impl/jsonrpc/proxy.h index 8cc8969..0f02edf 100644 --- a/lib/webfuse_provider/impl/jsonrpc/proxy.h +++ b/lib/webfuse_provider/impl/jsonrpc/proxy.h @@ -1,5 +1,5 @@ -#ifndef WF_JSONRPC_PROXY_H -#define WF_JSONRPC_PROXY_H +#ifndef WFP_JSONRPC_PROXY_H +#define WFP_JSONRPC_PROXY_H #ifndef __cplusplus #include @@ -19,18 +19,18 @@ using std::size_t; extern "C" { #endif -struct wf_jsonrpc_proxy; -struct wf_timer_manager; +struct wfp_jsonrpc_proxy; +struct wfp_timer_manager; -extern struct wf_jsonrpc_proxy * -wf_jsonrpc_proxy_create( - struct wf_timer_manager * manager, +extern struct wfp_jsonrpc_proxy * +wfp_jsonrpc_proxy_create( + struct wfp_timer_manager * manager, int timeout, - wf_jsonrpc_send_fn * send, + wfp_jsonrpc_send_fn * send, void * user_data); -extern void wf_jsonrpc_proxy_dispose( - struct wf_jsonrpc_proxy * proxy); +extern void wfp_jsonrpc_proxy_dispose( + struct wfp_jsonrpc_proxy * proxy); //------------------------------------------------------------------------------ /// \brief Invokes a method. @@ -46,24 +46,24 @@ extern void wf_jsonrpc_proxy_dispose( /// \param param_info types of the param (s = string, i = integer, j = json) /// \param ... params //------------------------------------------------------------------------------ -extern void wf_jsonrpc_proxy_invoke( - struct wf_jsonrpc_proxy * proxy, - wf_jsonrpc_proxy_finished_fn * finished, +extern void wfp_jsonrpc_proxy_invoke( + struct wfp_jsonrpc_proxy * proxy, + wfp_jsonrpc_proxy_finished_fn * finished, void * user_data, char const * method_name, char const * param_info, ... ); -extern void wf_jsonrpc_proxy_notify( - struct wf_jsonrpc_proxy * proxy, +extern void wfp_jsonrpc_proxy_notify( + struct wfp_jsonrpc_proxy * proxy, char const * method_name, char const * param_info, ... ); -extern void wf_jsonrpc_proxy_onresult( - struct wf_jsonrpc_proxy * proxy, +extern void wfp_jsonrpc_proxy_onresult( + struct wfp_jsonrpc_proxy * proxy, json_t * message); #ifdef __cplusplus diff --git a/lib/webfuse_provider/impl/jsonrpc/proxy_finished_fn.h b/lib/webfuse_provider/impl/jsonrpc/proxy_finished_fn.h index cd59c87..6d2b0d3 100644 --- a/lib/webfuse_provider/impl/jsonrpc/proxy_finished_fn.h +++ b/lib/webfuse_provider/impl/jsonrpc/proxy_finished_fn.h @@ -1,5 +1,5 @@ -#ifndef WF_JSONRPC_PROXY_FINISHED_FN_H -#define WF_JSONRPC_PROXY_FINISHED_FN_H +#ifndef WFP_JSONRPC_PROXY_FINISHED_FN_H +#define WFP_JSONRPC_PROXY_FINISHED_FN_H #include @@ -8,7 +8,7 @@ extern "C" { #endif -typedef void wf_jsonrpc_proxy_finished_fn( +typedef void wfp_jsonrpc_proxy_finished_fn( void * user_data, json_t const * result, json_t const * error); diff --git a/lib/webfuse_provider/impl/jsonrpc/proxy_intern.h b/lib/webfuse_provider/impl/jsonrpc/proxy_intern.h index 4df73e5..3284040 100644 --- a/lib/webfuse_provider/impl/jsonrpc/proxy_intern.h +++ b/lib/webfuse_provider/impl/jsonrpc/proxy_intern.h @@ -1,5 +1,5 @@ -#ifndef WF_JSONRPC_PROXY_INTERN_H -#define WF_JSONRPC_PROXY_INTERN_H +#ifndef WFP_JSONRPC_PROXY_INTERN_H +#define WFP_JSONRPC_PROXY_INTERN_H #include "webfuse_provider/impl/jsonrpc/proxy.h" #include "webfuse_provider/impl/jsonrpc/proxy_finished_fn.h" @@ -10,47 +10,47 @@ extern "C" { #endif -struct wf_timer; +struct wfp_timer; -struct wf_jsonrpc_request +struct wfp_jsonrpc_request { bool is_pending; - wf_jsonrpc_proxy_finished_fn * finished; + wfp_jsonrpc_proxy_finished_fn * finished; void * user_data; int id; - struct wf_timer * timer; + struct wfp_timer * timer; }; -struct wf_jsonrpc_proxy +struct wfp_jsonrpc_proxy { - struct wf_jsonrpc_request request; + struct wfp_jsonrpc_request request; int timeout; - wf_jsonrpc_send_fn * send; + wfp_jsonrpc_send_fn * send; void * user_data; }; extern void -wf_jsonrpc_proxy_init( - struct wf_jsonrpc_proxy * proxy, - struct wf_timer_manager * manager, +wfp_jsonrpc_proxy_init( + struct wfp_jsonrpc_proxy * proxy, + struct wfp_timer_manager * manager, int timeout, - wf_jsonrpc_send_fn * send, + wfp_jsonrpc_send_fn * send, void * user_data); extern void -wf_jsonrpc_proxy_cleanup( - struct wf_jsonrpc_proxy * proxy); +wfp_jsonrpc_proxy_cleanup( + struct wfp_jsonrpc_proxy * proxy); -extern void wf_jsonrpc_proxy_vinvoke( - struct wf_jsonrpc_proxy * proxy, - wf_jsonrpc_proxy_finished_fn * finished, +extern void wfp_jsonrpc_proxy_vinvoke( + struct wfp_jsonrpc_proxy * proxy, + wfp_jsonrpc_proxy_finished_fn * finished, void * user_data, char const * method_name, char const * param_info, va_list args); -extern void wf_jsonrpc_proxy_vnotify( - struct wf_jsonrpc_proxy * proxy, +extern void wfp_jsonrpc_proxy_vnotify( + struct wfp_jsonrpc_proxy * proxy, char const * method_name, char const * param_info, va_list args); diff --git a/lib/webfuse_provider/impl/jsonrpc/proxy_variadic.c b/lib/webfuse_provider/impl/jsonrpc/proxy_variadic.c index b25bf6a..3f249db 100644 --- a/lib/webfuse_provider/impl/jsonrpc/proxy_variadic.c +++ b/lib/webfuse_provider/impl/jsonrpc/proxy_variadic.c @@ -1,8 +1,8 @@ #include "webfuse_provider/impl/jsonrpc/proxy_intern.h" -void wf_jsonrpc_proxy_invoke( - struct wf_jsonrpc_proxy * proxy, - wf_jsonrpc_proxy_finished_fn * finished, +void wfp_jsonrpc_proxy_invoke( + struct wfp_jsonrpc_proxy * proxy, + wfp_jsonrpc_proxy_finished_fn * finished, void * user_data, char const * method_name, char const * param_info, @@ -10,12 +10,12 @@ void wf_jsonrpc_proxy_invoke( { va_list args; va_start(args, param_info); - wf_jsonrpc_proxy_vinvoke(proxy, finished, user_data, method_name, param_info, args); + wfp_jsonrpc_proxy_vinvoke(proxy, finished, user_data, method_name, param_info, args); va_end(args); } -extern void wf_jsonrpc_proxy_notify( - struct wf_jsonrpc_proxy * proxy, +extern void wfp_jsonrpc_proxy_notify( + struct wfp_jsonrpc_proxy * proxy, char const * method_name, char const * param_info, ... @@ -23,6 +23,6 @@ extern void wf_jsonrpc_proxy_notify( { va_list args; va_start(args, param_info); - wf_jsonrpc_proxy_vnotify(proxy, method_name, param_info, args); + wfp_jsonrpc_proxy_vnotify(proxy, method_name, param_info, args); va_end(args); } diff --git a/lib/webfuse_provider/impl/jsonrpc/request.c b/lib/webfuse_provider/impl/jsonrpc/request.c index 4f4c659..9d9260d 100644 --- a/lib/webfuse_provider/impl/jsonrpc/request.c +++ b/lib/webfuse_provider/impl/jsonrpc/request.c @@ -2,15 +2,15 @@ #include "webfuse_provider/impl/jsonrpc/error.h" #include -struct wf_jsonrpc_request +struct wfp_jsonrpc_request { int id; - wf_jsonrpc_send_fn * send; + wfp_jsonrpc_send_fn * send; void * user_data; }; bool -wf_jsonrpc_is_request( +wfp_jsonrpc_is_request( json_t * message) { json_t * id = json_object_get(message, "id"); @@ -22,13 +22,13 @@ wf_jsonrpc_is_request( } -struct wf_jsonrpc_request * -wf_jsonrpc_request_create( +struct wfp_jsonrpc_request * +wfp_jsonrpc_request_create( int id, - wf_jsonrpc_send_fn * send, + wfp_jsonrpc_send_fn * send, void * user_data) { - struct wf_jsonrpc_request * request = malloc(sizeof(struct wf_jsonrpc_request)); + struct wfp_jsonrpc_request * request = malloc(sizeof(struct wfp_jsonrpc_request)); request->id = id; request->send = send; request->user_data = user_data; @@ -37,23 +37,23 @@ wf_jsonrpc_request_create( } void -wf_jsonrpc_request_dispose( - struct wf_jsonrpc_request * request) +wfp_jsonrpc_request_dispose( + struct wfp_jsonrpc_request * request) { free(request); } void * -wf_jsonrpc_request_get_userdata( - struct wf_jsonrpc_request * request) +wfp_jsonrpc_request_get_userdata( + struct wfp_jsonrpc_request * request) { return request->user_data; } void -wf_jsonrpc_respond( - struct wf_jsonrpc_request * request, +wfp_jsonrpc_respond( + struct wfp_jsonrpc_request * request, json_t * result) { json_t * response = json_object(); @@ -62,20 +62,20 @@ wf_jsonrpc_respond( request->send(response, request->user_data); json_decref(response); - wf_jsonrpc_request_dispose(request); + wfp_jsonrpc_request_dispose(request); } -void wf_jsonrpc_respond_error( - struct wf_jsonrpc_request * request, +void wfp_jsonrpc_respond_error( + struct wfp_jsonrpc_request * request, int code, char const * message) { json_t * response = json_object(); - json_object_set_new(response, "error", wf_jsonrpc_error(code, message)); + json_object_set_new(response, "error", wfp_jsonrpc_error(code, message)); json_object_set_new(response, "id", json_integer(request->id)); request->send(response, request->user_data); json_decref(response); - wf_jsonrpc_request_dispose(request); + wfp_jsonrpc_request_dispose(request); } diff --git a/lib/webfuse_provider/impl/jsonrpc/request.h b/lib/webfuse_provider/impl/jsonrpc/request.h index 66f1386..aa0fd2e 100644 --- a/lib/webfuse_provider/impl/jsonrpc/request.h +++ b/lib/webfuse_provider/impl/jsonrpc/request.h @@ -1,5 +1,5 @@ -#ifndef WF_JSONRPC_REQUEST_H -#define WF_JSONRPC_REQUEST_H +#ifndef WFP_JSONRPC_REQUEST_H +#define WFP_JSONRPC_REQUEST_H #ifndef __cplusplus #include @@ -19,29 +19,29 @@ extern "C" { #endif -struct wf_jsonrpc_request; +struct wfp_jsonrpc_request; -extern bool wf_jsonrpc_is_request( +extern bool wfp_jsonrpc_is_request( json_t * message); -extern struct wf_jsonrpc_request * -wf_jsonrpc_request_create( +extern struct wfp_jsonrpc_request * +wfp_jsonrpc_request_create( int id, - wf_jsonrpc_send_fn * send, + wfp_jsonrpc_send_fn * send, void * user_data); -extern void wf_jsonrpc_request_dispose( - struct wf_jsonrpc_request * request); +extern void wfp_jsonrpc_request_dispose( + struct wfp_jsonrpc_request * request); -extern void * wf_jsonrpc_request_get_userdata( - struct wf_jsonrpc_request * request); +extern void * wfp_jsonrpc_request_get_userdata( + struct wfp_jsonrpc_request * request); -extern void wf_jsonrpc_respond( - struct wf_jsonrpc_request * request, +extern void wfp_jsonrpc_respond( + struct wfp_jsonrpc_request * request, json_t * result); -extern void wf_jsonrpc_respond_error( - struct wf_jsonrpc_request * request, +extern void wfp_jsonrpc_respond_error( + struct wfp_jsonrpc_request * request, int code, char const * message); diff --git a/lib/webfuse_provider/impl/jsonrpc/response.c b/lib/webfuse_provider/impl/jsonrpc/response.c index 355fe80..acc7b49 100644 --- a/lib/webfuse_provider/impl/jsonrpc/response.c +++ b/lib/webfuse_provider/impl/jsonrpc/response.c @@ -3,7 +3,7 @@ #include "webfuse_provider/status.h" bool -wf_jsonrpc_is_response( +wfp_jsonrpc_is_response( json_t * message) { json_t * id = json_object_get(message, "id"); @@ -16,8 +16,8 @@ wf_jsonrpc_is_response( void -wf_jsonrpc_response_init( - struct wf_jsonrpc_response * result, +wfp_jsonrpc_response_init( + struct wfp_jsonrpc_response * result, json_t * response) { result->id = -1; @@ -27,7 +27,7 @@ wf_jsonrpc_response_init( json_t * id_holder = json_object_get(response, "id"); if (!json_is_integer(id_holder)) { - result->error = wf_jsonrpc_error(WF_BAD_FORMAT, "invalid format: missing id"); + result->error = wfp_jsonrpc_error(WFP_BAD_FORMAT, "invalid format: missing id"); return; } @@ -47,14 +47,14 @@ wf_jsonrpc_response_init( } else { - result->error = wf_jsonrpc_error(WF_BAD_FORMAT, "invalid format: invalid error object"); + result->error = wfp_jsonrpc_error(WFP_BAD_FORMAT, "invalid format: invalid error object"); } } } void -wf_jsonrpc_response_cleanup( - struct wf_jsonrpc_response * response) +wfp_jsonrpc_response_cleanup( + struct wfp_jsonrpc_response * response) { if (NULL != response->result) { diff --git a/lib/webfuse_provider/impl/jsonrpc/response.h b/lib/webfuse_provider/impl/jsonrpc/response.h index 0bf0561..eae5cb8 100644 --- a/lib/webfuse_provider/impl/jsonrpc/response.h +++ b/lib/webfuse_provider/impl/jsonrpc/response.h @@ -1,5 +1,5 @@ -#ifndef WF_JSONRPC_RESPONSE_H -#define WF_JSONRPC_RESPONSE_H +#ifndef WFP_JSONRPC_RESPONSE_H +#define WFP_JSONRPC_RESPONSE_H #ifndef __cplusplus #include @@ -12,7 +12,7 @@ extern "C" { #endif -extern bool wf_jsonrpc_is_response( +extern bool wfp_jsonrpc_is_response( json_t * message); #ifdef __cplusplus diff --git a/lib/webfuse_provider/impl/jsonrpc/response_intern.h b/lib/webfuse_provider/impl/jsonrpc/response_intern.h index de8044a..e03dea7 100644 --- a/lib/webfuse_provider/impl/jsonrpc/response_intern.h +++ b/lib/webfuse_provider/impl/jsonrpc/response_intern.h @@ -1,5 +1,5 @@ -#ifndef WF_JSONRPC_RESPONSE_INTERN_H -#define WF_JSONRPC_RESPONSE_INTERN_H +#ifndef WFP_JSONRPC_RESPONSE_INTERN_H +#define WFP_JSONRPC_RESPONSE_INTERN_H #include "webfuse_provider/impl/jsonrpc/response.h" @@ -14,19 +14,19 @@ using std::size_t; extern "C" { #endif -struct wf_jsonrpc_response +struct wfp_jsonrpc_response { json_t * result; json_t * error; int id; }; -extern void wf_jsonrpc_response_init( - struct wf_jsonrpc_response * response, +extern void wfp_jsonrpc_response_init( + struct wfp_jsonrpc_response * response, json_t * message); -extern void wf_jsonrpc_response_cleanup( - struct wf_jsonrpc_response * response); +extern void wfp_jsonrpc_response_cleanup( + struct wfp_jsonrpc_response * response); #ifdef __cplusplus } diff --git a/lib/webfuse_provider/impl/jsonrpc/send_fn.h b/lib/webfuse_provider/impl/jsonrpc/send_fn.h index 2892687..9c4ea1a 100644 --- a/lib/webfuse_provider/impl/jsonrpc/send_fn.h +++ b/lib/webfuse_provider/impl/jsonrpc/send_fn.h @@ -1,5 +1,5 @@ -#ifndef WF_JSONRPC_SEND_FN_H -#define WF_JSONRPC_SEND_FN_H +#ifndef WFP_JSONRPC_SEND_FN_H +#define WFP_JSONRPC_SEND_FN_H #ifndef __cplusplus #include @@ -12,7 +12,7 @@ extern "C" { #endif -typedef bool wf_jsonrpc_send_fn( +typedef bool wfp_jsonrpc_send_fn( json_t * request, void * user_data); diff --git a/lib/webfuse_provider/impl/jsonrpc/server.c b/lib/webfuse_provider/impl/jsonrpc/server.c index b93a303..fdefd19 100644 --- a/lib/webfuse_provider/impl/jsonrpc/server.c +++ b/lib/webfuse_provider/impl/jsonrpc/server.c @@ -7,89 +7,89 @@ #include #include -struct wf_jsonrpc_server +struct wfp_jsonrpc_server { - struct wf_jsonrpc_method * methods; + struct wfp_jsonrpc_method * methods; }; static void -wf_jsonrpc_server_init( - struct wf_jsonrpc_server * server); +wfp_jsonrpc_server_init( + struct wfp_jsonrpc_server * server); static void -wf_jsonrpc_server_cleanup( - struct wf_jsonrpc_server * server); +wfp_jsonrpc_server_cleanup( + struct wfp_jsonrpc_server * server); -struct wf_jsonrpc_server * -wf_jsonrpc_server_create(void) +struct wfp_jsonrpc_server * +wfp_jsonrpc_server_create(void) { - struct wf_jsonrpc_server * server = malloc(sizeof(struct wf_jsonrpc_server)); - wf_jsonrpc_server_init(server); + struct wfp_jsonrpc_server * server = malloc(sizeof(struct wfp_jsonrpc_server)); + wfp_jsonrpc_server_init(server); return server; } void -wf_jsonrpc_server_dispose( - struct wf_jsonrpc_server * server) +wfp_jsonrpc_server_dispose( + struct wfp_jsonrpc_server * server) { - wf_jsonrpc_server_cleanup(server); + wfp_jsonrpc_server_cleanup(server); free(server); } -static void wf_jsonrpc_server_init( - struct wf_jsonrpc_server * server) +static void wfp_jsonrpc_server_init( + struct wfp_jsonrpc_server * server) { server->methods = NULL; } -static void wf_jsonrpc_server_cleanup( - struct wf_jsonrpc_server * server) +static void wfp_jsonrpc_server_cleanup( + struct wfp_jsonrpc_server * server) { - struct wf_jsonrpc_method * current = server->methods; + struct wfp_jsonrpc_method * current = server->methods; while (NULL != current) { - struct wf_jsonrpc_method * next = current->next; - wf_jsonrpc_method_dispose(current); + struct wfp_jsonrpc_method * next = current->next; + wfp_jsonrpc_method_dispose(current); current = next; } server->methods = NULL; } -void wf_jsonrpc_server_add( - struct wf_jsonrpc_server * server, +void wfp_jsonrpc_server_add( + struct wfp_jsonrpc_server * server, char const * method_name, - wf_jsonrpc_method_invoke_fn * invoke, + wfp_jsonrpc_method_invoke_fn * invoke, void * user_data) { - struct wf_jsonrpc_method * method = wf_jsonrpc_method_create(method_name, invoke, user_data); + struct wfp_jsonrpc_method * method = wfp_jsonrpc_method_create(method_name, invoke, user_data); method->next = server->methods; server->methods = method; } -static void wf_jsonrpc_server_invalid_method_invoke( - struct wf_jsonrpc_request * request, - char const * WF_UNUSED_PARAM(method_name), - json_t * WF_UNUSED_PARAM(params), - void * WF_UNUSED_PARAM(user_data)) +static void wfp_jsonrpc_server_invalid_method_invoke( + struct wfp_jsonrpc_request * request, + char const * WFP_UNUSED_PARAM(method_name), + json_t * WFP_UNUSED_PARAM(params), + void * WFP_UNUSED_PARAM(user_data)) { - wf_jsonrpc_respond_error(request, WF_BAD_NOTIMPLEMENTED, "not implemented"); + wfp_jsonrpc_respond_error(request, WFP_BAD_NOTIMPLEMENTED, "not implemented"); } -static struct wf_jsonrpc_method const wf_jsonrpc_server_invalid_method = +static struct wfp_jsonrpc_method const wfp_jsonrpc_server_invalid_method = { .next = NULL, .name = "", - .invoke = &wf_jsonrpc_server_invalid_method_invoke, + .invoke = &wfp_jsonrpc_server_invalid_method_invoke, .user_data = NULL }; -static struct wf_jsonrpc_method const * -wf_jsonrpc_server_get_method( - struct wf_jsonrpc_server * server, +static struct wfp_jsonrpc_method const * +wfp_jsonrpc_server_get_method( + struct wfp_jsonrpc_server * server, char const * method_name) { - struct wf_jsonrpc_method const * current = server->methods; + struct wfp_jsonrpc_method const * current = server->methods; while (NULL != current) { if (0 == strcmp(method_name, current->name)) @@ -100,13 +100,13 @@ wf_jsonrpc_server_get_method( current = current->next; } - return &wf_jsonrpc_server_invalid_method; + return &wfp_jsonrpc_server_invalid_method; } -void wf_jsonrpc_server_process( - struct wf_jsonrpc_server * server, +void wfp_jsonrpc_server_process( + struct wfp_jsonrpc_server * server, json_t * request_data, - wf_jsonrpc_send_fn * send, + wfp_jsonrpc_send_fn * send, void * user_data) { json_t * method_holder = json_object_get(request_data, "method"); @@ -119,8 +119,8 @@ void wf_jsonrpc_server_process( { char const * method_name = json_string_value(method_holder); int id = json_integer_value(id_holder); - struct wf_jsonrpc_request * request = wf_jsonrpc_request_create(id, send, user_data); - struct wf_jsonrpc_method const * method = wf_jsonrpc_server_get_method(server, method_name); + struct wfp_jsonrpc_request * request = wfp_jsonrpc_request_create(id, send, user_data); + struct wfp_jsonrpc_method const * method = wfp_jsonrpc_server_get_method(server, method_name); method->invoke(request, method_name, params, method->user_data); } diff --git a/lib/webfuse_provider/impl/jsonrpc/server.h b/lib/webfuse_provider/impl/jsonrpc/server.h index 17cfa09..c73a39b 100644 --- a/lib/webfuse_provider/impl/jsonrpc/server.h +++ b/lib/webfuse_provider/impl/jsonrpc/server.h @@ -1,5 +1,5 @@ -#ifndef WF_JSONRPC_SERVER_H -#define WF_JSONRPC_SERVER_H +#ifndef WFP_JSONRPC_SERVER_H +#define WFP_JSONRPC_SERVER_H #ifndef __cplusplus #include @@ -17,25 +17,25 @@ extern "C" { #endif -struct wf_jsonrpc_server; +struct wfp_jsonrpc_server; -extern struct wf_jsonrpc_server * -wf_jsonrpc_server_create(void); +extern struct wfp_jsonrpc_server * +wfp_jsonrpc_server_create(void); extern void -wf_jsonrpc_server_dispose( - struct wf_jsonrpc_server * server); +wfp_jsonrpc_server_dispose( + struct wfp_jsonrpc_server * server); -extern void wf_jsonrpc_server_add( - struct wf_jsonrpc_server * server, +extern void wfp_jsonrpc_server_add( + struct wfp_jsonrpc_server * server, char const * method_name, - wf_jsonrpc_method_invoke_fn * invoke, + wfp_jsonrpc_method_invoke_fn * invoke, void * user_data); -extern void wf_jsonrpc_server_process( - struct wf_jsonrpc_server * server, +extern void wfp_jsonrpc_server_process( + struct wfp_jsonrpc_server * server, json_t * request, - wf_jsonrpc_send_fn * send, + wfp_jsonrpc_send_fn * send, void * user_data); #ifdef __cplusplus diff --git a/lib/webfuse_provider/impl/lws_log.c b/lib/webfuse_provider/impl/lws_log.c index 70a6499..fea9471 100644 --- a/lib/webfuse_provider/impl/lws_log.c +++ b/lib/webfuse_provider/impl/lws_log.c @@ -2,16 +2,16 @@ #include #include -#define WF_LWSLOG_DISABLE 0 +#define WFP_LWSLOG_DISABLE 0 -static bool wf_lwslog_is_diabled = false; +static bool wfp_lwslog_is_diabled = false; -void wf_lwslog_disable(void) +void wfp_lwslog_disable(void) { - if (!wf_lwslog_is_diabled) + if (!wfp_lwslog_is_diabled) { - lws_set_log_level(WF_LWSLOG_DISABLE, NULL); - wf_lwslog_is_diabled = true; + lws_set_log_level(WFP_LWSLOG_DISABLE, NULL); + wfp_lwslog_is_diabled = true; } } diff --git a/lib/webfuse_provider/impl/lws_log.h b/lib/webfuse_provider/impl/lws_log.h index 6bbbdda..f3201bd 100644 --- a/lib/webfuse_provider/impl/lws_log.h +++ b/lib/webfuse_provider/impl/lws_log.h @@ -1,12 +1,12 @@ -#ifndef WF_LWS_LOG_H -#define WF_LWS_LOG_H +#ifndef WFP_LWS_LOG_H +#define WFP_LWS_LOG_H #ifdef __cplusplus extern "C" { #endif -extern void wf_lwslog_disable(void); +extern void wfp_lwslog_disable(void); #ifdef __cplusplus } diff --git a/lib/webfuse_provider/impl/message.c b/lib/webfuse_provider/impl/message.c index 11fc67d..49ffc35 100644 --- a/lib/webfuse_provider/impl/message.c +++ b/lib/webfuse_provider/impl/message.c @@ -3,16 +3,16 @@ #include #include -extern struct wf_message * wf_message_create(json_t const * value) +extern struct wfp_message * wfp_message_create(json_t const * value) { - struct wf_message * message = NULL; + struct wfp_message * message = NULL; size_t const length = json_dumpb(value, NULL, 0, JSON_COMPACT); if (0 < length) { - char * data = malloc(sizeof(struct wf_message) + LWS_PRE + length); - message = (struct wf_message *) data; - message->data = &data[sizeof(struct wf_message) + LWS_PRE]; + char * data = malloc(sizeof(struct wfp_message) + LWS_PRE + length); + message = (struct wfp_message *) data; + message->data = &data[sizeof(struct wfp_message) + LWS_PRE]; message->length = length; json_dumpb(value, message->data, length, JSON_COMPACT); @@ -21,8 +21,8 @@ extern struct wf_message * wf_message_create(json_t const * value) return message; } -void wf_message_dispose( - struct wf_message * message) +void wfp_message_dispose( + struct wfp_message * message) { free(message); } diff --git a/lib/webfuse_provider/impl/message.h b/lib/webfuse_provider/impl/message.h index 4ee0304..9ab5a2c 100644 --- a/lib/webfuse_provider/impl/message.h +++ b/lib/webfuse_provider/impl/message.h @@ -1,5 +1,5 @@ -#ifndef WF_MESSAGE_H -#define WF_MESSAGE_H +#ifndef WFP_MESSAGE_H +#define WFP_MESSAGE_H #ifndef __cplusplus #include @@ -11,9 +11,9 @@ using std::size_t; #include #include "webfuse_provider/impl/slist.h" -struct wf_message +struct wfp_message { - struct wf_slist_item item; + struct wfp_slist_item item; char * data; size_t length; }; @@ -23,11 +23,11 @@ extern "C" { #endif -extern struct wf_message * wf_message_create( +extern struct wfp_message * wfp_message_create( json_t const * value); -extern void wf_message_dispose( - struct wf_message * message); +extern void wfp_message_dispose( + struct wfp_message * message); #ifdef __cplusplus } diff --git a/lib/webfuse_provider/impl/message_queue.c b/lib/webfuse_provider/impl/message_queue.c index 5478e77..375163e 100644 --- a/lib/webfuse_provider/impl/message_queue.c +++ b/lib/webfuse_provider/impl/message_queue.c @@ -2,16 +2,16 @@ #include "webfuse_provider/impl/message.h" #include "webfuse_provider/impl/container_of.h" -void wf_message_queue_cleanup( - struct wf_slist * queue) +void wfp_message_queue_cleanup( + struct wfp_slist * queue) { - struct wf_slist_item * item = wf_slist_first(queue); + struct wfp_slist_item * item = wfp_slist_first(queue); while (NULL != item) { - struct wf_slist_item * next = item->next; - struct wf_message * message = wf_container_of(item, struct wf_message, item); - wf_message_dispose(message); + struct wfp_slist_item * next = item->next; + struct wfp_message * message = wfp_container_of(item, struct wfp_message, item); + wfp_message_dispose(message); item = next; } - wf_slist_init(queue); + wfp_slist_init(queue); } diff --git a/lib/webfuse_provider/impl/message_queue.h b/lib/webfuse_provider/impl/message_queue.h index 9d549d1..d839f80 100644 --- a/lib/webfuse_provider/impl/message_queue.h +++ b/lib/webfuse_provider/impl/message_queue.h @@ -1,15 +1,15 @@ -#ifndef WF_MESSAGE_QUEUE_H -#define WF_MESSAGE_QUEUE_H +#ifndef WFP_MESSAGE_QUEUE_H +#define WFP_MESSAGE_QUEUE_H #ifdef __cplusplus extern "C" { #endif -struct wf_slist; +struct wfp_slist; -extern void wf_message_queue_cleanup( - struct wf_slist * queue); +extern void wfp_message_queue_cleanup( + struct wfp_slist * queue); #ifdef __cplusplus diff --git a/lib/webfuse_provider/impl/operation/close.c b/lib/webfuse_provider/impl/operation/close.c index c50c940..e75a43b 100644 --- a/lib/webfuse_provider/impl/operation/close.c +++ b/lib/webfuse_provider/impl/operation/close.c @@ -5,7 +5,7 @@ void wfp_impl_close( struct wfp_impl_invokation_context * context, json_t * params, - int WF_UNUSED_PARAM(id)) + int WFP_UNUSED_PARAM(id)) { size_t const param_count = json_array_size(params); if (4 == param_count) @@ -29,10 +29,10 @@ void wfp_impl_close( } void wfp_impl_close_default( - ino_t WF_UNUSED_PARAM(inode), - uint32_t WF_UNUSED_PARAM(handle), - int WF_UNUSED_PARAM(flags), - void * WF_UNUSED_PARAM(user_data)) + ino_t WFP_UNUSED_PARAM(inode), + uint32_t WFP_UNUSED_PARAM(handle), + int WFP_UNUSED_PARAM(flags), + void * WFP_UNUSED_PARAM(user_data)) { // empty } \ No newline at end of file diff --git a/lib/webfuse_provider/impl/operation/close.h b/lib/webfuse_provider/impl/operation/close.h index 9928d8d..40488cf 100644 --- a/lib/webfuse_provider/impl/operation/close.h +++ b/lib/webfuse_provider/impl/operation/close.h @@ -1,5 +1,5 @@ -#ifndef WF_PROVIDER_IMPL_OPERATION_CLOSE_H -#define WF_PROVIDER_IMPL_OPERATION_CLOSE_H +#ifndef WFP_PROVIDER_IMPL_OPERATION_CLOSE_H +#define WFP_PROVIDER_IMPL_OPERATION_CLOSE_H #include "webfuse_provider/impl/provider.h" diff --git a/lib/webfuse_provider/impl/operation/error.h b/lib/webfuse_provider/impl/operation/error.h index d849ede..0d6c181 100644 --- a/lib/webfuse_provider/impl/operation/error.h +++ b/lib/webfuse_provider/impl/operation/error.h @@ -13,7 +13,7 @@ struct wfp_request; extern WFP_API void wfp_impl_respond_error( struct wfp_request * request, - wf_status status); + wfp_status status); #ifdef __cplusplus } diff --git a/lib/webfuse_provider/impl/operation/getattr.c b/lib/webfuse_provider/impl/operation/getattr.c index c9af90d..4ccc521 100644 --- a/lib/webfuse_provider/impl/operation/getattr.c +++ b/lib/webfuse_provider/impl/operation/getattr.c @@ -29,10 +29,10 @@ void wfp_impl_getattr( void wfp_impl_getattr_default( struct wfp_request * request, - ino_t WF_UNUSED_PARAM(inode), - void * WF_UNUSED_PARAM(user_data)) + ino_t WFP_UNUSED_PARAM(inode), + void * WFP_UNUSED_PARAM(user_data)) { - wfp_impl_respond_error(request, WF_BAD_NOENTRY); + wfp_impl_respond_error(request, WFP_BAD_NOENTRY); } void wfp_impl_respond_getattr( diff --git a/lib/webfuse_provider/impl/operation/getattr.h b/lib/webfuse_provider/impl/operation/getattr.h index 8d2616c..b5a2b58 100644 --- a/lib/webfuse_provider/impl/operation/getattr.h +++ b/lib/webfuse_provider/impl/operation/getattr.h @@ -1,5 +1,5 @@ -#ifndef WF_PROVIDER_IMPL_OPERATION_GETATTR_H -#define WF_PROVIDER_IMPL_OPERATION_GETATTR_H +#ifndef WFP_PROVIDER_IMPL_OPERATION_GETATTR_H +#define WFP_PROVIDER_IMPL_OPERATION_GETATTR_H #include "webfuse_provider/impl/provider.h" diff --git a/lib/webfuse_provider/impl/operation/lookup.c b/lib/webfuse_provider/impl/operation/lookup.c index 43b7eb0..92482d0 100644 --- a/lib/webfuse_provider/impl/operation/lookup.c +++ b/lib/webfuse_provider/impl/operation/lookup.c @@ -59,10 +59,10 @@ void wfp_impl_respond_lookup( void wfp_impl_lookup_default( struct wfp_request * request, - ino_t WF_UNUSED_PARAM(parent), - char const * WF_UNUSED_PARAM(name), - void * WF_UNUSED_PARAM(user_data)) + ino_t WFP_UNUSED_PARAM(parent), + char const * WFP_UNUSED_PARAM(name), + void * WFP_UNUSED_PARAM(user_data)) { - wfp_impl_respond_error(request, WF_BAD_NOENTRY); + wfp_impl_respond_error(request, WFP_BAD_NOENTRY); } diff --git a/lib/webfuse_provider/impl/operation/lookup.h b/lib/webfuse_provider/impl/operation/lookup.h index db1c44a..9968d4d 100644 --- a/lib/webfuse_provider/impl/operation/lookup.h +++ b/lib/webfuse_provider/impl/operation/lookup.h @@ -1,5 +1,5 @@ -#ifndef WF_PROVIDER_IMPL_OPERATION_LOOKUP_H -#define WF_PROVIDER_IMPL_OPERATION_LOOKUP_H +#ifndef WFP_PROVIDER_IMPL_OPERATION_LOOKUP_H +#define WFP_PROVIDER_IMPL_OPERATION_LOOKUP_H #include "webfuse_provider/impl/provider.h" diff --git a/lib/webfuse_provider/impl/operation/open.c b/lib/webfuse_provider/impl/operation/open.c index 1546b49..3916c07 100644 --- a/lib/webfuse_provider/impl/operation/open.c +++ b/lib/webfuse_provider/impl/operation/open.c @@ -29,11 +29,11 @@ void wfp_impl_open( void wfp_impl_open_default( struct wfp_request * request, - ino_t WF_UNUSED_PARAM(inode), - int WF_UNUSED_PARAM(flags), - void * WF_UNUSED_PARAM(user_data)) + ino_t WFP_UNUSED_PARAM(inode), + int WFP_UNUSED_PARAM(flags), + void * WFP_UNUSED_PARAM(user_data)) { - wfp_impl_respond_error(request, WF_BAD_NOENTRY); + wfp_impl_respond_error(request, WFP_BAD_NOENTRY); } void wfp_impl_respond_open( diff --git a/lib/webfuse_provider/impl/operation/open.h b/lib/webfuse_provider/impl/operation/open.h index 3ccf243..d8dd9a2 100644 --- a/lib/webfuse_provider/impl/operation/open.h +++ b/lib/webfuse_provider/impl/operation/open.h @@ -1,5 +1,5 @@ -#ifndef WF_PROVIDER_IMPL_OPERATION_OPEN_H -#define WF_PROVIDER_IMPL_OPERATION_OPEN_H +#ifndef WFP_PROVIDER_IMPL_OPERATION_OPEN_H +#define WFP_PROVIDER_IMPL_OPERATION_OPEN_H #include "webfuse_provider/impl/provider.h" diff --git a/lib/webfuse_provider/impl/operation/read.c b/lib/webfuse_provider/impl/operation/read.c index 5b0487f..795c662 100644 --- a/lib/webfuse_provider/impl/operation/read.c +++ b/lib/webfuse_provider/impl/operation/read.c @@ -38,13 +38,13 @@ void wfp_impl_read( void wfp_impl_read_default( struct wfp_request * request, - ino_t WF_UNUSED_PARAM(inode), - uint32_t WF_UNUSED_PARAM(handle), - size_t WF_UNUSED_PARAM(offset), - size_t WF_UNUSED_PARAM(length), - void * WF_UNUSED_PARAM(user_data)) + ino_t WFP_UNUSED_PARAM(inode), + uint32_t WFP_UNUSED_PARAM(handle), + size_t WFP_UNUSED_PARAM(offset), + size_t WFP_UNUSED_PARAM(length), + void * WFP_UNUSED_PARAM(user_data)) { - wfp_impl_respond_error(request, WF_BAD_NOENTRY); + wfp_impl_respond_error(request, WFP_BAD_NOENTRY); } void wfp_impl_respond_read( @@ -54,9 +54,9 @@ void wfp_impl_respond_read( { if (0 < length) { - size_t const size = wf_base64_encoded_size(length) + 1; + size_t const size = wfp_base64_encoded_size(length) + 1; char * buffer = malloc(size); - wf_base64_encode((uint8_t const *) data, length, buffer, size); + wfp_base64_encode((uint8_t const *) data, length, buffer, size); json_t * result = json_object(); json_object_set_new(result, "data", json_string(buffer)); diff --git a/lib/webfuse_provider/impl/operation/read.h b/lib/webfuse_provider/impl/operation/read.h index 7e29b75..4c7599e 100644 --- a/lib/webfuse_provider/impl/operation/read.h +++ b/lib/webfuse_provider/impl/operation/read.h @@ -1,5 +1,5 @@ -#ifndef WF_PROVIDER_IMPL_OPERATION_READ_H -#define WF_PROVIDER_IMPL_OPERATION_READ_H +#ifndef WFP_PROVIDER_IMPL_OPERATION_READ_H +#define WFP_PROVIDER_IMPL_OPERATION_READ_H #include "webfuse_provider/impl/provider.h" diff --git a/lib/webfuse_provider/impl/operation/readdir.c b/lib/webfuse_provider/impl/operation/readdir.c index 92c169f..f6e3e18 100644 --- a/lib/webfuse_provider/impl/operation/readdir.c +++ b/lib/webfuse_provider/impl/operation/readdir.c @@ -26,10 +26,10 @@ void wfp_impl_readdir( void wfp_impl_readdir_default( struct wfp_request * request, - ino_t WF_UNUSED_PARAM(directory), - void * WF_UNUSED_PARAM(user_data)) + ino_t WFP_UNUSED_PARAM(directory), + void * WFP_UNUSED_PARAM(user_data)) { - wfp_impl_respond_error(request, WF_BAD_NOENTRY); + wfp_impl_respond_error(request, WFP_BAD_NOENTRY); } void wfp_impl_respond_readdir( diff --git a/lib/webfuse_provider/impl/operation/readdir.h b/lib/webfuse_provider/impl/operation/readdir.h index 62eadf0..9d7298e 100644 --- a/lib/webfuse_provider/impl/operation/readdir.h +++ b/lib/webfuse_provider/impl/operation/readdir.h @@ -1,5 +1,5 @@ -#ifndef WF_PROVIDER_IMPL_OPERATION_READDIR_H -#define WF_PROVIDER_IMPL_OPERATION_READDIR_H +#ifndef WFP_PROVIDER_IMPL_OPERATION_READDIR_H +#define WFP_PROVIDER_IMPL_OPERATION_READDIR_H #include "webfuse_provider/impl/provider.h" diff --git a/lib/webfuse_provider/impl/provider.h b/lib/webfuse_provider/impl/provider.h index 54f4020..d0eb8a0 100644 --- a/lib/webfuse_provider/impl/provider.h +++ b/lib/webfuse_provider/impl/provider.h @@ -1,5 +1,5 @@ -#ifndef WF_PROVIDER_IMPL_PROVIDER_H -#define WF_PROVIDER_IMPL_PROVIDER_H +#ifndef WFP_PROVIDER_IMPL_PROVIDER_H +#define WFP_PROVIDER_IMPL_PROVIDER_H #ifndef __cplusplus #include diff --git a/lib/webfuse_provider/impl/request.c b/lib/webfuse_provider/impl/request.c index 95883df..85f5087 100644 --- a/lib/webfuse_provider/impl/request.c +++ b/lib/webfuse_provider/impl/request.c @@ -37,7 +37,7 @@ extern void wfp_impl_respond( void wfp_impl_respond_error( struct wfp_request * request, - wf_status status) + wfp_status status) { json_t * response = json_object(); json_t * error = json_object(); diff --git a/lib/webfuse_provider/impl/request.h b/lib/webfuse_provider/impl/request.h index 4feac3e..acca0ed 100644 --- a/lib/webfuse_provider/impl/request.h +++ b/lib/webfuse_provider/impl/request.h @@ -1,5 +1,5 @@ -#ifndef WF_PROVIDER_IMPL_REQUEST_H -#define WF_PROVIDER_IMPL_REQUEST_H +#ifndef WFP_PROVIDER_IMPL_REQUEST_H +#define WFP_PROVIDER_IMPL_REQUEST_H #include #include "webfuse_provider/impl/provider.h" @@ -23,7 +23,7 @@ struct wfp_request extern void wfp_impl_respond_error( struct wfp_request * request, - wf_status status); + wfp_status status); extern struct wfp_request * wfp_impl_request_create( struct wfp_request * prototype, diff --git a/lib/webfuse_provider/impl/slist.c b/lib/webfuse_provider/impl/slist.c index a661984..e81d1d6 100644 --- a/lib/webfuse_provider/impl/slist.c +++ b/lib/webfuse_provider/impl/slist.c @@ -1,46 +1,46 @@ #include "webfuse_provider/impl/slist.h" #include -void wf_slist_init( - struct wf_slist * list) +void wfp_slist_init( + struct wfp_slist * list) { list->head.next = NULL; list->last = &list->head; } -bool wf_slist_empty( - struct wf_slist * list) +bool wfp_slist_empty( + struct wfp_slist * list) { return (list->last == &list->head); } -struct wf_slist_item * wf_slist_first( - struct wf_slist * list) +struct wfp_slist_item * wfp_slist_first( + struct wfp_slist * list) { return list->head.next; } -void wf_slist_append( - struct wf_slist * list, - struct wf_slist_item * item) +void wfp_slist_append( + struct wfp_slist * list, + struct wfp_slist_item * item) { item->next = NULL; list->last->next = item; list->last = item; } -struct wf_slist_item * wf_slist_remove_first( - struct wf_slist * list) +struct wfp_slist_item * wfp_slist_remove_first( + struct wfp_slist * list) { - return wf_slist_remove_after(list, &list->head); + return wfp_slist_remove_after(list, &list->head); } -struct wf_slist_item * wf_slist_remove_after( - struct wf_slist * list, - struct wf_slist_item * prev) +struct wfp_slist_item * wfp_slist_remove_after( + struct wfp_slist * list, + struct wfp_slist_item * prev) { - struct wf_slist_item * result = prev->next; + struct wfp_slist_item * result = prev->next; if (NULL != result) { diff --git a/lib/webfuse_provider/impl/slist.h b/lib/webfuse_provider/impl/slist.h index b5530b5..b16ac57 100644 --- a/lib/webfuse_provider/impl/slist.h +++ b/lib/webfuse_provider/impl/slist.h @@ -1,5 +1,5 @@ -#ifndef WF_SLIST_H -#define WF_SLIST_H +#ifndef WFP_SLIST_H +#define WFP_SLIST_H #ifndef __cplusplus #include @@ -10,36 +10,36 @@ extern "C" { #endif -struct wf_slist_item +struct wfp_slist_item { - struct wf_slist_item * next; + struct wfp_slist_item * next; }; -struct wf_slist +struct wfp_slist { - struct wf_slist_item head; - struct wf_slist_item * last; + struct wfp_slist_item head; + struct wfp_slist_item * last; }; -extern void wf_slist_init( - struct wf_slist * list); +extern void wfp_slist_init( + struct wfp_slist * list); -extern bool wf_slist_empty( - struct wf_slist * list); +extern bool wfp_slist_empty( + struct wfp_slist * list); -extern struct wf_slist_item * wf_slist_first( - struct wf_slist * list); +extern struct wfp_slist_item * wfp_slist_first( + struct wfp_slist * list); -extern void wf_slist_append( - struct wf_slist * list, - struct wf_slist_item * item); +extern void wfp_slist_append( + struct wfp_slist * list, + struct wfp_slist_item * item); -extern struct wf_slist_item * wf_slist_remove_first( - struct wf_slist * list); +extern struct wfp_slist_item * wfp_slist_remove_first( + struct wfp_slist * list); -extern struct wf_slist_item * wf_slist_remove_after( - struct wf_slist * list, - struct wf_slist_item * prev); +extern struct wfp_slist_item * wfp_slist_remove_after( + struct wfp_slist * list, + struct wfp_slist_item * prev); #ifdef __cplusplus } diff --git a/lib/webfuse_provider/impl/status.c b/lib/webfuse_provider/impl/status.c index 2651306..5153f6b 100644 --- a/lib/webfuse_provider/impl/status.c +++ b/lib/webfuse_provider/impl/status.c @@ -2,33 +2,33 @@ #include - int wf_status_to_rc(wf_status status) + int wfp_status_to_rc(wfp_status status) { switch(status) { - case WF_GOOD: return 0; - case WF_BAD_NOTIMPLEMENTED: return -ENOSYS; - case WF_BAD_TIMEOUT: return -ETIMEDOUT; - case WF_BAD_BUSY: return -ENOENT; - case WF_BAD_FORMAT: return -ENOENT; - case WF_BAD_NOENTRY: return -ENOENT; - case WF_BAD_ACCESS_DENIED: return -EACCES; + case WFP_GOOD: return 0; + case WFP_BAD_NOTIMPLEMENTED: return -ENOSYS; + case WFP_BAD_TIMEOUT: return -ETIMEDOUT; + case WFP_BAD_BUSY: return -ENOENT; + case WFP_BAD_FORMAT: return -ENOENT; + case WFP_BAD_NOENTRY: return -ENOENT; + case WFP_BAD_ACCESS_DENIED: return -EACCES; default: return -ENOENT; } } -char const * wf_status_tostring(wf_status status) +char const * wfp_status_tostring(wfp_status status) { switch(status) { - case WF_GOOD: return "Good"; - case WF_BAD: return "Bad"; - case WF_BAD_NOTIMPLEMENTED: return "Bad (not implemented)"; - case WF_BAD_TIMEOUT: return "Bad (timeout)"; - case WF_BAD_BUSY: return "Bad (busy)"; - case WF_BAD_FORMAT: return "Bad (format)"; - case WF_BAD_NOENTRY: return "Bad (no entry)"; - case WF_BAD_ACCESS_DENIED: return "Bad (access denied)"; + case WFP_GOOD: return "Good"; + case WFP_BAD: return "Bad"; + case WFP_BAD_NOTIMPLEMENTED: return "Bad (not implemented)"; + case WFP_BAD_TIMEOUT: return "Bad (timeout)"; + case WFP_BAD_BUSY: return "Bad (busy)"; + case WFP_BAD_FORMAT: return "Bad (format)"; + case WFP_BAD_NOENTRY: return "Bad (no entry)"; + case WFP_BAD_ACCESS_DENIED: return "Bad (access denied)"; default: return "Bad (unknown)"; } } diff --git a/lib/webfuse_provider/impl/status_intern.h b/lib/webfuse_provider/impl/status_intern.h index 3972229..075a555 100644 --- a/lib/webfuse_provider/impl/status_intern.h +++ b/lib/webfuse_provider/impl/status_intern.h @@ -1,5 +1,5 @@ -#ifndef WF_STATUS_INTERN_H -#define WF_STATUS_INTERN_H +#ifndef WFP_STATUS_INTERN_H +#define WFP_STATUS_INTERN_H #include "webfuse_provider/status.h" @@ -7,9 +7,9 @@ extern "C" { #endif -extern int wf_status_to_rc(wf_status status); +extern int wfp_status_to_rc(wfp_status status); -extern char const * wf_status_tostring(wf_status status); +extern char const * wfp_status_tostring(wfp_status status); #ifdef __cplusplus } diff --git a/lib/webfuse_provider/impl/timer/manager.c b/lib/webfuse_provider/impl/timer/manager.c index 28d93f4..e8eac2b 100644 --- a/lib/webfuse_provider/impl/timer/manager.c +++ b/lib/webfuse_provider/impl/timer/manager.c @@ -5,30 +5,30 @@ #include #include -struct wf_timer_manager +struct wfp_timer_manager { - struct wf_timer * timers; + struct wfp_timer * timers; }; -struct wf_timer_manager * -wf_timer_manager_create(void) +struct wfp_timer_manager * +wfp_timer_manager_create(void) { - struct wf_timer_manager * manager = malloc(sizeof(struct wf_timer_manager)); + struct wfp_timer_manager * manager = malloc(sizeof(struct wfp_timer_manager)); manager->timers = NULL; return manager; } void -wf_timer_manager_dispose( - struct wf_timer_manager * manager) +wfp_timer_manager_dispose( + struct wfp_timer_manager * manager) { - struct wf_timer * timer = manager->timers; + struct wfp_timer * timer = manager->timers; while (NULL != timer) { - struct wf_timer * next = timer->next; + struct wfp_timer * next = timer->next; - wf_timer_trigger(timer); + wfp_timer_trigger(timer); timer = next; } @@ -36,27 +36,27 @@ wf_timer_manager_dispose( } -void wf_timer_manager_check( - struct wf_timer_manager * manager) +void wfp_timer_manager_check( + struct wfp_timer_manager * manager) { - struct wf_timer * timer = manager->timers; + struct wfp_timer * timer = manager->timers; while (NULL != timer) { - struct wf_timer * next = timer->next; + struct wfp_timer * next = timer->next; - if (wf_timer_is_timeout(timer)) + if (wfp_timer_is_timeout(timer)) { - wf_timer_manager_removetimer(manager, timer); - wf_timer_trigger(timer); + wfp_timer_manager_removetimer(manager, timer); + wfp_timer_trigger(timer); } timer = next; } } -void wf_timer_manager_addtimer( - struct wf_timer_manager * manager, - struct wf_timer * timer) +void wfp_timer_manager_addtimer( + struct wfp_timer_manager * manager, + struct wfp_timer * timer) { if (NULL != manager->timers) { @@ -68,12 +68,12 @@ void wf_timer_manager_addtimer( manager->timers = timer; } -void wf_timer_manager_removetimer( - struct wf_timer_manager * manager, - struct wf_timer * timer) +void wfp_timer_manager_removetimer( + struct wfp_timer_manager * manager, + struct wfp_timer * timer) { - struct wf_timer * prev = timer->prev; - struct wf_timer * next = timer->next; + struct wfp_timer * prev = timer->prev; + struct wfp_timer * next = timer->next; if (NULL != prev) { diff --git a/lib/webfuse_provider/impl/timer/manager.h b/lib/webfuse_provider/impl/timer/manager.h index 870a2d0..2515c2b 100644 --- a/lib/webfuse_provider/impl/timer/manager.h +++ b/lib/webfuse_provider/impl/timer/manager.h @@ -1,23 +1,23 @@ -#ifndef WF_TIMER_MANAGER_H -#define WF_TIMER_MANAGER_H +#ifndef WFP_TIMER_MANAGER_H +#define WFP_TIMER_MANAGER_H #ifdef __cplusplus extern "C" { #endif -struct wf_timer_manager; +struct wfp_timer_manager; -extern struct wf_timer_manager * -wf_timer_manager_create(void); +extern struct wfp_timer_manager * +wfp_timer_manager_create(void); extern void -wf_timer_manager_dispose( - struct wf_timer_manager * manager); +wfp_timer_manager_dispose( + struct wfp_timer_manager * manager); extern void -wf_timer_manager_check( - struct wf_timer_manager * manager); +wfp_timer_manager_check( + struct wfp_timer_manager * manager); #ifdef __cplusplus } diff --git a/lib/webfuse_provider/impl/timer/manager_intern.h b/lib/webfuse_provider/impl/timer/manager_intern.h index 6675483..e4c65c3 100644 --- a/lib/webfuse_provider/impl/timer/manager_intern.h +++ b/lib/webfuse_provider/impl/timer/manager_intern.h @@ -1,5 +1,5 @@ -#ifndef WF_TIMER_MANAGER_INTERN_H -#define WF_TIMER_MANAGER_INTERN_H +#ifndef WFP_TIMER_MANAGER_INTERN_H +#define WFP_TIMER_MANAGER_INTERN_H #include "webfuse_provider/impl/timer/manager.h" @@ -8,15 +8,15 @@ extern "C" { #endif -struct wf_timer; +struct wfp_timer; -extern void wf_timer_manager_addtimer( - struct wf_timer_manager * manager, - struct wf_timer * timer); +extern void wfp_timer_manager_addtimer( + struct wfp_timer_manager * manager, + struct wfp_timer * timer); -extern void wf_timer_manager_removetimer( - struct wf_timer_manager * manager, - struct wf_timer * timer); +extern void wfp_timer_manager_removetimer( + struct wfp_timer_manager * manager, + struct wfp_timer * timer); #ifdef __cplusplus } diff --git a/lib/webfuse_provider/impl/timer/on_timer_fn.h b/lib/webfuse_provider/impl/timer/on_timer_fn.h index d250bae..b1bc806 100644 --- a/lib/webfuse_provider/impl/timer/on_timer_fn.h +++ b/lib/webfuse_provider/impl/timer/on_timer_fn.h @@ -1,15 +1,15 @@ -#ifndef WF_TIMER_ON_TIMER_FN_H -#define WF_TIMER_ON_TIMER_FN_H +#ifndef WFP_TIMER_ON_TIMER_FN_H +#define WFP_TIMER_ON_TIMER_FN_H #ifdef __cplusplus extern "C" { #endif -struct wf_timer; +struct wfp_timer; -typedef void wf_timer_on_timer_fn( - struct wf_timer * timer, +typedef void wfp_timer_on_timer_fn( + struct wfp_timer * timer, void * user_data); #ifdef __cplusplus diff --git a/lib/webfuse_provider/impl/timer/timepoint.c b/lib/webfuse_provider/impl/timer/timepoint.c index 620cea1..eb281ef 100644 --- a/lib/webfuse_provider/impl/timer/timepoint.c +++ b/lib/webfuse_provider/impl/timer/timepoint.c @@ -2,30 +2,30 @@ #include -#define WF_TIMER_MSEC_PER_SEC ((wf_timer_timepoint) 1000) -#define WF_TIMER_NSEC_PER_MSEC ((wf_timer_timepoint) 1000 * 1000) +#define WFP_TIMER_MSEC_PER_SEC ((wfp_timer_timepoint) 1000) +#define WFP_TIMER_NSEC_PER_MSEC ((wfp_timer_timepoint) 1000 * 1000) -wf_timer_timepoint wf_timer_timepoint_now(void) +wfp_timer_timepoint wfp_timer_timepoint_now(void) { struct timespec tp; clock_gettime(CLOCK_MONOTONIC, &tp); - wf_timer_timepoint const now = (tp.tv_sec * WF_TIMER_MSEC_PER_SEC) + (tp.tv_nsec / WF_TIMER_NSEC_PER_MSEC); + wfp_timer_timepoint const now = (tp.tv_sec * WFP_TIMER_MSEC_PER_SEC) + (tp.tv_nsec / WFP_TIMER_NSEC_PER_MSEC); return now; } -wf_timer_timepoint wf_timer_timepoint_in_msec(wf_timer_timediff value) +wfp_timer_timepoint wfp_timer_timepoint_in_msec(wfp_timer_timediff value) { - wf_timer_timepoint const now = wf_timer_timepoint_now(); - wf_timer_timepoint result = now + ((wf_timer_timepoint) value); + wfp_timer_timepoint const now = wfp_timer_timepoint_now(); + wfp_timer_timepoint result = now + ((wfp_timer_timepoint) value); return result; } -bool wf_timer_timepoint_is_elapsed(wf_timer_timepoint tp) +bool wfp_timer_timepoint_is_elapsed(wfp_timer_timepoint tp) { - wf_timer_timepoint const now = wf_timer_timepoint_now(); - wf_timer_timediff const diff = (wf_timer_timediff) (tp - now); + wfp_timer_timepoint const now = wfp_timer_timepoint_now(); + wfp_timer_timediff const diff = (wfp_timer_timediff) (tp - now); return (0 > diff); } diff --git a/lib/webfuse_provider/impl/timer/timepoint.h b/lib/webfuse_provider/impl/timer/timepoint.h index cb78197..1990138 100644 --- a/lib/webfuse_provider/impl/timer/timepoint.h +++ b/lib/webfuse_provider/impl/timer/timepoint.h @@ -1,5 +1,5 @@ -#ifndef WF_TIMER_TIMEPOINT_H -#define WF_TIMER_TIMEPOINT_H +#ifndef WFP_TIMER_TIMEPOINT_H +#define WFP_TIMER_TIMEPOINT_H #ifndef __cplusplus #include @@ -13,16 +13,16 @@ extern "C" { #endif -typedef uint64_t wf_timer_timepoint; -typedef int64_t wf_timer_timediff; +typedef uint64_t wfp_timer_timepoint; +typedef int64_t wfp_timer_timediff; -extern wf_timer_timepoint wf_timer_timepoint_now(void); +extern wfp_timer_timepoint wfp_timer_timepoint_now(void); -extern wf_timer_timepoint wf_timer_timepoint_in_msec( - wf_timer_timediff value); +extern wfp_timer_timepoint wfp_timer_timepoint_in_msec( + wfp_timer_timediff value); -extern bool wf_timer_timepoint_is_elapsed( - wf_timer_timepoint timepoint); +extern bool wfp_timer_timepoint_is_elapsed( + wfp_timer_timepoint timepoint); #ifdef __cplusplus } diff --git a/lib/webfuse_provider/impl/timer/timer.c b/lib/webfuse_provider/impl/timer/timer.c index fb454b1..01b46e1 100644 --- a/lib/webfuse_provider/impl/timer/timer.c +++ b/lib/webfuse_provider/impl/timer/timer.c @@ -6,13 +6,13 @@ #include #include -struct wf_timer * -wf_timer_create( - struct wf_timer_manager * manager, - wf_timer_on_timer_fn * on_timer, +struct wfp_timer * +wfp_timer_create( + struct wfp_timer_manager * manager, + wfp_timer_on_timer_fn * on_timer, void * user_data) { - struct wf_timer * timer = malloc(sizeof(struct wf_timer)); + struct wfp_timer * timer = malloc(sizeof(struct wfp_timer)); timer->manager = manager; timer->timeout = 0; timer->on_timer = on_timer; @@ -24,38 +24,38 @@ wf_timer_create( } void -wf_timer_dispose( - struct wf_timer * timer) +wfp_timer_dispose( + struct wfp_timer * timer) { free(timer); } -void wf_timer_start( - struct wf_timer * timer, +void wfp_timer_start( + struct wfp_timer * timer, int timeout_ms) { - timer->timeout = wf_timer_timepoint_in_msec(timeout_ms); + timer->timeout = wfp_timer_timepoint_in_msec(timeout_ms); - wf_timer_manager_addtimer(timer->manager, timer); + wfp_timer_manager_addtimer(timer->manager, timer); } -void wf_timer_cancel( - struct wf_timer * timer) +void wfp_timer_cancel( + struct wfp_timer * timer) { - wf_timer_manager_removetimer(timer->manager, timer); + wfp_timer_manager_removetimer(timer->manager, timer); timer->timeout = 0; } -bool wf_timer_is_timeout( - struct wf_timer * timer) +bool wfp_timer_is_timeout( + struct wfp_timer * timer) { - return wf_timer_timepoint_is_elapsed(timer->timeout); + return wfp_timer_timepoint_is_elapsed(timer->timeout); } -void wf_timer_trigger( - struct wf_timer * timer) +void wfp_timer_trigger( + struct wfp_timer * timer) { if (0 != timer->on_timer) { diff --git a/lib/webfuse_provider/impl/timer/timer.h b/lib/webfuse_provider/impl/timer/timer.h index c07d166..d4d99ee 100644 --- a/lib/webfuse_provider/impl/timer/timer.h +++ b/lib/webfuse_provider/impl/timer/timer.h @@ -1,5 +1,5 @@ -#ifndef WF_TIMER_TIMER_H -#define WF_TIMER_TIMER_H +#ifndef WFP_TIMER_TIMER_H +#define WFP_TIMER_TIMER_H #include "webfuse_provider/impl/timer/on_timer_fn.h" @@ -8,27 +8,27 @@ extern "C" { #endif -struct wf_timer; -struct wf_timer_manager; +struct wfp_timer; +struct wfp_timer_manager; -extern struct wf_timer * -wf_timer_create( - struct wf_timer_manager * manager, - wf_timer_on_timer_fn * on_timer, +extern struct wfp_timer * +wfp_timer_create( + struct wfp_timer_manager * manager, + wfp_timer_on_timer_fn * on_timer, void * user_data); extern void -wf_timer_dispose( - struct wf_timer * timer); +wfp_timer_dispose( + struct wfp_timer * timer); extern void -wf_timer_start( - struct wf_timer * timer, +wfp_timer_start( + struct wfp_timer * timer, int timeout_ms); extern void -wf_timer_cancel( - struct wf_timer * timer); +wfp_timer_cancel( + struct wfp_timer * timer); #ifdef __cplusplus } diff --git a/lib/webfuse_provider/impl/timer/timer_intern.h b/lib/webfuse_provider/impl/timer/timer_intern.h index c9d9b10..88b668b 100644 --- a/lib/webfuse_provider/impl/timer/timer_intern.h +++ b/lib/webfuse_provider/impl/timer/timer_intern.h @@ -1,5 +1,5 @@ -#ifndef WF_TIMER_TIMER_H -#define WF_TIMER_TIMER_H +#ifndef WFP_TIMER_TIMER_H +#define WFP_TIMER_TIMER_H #include "webfuse_provider/impl/timer/timer.h" #include "webfuse_provider/impl/timer/on_timer_fn.h" @@ -14,21 +14,21 @@ extern "C" { #endif -struct wf_timer +struct wfp_timer { - struct wf_timer_manager * manager; - wf_timer_timepoint timeout; - wf_timer_on_timer_fn * on_timer; + struct wfp_timer_manager * manager; + wfp_timer_timepoint timeout; + wfp_timer_on_timer_fn * on_timer; void * user_data; - struct wf_timer * next; - struct wf_timer * prev; + struct wfp_timer * next; + struct wfp_timer * prev; }; -extern bool wf_timer_is_timeout( - struct wf_timer * timer); +extern bool wfp_timer_is_timeout( + struct wfp_timer * timer); -extern void wf_timer_trigger( - struct wf_timer * timer); +extern void wfp_timer_trigger( + struct wfp_timer * timer); #ifdef __cplusplus diff --git a/lib/webfuse_provider/impl/url.c b/lib/webfuse_provider/impl/url.c index 98f8c8e..a2f211e 100644 --- a/lib/webfuse_provider/impl/url.c +++ b/lib/webfuse_provider/impl/url.c @@ -3,7 +3,7 @@ #include #include -struct wf_url_protocol +struct wfp_url_protocol { char const * name; size_t name_length; @@ -11,11 +11,11 @@ struct wf_url_protocol bool use_tls; }; -static bool wf_url_readprotocol( - struct wf_url * url, +static bool wfp_url_readprotocol( + struct wfp_url * url, char const * * data) { - static struct wf_url_protocol const known_protocols[] = + static struct wfp_url_protocol const known_protocols[] = { {"ws://", 5, 80, false}, {"wss://", 6, 443, true} @@ -25,7 +25,7 @@ static bool wf_url_readprotocol( bool found = false; for(size_t i = 0; (!found) && (i < count); i++) { - struct wf_url_protocol const * protocol = &known_protocols[i]; + struct wfp_url_protocol const * protocol = &known_protocols[i]; if (0 == strncmp(*data, protocol->name, protocol->name_length)) { url->port = protocol->default_port; @@ -38,8 +38,8 @@ static bool wf_url_readprotocol( return found; } -static bool wf_url_readhost( - struct wf_url * url, +static bool wfp_url_readhost( + struct wfp_url * url, char const * * data) { char * end = strpbrk(*data, ":/"); @@ -55,8 +55,8 @@ static bool wf_url_readhost( return result; } -static bool wf_url_readport( - struct wf_url * url, +static bool wfp_url_readport( + struct wfp_url * url, char const * * data) { bool result; @@ -81,8 +81,8 @@ static bool wf_url_readport( return result; } -static bool wf_url_readpath( - struct wf_url * url, +static bool wfp_url_readpath( + struct wfp_url * url, char const * * data) { bool const result = ('/' == **data); @@ -93,33 +93,33 @@ static bool wf_url_readpath( } -bool wf_url_init( - struct wf_url * url, +bool wfp_url_init( + struct wfp_url * url, char const * value) { - memset(url, 0, sizeof(struct wf_url)); + memset(url, 0, sizeof(struct wfp_url)); char const * data = value; bool const result = - wf_url_readprotocol(url, &data) && - wf_url_readhost(url, &data) && - wf_url_readport(url, &data) && - wf_url_readpath(url, &data) + wfp_url_readprotocol(url, &data) && + wfp_url_readhost(url, &data) && + wfp_url_readport(url, &data) && + wfp_url_readpath(url, &data) ; if (!result) { - wf_url_cleanup(url); + wfp_url_cleanup(url); } return result; } -void wf_url_cleanup( - struct wf_url * url) +void wfp_url_cleanup( + struct wfp_url * url) { free(url->host); free(url->path); - memset(url, 0, sizeof(struct wf_url)); + memset(url, 0, sizeof(struct wfp_url)); } diff --git a/lib/webfuse_provider/impl/url.h b/lib/webfuse_provider/impl/url.h index 4f75d8d..21f00df 100644 --- a/lib/webfuse_provider/impl/url.h +++ b/lib/webfuse_provider/impl/url.h @@ -1,5 +1,5 @@ -#ifndef WF_URL_H -#define WF_URL_H +#ifndef WFP_URL_H +#define WFP_URL_H #ifndef __cplusplus #include @@ -9,7 +9,7 @@ extern "C" { #endif -struct wf_url +struct wfp_url { char * host; int port; @@ -17,12 +17,12 @@ struct wf_url bool use_tls; }; -extern bool wf_url_init( - struct wf_url * url, +extern bool wfp_url_init( + struct wfp_url * url, char const * value); -extern void wf_url_cleanup( - struct wf_url * url); +extern void wfp_url_cleanup( + struct wfp_url * url); #ifdef __cplusplus diff --git a/lib/webfuse_provider/impl/util.h b/lib/webfuse_provider/impl/util.h index b0169b8..0a54dd9 100644 --- a/lib/webfuse_provider/impl/util.h +++ b/lib/webfuse_provider/impl/util.h @@ -1,10 +1,10 @@ -#ifndef WF_UTIL_H -#define WF_UTIL_H +#ifndef WFP_UTIL_H +#define WFP_UTIL_H #ifdef __GNUC__ -#define WF_UNUSED_PARAM(param) param __attribute__((unused)) +#define WFP_UNUSED_PARAM(param) param __attribute__((unused)) #else -#define WF_UNUSED_PARAM(param) +#define WFP_UNUSED_PARAM(param) #endif #endif diff --git a/meson.build b/meson.build index fe69b6d..3792647 100644 --- a/meson.build +++ b/meson.build @@ -146,16 +146,16 @@ alltests = executable('alltests', 'test/webfuse_provider/tests/provider/operation/test_read.cc', 'test/webfuse_provider/tests/provider/operation/test_readdir.cc', link_args: [ - '-Wl,--wrap=wf_timer_manager_create', - '-Wl,--wrap=wf_timer_manager_dispose', - '-Wl,--wrap=wf_timer_manager_check', - '-Wl,--wrap=wf_timer_create', - '-Wl,--wrap=wf_timer_dispose', - '-Wl,--wrap=wf_timer_start', - '-Wl,--wrap=wf_timer_cancel', - '-Wl,--wrap=wf_impl_operation_context_get_proxy', - '-Wl,--wrap=wf_jsonrpc_proxy_vinvoke', - '-Wl,--wrap=wf_jsonrpc_proxy_vnotify', + '-Wl,--wrap=wfp_timer_manager_create', + '-Wl,--wrap=wfp_timer_manager_dispose', + '-Wl,--wrap=wfp_timer_manager_check', + '-Wl,--wrap=wfp_timer_create', + '-Wl,--wrap=wfp_timer_dispose', + '-Wl,--wrap=wfp_timer_start', + '-Wl,--wrap=wfp_timer_cancel', + '-Wl,--wrap=wfp_impl_operation_context_get_proxy', + '-Wl,--wrap=wfp_jsonrpc_proxy_vinvoke', + '-Wl,--wrap=wfp_jsonrpc_proxy_vnotify', ], include_directories: ['include', 'lib', 'test'], dependencies: [ diff --git a/test/webfuse_provider/json_matcher.hpp b/test/webfuse_provider/json_matcher.hpp index 7822344..9cf50e8 100644 --- a/test/webfuse_provider/json_matcher.hpp +++ b/test/webfuse_provider/json_matcher.hpp @@ -1,4 +1,4 @@ -#ifndef WF_JSON_MATCHER_HPP +#ifndef WFP_JSON_MATCHER_HPP #define FW_JSON_MATCHER_HPP #include diff --git a/test/webfuse_provider/mocks/lookup_matcher.hpp b/test/webfuse_provider/mocks/lookup_matcher.hpp index e9c5a55..2a798db 100644 --- a/test/webfuse_provider/mocks/lookup_matcher.hpp +++ b/test/webfuse_provider/mocks/lookup_matcher.hpp @@ -1,5 +1,5 @@ -#ifndef WF_LOOKUP_MATCHER_HPP -#define WF_LOOKUP_MATCHER_HPP +#ifndef WFP_LOOKUP_MATCHER_HPP +#define WFP_LOOKUP_MATCHER_HPP #include #include diff --git a/test/webfuse_provider/mocks/mock_invokation_handler.hpp b/test/webfuse_provider/mocks/mock_invokation_handler.hpp index 48d3b8b..37a43ae 100644 --- a/test/webfuse_provider/mocks/mock_invokation_handler.hpp +++ b/test/webfuse_provider/mocks/mock_invokation_handler.hpp @@ -1,5 +1,5 @@ -#ifndef WF_MOCK_INVOKATION_HANDLER_HPP -#define WF_MOCK_INVOKATION_HANDLER_HPP +#ifndef WFP_MOCK_INVOKATION_HANDLER_HPP +#define WFP_MOCK_INVOKATION_HANDLER_HPP #include "webfuse/utils/ws_server2.hpp" #include diff --git a/test/webfuse_provider/mocks/mock_jsonrpc_proxy.cc b/test/webfuse_provider/mocks/mock_jsonrpc_proxy.cc index 68e23e9..f299162 100644 --- a/test/webfuse_provider/mocks/mock_jsonrpc_proxy.cc +++ b/test/webfuse_provider/mocks/mock_jsonrpc_proxy.cc @@ -5,15 +5,15 @@ extern "C" { static webfuse_test::MockJsonRpcProxy * webfuse_test_MockJsonRpcProxy = nullptr; -WF_WRAP_VFUNC5(webfuse_test_MockJsonRpcProxy, void, wf_jsonrpc_proxy_vinvoke, - struct wf_jsonrpc_proxy *, - wf_jsonrpc_proxy_finished_fn *, +WFP_WRAP_VFUNC5(webfuse_test_MockJsonRpcProxy, void, wfp_jsonrpc_proxy_vinvoke, + struct wfp_jsonrpc_proxy *, + wfp_jsonrpc_proxy_finished_fn *, void *, char const *, char const *); -WF_WRAP_VFUNC3(webfuse_test_MockJsonRpcProxy, void, wf_jsonrpc_proxy_vnotify, - struct wf_jsonrpc_proxy *, +WFP_WRAP_VFUNC3(webfuse_test_MockJsonRpcProxy, void, wfp_jsonrpc_proxy_vnotify, + struct wfp_jsonrpc_proxy *, char const *, char const *); } diff --git a/test/webfuse_provider/mocks/mock_jsonrpc_proxy.hpp b/test/webfuse_provider/mocks/mock_jsonrpc_proxy.hpp index 2c5b84c..2018573 100644 --- a/test/webfuse_provider/mocks/mock_jsonrpc_proxy.hpp +++ b/test/webfuse_provider/mocks/mock_jsonrpc_proxy.hpp @@ -12,14 +12,14 @@ class MockJsonRpcProxy public: MockJsonRpcProxy(); virtual ~MockJsonRpcProxy(); - MOCK_METHOD5(wf_jsonrpc_proxy_vinvoke, void ( - struct wf_jsonrpc_proxy * proxy, - wf_jsonrpc_proxy_finished_fn * finished, + MOCK_METHOD5(wfp_jsonrpc_proxy_vinvoke, void ( + struct wfp_jsonrpc_proxy * proxy, + wfp_jsonrpc_proxy_finished_fn * finished, void * user_data, char const * method_name, char const * param_info)); - MOCK_METHOD3(wf_jsonrpc_proxy_vnotify, void ( - struct wf_jsonrpc_proxy * proxy, + MOCK_METHOD3(wfp_jsonrpc_proxy_vnotify, void ( + struct wfp_jsonrpc_proxy * proxy, char const * method_name, char const * param_info)); diff --git a/test/webfuse_provider/mocks/mock_operation_context.cc b/test/webfuse_provider/mocks/mock_operation_context.cc index 781b077..d817cde 100644 --- a/test/webfuse_provider/mocks/mock_operation_context.cc +++ b/test/webfuse_provider/mocks/mock_operation_context.cc @@ -5,9 +5,9 @@ extern "C" { static webfuse_test::MockOperationContext * webfuse_test_MockOperationContext = nullptr; -WF_WRAP_FUNC1(webfuse_test_MockOperationContext, - struct wf_jsonrpc_proxy *, wf_impl_operation_context_get_proxy, - struct wf_impl_operation_context *); +WFP_WRAP_FUNC1(webfuse_test_MockOperationContext, + struct wfp_jsonrpc_proxy *, wfp_impl_operation_context_get_proxy, + struct wfp_impl_operation_context *); } diff --git a/test/webfuse_provider/mocks/mock_operation_context.hpp b/test/webfuse_provider/mocks/mock_operation_context.hpp index e692e76..3e5f60e 100644 --- a/test/webfuse_provider/mocks/mock_operation_context.hpp +++ b/test/webfuse_provider/mocks/mock_operation_context.hpp @@ -12,8 +12,8 @@ class MockOperationContext public: MockOperationContext(); virtual ~MockOperationContext(); - MOCK_METHOD1(wf_impl_operation_context_get_proxy, wf_jsonrpc_proxy * ( - struct wf_impl_operation_context * context)); + MOCK_METHOD1(wfp_impl_operation_context_get_proxy, wfp_jsonrpc_proxy * ( + struct wfp_impl_operation_context * context)); }; diff --git a/test/webfuse_provider/mocks/mock_provider.hpp b/test/webfuse_provider/mocks/mock_provider.hpp index d201ef2..7191847 100644 --- a/test/webfuse_provider/mocks/mock_provider.hpp +++ b/test/webfuse_provider/mocks/mock_provider.hpp @@ -1,5 +1,5 @@ -#ifndef WF_MOCK_PROVIDER_HPP -#define WF_MOCK_PROVIDER_HPP +#ifndef WFP_MOCK_PROVIDER_HPP +#define WFP_MOCK_PROVIDER_HPP #include "webfuse_provider/impl/provider.h" #include diff --git a/test/webfuse_provider/mocks/mock_provider_client.cc b/test/webfuse_provider/mocks/mock_provider_client.cc index bb138e5..7a602de 100644 --- a/test/webfuse_provider/mocks/mock_provider_client.cc +++ b/test/webfuse_provider/mocks/mock_provider_client.cc @@ -41,7 +41,7 @@ static void webfuse_test_iproviderclient_onlookup( } catch (...) { - wfp_respond_error(request, WF_BAD); + wfp_respond_error(request, WFP_BAD); } } @@ -65,7 +65,7 @@ static void webfuse_test_iproviderclient_ongetattr( } catch (...) { - wfp_respond_error(request, WF_BAD); + wfp_respond_error(request, WFP_BAD); } } @@ -89,7 +89,7 @@ static void webfuse_test_iproviderclient_onreaddir( } catch (...) { - wfp_respond_error(request, WF_BAD); + wfp_respond_error(request, WFP_BAD); } wfp_dirbuffer_dispose(buffer); @@ -116,7 +116,7 @@ static void webfuse_test_iproviderclient_onopen( } catch (...) { - wfp_respond_error(request, WF_BAD); + wfp_respond_error(request, WFP_BAD); } } @@ -154,7 +154,7 @@ static void webfuse_test_iproviderclient_onread( } catch (...) { - wfp_respond_error(request, WF_BAD); + wfp_respond_error(request, WFP_BAD); } delete[] data; @@ -181,14 +181,14 @@ static void webfuse_test_iproviderclient_get_credentials( namespace webfuse_test { -ProviderClientException::ProviderClientException(wf_status error_code) +ProviderClientException::ProviderClientException(wfp_status error_code) : runtime_error("ProviderClientException") , error_code_(error_code) { } -wf_status ProviderClientException::GetErrorCode() +wfp_status ProviderClientException::GetErrorCode() { return error_code_; } diff --git a/test/webfuse_provider/mocks/mock_provider_client.hpp b/test/webfuse_provider/mocks/mock_provider_client.hpp index 06caa6b..e4d83a9 100644 --- a/test/webfuse_provider/mocks/mock_provider_client.hpp +++ b/test/webfuse_provider/mocks/mock_provider_client.hpp @@ -1,5 +1,5 @@ -#ifndef WF_MOCK_PROVIDER_CLIENT_HPP -#define WF_MOCK_PROVIDER_CLIENT_HPP +#ifndef WFP_MOCK_PROVIDER_CLIENT_HPP +#define WFP_MOCK_PROVIDER_CLIENT_HPP #include #include "webfuse_provider/client_config.h" @@ -11,10 +11,10 @@ namespace webfuse_test class ProviderClientException: public std::runtime_error { public: - explicit ProviderClientException(wf_status error_code); - wf_status GetErrorCode(); + explicit ProviderClientException(wfp_status error_code); + wfp_status GetErrorCode(); private: - wf_status error_code_; + wfp_status error_code_; }; class IProviderClient diff --git a/test/webfuse_provider/mocks/mock_request.hpp b/test/webfuse_provider/mocks/mock_request.hpp index 5c517c9..eb25d3e 100644 --- a/test/webfuse_provider/mocks/mock_request.hpp +++ b/test/webfuse_provider/mocks/mock_request.hpp @@ -1,5 +1,5 @@ -#ifndef WF_MOCK_REQUEST_HPP -#define WF_MOCK_REQUEST_HPP +#ifndef WFP_MOCK_REQUEST_HPP +#define WFP_MOCK_REQUEST_HPP #include #include diff --git a/test/webfuse_provider/tests/core/jsonrpc/mock_timer.cc b/test/webfuse_provider/tests/core/jsonrpc/mock_timer.cc index 0af9372..45733f8 100644 --- a/test/webfuse_provider/tests/core/jsonrpc/mock_timer.cc +++ b/test/webfuse_provider/tests/core/jsonrpc/mock_timer.cc @@ -3,29 +3,29 @@ extern "C" { -static wf_jsonrpc_test::ITimer * wf_jsonrpc_MockTimer = nullptr; +static wfp_jsonrpc_test::ITimer * wfp_jsonrpc_MockTimer = nullptr; -WF_WRAP_FUNC0(wf_jsonrpc_MockTimer, wf_timer_manager *, wf_timer_manager_create); -WF_WRAP_FUNC1(wf_jsonrpc_MockTimer, void, wf_timer_manager_dispose, wf_timer_manager *); -WF_WRAP_FUNC1(wf_jsonrpc_MockTimer, void, wf_timer_manager_check, wf_timer_manager *); +WFP_WRAP_FUNC0(wfp_jsonrpc_MockTimer, wfp_timer_manager *, wfp_timer_manager_create); +WFP_WRAP_FUNC1(wfp_jsonrpc_MockTimer, void, wfp_timer_manager_dispose, wfp_timer_manager *); +WFP_WRAP_FUNC1(wfp_jsonrpc_MockTimer, void, wfp_timer_manager_check, wfp_timer_manager *); -WF_WRAP_FUNC3(wf_jsonrpc_MockTimer, wf_timer *, wf_timer_create, wf_timer_manager *, wf_timer_on_timer_fn *, void *); -WF_WRAP_FUNC1(wf_jsonrpc_MockTimer, void, wf_timer_dispose, wf_timer *); -WF_WRAP_FUNC2(wf_jsonrpc_MockTimer, void, wf_timer_start, wf_timer *, int); -WF_WRAP_FUNC1(wf_jsonrpc_MockTimer, void, wf_timer_cancel, wf_timer *); +WFP_WRAP_FUNC3(wfp_jsonrpc_MockTimer, wfp_timer *, wfp_timer_create, wfp_timer_manager *, wfp_timer_on_timer_fn *, void *); +WFP_WRAP_FUNC1(wfp_jsonrpc_MockTimer, void, wfp_timer_dispose, wfp_timer *); +WFP_WRAP_FUNC2(wfp_jsonrpc_MockTimer, void, wfp_timer_start, wfp_timer *, int); +WFP_WRAP_FUNC1(wfp_jsonrpc_MockTimer, void, wfp_timer_cancel, wfp_timer *); } -namespace wf_jsonrpc_test +namespace wfp_jsonrpc_test { MockTimer::MockTimer() { - wf_jsonrpc_MockTimer = this; + wfp_jsonrpc_MockTimer = this; } MockTimer::~MockTimer() { - wf_jsonrpc_MockTimer = nullptr; + wfp_jsonrpc_MockTimer = nullptr; } } \ No newline at end of file diff --git a/test/webfuse_provider/tests/core/jsonrpc/mock_timer.hpp b/test/webfuse_provider/tests/core/jsonrpc/mock_timer.hpp index 5e1753f..3e002ed 100644 --- a/test/webfuse_provider/tests/core/jsonrpc/mock_timer.hpp +++ b/test/webfuse_provider/tests/core/jsonrpc/mock_timer.hpp @@ -1,27 +1,27 @@ -#ifndef WF_JSONRPC_MOCK_TIMERMANAGER_HPP -#define WF_JSONRPC_MOCK_TIMERMANAGER_HPP +#ifndef WFP_JSONRPC_MOCK_TIMERMANAGER_HPP +#define WFP_JSONRPC_MOCK_TIMERMANAGER_HPP #include "webfuse_provider/impl/timer/timer.h" #include "webfuse_provider/impl/timer/manager.h" #include -namespace wf_jsonrpc_test +namespace wfp_jsonrpc_test { class ITimer { public: virtual ~ITimer() = default; - virtual wf_timer_manager * wf_timer_manager_create() = 0; - virtual void wf_timer_manager_dispose(wf_timer_manager * manager) = 0; - virtual void wf_timer_manager_check(wf_timer_manager * manager) = 0; - virtual wf_timer * wf_timer_create( - wf_timer_manager * manager, - wf_timer_on_timer_fn * on_timer, + virtual wfp_timer_manager * wfp_timer_manager_create() = 0; + virtual void wfp_timer_manager_dispose(wfp_timer_manager * manager) = 0; + virtual void wfp_timer_manager_check(wfp_timer_manager * manager) = 0; + virtual wfp_timer * wfp_timer_create( + wfp_timer_manager * manager, + wfp_timer_on_timer_fn * on_timer, void * user_data) = 0; - virtual void wf_timer_dispose(wf_timer * timer) = 0; - virtual void wf_timer_start(wf_timer * timer, int timeout_ms) = 0; - virtual void wf_timer_cancel(wf_timer * timer) = 0; + virtual void wfp_timer_dispose(wfp_timer * timer) = 0; + virtual void wfp_timer_start(wfp_timer * timer, int timeout_ms) = 0; + virtual void wfp_timer_cancel(wfp_timer * timer) = 0; }; class MockTimer: public ITimer @@ -29,16 +29,16 @@ class MockTimer: public ITimer public: MockTimer(); ~MockTimer() override; - MOCK_METHOD0(wf_timer_manager_create, wf_timer_manager * ()); - MOCK_METHOD1(wf_timer_manager_dispose, void(wf_timer_manager * manager)); - MOCK_METHOD1(wf_timer_manager_check, void (wf_timer_manager * manager)); - MOCK_METHOD3(wf_timer_create, wf_timer *( - wf_timer_manager * manager, - wf_timer_on_timer_fn * on_timer, + MOCK_METHOD0(wfp_timer_manager_create, wfp_timer_manager * ()); + MOCK_METHOD1(wfp_timer_manager_dispose, void(wfp_timer_manager * manager)); + MOCK_METHOD1(wfp_timer_manager_check, void (wfp_timer_manager * manager)); + MOCK_METHOD3(wfp_timer_create, wfp_timer *( + wfp_timer_manager * manager, + wfp_timer_on_timer_fn * on_timer, void * user_data)); - MOCK_METHOD1(wf_timer_dispose, void (wf_timer * timer)); - MOCK_METHOD2(wf_timer_start, void (wf_timer * timer, int timeout_ms)); - MOCK_METHOD1(wf_timer_cancel, void (wf_timer * timer)); + MOCK_METHOD1(wfp_timer_dispose, void (wfp_timer * timer)); + MOCK_METHOD2(wfp_timer_start, void (wfp_timer * timer, int timeout_ms)); + MOCK_METHOD1(wfp_timer_cancel, void (wfp_timer * timer)); }; diff --git a/test/webfuse_provider/tests/core/jsonrpc/mock_timer_callback.cc b/test/webfuse_provider/tests/core/jsonrpc/mock_timer_callback.cc index d6709ca..96cf965 100644 --- a/test/webfuse_provider/tests/core/jsonrpc/mock_timer_callback.cc +++ b/test/webfuse_provider/tests/core/jsonrpc/mock_timer_callback.cc @@ -2,10 +2,10 @@ extern "C" { -using wf_jsonrpc_test::MockTimerCallback; +using wfp_jsonrpc_test::MockTimerCallback; -static void wf_jsonrpc_test_MockTimerCallback_on_timer( - wf_timer * timer, +static void wfp_jsonrpc_test_MockTimerCallback_on_timer( + wfp_timer * timer, void * user_data) { auto * self = reinterpret_cast(user_data); @@ -14,7 +14,7 @@ static void wf_jsonrpc_test_MockTimerCallback_on_timer( } -namespace wf_jsonrpc_test +namespace wfp_jsonrpc_test { MockTimerCallback::MockTimerCallback() @@ -27,9 +27,9 @@ MockTimerCallback::~MockTimerCallback() } -wf_timer_on_timer_fn * MockTimerCallback::on_timer_fn() +wfp_timer_on_timer_fn * MockTimerCallback::on_timer_fn() { - return &wf_jsonrpc_test_MockTimerCallback_on_timer; + return &wfp_jsonrpc_test_MockTimerCallback_on_timer; } void * MockTimerCallback::user_data() diff --git a/test/webfuse_provider/tests/core/jsonrpc/mock_timer_callback.hpp b/test/webfuse_provider/tests/core/jsonrpc/mock_timer_callback.hpp index ef8fc72..3dade79 100644 --- a/test/webfuse_provider/tests/core/jsonrpc/mock_timer_callback.hpp +++ b/test/webfuse_provider/tests/core/jsonrpc/mock_timer_callback.hpp @@ -1,20 +1,20 @@ -#ifndef WF_JSONRPC_MOCK_TIMERCALLBACK_HPP -#define WF_JSONRPC_MOCK_TIMERCALLBACK_HPP +#ifndef WFP_JSONRPC_MOCK_TIMERCALLBACK_HPP +#define WFP_JSONRPC_MOCK_TIMERCALLBACK_HPP #include "webfuse_provider/impl/timer/on_timer_fn.h" #include -namespace wf_jsonrpc_test +namespace wfp_jsonrpc_test { class MockTimerCallback { public: MockTimerCallback(); virtual ~MockTimerCallback(); - wf_timer_on_timer_fn * on_timer_fn(); + wfp_timer_on_timer_fn * on_timer_fn(); void * user_data(); - MOCK_METHOD2(on_timer, void (wf_timer * timer, void * user_data)); + MOCK_METHOD2(on_timer, void (wfp_timer * timer, void * user_data)); }; diff --git a/test/webfuse_provider/tests/core/jsonrpc/test_is_request.cc b/test/webfuse_provider/tests/core/jsonrpc/test_is_request.cc index 2a3636d..945ec04 100644 --- a/test/webfuse_provider/tests/core/jsonrpc/test_is_request.cc +++ b/test/webfuse_provider/tests/core/jsonrpc/test_is_request.cc @@ -1,112 +1,112 @@ #include #include "webfuse_provider/impl/jsonrpc/request.h" -TEST(wf_jsonrpc_is_request, request_with_object_params) +TEST(wfp_jsonrpc_is_request, request_with_object_params) { json_t * request = json_object(); json_object_set_new(request, "method", json_string("method")); json_object_set_new(request, "params", json_object()); json_object_set_new(request, "id", json_integer(42)); - ASSERT_TRUE(wf_jsonrpc_is_request(request)); + ASSERT_TRUE(wfp_jsonrpc_is_request(request)); json_decref(request); } -TEST(wf_jsonrpc_is_request, request_with_array_params) +TEST(wfp_jsonrpc_is_request, request_with_array_params) { json_t * request = json_object(); json_object_set_new(request, "method", json_string("method")); json_object_set_new(request, "params", json_array()); json_object_set_new(request, "id", json_integer(42)); - ASSERT_TRUE(wf_jsonrpc_is_request(request)); + ASSERT_TRUE(wfp_jsonrpc_is_request(request)); json_decref(request); } -TEST(wf_jsonrpc_is_request, null_request) +TEST(wfp_jsonrpc_is_request, null_request) { - ASSERT_FALSE(wf_jsonrpc_is_request(nullptr)); + ASSERT_FALSE(wfp_jsonrpc_is_request(nullptr)); } -TEST(wf_jsonrpc_is_request, invalid_request) +TEST(wfp_jsonrpc_is_request, invalid_request) { json_t * request = json_array(); json_array_append_new(request, json_string("method")); json_array_append_new(request, json_object()); json_array_append_new(request, json_integer(42)); - ASSERT_FALSE(wf_jsonrpc_is_request(request)); + ASSERT_FALSE(wfp_jsonrpc_is_request(request)); json_decref(request); } -TEST(wf_jsonrpc_is_request, invalid_request_without_id) +TEST(wfp_jsonrpc_is_request, invalid_request_without_id) { json_t * request = json_object(); json_object_set_new(request, "method", json_string("method")); json_object_set_new(request, "params", json_object()); - ASSERT_FALSE(wf_jsonrpc_is_request(request)); + ASSERT_FALSE(wfp_jsonrpc_is_request(request)); json_decref(request); } -TEST(wf_jsonrpc_is_request, invalid_request_due_to_invalid_id) +TEST(wfp_jsonrpc_is_request, invalid_request_due_to_invalid_id) { json_t * request = json_object(); json_object_set_new(request, "method", json_string("method")); json_object_set_new(request, "params", json_object()); json_object_set_new(request, "id", json_string("42")); - ASSERT_FALSE(wf_jsonrpc_is_request(request)); + ASSERT_FALSE(wfp_jsonrpc_is_request(request)); json_decref(request); } -TEST(wf_jsonrpc_is_request, invalid_request_without_method) +TEST(wfp_jsonrpc_is_request, invalid_request_without_method) { json_t * request = json_object(); json_object_set_new(request, "params", json_object()); json_object_set_new(request, "id", json_integer(42)); - ASSERT_FALSE(wf_jsonrpc_is_request(request)); + ASSERT_FALSE(wfp_jsonrpc_is_request(request)); json_decref(request); } -TEST(wf_jsonrpc_is_request, invalid_request_due_to_invalid_method) +TEST(wfp_jsonrpc_is_request, invalid_request_due_to_invalid_method) { json_t * request = json_object(); json_object_set_new(request, "method", json_integer(42)); json_object_set_new(request, "params", json_object()); json_object_set_new(request, "id", json_integer(42)); - ASSERT_FALSE(wf_jsonrpc_is_request(request)); + ASSERT_FALSE(wfp_jsonrpc_is_request(request)); json_decref(request); } -TEST(wf_jsonrpc_is_request, invalid_request_without_params) +TEST(wfp_jsonrpc_is_request, invalid_request_without_params) { json_t * request = json_object(); json_object_set_new(request, "method", json_string("method")); json_object_set_new(request, "id", json_integer(42)); - ASSERT_FALSE(wf_jsonrpc_is_request(request)); + ASSERT_FALSE(wfp_jsonrpc_is_request(request)); json_decref(request); } -TEST(wf_jsonrpc_is_request, invalid_request_due_to_invalid_params) +TEST(wfp_jsonrpc_is_request, invalid_request_due_to_invalid_params) { json_t * request = json_object(); json_object_set_new(request, "methdo", json_string("method")); json_object_set_new(request, "params", json_string("params")); json_object_set_new(request, "id", json_integer(42)); - ASSERT_FALSE(wf_jsonrpc_is_request(request)); + ASSERT_FALSE(wfp_jsonrpc_is_request(request)); json_decref(request); } diff --git a/test/webfuse_provider/tests/core/jsonrpc/test_is_response.cc b/test/webfuse_provider/tests/core/jsonrpc/test_is_response.cc index 914647a..856f350 100644 --- a/test/webfuse_provider/tests/core/jsonrpc/test_is_response.cc +++ b/test/webfuse_provider/tests/core/jsonrpc/test_is_response.cc @@ -1,94 +1,94 @@ #include #include "webfuse_provider/impl/jsonrpc/response.h" -TEST(wf_jsonrpc_is_response, valid_result) +TEST(wfp_jsonrpc_is_response, valid_result) { json_t * message = json_object(); json_object_set_new(message, "result", json_object()); json_object_set_new(message, "id", json_integer(42)); - ASSERT_TRUE(wf_jsonrpc_is_response(message)); + ASSERT_TRUE(wfp_jsonrpc_is_response(message)); json_decref(message); } -TEST(wf_jsonrpc_is_response, valid_result_string) +TEST(wfp_jsonrpc_is_response, valid_result_string) { json_t * message = json_object(); json_object_set_new(message, "result", json_string("also valid")); json_object_set_new(message, "id", json_integer(42)); - ASSERT_TRUE(wf_jsonrpc_is_response(message)); + ASSERT_TRUE(wfp_jsonrpc_is_response(message)); json_decref(message); } -TEST(wf_jsonrpc_is_response, valid_error) +TEST(wfp_jsonrpc_is_response, valid_error) { json_t * message = json_object(); json_object_set_new(message, "error", json_object()); json_object_set_new(message, "id", json_integer(42)); - ASSERT_TRUE(wf_jsonrpc_is_response(message)); + ASSERT_TRUE(wfp_jsonrpc_is_response(message)); json_decref(message); } -TEST(wf_jsonrpc_is_response, invalid_null) +TEST(wfp_jsonrpc_is_response, invalid_null) { - ASSERT_FALSE(wf_jsonrpc_is_response(nullptr)); + ASSERT_FALSE(wfp_jsonrpc_is_response(nullptr)); } -TEST(wf_jsonrpc_is_response, invalid_message) +TEST(wfp_jsonrpc_is_response, invalid_message) { json_t * message = json_array(); json_array_append_new(message, json_object()); json_array_append_new(message, json_integer(42)); - ASSERT_FALSE(wf_jsonrpc_is_response(message)); + ASSERT_FALSE(wfp_jsonrpc_is_response(message)); json_decref(message); } -TEST(wf_jsonrpc_is_response, invalid_missing_id) +TEST(wfp_jsonrpc_is_response, invalid_missing_id) { json_t * message = json_object(); json_object_set_new(message, "result", json_object()); - ASSERT_FALSE(wf_jsonrpc_is_response(message)); + ASSERT_FALSE(wfp_jsonrpc_is_response(message)); json_decref(message); } -TEST(wf_jsonrpc_is_response, invalid_id_wrong_type) +TEST(wfp_jsonrpc_is_response, invalid_id_wrong_type) { json_t * message = json_object(); json_object_set_new(message, "result", json_object()); json_object_set_new(message, "id", json_string("42")); - ASSERT_FALSE(wf_jsonrpc_is_response(message)); + ASSERT_FALSE(wfp_jsonrpc_is_response(message)); json_decref(message); } -TEST(wf_jsonrpc_is_response, invalid_missing_result_and_error) +TEST(wfp_jsonrpc_is_response, invalid_missing_result_and_error) { json_t * message = json_object(); json_object_set_new(message, "id", json_integer(42)); - ASSERT_FALSE(wf_jsonrpc_is_response(message)); + ASSERT_FALSE(wfp_jsonrpc_is_response(message)); json_decref(message); } -TEST(wf_jsonrpc_is_response, invalid_error_wrong_type) +TEST(wfp_jsonrpc_is_response, invalid_error_wrong_type) { json_t * message = json_object(); json_object_set_new(message, "error", json_array()); json_object_set_new(message, "id", json_integer(42)); - ASSERT_FALSE(wf_jsonrpc_is_response(message)); + ASSERT_FALSE(wfp_jsonrpc_is_response(message)); json_decref(message); } diff --git a/test/webfuse_provider/tests/core/jsonrpc/test_proxy.cc b/test/webfuse_provider/tests/core/jsonrpc/test_proxy.cc index 2449db3..5bfeb32 100644 --- a/test/webfuse_provider/tests/core/jsonrpc/test_proxy.cc +++ b/test/webfuse_provider/tests/core/jsonrpc/test_proxy.cc @@ -9,20 +9,20 @@ #include using namespace std::chrono_literals; -using wf_jsonrpc_test::MockTimer; +using wfp_jsonrpc_test::MockTimer; using testing::Return; using testing::_; using testing::DoAll; using testing::SaveArg; -#define WF_DEFAULT_TIMEOUT (10 * 1000) +#define WFP_DEFAULT_TIMEOUT (10 * 1000) namespace { int jsonrpc_get_status(json_t * error) { json_t * code = json_object_get(error, "code"); - return (json_is_integer(code)) ? json_integer_value(code) : WF_BAD_FORMAT; + return (json_is_integer(code)) ? json_integer_value(code) : WFP_BAD_FORMAT; } struct SendContext @@ -99,31 +99,31 @@ namespace } } -TEST(wf_jsonrpc_proxy, init) +TEST(wfp_jsonrpc_proxy, init) { - struct wf_timer_manager * timer_manager = wf_timer_manager_create(); + struct wfp_timer_manager * timer_manager = wfp_timer_manager_create(); SendContext context; void * user_data = reinterpret_cast(&context); - struct wf_jsonrpc_proxy * proxy = wf_jsonrpc_proxy_create(timer_manager, WF_DEFAULT_TIMEOUT, &jsonrpc_send, user_data); + struct wfp_jsonrpc_proxy * proxy = wfp_jsonrpc_proxy_create(timer_manager, WFP_DEFAULT_TIMEOUT, &jsonrpc_send, user_data); - wf_jsonrpc_proxy_dispose(proxy); - wf_timer_manager_dispose(timer_manager); + wfp_jsonrpc_proxy_dispose(proxy); + wfp_timer_manager_dispose(timer_manager); ASSERT_FALSE(context.is_called); } -TEST(wf_jsonrpc_proxy, invoke) +TEST(wfp_jsonrpc_proxy, invoke) { - struct wf_timer_manager * timer_manager = wf_timer_manager_create(); + struct wfp_timer_manager * timer_manager = wfp_timer_manager_create(); SendContext send_context; void * send_data = reinterpret_cast(&send_context); - struct wf_jsonrpc_proxy * proxy = wf_jsonrpc_proxy_create(timer_manager, WF_DEFAULT_TIMEOUT, &jsonrpc_send, send_data); + struct wfp_jsonrpc_proxy * proxy = wfp_jsonrpc_proxy_create(timer_manager, WFP_DEFAULT_TIMEOUT, &jsonrpc_send, send_data); FinishedContext finished_context; void * finished_data = reinterpret_cast(&finished_context); - wf_jsonrpc_proxy_invoke(proxy, &jsonrpc_finished, finished_data, "foo", "si", "bar", 42); + wfp_jsonrpc_proxy_invoke(proxy, &jsonrpc_finished, finished_data, "foo", "si", "bar", 42); ASSERT_TRUE(send_context.is_called); ASSERT_TRUE(json_is_object(send_context.response)); @@ -145,24 +145,24 @@ TEST(wf_jsonrpc_proxy, invoke) ASSERT_FALSE(finished_context.is_called); - wf_jsonrpc_proxy_dispose(proxy); - wf_timer_manager_dispose(timer_manager); + wfp_jsonrpc_proxy_dispose(proxy); + wfp_timer_manager_dispose(timer_manager); ASSERT_TRUE(finished_context.is_called); ASSERT_FALSE(nullptr == finished_context.error); } -TEST(wf_jsonrpc_proxy, invoke_calls_finish_if_send_fails) +TEST(wfp_jsonrpc_proxy, invoke_calls_finish_if_send_fails) { - struct wf_timer_manager * timer_manager = wf_timer_manager_create(); + struct wfp_timer_manager * timer_manager = wfp_timer_manager_create(); SendContext send_context(false); void * send_data = reinterpret_cast(&send_context); - struct wf_jsonrpc_proxy * proxy = wf_jsonrpc_proxy_create(timer_manager, WF_DEFAULT_TIMEOUT, &jsonrpc_send, send_data); + struct wfp_jsonrpc_proxy * proxy = wfp_jsonrpc_proxy_create(timer_manager, WFP_DEFAULT_TIMEOUT, &jsonrpc_send, send_data); FinishedContext finished_context; void * finished_data = reinterpret_cast(&finished_context); - wf_jsonrpc_proxy_invoke(proxy, &jsonrpc_finished, finished_data, "foo", "si", "bar", 42); + wfp_jsonrpc_proxy_invoke(proxy, &jsonrpc_finished, finished_data, "foo", "si", "bar", 42); ASSERT_TRUE(send_context.is_called); ASSERT_TRUE(json_is_object(send_context.response)); @@ -170,25 +170,25 @@ TEST(wf_jsonrpc_proxy, invoke_calls_finish_if_send_fails) ASSERT_TRUE(finished_context.is_called); ASSERT_FALSE(nullptr == finished_context.error); - wf_jsonrpc_proxy_dispose(proxy); - wf_timer_manager_dispose(timer_manager); + wfp_jsonrpc_proxy_dispose(proxy); + wfp_timer_manager_dispose(timer_manager); } -TEST(wf_jsonrpc_proxy, invoke_fails_if_another_request_is_pending) +TEST(wfp_jsonrpc_proxy, invoke_fails_if_another_request_is_pending) { - struct wf_timer_manager * timer_manager = wf_timer_manager_create(); + struct wfp_timer_manager * timer_manager = wfp_timer_manager_create(); SendContext send_context; void * send_data = reinterpret_cast(&send_context); - struct wf_jsonrpc_proxy * proxy = wf_jsonrpc_proxy_create(timer_manager, WF_DEFAULT_TIMEOUT, &jsonrpc_send, send_data); + struct wfp_jsonrpc_proxy * proxy = wfp_jsonrpc_proxy_create(timer_manager, WFP_DEFAULT_TIMEOUT, &jsonrpc_send, send_data); FinishedContext finished_context; void * finished_data = reinterpret_cast(&finished_context); - wf_jsonrpc_proxy_invoke(proxy, &jsonrpc_finished, finished_data, "foo", "si", "bar", 42); + wfp_jsonrpc_proxy_invoke(proxy, &jsonrpc_finished, finished_data, "foo", "si", "bar", 42); FinishedContext finished_context2; void * finished_data2 = reinterpret_cast(&finished_context2); - wf_jsonrpc_proxy_invoke(proxy, &jsonrpc_finished, finished_data2, "foo", ""); + wfp_jsonrpc_proxy_invoke(proxy, &jsonrpc_finished, finished_data2, "foo", ""); ASSERT_TRUE(send_context.is_called); ASSERT_TRUE(json_is_object(send_context.response)); @@ -196,44 +196,44 @@ TEST(wf_jsonrpc_proxy, invoke_fails_if_another_request_is_pending) ASSERT_FALSE(finished_context.is_called); ASSERT_TRUE(finished_context2.is_called); - ASSERT_EQ(WF_BAD_BUSY, jsonrpc_get_status(finished_context2.error)); + ASSERT_EQ(WFP_BAD_BUSY, jsonrpc_get_status(finished_context2.error)); - wf_jsonrpc_proxy_dispose(proxy); - wf_timer_manager_dispose(timer_manager); + wfp_jsonrpc_proxy_dispose(proxy); + wfp_timer_manager_dispose(timer_manager); } -TEST(wf_jsonrpc_proxy, invoke_fails_if_request_is_invalid) +TEST(wfp_jsonrpc_proxy, invoke_fails_if_request_is_invalid) { - struct wf_timer_manager * timer_manager = wf_timer_manager_create(); + struct wfp_timer_manager * timer_manager = wfp_timer_manager_create(); SendContext send_context; void * send_data = reinterpret_cast(&send_context); - struct wf_jsonrpc_proxy * proxy = wf_jsonrpc_proxy_create(timer_manager, WF_DEFAULT_TIMEOUT, &jsonrpc_send, send_data); + struct wfp_jsonrpc_proxy * proxy = wfp_jsonrpc_proxy_create(timer_manager, WFP_DEFAULT_TIMEOUT, &jsonrpc_send, send_data); FinishedContext finished_context; void * finished_data = reinterpret_cast(&finished_context); - wf_jsonrpc_proxy_invoke(proxy, &jsonrpc_finished, finished_data, "foo", "?", "error"); + wfp_jsonrpc_proxy_invoke(proxy, &jsonrpc_finished, finished_data, "foo", "?", "error"); ASSERT_FALSE(send_context.is_called); ASSERT_TRUE(finished_context.is_called); - ASSERT_EQ(WF_BAD, jsonrpc_get_status(finished_context.error)); + ASSERT_EQ(WFP_BAD, jsonrpc_get_status(finished_context.error)); - wf_jsonrpc_proxy_dispose(proxy); - wf_timer_manager_dispose(timer_manager); + wfp_jsonrpc_proxy_dispose(proxy); + wfp_timer_manager_dispose(timer_manager); } -TEST(wf_jsonrpc_proxy, on_result) +TEST(wfp_jsonrpc_proxy, on_result) { - struct wf_timer_manager * timer_manager = wf_timer_manager_create(); + struct wfp_timer_manager * timer_manager = wfp_timer_manager_create(); SendContext send_context; void * send_data = reinterpret_cast(&send_context); - struct wf_jsonrpc_proxy * proxy = wf_jsonrpc_proxy_create(timer_manager, WF_DEFAULT_TIMEOUT, &jsonrpc_send, send_data); + struct wfp_jsonrpc_proxy * proxy = wfp_jsonrpc_proxy_create(timer_manager, WFP_DEFAULT_TIMEOUT, &jsonrpc_send, send_data); FinishedContext finished_context; void * finished_data = reinterpret_cast(&finished_context); - wf_jsonrpc_proxy_invoke(proxy, &jsonrpc_finished, finished_data, "foo", "si", "bar", 42); + wfp_jsonrpc_proxy_invoke(proxy, &jsonrpc_finished, finished_data, "foo", "si", "bar", 42); ASSERT_TRUE(send_context.is_called); ASSERT_TRUE(json_is_object(send_context.response)); @@ -245,7 +245,7 @@ TEST(wf_jsonrpc_proxy, on_result) json_object_set_new(response, "result", json_string("okay")); json_object_set(response, "id", id); - wf_jsonrpc_proxy_onresult(proxy, response); + wfp_jsonrpc_proxy_onresult(proxy, response); json_decref(response); ASSERT_TRUE(finished_context.is_called); @@ -253,21 +253,21 @@ TEST(wf_jsonrpc_proxy, on_result) ASSERT_TRUE(json_is_string(finished_context.result)); ASSERT_STREQ("okay", json_string_value(finished_context.result)); - wf_jsonrpc_proxy_dispose(proxy); - wf_timer_manager_dispose(timer_manager); + wfp_jsonrpc_proxy_dispose(proxy); + wfp_timer_manager_dispose(timer_manager); } -TEST(wf_jsonrpc_proxy, on_result_reject_response_with_unknown_id) +TEST(wfp_jsonrpc_proxy, on_result_reject_response_with_unknown_id) { - struct wf_timer_manager * timer_manager = wf_timer_manager_create(); + struct wfp_timer_manager * timer_manager = wfp_timer_manager_create(); SendContext send_context; void * send_data = reinterpret_cast(&send_context); - struct wf_jsonrpc_proxy * proxy = wf_jsonrpc_proxy_create(timer_manager, WF_DEFAULT_TIMEOUT, &jsonrpc_send, send_data); + struct wfp_jsonrpc_proxy * proxy = wfp_jsonrpc_proxy_create(timer_manager, WFP_DEFAULT_TIMEOUT, &jsonrpc_send, send_data); FinishedContext finished_context; void * finished_data = reinterpret_cast(&finished_context); - wf_jsonrpc_proxy_invoke(proxy, &jsonrpc_finished, finished_data, "foo", "si", "bar", 42); + wfp_jsonrpc_proxy_invoke(proxy, &jsonrpc_finished, finished_data, "foo", "si", "bar", 42); ASSERT_TRUE(send_context.is_called); ASSERT_TRUE(json_is_object(send_context.response)); @@ -279,75 +279,75 @@ TEST(wf_jsonrpc_proxy, on_result_reject_response_with_unknown_id) json_object_set_new(response, "result", json_string("okay")); json_object_set_new(response, "id", json_integer(1 + json_integer_value(id))); - wf_jsonrpc_proxy_onresult(proxy, response); + wfp_jsonrpc_proxy_onresult(proxy, response); json_decref(response); ASSERT_FALSE(finished_context.is_called); - wf_jsonrpc_proxy_dispose(proxy); - wf_timer_manager_dispose(timer_manager); + wfp_jsonrpc_proxy_dispose(proxy); + wfp_timer_manager_dispose(timer_manager); } -TEST(wf_jsonrpc_proxy, timeout) +TEST(wfp_jsonrpc_proxy, timeout) { - struct wf_timer_manager * timer_manager = wf_timer_manager_create(); + struct wfp_timer_manager * timer_manager = wfp_timer_manager_create(); SendContext send_context; void * send_data = reinterpret_cast(&send_context); - struct wf_jsonrpc_proxy * proxy = wf_jsonrpc_proxy_create(timer_manager, 0, &jsonrpc_send, send_data); + struct wfp_jsonrpc_proxy * proxy = wfp_jsonrpc_proxy_create(timer_manager, 0, &jsonrpc_send, send_data); FinishedContext finished_context; void * finished_data = reinterpret_cast(&finished_context); - wf_jsonrpc_proxy_invoke(proxy, &jsonrpc_finished, finished_data, "foo", "si", "bar", 42); + wfp_jsonrpc_proxy_invoke(proxy, &jsonrpc_finished, finished_data, "foo", "si", "bar", 42); ASSERT_TRUE(send_context.is_called); ASSERT_TRUE(json_is_object(send_context.response)); std::this_thread::sleep_for(10ms); - wf_timer_manager_check(timer_manager); + wfp_timer_manager_check(timer_manager); ASSERT_TRUE(finished_context.is_called); - ASSERT_EQ(WF_BAD_TIMEOUT, jsonrpc_get_status(finished_context.error)); + ASSERT_EQ(WFP_BAD_TIMEOUT, jsonrpc_get_status(finished_context.error)); - wf_jsonrpc_proxy_dispose(proxy); - wf_timer_manager_dispose(timer_manager); + wfp_jsonrpc_proxy_dispose(proxy); + wfp_timer_manager_dispose(timer_manager); } -TEST(wf_jsonrpc_proxy, cleanup_pending_request) +TEST(wfp_jsonrpc_proxy, cleanup_pending_request) { - struct wf_timer_manager * timer_manager = wf_timer_manager_create(); + struct wfp_timer_manager * timer_manager = wfp_timer_manager_create(); SendContext send_context; void * send_data = reinterpret_cast(&send_context); - struct wf_jsonrpc_proxy * proxy = wf_jsonrpc_proxy_create(timer_manager, 10, &jsonrpc_send, send_data); + struct wfp_jsonrpc_proxy * proxy = wfp_jsonrpc_proxy_create(timer_manager, 10, &jsonrpc_send, send_data); FinishedContext finished_context; void * finished_data = reinterpret_cast(&finished_context); - wf_jsonrpc_proxy_invoke(proxy, &jsonrpc_finished, finished_data, "foo", "si", "bar", 42); + wfp_jsonrpc_proxy_invoke(proxy, &jsonrpc_finished, finished_data, "foo", "si", "bar", 42); ASSERT_TRUE(send_context.is_called); ASSERT_TRUE(json_is_object(send_context.response)); ASSERT_FALSE(finished_context.is_called); - wf_jsonrpc_proxy_dispose(proxy); + wfp_jsonrpc_proxy_dispose(proxy); ASSERT_TRUE(finished_context.is_called); - wf_timer_manager_dispose(timer_manager); + wfp_timer_manager_dispose(timer_manager); } -TEST(wf_jsonrpc_proxy, notify) +TEST(wfp_jsonrpc_proxy, notify) { - struct wf_timer_manager * timer_manager = wf_timer_manager_create(); + struct wfp_timer_manager * timer_manager = wfp_timer_manager_create(); SendContext send_context; void * send_data = reinterpret_cast(&send_context); - struct wf_jsonrpc_proxy * proxy = wf_jsonrpc_proxy_create(timer_manager, WF_DEFAULT_TIMEOUT, &jsonrpc_send, send_data); + struct wfp_jsonrpc_proxy * proxy = wfp_jsonrpc_proxy_create(timer_manager, WFP_DEFAULT_TIMEOUT, &jsonrpc_send, send_data); - wf_jsonrpc_proxy_notify(proxy, "foo", "si", "bar", 42); + wfp_jsonrpc_proxy_notify(proxy, "foo", "si", "bar", 42); ASSERT_TRUE(send_context.is_called); ASSERT_TRUE(json_is_object(send_context.response)); @@ -367,64 +367,64 @@ TEST(wf_jsonrpc_proxy, notify) json_t * id = json_object_get(send_context.response, "id"); ASSERT_EQ(nullptr, id); - wf_jsonrpc_proxy_dispose(proxy); - wf_timer_manager_dispose(timer_manager); + wfp_jsonrpc_proxy_dispose(proxy); + wfp_timer_manager_dispose(timer_manager); } -TEST(wf_jsonrpc_proxy, notify_dont_send_invalid_request) +TEST(wfp_jsonrpc_proxy, notify_dont_send_invalid_request) { - struct wf_timer_manager * timer_manager = wf_timer_manager_create(); + struct wfp_timer_manager * timer_manager = wfp_timer_manager_create(); SendContext send_context; void * send_data = reinterpret_cast(&send_context); - struct wf_jsonrpc_proxy * proxy = wf_jsonrpc_proxy_create(timer_manager, WF_DEFAULT_TIMEOUT, &jsonrpc_send, send_data); + struct wfp_jsonrpc_proxy * proxy = wfp_jsonrpc_proxy_create(timer_manager, WFP_DEFAULT_TIMEOUT, &jsonrpc_send, send_data); - wf_jsonrpc_proxy_notify(proxy, "foo", "?"); + wfp_jsonrpc_proxy_notify(proxy, "foo", "?"); ASSERT_FALSE(send_context.is_called); - wf_jsonrpc_proxy_dispose(proxy); - wf_timer_manager_dispose(timer_manager); + wfp_jsonrpc_proxy_dispose(proxy); + wfp_timer_manager_dispose(timer_manager); } -TEST(wf_jsonrpc_proxy, swallow_timeout_if_no_request_pending) +TEST(wfp_jsonrpc_proxy, swallow_timeout_if_no_request_pending) { MockTimer timer_api; - wf_timer_on_timer_fn * on_timer = nullptr; + wfp_timer_on_timer_fn * on_timer = nullptr; void * timer_context = nullptr; - EXPECT_CALL(timer_api, wf_timer_create(_, _, _)) + EXPECT_CALL(timer_api, wfp_timer_create(_, _, _)) .Times(1) .WillOnce(DoAll(SaveArg<1>(&on_timer), SaveArg<2>(&timer_context), Return(nullptr))); - EXPECT_CALL(timer_api, wf_timer_dispose(_)).Times(1); + EXPECT_CALL(timer_api, wfp_timer_dispose(_)).Times(1); SendContext send_context; void * send_data = reinterpret_cast(&send_context); - struct wf_jsonrpc_proxy * proxy = wf_jsonrpc_proxy_create(nullptr, 1, &jsonrpc_send, send_data); + struct wfp_jsonrpc_proxy * proxy = wfp_jsonrpc_proxy_create(nullptr, 1, &jsonrpc_send, send_data); on_timer(nullptr, timer_context); ASSERT_FALSE(send_context.is_called); - wf_jsonrpc_proxy_dispose(proxy); + wfp_jsonrpc_proxy_dispose(proxy); } -TEST(wf_jsonrpc_proxy, on_result_swallow_if_no_request_pending) +TEST(wfp_jsonrpc_proxy, on_result_swallow_if_no_request_pending) { - struct wf_timer_manager * timer_manager = wf_timer_manager_create(); + struct wfp_timer_manager * timer_manager = wfp_timer_manager_create(); SendContext send_context; void * send_data = reinterpret_cast(&send_context); - struct wf_jsonrpc_proxy * proxy = wf_jsonrpc_proxy_create(timer_manager, WF_DEFAULT_TIMEOUT, &jsonrpc_send, send_data); + struct wfp_jsonrpc_proxy * proxy = wfp_jsonrpc_proxy_create(timer_manager, WFP_DEFAULT_TIMEOUT, &jsonrpc_send, send_data); json_t * response = json_object(); json_object_set_new(response, "result", json_string("okay")); json_object_set_new(response, "id", json_integer(42)); - wf_jsonrpc_proxy_onresult(proxy, response); + wfp_jsonrpc_proxy_onresult(proxy, response); json_decref(response); - wf_jsonrpc_proxy_dispose(proxy); - wf_timer_manager_dispose(timer_manager); + wfp_jsonrpc_proxy_dispose(proxy); + wfp_timer_manager_dispose(timer_manager); } diff --git a/test/webfuse_provider/tests/core/jsonrpc/test_request.cc b/test/webfuse_provider/tests/core/jsonrpc/test_request.cc index aaf5e25..5e8a66d 100644 --- a/test/webfuse_provider/tests/core/jsonrpc/test_request.cc +++ b/test/webfuse_provider/tests/core/jsonrpc/test_request.cc @@ -23,29 +23,29 @@ bool jsonrpc_send( } -TEST(wf_jsonrpc_request, create_dispose) +TEST(wfp_jsonrpc_request, create_dispose) { Context context{nullptr}; void * user_data = reinterpret_cast(&context); - struct wf_jsonrpc_request * request = - wf_jsonrpc_request_create(42, &jsonrpc_send, user_data); + struct wfp_jsonrpc_request * request = + wfp_jsonrpc_request_create(42, &jsonrpc_send, user_data); ASSERT_NE(nullptr, request); - ASSERT_EQ(user_data, wf_jsonrpc_request_get_userdata(request)); + ASSERT_EQ(user_data, wfp_jsonrpc_request_get_userdata(request)); - wf_jsonrpc_request_dispose(request); + wfp_jsonrpc_request_dispose(request); } -TEST(wf_jsonrpc_request, respond) +TEST(wfp_jsonrpc_request, respond) { Context context{nullptr}; void * user_data = reinterpret_cast(&context); - struct wf_jsonrpc_request * request = - wf_jsonrpc_request_create(42, &jsonrpc_send, user_data); + struct wfp_jsonrpc_request * request = + wfp_jsonrpc_request_create(42, &jsonrpc_send, user_data); - wf_jsonrpc_respond(request, json_string("okay")); + wfp_jsonrpc_respond(request, json_string("okay")); ASSERT_NE(nullptr, context.response); @@ -66,15 +66,15 @@ TEST(wf_jsonrpc_request, respond) json_decref(response); } -TEST(wf_jsonrpc_request, respond_error) +TEST(wfp_jsonrpc_request, respond_error) { Context context{nullptr}; void * user_data = reinterpret_cast(&context); - struct wf_jsonrpc_request * request = - wf_jsonrpc_request_create(42, &jsonrpc_send, user_data); + struct wfp_jsonrpc_request * request = + wfp_jsonrpc_request_create(42, &jsonrpc_send, user_data); - wf_jsonrpc_respond_error(request, WF_BAD, "Bad"); + wfp_jsonrpc_respond_error(request, WFP_BAD, "Bad"); ASSERT_NE(nullptr, context.response); @@ -93,7 +93,7 @@ TEST(wf_jsonrpc_request, respond_error) json_t * err_code = json_object_get(err, "code"); ASSERT_TRUE(json_is_integer(err_code)); - ASSERT_EQ(WF_BAD, json_integer_value(err_code)); + ASSERT_EQ(WFP_BAD, json_integer_value(err_code)); json_t * err_message = json_object_get(err, "message"); ASSERT_TRUE(json_is_string(err_message)); @@ -102,37 +102,37 @@ TEST(wf_jsonrpc_request, respond_error) json_decref(response); } -TEST(wf_jsonrpc_request, is_request_object_params) +TEST(wfp_jsonrpc_request, is_request_object_params) { json_t * request = json_object(); json_object_set_new(request, "method", json_string("some_method")); json_object_set_new(request, "params", json_object()); json_object_set_new(request, "id", json_integer(42)); - ASSERT_TRUE(wf_jsonrpc_is_request(request)); + ASSERT_TRUE(wfp_jsonrpc_is_request(request)); json_decref(request); } -TEST(wf_jsonrpc_request, is_request_fail_missing_params) +TEST(wfp_jsonrpc_request, is_request_fail_missing_params) { json_t * request = json_object(); json_object_set_new(request, "method", json_string("some_method")); json_object_set_new(request, "id", json_integer(42)); - ASSERT_FALSE(wf_jsonrpc_is_request(request)); + ASSERT_FALSE(wfp_jsonrpc_is_request(request)); json_decref(request); } -TEST(wf_jsonrpc_request, is_request_fail_params_wrong_type) +TEST(wfp_jsonrpc_request, is_request_fail_params_wrong_type) { json_t * request = json_object(); json_object_set_new(request, "method", json_string("some_method")); json_object_set_new(request, "params", json_string("invalid_params")); json_object_set_new(request, "id", json_integer(42)); - ASSERT_FALSE(wf_jsonrpc_is_request(request)); + ASSERT_FALSE(wfp_jsonrpc_is_request(request)); json_decref(request); } diff --git a/test/webfuse_provider/tests/core/jsonrpc/test_response.cc b/test/webfuse_provider/tests/core/jsonrpc/test_response.cc index 412893a..9ab7c31 100644 --- a/test/webfuse_provider/tests/core/jsonrpc/test_response.cc +++ b/test/webfuse_provider/tests/core/jsonrpc/test_response.cc @@ -2,25 +2,25 @@ #include "webfuse_provider/impl/jsonrpc/response_intern.h" #include "webfuse_provider/status.h" -TEST(wf_json_response, init_result) +TEST(wfp_json_response, init_result) { json_t * message = json_object(); json_object_set_new(message, "result", json_integer(47)); json_object_set_new(message, "id", json_integer(11)); - struct wf_jsonrpc_response response; - wf_jsonrpc_response_init(&response, message); + struct wfp_jsonrpc_response response; + wfp_jsonrpc_response_init(&response, message); ASSERT_EQ(nullptr, response.error); ASSERT_TRUE(json_is_integer(response.result)); ASSERT_EQ(47, json_integer_value(response.result)); ASSERT_EQ(11, response.id); - wf_jsonrpc_response_cleanup(&response); + wfp_jsonrpc_response_cleanup(&response); json_decref(message); } -TEST(wf_json_response, init_error) +TEST(wfp_json_response, init_error) { json_t * message = json_object(); json_t * err = json_object(); @@ -29,68 +29,68 @@ TEST(wf_json_response, init_error) json_object_set_new(message, "error", err); json_object_set_new(message, "id", json_integer(23)); - struct wf_jsonrpc_response response; - wf_jsonrpc_response_init(&response, message); + struct wfp_jsonrpc_response response; + wfp_jsonrpc_response_init(&response, message); ASSERT_EQ(42, json_integer_value(json_object_get(response.error, "code"))); ASSERT_STREQ("Don't Panic!", json_string_value(json_object_get(response.error, "message"))); ASSERT_EQ(nullptr, response.result); ASSERT_EQ(23, response.id); - wf_jsonrpc_response_cleanup(&response); + wfp_jsonrpc_response_cleanup(&response); json_decref(message); } -TEST(wf_json_response, init_fail_missing_result_and_error) +TEST(wfp_json_response, init_fail_missing_result_and_error) { json_t * message = json_object(); json_object_set_new(message, "id", json_integer(12)); - struct wf_jsonrpc_response response; - wf_jsonrpc_response_init(&response, message); + struct wfp_jsonrpc_response response; + wfp_jsonrpc_response_init(&response, message); - ASSERT_EQ(WF_BAD_FORMAT, json_integer_value(json_object_get(response.error, "code"))); + ASSERT_EQ(WFP_BAD_FORMAT, json_integer_value(json_object_get(response.error, "code"))); ASSERT_EQ(nullptr, response.result); ASSERT_EQ(12, response.id); - wf_jsonrpc_response_cleanup(&response); + wfp_jsonrpc_response_cleanup(&response); json_decref(message); } -TEST(wf_json_response, init_fail_missing_id) +TEST(wfp_json_response, init_fail_missing_id) { json_t * message = json_object(); json_object_set_new(message, "result", json_integer(47)); - struct wf_jsonrpc_response response; - wf_jsonrpc_response_init(&response, message); + struct wfp_jsonrpc_response response; + wfp_jsonrpc_response_init(&response, message); - ASSERT_EQ(WF_BAD_FORMAT, json_integer_value(json_object_get(response.error, "code"))); + ASSERT_EQ(WFP_BAD_FORMAT, json_integer_value(json_object_get(response.error, "code"))); ASSERT_EQ(nullptr, response.result); ASSERT_EQ(-1, response.id); - wf_jsonrpc_response_cleanup(&response); + wfp_jsonrpc_response_cleanup(&response); json_decref(message); } -TEST(wf_json_response, init_fail_wrong_id_type) +TEST(wfp_json_response, init_fail_wrong_id_type) { json_t * message = json_object(); json_object_set_new(message, "result", json_integer(47)); json_object_set_new(message, "id", json_string("42")); - struct wf_jsonrpc_response response; - wf_jsonrpc_response_init(&response, message); + struct wfp_jsonrpc_response response; + wfp_jsonrpc_response_init(&response, message); - ASSERT_EQ(WF_BAD_FORMAT, json_integer_value(json_object_get(response.error, "code"))); + ASSERT_EQ(WFP_BAD_FORMAT, json_integer_value(json_object_get(response.error, "code"))); ASSERT_EQ(nullptr, response.result); ASSERT_EQ(-1, response.id); - wf_jsonrpc_response_cleanup(&response); + wfp_jsonrpc_response_cleanup(&response); json_decref(message); } -TEST(wf_json_response, init_fail_error_missing_code) +TEST(wfp_json_response, init_fail_error_missing_code) { json_t * message = json_object(); json_t * err = json_object(); @@ -98,18 +98,18 @@ TEST(wf_json_response, init_fail_error_missing_code) json_object_set_new(message, "error", err); json_object_set_new(message, "id", json_integer(23)); - struct wf_jsonrpc_response response; - wf_jsonrpc_response_init(&response, message); + struct wfp_jsonrpc_response response; + wfp_jsonrpc_response_init(&response, message); - ASSERT_EQ(WF_BAD_FORMAT, json_integer_value(json_object_get(response.error, "code"))); + ASSERT_EQ(WFP_BAD_FORMAT, json_integer_value(json_object_get(response.error, "code"))); ASSERT_EQ(nullptr, response.result); ASSERT_EQ(23, response.id); - wf_jsonrpc_response_cleanup(&response); + wfp_jsonrpc_response_cleanup(&response); json_decref(message); } -TEST(wf_json_response, init_fail_error_wrong_code_type) +TEST(wfp_json_response, init_fail_error_wrong_code_type) { json_t * message = json_object(); json_t * err = json_object(); @@ -118,30 +118,30 @@ TEST(wf_json_response, init_fail_error_wrong_code_type) json_object_set_new(message, "error", err); json_object_set_new(message, "id", json_integer(23)); - struct wf_jsonrpc_response response; - wf_jsonrpc_response_init(&response, message); + struct wfp_jsonrpc_response response; + wfp_jsonrpc_response_init(&response, message); - ASSERT_EQ(WF_BAD_FORMAT, json_integer_value(json_object_get(response.error, "code"))); + ASSERT_EQ(WFP_BAD_FORMAT, json_integer_value(json_object_get(response.error, "code"))); ASSERT_EQ(nullptr, response.result); ASSERT_EQ(23, response.id); - wf_jsonrpc_response_cleanup(&response); + wfp_jsonrpc_response_cleanup(&response); json_decref(message); } -TEST(wf_json_response, init_fail_error_wrong_type) +TEST(wfp_json_response, init_fail_error_wrong_type) { json_t * message = json_object(); json_object_set_new(message, "error", json_string("invalid error type")); json_object_set_new(message, "id", json_integer(23)); - struct wf_jsonrpc_response response; - wf_jsonrpc_response_init(&response, message); + struct wfp_jsonrpc_response response; + wfp_jsonrpc_response_init(&response, message); - ASSERT_EQ(WF_BAD_FORMAT, json_integer_value(json_object_get(response.error, "code"))); + ASSERT_EQ(WFP_BAD_FORMAT, json_integer_value(json_object_get(response.error, "code"))); ASSERT_EQ(nullptr, response.result); ASSERT_EQ(23, response.id); - wf_jsonrpc_response_cleanup(&response); + wfp_jsonrpc_response_cleanup(&response); json_decref(message); } diff --git a/test/webfuse_provider/tests/core/jsonrpc/test_response_parser.cc b/test/webfuse_provider/tests/core/jsonrpc/test_response_parser.cc index f7c92be..69a2e43 100644 --- a/test/webfuse_provider/tests/core/jsonrpc/test_response_parser.cc +++ b/test/webfuse_provider/tests/core/jsonrpc/test_response_parser.cc @@ -6,40 +6,40 @@ static void response_parse_str( std::string const & buffer, - struct wf_jsonrpc_response * response) + struct wfp_jsonrpc_response * response) { json_t * message = json_loadb(buffer.c_str(), buffer.size(), 0, nullptr); if (nullptr != message) { - wf_jsonrpc_response_init(response, message); + wfp_jsonrpc_response_init(response, message); json_decref(message); } } TEST(response_parser, test) { - struct wf_jsonrpc_response response; + struct wfp_jsonrpc_response response; // no object response_parse_str("[]", &response); ASSERT_NE(nullptr, response.error); ASSERT_EQ(-1, response.id); ASSERT_EQ(nullptr, response.result); - wf_jsonrpc_response_cleanup(&response); + wfp_jsonrpc_response_cleanup(&response); // empty response_parse_str("{}", &response); ASSERT_NE(nullptr, response.error); ASSERT_EQ(-1, response.id); ASSERT_EQ(nullptr, response.result); - wf_jsonrpc_response_cleanup(&response); + wfp_jsonrpc_response_cleanup(&response); // no data response_parse_str("{\"id\":42}", &response); ASSERT_NE(nullptr, response.error); ASSERT_EQ(42, response.id); ASSERT_EQ(nullptr, response.result); - wf_jsonrpc_response_cleanup(&response); + wfp_jsonrpc_response_cleanup(&response); // custom error code response_parse_str("{\"error\":{\"code\": 42}, \"id\": 42}", &response); @@ -47,12 +47,12 @@ TEST(response_parser, test) ASSERT_EQ(42, json_integer_value(json_object_get(response.error, "code"))); ASSERT_EQ(42, response.id); ASSERT_EQ(nullptr, response.result); - wf_jsonrpc_response_cleanup(&response); + wfp_jsonrpc_response_cleanup(&response); // valid response response_parse_str("{\"result\": true, \"id\": 42}", &response); ASSERT_EQ(nullptr, response.error); ASSERT_EQ(42, response.id); ASSERT_NE(nullptr, response.result); - wf_jsonrpc_response_cleanup(&response); + wfp_jsonrpc_response_cleanup(&response); } diff --git a/test/webfuse_provider/tests/core/jsonrpc/test_server.cc b/test/webfuse_provider/tests/core/jsonrpc/test_server.cc index e264672..dc6e93b 100644 --- a/test/webfuse_provider/tests/core/jsonrpc/test_server.cc +++ b/test/webfuse_provider/tests/core/jsonrpc/test_server.cc @@ -24,7 +24,7 @@ namespace } void sayHello( - struct wf_jsonrpc_request * request, + struct wfp_jsonrpc_request * request, char const * method_name, json_t * params, void * user_data) @@ -34,15 +34,15 @@ namespace (void) user_data; json_t * result = json_string("Hello"); - wf_jsonrpc_respond(request, result); + wfp_jsonrpc_respond(request, result); } } -TEST(wf_jsonrpc_server, process_request) +TEST(wfp_jsonrpc_server, process_request) { - struct wf_jsonrpc_server * server = wf_jsonrpc_server_create(); - wf_jsonrpc_server_add(server, "sayHello", &sayHello, nullptr); + struct wfp_jsonrpc_server * server = wfp_jsonrpc_server_create(); + wfp_jsonrpc_server_add(server, "sayHello", &sayHello, nullptr); Context context{nullptr, false}; void * user_data = reinterpret_cast(&context); @@ -50,7 +50,7 @@ TEST(wf_jsonrpc_server, process_request) json_object_set_new(request, "method", json_string("sayHello")); json_object_set_new(request, "params", json_array()); json_object_set_new(request, "id", json_integer(23)); - wf_jsonrpc_server_process(server, request, &jsonrpc_send, user_data); + wfp_jsonrpc_server_process(server, request, &jsonrpc_send, user_data); ASSERT_TRUE(context.is_called); ASSERT_NE(nullptr, context.response); @@ -66,13 +66,13 @@ TEST(wf_jsonrpc_server, process_request) json_decref(context.response); json_decref(request); - wf_jsonrpc_server_dispose(server); + wfp_jsonrpc_server_dispose(server); } -TEST(wf_jsonrpc_server, process_request_with_oject_params) +TEST(wfp_jsonrpc_server, process_request_with_oject_params) { - struct wf_jsonrpc_server * server = wf_jsonrpc_server_create(); - wf_jsonrpc_server_add(server, "sayHello", &sayHello, nullptr); + struct wfp_jsonrpc_server * server = wfp_jsonrpc_server_create(); + wfp_jsonrpc_server_add(server, "sayHello", &sayHello, nullptr); Context context{nullptr, false}; void * user_data = reinterpret_cast(&context); @@ -80,7 +80,7 @@ TEST(wf_jsonrpc_server, process_request_with_oject_params) json_object_set_new(request, "method", json_string("sayHello")); json_object_set_new(request, "params", json_object()); json_object_set_new(request, "id", json_integer(23)); - wf_jsonrpc_server_process(server, request, &jsonrpc_send, user_data); + wfp_jsonrpc_server_process(server, request, &jsonrpc_send, user_data); ASSERT_TRUE(context.is_called); ASSERT_NE(nullptr, context.response); @@ -96,13 +96,13 @@ TEST(wf_jsonrpc_server, process_request_with_oject_params) json_decref(context.response); json_decref(request); - wf_jsonrpc_server_dispose(server); + wfp_jsonrpc_server_dispose(server); } -TEST(wf_jsonrpc_server, invoke_unknown_method) +TEST(wfp_jsonrpc_server, invoke_unknown_method) { - struct wf_jsonrpc_server * server = wf_jsonrpc_server_create(); - wf_jsonrpc_server_add(server, "sayHello", &sayHello, nullptr); + struct wfp_jsonrpc_server * server = wfp_jsonrpc_server_create(); + wfp_jsonrpc_server_add(server, "sayHello", &sayHello, nullptr); Context context{nullptr, false}; void * user_data = reinterpret_cast(&context); @@ -110,7 +110,7 @@ TEST(wf_jsonrpc_server, invoke_unknown_method) json_object_set_new(request, "method", json_string("greet")); json_object_set_new(request, "params", json_array()); json_object_set_new(request, "id", json_integer(42)); - wf_jsonrpc_server_process(server, request, &jsonrpc_send, user_data); + wfp_jsonrpc_server_process(server, request, &jsonrpc_send, user_data); ASSERT_TRUE(context.is_called); ASSERT_NE(nullptr, context.response); @@ -125,36 +125,36 @@ TEST(wf_jsonrpc_server, invoke_unknown_method) json_t * err_code = json_object_get(err, "code"); ASSERT_TRUE(json_is_integer(err_code)); - ASSERT_EQ(WF_BAD_NOTIMPLEMENTED, json_integer_value(err_code)); + ASSERT_EQ(WFP_BAD_NOTIMPLEMENTED, json_integer_value(err_code)); json_t * err_message = json_object_get(err, "message"); ASSERT_TRUE(json_is_string(err_message)); json_decref(context.response); json_decref(request); - wf_jsonrpc_server_dispose(server); + wfp_jsonrpc_server_dispose(server); } -TEST(wf_jsonrpc_server, skip_invalid_request_missing_id) +TEST(wfp_jsonrpc_server, skip_invalid_request_missing_id) { - struct wf_jsonrpc_server * server = wf_jsonrpc_server_create(); + struct wfp_jsonrpc_server * server = wfp_jsonrpc_server_create(); Context context{nullptr, false}; void * user_data = reinterpret_cast(&context); json_t * request = json_object(); json_object_set_new(request, "method", json_string("sayHello")); json_object_set_new(request, "params", json_array()); - wf_jsonrpc_server_process(server, request, &jsonrpc_send, user_data); + wfp_jsonrpc_server_process(server, request, &jsonrpc_send, user_data); ASSERT_FALSE(context.is_called); json_decref(request); - wf_jsonrpc_server_dispose(server); + wfp_jsonrpc_server_dispose(server); } -TEST(wf_jsonrpc_server, skip_invalid_request_wrong_id_type) +TEST(wfp_jsonrpc_server, skip_invalid_request_wrong_id_type) { - struct wf_jsonrpc_server * server = wf_jsonrpc_server_create(); + struct wfp_jsonrpc_server * server = wfp_jsonrpc_server_create(); Context context{nullptr, false}; void * user_data = reinterpret_cast(&context); @@ -162,34 +162,34 @@ TEST(wf_jsonrpc_server, skip_invalid_request_wrong_id_type) json_object_set_new(request, "method", json_string("sayHello")); json_object_set_new(request, "params", json_array()); json_object_set_new(request, "id", json_string("42")); - wf_jsonrpc_server_process(server, request, &jsonrpc_send, user_data); + wfp_jsonrpc_server_process(server, request, &jsonrpc_send, user_data); ASSERT_FALSE(context.is_called); json_decref(request); - wf_jsonrpc_server_dispose(server); + wfp_jsonrpc_server_dispose(server); } -TEST(wf_jsonrpc_server, skip_invalid_request_missing_params) +TEST(wfp_jsonrpc_server, skip_invalid_request_missing_params) { - struct wf_jsonrpc_server * server = wf_jsonrpc_server_create(); + struct wfp_jsonrpc_server * server = wfp_jsonrpc_server_create(); Context context{nullptr, false}; void * user_data = reinterpret_cast(&context); json_t * request = json_object(); json_object_set_new(request, "method", json_string("sayHello")); json_object_set_new(request, "id", json_integer(42)); - wf_jsonrpc_server_process(server, request, &jsonrpc_send, user_data); + wfp_jsonrpc_server_process(server, request, &jsonrpc_send, user_data); ASSERT_FALSE(context.is_called); json_decref(request); - wf_jsonrpc_server_dispose(server); + wfp_jsonrpc_server_dispose(server); } -TEST(wf_jsonrpc_server, skip_invalid_request_wrong_params_type) +TEST(wfp_jsonrpc_server, skip_invalid_request_wrong_params_type) { - struct wf_jsonrpc_server * server = wf_jsonrpc_server_create(); + struct wfp_jsonrpc_server * server = wfp_jsonrpc_server_create(); Context context{nullptr, false}; void * user_data = reinterpret_cast(&context); @@ -197,34 +197,34 @@ TEST(wf_jsonrpc_server, skip_invalid_request_wrong_params_type) json_object_set_new(request, "method", json_string("sayHello")); json_object_set_new(request, "params", json_string("invalid")); json_object_set_new(request, "id", json_integer(42)); - wf_jsonrpc_server_process(server, request, &jsonrpc_send, user_data); + wfp_jsonrpc_server_process(server, request, &jsonrpc_send, user_data); ASSERT_FALSE(context.is_called); json_decref(request); - wf_jsonrpc_server_dispose(server); + wfp_jsonrpc_server_dispose(server); } -TEST(wf_jsonrpc_server, skip_invalid_request_missing_method) +TEST(wfp_jsonrpc_server, skip_invalid_request_missing_method) { - struct wf_jsonrpc_server * server = wf_jsonrpc_server_create(); + struct wfp_jsonrpc_server * server = wfp_jsonrpc_server_create(); Context context{nullptr, false}; void * user_data = reinterpret_cast(&context); json_t * request = json_object(); json_object_set_new(request, "params", json_array()); json_object_set_new(request, "id", json_integer(42)); - wf_jsonrpc_server_process(server, request, &jsonrpc_send, user_data); + wfp_jsonrpc_server_process(server, request, &jsonrpc_send, user_data); ASSERT_FALSE(context.is_called); json_decref(request); - wf_jsonrpc_server_dispose(server); + wfp_jsonrpc_server_dispose(server); } -TEST(wf_jsonrpc_server, skip_invalid_request_wront_method_type) +TEST(wfp_jsonrpc_server, skip_invalid_request_wront_method_type) { - struct wf_jsonrpc_server * server = wf_jsonrpc_server_create(); + struct wfp_jsonrpc_server * server = wfp_jsonrpc_server_create(); Context context{nullptr, false}; void * user_data = reinterpret_cast(&context); @@ -232,10 +232,10 @@ TEST(wf_jsonrpc_server, skip_invalid_request_wront_method_type) json_object_set_new(request, "method", json_integer(42)); json_object_set_new(request, "params", json_array()); json_object_set_new(request, "id", json_integer(42)); - wf_jsonrpc_server_process(server, request, &jsonrpc_send, user_data); + wfp_jsonrpc_server_process(server, request, &jsonrpc_send, user_data); ASSERT_FALSE(context.is_called); json_decref(request); - wf_jsonrpc_server_dispose(server); + wfp_jsonrpc_server_dispose(server); } \ No newline at end of file diff --git a/test/webfuse_provider/tests/core/test_base64.cc b/test/webfuse_provider/tests/core/test_base64.cc index 79eb49d..534886e 100644 --- a/test/webfuse_provider/tests/core/test_base64.cc +++ b/test/webfuse_provider/tests/core/test_base64.cc @@ -3,15 +3,15 @@ TEST(Base64, EncodedSize) { - ASSERT_EQ(4, wf_base64_encoded_size(1)); - ASSERT_EQ(4, wf_base64_encoded_size(2)); - ASSERT_EQ(4, wf_base64_encoded_size(3)); + ASSERT_EQ(4, wfp_base64_encoded_size(1)); + ASSERT_EQ(4, wfp_base64_encoded_size(2)); + ASSERT_EQ(4, wfp_base64_encoded_size(3)); - ASSERT_EQ(8, wf_base64_encoded_size(4)); - ASSERT_EQ(8, wf_base64_encoded_size(5)); - ASSERT_EQ(8, wf_base64_encoded_size(6)); + ASSERT_EQ(8, wfp_base64_encoded_size(4)); + ASSERT_EQ(8, wfp_base64_encoded_size(5)); + ASSERT_EQ(8, wfp_base64_encoded_size(6)); - ASSERT_EQ(120, wf_base64_encoded_size(90)); + ASSERT_EQ(120, wfp_base64_encoded_size(90)); } TEST(Base64, Encode) @@ -19,17 +19,17 @@ TEST(Base64, Encode) char buffer[42]; std::string in = "Hello"; - size_t length = wf_base64_encode((uint8_t const*) in.c_str(), in.size(), buffer, 42); + size_t length = wfp_base64_encode((uint8_t const*) in.c_str(), in.size(), buffer, 42); ASSERT_EQ(8, length); ASSERT_STREQ("SGVsbG8=", buffer); in = "Hello\n"; - length = wf_base64_encode((uint8_t const*) in.c_str(), in.size(), buffer, 42); + length = wfp_base64_encode((uint8_t const*) in.c_str(), in.size(), buffer, 42); ASSERT_EQ(8, length); ASSERT_STREQ("SGVsbG8K", buffer); in = "Blue"; - length = wf_base64_encode((uint8_t const*) in.c_str(), in.size(), buffer, 42); + length = wfp_base64_encode((uint8_t const*) in.c_str(), in.size(), buffer, 42); ASSERT_EQ(8, length); ASSERT_STREQ("Qmx1ZQ==", buffer); } @@ -39,53 +39,53 @@ TEST(Base64, FailedToEncodeBufferTooSmall) char buffer[1]; std::string in = "Hello"; - size_t length = wf_base64_encode((uint8_t const*) in.c_str(), in.size(), buffer, 1); + size_t length = wfp_base64_encode((uint8_t const*) in.c_str(), in.size(), buffer, 1); ASSERT_EQ(0, length); } TEST(Base64, DecodedSize) { std::string in = "SGVsbG8="; // Hello - size_t length = wf_base64_decoded_size(in.c_str(), in.size()); + size_t length = wfp_base64_decoded_size(in.c_str(), in.size()); ASSERT_EQ(5, length); in = "SGVsbG8K"; // Hello\n - length = wf_base64_decoded_size(in.c_str(), in.size()); + length = wfp_base64_decoded_size(in.c_str(), in.size()); ASSERT_EQ(6, length); in = "Qmx1ZQ=="; // Blue - length = wf_base64_decoded_size(in.c_str(), in.size()); + length = wfp_base64_decoded_size(in.c_str(), in.size()); ASSERT_EQ(4, length); } TEST(Base64, IsValid) { std::string in = "SGVsbG8="; // Hello - ASSERT_TRUE(wf_base64_isvalid(in.c_str(), in.size())); + ASSERT_TRUE(wfp_base64_isvalid(in.c_str(), in.size())); in = "SGVsbG8K"; // Hello\n - ASSERT_TRUE(wf_base64_isvalid(in.c_str(), in.size())); + ASSERT_TRUE(wfp_base64_isvalid(in.c_str(), in.size())); in = "Qmx1ZQ=="; // Blue - ASSERT_TRUE(wf_base64_isvalid(in.c_str(), in.size())); + ASSERT_TRUE(wfp_base64_isvalid(in.c_str(), in.size())); in = "Qmx1ZQ=a"; - ASSERT_FALSE(wf_base64_isvalid(in.c_str(), in.size())); + ASSERT_FALSE(wfp_base64_isvalid(in.c_str(), in.size())); in = "Qmx1ZQ"; - ASSERT_FALSE(wf_base64_isvalid(in.c_str(), in.size())); + ASSERT_FALSE(wfp_base64_isvalid(in.c_str(), in.size())); in = "Qmx1ZQ="; - ASSERT_FALSE(wf_base64_isvalid(in.c_str(), in.size())); + ASSERT_FALSE(wfp_base64_isvalid(in.c_str(), in.size())); in = "Qmx1Z==="; - ASSERT_FALSE(wf_base64_isvalid(in.c_str(), in.size())); + ASSERT_FALSE(wfp_base64_isvalid(in.c_str(), in.size())); in = "Qmx1ZQ?="; - ASSERT_FALSE(wf_base64_isvalid(in.c_str(), in.size())); + ASSERT_FALSE(wfp_base64_isvalid(in.c_str(), in.size())); in = "Qm?1ZQ=="; - ASSERT_FALSE(wf_base64_isvalid(in.c_str(), in.size())); + ASSERT_FALSE(wfp_base64_isvalid(in.c_str(), in.size())); } TEST(Base64, Decode) @@ -93,19 +93,19 @@ TEST(Base64, Decode) char buffer[42]; std::string in = "SGVsbG8="; // Hello - size_t length = wf_base64_decode(in.c_str(), in.size(), (uint8_t*) buffer, 42); + size_t length = wfp_base64_decode(in.c_str(), in.size(), (uint8_t*) buffer, 42); ASSERT_EQ(5, length); buffer[length] = '\0'; ASSERT_STREQ("Hello", buffer); in = "SGVsbG8K"; // Hello\n - length = wf_base64_decode(in.c_str(), in.size(), (uint8_t*) buffer, 42); + length = wfp_base64_decode(in.c_str(), in.size(), (uint8_t*) buffer, 42); ASSERT_EQ(6, length); buffer[length] = '\0'; ASSERT_STREQ("Hello\n", buffer); in = "Qmx1ZQ=="; // Blue - length = wf_base64_decode(in.c_str(), in.size(), (uint8_t*) buffer, 42); + length = wfp_base64_decode(in.c_str(), in.size(), (uint8_t*) buffer, 42); ASSERT_EQ(4, length); buffer[length] = '\0'; ASSERT_STREQ("Blue", buffer); @@ -116,7 +116,7 @@ TEST(Base64, FailToDecodeBufferTooSmall) char buffer[1]; std::string in = "SGVsbG8="; // Hello - size_t length = wf_base64_decode(in.c_str(), in.size(), (uint8_t*) buffer, 1); + size_t length = wfp_base64_decode(in.c_str(), in.size(), (uint8_t*) buffer, 1); ASSERT_EQ(0, length); } diff --git a/test/webfuse_provider/tests/core/test_container_of.cc b/test/webfuse_provider/tests/core/test_container_of.cc index 5d95f45..75f5433 100644 --- a/test/webfuse_provider/tests/core/test_container_of.cc +++ b/test/webfuse_provider/tests/core/test_container_of.cc @@ -17,7 +17,7 @@ TEST(ContainerOf, FirstMember) MyStruct my_struct = {23, 42}; int * first = &my_struct.first; - ASSERT_EQ(&my_struct, wf_container_of(first, MyStruct, first)); + ASSERT_EQ(&my_struct, wfp_container_of(first, MyStruct, first)); } TEST(ContainerOf, SecondMember) @@ -25,5 +25,5 @@ TEST(ContainerOf, SecondMember) MyStruct my_struct = {23, 42}; int * second = &my_struct.second; - ASSERT_EQ(&my_struct, wf_container_of(second, MyStruct, second)); + ASSERT_EQ(&my_struct, wfp_container_of(second, MyStruct, second)); } \ No newline at end of file diff --git a/test/webfuse_provider/tests/core/test_message.cc b/test/webfuse_provider/tests/core/test_message.cc index e2d3a0d..139c7bf 100644 --- a/test/webfuse_provider/tests/core/test_message.cc +++ b/test/webfuse_provider/tests/core/test_message.cc @@ -2,21 +2,21 @@ #include #include "webfuse_provider/impl/message.h" -TEST(wf_message, create) +TEST(wfp_message, create) { json_t * value = json_object(); - struct wf_message * message = wf_message_create(value); + struct wfp_message * message = wfp_message_create(value); ASSERT_NE(nullptr, message); ASSERT_EQ(2, message->length); ASSERT_TRUE(0 == strncmp("{}", message->data, 2)); - wf_message_dispose(message); + wfp_message_dispose(message); json_decref(value); } -TEST(wf_message, fail_to_create) +TEST(wfp_message, fail_to_create) { - struct wf_message * message = wf_message_create(nullptr); + struct wfp_message * message = wfp_message_create(nullptr); ASSERT_EQ(nullptr, message); } \ No newline at end of file diff --git a/test/webfuse_provider/tests/core/test_message_queue.cc b/test/webfuse_provider/tests/core/test_message_queue.cc index b0dab02..ec0b254 100644 --- a/test/webfuse_provider/tests/core/test_message_queue.cc +++ b/test/webfuse_provider/tests/core/test_message_queue.cc @@ -6,11 +6,11 @@ namespace { - struct wf_slist_item * create_message(char const * content) + struct wfp_slist_item * create_message(char const * content) { json_t * value = json_object(); json_object_set_new(value, "content", json_string(content)); - struct wf_message * message = wf_message_create(value); + struct wfp_message * message = wfp_message_create(value); json_decref(value); return &message->item; @@ -18,35 +18,35 @@ namespace } -TEST(wf_message_queue, cleanup_empty_list) +TEST(wfp_message_queue, cleanup_empty_list) { - struct wf_slist queue; - wf_slist_init(&queue); + struct wfp_slist queue; + wfp_slist_init(&queue); - wf_message_queue_cleanup(&queue); - ASSERT_TRUE(wf_slist_empty(&queue)); + wfp_message_queue_cleanup(&queue); + ASSERT_TRUE(wfp_slist_empty(&queue)); } -TEST(wf_message_queue, cleanup_one_element) +TEST(wfp_message_queue, cleanup_one_element) { - struct wf_slist queue; - wf_slist_init(&queue); + struct wfp_slist queue; + wfp_slist_init(&queue); - wf_slist_append(&queue, create_message("Hello")); + wfp_slist_append(&queue, create_message("Hello")); - wf_message_queue_cleanup(&queue); - ASSERT_TRUE(wf_slist_empty(&queue)); + wfp_message_queue_cleanup(&queue); + ASSERT_TRUE(wfp_slist_empty(&queue)); } -TEST(wf_message_queue, cleanup_multiple_element) +TEST(wfp_message_queue, cleanup_multiple_element) { - struct wf_slist queue; - wf_slist_init(&queue); + struct wfp_slist queue; + wfp_slist_init(&queue); - wf_slist_append(&queue, create_message("Hello")); - wf_slist_append(&queue, create_message("World")); - wf_slist_append(&queue, create_message("!")); + wfp_slist_append(&queue, create_message("Hello")); + wfp_slist_append(&queue, create_message("World")); + wfp_slist_append(&queue, create_message("!")); - wf_message_queue_cleanup(&queue); - ASSERT_TRUE(wf_slist_empty(&queue)); + wfp_message_queue_cleanup(&queue); + ASSERT_TRUE(wfp_slist_empty(&queue)); } \ No newline at end of file diff --git a/test/webfuse_provider/tests/core/test_slist.cc b/test/webfuse_provider/tests/core/test_slist.cc index ec2cd09..b15b7fb 100644 --- a/test/webfuse_provider/tests/core/test_slist.cc +++ b/test/webfuse_provider/tests/core/test_slist.cc @@ -1,49 +1,49 @@ #include #include "webfuse_provider/impl/slist.h" -TEST(wf_slist, init) +TEST(wfp_slist, init) { - struct wf_slist list; - wf_slist_init(&list); + struct wfp_slist list; + wfp_slist_init(&list); ASSERT_EQ(nullptr, list.head.next); ASSERT_EQ(nullptr, list.last->next); ASSERT_EQ(&list.head, list.last); - ASSERT_TRUE(wf_slist_empty(&list)); - ASSERT_EQ(nullptr, wf_slist_first(&list)); + ASSERT_TRUE(wfp_slist_empty(&list)); + ASSERT_EQ(nullptr, wfp_slist_first(&list)); } -TEST(wf_slist, append) +TEST(wfp_slist, append) { - struct wf_slist list; - struct wf_slist_item item[3]; + struct wfp_slist list; + struct wfp_slist_item item[3]; - wf_slist_init(&list); - ASSERT_TRUE(wf_slist_empty(&list)); + wfp_slist_init(&list); + ASSERT_TRUE(wfp_slist_empty(&list)); - wf_slist_append(&list, &item[0]); + wfp_slist_append(&list, &item[0]); ASSERT_NE(&list.head, list.last); - ASSERT_FALSE(wf_slist_empty(&list)); - ASSERT_EQ(&item[0], wf_slist_first(&list)); + ASSERT_FALSE(wfp_slist_empty(&list)); + ASSERT_EQ(&item[0], wfp_slist_first(&list)); ASSERT_EQ(&item[0], list.head.next); ASSERT_EQ(&item[0], list.last); ASSERT_EQ(nullptr, list.last->next); ASSERT_EQ(nullptr, item[0].next); - wf_slist_append(&list, &item[1]); + wfp_slist_append(&list, &item[1]); ASSERT_NE(&list.head, list.last); - ASSERT_FALSE(wf_slist_empty(&list)); - ASSERT_EQ(&item[0], wf_slist_first(&list)); + ASSERT_FALSE(wfp_slist_empty(&list)); + ASSERT_EQ(&item[0], wfp_slist_first(&list)); ASSERT_EQ(&item[0], list.head.next); ASSERT_EQ(&item[1], list.last); ASSERT_EQ(nullptr, list.last->next); ASSERT_EQ(&item[1], item[0].next); ASSERT_EQ(nullptr, item[1].next); - wf_slist_append(&list, &item[2]); + wfp_slist_append(&list, &item[2]); ASSERT_NE(&list.head, list.last); - ASSERT_FALSE(wf_slist_empty(&list)); - ASSERT_EQ(&item[0], wf_slist_first(&list)); + ASSERT_FALSE(wfp_slist_empty(&list)); + ASSERT_EQ(&item[0], wfp_slist_first(&list)); ASSERT_EQ(&item[0], list.head.next); ASSERT_EQ(&item[2], list.last); ASSERT_EQ(nullptr, list.last->next); @@ -52,85 +52,85 @@ TEST(wf_slist, append) ASSERT_EQ(nullptr, item[2].next); } -TEST(wf_slist_remove_after, remove_first) +TEST(wfp_slist_remove_after, remove_first) { - struct wf_slist list; - struct wf_slist_item item[3]; + struct wfp_slist list; + struct wfp_slist_item item[3]; - wf_slist_init(&list); - wf_slist_append(&list, &item[0]); - wf_slist_append(&list, &item[1]); - wf_slist_append(&list, &item[2]); + wfp_slist_init(&list); + wfp_slist_append(&list, &item[0]); + wfp_slist_append(&list, &item[1]); + wfp_slist_append(&list, &item[2]); - wf_slist_item * removed; + wfp_slist_item * removed; - removed = wf_slist_remove_first(&list); - ASSERT_FALSE(wf_slist_empty(&list)); + removed = wfp_slist_remove_first(&list); + ASSERT_FALSE(wfp_slist_empty(&list)); ASSERT_EQ(&item[0], removed); - removed = wf_slist_remove_first(&list); - ASSERT_FALSE(wf_slist_empty(&list)); + removed = wfp_slist_remove_first(&list); + ASSERT_FALSE(wfp_slist_empty(&list)); ASSERT_EQ(&item[1], removed); - removed = wf_slist_remove_first(&list); - ASSERT_TRUE(wf_slist_empty(&list)); + removed = wfp_slist_remove_first(&list); + ASSERT_TRUE(wfp_slist_empty(&list)); ASSERT_EQ(&item[2], removed); ASSERT_EQ(nullptr, list.head.next); ASSERT_EQ(nullptr, list.last->next); ASSERT_EQ(&list.head, list.last); - ASSERT_EQ(nullptr, wf_slist_first(&list)); + ASSERT_EQ(nullptr, wfp_slist_first(&list)); } -TEST(wf_slist_remove_after, remove_last) +TEST(wfp_slist_remove_after, remove_last) { - struct wf_slist list; - struct wf_slist_item item[3]; + struct wfp_slist list; + struct wfp_slist_item item[3]; - wf_slist_init(&list); - wf_slist_append(&list, &item[0]); - wf_slist_append(&list, &item[1]); - wf_slist_append(&list, &item[2]); + wfp_slist_init(&list); + wfp_slist_append(&list, &item[0]); + wfp_slist_append(&list, &item[1]); + wfp_slist_append(&list, &item[2]); - wf_slist_item * removed; + wfp_slist_item * removed; - removed = wf_slist_remove_after(&list, &item[1]); - ASSERT_FALSE(wf_slist_empty(&list)); + removed = wfp_slist_remove_after(&list, &item[1]); + ASSERT_FALSE(wfp_slist_empty(&list)); ASSERT_EQ(&item[2], removed); - removed = wf_slist_remove_after(&list, &item[0]); - ASSERT_FALSE(wf_slist_empty(&list)); + removed = wfp_slist_remove_after(&list, &item[0]); + ASSERT_FALSE(wfp_slist_empty(&list)); ASSERT_EQ(&item[1], removed); - removed = wf_slist_remove_after(&list, &list.head); - ASSERT_TRUE(wf_slist_empty(&list)); + removed = wfp_slist_remove_after(&list, &list.head); + ASSERT_TRUE(wfp_slist_empty(&list)); ASSERT_EQ(&item[0], removed); ASSERT_EQ(nullptr, list.head.next); ASSERT_EQ(nullptr, list.last->next); ASSERT_EQ(&list.head, list.last); - ASSERT_EQ(nullptr, wf_slist_first(&list)); + ASSERT_EQ(nullptr, wfp_slist_first(&list)); } -TEST(wf_slist_remove_after, remove_after) +TEST(wfp_slist_remove_after, remove_after) { - struct wf_slist list; - struct wf_slist_item item[3]; + struct wfp_slist list; + struct wfp_slist_item item[3]; - wf_slist_init(&list); - wf_slist_append(&list, &item[0]); - wf_slist_append(&list, &item[1]); - wf_slist_append(&list, &item[2]); + wfp_slist_init(&list); + wfp_slist_append(&list, &item[0]); + wfp_slist_append(&list, &item[1]); + wfp_slist_append(&list, &item[2]); - wf_slist_item * removed; + wfp_slist_item * removed; - removed = wf_slist_remove_after(&list, &item[0]); - ASSERT_FALSE(wf_slist_empty(&list)); + removed = wfp_slist_remove_after(&list, &item[0]); + ASSERT_FALSE(wfp_slist_empty(&list)); ASSERT_EQ(&item[1], removed); ASSERT_NE(&list.head, list.last); - ASSERT_FALSE(wf_slist_empty(&list)); - ASSERT_EQ(&item[0], wf_slist_first(&list)); + ASSERT_FALSE(wfp_slist_empty(&list)); + ASSERT_EQ(&item[0], wfp_slist_first(&list)); ASSERT_EQ(&item[0], list.head.next); ASSERT_EQ(&item[2], list.last); ASSERT_EQ(nullptr, list.last->next); diff --git a/test/webfuse_provider/tests/core/test_status.cc b/test/webfuse_provider/tests/core/test_status.cc index 857b039..f9087e0 100644 --- a/test/webfuse_provider/tests/core/test_status.cc +++ b/test/webfuse_provider/tests/core/test_status.cc @@ -1,30 +1,30 @@ #include #include "webfuse_provider/impl/status_intern.h" -TEST(wf_status, tostring) +TEST(wfp_status, tostring) { - ASSERT_STREQ("Good", wf_status_tostring(WF_GOOD)); - ASSERT_STREQ("Bad", wf_status_tostring(WF_BAD)); - ASSERT_STREQ("Bad (not implemented)", wf_status_tostring(WF_BAD_NOTIMPLEMENTED)); - ASSERT_STREQ("Bad (busy)", wf_status_tostring(WF_BAD_BUSY)); - ASSERT_STREQ("Bad (timeout)", wf_status_tostring(WF_BAD_TIMEOUT)); - ASSERT_STREQ("Bad (format)", wf_status_tostring(WF_BAD_FORMAT)); - ASSERT_STREQ("Bad (no entry)", wf_status_tostring(WF_BAD_NOENTRY)); - ASSERT_STREQ("Bad (access denied)", wf_status_tostring(WF_BAD_ACCESS_DENIED)); + ASSERT_STREQ("Good", wfp_status_tostring(WFP_GOOD)); + ASSERT_STREQ("Bad", wfp_status_tostring(WFP_BAD)); + ASSERT_STREQ("Bad (not implemented)", wfp_status_tostring(WFP_BAD_NOTIMPLEMENTED)); + ASSERT_STREQ("Bad (busy)", wfp_status_tostring(WFP_BAD_BUSY)); + ASSERT_STREQ("Bad (timeout)", wfp_status_tostring(WFP_BAD_TIMEOUT)); + ASSERT_STREQ("Bad (format)", wfp_status_tostring(WFP_BAD_FORMAT)); + ASSERT_STREQ("Bad (no entry)", wfp_status_tostring(WFP_BAD_NOENTRY)); + ASSERT_STREQ("Bad (access denied)", wfp_status_tostring(WFP_BAD_ACCESS_DENIED)); - ASSERT_STREQ("Bad (unknown)", wf_status_tostring(-1)); + ASSERT_STREQ("Bad (unknown)", wfp_status_tostring(-1)); } -TEST(wf_status, to_rc) +TEST(wfp_status, to_rc) { - ASSERT_EQ(0, wf_status_to_rc(WF_GOOD)); - ASSERT_EQ(-ENOENT, wf_status_to_rc(WF_BAD)); - ASSERT_EQ(-ENOSYS, wf_status_to_rc(WF_BAD_NOTIMPLEMENTED)); - ASSERT_EQ(-ENOENT, wf_status_to_rc(WF_BAD_BUSY)); - ASSERT_EQ(-ETIMEDOUT, wf_status_to_rc(WF_BAD_TIMEOUT)); - ASSERT_EQ(-ENOENT, wf_status_to_rc(WF_BAD_FORMAT)); - ASSERT_EQ(-ENOENT, wf_status_to_rc(WF_BAD_NOENTRY)); - ASSERT_EQ(-EACCES, wf_status_to_rc(WF_BAD_ACCESS_DENIED)); + ASSERT_EQ(0, wfp_status_to_rc(WFP_GOOD)); + ASSERT_EQ(-ENOENT, wfp_status_to_rc(WFP_BAD)); + ASSERT_EQ(-ENOSYS, wfp_status_to_rc(WFP_BAD_NOTIMPLEMENTED)); + ASSERT_EQ(-ENOENT, wfp_status_to_rc(WFP_BAD_BUSY)); + ASSERT_EQ(-ETIMEDOUT, wfp_status_to_rc(WFP_BAD_TIMEOUT)); + ASSERT_EQ(-ENOENT, wfp_status_to_rc(WFP_BAD_FORMAT)); + ASSERT_EQ(-ENOENT, wfp_status_to_rc(WFP_BAD_NOENTRY)); + ASSERT_EQ(-EACCES, wfp_status_to_rc(WFP_BAD_ACCESS_DENIED)); - ASSERT_EQ(-ENOENT, wf_status_to_rc(-1)); + ASSERT_EQ(-ENOENT, wfp_status_to_rc(-1)); } \ No newline at end of file diff --git a/test/webfuse_provider/tests/core/test_url.cc b/test/webfuse_provider/tests/core/test_url.cc index aead917..6e65373 100644 --- a/test/webfuse_provider/tests/core/test_url.cc +++ b/test/webfuse_provider/tests/core/test_url.cc @@ -4,66 +4,66 @@ TEST(url, ParseWs) { - struct wf_url url; - bool result = wf_url_init(&url, "ws://localhost/"); + struct wfp_url url; + bool result = wfp_url_init(&url, "ws://localhost/"); ASSERT_TRUE(result); ASSERT_EQ(80, url.port); ASSERT_FALSE(url.use_tls); ASSERT_STREQ("localhost", url.host); ASSERT_STREQ("/", url.path); - wf_url_cleanup(&url); + wfp_url_cleanup(&url); } TEST(url, ParswWss) { - struct wf_url url; - bool result = wf_url_init(&url, "wss://localhost/"); + struct wfp_url url; + bool result = wfp_url_init(&url, "wss://localhost/"); ASSERT_TRUE(result); ASSERT_EQ(443, url.port); ASSERT_TRUE(url.use_tls); ASSERT_STREQ("localhost", url.host); ASSERT_STREQ("/", url.path); - wf_url_cleanup(&url); + wfp_url_cleanup(&url); } TEST(url, ParseIPAdress) { - struct wf_url url; - bool result = wf_url_init(&url, "ws://127.0.0.1/"); + struct wfp_url url; + bool result = wfp_url_init(&url, "ws://127.0.0.1/"); ASSERT_TRUE(result); ASSERT_EQ(80, url.port); ASSERT_STREQ("127.0.0.1", url.host); ASSERT_STREQ("/", url.path); - wf_url_cleanup(&url); + wfp_url_cleanup(&url); } TEST(url, ParsePort) { - struct wf_url url; - bool result = wf_url_init(&url, "ws://localhost:54321/"); + struct wfp_url url; + bool result = wfp_url_init(&url, "ws://localhost:54321/"); ASSERT_TRUE(result); ASSERT_EQ(54321, url.port); - wf_url_cleanup(&url); + wfp_url_cleanup(&url); } TEST(url, ParseNonEmptyPath) { - struct wf_url url; - bool result = wf_url_init(&url, "ws://localhost/some_path?query"); + struct wfp_url url; + bool result = wfp_url_init(&url, "ws://localhost/some_path?query"); ASSERT_TRUE(result); ASSERT_STREQ("/some_path?query", url.path); - wf_url_cleanup(&url); + wfp_url_cleanup(&url); } TEST(url, FailToParseUnknownProtocol) { - struct wf_url url; - bool result = wf_url_init(&url, "unknown://localhost/"); + struct wfp_url url; + bool result = wfp_url_init(&url, "unknown://localhost/"); ASSERT_FALSE(result); ASSERT_EQ(0, url.port); ASSERT_EQ(nullptr, url.path); @@ -72,8 +72,8 @@ TEST(url, FailToParseUnknownProtocol) TEST(url, FailToParseMissingProtocol) { - struct wf_url url; - bool result = wf_url_init(&url, "unknown"); + struct wfp_url url; + bool result = wfp_url_init(&url, "unknown"); ASSERT_FALSE(result); ASSERT_EQ(0, url.port); ASSERT_EQ(nullptr, url.path); @@ -82,8 +82,8 @@ TEST(url, FailToParseMissingProtocol) TEST(url, FailToParseMissingPath) { - struct wf_url url; - bool result = wf_url_init(&url, "ws://localhost"); + struct wfp_url url; + bool result = wfp_url_init(&url, "ws://localhost"); ASSERT_FALSE(result); ASSERT_EQ(0, url.port); ASSERT_EQ(nullptr, url.path); diff --git a/test/webfuse_provider/tests/core/test_util.cc b/test/webfuse_provider/tests/core/test_util.cc index 6bb59da..9879f74 100644 --- a/test/webfuse_provider/tests/core/test_util.cc +++ b/test/webfuse_provider/tests/core/test_util.cc @@ -5,7 +5,7 @@ TEST(jsonrpc_util, get_int) { json_t * object = json_object(); json_object_set_new(object, "key", json_integer(23)); - int value = wf_impl_json_get_int(object, "key", 42); + int value = wfp_impl_json_get_int(object, "key", 42); ASSERT_EQ(23, value); json_decref(object); @@ -13,7 +13,7 @@ TEST(jsonrpc_util, get_int) TEST(jsonrpc_util, failed_to_get_null_object) { - int value = wf_impl_json_get_int(nullptr, "key", 42); + int value = wfp_impl_json_get_int(nullptr, "key", 42); ASSERT_EQ(42, value); } @@ -21,7 +21,7 @@ TEST(jsonrpc_util, failed_to_get_null_object) TEST(jsonrpc_util, failed_to_get_not_object) { json_t * object = json_array(); - int value = wf_impl_json_get_int(nullptr, "key", 42); + int value = wfp_impl_json_get_int(nullptr, "key", 42); ASSERT_EQ(42, value); json_decref(object); @@ -30,7 +30,7 @@ TEST(jsonrpc_util, failed_to_get_not_object) TEST(jsonrpc_util, failed_to_get_invalid_key) { json_t * object = json_object(); - int value = wf_impl_json_get_int(object, "key", 42); + int value = wfp_impl_json_get_int(object, "key", 42); ASSERT_EQ(42, value); json_decref(object); @@ -40,7 +40,7 @@ TEST(jsonrpc_util, failed_to_get_invalid_value_type) { json_t * object = json_object(); json_object_set_new(object, "key", json_string("42")); - int value = wf_impl_json_get_int(object, "key", 42); + int value = wfp_impl_json_get_int(object, "key", 42); ASSERT_EQ(42, value); json_decref(object); diff --git a/test/webfuse_provider/tests/core/timer/test_timepoint.cc b/test/webfuse_provider/tests/core/timer/test_timepoint.cc index 733d6d9..3818fa9 100644 --- a/test/webfuse_provider/tests/core/timer/test_timepoint.cc +++ b/test/webfuse_provider/tests/core/timer/test_timepoint.cc @@ -7,32 +7,32 @@ using namespace std::chrono_literals; -TEST(wf_timer_timepoint, now) +TEST(wfp_timer_timepoint, now) { - wf_timer_timepoint start = wf_timer_timepoint_now(); + wfp_timer_timepoint start = wfp_timer_timepoint_now(); std::this_thread::sleep_for(42ms); - wf_timer_timepoint end = wf_timer_timepoint_now(); + wfp_timer_timepoint end = wfp_timer_timepoint_now(); ASSERT_LT(start, end); ASSERT_LT(end, start + 500); } -TEST(wf_timer_timepoint, in_msec) +TEST(wfp_timer_timepoint, in_msec) { - wf_timer_timepoint now = wf_timer_timepoint_now(); - wf_timer_timepoint later = wf_timer_timepoint_in_msec(42); + wfp_timer_timepoint now = wfp_timer_timepoint_now(); + wfp_timer_timepoint later = wfp_timer_timepoint_in_msec(42); ASSERT_LT(now, later); ASSERT_LT(later, now + 500); } -TEST(wf_timer_timepoint, elapsed) +TEST(wfp_timer_timepoint, elapsed) { - wf_timer_timepoint now; + wfp_timer_timepoint now; - now = wf_timer_timepoint_now(); - ASSERT_TRUE(wf_timer_timepoint_is_elapsed(now - 1)); + now = wfp_timer_timepoint_now(); + ASSERT_TRUE(wfp_timer_timepoint_is_elapsed(now - 1)); - now = wf_timer_timepoint_now(); - ASSERT_FALSE(wf_timer_timepoint_is_elapsed(now + 500)); + now = wfp_timer_timepoint_now(); + ASSERT_FALSE(wfp_timer_timepoint_is_elapsed(now + 500)); } diff --git a/test/webfuse_provider/tests/core/timer/test_timer.cc b/test/webfuse_provider/tests/core/timer/test_timer.cc index 493064a..a87e869 100644 --- a/test/webfuse_provider/tests/core/timer/test_timer.cc +++ b/test/webfuse_provider/tests/core/timer/test_timer.cc @@ -12,7 +12,7 @@ using namespace std::chrono_literals; extern "C" { - void on_timeout(struct wf_timer * timer, void * user_data) + void on_timeout(struct wfp_timer * timer, void * user_data) { (void) timer; @@ -21,128 +21,128 @@ extern "C" } } -TEST(wf_timer, init) +TEST(wfp_timer, init) { bool triggered = false; - struct wf_timer_manager * manager = wf_timer_manager_create(); - struct wf_timer * timer = wf_timer_create(manager, &on_timeout, reinterpret_cast(&triggered)); + struct wfp_timer_manager * manager = wfp_timer_manager_create(); + struct wfp_timer * timer = wfp_timer_create(manager, &on_timeout, reinterpret_cast(&triggered)); - wf_timer_dispose(timer); - wf_timer_manager_dispose(manager); + wfp_timer_dispose(timer); + wfp_timer_manager_dispose(manager); } -TEST(wf_timer, trigger) +TEST(wfp_timer, trigger) { bool triggered = false; - struct wf_timer_manager * manager = wf_timer_manager_create(); - struct wf_timer * timer = wf_timer_create(manager, &on_timeout, reinterpret_cast(&triggered)); + struct wfp_timer_manager * manager = wfp_timer_manager_create(); + struct wfp_timer * timer = wfp_timer_create(manager, &on_timeout, reinterpret_cast(&triggered)); - wf_timer_start(timer, -1); - wf_timer_manager_check(manager); + wfp_timer_start(timer, -1); + wfp_timer_manager_check(manager); ASSERT_TRUE(triggered); - wf_timer_dispose(timer); - wf_timer_manager_dispose(manager); + wfp_timer_dispose(timer); + wfp_timer_manager_dispose(manager); } -TEST(wf_timer, trigger_on_dispose) +TEST(wfp_timer, trigger_on_dispose) { bool triggered = false; - struct wf_timer_manager * manager = wf_timer_manager_create(); - struct wf_timer * timer = wf_timer_create(manager, &on_timeout, reinterpret_cast(&triggered)); + struct wfp_timer_manager * manager = wfp_timer_manager_create(); + struct wfp_timer * timer = wfp_timer_create(manager, &on_timeout, reinterpret_cast(&triggered)); - wf_timer_start(timer, (5 * 60 * 1000)); + wfp_timer_start(timer, (5 * 60 * 1000)); - wf_timer_manager_dispose(manager); + wfp_timer_manager_dispose(manager); ASSERT_TRUE(triggered); - wf_timer_dispose(timer); + wfp_timer_dispose(timer); } -TEST(wf_timer, cancel) +TEST(wfp_timer, cancel) { bool triggered = false; - struct wf_timer_manager * manager = wf_timer_manager_create(); - struct wf_timer * timer = wf_timer_create(manager, &on_timeout, reinterpret_cast(&triggered)); + struct wfp_timer_manager * manager = wfp_timer_manager_create(); + struct wfp_timer * timer = wfp_timer_create(manager, &on_timeout, reinterpret_cast(&triggered)); - wf_timer_start(timer, 250); + wfp_timer_start(timer, 250); std::this_thread::sleep_for(500ms); - wf_timer_cancel(timer); - wf_timer_manager_check(manager); + wfp_timer_cancel(timer); + wfp_timer_manager_check(manager); ASSERT_FALSE(triggered); - wf_timer_dispose(timer); - wf_timer_manager_dispose(manager); + wfp_timer_dispose(timer); + wfp_timer_manager_dispose(manager); } -TEST(wf_timer, cancel_multiple_timers) +TEST(wfp_timer, cancel_multiple_timers) { static size_t const count = 5; - struct wf_timer_manager * manager = wf_timer_manager_create(); - struct wf_timer * timer[count]; + struct wfp_timer_manager * manager = wfp_timer_manager_create(); + struct wfp_timer * timer[count]; bool triggered = false; for(size_t i = 0; i < count; i++) { - timer[i] = wf_timer_create(manager, &on_timeout, reinterpret_cast(&triggered)); - wf_timer_start(timer[i], 0); + timer[i] = wfp_timer_create(manager, &on_timeout, reinterpret_cast(&triggered)); + wfp_timer_start(timer[i], 0); } std::this_thread::sleep_for(10ms); for(size_t i = 0; i < count; i++) { - wf_timer_cancel(timer[i]); + wfp_timer_cancel(timer[i]); } - wf_timer_manager_check(manager); + wfp_timer_manager_check(manager); ASSERT_FALSE(triggered); for(size_t i = 0; i < count; i++) { - wf_timer_dispose(timer[i]); + wfp_timer_dispose(timer[i]); } - wf_timer_manager_dispose(manager); + wfp_timer_manager_dispose(manager); } -TEST(wf_timer, multiple_timers) +TEST(wfp_timer, multiple_timers) { static size_t const count = 5; - struct wf_timer_manager * manager = wf_timer_manager_create(); - struct wf_timer * timer[count]; + struct wfp_timer_manager * manager = wfp_timer_manager_create(); + struct wfp_timer * timer[count]; bool triggered[count]; for(size_t i = 0; i < count; i++) { - timer[i] = wf_timer_create(manager, &on_timeout, reinterpret_cast(&triggered[i])); + timer[i] = wfp_timer_create(manager, &on_timeout, reinterpret_cast(&triggered[i])); triggered[i] = false; - wf_timer_start(timer[i], (300 - (50 * i))); + wfp_timer_start(timer[i], (300 - (50 * i))); } for(size_t i = 0; i < count; i++) { std::this_thread::sleep_for(100ms); - wf_timer_manager_check(manager); + wfp_timer_manager_check(manager); } for(size_t i = 0; i < count; i++) { ASSERT_TRUE(triggered[i]); - wf_timer_dispose(timer[i]); + wfp_timer_dispose(timer[i]); } - wf_timer_manager_dispose(manager); + wfp_timer_manager_dispose(manager); } -TEST(wf_timer, dont_trigger_null_callback) +TEST(wfp_timer, dont_trigger_null_callback) { - struct wf_timer_manager * manager = wf_timer_manager_create(); - struct wf_timer * timer = wf_timer_create(manager, nullptr, nullptr); + struct wfp_timer_manager * manager = wfp_timer_manager_create(); + struct wfp_timer * timer = wfp_timer_create(manager, nullptr, nullptr); - wf_timer_start(timer, -1); - wf_timer_manager_check(manager); + wfp_timer_start(timer, -1); + wfp_timer_manager_check(manager); - wf_timer_dispose(timer); - wf_timer_manager_dispose(manager); + wfp_timer_dispose(timer); + wfp_timer_manager_dispose(manager); } diff --git a/test/webfuse_provider/tests/integration/file.hpp b/test/webfuse_provider/tests/integration/file.hpp index e36e6ce..865576b 100644 --- a/test/webfuse_provider/tests/integration/file.hpp +++ b/test/webfuse_provider/tests/integration/file.hpp @@ -1,5 +1,5 @@ -#ifndef WF_TEST_INTEGRATION_FILE_HPP -#define WF_TEST_INTEGRATION_FILE_HPP +#ifndef WFP_TEST_INTEGRATION_FILE_HPP +#define WFP_TEST_INTEGRATION_FILE_HPP #include diff --git a/test/webfuse_provider/tests/integration/provider.hpp b/test/webfuse_provider/tests/integration/provider.hpp index c7c60c4..ce3e638 100644 --- a/test/webfuse_provider/tests/integration/provider.hpp +++ b/test/webfuse_provider/tests/integration/provider.hpp @@ -1,5 +1,5 @@ -#ifndef WF_TEST_INTEGRATION_PROVIDER -#define WF_TEST_INTEGRATION_PROVIDER +#ifndef WFP_TEST_INTEGRATION_PROVIDER +#define WFP_TEST_INTEGRATION_PROVIDER namespace webfuse_test { diff --git a/test/webfuse_provider/tests/integration/server.cc b/test/webfuse_provider/tests/integration/server.cc index d3c2735..996eccc 100644 --- a/test/webfuse_provider/tests/integration/server.cc +++ b/test/webfuse_provider/tests/integration/server.cc @@ -9,7 +9,7 @@ #include "webfuse_adapter.h" #include "webfuse/adapter/impl/server.h" -#define WF_PATH_MAX (100) +#define WFP_PATH_MAX (100) extern "C" { @@ -22,17 +22,17 @@ static void webfuse_test_server_cleanup_mountpoint( free(path); } -static struct wf_mountpoint * +static struct wfp_mountpoint * webfuse_test_server_create_mountpoint( char const * filesystem, void * user_data) { char const * base_dir = reinterpret_cast(user_data); - char path[WF_PATH_MAX]; - snprintf(path, WF_PATH_MAX, "%s/%s", base_dir, filesystem); + char path[WFP_PATH_MAX]; + snprintf(path, WFP_PATH_MAX, "%s/%s", base_dir, filesystem); mkdir(path, 0755); - struct wf_mountpoint * mountpoint = wf_mountpoint_create(path); - wf_mountpoint_set_userdata( + struct wfp_mountpoint * mountpoint = wfp_mountpoint_create(path); + wfp_mountpoint_set_userdata( mountpoint, reinterpret_cast(strdup(path)), &webfuse_test_server_cleanup_mountpoint); @@ -51,7 +51,7 @@ public: Private() : is_shutdown_requested(false) { - snprintf(base_dir, WF_PATH_MAX, "%s", "/tmp/webfuse_test_integration_XXXXXX"); + snprintf(base_dir, WFP_PATH_MAX, "%s", "/tmp/webfuse_test_integration_XXXXXX"); char const * result = mkdtemp(base_dir); if (NULL == result) { @@ -59,19 +59,19 @@ public: } - config = wf_server_config_create(); - wf_server_config_set_port(config, 0); - wf_server_config_set_mountpoint_factory(config, + config = wfp_server_config_create(); + wfp_server_config_set_port(config, 0); + wfp_server_config_set_mountpoint_factory(config, &webfuse_test_server_create_mountpoint, reinterpret_cast(base_dir)); - wf_server_config_set_keypath(config, "server-key.pem"); - wf_server_config_set_certpath(config, "server-cert.pem"); + wfp_server_config_set_keypath(config, "server-key.pem"); + wfp_server_config_set_certpath(config, "server-cert.pem"); - server = wf_server_create(config); + server = wfp_server_create(config); - while (!wf_impl_server_is_operational(server)) + while (!wfp_impl_server_is_operational(server)) { - wf_server_service(server); + wfp_server_service(server); } thread = std::thread(Run, this); @@ -83,8 +83,8 @@ public: RequestShutdown(); thread.join(); rmdir(base_dir); - wf_server_dispose(server); - wf_server_config_dispose(config); + wfp_server_dispose(server); + wfp_server_config_dispose(config); } bool IsShutdownRequested() @@ -95,7 +95,7 @@ public: std::string GetUrl(void) const { - int const port = wf_server_get_port(server); + int const port = wfp_server_get_port(server); std::ostringstream stream; stream << "wss://localhost:" << port << "/"; return stream.str(); @@ -106,14 +106,14 @@ private: { std::lock_guard lock(shutdown_lock); is_shutdown_requested = true; - wf_server_interrupt(server); + wfp_server_interrupt(server); } static void Run(Server::Private * context) { while (!context->IsShutdownRequested()) { - wf_server_service(context->server); + wfp_server_service(context->server); } } @@ -124,9 +124,9 @@ private: public: - char base_dir[WF_PATH_MAX]; - wf_server_config * config; - wf_server * server; + char base_dir[WFP_PATH_MAX]; + wfp_server_config * config; + wfp_server * server; }; Server::Server() diff --git a/test/webfuse_provider/tests/integration/server.hpp b/test/webfuse_provider/tests/integration/server.hpp index de7864c..07aa1b4 100644 --- a/test/webfuse_provider/tests/integration/server.hpp +++ b/test/webfuse_provider/tests/integration/server.hpp @@ -1,5 +1,5 @@ -#ifndef WF_TEST_INTEGRATION_SERVER_HPP -#define WF_TEST_INTEGRATION_SERVER_HPP +#ifndef WFP_TEST_INTEGRATION_SERVER_HPP +#define WFP_TEST_INTEGRATION_SERVER_HPP #include diff --git a/test/webfuse_provider/tests/integration/test_integration.cc b/test/webfuse_provider/tests/integration/test_integration.cc index 192c860..eb4905e 100644 --- a/test/webfuse_provider/tests/integration/test_integration.cc +++ b/test/webfuse_provider/tests/integration/test_integration.cc @@ -31,7 +31,7 @@ namespace , provider(nullptr) { json_object_seed(0); - wf_lwslog_disable(); + wfp_lwslog_disable(); } protected: diff --git a/test/webfuse_provider/tests/integration/test_lowlevel.cc b/test/webfuse_provider/tests/integration/test_lowlevel.cc index 0c49192..5209d93 100644 --- a/test/webfuse_provider/tests/integration/test_lowlevel.cc +++ b/test/webfuse_provider/tests/integration/test_lowlevel.cc @@ -11,16 +11,16 @@ using ::webfuse_test::TempDir; extern "C" { -wf_mountpoint * -wf_test_integration_lowlevel_create_mountpoint( +wfp_mountpoint * +wfp_test_integration_lowlevel_create_mountpoint( char const *, void * user_data) { auto * tempDir = reinterpret_cast(user_data); - return wf_mountpoint_create(tempDir->path()); + return wfp_mountpoint_create(tempDir->path()); } void -wf_test_integration_lowlevel_on_connected( +wfp_test_integration_lowlevel_on_connected( void * user_data) { int * state = reinterpret_cast(user_data); @@ -28,7 +28,7 @@ wf_test_integration_lowlevel_on_connected( } void -wf_test_integration_lowlevel_on_disconnected( +wfp_test_integration_lowlevel_on_disconnected( void * user_data) { int * state = reinterpret_cast(user_data); @@ -36,18 +36,18 @@ wf_test_integration_lowlevel_on_disconnected( } bool -wf_test_integration_lowlevel_authenticate( - struct wf_credentials const * credentials, +wfp_test_integration_lowlevel_authenticate( + struct wfp_credentials const * credentials, void * ) { - char const * username = wf_credentials_get(credentials, "username"); - char const * password = wf_credentials_get(credentials, "password"); + char const * username = wfp_credentials_get(credentials, "username"); + char const * password = wfp_credentials_get(credentials, "password"); return ((0 == strcmp(username, "bob")) && (0 == strcmp(password, "secret"))); } void -wf_test_integration_lowlevel_get_credentials( +wfp_test_integration_lowlevel_get_credentials( struct wfp_credentials * credentials, void * ) { @@ -60,29 +60,29 @@ wf_test_integration_lowlevel_get_credentials( TEST(integration, lowlevel) { - TempDir dir("wf_test"); + TempDir dir("wfp_test"); - wf_server_protocol * server_protocol = wf_server_protocol_create( - &wf_test_integration_lowlevel_create_mountpoint, + wfp_server_protocol * server_protocol = wfp_server_protocol_create( + &wfp_test_integration_lowlevel_create_mountpoint, reinterpret_cast(&dir)); ASSERT_NE(nullptr, server_protocol); - wf_server_protocol_add_authenticator(server_protocol, "username", - &wf_test_integration_lowlevel_authenticate, nullptr); + wfp_server_protocol_add_authenticator(server_protocol, "username", + &wfp_test_integration_lowlevel_authenticate, nullptr); int state = 0; wfp_client_config * client_config = wfp_client_config_create(); ASSERT_NE(nullptr, client_config); wfp_client_config_set_userdata(client_config, reinterpret_cast(&state)); - wfp_client_config_set_onconnected(client_config, &wf_test_integration_lowlevel_on_connected); - wfp_client_config_set_ondisconnected(client_config, &wf_test_integration_lowlevel_on_disconnected); - wfp_client_config_enable_authentication(client_config, &wf_test_integration_lowlevel_get_credentials); + wfp_client_config_set_onconnected(client_config, &wfp_test_integration_lowlevel_on_connected); + wfp_client_config_set_ondisconnected(client_config, &wfp_test_integration_lowlevel_on_disconnected); + wfp_client_config_enable_authentication(client_config, &wfp_test_integration_lowlevel_get_credentials); wfp_client_protocol * client_protocol = wfp_client_protocol_create(client_config); ASSERT_NE(nullptr, client_protocol); lws_protocols protocols[3]; memset(protocols, 0, 3 * sizeof(lws_protocols)); - wf_server_protocol_init_lws(server_protocol, &protocols[0]); + wfp_server_protocol_init_lws(server_protocol, &protocols[0]); wfp_client_protocol_init_lws(client_protocol, &protocols[1]); lws_context_creation_info info; @@ -108,5 +108,5 @@ TEST(integration, lowlevel) wfp_client_protocol_dispose(client_protocol); wfp_client_config_dispose(client_config); - wf_server_protocol_dispose(server_protocol); + wfp_server_protocol_dispose(server_protocol); } \ No newline at end of file diff --git a/test/webfuse_provider/tests/provider/test_client_protocol.cc b/test/webfuse_provider/tests/provider/test_client_protocol.cc index 405b1c5..8e8253f 100644 --- a/test/webfuse_provider/tests/provider/test_client_protocol.cc +++ b/test/webfuse_provider/tests/provider/test_client_protocol.cc @@ -34,7 +34,7 @@ class ClientProtocolFixture public: explicit ClientProtocolFixture(IProviderClient& client, bool enableAuthentication = false) { - server = new WsServer(WF_PROTOCOL_NAME_ADAPTER_SERVER); + server = new WsServer(WFP_PROTOCOL_NAME_ADAPTER_SERVER); config = wfp_client_config_create(); client.AttachTo(config, enableAuthentication); diff --git a/test/webfuse_provider/utils/adapter_client.cc b/test/webfuse_provider/utils/adapter_client.cc index d1dbb4e..11e0c15 100644 --- a/test/webfuse_provider/utils/adapter_client.cc +++ b/test/webfuse_provider/utils/adapter_client.cc @@ -25,10 +25,10 @@ class AdapterClient::Private { public: Private( - wf_client_callback_fn * callback, + wfp_client_callback_fn * callback, void * user_data, std::string const & url) - : client(wf_client_create(callback, user_data)) + : client(wfp_client_create(callback, user_data)) , url_(url) , command(Command::run) , tempdir("webfuse_adpter_client") @@ -40,7 +40,7 @@ public: { ApplyCommand(Command::shutdown); thread.join(); - wf_client_dispose(client); + wfp_client_dispose(client); } void ApplyCommand(Command actual_command) @@ -50,7 +50,7 @@ public: command = actual_command; } - wf_client_interrupt(client); + wfp_client_interrupt(client); } std::string GetDir() @@ -74,19 +74,19 @@ private: switch (actual_command) { case Command::run: - wf_client_service(self->client); + wfp_client_service(self->client); break; case Command::connect: - wf_client_connect(self->client, self->url_.c_str()); + wfp_client_connect(self->client, self->url_.c_str()); break; case Command::disconnect: - wf_client_disconnect(self->client); + wfp_client_disconnect(self->client); break; case Command::authenticate: - wf_client_authenticate(self->client); + wfp_client_authenticate(self->client); break; case Command::add_filesystem: - wf_client_add_filesystem(self->client, self->tempdir.path(), "test"); + wfp_client_add_filesystem(self->client, self->tempdir.path(), "test"); break; case Command::shutdown: // fall-through @@ -98,7 +98,7 @@ private: } } - wf_client * client; + wfp_client * client; std::string url_; Command command; TempDir tempdir; @@ -107,7 +107,7 @@ private: }; AdapterClient::AdapterClient( - wf_client_callback_fn * callback, + wfp_client_callback_fn * callback, void * user_data, std::string const & url) : d(new Private(callback, user_data, url)) diff --git a/test/webfuse_provider/utils/adapter_client.hpp b/test/webfuse_provider/utils/adapter_client.hpp index ceaefcb..6ce0152 100644 --- a/test/webfuse_provider/utils/adapter_client.hpp +++ b/test/webfuse_provider/utils/adapter_client.hpp @@ -1,5 +1,5 @@ -#ifndef WF_UTILS_ADAPTER_CLIENT_HPP -#define WF_UTILS_APAPTER_CLIENT_HPP +#ifndef WFP_UTILS_ADAPTER_CLIENT_HPP +#define WFP_UTILS_APAPTER_CLIENT_HPP #include "webfuse/adapter/client.h" #include @@ -13,7 +13,7 @@ class AdapterClient AdapterClient& operator=(AdapterClient const &) = delete; public: AdapterClient( - wf_client_callback_fn * callback, + wfp_client_callback_fn * callback, void * user_data, std::string const & url); ~AdapterClient(); diff --git a/test/webfuse_provider/utils/file_utils.hpp b/test/webfuse_provider/utils/file_utils.hpp index 0c8cbc1..01df8cc 100644 --- a/test/webfuse_provider/utils/file_utils.hpp +++ b/test/webfuse_provider/utils/file_utils.hpp @@ -1,5 +1,5 @@ -#ifndef WF_TEST_FILE_UTILS_HPP -#define WF_TEST_FILE_UTILS_HPP +#ifndef WFP_TEST_FILE_UTILS_HPP +#define WFP_TEST_FILE_UTILS_HPP #include diff --git a/test/webfuse_provider/utils/path.c b/test/webfuse_provider/utils/path.c index 6179d02..b1a2af0 100644 --- a/test/webfuse_provider/utils/path.c +++ b/test/webfuse_provider/utils/path.c @@ -2,9 +2,9 @@ #include #include -#define WF_PATH_DEFAULT_CAPACITY (8) +#define WFP_PATH_DEFAULT_CAPACITY (8) -struct wf_path +struct wfp_path { char * * elements; size_t count; @@ -12,8 +12,8 @@ struct wf_path }; static void -wf_path_add( - struct wf_path * path, +wfp_path_add( + struct wfp_path * path, char const * element, size_t element_size) { @@ -40,32 +40,32 @@ wf_path_add( } } -struct wf_path * -wf_path_create( +struct wfp_path * +wfp_path_create( char const * value) { - struct wf_path * path = malloc(sizeof(struct wf_path)); - path->elements = malloc(sizeof(char*) * WF_PATH_DEFAULT_CAPACITY); - path->capacity = WF_PATH_DEFAULT_CAPACITY; + struct wfp_path * path = malloc(sizeof(struct wfp_path)); + path->elements = malloc(sizeof(char*) * WFP_PATH_DEFAULT_CAPACITY); + path->capacity = WFP_PATH_DEFAULT_CAPACITY; path->count = 0; char const * remainder = value; char const * pos = strchr(remainder, '/'); while (NULL != pos) { - wf_path_add(path, remainder, (pos - remainder)); + wfp_path_add(path, remainder, (pos - remainder)); remainder = pos + 1; pos = strchr(remainder, '/'); } - wf_path_add(path, remainder, strlen(remainder)); + wfp_path_add(path, remainder, strlen(remainder)); return path; } void -wf_path_dispose( - struct wf_path * path) +wfp_path_dispose( + struct wfp_path * path) { for(size_t i = 0; i < path->count; i++) { @@ -78,15 +78,15 @@ wf_path_dispose( } size_t -wf_path_element_count( - struct wf_path * path) +wfp_path_element_count( + struct wfp_path * path) { return path->count; } char const * -wf_path_get_element( - struct wf_path * path, +wfp_path_get_element( + struct wfp_path * path, size_t i) { char const * result = NULL; @@ -99,8 +99,8 @@ wf_path_get_element( } char const * -wf_path_get_filename( - struct wf_path * path) +wfp_path_get_filename( + struct wfp_path * path) { char const * result = NULL; diff --git a/test/webfuse_provider/utils/path.h b/test/webfuse_provider/utils/path.h index ca31725..01da8e6 100644 --- a/test/webfuse_provider/utils/path.h +++ b/test/webfuse_provider/utils/path.h @@ -1,5 +1,5 @@ -#ifndef WF_PATH_H -#define WF_PATH_H +#ifndef WFP_PATH_H +#define WFP_PATH_H #ifndef __cplusplus #include @@ -13,28 +13,28 @@ extern "C" { #endif -struct wf_path; +struct wfp_path; -extern struct wf_path * -wf_path_create( +extern struct wfp_path * +wfp_path_create( char const * value); extern void -wf_path_dispose( - struct wf_path * path); +wfp_path_dispose( + struct wfp_path * path); extern size_t -wf_path_element_count( - struct wf_path * path); +wfp_path_element_count( + struct wfp_path * path); extern char const * -wf_path_get_element( - struct wf_path * path, +wfp_path_get_element( + struct wfp_path * path, size_t i); extern char const * -wf_path_get_filename( - struct wf_path * path); +wfp_path_get_filename( + struct wfp_path * path); #ifdef __cplusplus } diff --git a/test/webfuse_provider/utils/static_filesystem.c b/test/webfuse_provider/utils/static_filesystem.c index 1667d3d..eb5fb8d 100644 --- a/test/webfuse_provider/utils/static_filesystem.c +++ b/test/webfuse_provider/utils/static_filesystem.c @@ -165,16 +165,16 @@ wfp_static_filesystem_add_dir( static size_t wfp_static_filesystem_make_parent( struct wfp_static_filesystem * filesystem, - struct wf_path * path) + struct wfp_path * path) { size_t result = WFP_STATIC_FILSYSTEM_INODE_ROOT; - size_t count = wf_path_element_count(path); + size_t count = wfp_path_element_count(path); if (0 < count) { for(size_t i = 0; i < (count - 1); i++) { - char const * name = wf_path_get_element(path, i); + char const * name = wfp_path_get_element(path, i); result = wfp_static_filesystem_add_dir(filesystem, result, name); } } @@ -217,7 +217,7 @@ static void wfp_static_filesystem_lookup( } else { - wfp_respond_error(request, WF_BAD_NOENTRY); + wfp_respond_error(request, WFP_BAD_NOENTRY); } } @@ -238,7 +238,7 @@ static void wfp_static_filesystem_getattr( } else { - wfp_respond_error(request, WF_BAD_NOENTRY); + wfp_respond_error(request, WFP_BAD_NOENTRY); } } @@ -270,7 +270,7 @@ static void wfp_static_filesystem_readdir( } else { - wfp_respond_error(request, WF_BAD_NOENTRY); + wfp_respond_error(request, WFP_BAD_NOENTRY); } } @@ -291,19 +291,19 @@ static void wfp_static_filesystem_open( } else { - wfp_respond_error(request, WF_BAD_ACCESS_DENIED); + wfp_respond_error(request, WFP_BAD_ACCESS_DENIED); } } else { - wfp_respond_error(request, WF_BAD_NOENTRY); + wfp_respond_error(request, WFP_BAD_NOENTRY); } } static void wfp_static_filesystem_read( struct wfp_request * request, ino_t inode, - uint32_t WF_UNUSED_PARAM(handle), + uint32_t WFP_UNUSED_PARAM(handle), size_t offset, size_t length, void * user_data) @@ -321,7 +321,7 @@ static void wfp_static_filesystem_read( } else { - wfp_respond_error(request, WF_BAD_NOENTRY); + wfp_respond_error(request, WFP_BAD_NOENTRY); } } @@ -373,14 +373,14 @@ wfp_static_filesystem_add( char const * content, size_t length) { - struct wf_path * path_ = wf_path_create(path); + struct wfp_path * path_ = wfp_path_create(path); if (NULL != path_) { size_t parent = wfp_static_filesystem_make_parent(filesystem, path_); struct wfp_static_filesystem_entry * entry = wfp_static_filesystem_add_entry(filesystem); entry->parent = parent; entry->is_file = true; - entry->name = strdup(wf_path_get_filename(path_)); + entry->name = strdup(wfp_path_get_filename(path_)); entry->mode = mode; entry->size = length; entry->get_info = &wfp_static_filesystem_entry_get_info; @@ -390,7 +390,7 @@ wfp_static_filesystem_add( entry->content = malloc(length); memcpy(entry->content, content, length); - wf_path_dispose(path_); + wfp_path_dispose(path_); } } diff --git a/test/webfuse_provider/utils/tempdir.hpp b/test/webfuse_provider/utils/tempdir.hpp index 6a03fc5..ecf8a61 100644 --- a/test/webfuse_provider/utils/tempdir.hpp +++ b/test/webfuse_provider/utils/tempdir.hpp @@ -1,5 +1,5 @@ -#ifndef WF_TEST_TEMPDIR_HPP -#define WF_TEST_TEMPDIR_HPP +#ifndef WFP_TEST_TEMPDIR_HPP +#define WFP_TEST_TEMPDIR_HPP namespace webfuse_test { diff --git a/test/webfuse_provider/utils/timeout_watcher.hpp b/test/webfuse_provider/utils/timeout_watcher.hpp index 3696dd1..f0119a9 100644 --- a/test/webfuse_provider/utils/timeout_watcher.hpp +++ b/test/webfuse_provider/utils/timeout_watcher.hpp @@ -1,5 +1,5 @@ -#ifndef WF_TEST_TIMEOUT_WATCHER_HPP -#define WF_TEST_TIMEOUT_WATCHER_HPP +#ifndef WFP_TEST_TIMEOUT_WATCHER_HPP +#define WFP_TEST_TIMEOUT_WATCHER_HPP #include #include diff --git a/test/webfuse_provider/utils/wrap.hpp b/test/webfuse_provider/utils/wrap.hpp index 30694de..bb34ff4 100644 --- a/test/webfuse_provider/utils/wrap.hpp +++ b/test/webfuse_provider/utils/wrap.hpp @@ -1,7 +1,7 @@ -#ifndef WF_WRAP_HPP -#define WF_WRAP_HPP +#ifndef WFP_WRAP_HPP +#define WFP_WRAP_HPP -#define WF_WRAP_FUNC0( GLOBAL_VAR, RETURN_TYPE, FUNC_NAME ) \ +#define WFP_WRAP_FUNC0( GLOBAL_VAR, RETURN_TYPE, FUNC_NAME ) \ extern RETURN_TYPE __real_ ## FUNC_NAME (); \ RETURN_TYPE __wrap_ ## FUNC_NAME () \ { \ @@ -15,7 +15,7 @@ } \ } -#define WF_WRAP_FUNC1( GLOBAL_VAR, RETURN_TYPE, FUNC_NAME, ARG1_TYPE ) \ +#define WFP_WRAP_FUNC1( GLOBAL_VAR, RETURN_TYPE, FUNC_NAME, ARG1_TYPE ) \ extern RETURN_TYPE __real_ ## FUNC_NAME (ARG1_TYPE); \ RETURN_TYPE __wrap_ ## FUNC_NAME (ARG1_TYPE arg1) \ { \ @@ -29,7 +29,7 @@ } \ } -#define WF_WRAP_FUNC2( GLOBAL_VAR, RETURN_TYPE, FUNC_NAME, ARG1_TYPE, ARG2_TYPE ) \ +#define WFP_WRAP_FUNC2( GLOBAL_VAR, RETURN_TYPE, FUNC_NAME, ARG1_TYPE, ARG2_TYPE ) \ extern RETURN_TYPE __real_ ## FUNC_NAME (ARG1_TYPE, ARG2_TYPE); \ RETURN_TYPE __wrap_ ## FUNC_NAME (ARG1_TYPE arg1, ARG2_TYPE arg2) \ { \ @@ -43,7 +43,7 @@ } \ } -#define WF_WRAP_FUNC3( GLOBAL_VAR, RETURN_TYPE, FUNC_NAME, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE ) \ +#define WFP_WRAP_FUNC3( GLOBAL_VAR, RETURN_TYPE, FUNC_NAME, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE ) \ extern RETURN_TYPE __real_ ## FUNC_NAME (ARG1_TYPE, ARG2_TYPE, ARG3_TYPE); \ RETURN_TYPE __wrap_ ## FUNC_NAME (ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3) \ { \ @@ -57,7 +57,7 @@ } \ } -#define WF_WRAP_FUNC4( GLOBAL_VAR, RETURN_TYPE, FUNC_NAME, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE ) \ +#define WFP_WRAP_FUNC4( GLOBAL_VAR, RETURN_TYPE, FUNC_NAME, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE ) \ extern RETURN_TYPE __real_ ## FUNC_NAME (ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE); \ RETURN_TYPE __wrap_ ## FUNC_NAME (ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4) \ { \ @@ -71,7 +71,7 @@ } \ } -#define WF_WRAP_FUNC5( GLOBAL_VAR, RETURN_TYPE, FUNC_NAME, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE ) \ +#define WFP_WRAP_FUNC5( GLOBAL_VAR, RETURN_TYPE, FUNC_NAME, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE ) \ extern RETURN_TYPE __real_ ## FUNC_NAME (ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE); \ RETURN_TYPE __wrap_ ## FUNC_NAME (ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5) \ { \ @@ -85,7 +85,7 @@ } \ } -#define WF_WRAP_FUNC6( GLOBAL_VAR, RETURN_TYPE, FUNC_NAME, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE ) \ +#define WFP_WRAP_FUNC6( GLOBAL_VAR, RETURN_TYPE, FUNC_NAME, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE ) \ extern RETURN_TYPE __real_ ## FUNC_NAME (ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, ARG6_TYPE); \ RETURN_TYPE __wrap_ ## FUNC_NAME (ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, ARG6_TYPE arg6) \ { \ @@ -100,7 +100,7 @@ } -#define WF_WRAP_VFUNC3( GLOBAL_VAR, RETURN_TYPE, FUNC_NAME, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE ) \ +#define WFP_WRAP_VFUNC3( GLOBAL_VAR, RETURN_TYPE, FUNC_NAME, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE ) \ extern RETURN_TYPE __real_ ## FUNC_NAME (ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, va_list); \ RETURN_TYPE __wrap_ ## FUNC_NAME (ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, va_list args) \ { \ @@ -114,7 +114,7 @@ } \ } -#define WF_WRAP_VFUNC5( GLOBAL_VAR, RETURN_TYPE, FUNC_NAME, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE ) \ +#define WFP_WRAP_VFUNC5( GLOBAL_VAR, RETURN_TYPE, FUNC_NAME, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE ) \ extern RETURN_TYPE __real_ ## FUNC_NAME (ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, va_list); \ RETURN_TYPE __wrap_ ## FUNC_NAME (ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, va_list args) \ { \ diff --git a/test/webfuse_provider/utils/ws_server.cc b/test/webfuse_provider/utils/ws_server.cc index 908131b..3c7a4ca 100644 --- a/test/webfuse_provider/utils/ws_server.cc +++ b/test/webfuse_provider/utils/ws_server.cc @@ -63,7 +63,7 @@ private: extern "C" { -static int wf_test_utils_ws_server_callback( +static int wfp_test_utils_ws_server_callback( struct lws * wsi, enum lws_callback_reasons reason, void * user, @@ -146,12 +146,12 @@ WsServer::Private::Private(std::string const & protocol, int port) , is_shutdown_requested(false) , wsi_(nullptr) { - wf_lwslog_disable(); + wfp_lwslog_disable(); IServer * server = this; memset(ws_protocols, 0, sizeof(struct lws_protocols) * 2 ); ws_protocols[0].name = protocol_.c_str(); - ws_protocols[0].callback = &wf_test_utils_ws_server_callback; + ws_protocols[0].callback = &wfp_test_utils_ws_server_callback; ws_protocols[0].per_session_data_size = 0; ws_protocols[0].user = reinterpret_cast(server); diff --git a/test/webfuse_provider/utils/ws_server.h b/test/webfuse_provider/utils/ws_server.h index a51f695..8c28005 100644 --- a/test/webfuse_provider/utils/ws_server.h +++ b/test/webfuse_provider/utils/ws_server.h @@ -1,5 +1,5 @@ -#ifndef WF_TEST_UTILS_WS_SERVER_HPP -#define WF_TEST_UTILS_WS_SERVER_HPP +#ifndef WFP_TEST_UTILS_WS_SERVER_HPP +#define WFP_TEST_UTILS_WS_SERVER_HPP #include #include diff --git a/test/webfuse_provider/utils/ws_server2.cc b/test/webfuse_provider/utils/ws_server2.cc index a11f4c3..8e1ef64 100644 --- a/test/webfuse_provider/utils/ws_server2.cc +++ b/test/webfuse_provider/utils/ws_server2.cc @@ -26,7 +26,7 @@ public: extern "C" { -static int wf_test_utils_ws_server_callback( +static int wfp_test_utils_ws_server_callback( struct lws * wsi, enum lws_callback_reasons reason, void * user, @@ -150,12 +150,12 @@ WsServer2::Private::Private( , is_shutdown_requested(false) , wsi_(nullptr) { - wf_lwslog_disable(); + wfp_lwslog_disable(); IServer * server = this; memset(ws_protocols, 0, sizeof(struct lws_protocols) * 2 ); ws_protocols[0].name = protocol_.c_str(); - ws_protocols[0].callback = &wf_test_utils_ws_server_callback; + ws_protocols[0].callback = &wfp_test_utils_ws_server_callback; ws_protocols[0].per_session_data_size = 0; ws_protocols[0].user = reinterpret_cast(server); diff --git a/test/webfuse_provider/utils/ws_server2.hpp b/test/webfuse_provider/utils/ws_server2.hpp index b29ffb1..dea3d63 100644 --- a/test/webfuse_provider/utils/ws_server2.hpp +++ b/test/webfuse_provider/utils/ws_server2.hpp @@ -1,5 +1,5 @@ -#ifndef WF_TEST_UTILS_WS_SERVER2_HPP -#define WF_TEST_UTILS_WS_SERVER2_HPP +#ifndef WFP_TEST_UTILS_WS_SERVER2_HPP +#define WFP_TEST_UTILS_WS_SERVER2_HPP #include #include