2023-02-08 18:12:00 +01:00
|
|
|
/* AVB support */
|
|
|
|
|
/* SPDX-FileCopyrightText: Copyright © 2022 Wim Taymans */
|
2025-11-12 09:17:04 +01:00
|
|
|
/* SPDX-FileCopyrightText: Copyright © 2025 Kebag-Logic */
|
|
|
|
|
/* SPDX-FileCopyrightText: Copyright © 2025 Alexandre Malki <alexandre.malki@kebag-logic.com> */
|
2023-02-08 18:12:00 +01:00
|
|
|
/* SPDX-License-Identifier: MIT */
|
2022-03-22 19:40:23 +01:00
|
|
|
|
2022-04-03 17:52:28 +02:00
|
|
|
#include <unistd.h>
|
|
|
|
|
|
2022-03-22 19:40:23 +01:00
|
|
|
#include <spa/debug/mem.h>
|
|
|
|
|
|
|
|
|
|
#include <pipewire/pipewire.h>
|
|
|
|
|
|
|
|
|
|
#include "utils.h"
|
|
|
|
|
#include "msrp.h"
|
2026-04-12 11:12:15 +02:00
|
|
|
#include "acmp.h"
|
2026-04-25 07:01:14 +02:00
|
|
|
#include "stream.h"
|
2026-04-25 08:16:27 +02:00
|
|
|
#include "aecp-aem.h"
|
|
|
|
|
#include "aecp-aem-state.h"
|
2022-03-22 19:40:23 +01:00
|
|
|
|
2022-04-03 12:32:25 +02:00
|
|
|
static const uint8_t msrp_mac[6] = AVB_MSRP_MAC;
|
2022-03-22 19:40:23 +01:00
|
|
|
|
|
|
|
|
struct attr {
|
2026-03-15 10:22:48 +01:00
|
|
|
struct avb_msrp_attribute *attr;
|
2022-04-05 18:10:27 +02:00
|
|
|
struct msrp *msrp;
|
|
|
|
|
struct spa_hook listener;
|
2022-03-22 19:40:23 +01:00
|
|
|
struct spa_list link;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct msrp {
|
|
|
|
|
struct server *server;
|
|
|
|
|
struct spa_hook server_listener;
|
2022-03-23 19:57:25 +01:00
|
|
|
struct spa_hook mrp_listener;
|
2022-03-22 19:40:23 +01:00
|
|
|
|
2022-04-03 12:32:25 +02:00
|
|
|
struct spa_source *source;
|
|
|
|
|
|
2022-03-22 19:40:23 +01:00
|
|
|
struct spa_list attributes;
|
|
|
|
|
};
|
|
|
|
|
|
2022-03-25 10:28:18 +01:00
|
|
|
static void debug_msrp_talker_common(const struct avb_packet_msrp_talker *t)
|
2022-03-22 19:40:23 +01:00
|
|
|
{
|
2022-03-23 19:57:25 +01:00
|
|
|
char buf[128];
|
2022-03-25 10:28:18 +01:00
|
|
|
pw_log_info(" stream-id: %s", avb_utils_format_id(buf, sizeof(buf), be64toh(t->stream_id)));
|
|
|
|
|
pw_log_info(" dest-addr: %s", avb_utils_format_addr(buf, sizeof(buf), t->dest_addr));
|
2022-03-23 19:57:25 +01:00
|
|
|
pw_log_info(" vlan-id: %d", ntohs(t->vlan_id));
|
|
|
|
|
pw_log_info(" tspec-max-frame-size: %d", ntohs(t->tspec_max_frame_size));
|
|
|
|
|
pw_log_info(" tspec-max-interval-frames: %d", ntohs(t->tspec_max_interval_frames));
|
|
|
|
|
pw_log_info(" priority: %d", t->priority);
|
|
|
|
|
pw_log_info(" rank: %d", t->rank);
|
|
|
|
|
pw_log_info(" accumulated-latency: %d", ntohl(t->accumulated_latency));
|
2022-03-22 19:40:23 +01:00
|
|
|
}
|
|
|
|
|
|
2022-03-25 10:28:18 +01:00
|
|
|
static void debug_msrp_talker(const struct avb_packet_msrp_talker *t)
|
2022-03-24 17:00:40 +01:00
|
|
|
{
|
|
|
|
|
pw_log_info("talker");
|
|
|
|
|
debug_msrp_talker_common(t);
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-25 07:01:14 +02:00
|
|
|
/* IEEE 802.1Q Section 35.2.2.4.4: Listener may declare Ready only once the matching
|
|
|
|
|
* Talker Advertise is registered; otherwise it stays in AskingFailed. */
|
2022-03-24 17:00:40 +01:00
|
|
|
static void notify_talker(struct msrp *msrp, uint64_t now, struct attr *attr, uint8_t notify)
|
|
|
|
|
{
|
2026-04-25 07:01:14 +02:00
|
|
|
struct stream_common *sc;
|
2026-04-25 08:16:27 +02:00
|
|
|
char label[64];
|
2026-04-25 07:01:14 +02:00
|
|
|
|
2026-04-25 13:32:16 +02:00
|
|
|
pw_log_info("> notify talker advertise: %s", avb_mrp_notify_name(notify));
|
2026-04-25 08:16:27 +02:00
|
|
|
snprintf(label, sizeof(label), "MSRP talker-adv %s", avb_mrp_notify_name(notify));
|
|
|
|
|
avb_log_state(msrp->server, label);
|
2026-03-15 10:22:48 +01:00
|
|
|
if (msrp->server->avb_mode == AVB_MODE_MILAN_V12) {
|
2026-04-12 11:12:15 +02:00
|
|
|
uint64_t stream_id = be64toh(attr->attr->attr.talker.stream_id);
|
|
|
|
|
if (notify == AVB_MRP_NOTIFY_NEW || notify == AVB_MRP_NOTIFY_JOIN)
|
|
|
|
|
handle_evt_tk_discovered(msrp->server->acmp, stream_id, now);
|
|
|
|
|
else if (notify == AVB_MRP_NOTIFY_LEAVE)
|
|
|
|
|
handle_evt_tk_departed(msrp->server->acmp, stream_id, now);
|
2026-03-15 10:22:48 +01:00
|
|
|
}
|
2026-04-25 07:01:14 +02:00
|
|
|
|
|
|
|
|
sc = SPA_CONTAINER_OF(attr->attr, struct stream_common, tastream_attr);
|
|
|
|
|
if (sc->stream.direction == SPA_DIRECTION_INPUT) {
|
|
|
|
|
if (notify == AVB_MRP_NOTIFY_NEW || notify == AVB_MRP_NOTIFY_JOIN)
|
|
|
|
|
sc->lstream_attr.param = AVB_MSRP_LISTENER_PARAM_READY;
|
|
|
|
|
else if (notify == AVB_MRP_NOTIFY_LEAVE)
|
|
|
|
|
sc->lstream_attr.param = AVB_MSRP_LISTENER_PARAM_ASKING_FAILED;
|
2026-04-25 13:45:44 +02:00
|
|
|
/* Milan Table 5.10: TA registrar state flips flags_ex.REGISTERING
|
|
|
|
|
* in the listener-side GET_STREAM_INFO answer — emit an unsol. */
|
|
|
|
|
avb_aecp_aem_mark_stream_info_dirty(msrp->server,
|
|
|
|
|
AVB_AEM_DESC_STREAM_INPUT, sc->stream.index);
|
2026-04-25 07:01:14 +02:00
|
|
|
}
|
2026-03-15 10:22:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void notify_talker_failed(struct msrp *msrp, uint64_t now, struct attr *attr, uint8_t notify)
|
|
|
|
|
{
|
2026-04-25 13:45:44 +02:00
|
|
|
struct stream_common *sc;
|
2026-04-25 08:16:27 +02:00
|
|
|
char label[64];
|
2026-04-25 13:45:44 +02:00
|
|
|
|
2026-04-25 13:32:16 +02:00
|
|
|
pw_log_info("> notify talker failed: %s", avb_mrp_notify_name(notify));
|
2026-04-25 08:16:27 +02:00
|
|
|
snprintf(label, sizeof(label), "MSRP talker-fail %s", avb_mrp_notify_name(notify));
|
|
|
|
|
avb_log_state(msrp->server, label);
|
2026-03-15 10:22:48 +01:00
|
|
|
|
|
|
|
|
if (msrp->server->avb_mode == AVB_MODE_MILAN_V12) {
|
2026-04-12 13:14:58 +02:00
|
|
|
if (notify == AVB_MRP_NOTIFY_NEW || notify == AVB_MRP_NOTIFY_JOIN)
|
|
|
|
|
handle_evt_tk_registration_failed(msrp->server->acmp, attr->attr, now);
|
2026-03-15 10:22:48 +01:00
|
|
|
}
|
2026-04-25 13:45:44 +02:00
|
|
|
|
|
|
|
|
/* Milan Table 5.10: TF registrar state also flips flags_ex.REGISTERING
|
|
|
|
|
* on the listener side; emit an unsol when it changes. */
|
|
|
|
|
sc = SPA_CONTAINER_OF(attr->attr, struct stream_common, tfstream_attr);
|
|
|
|
|
if (sc->stream.direction == SPA_DIRECTION_INPUT)
|
|
|
|
|
avb_aecp_aem_mark_stream_info_dirty(msrp->server,
|
|
|
|
|
AVB_AEM_DESC_STREAM_INPUT, sc->stream.index);
|
2022-03-24 17:00:40 +01:00
|
|
|
}
|
|
|
|
|
|
2022-03-23 19:57:25 +01:00
|
|
|
static int process_talker(struct msrp *msrp, uint64_t now, uint8_t attr_type,
|
2022-03-22 19:40:23 +01:00
|
|
|
const void *m, uint8_t event, uint8_t param, int num)
|
|
|
|
|
{
|
2022-03-25 10:28:18 +01:00
|
|
|
const struct avb_packet_msrp_talker *t = m;
|
2022-03-22 19:40:23 +01:00
|
|
|
struct attr *a;
|
2026-04-12 11:12:15 +02:00
|
|
|
spa_list_for_each(a, &msrp->attributes, link) {
|
2026-03-15 10:22:48 +01:00
|
|
|
if (a->attr->type == attr_type &&
|
|
|
|
|
a->attr->attr.talker.stream_id == t->stream_id) {
|
|
|
|
|
a->attr->attr.talker = *t;
|
|
|
|
|
avb_mrp_attribute_rx_event(a->attr->mrp, now, event);
|
2022-03-24 17:00:40 +01:00
|
|
|
}
|
2026-04-12 11:12:15 +02:00
|
|
|
}
|
|
|
|
|
|
2022-03-23 19:57:25 +01:00
|
|
|
return 0;
|
2022-03-22 19:40:23 +01:00
|
|
|
}
|
2022-04-05 18:10:27 +02:00
|
|
|
static int encode_talker(struct msrp *msrp, struct attr *a, void *m)
|
|
|
|
|
{
|
|
|
|
|
struct avb_packet_msrp_msg *msg = m;
|
|
|
|
|
struct avb_packet_mrp_vector *v;
|
|
|
|
|
struct avb_packet_msrp_talker *t;
|
|
|
|
|
struct avb_packet_mrp_footer *f;
|
|
|
|
|
uint8_t *ev;
|
|
|
|
|
size_t attr_list_length = sizeof(*v) + sizeof(*t) + sizeof(*f) + 1;
|
|
|
|
|
|
|
|
|
|
msg->attribute_type = AVB_MSRP_ATTRIBUTE_TYPE_TALKER_ADVERTISE;
|
|
|
|
|
msg->attribute_length = sizeof(*t);
|
|
|
|
|
msg->attribute_list_length = htons(attr_list_length);
|
|
|
|
|
|
|
|
|
|
v = (struct avb_packet_mrp_vector *)msg->attribute_list;
|
2026-04-25 12:54:11 +02:00
|
|
|
v->lva = avb_mrp_lva_tx_pending(msrp->server->mrp) ? 1 : 0;
|
2022-04-05 18:10:27 +02:00
|
|
|
AVB_MRP_VECTOR_SET_NUM_VALUES(v, 1);
|
|
|
|
|
|
|
|
|
|
t = (struct avb_packet_msrp_talker *)v->first_value;
|
2026-03-15 10:22:48 +01:00
|
|
|
*t = a->attr->attr.talker;
|
2022-04-05 18:10:27 +02:00
|
|
|
|
|
|
|
|
ev = SPA_PTROFF(t, sizeof(*t), uint8_t);
|
2026-03-15 10:22:48 +01:00
|
|
|
*ev = (a->attr->mrp->pending_send - 1) * 6 * 6;
|
2022-04-05 18:10:27 +02:00
|
|
|
|
|
|
|
|
f = SPA_PTROFF(ev, sizeof(*ev), struct avb_packet_mrp_footer);
|
|
|
|
|
f->end_mark = 0;
|
|
|
|
|
|
|
|
|
|
return attr_list_length + sizeof(*msg);
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-22 19:40:23 +01:00
|
|
|
|
2022-03-25 10:28:18 +01:00
|
|
|
static void debug_msrp_talker_fail(const struct avb_packet_msrp_talker_fail *t)
|
2022-03-23 19:57:25 +01:00
|
|
|
{
|
|
|
|
|
char buf[128];
|
2022-03-24 17:00:40 +01:00
|
|
|
pw_log_info("talker fail");
|
|
|
|
|
debug_msrp_talker_common(&t->talker);
|
2022-03-25 10:28:18 +01:00
|
|
|
pw_log_info(" bridge-id: %s", avb_utils_format_id(buf, sizeof(buf), be64toh(t->bridge_id)));
|
2022-03-23 19:57:25 +01:00
|
|
|
pw_log_info(" failure-code: %d", t->failure_code);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int process_talker_fail(struct msrp *msrp, uint64_t now, uint8_t attr_type,
|
2022-03-22 19:40:23 +01:00
|
|
|
const void *m, uint8_t event, uint8_t param, int num)
|
|
|
|
|
{
|
2022-03-25 10:28:18 +01:00
|
|
|
const struct avb_packet_msrp_talker_fail *t = m;
|
2022-03-24 17:00:40 +01:00
|
|
|
struct attr *a;
|
|
|
|
|
|
2022-03-23 19:57:25 +01:00
|
|
|
debug_msrp_talker_fail(t);
|
2022-03-24 17:00:40 +01:00
|
|
|
|
|
|
|
|
spa_list_for_each(a, &msrp->attributes, link)
|
2026-03-15 10:22:48 +01:00
|
|
|
if (a->attr->type == attr_type &&
|
|
|
|
|
a->attr->attr.talker_fail.talker.stream_id == t->talker.stream_id)
|
|
|
|
|
avb_mrp_attribute_rx_event(a->attr->mrp, now, event);
|
2022-03-23 19:57:25 +01:00
|
|
|
return 0;
|
2022-03-22 19:40:23 +01:00
|
|
|
}
|
|
|
|
|
|
2022-04-05 18:10:27 +02:00
|
|
|
static void debug_msrp_listener(const struct avb_packet_msrp_listener *l, uint8_t param)
|
2022-03-22 19:40:23 +01:00
|
|
|
{
|
|
|
|
|
char buf[128];
|
2022-03-24 17:00:40 +01:00
|
|
|
pw_log_info("listener");
|
2022-03-25 10:28:18 +01:00
|
|
|
pw_log_info(" %s", avb_utils_format_id(buf, sizeof(buf), be64toh(l->stream_id)));
|
2022-04-05 18:10:27 +02:00
|
|
|
pw_log_info(" %d", param);
|
2022-03-24 17:00:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void notify_listener(struct msrp *msrp, uint64_t now, struct attr *attr, uint8_t notify)
|
|
|
|
|
{
|
2026-04-25 08:16:27 +02:00
|
|
|
struct stream_common *sc;
|
|
|
|
|
struct stream *s;
|
|
|
|
|
char label[64];
|
2026-03-15 10:22:48 +01:00
|
|
|
|
2026-04-25 13:32:16 +02:00
|
|
|
pw_log_info("> notify listener: %s", avb_mrp_notify_name(notify));
|
2026-04-25 08:16:27 +02:00
|
|
|
debug_msrp_listener(&attr->attr->attr.listener, attr->attr->param);
|
|
|
|
|
snprintf(label, sizeof(label), "MSRP listener %s", avb_mrp_notify_name(notify));
|
|
|
|
|
avb_log_state(msrp->server, label);
|
|
|
|
|
|
|
|
|
|
if (msrp->server->avb_mode != AVB_MODE_MILAN_V12)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/* Milan Section 4.3.3.1 second condition: a Listener attribute
|
|
|
|
|
* matching the Stream Output's stream_id is registered. */
|
|
|
|
|
sc = SPA_CONTAINER_OF(attr->attr, struct stream_common, lstream_attr);
|
|
|
|
|
s = &sc->stream;
|
|
|
|
|
|
|
|
|
|
if (s->direction == SPA_DIRECTION_INPUT) {
|
2026-04-12 11:12:15 +02:00
|
|
|
if (notify == AVB_MRP_NOTIFY_NEW || notify == AVB_MRP_NOTIFY_JOIN)
|
|
|
|
|
handle_evt_tk_registered(msrp->server->acmp, attr->attr, now);
|
|
|
|
|
else if (notify == AVB_MRP_NOTIFY_LEAVE)
|
|
|
|
|
handle_evt_tk_unregistered(msrp->server->acmp, attr->attr, now);
|
2026-04-25 08:16:27 +02:00
|
|
|
} else {
|
|
|
|
|
struct aecp_aem_stream_output_state *stream_out =
|
|
|
|
|
SPA_CONTAINER_OF(sc, struct aecp_aem_stream_output_state, common);
|
|
|
|
|
bool prev = stream_out->listener_observed;
|
|
|
|
|
|
|
|
|
|
if (notify == AVB_MRP_NOTIFY_NEW || notify == AVB_MRP_NOTIFY_JOIN)
|
|
|
|
|
stream_out->listener_observed = true;
|
|
|
|
|
else if (notify == AVB_MRP_NOTIFY_LEAVE)
|
|
|
|
|
stream_out->listener_observed = false;
|
|
|
|
|
|
|
|
|
|
/* listener_observed flips flags_ex.REGISTERING in the
|
|
|
|
|
* GET_STREAM_INFO answer (Milan Table 5.12). Hint AECP to
|
|
|
|
|
* re-emit so controllers see the update. */
|
|
|
|
|
if (prev != stream_out->listener_observed)
|
|
|
|
|
avb_aecp_aem_mark_stream_info_dirty(msrp->server,
|
|
|
|
|
AVB_AEM_DESC_STREAM_OUTPUT, s->index);
|
2026-04-12 11:12:15 +02:00
|
|
|
}
|
2022-03-22 19:40:23 +01:00
|
|
|
}
|
|
|
|
|
|
2026-04-25 06:45:26 +02:00
|
|
|
/* IEEE 802.1Q Section 35.2.2.4.4: capture the rx 4-pack Listener Declaration Type. */
|
2022-03-23 19:57:25 +01:00
|
|
|
static int process_listener(struct msrp *msrp, uint64_t now, uint8_t attr_type,
|
2022-03-22 19:40:23 +01:00
|
|
|
const void *m, uint8_t event, uint8_t param, int num)
|
|
|
|
|
{
|
2022-03-25 10:28:18 +01:00
|
|
|
const struct avb_packet_msrp_listener *l = m;
|
2022-03-24 17:00:40 +01:00
|
|
|
struct attr *a;
|
|
|
|
|
spa_list_for_each(a, &msrp->attributes, link)
|
2026-03-15 10:22:48 +01:00
|
|
|
if (a->attr->type == attr_type &&
|
2026-04-25 06:45:26 +02:00
|
|
|
a->attr->attr.listener.stream_id == l->stream_id) {
|
|
|
|
|
a->attr->attr.listener = *l;
|
|
|
|
|
a->attr->param = param;
|
2026-03-15 10:22:48 +01:00
|
|
|
avb_mrp_attribute_rx_event(a->attr->mrp, now, event);
|
2026-04-25 06:45:26 +02:00
|
|
|
}
|
2022-03-23 19:57:25 +01:00
|
|
|
return 0;
|
|
|
|
|
}
|
2022-03-24 17:00:40 +01:00
|
|
|
static int encode_listener(struct msrp *msrp, struct attr *a, void *m)
|
|
|
|
|
{
|
2022-03-25 10:28:18 +01:00
|
|
|
struct avb_packet_msrp_msg *msg = m;
|
|
|
|
|
struct avb_packet_mrp_vector *v;
|
|
|
|
|
struct avb_packet_msrp_listener *l;
|
|
|
|
|
struct avb_packet_mrp_footer *f;
|
2022-03-24 17:00:40 +01:00
|
|
|
uint8_t *ev;
|
|
|
|
|
size_t attr_list_length = sizeof(*v) + sizeof(*l) + sizeof(*f) + 1 + 1;
|
|
|
|
|
|
2022-03-25 10:28:18 +01:00
|
|
|
msg->attribute_type = AVB_MSRP_ATTRIBUTE_TYPE_LISTENER;
|
2022-03-24 17:00:40 +01:00
|
|
|
msg->attribute_length = sizeof(*l);
|
|
|
|
|
msg->attribute_list_length = htons(attr_list_length);
|
|
|
|
|
|
2022-03-25 10:28:18 +01:00
|
|
|
v = (struct avb_packet_mrp_vector *)msg->attribute_list;
|
2026-04-25 12:54:11 +02:00
|
|
|
v->lva = avb_mrp_lva_tx_pending(msrp->server->mrp) ? 1 : 0;
|
2022-03-25 10:28:18 +01:00
|
|
|
AVB_MRP_VECTOR_SET_NUM_VALUES(v, 1);
|
2022-03-24 17:00:40 +01:00
|
|
|
|
2022-03-25 10:28:18 +01:00
|
|
|
l = (struct avb_packet_msrp_listener *)v->first_value;
|
2026-03-15 10:22:48 +01:00
|
|
|
*l = a->attr->attr.listener;
|
2022-03-24 17:00:40 +01:00
|
|
|
|
|
|
|
|
ev = SPA_PTROFF(l, sizeof(*l), uint8_t);
|
2026-03-15 10:22:48 +01:00
|
|
|
*ev = (a->attr->mrp->pending_send - 1) * 6 * 6;
|
2022-03-24 17:00:40 +01:00
|
|
|
|
|
|
|
|
ev = SPA_PTROFF(ev, sizeof(*ev), uint8_t);
|
2026-03-15 10:22:48 +01:00
|
|
|
*ev = a->attr->param * 4 * 4 * 4;
|
2022-03-24 17:00:40 +01:00
|
|
|
|
2022-03-25 10:28:18 +01:00
|
|
|
f = SPA_PTROFF(ev, sizeof(*ev), struct avb_packet_mrp_footer);
|
2022-03-24 17:00:40 +01:00
|
|
|
f->end_mark = 0;
|
|
|
|
|
|
|
|
|
|
return attr_list_length + sizeof(*msg);
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-25 10:28:18 +01:00
|
|
|
static void debug_msrp_domain(const struct avb_packet_msrp_domain *d)
|
2022-03-23 19:57:25 +01:00
|
|
|
{
|
2022-03-24 17:00:40 +01:00
|
|
|
pw_log_info("domain");
|
2022-04-07 15:14:45 +02:00
|
|
|
pw_log_info(" id: %d", d->sr_class_id);
|
|
|
|
|
pw_log_info(" prio: %d", d->sr_class_priority);
|
|
|
|
|
pw_log_info(" vid: %d", ntohs(d->sr_class_vid));
|
2022-03-22 19:40:23 +01:00
|
|
|
}
|
|
|
|
|
|
2022-03-24 17:00:40 +01:00
|
|
|
static void notify_domain(struct msrp *msrp, uint64_t now, struct attr *attr, uint8_t notify)
|
|
|
|
|
{
|
2026-04-25 13:32:16 +02:00
|
|
|
pw_log_info("> notify domain: %s", avb_mrp_notify_name(notify));
|
2026-03-15 10:22:48 +01:00
|
|
|
debug_msrp_domain(&attr->attr->attr.domain);
|
2022-03-24 17:00:40 +01:00
|
|
|
}
|
|
|
|
|
|
2022-03-23 19:57:25 +01:00
|
|
|
static int process_domain(struct msrp *msrp, uint64_t now, uint8_t attr_type,
|
|
|
|
|
const void *m, uint8_t event, uint8_t param, int num)
|
|
|
|
|
{
|
2022-03-24 17:00:40 +01:00
|
|
|
struct attr *a;
|
2026-04-12 09:58:44 +02:00
|
|
|
const struct avb_packet_msrp_domain *d = m;
|
|
|
|
|
|
|
|
|
|
spa_list_for_each(a, &msrp->attributes, link) {
|
|
|
|
|
if (a->attr->type != attr_type) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (msrp->server->avb_mode == AVB_MODE_MILAN_V12)
|
|
|
|
|
{
|
|
|
|
|
/** Milan V1.2 Section 4.2.7.2.1:
|
|
|
|
|
The endstation shall re-adjust the domain according
|
|
|
|
|
to the from the MSRPDU received on its interface */
|
|
|
|
|
bool mismatch = (a->attr->attr.domain.sr_class_id != d->sr_class_id
|
|
|
|
|
|| a->attr->attr.domain.sr_class_priority != d->sr_class_priority
|
|
|
|
|
|| a->attr->attr.domain.sr_class_vid != d->sr_class_vid);
|
|
|
|
|
|
|
|
|
|
if (mismatch) {
|
|
|
|
|
pw_log_info("Domain mismatch re-adjusting");
|
|
|
|
|
a->attr->attr.domain = *d;
|
|
|
|
|
avb_mrp_attribute_leave(a->attr->mrp, now);
|
|
|
|
|
avb_mrp_attribute_begin(a->attr->mrp, now);
|
|
|
|
|
avb_mrp_attribute_join(a->attr->mrp, now, true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
avb_mrp_attribute_rx_event(a->attr->mrp, now, event);
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-23 19:57:25 +01:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-24 17:00:40 +01:00
|
|
|
static int encode_domain(struct msrp *msrp, struct attr *a, void *m)
|
|
|
|
|
{
|
2022-03-25 10:28:18 +01:00
|
|
|
struct avb_packet_msrp_msg *msg = m;
|
|
|
|
|
struct avb_packet_mrp_vector *v;
|
|
|
|
|
struct avb_packet_msrp_domain *d;
|
|
|
|
|
struct avb_packet_mrp_footer *f;
|
2022-03-24 17:00:40 +01:00
|
|
|
uint8_t *ev;
|
|
|
|
|
size_t attr_list_length = sizeof(*v) + sizeof(*d) + sizeof(*f) + 1;
|
|
|
|
|
|
2022-03-25 10:28:18 +01:00
|
|
|
msg->attribute_type = AVB_MSRP_ATTRIBUTE_TYPE_DOMAIN;
|
2022-03-24 17:00:40 +01:00
|
|
|
msg->attribute_length = sizeof(*d);
|
|
|
|
|
msg->attribute_list_length = htons(attr_list_length);
|
|
|
|
|
|
2022-03-25 10:28:18 +01:00
|
|
|
v = (struct avb_packet_mrp_vector *)msg->attribute_list;
|
2026-04-25 12:54:11 +02:00
|
|
|
v->lva = avb_mrp_lva_tx_pending(msrp->server->mrp) ? 1 : 0;
|
2022-03-25 10:28:18 +01:00
|
|
|
AVB_MRP_VECTOR_SET_NUM_VALUES(v, 1);
|
2022-03-24 17:00:40 +01:00
|
|
|
|
2022-03-25 10:28:18 +01:00
|
|
|
d = (struct avb_packet_msrp_domain *)v->first_value;
|
2026-03-15 10:22:48 +01:00
|
|
|
*d = a->attr->attr.domain;
|
2022-03-24 17:00:40 +01:00
|
|
|
|
|
|
|
|
ev = SPA_PTROFF(d, sizeof(*d), uint8_t);
|
2026-03-15 10:22:48 +01:00
|
|
|
*ev = (a->attr->mrp->pending_send - 1) * 36;
|
2022-03-24 17:00:40 +01:00
|
|
|
|
2022-03-25 10:28:18 +01:00
|
|
|
f = SPA_PTROFF(ev, sizeof(*ev), struct avb_packet_mrp_footer);
|
2022-03-24 17:00:40 +01:00
|
|
|
f->end_mark = 0;
|
|
|
|
|
|
|
|
|
|
return attr_list_length + sizeof(*msg);
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-22 19:40:23 +01:00
|
|
|
static const struct {
|
2022-03-25 17:01:51 +01:00
|
|
|
const char *name;
|
2022-04-05 18:10:27 +02:00
|
|
|
int (*process) (struct msrp *msrp, uint64_t now, uint8_t attr_type,
|
2022-03-23 19:57:25 +01:00
|
|
|
const void *m, uint8_t event, uint8_t param, int num);
|
2022-03-24 17:00:40 +01:00
|
|
|
int (*encode) (struct msrp *msrp, struct attr *attr, void *m);
|
|
|
|
|
void (*notify) (struct msrp *msrp, uint64_t now, struct attr *attr, uint8_t notify);
|
2022-03-22 19:40:23 +01:00
|
|
|
} dispatch[] = {
|
2022-04-05 18:10:27 +02:00
|
|
|
[AVB_MSRP_ATTRIBUTE_TYPE_TALKER_ADVERTISE] = { "talker", process_talker, encode_talker, notify_talker, },
|
2026-03-15 10:22:48 +01:00
|
|
|
[AVB_MSRP_ATTRIBUTE_TYPE_TALKER_FAILED] = { "talker-fail", process_talker_fail, NULL, notify_talker_failed, },
|
2022-03-25 17:01:51 +01:00
|
|
|
[AVB_MSRP_ATTRIBUTE_TYPE_LISTENER] = { "listener", process_listener, encode_listener, notify_listener },
|
|
|
|
|
[AVB_MSRP_ATTRIBUTE_TYPE_DOMAIN] = { "domain", process_domain, encode_domain, notify_domain, },
|
2022-03-22 19:40:23 +01:00
|
|
|
};
|
|
|
|
|
|
2022-03-23 19:57:25 +01:00
|
|
|
static bool msrp_check_header(void *data, const void *hdr, size_t *hdr_size, bool *has_params)
|
2022-03-22 19:40:23 +01:00
|
|
|
{
|
2022-03-25 10:28:18 +01:00
|
|
|
const struct avb_packet_msrp_msg *msg = hdr;
|
2022-03-23 19:57:25 +01:00
|
|
|
uint8_t attr_type = msg->attribute_type;
|
|
|
|
|
|
2022-03-25 10:28:18 +01:00
|
|
|
if (!AVB_MSRP_ATTRIBUTE_TYPE_VALID(attr_type))
|
2022-03-23 19:57:25 +01:00
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
*hdr_size = sizeof(*msg);
|
2022-03-25 10:28:18 +01:00
|
|
|
*has_params = attr_type == AVB_MSRP_ATTRIBUTE_TYPE_LISTENER;
|
2022-03-23 19:57:25 +01:00
|
|
|
return true;
|
2022-03-22 19:40:23 +01:00
|
|
|
}
|
|
|
|
|
|
2022-03-23 19:57:25 +01:00
|
|
|
static int msrp_attr_event(void *data, uint64_t now, uint8_t attribute_type, uint8_t event)
|
2022-03-22 19:40:23 +01:00
|
|
|
{
|
2022-03-23 19:57:25 +01:00
|
|
|
struct msrp *msrp = data;
|
|
|
|
|
struct attr *a;
|
|
|
|
|
spa_list_for_each(a, &msrp->attributes, link)
|
2026-03-15 10:22:48 +01:00
|
|
|
if (a->attr->type == attribute_type)
|
|
|
|
|
avb_mrp_attribute_update_state(a->attr->mrp, now, event);
|
2022-03-22 19:40:23 +01:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-23 19:57:25 +01:00
|
|
|
static int msrp_process(void *data, uint64_t now, uint8_t attribute_type, const void *value,
|
|
|
|
|
uint8_t event, uint8_t param, int index)
|
|
|
|
|
{
|
|
|
|
|
struct msrp *msrp = data;
|
2022-04-05 18:10:27 +02:00
|
|
|
return dispatch[attribute_type].process(msrp, now,
|
2022-03-23 19:57:25 +01:00
|
|
|
attribute_type, value, event, param, index);
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-25 10:28:18 +01:00
|
|
|
static const struct avb_mrp_parse_info info = {
|
|
|
|
|
AVB_VERSION_MRP_PARSE_INFO,
|
2022-03-23 19:57:25 +01:00
|
|
|
.check_header = msrp_check_header,
|
|
|
|
|
.attr_event = msrp_attr_event,
|
|
|
|
|
.process = msrp_process,
|
|
|
|
|
};
|
|
|
|
|
|
2022-03-22 19:40:23 +01:00
|
|
|
|
2022-04-03 12:32:25 +02:00
|
|
|
static int msrp_message(struct msrp *msrp, uint64_t now, const void *message, int len)
|
2022-03-22 19:40:23 +01:00
|
|
|
{
|
2022-03-25 10:28:18 +01:00
|
|
|
return avb_mrp_parse_packet(msrp->server->mrp,
|
2022-03-23 19:57:25 +01:00
|
|
|
now, message, len, &info, msrp);
|
2022-03-22 19:40:23 +01:00
|
|
|
}
|
2022-04-03 12:32:25 +02:00
|
|
|
static void on_socket_data(void *data, int fd, uint32_t mask)
|
|
|
|
|
{
|
|
|
|
|
struct msrp *msrp = data;
|
|
|
|
|
struct timespec now;
|
|
|
|
|
|
|
|
|
|
if (mask & SPA_IO_IN) {
|
|
|
|
|
int len;
|
|
|
|
|
uint8_t buffer[2048];
|
|
|
|
|
|
|
|
|
|
len = recv(fd, buffer, sizeof(buffer), 0);
|
|
|
|
|
|
|
|
|
|
if (len < 0) {
|
|
|
|
|
pw_log_warn("got recv error: %m");
|
|
|
|
|
}
|
|
|
|
|
else if (len < (int)sizeof(struct avb_packet_header)) {
|
|
|
|
|
pw_log_warn("short packet received (%d < %d)", len,
|
|
|
|
|
(int)sizeof(struct avb_packet_header));
|
|
|
|
|
} else {
|
|
|
|
|
clock_gettime(CLOCK_REALTIME, &now);
|
|
|
|
|
msrp_message(msrp, SPA_TIMESPEC_TO_NSEC(&now), buffer, len);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-03-22 19:40:23 +01:00
|
|
|
|
|
|
|
|
static void msrp_destroy(void *data)
|
|
|
|
|
{
|
|
|
|
|
struct msrp *msrp = data;
|
|
|
|
|
spa_hook_remove(&msrp->server_listener);
|
2022-04-03 12:32:25 +02:00
|
|
|
pw_loop_destroy_source(msrp->server->impl->loop, msrp->source);
|
2022-03-22 19:40:23 +01:00
|
|
|
free(msrp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static const struct server_events server_events = {
|
2022-03-25 10:28:18 +01:00
|
|
|
AVB_VERSION_SERVER_EVENTS,
|
2022-03-22 19:40:23 +01:00
|
|
|
.destroy = msrp_destroy,
|
|
|
|
|
};
|
|
|
|
|
|
2022-04-05 18:10:27 +02:00
|
|
|
static void msrp_notify(void *data, uint64_t now, uint8_t notify)
|
|
|
|
|
{
|
|
|
|
|
struct attr *a = data;
|
|
|
|
|
struct msrp *msrp = a->msrp;
|
2026-03-15 10:22:48 +01:00
|
|
|
|
|
|
|
|
if (dispatch[a->attr->type].notify)
|
|
|
|
|
dispatch[a->attr->type].notify(msrp, now, a, notify);
|
2022-04-05 18:10:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static const struct avb_mrp_attribute_events mrp_attr_events = {
|
|
|
|
|
AVB_VERSION_MRP_ATTRIBUTE_EVENTS,
|
|
|
|
|
.notify = msrp_notify,
|
|
|
|
|
};
|
|
|
|
|
|
2026-03-15 10:22:48 +01:00
|
|
|
int avb_msrp_attribute_new(struct avb_msrp *m, struct avb_msrp_attribute *msrp_attr,
|
2022-03-23 19:57:25 +01:00
|
|
|
uint8_t type)
|
|
|
|
|
{
|
|
|
|
|
struct msrp *msrp = (struct msrp*)m;
|
2022-03-25 10:28:18 +01:00
|
|
|
struct avb_mrp_attribute *attr;
|
2022-03-23 19:57:25 +01:00
|
|
|
struct attr *a;
|
|
|
|
|
|
2022-03-25 10:28:18 +01:00
|
|
|
attr = avb_mrp_attribute_new(msrp->server->mrp, sizeof(struct attr));
|
2026-03-15 10:22:48 +01:00
|
|
|
if (!attr) {
|
|
|
|
|
pw_log_error("MSRP attribute allocation failed");
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
2022-03-23 19:57:25 +01:00
|
|
|
|
|
|
|
|
a = attr->user_data;
|
2022-04-05 18:10:27 +02:00
|
|
|
a->msrp = msrp;
|
2026-03-15 10:22:48 +01:00
|
|
|
a->attr = msrp_attr;
|
|
|
|
|
a->attr->mrp = attr;
|
|
|
|
|
a->attr->type = type;
|
2026-04-12 13:14:58 +02:00
|
|
|
a->attr->mrp = attr;
|
2025-11-12 09:17:04 +01:00
|
|
|
attr->name = "MSRP";
|
2022-03-24 17:00:40 +01:00
|
|
|
spa_list_append(&msrp->attributes, &a->link);
|
2022-04-05 18:10:27 +02:00
|
|
|
avb_mrp_attribute_add_listener(attr, &a->listener, &mrp_attr_events, a);
|
2022-03-23 19:57:25 +01:00
|
|
|
|
2026-03-15 10:22:48 +01:00
|
|
|
return 0;
|
2022-03-23 19:57:25 +01:00
|
|
|
}
|
|
|
|
|
|
2022-03-24 17:00:40 +01:00
|
|
|
static void msrp_event(void *data, uint64_t now, uint8_t event)
|
2022-03-23 19:57:25 +01:00
|
|
|
{
|
2022-03-24 17:00:40 +01:00
|
|
|
struct msrp *msrp = data;
|
|
|
|
|
uint8_t buffer[2048];
|
2022-03-25 10:28:18 +01:00
|
|
|
struct avb_packet_mrp *p = (struct avb_packet_mrp*)buffer;
|
|
|
|
|
struct avb_packet_mrp_footer *f;
|
2022-03-24 17:00:40 +01:00
|
|
|
void *msg = SPA_PTROFF(buffer, sizeof(*p), void);
|
|
|
|
|
struct attr *a;
|
|
|
|
|
int len, count = 0;
|
|
|
|
|
size_t total = sizeof(*p) + 2;
|
|
|
|
|
|
2022-03-25 10:28:18 +01:00
|
|
|
p->version = AVB_MRP_PROTOCOL_VERSION;
|
2022-03-24 17:00:40 +01:00
|
|
|
|
|
|
|
|
spa_list_for_each(a, &msrp->attributes, link) {
|
2026-03-15 10:22:48 +01:00
|
|
|
if (!a->attr->mrp->pending_send)
|
2022-03-24 17:00:40 +01:00
|
|
|
continue;
|
2026-03-15 10:22:48 +01:00
|
|
|
if (dispatch[a->attr->type].encode == NULL)
|
2022-03-24 17:00:40 +01:00
|
|
|
continue;
|
|
|
|
|
|
2026-04-25 08:16:27 +02:00
|
|
|
pw_log_info("MSRP encode %s %s",
|
|
|
|
|
dispatch[a->attr->type].name,
|
2026-03-15 10:22:48 +01:00
|
|
|
avb_mrp_send_name(a->attr->mrp->pending_send));
|
2022-03-25 17:01:51 +01:00
|
|
|
|
2026-03-15 10:22:48 +01:00
|
|
|
len = dispatch[a->attr->type].encode(msrp, a, msg);
|
2022-03-24 17:00:40 +01:00
|
|
|
if (len < 0)
|
|
|
|
|
break;
|
|
|
|
|
|
2026-04-25 08:16:27 +02:00
|
|
|
a->attr->mrp->pending_send = 0;
|
|
|
|
|
|
2022-03-24 17:00:40 +01:00
|
|
|
count++;
|
|
|
|
|
msg = SPA_PTROFF(msg, len, void);
|
|
|
|
|
total += len;
|
|
|
|
|
}
|
2022-03-25 10:28:18 +01:00
|
|
|
f = (struct avb_packet_mrp_footer *)msg;
|
2022-03-24 17:00:40 +01:00
|
|
|
f->end_mark = 0;
|
|
|
|
|
|
2026-04-25 08:16:27 +02:00
|
|
|
if (count > 0) {
|
|
|
|
|
pw_log_info("MSRP send: %d attribute(s), %zu bytes", count, total);
|
2022-04-03 12:32:25 +02:00
|
|
|
avb_server_send_packet(msrp->server, msrp_mac, AVB_MSRP_ETH,
|
2022-03-24 17:00:40 +01:00
|
|
|
buffer, total);
|
2026-04-25 08:16:27 +02:00
|
|
|
}
|
2022-03-24 17:00:40 +01:00
|
|
|
}
|
|
|
|
|
|
2022-03-25 10:28:18 +01:00
|
|
|
static const struct avb_mrp_events mrp_events = {
|
2022-03-25 17:01:51 +01:00
|
|
|
AVB_VERSION_MRP_EVENTS,
|
2022-03-24 17:00:40 +01:00
|
|
|
.event = msrp_event,
|
2022-03-23 19:57:25 +01:00
|
|
|
};
|
|
|
|
|
|
2026-03-15 10:22:48 +01:00
|
|
|
|
2026-04-25 08:16:27 +02:00
|
|
|
static const char *msrp_attr_type_name(uint8_t type)
|
|
|
|
|
{
|
|
|
|
|
switch (type) {
|
|
|
|
|
case AVB_MSRP_ATTRIBUTE_TYPE_TALKER_ADVERTISE: return "talker-adv";
|
|
|
|
|
case AVB_MSRP_ATTRIBUTE_TYPE_TALKER_FAILED: return "talker-fail";
|
|
|
|
|
case AVB_MSRP_ATTRIBUTE_TYPE_LISTENER: return "listener";
|
|
|
|
|
case AVB_MSRP_ATTRIBUTE_TYPE_DOMAIN: return "domain";
|
|
|
|
|
default: return "?";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void avb_msrp_log_state(struct server *server, const char *label)
|
|
|
|
|
{
|
|
|
|
|
struct msrp *msrp = (struct msrp *)server->msrp;
|
|
|
|
|
struct attr *a;
|
|
|
|
|
char buf[64];
|
|
|
|
|
int n = 0;
|
|
|
|
|
|
|
|
|
|
if (msrp == NULL)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
spa_list_for_each(a, &msrp->attributes, link)
|
|
|
|
|
n++;
|
|
|
|
|
pw_log_debug("[%s] MSRP: %d attribute%s", label, n, n == 1 ? "" : "s");
|
|
|
|
|
|
|
|
|
|
spa_list_for_each(a, &msrp->attributes, link) {
|
|
|
|
|
uint8_t app_st = avb_mrp_attribute_get_applicant_state(a->attr->mrp);
|
|
|
|
|
uint8_t reg_st = avb_mrp_attribute_get_registrar_state(a->attr->mrp);
|
|
|
|
|
switch (a->attr->type) {
|
|
|
|
|
case AVB_MSRP_ATTRIBUTE_TYPE_TALKER_ADVERTISE:
|
|
|
|
|
case AVB_MSRP_ATTRIBUTE_TYPE_TALKER_FAILED:
|
|
|
|
|
pw_log_debug("[%s] %-11s stream_id=%s app=%s reg=%s",
|
|
|
|
|
label, msrp_attr_type_name(a->attr->type),
|
|
|
|
|
avb_utils_format_id(buf, sizeof(buf),
|
|
|
|
|
be64toh(a->attr->attr.talker.stream_id)),
|
|
|
|
|
avb_applicant_state_name(app_st),
|
|
|
|
|
avb_registrar_state_name(reg_st));
|
|
|
|
|
break;
|
|
|
|
|
case AVB_MSRP_ATTRIBUTE_TYPE_LISTENER:
|
|
|
|
|
pw_log_debug("[%s] %-11s stream_id=%s param=%u app=%s reg=%s",
|
|
|
|
|
label, msrp_attr_type_name(a->attr->type),
|
|
|
|
|
avb_utils_format_id(buf, sizeof(buf),
|
|
|
|
|
be64toh(a->attr->attr.listener.stream_id)),
|
|
|
|
|
a->attr->param,
|
|
|
|
|
avb_applicant_state_name(app_st),
|
|
|
|
|
avb_registrar_state_name(reg_st));
|
|
|
|
|
break;
|
|
|
|
|
case AVB_MSRP_ATTRIBUTE_TYPE_DOMAIN:
|
|
|
|
|
pw_log_debug("[%s] %-11s class_id=%u prio=%u vid=%u app=%s reg=%s",
|
|
|
|
|
label, msrp_attr_type_name(a->attr->type),
|
|
|
|
|
a->attr->attr.domain.sr_class_id,
|
|
|
|
|
a->attr->attr.domain.sr_class_priority,
|
|
|
|
|
ntohs(a->attr->attr.domain.sr_class_vid),
|
|
|
|
|
avb_applicant_state_name(app_st),
|
|
|
|
|
avb_registrar_state_name(reg_st));
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
pw_log_debug("[%s] type=%u app=%s reg=%s", label, a->attr->type,
|
|
|
|
|
avb_applicant_state_name(app_st),
|
|
|
|
|
avb_registrar_state_name(reg_st));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-25 10:28:18 +01:00
|
|
|
struct avb_msrp *avb_msrp_register(struct server *server)
|
2022-03-22 19:40:23 +01:00
|
|
|
{
|
|
|
|
|
struct msrp *msrp;
|
2022-04-03 12:32:25 +02:00
|
|
|
int fd, res;
|
2022-03-22 19:40:23 +01:00
|
|
|
|
2022-04-03 12:32:25 +02:00
|
|
|
fd = avb_server_make_socket(server, AVB_MSRP_ETH, msrp_mac);
|
|
|
|
|
if (fd < 0) {
|
|
|
|
|
errno = -fd;
|
2022-03-23 19:57:25 +01:00
|
|
|
return NULL;
|
2022-04-03 12:32:25 +02:00
|
|
|
}
|
|
|
|
|
msrp = calloc(1, sizeof(*msrp));
|
|
|
|
|
if (msrp == NULL) {
|
|
|
|
|
res = -errno;
|
|
|
|
|
goto error_close;
|
|
|
|
|
}
|
2022-03-22 19:40:23 +01:00
|
|
|
|
|
|
|
|
msrp->server = server;
|
|
|
|
|
spa_list_init(&msrp->attributes);
|
|
|
|
|
|
2022-04-03 12:32:25 +02:00
|
|
|
msrp->source = pw_loop_add_io(server->impl->loop, fd, SPA_IO_IN, true, on_socket_data, msrp);
|
|
|
|
|
if (msrp->source == NULL) {
|
|
|
|
|
res = -errno;
|
|
|
|
|
pw_log_error("msrp %p: can't create msrp source: %m", msrp);
|
|
|
|
|
goto error_no_source;
|
|
|
|
|
}
|
2022-03-22 19:40:23 +01:00
|
|
|
avdecc_server_add_listener(server, &msrp->server_listener, &server_events, msrp);
|
2022-03-25 10:28:18 +01:00
|
|
|
avb_mrp_add_listener(server->mrp, &msrp->mrp_listener, &mrp_events, msrp);
|
2022-03-22 19:40:23 +01:00
|
|
|
|
2022-03-25 10:28:18 +01:00
|
|
|
return (struct avb_msrp*)msrp;
|
2022-04-03 12:32:25 +02:00
|
|
|
|
|
|
|
|
error_no_source:
|
|
|
|
|
free(msrp);
|
|
|
|
|
error_close:
|
|
|
|
|
close(fd);
|
|
|
|
|
errno = -res;
|
|
|
|
|
return NULL;
|
2022-03-22 19:40:23 +01:00
|
|
|
}
|