10 struct BAP_Frame* vw_bap_frame_alloc(void)
12 struct BAP_Frame* bap_frame;
14 bap_frame = calloc(1, sizeof(struct BAP_Frame));
20 void vw_bap_frame_free(struct BAP_Frame *bap_frame)
26 int vw_bap_frame_is_valid(struct BAP_Frame *bap_frame)
29 || (bap_frame->opcode > 7)
30 || (bap_frame->node > 63)
31 || (bap_frame->port > 63)
32 || (bap_frame->len > 4095)
33 || (!bap_frame->is_multiframe && bap_frame->len > 6)
42 struct BAP_Frame* vw_bap_frame_clone(struct BAP_Frame *bap_frame)
44 struct BAP_Frame *new_frame;
46 if (!vw_bap_frame_is_valid(bap_frame)) {
50 new_frame = vw_bap_frame_alloc();
55 memcpy(new_frame, bap_frame, sizeof(*new_frame));
62 void vw_bap_frame_dump(struct BAP_Frame *bap_frame)
66 printf("%u. %2i/%-2i .%02i --",
72 for (i = 0; i < bap_frame->len; i++) {
76 printf("%02x", (unsigned char)(bap_frame->data[i]));
80 for (i = 0; i < bap_frame->len; i++) {
81 unsigned char c = bap_frame->data[i];
82 if (!isprint(c) || c == '\n' || c == '\r') {