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.
|
|
|
|
|
*/
|
|
|
|
|
|
2017-03-07 17:23:35 +01:00
|
|
|
|
|
|
|
|
#include "spa/pod-iter.h"
|
|
|
|
|
|
2017-03-03 19:06:54 +01:00
|
|
|
#include "pinos/client/interfaces.h"
|
|
|
|
|
#include "pinos/server/resource.h"
|
|
|
|
|
#include "pinos/server/protocol-native.h"
|
|
|
|
|
|
2017-03-09 13:00:56 +01:00
|
|
|
typedef bool (*PinosDemarshalFunc) (void *object, void *data, size_t size);
|
2017-03-06 15:48:04 +01:00
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
SpaPODBuilder b;
|
|
|
|
|
PinosConnection *connection;
|
|
|
|
|
} Builder;
|
|
|
|
|
|
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-03 19:06:54 +01:00
|
|
|
{
|
2017-03-06 15:48:04 +01:00
|
|
|
if (ref == -1)
|
|
|
|
|
ref = b->offset;
|
2017-03-03 19:06:54 +01:00
|
|
|
|
2017-03-06 15:48:04 +01:00
|
|
|
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-03 19:06:54 +01:00
|
|
|
}
|
|
|
|
|
|
2017-03-14 20:18:31 +01:00
|
|
|
static void
|
|
|
|
|
core_update_map (PinosClient *client)
|
|
|
|
|
{
|
|
|
|
|
uint32_t diff, base, i;
|
|
|
|
|
PinosCore *core = client->core;
|
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 = client->n_types;
|
|
|
|
|
diff = spa_type_map_get_size (core->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 (core->type.map, base);
|
2017-03-14 20:18:31 +01:00
|
|
|
|
2017-03-24 11:40:58 +01:00
|
|
|
pinos_core_notify_update_types (client->core_resource,
|
|
|
|
|
client->n_types,
|
2017-03-14 20:18:31 +01:00
|
|
|
diff,
|
2017-03-24 11:40:58 +01:00
|
|
|
types);
|
|
|
|
|
client->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_info (void *object,
|
2017-03-09 19:21:50 +01:00
|
|
|
PinosCoreInfo *info)
|
2017-03-06 15:48:04 +01:00
|
|
|
{
|
|
|
|
|
PinosResource *resource = object;
|
|
|
|
|
PinosConnection *connection = resource->client->protocol_private;
|
|
|
|
|
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-14 20:18:31 +01:00
|
|
|
core_update_map (resource->client);
|
|
|
|
|
|
2017-03-06 15:48:04 +01:00
|
|
|
n_items = info->props ? info->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, 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, 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->props->items[i].key,
|
|
|
|
|
SPA_POD_TYPE_STRING, info->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-06 15:48:04 +01:00
|
|
|
|
|
|
|
|
pinos_connection_end_write (connection, resource->id, 0, b.b.offset);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
core_marshal_done (void *object,
|
2017-03-09 19:21:50 +01:00
|
|
|
uint32_t seq)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosResource *resource = object;
|
|
|
|
|
PinosConnection *connection = resource->client->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 (resource->client);
|
|
|
|
|
|
2017-03-17 11:58:09 +01:00
|
|
|
spa_pod_builder_struct (&b.b, &f,
|
|
|
|
|
SPA_POD_TYPE_INT, seq);
|
2017-03-06 15:48:04 +01:00
|
|
|
|
|
|
|
|
pinos_connection_end_write (connection, resource->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_error (void *object,
|
2017-03-09 19:21:50 +01:00
|
|
|
uint32_t id,
|
|
|
|
|
SpaResult res,
|
|
|
|
|
const char *error, ...)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosResource *resource = object;
|
|
|
|
|
PinosConnection *connection = resource->client->protocol_private;
|
|
|
|
|
char buffer[128];
|
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
|
|
|
va_list ap;
|
|
|
|
|
|
2017-03-14 20:18:31 +01:00
|
|
|
core_update_map (resource->client);
|
|
|
|
|
|
2017-03-03 19:06:54 +01:00
|
|
|
va_start (ap, error);
|
|
|
|
|
vsnprintf (buffer, sizeof (buffer), error, ap);
|
|
|
|
|
va_end (ap);
|
|
|
|
|
|
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,
|
|
|
|
|
SPA_POD_TYPE_INT, res,
|
2017-03-17 11:58:09 +01:00
|
|
|
SPA_POD_TYPE_STRING, buffer);
|
2017-03-06 15:48:04 +01:00
|
|
|
|
|
|
|
|
pinos_connection_end_write (connection, resource->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_remove_id (void *object,
|
2017-03-09 19:21:50 +01:00
|
|
|
uint32_t id)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosResource *resource = object;
|
|
|
|
|
PinosConnection *connection = resource->client->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 (resource->client);
|
|
|
|
|
|
2017-03-17 11:58:09 +01:00
|
|
|
spa_pod_builder_struct (&b.b, &f,
|
|
|
|
|
SPA_POD_TYPE_INT, id);
|
2017-03-06 15:48:04 +01:00
|
|
|
|
|
|
|
|
pinos_connection_end_write (connection, resource->id, 3, 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
|
|
|
{
|
|
|
|
|
PinosResource *resource = object;
|
|
|
|
|
PinosConnection *connection = resource->client->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, resource->id, 4, b.b.offset);
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-07 17:23:35 +01:00
|
|
|
static bool
|
2017-03-06 15:48:04 +01:00
|
|
|
core_demarshal_client_update (void *object,
|
2017-03-07 17:23:35 +01:00
|
|
|
void *data,
|
|
|
|
|
size_t size)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosResource *resource = object;
|
2017-03-06 15:48:04 +01:00
|
|
|
SpaDict props;
|
2017-03-07 17:23:35 +01:00
|
|
|
SpaPODIter it;
|
|
|
|
|
uint32_t i;
|
|
|
|
|
|
|
|
|
|
if (!spa_pod_iter_struct (&it, data, size) ||
|
|
|
|
|
!spa_pod_iter_get (&it,
|
|
|
|
|
SPA_POD_TYPE_INT, &props.n_items,
|
|
|
|
|
0))
|
|
|
|
|
return false;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
|
|
|
|
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
|
|
|
((PinosCoreMethods*)resource->implementation)->client_update (resource, &props);
|
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_sync (void *object,
|
2017-03-09 19:21:50 +01:00
|
|
|
void *data,
|
|
|
|
|
size_t size)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosResource *resource = object;
|
2017-03-07 17:23:35 +01:00
|
|
|
SpaPODIter it;
|
|
|
|
|
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,
|
|
|
|
|
0))
|
|
|
|
|
return false;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
2017-03-09 13:00:56 +01:00
|
|
|
((PinosCoreMethods*)resource->implementation)->sync (resource, 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_get_registry (void *object,
|
2017-03-09 19:21:50 +01:00
|
|
|
void *data,
|
|
|
|
|
size_t size)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosResource *resource = object;
|
2017-03-07 17:23:35 +01:00
|
|
|
SpaPODIter it;
|
2017-03-09 19:21:50 +01:00
|
|
|
int32_t new_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, &new_id,
|
|
|
|
|
0))
|
|
|
|
|
return false;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
2017-03-09 19:21:50 +01:00
|
|
|
((PinosCoreMethods*)resource->implementation)->get_registry (resource, new_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
|
|
|
core_demarshal_create_node (void *object,
|
2017-03-09 19:21:50 +01:00
|
|
|
void *data,
|
|
|
|
|
size_t size)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosResource *resource = object;
|
2017-03-07 17:23:35 +01:00
|
|
|
SpaPODIter it;
|
2017-03-09 19:21:50 +01:00
|
|
|
uint32_t new_id, i;
|
2017-03-06 15:48:04 +01:00
|
|
|
const char *factory_name, *name;
|
|
|
|
|
SpaDict props;
|
|
|
|
|
|
2017-03-07 17:23:35 +01:00
|
|
|
if (!spa_pod_iter_struct (&it, data, size) ||
|
|
|
|
|
!spa_pod_iter_get (&it,
|
|
|
|
|
SPA_POD_TYPE_STRING, &factory_name,
|
|
|
|
|
SPA_POD_TYPE_STRING, &name,
|
|
|
|
|
SPA_POD_TYPE_INT, &props.n_items,
|
|
|
|
|
0))
|
|
|
|
|
return false;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
|
|
|
|
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-07 17:23:35 +01:00
|
|
|
if (!spa_pod_iter_get (&it, SPA_POD_TYPE_INT, &new_id, 0))
|
|
|
|
|
return false;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
2017-03-09 13:00:56 +01:00
|
|
|
((PinosCoreMethods*)resource->implementation)->create_node (resource,
|
|
|
|
|
factory_name,
|
|
|
|
|
name,
|
|
|
|
|
&props,
|
|
|
|
|
new_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
|
|
|
core_demarshal_create_client_node (void *object,
|
2017-03-09 19:21:50 +01:00
|
|
|
void *data,
|
|
|
|
|
size_t size)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosResource *resource = object;
|
2017-03-07 17:23:35 +01:00
|
|
|
SpaPODIter it;
|
2017-03-09 19:21:50 +01:00
|
|
|
uint32_t new_id, i;
|
2017-03-06 15:48:04 +01:00
|
|
|
const char *name;
|
|
|
|
|
SpaDict props;
|
|
|
|
|
|
2017-03-07 17:23:35 +01:00
|
|
|
if (!spa_pod_iter_struct (&it, data, size) ||
|
|
|
|
|
!spa_pod_iter_get (&it,
|
|
|
|
|
SPA_POD_TYPE_STRING, &name,
|
|
|
|
|
SPA_POD_TYPE_INT, &props.n_items,
|
|
|
|
|
0))
|
|
|
|
|
return false;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
|
|
|
|
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-07 17:23:35 +01:00
|
|
|
if (!spa_pod_iter_get (&it, SPA_POD_TYPE_INT, &new_id, 0))
|
|
|
|
|
return false;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
2017-03-09 13:00:56 +01:00
|
|
|
((PinosCoreMethods*)resource->implementation)->create_client_node (resource,
|
|
|
|
|
name,
|
|
|
|
|
&props,
|
|
|
|
|
new_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
|
|
|
{
|
|
|
|
|
PinosResource *resource = 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
|
|
|
((PinosCoreMethods*)resource->implementation)->update_types (resource, first_id, n_types, types);
|
2017-03-14 20:18:31 +01:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-03 19:06:54 +01:00
|
|
|
static void
|
2017-03-06 15:48:04 +01:00
|
|
|
registry_marshal_global (void *object,
|
2017-03-09 19:21:50 +01:00
|
|
|
uint32_t id,
|
|
|
|
|
const char *type)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosResource *resource = object;
|
|
|
|
|
PinosConnection *connection = resource->client->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 (resource->client);
|
|
|
|
|
|
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_STRING, type);
|
2017-03-03 19:06:54 +01:00
|
|
|
|
2017-03-06 15:48:04 +01:00
|
|
|
pinos_connection_end_write (connection, resource->id, 0, b.b.offset);
|
2017-03-03 19:06:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2017-03-06 15:48:04 +01:00
|
|
|
registry_marshal_global_remove (void *object,
|
2017-03-09 19:21:50 +01:00
|
|
|
uint32_t id)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosResource *resource = object;
|
|
|
|
|
PinosConnection *connection = resource->client->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 (resource->client);
|
|
|
|
|
|
2017-03-17 11:58:09 +01:00
|
|
|
spa_pod_builder_struct (&b.b, &f,
|
|
|
|
|
SPA_POD_TYPE_INT, id);
|
2017-03-06 15:48:04 +01:00
|
|
|
|
|
|
|
|
pinos_connection_end_write (connection, resource->id, 1, 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
|
|
|
registry_demarshal_bind (void *object,
|
2017-03-09 19:21:50 +01:00
|
|
|
void *data,
|
|
|
|
|
size_t size)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosResource *resource = object;
|
2017-03-07 17:23:35 +01:00
|
|
|
SpaPODIter it;
|
|
|
|
|
uint32_t id, new_id;
|
2017-03-03 19:06:54 +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,
|
|
|
|
|
SPA_POD_TYPE_INT, &new_id,
|
|
|
|
|
0))
|
|
|
|
|
return false;
|
2017-03-03 19:06:54 +01:00
|
|
|
|
2017-03-09 13:00:56 +01:00
|
|
|
((PinosRegistryMethods*)resource->implementation)->bind (resource, id, new_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
|
|
|
module_marshal_info (void *object,
|
|
|
|
|
PinosModuleInfo *info)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosResource *resource = object;
|
|
|
|
|
PinosConnection *connection = resource->client->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-14 20:18:31 +01:00
|
|
|
core_update_map (resource->client);
|
|
|
|
|
|
2017-03-06 15:48:04 +01:00
|
|
|
n_items = info->props ? info->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, 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, 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->props->items[i].key,
|
|
|
|
|
SPA_POD_TYPE_STRING, info->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, resource->id, 0, b.b.offset);
|
2017-03-03 19:06:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2017-03-06 15:48:04 +01:00
|
|
|
node_marshal_info (void *object,
|
|
|
|
|
PinosNodeInfo *info)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosResource *resource = object;
|
|
|
|
|
PinosConnection *connection = resource->client->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-14 20:18:31 +01:00
|
|
|
core_update_map (resource->client);
|
|
|
|
|
|
2017-03-07 17:23:35 +01:00
|
|
|
spa_pod_builder_add (&b.b,
|
|
|
|
|
SPA_POD_TYPE_STRUCT, &f,
|
|
|
|
|
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-06 15:48:04 +01:00
|
|
|
for (i = 0; i < info->n_input_formats; i++)
|
2017-03-07 17:23:35 +01:00
|
|
|
spa_pod_builder_add (&b.b, SPA_POD_TYPE_POD, info->input_formats[i], 0);
|
|
|
|
|
|
|
|
|
|
spa_pod_builder_add (&b.b,
|
|
|
|
|
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-06 15:48:04 +01:00
|
|
|
for (i = 0; i < info->n_output_formats; i++)
|
2017-03-07 17:23:35 +01:00
|
|
|
spa_pod_builder_add (&b.b, SPA_POD_TYPE_POD, info->output_formats[i], 0);
|
|
|
|
|
|
2017-03-06 15:48:04 +01:00
|
|
|
n_items = info->props ? info->props->n_items : 0;
|
2017-03-07 17:23:35 +01:00
|
|
|
|
|
|
|
|
spa_pod_builder_add (&b.b,
|
|
|
|
|
SPA_POD_TYPE_INT, info->state,
|
|
|
|
|
SPA_POD_TYPE_STRING, info->error,
|
|
|
|
|
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->props->items[i].key,
|
|
|
|
|
SPA_POD_TYPE_STRING, info->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-06 15:48:04 +01:00
|
|
|
|
2017-03-09 19:21:50 +01:00
|
|
|
pinos_connection_end_write (connection, resource->id, 0, b.b.offset);
|
2017-03-06 15:48:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
client_marshal_info (void *object,
|
|
|
|
|
PinosClientInfo *info)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosResource *resource = object;
|
|
|
|
|
PinosConnection *connection = resource->client->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 (resource->client);
|
|
|
|
|
|
2017-03-06 15:48:04 +01:00
|
|
|
n_items = info->props ? info->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, info->id,
|
|
|
|
|
SPA_POD_TYPE_LONG, info->change_mask,
|
|
|
|
|
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->props->items[i].key,
|
|
|
|
|
SPA_POD_TYPE_STRING, info->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-06 15:48:04 +01:00
|
|
|
|
|
|
|
|
pinos_connection_end_write (connection, resource->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_done (void *object,
|
|
|
|
|
int datafd)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosResource *resource = object;
|
|
|
|
|
PinosConnection *connection = resource->client->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 (resource->client);
|
|
|
|
|
|
2017-03-17 11:58:09 +01:00
|
|
|
spa_pod_builder_struct (&b.b, &f,
|
|
|
|
|
SPA_POD_TYPE_INT, pinos_connection_add_fd (connection, datafd));
|
2017-03-03 19:06:54 +01:00
|
|
|
|
2017-03-06 15:48:04 +01:00
|
|
|
pinos_connection_end_write (connection, resource->id, 0, 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,
|
|
|
|
|
const SpaEvent *event)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosResource *resource = object;
|
|
|
|
|
PinosConnection *connection = resource->client->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 (resource->client);
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
pinos_connection_end_write (connection, resource->id, 1, b.b.offset);
|
2017-03-03 19:06:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2017-03-06 15:48:04 +01:00
|
|
|
client_node_marshal_add_port (void *object,
|
|
|
|
|
uint32_t seq,
|
|
|
|
|
SpaDirection direction,
|
|
|
|
|
uint32_t port_id)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosResource *resource = object;
|
|
|
|
|
PinosConnection *connection = resource->client->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 (resource->client);
|
|
|
|
|
|
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, seq,
|
|
|
|
|
SPA_POD_TYPE_INT, direction,
|
2017-03-17 11:58:09 +01:00
|
|
|
SPA_POD_TYPE_INT, port_id);
|
2017-03-03 19:06:54 +01:00
|
|
|
|
2017-03-06 15:48:04 +01:00
|
|
|
pinos_connection_end_write (connection, resource->id, 2, b.b.offset);
|
2017-03-03 19:06:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2017-03-06 15:48:04 +01:00
|
|
|
client_node_marshal_remove_port (void *object,
|
|
|
|
|
uint32_t seq,
|
|
|
|
|
SpaDirection direction,
|
|
|
|
|
uint32_t port_id)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosResource *resource = object;
|
|
|
|
|
PinosConnection *connection = resource->client->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 (resource->client);
|
|
|
|
|
|
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, seq,
|
|
|
|
|
SPA_POD_TYPE_INT, direction,
|
2017-03-17 11:58:09 +01:00
|
|
|
SPA_POD_TYPE_INT, port_id);
|
2017-03-03 19:06:54 +01:00
|
|
|
|
2017-03-06 15:48:04 +01:00
|
|
|
pinos_connection_end_write (connection, resource->id, 3, b.b.offset);
|
2017-03-03 19:06:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2017-03-06 15:48:04 +01:00
|
|
|
client_node_marshal_set_format (void *object,
|
2017-03-03 19:06:54 +01:00
|
|
|
uint32_t seq,
|
2017-03-06 15:48:04 +01:00
|
|
|
SpaDirection direction,
|
|
|
|
|
uint32_t port_id,
|
|
|
|
|
SpaPortFormatFlags flags,
|
|
|
|
|
const SpaFormat *format)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosResource *resource = object;
|
|
|
|
|
PinosConnection *connection = resource->client->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 (resource->client);
|
|
|
|
|
|
2017-03-23 16:08:50 +01:00
|
|
|
spa_pod_builder_struct (&b.b, &f,
|
|
|
|
|
SPA_POD_TYPE_INT, seq,
|
|
|
|
|
SPA_POD_TYPE_INT, direction,
|
|
|
|
|
SPA_POD_TYPE_INT, port_id,
|
|
|
|
|
SPA_POD_TYPE_INT, flags,
|
|
|
|
|
SPA_POD_TYPE_POD, format);
|
2017-03-03 19:06:54 +01:00
|
|
|
|
2017-03-06 15:48:04 +01:00
|
|
|
pinos_connection_end_write (connection, resource->id, 4, b.b.offset);
|
2017-03-03 19:06:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2017-03-06 15:48:04 +01:00
|
|
|
client_node_marshal_set_property (void *object,
|
|
|
|
|
uint32_t seq,
|
|
|
|
|
uint32_t id,
|
2017-03-07 11:56:43 +01:00
|
|
|
uint32_t size,
|
2017-03-06 15:48:04 +01:00
|
|
|
const void *value)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosResource *resource = object;
|
|
|
|
|
PinosConnection *connection = resource->client->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 (resource->client);
|
|
|
|
|
|
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, seq,
|
|
|
|
|
SPA_POD_TYPE_INT, id,
|
2017-03-17 11:58:09 +01:00
|
|
|
SPA_POD_TYPE_BYTES, value, size);
|
2017-03-06 15:48:04 +01:00
|
|
|
|
|
|
|
|
pinos_connection_end_write (connection, resource->id, 5, b.b.offset);
|
2017-03-03 19:06:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2017-03-06 15:48:04 +01:00
|
|
|
client_node_marshal_add_mem (void *object,
|
|
|
|
|
SpaDirection direction,
|
|
|
|
|
uint32_t port_id,
|
|
|
|
|
uint32_t mem_id,
|
|
|
|
|
SpaDataType type,
|
|
|
|
|
int memfd,
|
|
|
|
|
uint32_t flags,
|
2017-03-07 11:56:43 +01:00
|
|
|
uint32_t offset,
|
|
|
|
|
uint32_t size)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosResource *resource = object;
|
|
|
|
|
PinosConnection *connection = resource->client->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 (resource->client);
|
|
|
|
|
|
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, direction,
|
|
|
|
|
SPA_POD_TYPE_INT, port_id,
|
|
|
|
|
SPA_POD_TYPE_INT, mem_id,
|
|
|
|
|
SPA_POD_TYPE_INT, type,
|
|
|
|
|
SPA_POD_TYPE_INT, pinos_connection_add_fd (connection, memfd),
|
|
|
|
|
SPA_POD_TYPE_INT, flags,
|
|
|
|
|
SPA_POD_TYPE_INT, offset,
|
2017-03-17 11:58:09 +01:00
|
|
|
SPA_POD_TYPE_INT, size);
|
2017-03-03 19:06:54 +01:00
|
|
|
|
2017-03-06 15:48:04 +01:00
|
|
|
pinos_connection_end_write (connection, resource->id, 6, b.b.offset);
|
2017-03-03 19:06:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2017-03-06 15:48:04 +01:00
|
|
|
client_node_marshal_use_buffers (void *object,
|
|
|
|
|
uint32_t seq,
|
|
|
|
|
SpaDirection direction,
|
|
|
|
|
uint32_t port_id,
|
2017-03-07 11:56:43 +01:00
|
|
|
uint32_t n_buffers,
|
2017-03-06 15:48:04 +01:00
|
|
|
PinosClientNodeBuffer *buffers)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosResource *resource = object;
|
|
|
|
|
PinosConnection *connection = resource->client->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, j;
|
|
|
|
|
|
2017-03-14 20:18:31 +01:00
|
|
|
core_update_map (resource->client);
|
|
|
|
|
|
2017-03-07 17:23:35 +01:00
|
|
|
spa_pod_builder_add (&b.b,
|
|
|
|
|
SPA_POD_TYPE_STRUCT, &f,
|
|
|
|
|
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-06 15:48:04 +01:00
|
|
|
|
|
|
|
|
for (i = 0; i < n_buffers; i++) {
|
|
|
|
|
SpaBuffer *buf = buffers[i].buffer;
|
|
|
|
|
|
2017-03-07 17:23:35 +01:00
|
|
|
spa_pod_builder_add (&b.b,
|
|
|
|
|
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-06 15:48:04 +01:00
|
|
|
for (j = 0; j < buf->n_metas; j++) {
|
|
|
|
|
SpaMeta *m = &buf->metas[j];
|
2017-03-07 17:23:35 +01:00
|
|
|
spa_pod_builder_add (&b.b,
|
|
|
|
|
SPA_POD_TYPE_INT, m->type,
|
|
|
|
|
SPA_POD_TYPE_INT, m->size, 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, buf->n_datas, 0);
|
2017-03-06 15:48:04 +01:00
|
|
|
for (j = 0; j < buf->n_datas; j++) {
|
|
|
|
|
SpaData *d = &buf->datas[j];
|
2017-03-07 17:23:35 +01:00
|
|
|
spa_pod_builder_add (&b.b,
|
|
|
|
|
SPA_POD_TYPE_INT, d->type,
|
|
|
|
|
SPA_POD_TYPE_INT, SPA_PTR_TO_UINT32 (d->data),
|
|
|
|
|
SPA_POD_TYPE_INT, d->flags,
|
|
|
|
|
SPA_POD_TYPE_INT, d->mapoffset,
|
|
|
|
|
SPA_POD_TYPE_INT, d->maxsize, 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-06 15:48:04 +01:00
|
|
|
|
|
|
|
|
pinos_connection_end_write (connection, resource->id, 7, b.b.offset);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2017-03-22 10:04:24 +01:00
|
|
|
client_node_marshal_node_command (void *object,
|
|
|
|
|
uint32_t seq,
|
|
|
|
|
const SpaCommand *command)
|
2017-03-06 15:48:04 +01:00
|
|
|
{
|
|
|
|
|
PinosResource *resource = object;
|
|
|
|
|
PinosConnection *connection = resource->client->protocol_private;
|
|
|
|
|
Builder b = { { NULL, 0, 0, NULL, write_pod }, connection };
|
|
|
|
|
SpaPODFrame f;
|
|
|
|
|
|
2017-03-14 20:18:31 +01:00
|
|
|
core_update_map (resource->client);
|
|
|
|
|
|
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, seq,
|
2017-03-17 11:58:09 +01:00
|
|
|
SPA_POD_TYPE_POD, command);
|
2017-03-03 19:06:54 +01:00
|
|
|
|
2017-03-06 15:48:04 +01:00
|
|
|
pinos_connection_end_write (connection, resource->id, 8, b.b.offset);
|
2017-03-03 19:06:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2017-03-22 10:04:24 +01:00
|
|
|
client_node_marshal_port_command (void *object,
|
|
|
|
|
uint32_t port_id,
|
|
|
|
|
const SpaCommand *command)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosResource *resource = object;
|
|
|
|
|
PinosConnection *connection = resource->client->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 (resource->client);
|
|
|
|
|
|
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, port_id,
|
2017-03-17 11:58:09 +01:00
|
|
|
SPA_POD_TYPE_POD, command);
|
2017-03-03 19:06:54 +01:00
|
|
|
|
2017-03-06 15:48:04 +01:00
|
|
|
pinos_connection_end_write (connection, resource->id, 9, b.b.offset);
|
2017-03-03 19:06:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2017-03-06 15:48:04 +01:00
|
|
|
client_node_marshal_transport (void *object,
|
|
|
|
|
int memfd,
|
2017-03-07 11:56:43 +01:00
|
|
|
uint32_t offset,
|
|
|
|
|
uint32_t size)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosResource *resource = object;
|
|
|
|
|
PinosConnection *connection = resource->client->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 (resource->client);
|
|
|
|
|
|
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, pinos_connection_add_fd (connection, memfd),
|
|
|
|
|
SPA_POD_TYPE_INT, offset,
|
2017-03-17 11:58:09 +01:00
|
|
|
SPA_POD_TYPE_INT, size);
|
2017-03-06 15:48:04 +01:00
|
|
|
|
|
|
|
|
pinos_connection_end_write (connection, resource->id, 10, 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_update (void *object,
|
|
|
|
|
void *data,
|
|
|
|
|
size_t size)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosResource *resource = object;
|
2017-03-07 17:23:35 +01:00
|
|
|
SpaPODIter it;
|
2017-03-23 16:08:50 +01:00
|
|
|
uint32_t change_mask, max_input_ports, max_output_ports;
|
|
|
|
|
const SpaProps *props;
|
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, &change_mask,
|
|
|
|
|
SPA_POD_TYPE_INT, &max_input_ports,
|
|
|
|
|
SPA_POD_TYPE_INT, &max_output_ports,
|
2017-03-23 16:57:33 +01:00
|
|
|
-SPA_POD_TYPE_OBJECT, &props,
|
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
|
|
|
((PinosClientNodeMethods*)resource->implementation)->update (resource, change_mask, max_input_ports, max_output_ports, props);
|
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_update (void *object,
|
|
|
|
|
void *data,
|
|
|
|
|
size_t size)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosResource *resource = object;
|
2017-03-07 17:23:35 +01:00
|
|
|
SpaPODIter it;
|
2017-03-23 16:57:33 +01:00
|
|
|
uint32_t i, direction, port_id, change_mask, n_possible_formats;
|
2017-03-06 15:48:04 +01:00
|
|
|
const SpaProps *props = NULL;
|
|
|
|
|
const SpaFormat **possible_formats = NULL, *format = NULL;
|
|
|
|
|
SpaPortInfo info, *infop = NULL;
|
2017-03-23 16:57:33 +01:00
|
|
|
SpaPOD *ipod;
|
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, &direction,
|
|
|
|
|
SPA_POD_TYPE_INT, &port_id,
|
|
|
|
|
SPA_POD_TYPE_INT, &change_mask,
|
|
|
|
|
SPA_POD_TYPE_INT, &n_possible_formats,
|
|
|
|
|
0))
|
|
|
|
|
return false;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
|
|
|
|
possible_formats = alloca (n_possible_formats * sizeof (SpaFormat*));
|
|
|
|
|
for (i = 0; i < n_possible_formats; i++)
|
2017-03-23 16:57:33 +01:00
|
|
|
if (!spa_pod_iter_get (&it, SPA_POD_TYPE_OBJECT, &possible_formats[i], 0))
|
2017-03-07 17:23:35 +01:00
|
|
|
return false;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
2017-03-23 16:08:50 +01:00
|
|
|
if (!spa_pod_iter_get (&it,
|
2017-03-23 16:57:33 +01:00
|
|
|
-SPA_POD_TYPE_OBJECT, &format,
|
|
|
|
|
-SPA_POD_TYPE_OBJECT, &props,
|
|
|
|
|
-SPA_POD_TYPE_STRUCT, &ipod,
|
2017-03-23 16:08:50 +01:00
|
|
|
0))
|
2017-03-07 17:23:35 +01:00
|
|
|
return false;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
2017-03-23 16:57:33 +01:00
|
|
|
if (ipod) {
|
2017-03-06 15:48:04 +01:00
|
|
|
SpaDict dict;
|
2017-03-23 16:57:33 +01:00
|
|
|
SpaPODIter it2;
|
2017-03-06 15:48:04 +01:00
|
|
|
infop = &info;
|
|
|
|
|
|
2017-03-23 16:57:33 +01:00
|
|
|
if (!spa_pod_iter_pod (&it2, ipod) ||
|
|
|
|
|
!spa_pod_iter_get (&it2,
|
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))
|
|
|
|
|
return false;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
|
|
|
|
info.params = alloca (info.n_params * sizeof (SpaAllocParam *));
|
|
|
|
|
for (i = 0; i < info.n_params; i++)
|
2017-03-23 16:57:33 +01:00
|
|
|
if (!spa_pod_iter_get (&it2, SPA_POD_TYPE_OBJECT, &info.params[i], 0))
|
2017-03-07 17:23:35 +01:00
|
|
|
return false;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
2017-03-23 16:57:33 +01:00
|
|
|
if (!spa_pod_iter_get (&it2, SPA_POD_TYPE_INT, &dict.n_items, 0))
|
2017-03-07 17:23:35 +01:00
|
|
|
return false;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
|
|
|
|
info.extra = &dict;
|
|
|
|
|
dict.items = alloca (dict.n_items * sizeof (SpaDictItem));
|
|
|
|
|
for (i = 0; i < dict.n_items; i++) {
|
2017-03-23 16:57:33 +01:00
|
|
|
if (!spa_pod_iter_get (&it2,
|
2017-03-07 17:23:35 +01:00
|
|
|
SPA_POD_TYPE_STRING, &dict.items[i].key,
|
|
|
|
|
SPA_POD_TYPE_STRING, &dict.items[i].value,
|
|
|
|
|
0))
|
|
|
|
|
return false;
|
2017-03-06 15:48:04 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-09 13:00:56 +01:00
|
|
|
((PinosClientNodeMethods*)resource->implementation)->port_update (resource,
|
2017-03-06 15:48:04 +01:00
|
|
|
direction,
|
|
|
|
|
port_id,
|
|
|
|
|
change_mask,
|
|
|
|
|
n_possible_formats,
|
|
|
|
|
possible_formats,
|
|
|
|
|
format,
|
|
|
|
|
props,
|
|
|
|
|
infop);
|
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,
|
2017-03-03 19:06:54 +01:00
|
|
|
void *data,
|
|
|
|
|
size_t size)
|
|
|
|
|
{
|
|
|
|
|
PinosResource *resource = object;
|
2017-03-07 17:23:35 +01:00
|
|
|
SpaPODIter it;
|
2017-03-21 20:39:20 +01:00
|
|
|
SpaEvent *event;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
2017-03-07 17:23:35 +01:00
|
|
|
if (!spa_pod_iter_struct (&it, data, size) ||
|
2017-03-15 16:21:05 +01:00
|
|
|
!spa_pod_iter_get (&it, SPA_POD_TYPE_OBJECT, &event, 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
|
|
|
((PinosClientNodeMethods*)resource->implementation)->event (resource, 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_destroy (void *object,
|
2017-03-03 19:06:54 +01:00
|
|
|
void *data,
|
|
|
|
|
size_t size)
|
|
|
|
|
{
|
|
|
|
|
PinosResource *resource = object;
|
2017-03-07 17:23:35 +01:00
|
|
|
SpaPODIter it;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
2017-03-09 19:21:50 +01:00
|
|
|
if (!spa_pod_iter_struct (&it, data, size))
|
2017-03-07 17:23:35 +01:00
|
|
|
return false;
|
2017-03-06 15:48:04 +01:00
|
|
|
|
2017-03-09 19:21:50 +01:00
|
|
|
((PinosClientNodeMethods*)resource->implementation)->destroy (resource);
|
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
|
|
|
link_marshal_info (void *object,
|
2017-03-07 17:23:35 +01:00
|
|
|
PinosLinkInfo *info)
|
2017-03-03 19:06:54 +01:00
|
|
|
{
|
|
|
|
|
PinosResource *resource = object;
|
|
|
|
|
PinosConnection *connection = resource->client->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 (resource->client);
|
|
|
|
|
|
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, info->id,
|
|
|
|
|
SPA_POD_TYPE_LONG, info->change_mask,
|
2017-03-09 13:00:56 +01:00
|
|
|
SPA_POD_TYPE_INT, info->output_node_id,
|
|
|
|
|
SPA_POD_TYPE_INT, info->output_port_id,
|
|
|
|
|
SPA_POD_TYPE_INT, info->input_node_id,
|
2017-03-17 11:58:09 +01:00
|
|
|
SPA_POD_TYPE_INT, info->input_port_id);
|
2017-03-03 19:06:54 +01:00
|
|
|
|
2017-03-06 15:48:04 +01:00
|
|
|
pinos_connection_end_write (connection, resource->id, 0, b.b.offset);
|
2017-03-03 19:06:54 +01:00
|
|
|
}
|
|
|
|
|
|
2017-03-09 13:00:56 +01:00
|
|
|
static const PinosDemarshalFunc pinos_protocol_native_server_core_demarshal[] = {
|
|
|
|
|
&core_demarshal_client_update,
|
|
|
|
|
&core_demarshal_sync,
|
|
|
|
|
&core_demarshal_get_registry,
|
|
|
|
|
&core_demarshal_create_node,
|
2017-03-14 20:18:31 +01:00
|
|
|
&core_demarshal_create_client_node,
|
2017-03-24 11:40:58 +01:00
|
|
|
&core_demarshal_update_types
|
2017-03-09 13:00:56 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static const PinosCoreEvents pinos_protocol_native_server_core_events = {
|
2017-03-06 15:48:04 +01:00
|
|
|
&core_marshal_info,
|
|
|
|
|
&core_marshal_done,
|
|
|
|
|
&core_marshal_error,
|
2017-03-14 20:18:31 +01:00
|
|
|
&core_marshal_remove_id,
|
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
|
|
|
const PinosInterface pinos_protocol_native_server_core_interface = {
|
2017-03-14 20:18:31 +01:00
|
|
|
6, pinos_protocol_native_server_core_demarshal,
|
|
|
|
|
5, &pinos_protocol_native_server_core_events,
|
2017-03-03 19:06:54 +01:00
|
|
|
};
|
|
|
|
|
|
2017-03-09 13:00:56 +01:00
|
|
|
static const PinosDemarshalFunc pinos_protocol_native_server_registry_demarshal[] = {
|
|
|
|
|
®istry_demarshal_bind,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static const PinosRegistryEvents pinos_protocol_native_server_registry_events = {
|
2017-03-06 15:48:04 +01:00
|
|
|
®istry_marshal_global,
|
|
|
|
|
®istry_marshal_global_remove,
|
2017-03-03 19:06:54 +01:00
|
|
|
};
|
|
|
|
|
|
2017-03-09 13:00:56 +01:00
|
|
|
const PinosInterface pinos_protocol_native_server_registry_interface = {
|
|
|
|
|
1, pinos_protocol_native_server_registry_demarshal,
|
|
|
|
|
2, &pinos_protocol_native_server_registry_events,
|
2017-03-03 19:06:54 +01:00
|
|
|
};
|
|
|
|
|
|
2017-03-09 13:00:56 +01:00
|
|
|
static const PinosModuleEvents pinos_protocol_native_server_module_events = {
|
2017-03-06 15:48:04 +01:00
|
|
|
&module_marshal_info,
|
2017-03-03 19:06:54 +01:00
|
|
|
};
|
|
|
|
|
|
2017-03-09 13:00:56 +01:00
|
|
|
const PinosInterface pinos_protocol_native_server_module_interface = {
|
|
|
|
|
0, NULL,
|
|
|
|
|
1, &pinos_protocol_native_server_module_events,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static const PinosNodeEvents pinos_protocol_native_server_node_events = {
|
2017-03-06 15:48:04 +01:00
|
|
|
&node_marshal_info,
|
2017-03-03 19:06:54 +01:00
|
|
|
};
|
|
|
|
|
|
2017-03-09 13:00:56 +01:00
|
|
|
const PinosInterface pinos_protocol_native_server_node_interface = {
|
|
|
|
|
0, NULL,
|
2017-03-09 19:21:50 +01:00
|
|
|
1, &pinos_protocol_native_server_node_events,
|
2017-03-09 13:00:56 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static const PinosClientEvents pinos_protocol_native_server_client_events = {
|
2017-03-06 15:48:04 +01:00
|
|
|
&client_marshal_info,
|
2017-03-03 19:06:54 +01:00
|
|
|
};
|
|
|
|
|
|
2017-03-09 13:00:56 +01:00
|
|
|
const PinosInterface pinos_protocol_native_server_client_interface = {
|
|
|
|
|
0, NULL,
|
|
|
|
|
2, &pinos_protocol_native_server_client_events,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static const PinosDemarshalFunc pinos_protocol_native_server_client_node_demarshal[] = {
|
|
|
|
|
&client_node_demarshal_update,
|
|
|
|
|
&client_node_demarshal_port_update,
|
|
|
|
|
&client_node_demarshal_event,
|
|
|
|
|
&client_node_demarshal_destroy,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static const PinosClientNodeEvents pinos_protocol_native_server_client_node_events = {
|
2017-03-06 15:48:04 +01:00
|
|
|
&client_node_marshal_done,
|
|
|
|
|
&client_node_marshal_event,
|
|
|
|
|
&client_node_marshal_add_port,
|
|
|
|
|
&client_node_marshal_remove_port,
|
|
|
|
|
&client_node_marshal_set_format,
|
|
|
|
|
&client_node_marshal_set_property,
|
|
|
|
|
&client_node_marshal_add_mem,
|
|
|
|
|
&client_node_marshal_use_buffers,
|
|
|
|
|
&client_node_marshal_node_command,
|
|
|
|
|
&client_node_marshal_port_command,
|
|
|
|
|
&client_node_marshal_transport,
|
2017-03-03 19:06:54 +01:00
|
|
|
};
|
|
|
|
|
|
2017-03-09 13:00:56 +01:00
|
|
|
const PinosInterface pinos_protocol_native_server_client_node_interface = {
|
2017-04-08 20:33:54 +02:00
|
|
|
4, &pinos_protocol_native_server_client_node_demarshal,
|
2017-03-09 13:00:56 +01:00
|
|
|
11, &pinos_protocol_native_server_client_node_events,
|
2017-03-03 19:06:54 +01:00
|
|
|
};
|
|
|
|
|
|
2017-03-09 13:00:56 +01:00
|
|
|
static const PinosLinkEvents pinos_protocol_native_server_link_events = {
|
2017-03-06 15:48:04 +01:00
|
|
|
&link_marshal_info,
|
2017-03-03 19:06:54 +01:00
|
|
|
};
|
2017-03-09 13:00:56 +01:00
|
|
|
|
|
|
|
|
const PinosInterface pinos_protocol_native_server_link_interface = {
|
|
|
|
|
0, NULL,
|
|
|
|
|
1, &pinos_protocol_native_server_link_events,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
|
pinos_protocol_native_server_setup (PinosResource *resource)
|
|
|
|
|
{
|
|
|
|
|
const PinosInterface *iface;
|
2017-03-24 11:40:58 +01:00
|
|
|
if (resource->type == resource->core->type.core) {
|
2017-03-09 13:00:56 +01:00
|
|
|
iface = &pinos_protocol_native_server_core_interface;
|
|
|
|
|
}
|
2017-03-24 11:40:58 +01:00
|
|
|
else if (resource->type == resource->core->type.registry) {
|
2017-03-09 13:00:56 +01:00
|
|
|
iface = &pinos_protocol_native_server_registry_interface;
|
|
|
|
|
}
|
2017-03-24 11:40:58 +01:00
|
|
|
else if (resource->type == resource->core->type.module) {
|
2017-03-09 13:00:56 +01:00
|
|
|
iface = &pinos_protocol_native_server_module_interface;
|
|
|
|
|
}
|
2017-03-24 11:40:58 +01:00
|
|
|
else if (resource->type == resource->core->type.node) {
|
2017-03-09 13:00:56 +01:00
|
|
|
iface = &pinos_protocol_native_server_node_interface;
|
|
|
|
|
}
|
2017-03-24 11:40:58 +01:00
|
|
|
else if (resource->type == resource->core->type.client) {
|
2017-03-09 13:00:56 +01:00
|
|
|
iface = &pinos_protocol_native_server_client_interface;
|
|
|
|
|
}
|
2017-03-24 11:40:58 +01:00
|
|
|
else if (resource->type == resource->core->type.client_node) {
|
2017-03-09 13:00:56 +01:00
|
|
|
iface = &pinos_protocol_native_server_client_node_interface;
|
|
|
|
|
}
|
2017-03-24 11:40:58 +01:00
|
|
|
else if (resource->type == resource->core->type.link) {
|
2017-03-09 13:00:56 +01:00
|
|
|
iface = &pinos_protocol_native_server_link_interface;
|
|
|
|
|
} else
|
|
|
|
|
return false;
|
|
|
|
|
resource->iface = iface;
|
|
|
|
|
return true;
|
|
|
|
|
}
|