Add ndpi_serialize_binary_boolean for consistency. Fix comments.
This commit is contained in:
@@ -1254,7 +1254,17 @@ extern "C" {
|
||||
int ndpi_serialize_string_float(ndpi_serializer *serializer, const char *key, float value, const char *format /* e.f. "%.2f" */);
|
||||
|
||||
/**
|
||||
* Serialize a string key and a boolean value
|
||||
* Serialize an unterminated string key and a boolean value (JSON/CSV only, not supported by TLV)
|
||||
* @param serializer The serializer handle
|
||||
* @param key The field name or ID
|
||||
* @param klen The key length
|
||||
* @param value The field value
|
||||
* @return 0 on success, a negative number otherwise
|
||||
*/
|
||||
int ndpi_serialize_binary_boolean(ndpi_serializer *_serializer, const char *key, u_int16_t klen, u_int8_t value);
|
||||
|
||||
/**
|
||||
* Serialize a string key and a boolean value (JSON/CSV only, not supported by TLV)
|
||||
* @param serializer The serializer handle
|
||||
* @param key The field name or ID
|
||||
* @param value The field value
|
||||
|
||||
@@ -1673,11 +1673,10 @@ int ndpi_serialize_string_raw(ndpi_serializer *_serializer,
|
||||
|
||||
/* ********************************** */
|
||||
|
||||
int ndpi_serialize_string_boolean(ndpi_serializer *_serializer,
|
||||
const char *key, u_int8_t value) {
|
||||
int ndpi_serialize_binary_boolean(ndpi_serializer *_serializer,
|
||||
const char *key, u_int16_t klen, u_int8_t value) {
|
||||
ndpi_private_serializer *serializer = (ndpi_private_serializer*)_serializer;
|
||||
u_int32_t buff_diff = serializer->buffer.size - serializer->status.buffer.size_used;
|
||||
u_int16_t klen = strlen(key);
|
||||
u_int32_t needed;
|
||||
|
||||
if(serializer->fmt != ndpi_serialization_format_json &&
|
||||
@@ -1726,6 +1725,13 @@ int ndpi_serialize_string_boolean(ndpi_serializer *_serializer,
|
||||
|
||||
/* ********************************** */
|
||||
|
||||
int ndpi_serialize_string_boolean(ndpi_serializer *_serializer,
|
||||
const char *key, u_int8_t value) {
|
||||
return(ndpi_serialize_binary_boolean(_serializer, key, strlen(key), value));
|
||||
}
|
||||
|
||||
/* ********************************** */
|
||||
|
||||
int ndpi_serialize_start_of_list_binary(ndpi_serializer *_serializer,
|
||||
const char *key, u_int16_t klen) {
|
||||
ndpi_private_serializer *serializer = (ndpi_private_serializer*)_serializer;
|
||||
|
||||
Reference in New Issue
Block a user