avb: implement some descriptors

Work on raw ethernet frames.
This commit is contained in:
Wim Taymans 2022-03-17 19:13:43 +01:00
parent da14e9f59d
commit 4613c7822f
14 changed files with 1052 additions and 452 deletions

View file

@ -49,13 +49,20 @@ struct server_events {
/** the server is destroyed */
void (*destroy) (void *data);
int (*message) (void *data, uint64_t now, const uint8_t src[6], const void *message, int len);
int (*message) (void *data, uint64_t now, const void *message, int len);
void (*periodic) (void *data, uint64_t now);
int (*command) (void *data, uint64_t now, const char *command, const char *args);
};
struct descriptor {
uint16_t type;
uint16_t index;
uint32_t size;
void *ptr;
};
struct server {
struct spa_list link;
struct impl *impl;
@ -70,9 +77,23 @@ struct server {
struct spa_hook_list listener_list;
const struct descriptor *descriptors[512];
uint32_t n_descriptors;
unsigned debug_messages:1;
};
static inline const struct descriptor *find_descriptor(struct server *server, uint16_t type, uint16_t index)
{
uint32_t i;
for (i = 0; i < server->n_descriptors; i++) {
if (server->descriptors[i]->type == type &&
server->descriptors[i]->index == index)
return server->descriptors[i];
}
return NULL;
}
struct server *avdecc_server_new(struct impl *impl, const char *ifname, struct spa_dict *props);
void avdecc_server_free(struct server *server);
@ -82,6 +103,14 @@ void avdecc_server_add_listener(struct server *server, struct spa_hook *listener
int avbtp_server_broadcast_packet(struct server *server, void *data, size_t size);
int avbtp_server_send_packet(struct server *server, const uint8_t dest[6], void *data, size_t size);
struct aecp {
struct server *server;
struct spa_hook server_listener;
uint64_t now;
};
#ifdef __cplusplus
} /* extern "C" */
#endif