1
0
mirror of https://github.com/falk-werner/webfuse synced 2025-06-13 12:54:15 +00:00

updates provider to support changed protocol

This commit is contained in:
Falk Werner 2019-04-14 19:17:10 +02:00
parent 043a0f18bc
commit ac349dcde9
7 changed files with 40 additions and 19 deletions

View File

@ -45,6 +45,26 @@ static void wfp_impl_client_protocol_process_request(
}
}
static void wfp_impl_client_protocol_add_filesystem(
struct wfp_client_protocol * protocol)
{
json_t * params = json_array();
json_array_append_new(params, json_string("cprovider"));
json_t * request = json_object();
json_object_set_new(request, "method", json_string("add_filesystem"));
json_object_set_new(request, "params", params);
json_object_set_new(request, "id", json_integer(42));
struct wf_message * message = wf_message_create(request);
if (NULL != message)
{
wf_message_queue_push(&protocol->queue, message);
lws_callback_on_writable(protocol->wsi);
}
json_decref(request);
}
static int wfp_impl_client_protocol_callback(
struct lws * wsi,
@ -61,6 +81,7 @@ static int wfp_impl_client_protocol_callback(
switch (reason)
{
case LWS_CALLBACK_CLIENT_ESTABLISHED:
wfp_impl_client_protocol_add_filesystem(protocol);
protocol->provider.connected(protocol->user_data);
break;
case LWS_CALLBACK_CLIENT_CONNECTION_ERROR:

View File

@ -8,11 +8,11 @@ void wfp_impl_close(
int WF_UNUSED_PARAM(id))
{
size_t const param_count = json_array_size(params);
if (3 == param_count)
if (4 == param_count)
{
json_t * inode_holder = json_array_get(params, 0);
json_t * handle_holder = json_array_get(params, 1);
json_t * flags_holder = json_array_get(params, 2);
json_t * inode_holder = json_array_get(params, 1);
json_t * handle_holder = json_array_get(params, 2);
json_t * flags_holder = json_array_get(params, 3);
if (json_is_integer(inode_holder) &&
json_is_integer(handle_holder) &&

View File

@ -13,9 +13,9 @@ void wfp_impl_getattr(
int id)
{
size_t const count = json_array_size(params);
if (1 == count)
if (2 == count)
{
json_t * inode_holder = json_array_get(params, 0);
json_t * inode_holder = json_array_get(params, 1);
if (json_is_integer(inode_holder))
{

View File

@ -12,10 +12,10 @@ void wfp_impl_lookup(
int id)
{
size_t const count = json_array_size(params);
if (2 == count)
if (3 == count)
{
json_t * inode_holder = json_array_get(params, 0);
json_t * name_holder = json_array_get(params, 1);
json_t * inode_holder = json_array_get(params, 1);
json_t * name_holder = json_array_get(params, 2);
if (json_is_integer(inode_holder) &&
json_is_string(name_holder))

View File

@ -9,10 +9,10 @@ void wfp_impl_open(
int id)
{
size_t const count = json_array_size(params);
if (2 == count)
if (3 == count)
{
json_t * inode_holder = json_array_get(params, 0);
json_t * flags_holder = json_array_get(params, 1);
json_t * inode_holder = json_array_get(params, 1);
json_t * flags_holder = json_array_get(params, 2);
if (json_is_integer(inode_holder) &&
json_is_integer(flags_holder))

View File

@ -13,12 +13,12 @@ void wfp_impl_read(
int id)
{
size_t const count = json_array_size(params);
if (4 == count)
if (5 == count)
{
json_t * inode_holder = json_array_get(params, 0);
json_t * handle_holder = json_array_get(params, 1);
json_t * offset_holder = json_array_get(params, 2);
json_t * length_holder = json_array_get(params, 3);
json_t * inode_holder = json_array_get(params, 1);
json_t * handle_holder = json_array_get(params, 2);
json_t * offset_holder = json_array_get(params, 3);
json_t * length_holder = json_array_get(params, 4);
if (json_is_integer(inode_holder) &&
json_is_integer(handle_holder) &&

View File

@ -10,9 +10,9 @@ void wfp_impl_readdir(
int id)
{
size_t const count = json_array_size(params);
if (1 == count)
if (2 == count)
{
json_t * inode_holder = json_array_get(params, 0);
json_t * inode_holder = json_array_get(params, 1);
if ((NULL != inode_holder) && (json_is_integer(inode_holder)))
{