diff --git a/lib/c/experimental/labcomm_sig_parser.c b/lib/c/experimental/labcomm_sig_parser.c index 3c0222ff0ca0e4d28814b037389c91020438e6a7..99a7fc90415e2392cc57a6d97655b8e8934283c1 100644 --- a/lib/c/experimental/labcomm_sig_parser.c +++ b/lib/c/experimental/labcomm_sig_parser.c @@ -402,16 +402,24 @@ static int accept_signature(labcomm_sig_parser_t *d) int accept_packet(labcomm_sig_parser_t *d) { unsigned char nbytes; unsigned int type = peek_varint(d, &nbytes) ; - if(type == TYPE_DECL ) { + if(type == VERSION ) { + //XXX is this used? If so, is it correct? + advancen(d, nbytes); + VERBOSE_PRINTF("ignoring version "); + int len = get_varint(d); //ignore length field + advancen(d, len); + }else if(type == TYPE_DECL ) { //XXX is this used? If so, is it correct? advancen(d, nbytes); d->current_decl_is_varsize = FALSE; // <-- a conveniance flag in labcomm_sig_parser_t VERBOSE_PRINTF("type_decl "); + get_varint(d); //ignore length field accept_signature(d); } else if (type == SAMPLE_DECL) { d->current_decl_is_varsize = FALSE; // <-- a conveniance flag in labcomm_sig_parser_t advancen(d, nbytes); VERBOSE_PRINTF("sample_decl "); + get_varint(d); //ignore length field accept_signature(d); } else if(type >= LABCOMM_USER) { #ifdef EXIT_WHEN_RECEIVING_DATA @@ -609,14 +617,19 @@ static int accept_sample_data(labcomm_sig_parser_t *d){ accept_user_id(d); unsigned int uid = pop_val(d); printf("sample data... uid=0x%x\n", uid); + int len = get_varint(d); //length field #ifdef DEBUG dump_signature(d, uid); #endif +#ifdef SKIP_BY_PARSING struct labcomm_signature *sigt = get_sig_t(d, uid); int encoded_size = sigt->encoded_size(NULL); INFO_PRINTF("encoded_size from sig: %d\n", encoded_size); struct labcomm_signature *sig = get_sig_t(d, uid); skip_packed_sample_data(d, sig); +#else + advancen(d, len); +#endif return TRUE; } diff --git a/lib/c/experimental/labcomm_sig_parser.h b/lib/c/experimental/labcomm_sig_parser.h index 6aa85f2e4e8b101601d4aafd30d9a633f5f6637c..7c679b5a35671aaa452a434b1aaaf58fc15c7e60 100644 --- a/lib/c/experimental/labcomm_sig_parser.h +++ b/lib/c/experimental/labcomm_sig_parser.h @@ -112,8 +112,9 @@ int skip_packed_sample_data(labcomm_sig_parser_t *p, struct labcomm_signature *s #endif typedef enum{ - TYPE_DECL = LABCOMM_TYPEDEF, + VERSION = LABCOMM_VERSION, SAMPLE_DECL = LABCOMM_SAMPLE_DEF, + TYPE_DECL = LABCOMM_TYPEDEF, ARRAY_DECL = LABCOMM_ARRAY, STRUCT_DECL = LABCOMM_STRUCT,