avb: use descriptors for ADP

Remove some of the json parsing for now, work with descriptors.
Remove some parsing code.
Implement GET_AVB_INFO.
Keep descriptors in a list.
Add some utils.
This commit is contained in:
Wim Taymans 2022-03-18 15:18:11 +01:00
parent b6b8471540
commit 50199c9824
14 changed files with 584 additions and 434 deletions

View file

@ -96,37 +96,9 @@ struct avbtp_packet_adp {
#define AVBTP_PACKET_ADP_SET_MESSAGE_TYPE(p,v) AVBTP_PACKET_SET_SUB1(&(p)->hdr, v)
#define AVBTP_PACKET_ADP_SET_VALID_TIME(p,v) AVBTP_PACKET_SET_SUB2(&(p)->hdr, v)
#define AVBTP_PACKET_ADP_SET_ENTITY_ID(p,v) ((p)->entity_id = htobe64(v))
#define AVBTP_PACKET_ADP_SET_ENTITY_MODEL_ID(p,v) ((p)->entity_model_id = htobe64(v))
#define AVBTP_PACKET_ADP_SET_ENTITY_CAPABILITIES(p,v) ((p)->entity_capabilities = htonl(v))
#define AVBTP_PACKET_ADP_SET_TALKER_STREAM_SOURCES(p,v) ((p)->talker_stream_sources = htons(v))
#define AVBTP_PACKET_ADP_SET_TALKER_CAPABILITIES(p,v) ((p)->talker_capabilities = htons(v))
#define AVBTP_PACKET_ADP_SET_LISTENER_STREAM_SINKS(p,v) ((p)->listener_stream_sinks = htons(v))
#define AVBTP_PACKET_ADP_SET_LISTENER_CAPABILITIES(p,v) ((p)->listener_capabilities = htons(v))
#define AVBTP_PACKET_ADP_SET_CONTROLLER_CAPABILITIES(p,v) ((p)->controller_capabilities = htonl(v))
#define AVBTP_PACKET_ADP_SET_AVAILABLE_INDEX(p,v) ((p)->available_index = htonl(v))
#define AVBTP_PACKET_ADP_SET_GPTP_GRANDMASTER_ID(p,v) ((p)->gptp_grandmaster_id = htobe64(v))
#define AVBTP_PACKET_ADP_SET_GPTP_DOMAIN_NUMBER(p,v) ((p)->gptp_domain_number = (v))
#define AVBTP_PACKET_ADP_SET_IDENTIFY_CONTROL_INDEX(p,v) ((p)->identify_control_index = htons(v))
#define AVBTP_PACKET_ADP_SET_INTERFACE_INDEX(p,v) ((p)->interface_index = htons(v))
#define AVBTP_PACKET_ADP_SET_ASSOCIATION_ID(p,v) ((p)->association_id = htobe64(v))
#define AVBTP_PACKET_ADP_GET_MESSAGE_TYPE(p) AVBTP_PACKET_GET_SUB1(&(p)->hdr)
#define AVBTP_PACKET_ADP_GET_VALID_TIME(p) AVBTP_PACKET_GET_SUB2(&(p)->hdr)
#define AVBTP_PACKET_ADP_GET_ENTITY_ID(p) be64toh((p)->entity_id)
#define AVBTP_PACKET_ADP_GET_ENTITY_MODEL_ID(p) be64toh((p)->entity_model_id)
#define AVBTP_PACKET_ADP_GET_ENTITY_CAPABILITIES(p) ntohl((p)->entity_capabilities)
#define AVBTP_PACKET_ADP_GET_TALKER_STREAM_SOURCES(p) ntohs((p)->talker_stream_sources)
#define AVBTP_PACKET_ADP_GET_TALKER_CAPABILITIES(p) ntohs((p)->talker_capabilities)
#define AVBTP_PACKET_ADP_GET_LISTENER_STREAM_SINKS(p) ntohs((p)->listener_stream_sinks)
#define AVBTP_PACKET_ADP_GET_LISTENER_CAPABILITIES(p) ntohs((p)->listener_capabilities)
#define AVBTP_PACKET_ADP_GET_CONTROLLER_CAPABILITIES(p) ntohl((p)->controller_capabilities)
#define AVBTP_PACKET_ADP_GET_AVAILABLE_INDEX(p) ntohl((p)->available_index)
#define AVBTP_PACKET_ADP_GET_GPTP_GRANDMASTER_ID(p) be64toh((p)->gptp_grandmaster_id)
#define AVBTP_PACKET_ADP_GET_GPTP_DOMAIN_NUMBER(p) ((p)->gptp_domain_number)
#define AVBTP_PACKET_ADP_GET_IDENTIFY_CONTROL_INDEX(p) ntohs((p)->identify_control_index)
#define AVBTP_PACKET_ADP_GET_INTERFACE_INDEX(p) ntohs((p)->interface_index)
#define AVBTP_PACKET_ADP_GET_ASSOCIATION_ID(p) be64toh((p)->association_id)
struct avbtp_adp *avbtp_adp_register(struct server *server);