Obtaining the method for remote calls
This commit is contained in:
parent
b8db50354e
commit
658c03d984
|
@ -81,6 +81,7 @@ AppMessage * appmessage_new_deserialize(Buffer * buffer)
|
||||||
AppMessage * message;
|
AppMessage * message;
|
||||||
char const * data = buffer_get_data(buffer);
|
char const * data = buffer_get_data(buffer);
|
||||||
size_t size = buffer_get_size(buffer);
|
size_t size = buffer_get_size(buffer);
|
||||||
|
size_t pos = 0;
|
||||||
size_t s;
|
size_t s;
|
||||||
Variable * v;
|
Variable * v;
|
||||||
uint32_t u32;
|
uint32_t u32;
|
||||||
|
@ -91,11 +92,14 @@ AppMessage * appmessage_new_deserialize(Buffer * buffer)
|
||||||
if((message = object_new(sizeof(*message))) == NULL)
|
if((message = object_new(sizeof(*message))) == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
s = size;
|
s = size;
|
||||||
if((v = variable_new_deserialize_type(VT_UINT32, &s, data)) == NULL)
|
if((v = variable_new_deserialize_type(VT_UINT32, &s, &data[pos]))
|
||||||
|
== NULL)
|
||||||
{
|
{
|
||||||
object_delete(message);
|
object_delete(message);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
pos += s;
|
||||||
|
size -= s;
|
||||||
/* XXX may fail */
|
/* XXX may fail */
|
||||||
variable_get_as(v, VT_UINT32, &u32);
|
variable_get_as(v, VT_UINT32, &u32);
|
||||||
variable_delete(v);
|
variable_delete(v);
|
||||||
|
@ -105,8 +109,19 @@ AppMessage * appmessage_new_deserialize(Buffer * buffer)
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stderr, "DEBUG: %s() AMT_CALL\n", __func__);
|
fprintf(stderr, "DEBUG: %s() AMT_CALL\n", __func__);
|
||||||
#endif
|
#endif
|
||||||
|
s = size;
|
||||||
|
v = variable_new_deserialize_type(VT_STRING, &s,
|
||||||
|
&data[pos]);
|
||||||
|
if(v == NULL)
|
||||||
|
{
|
||||||
|
error_set_code(1, "%s%u", "Unknown method ");
|
||||||
|
object_delete(message);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
/* XXX may fail */
|
||||||
|
variable_get_as(v, VT_STRING, &message->t.call.method);
|
||||||
|
variable_delete(v);
|
||||||
/* FIXME really implement */
|
/* FIXME really implement */
|
||||||
message->t.call.method = NULL;
|
|
||||||
message->t.call.var = NULL;
|
message->t.call.var = NULL;
|
||||||
message->t.call.var_cnt = 0;
|
message->t.call.var_cnt = 0;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
/* Copyright (c) 2012 Pierre Pronchery <khorben@defora.org> */
|
/* Copyright (c) 2012-2013 Pierre Pronchery <khorben@defora.org> */
|
||||||
/* This file is part of DeforaOS System libApp */
|
/* This file is part of DeforaOS System libApp */
|
||||||
/* This program is free software: you can redistribute it and/or modify
|
/* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -15,8 +15,12 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
# include <stdio.h>
|
||||||
|
#endif
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <System.h>
|
#include <System.h>
|
||||||
|
#include "App/appmessage.h"
|
||||||
#include "apptransport.h"
|
#include "apptransport.h"
|
||||||
#include "../config.h"
|
#include "../config.h"
|
||||||
|
|
||||||
|
@ -105,6 +109,11 @@ void apptransport_delete(AppTransport * transport)
|
||||||
static int _apptransport_helper_client_receive(AppTransport * transport,
|
static int _apptransport_helper_client_receive(AppTransport * transport,
|
||||||
AppTransportClient * client, AppMessage * message)
|
AppTransportClient * client, AppMessage * message)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG
|
||||||
|
fprintf(stderr, "DEBUG: %s() %u \"%s\"\n", __func__,
|
||||||
|
appmessage_get_type(message),
|
||||||
|
appmessage_get_method(message));
|
||||||
|
#endif
|
||||||
/* FIXME implement */
|
/* FIXME implement */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user