Fix for ndpi_serialize_string_uint32_format with JSON
This commit is contained in:
@@ -833,6 +833,9 @@ extern "C" {
|
||||
u_int32_t key, const char *value);
|
||||
int ndpi_serialize_string_uint32(ndpi_serializer *serializer,
|
||||
const char *key, u_int32_t value);
|
||||
int ndpi_serialize_string_uint32_format(ndpi_serializer *serializer,
|
||||
const char *key, u_int32_t value,
|
||||
const char *format);
|
||||
int ndpi_serialize_string_uint64(ndpi_serializer *serializer,
|
||||
const char *key, u_int64_t value);
|
||||
int ndpi_serialize_string_string(ndpi_serializer *serializer,
|
||||
|
||||
+16
-1
@@ -1251,6 +1251,22 @@ int ndpi_serialize_string_uint32(ndpi_serializer *serializer,
|
||||
|
||||
/* ********************************** */
|
||||
|
||||
int ndpi_serialize_string_uint32_format(ndpi_serializer *serializer,
|
||||
const char *key, u_int32_t value,
|
||||
const char *format) {
|
||||
if(serializer->fmt == ndpi_serialization_format_json) {
|
||||
/*
|
||||
JSON supports base 10 numbers only
|
||||
http://cjihrig.com/blog/json-overview/
|
||||
*/
|
||||
|
||||
return(ndpi_serialize_string_uint32(serializer, key, value));
|
||||
} else
|
||||
return(ndpi_serialize_string_uint32_format(serializer, key, value, format));
|
||||
}
|
||||
|
||||
/* ********************************** */
|
||||
|
||||
int ndpi_serialize_string_uint64(ndpi_serializer *serializer,
|
||||
const char *key, u_int64_t value) {
|
||||
u_int16_t klen = strlen(key);
|
||||
@@ -1634,4 +1650,3 @@ int ndpi_deserialize_string_string(ndpi_deserializer *deserializer,
|
||||
}
|
||||
|
||||
/* ********************************** */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user