rename xxx_tostring() -> xxx_to_str()
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
#define PACKET_LOG_DATA_INSUFFICIENCY(type) \
|
||||
{ \
|
||||
PACKET_LOG_ERROR("layer: %s, data insufficiency", \
|
||||
layer_type_tostring((type))); \
|
||||
layer_type_to_str((type))); \
|
||||
}
|
||||
|
||||
#define PACKET_LOG_UNSUPPORT_PROTO(tag, next_proto) \
|
||||
@@ -30,26 +30,26 @@
|
||||
(tag), (next_proto)); \
|
||||
}
|
||||
|
||||
#define PACKET_LOG_UNSUPPORT_ETHPROTO(tag, next_proto) \
|
||||
{ \
|
||||
PACKET_LOG_ERROR("%s: unsupport next proto %d: %s", \
|
||||
(tag), (next_proto), ethproto_tostring(next_proto)); \
|
||||
#define PACKET_LOG_UNSUPPORT_ETHPROTO(tag, next_proto) \
|
||||
{ \
|
||||
PACKET_LOG_ERROR("%s: unsupport next proto %d: %s", \
|
||||
(tag), (next_proto), ethproto_to_str(next_proto)); \
|
||||
}
|
||||
|
||||
#define PACKET_LOG_UNSUPPORT_IPPROTO(tag, next_proto) \
|
||||
{ \
|
||||
PACKET_LOG_ERROR("%s: unsupport next proto %d: %s", \
|
||||
(tag), (next_proto), ipproto_tostring(next_proto)); \
|
||||
#define PACKET_LOG_UNSUPPORT_IPPROTO(tag, next_proto) \
|
||||
{ \
|
||||
PACKET_LOG_ERROR("%s: unsupport next proto %d: %s", \
|
||||
(tag), (next_proto), ipproto_to_str(next_proto)); \
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* Static API
|
||||
******************************************************************************/
|
||||
|
||||
static const char *ethproto_tostring(uint16_t proto);
|
||||
static const char *ipproto_tostring(uint16_t proto);
|
||||
static inline const char *ldbc_method_tostring(enum ldbc_method method);
|
||||
static inline const char *layer_type_tostring(enum layer_type type);
|
||||
static const char *ethproto_to_str(uint16_t proto);
|
||||
static const char *ipproto_to_str(uint16_t proto);
|
||||
static inline const char *ldbc_method_to_str(enum ldbc_method method);
|
||||
static inline const char *layer_type_to_str(enum layer_type type);
|
||||
|
||||
static inline void set_tuple2(const char *data, enum layer_type type, struct tuple2 *tuple);
|
||||
static inline void set_tuple4(const char *data, enum layer_type type, struct tuple4 *tuple);
|
||||
@@ -86,7 +86,7 @@ static inline const char *parse_l4(struct packet *handler, uint8_t next_proto, c
|
||||
* Private API -- Utils
|
||||
******************************************************************************/
|
||||
|
||||
static const char *ethproto_tostring(uint16_t proto)
|
||||
static const char *ethproto_to_str(uint16_t proto)
|
||||
{
|
||||
switch (proto)
|
||||
{
|
||||
@@ -193,7 +193,7 @@ static const char *ethproto_tostring(uint16_t proto)
|
||||
}
|
||||
}
|
||||
|
||||
static const char *ipproto_tostring(uint16_t proto)
|
||||
static const char *ipproto_to_str(uint16_t proto)
|
||||
{
|
||||
switch (proto)
|
||||
{
|
||||
@@ -258,7 +258,7 @@ static const char *ipproto_tostring(uint16_t proto)
|
||||
}
|
||||
}
|
||||
|
||||
static inline const char *ldbc_method_tostring(enum ldbc_method method)
|
||||
static inline const char *ldbc_method_to_str(enum ldbc_method method)
|
||||
{
|
||||
switch (method)
|
||||
{
|
||||
@@ -277,7 +277,7 @@ static inline const char *ldbc_method_tostring(enum ldbc_method method)
|
||||
}
|
||||
}
|
||||
|
||||
static inline const char *layer_type_tostring(enum layer_type type)
|
||||
static inline const char *layer_type_to_str(enum layer_type type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
@@ -432,7 +432,7 @@ static inline struct layer_record *get_free_layer(struct packet *handler)
|
||||
(_layer)->pld_len = (_len) - (_hdr_len); \
|
||||
(_handler)->layers_used++; \
|
||||
PACKET_LOG_DEBUG("layer[%d/%d]: %s, hdr_offset: %d, hdr_ptr: %p, hdr_len: %d, pld_ptr: %p, pld_len: %d", \
|
||||
(_handler)->layers_used - 1, (_handler)->layers_size, layer_type_tostring((_type)), \
|
||||
(_handler)->layers_used - 1, (_handler)->layers_size, layer_type_to_str((_type)), \
|
||||
(_layer)->hdr_offset, (_layer)->hdr_ptr, (_layer)->hdr_len, (_layer)->pld_ptr, (_layer)->pld_len); \
|
||||
}
|
||||
|
||||
@@ -1134,7 +1134,7 @@ void packet_print(const struct packet *handler)
|
||||
{
|
||||
const struct layer_record *layer = &handler->layers[i];
|
||||
printf(" layer[%u]: %p, type: %s, hdr_offset: %u, hdr_ptr: %p, hdr_len: %u, pld_ptr: %p, pld_len: %u\n",
|
||||
i, layer, layer_type_tostring(layer->type), layer->hdr_offset,
|
||||
i, layer, layer_type_to_str(layer->type), layer->hdr_offset,
|
||||
layer->hdr_ptr, layer->hdr_len, layer->pld_ptr, layer->pld_len);
|
||||
}
|
||||
for (uint16_t i = 0; i < handler->data_len; i++)
|
||||
|
||||
Reference in New Issue
Block a user