SIDE_TYPE_S16,
SIDE_TYPE_S32,
SIDE_TYPE_S64,
+ SIDE_TYPE_BLOB,
SIDE_TYPE_ENUM_U8,
SIDE_TYPE_ENUM_U16,
SIDE_TYPE_ARRAY_S16,
SIDE_TYPE_ARRAY_S32,
SIDE_TYPE_ARRAY_S64,
+ SIDE_TYPE_ARRAY_BLOB,
SIDE_TYPE_VLA_U8,
SIDE_TYPE_VLA_U16,
SIDE_TYPE_VLA_S16,
SIDE_TYPE_VLA_S32,
SIDE_TYPE_VLA_S64,
+ SIDE_TYPE_VLA_BLOB,
SIDE_TYPE_DYNAMIC,
};
int16_t side_s16;
int32_t side_s32;
int64_t side_s64;
+ uint8_t side_blob;
#if __HAVE_FLOAT16
_Float16 side_float_binary16;
#define side_type_s16(_attr) _side_type(SIDE_TYPE_S16, SIDE_PARAM(_attr))
#define side_type_s32(_attr) _side_type(SIDE_TYPE_S32, SIDE_PARAM(_attr))
#define side_type_s64(_attr) _side_type(SIDE_TYPE_S64, SIDE_PARAM(_attr))
+#define side_type_blob(_attr) _side_type(SIDE_TYPE_BLOB, SIDE_PARAM(_attr))
#define side_type_float_binary16(_attr) _side_type(SIDE_TYPE_FLOAT_BINARY16, SIDE_PARAM(_attr))
#define side_type_float_binary32(_attr) _side_type(SIDE_TYPE_FLOAT_BINARY32, SIDE_PARAM(_attr))
#define side_type_float_binary64(_attr) _side_type(SIDE_TYPE_FLOAT_BINARY64, SIDE_PARAM(_attr))
#define side_field_s16(_name, _attr) _side_field(_name, side_type_s16(SIDE_PARAM(_attr)))
#define side_field_s32(_name, _attr) _side_field(_name, side_type_s32(SIDE_PARAM(_attr)))
#define side_field_s64(_name, _attr) _side_field(_name, side_type_s64(SIDE_PARAM(_attr)))
+#define side_field_blob(_name, _attr) _side_field(_name, side_type_blob(SIDE_PARAM(_attr)))
#define side_field_float_binary16(_name, _attr) _side_field(_name, side_type_float_binary16(SIDE_PARAM(_attr)))
#define side_field_float_binary32(_name, _attr) _side_field(_name, side_type_float_binary32(SIDE_PARAM(_attr)))
#define side_field_float_binary64(_name, _attr) _side_field(_name, side_type_float_binary64(SIDE_PARAM(_attr)))
#define side_arg_s16(val) { .type = SIDE_TYPE_S16, .u = { .side_s16 = (val) } }
#define side_arg_s32(val) { .type = SIDE_TYPE_S32, .u = { .side_s32 = (val) } }
#define side_arg_s64(val) { .type = SIDE_TYPE_S64, .u = { .side_s64 = (val) } }
+#define side_arg_blob(val) { .type = SIDE_TYPE_BLOB, .u = { .side_blob = (val) } }
#define side_arg_enum_u8(val) { .type = SIDE_TYPE_ENUM_U8, .u = { .side_u8 = (val) } }
#define side_arg_enum_u16(val) { .type = SIDE_TYPE_ENUM_U16, .u = { .side_u16 = (val) } }
#define side_arg_enum_u32(val) { .type = SIDE_TYPE_ENUM_U32, .u = { .side_u32 = (val) } }
#define side_arg_array_s16(_ptr) { .type = SIDE_TYPE_ARRAY_S16, .u = { .side_array_fixint = (_ptr) } }
#define side_arg_array_s32(_ptr) { .type = SIDE_TYPE_ARRAY_S32, .u = { .side_array_fixint = (_ptr) } }
#define side_arg_array_s64(_ptr) { .type = SIDE_TYPE_ARRAY_S64, .u = { .side_array_fixint = (_ptr) } }
+#define side_arg_array_blob(_ptr) { .type = SIDE_TYPE_ARRAY_BLOB, .u = { .side_array_fixint = (_ptr) } }
#define side_arg_vla_u8(_ptr, _length) { .type = SIDE_TYPE_VLA_U8, .u = { .side_vla_fixint = { .p = (_ptr), .length = (_length) } }
#define side_arg_vla_u16(_ptr, _length) { .type = SIDE_TYPE_VLA_U16, .u = { .side_vla_fixint = { .p = (_ptr), .length = (_length) } } }
#define side_arg_vla_s16(_ptr, _length) { .type = SIDE_TYPE_VLA_S16, .u = { .side_vla_fixint = { .p = (_ptr), .length = (_length) } } }
#define side_arg_vla_s32(_ptr, _length) { .type = SIDE_TYPE_VLA_S32, .u = { .side_vla_fixint = { .p = (_ptr), .length = (_length) } } }
#define side_arg_vla_s64(_ptr, _length) { .type = SIDE_TYPE_VLA_S64, .u = { .side_vla_fixint = { .p = (_ptr), .length = (_length) } } }
+#define side_arg_vla_blob(_ptr, _length) { .type = SIDE_TYPE_VLA_BLOB, .u = { .side_vla_fixint = { .p = (_ptr), .length = (_length) } } }
#define side_arg_dynamic(dynamic_arg_type) \
{ \
);
}
+static uint8_t blob_fixint[] = { 0x55, 0x44, 0x33, 0x22, 0x11 };
+
+static side_define_event(my_provider_event_blob, "myprovider", "myeventblob", SIDE_LOGLEVEL_DEBUG,
+ side_field_list(
+ side_field_blob("blobfield", side_attr_list()),
+ side_field_array("arrayblob", side_elem(side_type_blob(side_attr_list())), 3, side_attr_list()),
+ side_field_array("arrayblobfix", side_elem(side_type_blob(side_attr_list())), SIDE_ARRAY_SIZE(blob_fixint), side_attr_list()),
+ side_field_vla("vlablobfix", side_elem(side_type_blob(side_attr_list())), side_attr_list()),
+ ),
+ side_attr_list()
+);
+
+static
+void test_blob(void)
+{
+ my_provider_event_blob.enabled = 1;
+ side_event_cond(&my_provider_event_blob) {
+ side_arg_define_vec(myarray, side_arg_list(side_arg_blob(1), side_arg_blob(2), side_arg_blob(3)));
+ side_event_call(&my_provider_event_blob,
+ side_arg_list(
+ side_arg_blob(0x55),
+ side_arg_array(&myarray),
+ side_arg_array_blob(blob_fixint),
+ side_arg_vla_blob(blob_fixint, SIDE_ARRAY_SIZE(blob_fixint)),
+ )
+ );
+ }
+}
int main()
{
test_variadic_float();
test_enum();
test_enum_bitmap();
+ test_blob();
return 0;
}
case SIDE_TYPE_ARRAY_S16:
case SIDE_TYPE_ARRAY_S32:
case SIDE_TYPE_ARRAY_S64:
+ case SIDE_TYPE_ARRAY_BLOB:
if (type_desc->type != SIDE_TYPE_ARRAY) {
printf("ERROR: type mismatch between description and arguments\n");
abort();
case SIDE_TYPE_VLA_S16:
case SIDE_TYPE_VLA_S32:
case SIDE_TYPE_VLA_S64:
+ case SIDE_TYPE_VLA_BLOB:
if (type_desc->type != SIDE_TYPE_VLA) {
printf("ERROR: type mismatch between description and arguments\n");
abort();
case SIDE_TYPE_S64:
printf("%" PRId64, item->u.side_s64);
break;
+ case SIDE_TYPE_BLOB:
+ printf("0x%" PRIx8, item->u.side_blob);
+ break;
case SIDE_TYPE_ENUM_U8:
print_enum(type_desc->u.side_enum_mappings,
case SIDE_TYPE_ARRAY_S16:
case SIDE_TYPE_ARRAY_S32:
case SIDE_TYPE_ARRAY_S64:
+ case SIDE_TYPE_ARRAY_BLOB:
tracer_print_array_fixint(type_desc, item);
break;
case SIDE_TYPE_VLA_U8:
case SIDE_TYPE_VLA_S16:
case SIDE_TYPE_VLA_S32:
case SIDE_TYPE_VLA_S64:
+ case SIDE_TYPE_VLA_BLOB:
tracer_print_vla_fixint(type_desc, item);
break;
case SIDE_TYPE_DYNAMIC:
if (elem_type->type != SIDE_TYPE_S64)
goto type_error;
break;
+ case SIDE_TYPE_ARRAY_BLOB:
+ if (elem_type->type != SIDE_TYPE_BLOB)
+ goto type_error;
+ break;
default:
goto type_error;
}
case SIDE_TYPE_S64:
sav_elem.u.side_s64 = ((const int64_t *) p)[i];
break;
+ case SIDE_TYPE_BLOB:
+ sav_elem.u.side_blob = ((const uint8_t *) p)[i];
+ break;
default:
printf("ERROR: Unexpected type\n");
if (elem_type->type != SIDE_TYPE_S64)
goto type_error;
break;
+ case SIDE_TYPE_VLA_BLOB:
+ if (elem_type->type != SIDE_TYPE_BLOB)
+ goto type_error;
+ break;
default:
goto type_error;
}
case SIDE_TYPE_S64:
sav_elem.u.side_s64 = ((const int64_t *) p)[i];
break;
+ case SIDE_TYPE_BLOB:
+ sav_elem.u.side_blob = ((const uint8_t *) p)[i];
+ break;
default:
printf("ERROR: Unexpected type\n");