2017-03-03 19:06:54 +01:00
|
|
|
/* Pinos
|
|
|
|
|
* Copyright (C) 2017 Wim Taymans <wim.taymans@gmail.com>
|
|
|
|
|
*
|
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
* Library General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
|
* Boston, MA 02110-1301, USA.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <errno.h>
|
|
|
|
|
|
2017-03-07 11:56:43 +01:00
|
|
|
#include "spa/pod-iter.h"
|
2017-03-03 19:06:54 +01:00
|
|
|
#include "pinos/client/pinos.h"
|
|
|
|
|
|
|
|
|
|
#include "pinos/client/protocol-native.h"
|
|
|
|
|
#include "pinos/client/interfaces.h"
|
|
|
|
|
#include "pinos/client/connection.h"
|
|
|
|
|
|
2017-03-06 15:48:04 +01:00
|
|
|
typedef struct {
|
|
|
|
|
SpaPODBuilder b;
|
|
|
|
|
PinosConnection *connection;
|
|
|
|
|
} Builder;
|
|
|
|
|
|
2017-03-09 13:00:56 +01:00
|
|
|
typedef bool (*PinosDemarshalFunc) (void *object, void *data, size_t size);
|
|
|
|
|
|
2017-03-07 11:56:43 +01:00
|
|
|
static uint32_t
|
|
|
|
|
write_pod (SpaPODBuilder *b, uint32_t ref, const void *data, uint32_t size)
|
2017-03-06 15:48:04 +01:00
|
|
|
{
|
|
|
|
|
if (ref == -1)
|
|
|
|
|
ref = b->offset;
|
|
|
|
|
|
|
|
|
|
if (b->size <= b->offset) {
|
2017-03-09 19:42:35 +01:00
|
|
|
b->size = SPA_ROUND_UP_N (b->offset + size, 4096);
|
2017-03-06 15:48:04 +01:00
|
|
|
b->data = pinos_connection_begin_write (((Builder*)b)->connection, b->size);
|
|
|
|
|
}
|
|
|
|
|
memcpy (b->data + ref, data, size);
|
|
|
|
|
return ref;
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-14 20:18:31 +01:00
|
|
|
static void
|
|
|
|
|
core_update_map (PinosContext *context)
|
|
|
|
|
{
|
|
|
|
|
uint32_t diff, base, i;
|
2017-03-24 11:40:58 +01:00
|
|
|
const char **types;
|
2017-03-14 20:18:31 +01:00
|
|
|
|
2017-03-24 11:40:58 +01:00
|
|
|
base = context->n_types;
|
|
|
|
|
diff = spa_type_map_get_size (context->type.map) - base;
|
2017-03-14 20:18:31 +01:00
|
|
|
if (diff == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
2017-03-24 11:40:58 +01:00
|
|
|
types = alloca (diff * sizeof (char *));
|
2017-03-14 20:18:31 +01:00
|
|
|
for (i = 0; i < diff; i++, base++)
|
2017-03-24 11:40:58 +01:00
|
|
|
types[i] = spa_type_map_get_type (context->type.map, base);
|
2017-03-14 20:18:31 +01:00
|
|
|
|
2017-03-24 11:40:58 +01:00
|
|
|
pinos_core_do_update_types (context->core_proxy,
|
|
|
|
|
context->n_types,
|
|
|
|
|
diff,
|
|
|
|
|
types);
|
|
|
|
|
context->n_types += diff;
|
2017-03-14 20:18:31 +01:00
|
|
|
}
|
|
|
|
|
|
2017-03-03 19:06:54 +01:00
|
|
|
static void
|
2017-03-06 15:48:04 +01:00
|
|
|
core_marshal_client_update (void *object,
|
2017-03-07 17:23:35 +01:00
|
|
|
const SpaDict *props)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosProxy *proxy = object;
|
|
|
|
|
PinosConnection *connection = proxy->context->protocol_private;
|
2017-03-06 15:48:04 +01:00
|
|
|
Builder b = { { NULL, 0, 0, NULL, write_pod }, connection };
|
|
|
|
|
SpaPODFrame f;
|
|
|
|
|
int i, n_items;
|
|
|
|
|
|
2017-03-14 20:18:31 +01:00
|
|
|
core_update_map (proxy->context);
|
|
|
|
|
|
2017-03-06 15:48:04 +01:00
|
|
|
n_items = props ? props->n_items : 0;
|
2017-03-07 17:23:35 +01:00
|
|
|
|
|
|
|
|
spa_pod_builder_add (&b.b,
|
|
|
|
|
SPA_POD_TYPE_STRUCT, &f,
|
|
|
|
|
SPA_POD_TYPE_INT, n_items, 0);
|
|
|
|
|
|
2017-03-06 15:48:04 +01:00
|
|
|
for (i = 0; i < n_items; i++) {
|
2017-03-07 17:23:35 +01:00
|
|
|
spa_pod_builder_add (&b.b,
|
|
|
|
|
SPA_POD_TYPE_STRING, props->items[i].key,
|
|
|
|
|
SPA_POD_TYPE_STRING, props->items[i].value,
|
|
|
|
|
0);
|
2017-03-06 15:48:04 +01:00
|
|
|
}
|
2017-03-07 17:23:35 +01:00
|
|
|
spa_pod_builder_add (&b.b, -SPA_POD_TYPE_STRUCT, &f, 0);
|
2017-03-03 19:06:54 +01:00
|
|
|
|
2017-03-06 15:48:04 +01:00
|
|
|
pinos_connection_end_write (connection, proxy->id, 0, b.b.offset);
|
2017-03-03 19:06:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2017-03-06 15:48:04 +01:00
|
|
|
core_marshal_sync (void *object,
|
2017-03-07 17:23:35 +01:00
|
|
|
uint32_t seq)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosProxy *proxy = object;
|
|
|
|
|
PinosConnection *connection = proxy->context->protocol_private;
|
2017-03-06 15:48:04 +01:00
|
|
|
Builder b = { { NULL, 0, 0, NULL, write_pod }, connection };
|
|
|
|
|
SpaPODFrame f;
|
|
|
|
|
|
2017-03-14 20:18:31 +01:00
|
|
|
core_update_map (proxy->context);
|
|
|
|
|
|
2017-03-17 11:58:09 +01:00
|
|
|
spa_pod_builder_struct (&b.b, &f,
|
|
|
|
|
SPA_POD_TYPE_INT, seq);
|
2017-03-03 19:06:54 +01:00
|
|
|
|
2017-03-06 15:48:04 +01:00
|
|
|
pinos_connection_end_write (connection, proxy->id, 1, b.b.offset);
|
2017-03-03 19:06:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2017-03-06 15:48:04 +01:00
|
|
|
core_marshal_get_registry (void *object,
|
2017-03-07 17:23:35 +01:00
|
|
|
uint32_t new_id)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosProxy *proxy = object;
|
|
|
|
|
PinosConnection *connection = proxy->context->protocol_private;
|
2017-03-06 15:48:04 +01:00
|
|
|
Builder b = { { NULL, 0, 0, NULL, write_pod }, connection };
|
|
|
|
|
SpaPODFrame f;
|
2017-03-03 19:06:54 +01:00
|
|
|
|
2017-03-14 20:18:31 +01:00
|
|
|
core_update_map (proxy->context);
|
|
|
|
|
|
2017-03-17 11:58:09 +01:00
|
|
|
spa_pod_builder_struct (&b.b, &f,
|
|
|
|
|
SPA_POD_TYPE_INT, new_id);
|
2017-03-06 15:48:04 +01:00
|
|
|
|
|
|
|
|
pinos_connection_end_write (connection, proxy->id, 2, b.b.offset);
|
2017-03-03 19:06:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2017-03-06 15:48:04 +01:00
|
|
|
core_marshal_create_node (void *object,
|
2017-03-07 17:23:35 +01:00
|
|
|
const char *factory_name,
|
|
|
|
|
const char *name,
|
|
|
|
|
const SpaDict *props,
|
|
|
|
|
uint32_t new_id)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosProxy *proxy = object;
|
|
|
|
|
PinosConnection *connection = proxy->context->protocol_private;
|
2017-03-06 15:48:04 +01:00
|
|
|
Builder b = { { NULL, 0, 0, NULL, write_pod }, connection };
|
|
|
|
|
SpaPODFrame f;
|
2017-03-07 17:23:35 +01:00
|
|
|
uint32_t i, n_items;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
2017-03-14 20:18:31 +01:00
|
|
|
core_update_map (proxy->context);
|
|
|
|
|
|
2017-03-06 15:48:04 +01:00
|
|
|
n_items = props ? props->n_items : 0;
|
2017-03-07 17:23:35 +01:00
|
|
|
|
|
|
|
|
spa_pod_builder_add (&b.b,
|
|
|
|
|
SPA_POD_TYPE_STRUCT, &f,
|
|
|
|
|
SPA_POD_TYPE_STRING, factory_name,
|
|
|
|
|
SPA_POD_TYPE_STRING, name,
|
|
|
|
|
SPA_POD_TYPE_INT, n_items, 0);
|
|
|
|
|
|
2017-03-06 15:48:04 +01:00
|
|
|
for (i = 0; i < n_items; i++) {
|
2017-03-07 17:23:35 +01:00
|
|
|
spa_pod_builder_add (&b.b,
|
|
|
|
|
SPA_POD_TYPE_STRING, props->items[i].key,
|
|
|
|
|
SPA_POD_TYPE_STRING, props->items[i].value,
|
|
|
|
|
0);
|
2017-03-06 15:48:04 +01:00
|
|
|
}
|
2017-03-07 17:23:35 +01:00
|
|
|
spa_pod_builder_add (&b.b,
|
|
|
|
|
SPA_POD_TYPE_INT, new_id,
|
|
|
|
|
-SPA_POD_TYPE_STRUCT, &f, 0);
|
2017-03-03 19:06:54 +01:00
|
|
|
|
2017-03-06 15:48:04 +01:00
|
|
|
pinos_connection_end_write (connection, proxy->id, 3, b.b.offset);
|
2017-03-03 19:06:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2017-03-06 15:48:04 +01:00
|
|
|
core_marshal_create_client_node (void *object,
|
|
|
|
|
const char *name,
|
|
|
|
|
const SpaDict *props,
|
|
|
|
|
uint32_t new_id)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosProxy *proxy = object;
|
|
|
|
|
PinosConnection *connection = proxy->context->protocol_private;
|
2017-03-06 15:48:04 +01:00
|
|
|
Builder b = { { NULL, 0, 0, NULL, write_pod }, connection };
|
|
|
|
|
SpaPODFrame f;
|
2017-03-07 17:23:35 +01:00
|
|
|
uint32_t i, n_items;
|
2017-03-03 19:06:54 +01:00
|
|
|
|
2017-03-14 20:18:31 +01:00
|
|
|
core_update_map (proxy->context);
|
|
|
|
|
|
2017-03-06 15:48:04 +01:00
|
|
|
n_items = props ? props->n_items : 0;
|
2017-03-07 17:23:35 +01:00
|
|
|
|
|
|
|
|
spa_pod_builder_add (&b.b,
|
|
|
|
|
SPA_POD_TYPE_STRUCT, &f,
|
|
|
|
|
SPA_POD_TYPE_STRING, name,
|
|
|
|
|
SPA_POD_TYPE_INT, n_items, 0);
|
|
|
|
|
|
2017-03-06 15:48:04 +01:00
|
|
|
for (i = 0; i < n_items; i++) {
|
2017-03-07 17:23:35 +01:00
|
|
|
spa_pod_builder_add (&b.b,
|
|
|
|
|
SPA_POD_TYPE_STRING, props->items[i].key,
|
|
|
|
|
SPA_POD_TYPE_STRING, props->items[i].value,
|
|
|
|
|
0);
|
2017-03-06 15:48:04 +01:00
|
|
|
}
|
2017-03-07 17:23:35 +01:00
|
|
|
spa_pod_builder_add (&b.b,
|
|
|
|
|
SPA_POD_TYPE_INT, new_id,
|
|
|
|
|
-SPA_POD_TYPE_STRUCT, &f, 0);
|
2017-03-03 19:06:54 +01:00
|
|
|
|
2017-03-06 15:48:04 +01:00
|
|
|
pinos_connection_end_write (connection, proxy->id, 4, b.b.offset);
|
2017-03-03 19:06:54 +01:00
|
|
|
}
|
|
|
|
|
|
2017-03-14 20:18:31 +01:00
|
|
|
static void
|
2017-03-24 11:40:58 +01:00
|
|
|
core_marshal_update_types (void *object,
|
|
|
|
|
uint32_t first_id,
|
|
|
|
|
uint32_t n_types,
|
|
|
|
|
const char **types)
|
2017-03-14 20:18:31 +01:00
|
|
|
{
|
|
|
|
|
PinosProxy *proxy = object;
|
|
|
|
|
PinosConnection *connection = proxy->context->protocol_private;
|
|
|
|
|
Builder b = { { NULL, 0, 0, NULL, write_pod }, connection };
|
|
|
|
|
SpaPODFrame f;
|
|
|
|
|
uint32_t i;
|
|
|
|
|
|
|
|
|
|
spa_pod_builder_add (&b.b,
|
|
|
|
|
SPA_POD_TYPE_STRUCT, &f,
|
|
|
|
|
SPA_POD_TYPE_INT, first_id,
|
2017-03-24 11:40:58 +01:00
|
|
|
SPA_POD_TYPE_INT, n_types, 0);
|
2017-03-14 20:18:31 +01:00
|
|
|
|
2017-03-24 11:40:58 +01:00
|
|
|
for (i = 0; i < n_types; i++) {
|
2017-03-14 20:18:31 +01:00
|
|
|
spa_pod_builder_add (&b.b,
|
2017-03-24 11:40:58 +01:00
|
|
|
SPA_POD_TYPE_STRING, types[i], 0);
|
2017-03-14 20:18:31 +01:00
|
|
|
}
|
|
|
|
|
spa_pod_builder_add (&b.b,
|
|
|
|
|
-SPA_POD_TYPE_STRUCT, &f, 0);
|
|
|
|
|
|
|
|
|
|
pinos_connection_end_write (connection, proxy->id, 5, b.b.offset);
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-07 17:23:35 +01:00
|
|
|
static bool
|
2017-03-06 15:48:04 +01:00
|
|
|
core_demarshal_info (void *object,
|
|
|
|
|
void *data,
|
|
|
|
|
size_t size)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosProxy *proxy = object;
|
2017-03-06 15:48:04 +01:00
|
|
|
SpaDict props;
|
|
|
|
|
PinosCoreInfo info;
|
2017-03-07 11:56:43 +01:00
|
|
|
SpaPODIter it;
|
2017-03-06 15:48:04 +01:00
|
|
|
int i;
|
|
|
|
|
|
2017-03-07 11:56:43 +01:00
|
|
|
if (!spa_pod_iter_struct (&it, data, size) ||
|
|
|
|
|
!spa_pod_iter_get (&it,
|
|
|
|
|
SPA_POD_TYPE_INT, &info.id,
|
|
|
|
|
SPA_POD_TYPE_LONG, &info.change_mask,
|
|
|
|
|
SPA_POD_TYPE_STRING, &info.user_name,
|
|
|
|
|
SPA_POD_TYPE_STRING, &info.host_name,
|
|
|
|
|
SPA_POD_TYPE_STRING, &info.version,
|
|
|
|
|
SPA_POD_TYPE_STRING, &info.name,
|
|
|
|
|
SPA_POD_TYPE_INT, &info.cookie,
|
|
|
|
|
SPA_POD_TYPE_INT, &props.n_items,
|
|
|
|
|
0))
|
2017-03-07 17:23:35 +01:00
|
|
|
return false;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
|
|
|
|
info.props = &props;
|
|
|
|
|
props.items = alloca (props.n_items * sizeof (SpaDictItem));
|
|
|
|
|
for (i = 0; i < props.n_items; i++) {
|
2017-03-07 11:56:43 +01:00
|
|
|
if (!spa_pod_iter_get (&it,
|
|
|
|
|
SPA_POD_TYPE_STRING, &props.items[i].key,
|
|
|
|
|
SPA_POD_TYPE_STRING, &props.items[i].value,
|
|
|
|
|
0))
|
2017-03-07 17:23:35 +01:00
|
|
|
return false;
|
2017-03-06 15:48:04 +01:00
|
|
|
}
|
2017-03-09 13:00:56 +01:00
|
|
|
((PinosCoreEvents*)proxy->implementation)->info (proxy, &info);
|
2017-03-07 17:23:35 +01:00
|
|
|
return true;
|
2017-03-06 15:48:04 +01:00
|
|
|
}
|
|
|
|
|
|
2017-03-07 17:23:35 +01:00
|
|
|
static bool
|
2017-03-06 15:48:04 +01:00
|
|
|
core_demarshal_done (void *object,
|
2017-03-03 19:06:54 +01:00
|
|
|
void *data,
|
|
|
|
|
size_t size)
|
|
|
|
|
{
|
|
|
|
|
PinosProxy *proxy = object;
|
2017-03-07 11:56:43 +01:00
|
|
|
SpaPODIter it;
|
|
|
|
|
uint32_t seq;
|
2017-03-03 19:06:54 +01:00
|
|
|
|
2017-03-07 11:56:43 +01:00
|
|
|
if (!spa_pod_iter_struct (&it, data, size) ||
|
|
|
|
|
!spa_pod_iter_get (&it,
|
|
|
|
|
SPA_POD_TYPE_INT, &seq,
|
|
|
|
|
0))
|
2017-03-07 17:23:35 +01:00
|
|
|
return false;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
2017-03-09 13:00:56 +01:00
|
|
|
((PinosCoreEvents*)proxy->implementation)->done (proxy, seq);
|
2017-03-07 17:23:35 +01:00
|
|
|
return true;
|
2017-03-03 19:06:54 +01:00
|
|
|
}
|
|
|
|
|
|
2017-03-07 17:23:35 +01:00
|
|
|
static bool
|
2017-03-06 15:48:04 +01:00
|
|
|
core_demarshal_error (void *object,
|
2017-03-03 19:06:54 +01:00
|
|
|
void *data,
|
|
|
|
|
size_t size)
|
|
|
|
|
{
|
|
|
|
|
PinosProxy *proxy = object;
|
2017-03-07 11:56:43 +01:00
|
|
|
SpaPODIter it;
|
|
|
|
|
uint32_t id, res;
|
2017-03-06 15:48:04 +01:00
|
|
|
const char *error;
|
|
|
|
|
|
2017-03-07 11:56:43 +01:00
|
|
|
if (!spa_pod_iter_struct (&it, data, size) ||
|
|
|
|
|
!spa_pod_iter_get (&it,
|
|
|
|
|
SPA_POD_TYPE_INT, &id,
|
|
|
|
|
SPA_POD_TYPE_INT, &res,
|
|
|
|
|
SPA_POD_TYPE_STRING, &error,
|
|
|
|
|
0))
|
2017-03-07 17:23:35 +01:00
|
|
|
return false;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
2017-03-09 13:00:56 +01:00
|
|
|
((PinosCoreEvents*)proxy->implementation)->error (proxy, id, res, error);
|
2017-03-07 17:23:35 +01:00
|
|
|
return true;
|
2017-03-03 19:06:54 +01:00
|
|
|
}
|
|
|
|
|
|
2017-03-07 17:23:35 +01:00
|
|
|
static bool
|
2017-03-06 15:48:04 +01:00
|
|
|
core_demarshal_remove_id (void *object,
|
|
|
|
|
void *data,
|
|
|
|
|
size_t size)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosProxy *proxy = object;
|
2017-03-07 11:56:43 +01:00
|
|
|
SpaPODIter it;
|
|
|
|
|
uint32_t id;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
2017-03-07 11:56:43 +01:00
|
|
|
if (!spa_pod_iter_struct (&it, data, size) ||
|
|
|
|
|
!spa_pod_iter_get (&it,
|
|
|
|
|
SPA_POD_TYPE_INT, &id,
|
|
|
|
|
0))
|
2017-03-07 17:23:35 +01:00
|
|
|
return false;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
2017-03-09 13:00:56 +01:00
|
|
|
((PinosCoreEvents*)proxy->implementation)->remove_id (proxy, id);
|
2017-03-07 17:23:35 +01:00
|
|
|
return true;
|
2017-03-03 19:06:54 +01:00
|
|
|
}
|
|
|
|
|
|
2017-03-14 20:18:31 +01:00
|
|
|
static bool
|
2017-03-24 11:40:58 +01:00
|
|
|
core_demarshal_update_types (void *object,
|
|
|
|
|
void *data,
|
|
|
|
|
size_t size)
|
2017-03-14 20:18:31 +01:00
|
|
|
{
|
|
|
|
|
PinosProxy *proxy = object;
|
|
|
|
|
SpaPODIter it;
|
2017-03-24 11:40:58 +01:00
|
|
|
uint32_t first_id, n_types;
|
|
|
|
|
const char **types;
|
2017-03-14 20:18:31 +01:00
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
if (!spa_pod_iter_struct (&it, data, size) ||
|
|
|
|
|
!spa_pod_iter_get (&it,
|
|
|
|
|
SPA_POD_TYPE_INT, &first_id,
|
2017-03-24 11:40:58 +01:00
|
|
|
SPA_POD_TYPE_INT, &n_types,
|
2017-03-14 20:18:31 +01:00
|
|
|
0))
|
|
|
|
|
return false;
|
|
|
|
|
|
2017-03-24 11:40:58 +01:00
|
|
|
types = alloca (n_types * sizeof (char *));
|
|
|
|
|
for (i = 0; i < n_types; i++) {
|
|
|
|
|
if (!spa_pod_iter_get (&it, SPA_POD_TYPE_STRING, &types[i], 0))
|
2017-03-14 20:18:31 +01:00
|
|
|
return false;
|
|
|
|
|
}
|
2017-03-24 11:40:58 +01:00
|
|
|
((PinosCoreEvents*)proxy->implementation)->update_types (proxy, first_id, n_types, types);
|
2017-03-14 20:18:31 +01:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-07 17:23:35 +01:00
|
|
|
static bool
|
2017-03-06 15:48:04 +01:00
|
|
|
module_demarshal_info (void *object,
|
|
|
|
|
void *data,
|
|
|
|
|
size_t size)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosProxy *proxy = object;
|
2017-03-07 11:56:43 +01:00
|
|
|
SpaPODIter it;
|
2017-03-06 15:48:04 +01:00
|
|
|
SpaDict props;
|
|
|
|
|
PinosModuleInfo info;
|
|
|
|
|
int i;
|
|
|
|
|
|
2017-03-07 11:56:43 +01:00
|
|
|
if (!spa_pod_iter_struct (&it, data, size) ||
|
|
|
|
|
!spa_pod_iter_get (&it,
|
|
|
|
|
SPA_POD_TYPE_INT, &info.id,
|
|
|
|
|
SPA_POD_TYPE_LONG, &info.change_mask,
|
|
|
|
|
SPA_POD_TYPE_STRING, &info.name,
|
|
|
|
|
SPA_POD_TYPE_STRING, &info.filename,
|
|
|
|
|
SPA_POD_TYPE_STRING, &info.args,
|
|
|
|
|
SPA_POD_TYPE_INT, &props.n_items,
|
|
|
|
|
0))
|
2017-03-07 17:23:35 +01:00
|
|
|
return false;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
|
|
|
|
info.props = &props;
|
|
|
|
|
props.items = alloca (props.n_items * sizeof (SpaDictItem));
|
|
|
|
|
for (i = 0; i < props.n_items; i++) {
|
2017-03-07 11:56:43 +01:00
|
|
|
if (!spa_pod_iter_get (&it,
|
|
|
|
|
SPA_POD_TYPE_STRING, &props.items[i].key,
|
|
|
|
|
SPA_POD_TYPE_STRING, &props.items[i].value,
|
|
|
|
|
0))
|
2017-03-07 17:23:35 +01:00
|
|
|
return false;
|
2017-03-06 15:48:04 +01:00
|
|
|
}
|
2017-03-09 13:00:56 +01:00
|
|
|
((PinosModuleEvents*)proxy->implementation)->info (proxy, &info);
|
2017-03-07 17:23:35 +01:00
|
|
|
return true;
|
2017-03-03 19:06:54 +01:00
|
|
|
}
|
|
|
|
|
|
2017-03-07 17:23:35 +01:00
|
|
|
static bool
|
2017-03-06 15:48:04 +01:00
|
|
|
node_demarshal_info (void *object,
|
|
|
|
|
void *data,
|
|
|
|
|
size_t size)
|
|
|
|
|
{
|
|
|
|
|
PinosProxy *proxy = object;
|
2017-03-07 11:56:43 +01:00
|
|
|
SpaPODIter it;
|
2017-03-06 15:48:04 +01:00
|
|
|
SpaDict props;
|
|
|
|
|
PinosNodeInfo info;
|
|
|
|
|
int i;
|
|
|
|
|
|
2017-03-07 11:56:43 +01:00
|
|
|
if (!spa_pod_iter_struct (&it, data, size) ||
|
|
|
|
|
!spa_pod_iter_get (&it,
|
|
|
|
|
SPA_POD_TYPE_INT, &info.id,
|
|
|
|
|
SPA_POD_TYPE_LONG, &info.change_mask,
|
|
|
|
|
SPA_POD_TYPE_STRING, &info.name,
|
|
|
|
|
SPA_POD_TYPE_INT, &info.max_inputs,
|
|
|
|
|
SPA_POD_TYPE_INT, &info.n_inputs,
|
|
|
|
|
SPA_POD_TYPE_INT, &info.n_input_formats,
|
|
|
|
|
0))
|
2017-03-07 17:23:35 +01:00
|
|
|
return false;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
|
|
|
|
info.input_formats = alloca (info.n_input_formats * sizeof (SpaFormat*));
|
|
|
|
|
for (i = 0; i < info.n_input_formats; i++)
|
2017-03-07 17:23:35 +01:00
|
|
|
if (!spa_pod_iter_get (&it, SPA_POD_TYPE_OBJECT, &info.input_formats[i], 0))
|
|
|
|
|
return false;
|
2017-03-07 11:56:43 +01:00
|
|
|
|
|
|
|
|
if (!spa_pod_iter_get (&it,
|
|
|
|
|
SPA_POD_TYPE_INT, &info.max_outputs,
|
|
|
|
|
SPA_POD_TYPE_INT, &info.n_outputs,
|
|
|
|
|
SPA_POD_TYPE_INT, &info.n_output_formats,
|
|
|
|
|
0))
|
2017-03-07 17:23:35 +01:00
|
|
|
return false;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
|
|
|
|
info.output_formats = alloca (info.n_output_formats * sizeof (SpaFormat*));
|
|
|
|
|
for (i = 0; i < info.n_output_formats; i++)
|
2017-03-07 17:23:35 +01:00
|
|
|
if (!spa_pod_iter_get (&it, SPA_POD_TYPE_OBJECT, &info.output_formats[i], 0))
|
|
|
|
|
return false;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
2017-03-07 11:56:43 +01:00
|
|
|
if (!spa_pod_iter_get (&it,
|
|
|
|
|
SPA_POD_TYPE_INT, &info.state,
|
|
|
|
|
SPA_POD_TYPE_STRING, &info.error,
|
|
|
|
|
SPA_POD_TYPE_INT, &props.n_items,
|
|
|
|
|
0))
|
2017-03-07 17:23:35 +01:00
|
|
|
return false;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
|
|
|
|
info.props = &props;
|
|
|
|
|
props.items = alloca (props.n_items * sizeof (SpaDictItem));
|
|
|
|
|
for (i = 0; i < props.n_items; i++) {
|
2017-03-07 11:56:43 +01:00
|
|
|
if (!spa_pod_iter_get (&it,
|
|
|
|
|
SPA_POD_TYPE_STRING, &props.items[i].key,
|
|
|
|
|
SPA_POD_TYPE_STRING, &props.items[i].value,
|
|
|
|
|
0))
|
2017-03-07 17:23:35 +01:00
|
|
|
return false;
|
2017-03-06 15:48:04 +01:00
|
|
|
}
|
2017-03-09 13:00:56 +01:00
|
|
|
((PinosNodeEvents*)proxy->implementation)->info (proxy, &info);
|
2017-03-07 17:23:35 +01:00
|
|
|
return true;
|
2017-03-06 15:48:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
client_node_marshal_update (void *object,
|
|
|
|
|
uint32_t change_mask,
|
2017-03-07 11:56:43 +01:00
|
|
|
uint32_t max_input_ports,
|
|
|
|
|
uint32_t max_output_ports,
|
2017-03-06 15:48:04 +01:00
|
|
|
const SpaProps *props)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosProxy *proxy = object;
|
|
|
|
|
PinosConnection *connection = proxy->context->protocol_private;
|
2017-03-06 15:48:04 +01:00
|
|
|
Builder b = { { NULL, 0, 0, NULL, write_pod }, connection };
|
|
|
|
|
SpaPODFrame f;
|
|
|
|
|
|
2017-03-14 20:18:31 +01:00
|
|
|
core_update_map (proxy->context);
|
|
|
|
|
|
2017-03-23 16:08:50 +01:00
|
|
|
spa_pod_builder_struct (&b.b, &f,
|
2017-03-07 17:23:35 +01:00
|
|
|
SPA_POD_TYPE_INT, change_mask,
|
|
|
|
|
SPA_POD_TYPE_INT, max_input_ports,
|
|
|
|
|
SPA_POD_TYPE_INT, max_output_ports,
|
2017-03-23 16:08:50 +01:00
|
|
|
SPA_POD_TYPE_POD, props);
|
2017-03-03 19:06:54 +01:00
|
|
|
|
2017-03-06 15:48:04 +01:00
|
|
|
pinos_connection_end_write (connection, proxy->id, 0, b.b.offset);
|
2017-03-03 19:06:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2017-03-06 15:48:04 +01:00
|
|
|
client_node_marshal_port_update (void *object,
|
|
|
|
|
SpaDirection direction,
|
|
|
|
|
uint32_t port_id,
|
|
|
|
|
uint32_t change_mask,
|
2017-03-07 11:56:43 +01:00
|
|
|
uint32_t n_possible_formats,
|
2017-03-06 15:48:04 +01:00
|
|
|
const SpaFormat **possible_formats,
|
|
|
|
|
const SpaFormat *format,
|
|
|
|
|
const SpaProps *props,
|
|
|
|
|
const SpaPortInfo *info)
|
|
|
|
|
{
|
|
|
|
|
PinosProxy *proxy = object;
|
|
|
|
|
PinosConnection *connection = proxy->context->protocol_private;
|
|
|
|
|
Builder b = { { NULL, 0, 0, NULL, write_pod }, connection };
|
2017-03-23 16:57:33 +01:00
|
|
|
SpaPODFrame f[2];
|
2017-03-06 15:48:04 +01:00
|
|
|
int i, n_items;
|
|
|
|
|
|
2017-03-14 20:18:31 +01:00
|
|
|
core_update_map (proxy->context);
|
|
|
|
|
|
2017-03-07 17:23:35 +01:00
|
|
|
spa_pod_builder_add (&b.b,
|
2017-03-23 16:57:33 +01:00
|
|
|
SPA_POD_TYPE_STRUCT, &f[0],
|
2017-03-07 17:23:35 +01:00
|
|
|
SPA_POD_TYPE_INT, direction,
|
|
|
|
|
SPA_POD_TYPE_INT, port_id,
|
|
|
|
|
SPA_POD_TYPE_INT, change_mask,
|
|
|
|
|
SPA_POD_TYPE_INT, n_possible_formats,
|
|
|
|
|
0);
|
|
|
|
|
|
2017-03-06 15:48:04 +01:00
|
|
|
for (i = 0; i < n_possible_formats; i++)
|
2017-03-07 17:23:35 +01:00
|
|
|
spa_pod_builder_add (&b.b, SPA_POD_TYPE_POD, possible_formats[i], 0);
|
|
|
|
|
|
2017-03-23 16:08:50 +01:00
|
|
|
spa_pod_builder_add (&b.b,
|
|
|
|
|
SPA_POD_TYPE_POD, format,
|
|
|
|
|
SPA_POD_TYPE_POD, props,
|
|
|
|
|
0);
|
|
|
|
|
|
2017-03-06 15:48:04 +01:00
|
|
|
if (info) {
|
2017-03-07 17:23:35 +01:00
|
|
|
spa_pod_builder_add (&b.b,
|
2017-03-23 16:57:33 +01:00
|
|
|
SPA_POD_TYPE_STRUCT, &f[1],
|
2017-03-07 17:23:35 +01:00
|
|
|
SPA_POD_TYPE_INT, info->flags,
|
|
|
|
|
SPA_POD_TYPE_LONG, info->maxbuffering,
|
|
|
|
|
SPA_POD_TYPE_LONG, info->latency,
|
|
|
|
|
SPA_POD_TYPE_INT, info->n_params,
|
|
|
|
|
0);
|
|
|
|
|
|
2017-03-06 15:48:04 +01:00
|
|
|
for (i = 0; i < info->n_params; i++) {
|
|
|
|
|
SpaAllocParam *p = info->params[i];
|
2017-03-17 11:58:09 +01:00
|
|
|
spa_pod_builder_add (&b.b, SPA_POD_TYPE_POD, p, 0);
|
2017-03-06 15:48:04 +01:00
|
|
|
}
|
|
|
|
|
n_items = info->extra ? info->extra->n_items : 0;
|
2017-03-07 17:23:35 +01:00
|
|
|
spa_pod_builder_add (&b.b, SPA_POD_TYPE_INT, n_items, 0);
|
2017-03-06 15:48:04 +01:00
|
|
|
for (i = 0; i < n_items; i++) {
|
2017-03-07 17:23:35 +01:00
|
|
|
spa_pod_builder_add (&b.b,
|
|
|
|
|
SPA_POD_TYPE_STRING, info->extra->items[i].key,
|
|
|
|
|
SPA_POD_TYPE_STRING, info->extra->items[i].value,
|
|
|
|
|
0);
|
2017-03-06 15:48:04 +01:00
|
|
|
}
|
2017-03-23 16:57:33 +01:00
|
|
|
spa_pod_builder_add (&b.b, -SPA_POD_TYPE_STRUCT, &f[1], 0);
|
|
|
|
|
} else {
|
|
|
|
|
spa_pod_builder_add (&b.b, SPA_POD_TYPE_POD, NULL, 0);
|
2017-03-06 15:48:04 +01:00
|
|
|
}
|
2017-03-23 16:57:33 +01:00
|
|
|
spa_pod_builder_add (&b.b, -SPA_POD_TYPE_STRUCT, &f[0], 0);
|
2017-03-06 15:48:04 +01:00
|
|
|
|
|
|
|
|
pinos_connection_end_write (connection, proxy->id, 1, b.b.offset);
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-03 19:06:54 +01:00
|
|
|
static void
|
2017-03-21 20:39:20 +01:00
|
|
|
client_node_marshal_event (void *object,
|
|
|
|
|
SpaEvent *event)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosProxy *proxy = object;
|
|
|
|
|
PinosConnection *connection = proxy->context->protocol_private;
|
2017-03-06 15:48:04 +01:00
|
|
|
Builder b = { { NULL, 0, 0, NULL, write_pod }, connection };
|
|
|
|
|
SpaPODFrame f;
|
2017-03-03 19:06:54 +01:00
|
|
|
|
2017-03-14 20:18:31 +01:00
|
|
|
core_update_map (proxy->context);
|
|
|
|
|
|
2017-03-17 11:58:09 +01:00
|
|
|
spa_pod_builder_struct (&b.b, &f,
|
|
|
|
|
SPA_POD_TYPE_POD, event);
|
2017-03-06 15:48:04 +01:00
|
|
|
|
2017-04-08 20:33:54 +02:00
|
|
|
pinos_connection_end_write (connection, proxy->id, 2, b.b.offset);
|
2017-03-03 19:06:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2017-03-09 19:21:50 +01:00
|
|
|
client_node_marshal_destroy (void *object)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosProxy *proxy = object;
|
|
|
|
|
PinosConnection *connection = proxy->context->protocol_private;
|
2017-03-06 15:48:04 +01:00
|
|
|
Builder b = { { NULL, 0, 0, NULL, write_pod }, connection };
|
|
|
|
|
SpaPODFrame f;
|
|
|
|
|
|
2017-03-14 20:18:31 +01:00
|
|
|
core_update_map (proxy->context);
|
|
|
|
|
|
2017-03-17 11:58:09 +01:00
|
|
|
spa_pod_builder_struct (&b.b, &f, 0);
|
2017-03-03 19:06:54 +01:00
|
|
|
|
2017-04-08 20:33:54 +02:00
|
|
|
pinos_connection_end_write (connection, proxy->id, 3, b.b.offset);
|
2017-03-03 19:06:54 +01:00
|
|
|
}
|
|
|
|
|
|
2017-03-07 17:23:35 +01:00
|
|
|
static bool
|
2017-03-06 15:48:04 +01:00
|
|
|
client_node_demarshal_done (void *object,
|
|
|
|
|
void *data,
|
|
|
|
|
size_t size)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosProxy *proxy = object;
|
2017-03-07 11:56:43 +01:00
|
|
|
SpaPODIter it;
|
2017-03-06 15:48:04 +01:00
|
|
|
PinosConnection *connection = proxy->context->protocol_private;
|
2017-03-09 19:21:50 +01:00
|
|
|
int32_t idx;
|
2017-03-06 15:48:04 +01:00
|
|
|
int fd;
|
|
|
|
|
|
2017-03-07 11:56:43 +01:00
|
|
|
if (!spa_pod_iter_struct (&it, data, size) ||
|
|
|
|
|
!spa_pod_iter_get (&it,
|
|
|
|
|
SPA_POD_TYPE_INT, &idx,
|
|
|
|
|
0))
|
2017-03-07 17:23:35 +01:00
|
|
|
return false;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
2017-03-07 11:56:43 +01:00
|
|
|
fd = pinos_connection_get_fd (connection, idx);
|
2017-03-09 19:21:50 +01:00
|
|
|
((PinosClientNodeEvents*)proxy->implementation)->done (proxy, fd);
|
2017-03-07 17:23:35 +01:00
|
|
|
return true;
|
2017-03-03 19:06:54 +01:00
|
|
|
}
|
|
|
|
|
|
2017-03-07 17:23:35 +01:00
|
|
|
static bool
|
2017-03-06 15:48:04 +01:00
|
|
|
client_node_demarshal_event (void *object,
|
|
|
|
|
void *data,
|
|
|
|
|
size_t size)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosProxy *proxy = object;
|
2017-03-07 11:56:43 +01:00
|
|
|
SpaPODIter it;
|
2017-03-21 20:39:20 +01:00
|
|
|
const SpaEvent *event;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
2017-03-07 11:56:43 +01:00
|
|
|
if (!spa_pod_iter_struct (&it, data, size) ||
|
|
|
|
|
!spa_pod_iter_get (&it,
|
2017-03-15 16:21:05 +01:00
|
|
|
SPA_POD_TYPE_OBJECT, &event,
|
2017-03-07 11:56:43 +01:00
|
|
|
0))
|
2017-03-07 17:23:35 +01:00
|
|
|
return false;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
2017-03-09 13:00:56 +01:00
|
|
|
((PinosClientNodeEvents*)proxy->implementation)->event (proxy, event);
|
2017-03-07 17:23:35 +01:00
|
|
|
return true;
|
2017-03-03 19:06:54 +01:00
|
|
|
}
|
|
|
|
|
|
2017-03-07 17:23:35 +01:00
|
|
|
static bool
|
2017-03-06 15:48:04 +01:00
|
|
|
client_node_demarshal_add_port (void *object,
|
|
|
|
|
void *data,
|
|
|
|
|
size_t size)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosProxy *proxy = object;
|
2017-03-07 11:56:43 +01:00
|
|
|
SpaPODIter it;
|
|
|
|
|
int32_t seq, direction, port_id;
|
|
|
|
|
|
|
|
|
|
if (!spa_pod_iter_struct (&it, data, size) ||
|
|
|
|
|
!spa_pod_iter_get (&it,
|
|
|
|
|
SPA_POD_TYPE_INT, &seq,
|
|
|
|
|
SPA_POD_TYPE_INT, &direction,
|
|
|
|
|
SPA_POD_TYPE_INT, &port_id,
|
|
|
|
|
0))
|
2017-03-07 17:23:35 +01:00
|
|
|
return false;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
2017-03-09 13:00:56 +01:00
|
|
|
((PinosClientNodeEvents*)proxy->implementation)->add_port (proxy, seq, direction, port_id);
|
2017-03-07 17:23:35 +01:00
|
|
|
return true;
|
2017-03-03 19:06:54 +01:00
|
|
|
}
|
|
|
|
|
|
2017-03-07 17:23:35 +01:00
|
|
|
static bool
|
2017-03-06 15:48:04 +01:00
|
|
|
client_node_demarshal_remove_port (void *object,
|
2017-03-07 17:23:35 +01:00
|
|
|
void *data,
|
|
|
|
|
size_t size)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosProxy *proxy = object;
|
2017-03-07 11:56:43 +01:00
|
|
|
SpaPODIter it;
|
|
|
|
|
int32_t seq, direction, port_id;
|
|
|
|
|
|
|
|
|
|
if (!spa_pod_iter_struct (&it, data, size) ||
|
|
|
|
|
!spa_pod_iter_get (&it,
|
|
|
|
|
SPA_POD_TYPE_INT, &seq,
|
|
|
|
|
SPA_POD_TYPE_INT, &direction,
|
|
|
|
|
SPA_POD_TYPE_INT, &port_id,
|
|
|
|
|
0))
|
2017-03-07 17:23:35 +01:00
|
|
|
return false;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
2017-03-09 13:00:56 +01:00
|
|
|
((PinosClientNodeEvents*)proxy->implementation)->remove_port (proxy, seq, direction, port_id);
|
2017-03-07 17:23:35 +01:00
|
|
|
return true;
|
2017-03-03 19:06:54 +01:00
|
|
|
}
|
|
|
|
|
|
2017-03-07 17:23:35 +01:00
|
|
|
static bool
|
2017-03-06 15:48:04 +01:00
|
|
|
client_node_demarshal_set_format (void *object,
|
2017-03-07 17:23:35 +01:00
|
|
|
void *data,
|
|
|
|
|
size_t size)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosProxy *proxy = object;
|
2017-03-07 11:56:43 +01:00
|
|
|
SpaPODIter it;
|
2017-03-23 16:08:50 +01:00
|
|
|
uint32_t seq, direction, port_id, flags;
|
2017-03-06 15:48:04 +01:00
|
|
|
const SpaFormat *format = NULL;
|
|
|
|
|
|
2017-03-07 11:56:43 +01:00
|
|
|
if (!spa_pod_iter_struct (&it, data, size) ||
|
|
|
|
|
!spa_pod_iter_get (&it,
|
|
|
|
|
SPA_POD_TYPE_INT, &seq,
|
|
|
|
|
SPA_POD_TYPE_INT, &direction,
|
|
|
|
|
SPA_POD_TYPE_INT, &port_id,
|
|
|
|
|
SPA_POD_TYPE_INT, &flags,
|
2017-03-23 16:57:33 +01:00
|
|
|
-SPA_POD_TYPE_OBJECT, &format,
|
2017-03-07 11:56:43 +01:00
|
|
|
0))
|
2017-03-07 17:23:35 +01:00
|
|
|
return false;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
2017-03-09 13:00:56 +01:00
|
|
|
((PinosClientNodeEvents*)proxy->implementation)->set_format (proxy, seq, direction, port_id,
|
2017-03-06 15:48:04 +01:00
|
|
|
flags, format);
|
2017-03-07 17:23:35 +01:00
|
|
|
return true;
|
2017-03-03 19:06:54 +01:00
|
|
|
}
|
|
|
|
|
|
2017-03-07 17:23:35 +01:00
|
|
|
static bool
|
2017-03-06 15:48:04 +01:00
|
|
|
client_node_demarshal_set_property (void *object,
|
|
|
|
|
void *data,
|
|
|
|
|
size_t size)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosProxy *proxy = object;
|
2017-03-07 11:56:43 +01:00
|
|
|
SpaPODIter it;
|
|
|
|
|
uint32_t seq, id;
|
2017-03-06 15:48:04 +01:00
|
|
|
const void *value;
|
|
|
|
|
uint32_t s;
|
|
|
|
|
|
2017-03-07 11:56:43 +01:00
|
|
|
if (!spa_pod_iter_struct (&it, data, size) ||
|
|
|
|
|
!spa_pod_iter_get (&it,
|
|
|
|
|
SPA_POD_TYPE_INT, &seq,
|
|
|
|
|
SPA_POD_TYPE_INT, &id,
|
|
|
|
|
SPA_POD_TYPE_BYTES, &value, &s,
|
|
|
|
|
0))
|
2017-03-07 17:23:35 +01:00
|
|
|
return false;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
2017-03-09 13:00:56 +01:00
|
|
|
((PinosClientNodeEvents*)proxy->implementation)->set_property (proxy, seq, id, s, value);
|
2017-03-07 17:23:35 +01:00
|
|
|
return true;
|
2017-03-03 19:06:54 +01:00
|
|
|
}
|
|
|
|
|
|
2017-03-07 17:23:35 +01:00
|
|
|
static bool
|
2017-03-06 15:48:04 +01:00
|
|
|
client_node_demarshal_add_mem (void *object,
|
|
|
|
|
void *data,
|
|
|
|
|
size_t size)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosProxy *proxy = object;
|
2017-03-07 11:56:43 +01:00
|
|
|
SpaPODIter it;
|
2017-03-06 15:48:04 +01:00
|
|
|
PinosConnection *connection = proxy->context->protocol_private;
|
2017-03-07 11:56:43 +01:00
|
|
|
uint32_t direction, port_id, mem_id, type, memfd_idx, flags, offset, sz;
|
|
|
|
|
int memfd;
|
|
|
|
|
|
|
|
|
|
if (!spa_pod_iter_struct (&it, data, size) ||
|
|
|
|
|
!spa_pod_iter_get (&it,
|
|
|
|
|
SPA_POD_TYPE_INT, &direction,
|
|
|
|
|
SPA_POD_TYPE_INT, &port_id,
|
|
|
|
|
SPA_POD_TYPE_INT, &mem_id,
|
|
|
|
|
SPA_POD_TYPE_INT, &type,
|
|
|
|
|
SPA_POD_TYPE_INT, &memfd_idx,
|
|
|
|
|
SPA_POD_TYPE_INT, &flags,
|
|
|
|
|
SPA_POD_TYPE_INT, &offset,
|
|
|
|
|
SPA_POD_TYPE_INT, &sz,
|
|
|
|
|
0))
|
2017-03-07 17:23:35 +01:00
|
|
|
return false;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
2017-03-07 11:56:43 +01:00
|
|
|
memfd = pinos_connection_get_fd (connection, memfd_idx);
|
2017-03-06 15:48:04 +01:00
|
|
|
|
2017-03-09 13:00:56 +01:00
|
|
|
((PinosClientNodeEvents*)proxy->implementation)->add_mem (proxy,
|
|
|
|
|
direction,
|
|
|
|
|
port_id,
|
|
|
|
|
mem_id,
|
|
|
|
|
type,
|
|
|
|
|
memfd,
|
|
|
|
|
flags,
|
|
|
|
|
offset,
|
|
|
|
|
sz);
|
2017-03-07 17:23:35 +01:00
|
|
|
return true;
|
2017-03-03 19:06:54 +01:00
|
|
|
}
|
|
|
|
|
|
2017-03-07 17:23:35 +01:00
|
|
|
static bool
|
2017-03-06 15:48:04 +01:00
|
|
|
client_node_demarshal_use_buffers (void *object,
|
2017-03-07 17:23:35 +01:00
|
|
|
void *data,
|
|
|
|
|
size_t size)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosProxy *proxy = object;
|
2017-03-07 11:56:43 +01:00
|
|
|
SpaPODIter it;
|
|
|
|
|
uint32_t seq, direction, port_id, n_buffers, data_id;
|
2017-03-06 15:48:04 +01:00
|
|
|
PinosClientNodeBuffer *buffers;
|
|
|
|
|
int i, j;
|
|
|
|
|
|
2017-03-07 11:56:43 +01:00
|
|
|
if (!spa_pod_iter_struct (&it, data, size) ||
|
|
|
|
|
!spa_pod_iter_get (&it,
|
|
|
|
|
SPA_POD_TYPE_INT, &seq,
|
|
|
|
|
SPA_POD_TYPE_INT, &direction,
|
|
|
|
|
SPA_POD_TYPE_INT, &port_id,
|
|
|
|
|
SPA_POD_TYPE_INT, &n_buffers,
|
|
|
|
|
0))
|
2017-03-07 17:23:35 +01:00
|
|
|
return false;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
|
|
|
|
buffers = alloca (sizeof (PinosClientNodeBuffer) * n_buffers);
|
|
|
|
|
for (i = 0; i < n_buffers; i++) {
|
|
|
|
|
SpaBuffer *buf = buffers[i].buffer = alloca (sizeof (SpaBuffer));
|
|
|
|
|
|
2017-03-07 11:56:43 +01:00
|
|
|
if (!spa_pod_iter_get (&it,
|
|
|
|
|
SPA_POD_TYPE_INT, &buffers[i].mem_id,
|
|
|
|
|
SPA_POD_TYPE_INT, &buffers[i].offset,
|
|
|
|
|
SPA_POD_TYPE_INT, &buffers[i].size,
|
|
|
|
|
SPA_POD_TYPE_INT, &buf->id,
|
|
|
|
|
SPA_POD_TYPE_INT, &buf->n_metas, 0))
|
2017-03-07 17:23:35 +01:00
|
|
|
return false;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
|
|
|
|
buf->metas = alloca (sizeof (SpaMeta) * buf->n_metas);
|
|
|
|
|
for (j = 0; j < buf->n_metas; j++) {
|
|
|
|
|
SpaMeta *m = &buf->metas[j];
|
|
|
|
|
|
2017-03-07 11:56:43 +01:00
|
|
|
if (!spa_pod_iter_get (&it,
|
|
|
|
|
SPA_POD_TYPE_INT, &m->type,
|
2017-03-17 17:09:16 +01:00
|
|
|
SPA_POD_TYPE_INT, &m->size, 0))
|
2017-03-07 17:23:35 +01:00
|
|
|
return false;
|
2017-03-06 15:48:04 +01:00
|
|
|
}
|
2017-03-07 11:56:43 +01:00
|
|
|
if (!spa_pod_iter_get (&it, SPA_POD_TYPE_INT, &buf->n_datas, 0))
|
2017-03-07 17:23:35 +01:00
|
|
|
return false;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
|
|
|
|
buf->datas = alloca (sizeof (SpaData) * buf->n_datas);
|
|
|
|
|
for (j = 0; j < buf->n_datas; j++) {
|
|
|
|
|
SpaData *d = &buf->datas[j];
|
|
|
|
|
|
2017-03-07 11:56:43 +01:00
|
|
|
if (!spa_pod_iter_get (&it,
|
|
|
|
|
SPA_POD_TYPE_INT, &d->type,
|
|
|
|
|
SPA_POD_TYPE_INT, &data_id,
|
|
|
|
|
SPA_POD_TYPE_INT, &d->flags,
|
|
|
|
|
SPA_POD_TYPE_INT, &d->mapoffset,
|
|
|
|
|
SPA_POD_TYPE_INT, &d->maxsize,
|
|
|
|
|
0))
|
2017-03-07 17:23:35 +01:00
|
|
|
return false;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
2017-03-07 11:56:43 +01:00
|
|
|
d->data = SPA_UINT32_TO_PTR (data_id);
|
2017-03-06 15:48:04 +01:00
|
|
|
}
|
|
|
|
|
}
|
2017-03-09 13:00:56 +01:00
|
|
|
((PinosClientNodeEvents*)proxy->implementation)->use_buffers (proxy,
|
|
|
|
|
seq,
|
|
|
|
|
direction,
|
|
|
|
|
port_id,
|
|
|
|
|
n_buffers,
|
|
|
|
|
buffers);
|
2017-03-07 17:23:35 +01:00
|
|
|
return true;
|
2017-03-03 19:06:54 +01:00
|
|
|
}
|
|
|
|
|
|
2017-03-07 17:23:35 +01:00
|
|
|
static bool
|
2017-03-06 15:48:04 +01:00
|
|
|
client_node_demarshal_node_command (void *object,
|
2017-03-07 17:23:35 +01:00
|
|
|
void *data,
|
|
|
|
|
size_t size)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosProxy *proxy = object;
|
2017-03-07 17:23:35 +01:00
|
|
|
SpaPODIter it;
|
2017-03-22 10:04:24 +01:00
|
|
|
const SpaCommand *command;
|
2017-03-15 16:21:05 +01:00
|
|
|
uint32_t seq;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
2017-03-07 17:23:35 +01:00
|
|
|
if (!spa_pod_iter_struct (&it, data, size) ||
|
|
|
|
|
!spa_pod_iter_get (&it,
|
|
|
|
|
SPA_POD_TYPE_INT, &seq,
|
2017-03-15 16:21:05 +01:00
|
|
|
SPA_POD_TYPE_OBJECT, &command,
|
2017-03-07 17:23:35 +01:00
|
|
|
0))
|
|
|
|
|
return false;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
2017-03-09 13:00:56 +01:00
|
|
|
((PinosClientNodeEvents*)proxy->implementation)->node_command (proxy, seq, command);
|
2017-03-07 17:23:35 +01:00
|
|
|
return true;
|
2017-03-03 19:06:54 +01:00
|
|
|
}
|
|
|
|
|
|
2017-03-07 17:23:35 +01:00
|
|
|
static bool
|
2017-03-06 15:48:04 +01:00
|
|
|
client_node_demarshal_port_command (void *object,
|
|
|
|
|
void *data,
|
|
|
|
|
size_t size)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosProxy *proxy = object;
|
2017-03-07 17:23:35 +01:00
|
|
|
SpaPODIter it;
|
2017-03-22 10:04:24 +01:00
|
|
|
const SpaCommand *command;
|
2017-03-15 16:21:05 +01:00
|
|
|
uint32_t port_id;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
2017-03-07 17:23:35 +01:00
|
|
|
if (!spa_pod_iter_struct (&it, data, size) ||
|
|
|
|
|
!spa_pod_iter_get (&it,
|
|
|
|
|
SPA_POD_TYPE_INT, &port_id,
|
2017-03-15 16:21:05 +01:00
|
|
|
SPA_POD_TYPE_OBJECT, &command,
|
2017-03-07 17:23:35 +01:00
|
|
|
0))
|
|
|
|
|
return false;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
2017-03-09 13:00:56 +01:00
|
|
|
((PinosClientNodeEvents*)proxy->implementation)->port_command (proxy, port_id, command);
|
2017-03-07 17:23:35 +01:00
|
|
|
return true;
|
2017-03-03 19:06:54 +01:00
|
|
|
}
|
|
|
|
|
|
2017-03-07 17:23:35 +01:00
|
|
|
static bool
|
2017-03-06 15:48:04 +01:00
|
|
|
client_node_demarshal_transport (void *object,
|
2017-03-07 17:23:35 +01:00
|
|
|
void *data,
|
|
|
|
|
size_t size)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosProxy *proxy = object;
|
2017-03-07 17:23:35 +01:00
|
|
|
SpaPODIter it;
|
2017-03-06 15:48:04 +01:00
|
|
|
PinosConnection *connection = proxy->context->protocol_private;
|
2017-03-07 17:23:35 +01:00
|
|
|
uint32_t memfd_idx, offset, sz;
|
|
|
|
|
int memfd;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
2017-03-07 17:23:35 +01:00
|
|
|
if (!spa_pod_iter_struct (&it, data, size) ||
|
|
|
|
|
!spa_pod_iter_get (&it,
|
|
|
|
|
SPA_POD_TYPE_INT, &memfd_idx,
|
|
|
|
|
SPA_POD_TYPE_INT, &offset,
|
|
|
|
|
SPA_POD_TYPE_INT, &sz,
|
|
|
|
|
0))
|
|
|
|
|
return false;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
2017-03-07 17:23:35 +01:00
|
|
|
memfd = pinos_connection_get_fd (connection, memfd_idx);
|
2017-03-09 13:00:56 +01:00
|
|
|
((PinosClientNodeEvents*)proxy->implementation)->transport (proxy, memfd, offset, sz);
|
2017-03-07 17:23:35 +01:00
|
|
|
return true;
|
2017-03-03 19:06:54 +01:00
|
|
|
}
|
|
|
|
|
|
2017-03-07 17:23:35 +01:00
|
|
|
static bool
|
2017-03-06 15:48:04 +01:00
|
|
|
client_demarshal_info (void *object,
|
2017-03-07 17:23:35 +01:00
|
|
|
void *data,
|
|
|
|
|
size_t size)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosProxy *proxy = object;
|
2017-03-07 17:23:35 +01:00
|
|
|
SpaPODIter it;
|
2017-03-06 15:48:04 +01:00
|
|
|
SpaDict props;
|
|
|
|
|
PinosClientInfo info;
|
2017-03-07 17:23:35 +01:00
|
|
|
uint32_t i;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
2017-03-07 17:23:35 +01:00
|
|
|
if (!spa_pod_iter_struct (&it, data, size) ||
|
|
|
|
|
!spa_pod_iter_get (&it,
|
|
|
|
|
SPA_POD_TYPE_INT, &info.id,
|
|
|
|
|
SPA_POD_TYPE_LONG, &info.change_mask,
|
|
|
|
|
SPA_POD_TYPE_INT, &props.n_items,
|
|
|
|
|
0))
|
|
|
|
|
return false;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
|
|
|
|
info.props = &props;
|
|
|
|
|
props.items = alloca (props.n_items * sizeof (SpaDictItem));
|
|
|
|
|
for (i = 0; i < props.n_items; i++) {
|
2017-03-07 17:23:35 +01:00
|
|
|
if (!spa_pod_iter_get (&it,
|
|
|
|
|
SPA_POD_TYPE_STRING, &props.items[i].key,
|
|
|
|
|
SPA_POD_TYPE_STRING, &props.items[i].value,
|
|
|
|
|
0))
|
|
|
|
|
return false;
|
2017-03-06 15:48:04 +01:00
|
|
|
}
|
2017-03-09 13:00:56 +01:00
|
|
|
((PinosClientEvents*)proxy->implementation)->info (proxy, &info);
|
2017-03-07 17:23:35 +01:00
|
|
|
return true;
|
2017-03-03 19:06:54 +01:00
|
|
|
}
|
|
|
|
|
|
2017-03-07 17:23:35 +01:00
|
|
|
static bool
|
2017-03-06 15:48:04 +01:00
|
|
|
link_demarshal_info (void *object,
|
2017-03-07 17:23:35 +01:00
|
|
|
void *data,
|
|
|
|
|
size_t size)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosProxy *proxy = object;
|
2017-03-07 17:23:35 +01:00
|
|
|
SpaPODIter it;
|
2017-03-06 15:48:04 +01:00
|
|
|
PinosLinkInfo info;
|
2017-03-07 17:23:35 +01:00
|
|
|
|
|
|
|
|
if (!spa_pod_iter_struct (&it, data, size) ||
|
|
|
|
|
!spa_pod_iter_get (&it,
|
|
|
|
|
SPA_POD_TYPE_INT, &info.id,
|
|
|
|
|
SPA_POD_TYPE_LONG, &info.change_mask,
|
|
|
|
|
SPA_POD_TYPE_INT, &info.output_node_id,
|
|
|
|
|
SPA_POD_TYPE_INT, &info.output_port_id,
|
|
|
|
|
SPA_POD_TYPE_INT, &info.input_node_id,
|
|
|
|
|
SPA_POD_TYPE_INT, &info.input_port_id,
|
|
|
|
|
0))
|
|
|
|
|
return false;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
2017-03-09 13:00:56 +01:00
|
|
|
((PinosLinkEvents*)proxy->implementation)->info (proxy, &info);
|
2017-03-07 17:23:35 +01:00
|
|
|
return true;
|
2017-03-03 19:06:54 +01:00
|
|
|
}
|
|
|
|
|
|
2017-03-07 17:23:35 +01:00
|
|
|
static bool
|
2017-03-06 15:48:04 +01:00
|
|
|
registry_demarshal_global (void *object,
|
2017-03-07 17:23:35 +01:00
|
|
|
void *data,
|
|
|
|
|
size_t size)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosProxy *proxy = object;
|
2017-03-07 17:23:35 +01:00
|
|
|
SpaPODIter it;
|
|
|
|
|
uint32_t id;
|
2017-03-06 15:48:04 +01:00
|
|
|
const char *type;
|
|
|
|
|
|
2017-03-07 17:23:35 +01:00
|
|
|
if (!spa_pod_iter_struct (&it, data, size) ||
|
|
|
|
|
!spa_pod_iter_get (&it,
|
|
|
|
|
SPA_POD_TYPE_INT, &id,
|
|
|
|
|
SPA_POD_TYPE_STRING, &type,
|
|
|
|
|
0))
|
|
|
|
|
return false;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
2017-03-09 13:00:56 +01:00
|
|
|
((PinosRegistryEvents*)proxy->implementation)->global (proxy, id, type);
|
2017-03-07 17:23:35 +01:00
|
|
|
return true;
|
2017-03-03 19:06:54 +01:00
|
|
|
}
|
|
|
|
|
|
2017-03-07 17:23:35 +01:00
|
|
|
static bool
|
2017-03-06 15:48:04 +01:00
|
|
|
registry_demarshal_global_remove (void *object,
|
2017-03-07 17:23:35 +01:00
|
|
|
void *data,
|
|
|
|
|
size_t size)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosProxy *proxy = object;
|
2017-03-07 17:23:35 +01:00
|
|
|
SpaPODIter it;
|
|
|
|
|
uint32_t id;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
2017-03-07 17:23:35 +01:00
|
|
|
if (!spa_pod_iter_struct (&it, data, size) ||
|
|
|
|
|
!spa_pod_iter_get (&it,
|
|
|
|
|
SPA_POD_TYPE_INT, &id,
|
|
|
|
|
0))
|
|
|
|
|
return false;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
2017-03-09 13:00:56 +01:00
|
|
|
((PinosRegistryEvents*)proxy->implementation)->global_remove (proxy, id);
|
2017-03-07 17:23:35 +01:00
|
|
|
return true;
|
2017-03-03 19:06:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2017-03-06 15:48:04 +01:00
|
|
|
registry_marshal_bind (void *object,
|
|
|
|
|
uint32_t id,
|
|
|
|
|
uint32_t new_id)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosProxy *proxy = object;
|
|
|
|
|
PinosConnection *connection = proxy->context->protocol_private;
|
2017-03-06 15:48:04 +01:00
|
|
|
Builder b = { { NULL, 0, 0, NULL, write_pod }, connection };
|
|
|
|
|
SpaPODFrame f;
|
|
|
|
|
|
2017-03-14 20:18:31 +01:00
|
|
|
core_update_map (proxy->context);
|
|
|
|
|
|
2017-03-17 11:58:09 +01:00
|
|
|
spa_pod_builder_struct (&b.b, &f,
|
2017-03-07 17:23:35 +01:00
|
|
|
SPA_POD_TYPE_INT, id,
|
2017-03-17 11:58:09 +01:00
|
|
|
SPA_POD_TYPE_INT, new_id);
|
2017-03-03 19:06:54 +01:00
|
|
|
|
2017-03-06 15:48:04 +01:00
|
|
|
pinos_connection_end_write (connection, proxy->id, 0, b.b.offset);
|
2017-03-03 19:06:54 +01:00
|
|
|
}
|
|
|
|
|
|
2017-03-09 13:00:56 +01:00
|
|
|
static const PinosCoreMethods pinos_protocol_native_client_core_methods = {
|
2017-03-06 15:48:04 +01:00
|
|
|
&core_marshal_client_update,
|
|
|
|
|
&core_marshal_sync,
|
|
|
|
|
&core_marshal_get_registry,
|
|
|
|
|
&core_marshal_create_node,
|
2017-03-14 20:18:31 +01:00
|
|
|
&core_marshal_create_client_node,
|
2017-03-24 11:40:58 +01:00
|
|
|
&core_marshal_update_types,
|
2017-03-03 19:06:54 +01:00
|
|
|
};
|
|
|
|
|
|
2017-03-09 13:00:56 +01:00
|
|
|
static const PinosDemarshalFunc pinos_protocol_native_client_core_demarshal[] = {
|
2017-03-06 15:48:04 +01:00
|
|
|
&core_demarshal_info,
|
|
|
|
|
&core_demarshal_done,
|
|
|
|
|
&core_demarshal_error,
|
|
|
|
|
&core_demarshal_remove_id,
|
2017-03-24 11:40:58 +01:00
|
|
|
&core_demarshal_update_types,
|
2017-03-03 19:06:54 +01:00
|
|
|
};
|
|
|
|
|
|
2017-03-09 13:00:56 +01:00
|
|
|
static const PinosInterface pinos_protocol_native_client_core_interface = {
|
2017-03-14 20:18:31 +01:00
|
|
|
6, &pinos_protocol_native_client_core_methods,
|
|
|
|
|
5, pinos_protocol_native_client_core_demarshal
|
2017-03-03 19:06:54 +01:00
|
|
|
};
|
|
|
|
|
|
2017-03-09 13:00:56 +01:00
|
|
|
static const PinosRegistryMethods pinos_protocol_native_client_registry_methods = {
|
|
|
|
|
®istry_marshal_bind
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static const PinosDemarshalFunc pinos_protocol_native_client_registry_demarshal[] = {
|
|
|
|
|
®istry_demarshal_global,
|
|
|
|
|
®istry_demarshal_global_remove,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static const PinosInterface pinos_protocol_native_client_registry_interface = {
|
|
|
|
|
1, &pinos_protocol_native_client_registry_methods,
|
|
|
|
|
2, pinos_protocol_native_client_registry_demarshal,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static const PinosClientNodeMethods pinos_protocol_native_client_client_node_methods = {
|
|
|
|
|
&client_node_marshal_update,
|
|
|
|
|
&client_node_marshal_port_update,
|
|
|
|
|
&client_node_marshal_event,
|
|
|
|
|
&client_node_marshal_destroy
|
2017-03-03 19:06:54 +01:00
|
|
|
};
|
|
|
|
|
|
2017-03-09 13:00:56 +01:00
|
|
|
static const PinosDemarshalFunc pinos_protocol_native_client_client_node_demarshal[] = {
|
2017-03-06 15:48:04 +01:00
|
|
|
&client_node_demarshal_done,
|
|
|
|
|
&client_node_demarshal_event,
|
|
|
|
|
&client_node_demarshal_add_port,
|
|
|
|
|
&client_node_demarshal_remove_port,
|
|
|
|
|
&client_node_demarshal_set_format,
|
|
|
|
|
&client_node_demarshal_set_property,
|
|
|
|
|
&client_node_demarshal_add_mem,
|
|
|
|
|
&client_node_demarshal_use_buffers,
|
|
|
|
|
&client_node_demarshal_node_command,
|
|
|
|
|
&client_node_demarshal_port_command,
|
|
|
|
|
&client_node_demarshal_transport
|
2017-03-03 19:06:54 +01:00
|
|
|
};
|
|
|
|
|
|
2017-03-09 13:00:56 +01:00
|
|
|
static const PinosInterface pinos_protocol_native_client_client_node_interface = {
|
2017-04-08 20:33:54 +02:00
|
|
|
4, &pinos_protocol_native_client_client_node_methods,
|
2017-03-09 13:00:56 +01:00
|
|
|
11, pinos_protocol_native_client_client_node_demarshal,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static const PinosDemarshalFunc pinos_protocol_native_client_module_demarshal[] = {
|
|
|
|
|
&module_demarshal_info,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static const PinosInterface pinos_protocol_native_client_module_interface = {
|
|
|
|
|
0, NULL,
|
|
|
|
|
1, pinos_protocol_native_client_module_demarshal,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static const PinosDemarshalFunc pinos_protocol_native_client_node_demarshal[] = {
|
|
|
|
|
&node_demarshal_info,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static const PinosInterface pinos_protocol_native_client_node_interface = {
|
|
|
|
|
0, NULL,
|
2017-03-09 19:21:50 +01:00
|
|
|
1, pinos_protocol_native_client_node_demarshal,
|
2017-03-09 13:00:56 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static const PinosDemarshalFunc pinos_protocol_native_client_client_demarshal[] = {
|
2017-03-06 15:48:04 +01:00
|
|
|
&client_demarshal_info,
|
2017-03-03 19:06:54 +01:00
|
|
|
};
|
|
|
|
|
|
2017-03-09 13:00:56 +01:00
|
|
|
static const PinosInterface pinos_protocol_native_client_client_interface = {
|
|
|
|
|
0, NULL,
|
|
|
|
|
1, pinos_protocol_native_client_client_demarshal,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static const PinosDemarshalFunc pinos_protocol_native_client_link_demarshal[] = {
|
2017-03-06 15:48:04 +01:00
|
|
|
&link_demarshal_info,
|
2017-03-03 19:06:54 +01:00
|
|
|
};
|
|
|
|
|
|
2017-03-09 13:00:56 +01:00
|
|
|
static const PinosInterface pinos_protocol_native_client_link_interface = {
|
|
|
|
|
0, NULL,
|
|
|
|
|
1, pinos_protocol_native_client_link_demarshal,
|
2017-03-03 19:06:54 +01:00
|
|
|
};
|
2017-03-09 13:00:56 +01:00
|
|
|
|
|
|
|
|
bool
|
|
|
|
|
pinos_protocol_native_client_setup (PinosProxy *proxy)
|
|
|
|
|
{
|
|
|
|
|
const PinosInterface *iface;
|
|
|
|
|
|
2017-03-24 11:40:58 +01:00
|
|
|
if (proxy->type == proxy->context->type.core) {
|
2017-03-09 13:00:56 +01:00
|
|
|
iface = &pinos_protocol_native_client_core_interface;
|
2017-03-14 20:18:31 +01:00
|
|
|
}
|
2017-03-24 11:40:58 +01:00
|
|
|
else if (proxy->type == proxy->context->type.registry) {
|
2017-03-09 13:00:56 +01:00
|
|
|
iface = &pinos_protocol_native_client_registry_interface;
|
2017-03-14 20:18:31 +01:00
|
|
|
}
|
2017-03-24 11:40:58 +01:00
|
|
|
else if (proxy->type == proxy->context->type.module) {
|
2017-03-09 13:00:56 +01:00
|
|
|
iface = &pinos_protocol_native_client_module_interface;
|
2017-03-14 20:18:31 +01:00
|
|
|
}
|
2017-03-24 11:40:58 +01:00
|
|
|
else if (proxy->type == proxy->context->type.node) {
|
2017-03-09 13:00:56 +01:00
|
|
|
iface = &pinos_protocol_native_client_node_interface;
|
2017-03-14 20:18:31 +01:00
|
|
|
}
|
2017-03-24 11:40:58 +01:00
|
|
|
else if (proxy->type == proxy->context->type.client_node) {
|
2017-03-09 13:00:56 +01:00
|
|
|
iface = &pinos_protocol_native_client_client_node_interface;
|
2017-03-14 20:18:31 +01:00
|
|
|
}
|
2017-03-24 11:40:58 +01:00
|
|
|
else if (proxy->type == proxy->context->type.client) {
|
2017-03-09 13:00:56 +01:00
|
|
|
iface = &pinos_protocol_native_client_client_interface;
|
2017-03-14 20:18:31 +01:00
|
|
|
}
|
2017-03-24 11:40:58 +01:00
|
|
|
else if (proxy->type == proxy->context->type.link) {
|
2017-03-09 13:00:56 +01:00
|
|
|
iface = &pinos_protocol_native_client_link_interface;
|
|
|
|
|
} else
|
|
|
|
|
return false;
|
|
|
|
|
proxy->iface = iface;
|
|
|
|
|
return true;
|
|
|
|
|
}
|