summaryrefslogtreecommitdiffstats
path: root/src/modules/module-avb/adp.h
blob: c546088d8ac130b7dfb1f5939ea6057efd2d78df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/* AVB support
 *
 * Copyright © 2022 Wim Taymans
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice (including the next
 * paragraph) shall be included in all copies or substantial portions of the
 * Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 * DEALINGS IN THE SOFTWARE.
 */

#ifndef AVB_ADP_H
#define AVB_ADP_H

#include "packets.h"
#include "internal.h"

#define AVB_ADP_MESSAGE_TYPE_ENTITY_AVAILABLE		0
#define AVB_ADP_MESSAGE_TYPE_ENTITY_DEPARTING		1
#define AVB_ADP_MESSAGE_TYPE_ENTITY_DISCOVER		2

#define AVB_ADP_ENTITY_CAPABILITY_EFU_MODE				(1u<<0)
#define AVB_ADP_ENTITY_CAPABILITY_ADDRESS_ACCESS_SUPPORTED		(1u<<1)
#define AVB_ADP_ENTITY_CAPABILITY_GATEWAY_ENTITY			(1u<<2)
#define AVB_ADP_ENTITY_CAPABILITY_AEM_SUPPORTED				(1u<<3)
#define AVB_ADP_ENTITY_CAPABILITY_LEGACY_AVC				(1u<<4)
#define AVB_ADP_ENTITY_CAPABILITY_ASSOCIATION_ID_SUPPORTED		(1u<<5)
#define AVB_ADP_ENTITY_CAPABILITY_ASSOCIATION_ID_VALID			(1u<<6)
#define AVB_ADP_ENTITY_CAPABILITY_VENDOR_UNIQUE_SUPPORTED		(1u<<7)
#define AVB_ADP_ENTITY_CAPABILITY_CLASS_A_SUPPORTED			(1u<<8)
#define AVB_ADP_ENTITY_CAPABILITY_CLASS_B_SUPPORTED			(1u<<9)
#define AVB_ADP_ENTITY_CAPABILITY_GPTP_SUPPORTED			(1u<<10)
#define AVB_ADP_ENTITY_CAPABILITY_AEM_AUTHENTICATION_SUPPORTED		(1u<<11)
#define AVB_ADP_ENTITY_CAPABILITY_AEM_AUTHENTICATION_REQUIRED		(1u<<12)
#define AVB_ADP_ENTITY_CAPABILITY_AEM_PERSISTENT_ACQUIRE_SUPPORTED	(1u<<13)
#define AVB_ADP_ENTITY_CAPABILITY_AEM_IDENTIFY_CONTROL_INDEX_VALID	(1u<<14)
#define AVB_ADP_ENTITY_CAPABILITY_AEM_INTERFACE_INDEX_VALID		(1u<<15)
#define AVB_ADP_ENTITY_CAPABILITY_GENERAL_CONTROLLER_IGNORE		(1u<<16)
#define AVB_ADP_ENTITY_CAPABILITY_ENTITY_NOT_READY			(1u<<17)

#define AVB_ADP_TALKER_CAPABILITY_IMPLEMENTED				(1u<<0)
#define AVB_ADP_TALKER_CAPABILITY_OTHER_SOURCE				(1u<<9)
#define AVB_ADP_TALKER_CAPABILITY_CONTROL_SOURCE			(1u<<10)
#define AVB_ADP_TALKER_CAPABILITY_MEDIA_CLOCK_SOURCE			(1u<<11)
#define AVB_ADP_TALKER_CAPABILITY_SMPTE_SOURCE				(1u<<12)
#define AVB_ADP_TALKER_CAPABILITY_MIDI_SOURCE				(1u<<13)
#define AVB_ADP_TALKER_CAPABILITY_AUDIO_SOURCE				(1u<<14)
#define AVB_ADP_TALKER_CAPABILITY_VIDEO_SOURCE				(1u<<15)

#define AVB_ADP_LISTENER_CAPABILITY_IMPLEMENTED				(1u<<0)
#define AVB_ADP_LISTENER_CAPABILITY_OTHER_SINK				(1u<<9)
#define AVB_ADP_LISTENER_CAPABILITY_CONTROL_SINK			(1u<<10)
#define AVB_ADP_LISTENER_CAPABILITY_MEDIA_CLOCK_SINK			(1u<<11)
#define AVB_ADP_LISTENER_CAPABILITY_SMPTE_SINK				(1u<<12)
#define AVB_ADP_LISTENER_CAPABILITY_MIDI_SINK				(1u<<13)
#define AVB_ADP_LISTENER_CAPABILITY_AUDIO_SINK				(1u<<14)
#define AVB_ADP_LISTENER_CAPABILITY_VIDEO_SINK				(1u<<15)

#define AVB_ADP_CONTROLLER_CAPABILITY_IMPLEMENTED			(1u<<0)
#define AVB_ADP_CONTROLLER_CAPABILITY_LAYER3_PROXY			(1u<<1)

#define AVB_ADP_CONTROL_DATA_LENGTH		56

struct avb_packet_adp {
	struct avb_packet_header hdr;
	uint64_t entity_id;
	uint64_t entity_model_id;
	uint32_t entity_capabilities;
	uint16_t talker_stream_sources;
	uint16_t talker_capabilities;
	uint16_t listener_stream_sinks;
	uint16_t listener_capabilities;
	uint32_t controller_capabilities;
	uint32_t available_index;
	uint64_t gptp_grandmaster_id;
	uint8_t gptp_domain_number;
	uint8_t reserved0[3];
	uint16_t identify_control_index;
	uint16_t interface_index;
	uint64_t association_id;
	uint32_t reserved1;
} __attribute__ ((__packed__));

#define AVB_PACKET_ADP_SET_MESSAGE_TYPE(p,v)		AVB_PACKET_SET_SUB1(&(p)->hdr, v)
#define AVB_PACKET_ADP_SET_VALID_TIME(p,v)		AVB_PACKET_SET_SUB2(&(p)->hdr, v)

#define AVB_PACKET_ADP_GET_MESSAGE_TYPE(p)		AVB_PACKET_GET_SUB1(&(p)->hdr)
#define AVB_PACKET_ADP_GET_VALID_TIME(p)		AVB_PACKET_GET_SUB2(&(p)->hdr)

struct avb_adp *avb_adp_register(struct server *server);

#endif /* AVB_ADP_H */