implementation session manager
This commit is contained in:
@@ -14,29 +14,28 @@
|
||||
#define likely(expr) __builtin_expect((expr), 1)
|
||||
#define unlikely(expr) __builtin_expect((expr), 0)
|
||||
|
||||
#define LOG_PACKET "PACKET"
|
||||
#define PACKET_LOG_DATA_INSUFFICIENCY(type) \
|
||||
{ \
|
||||
PACKET_LOG_ERROR("%s: layer: %s, data insufficiency", \
|
||||
LOG_PACKET, layer_type_tostring((type))); \
|
||||
#define PACKET_LOG_DATA_INSUFFICIENCY(type) \
|
||||
{ \
|
||||
PACKET_LOG_ERROR("layer: %s, data insufficiency", \
|
||||
layer_type_tostring((type))); \
|
||||
}
|
||||
|
||||
#define PACKET_LOG_UNSUPPORT_PROTO(tag, next_proto) \
|
||||
{ \
|
||||
PACKET_LOG_ERROR("%s: %s: unsupport next proto %d", \
|
||||
LOG_PACKET, (tag), (next_proto)); \
|
||||
#define PACKET_LOG_UNSUPPORT_PROTO(tag, next_proto) \
|
||||
{ \
|
||||
PACKET_LOG_ERROR("%s: unsupport next proto %d", \
|
||||
(tag), (next_proto)); \
|
||||
}
|
||||
|
||||
#define PACKET_LOG_UNSUPPORT_ETHPROTO(tag, next_proto) \
|
||||
{ \
|
||||
PACKET_LOG_ERROR("%s: %s: unsupport next proto %d: %s", \
|
||||
LOG_PACKET, (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_tostring(next_proto)); \
|
||||
}
|
||||
|
||||
#define PACKET_LOG_UNSUPPORT_IPPROTO(tag, next_proto) \
|
||||
{ \
|
||||
PACKET_LOG_ERROR("%s: %s: unsupport next proto %d: %s", \
|
||||
LOG_PACKET, (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_tostring(next_proto)); \
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@@ -428,8 +427,8 @@ static inline struct layer_record *get_free_layer(struct packet *handler)
|
||||
(_layer)->pld_ptr = (_data) + (_hdr_len); \
|
||||
(_layer)->pld_len = (_len) - (_hdr_len); \
|
||||
(_handler)->layers_used++; \
|
||||
PACKET_LOG_DEBUG("%s: layer[%d/%d]: %s, hdr_offset: %d, hdr_ptr: %p, hdr_len: %d, pld_ptr: %p, pld_len: %d", \
|
||||
LOG_PACKET, (_handler)->layers_used - 1, (_handler)->layers_size, layer_type_tostring((_type)), \
|
||||
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)), \
|
||||
(_layer)->hdr_offset, (_layer)->hdr_ptr, (_layer)->hdr_len, (_layer)->pld_ptr, (_layer)->pld_len); \
|
||||
}
|
||||
|
||||
@@ -865,7 +864,7 @@ static inline const char *parse_ipv4(struct packet *handler, const char *data, u
|
||||
// ip fragmented
|
||||
if ((ntohs(hdr->ip_off) & IP_MF) || (ntohs(hdr->ip_off) & IP_OFFMASK))
|
||||
{
|
||||
PACKET_LOG_DEBUG("%s: ip is fragmented", LOG_PACKET);
|
||||
PACKET_LOG_DEBUG("ip is fragmented");
|
||||
return layer->pld_ptr;
|
||||
}
|
||||
|
||||
@@ -1471,14 +1470,5 @@ uint64_t packet_get_hash(const struct packet *handler, enum ldbc_method method,
|
||||
return hash_value;
|
||||
}
|
||||
|
||||
#if 0
|
||||
char *inner_addr_str = tuple2_tostring(&inner_addr);
|
||||
char *outer_addr_str = tuple2_tostring(&outer_addr);
|
||||
printf("%s: outer_addr: %s, inner_addr: %s, dir: %s, hash_method: %s, hash_value: %lu\n",
|
||||
LOG_PACKET, outer_addr_str, inner_addr_str, (direction ? "E2I" : "I2E"), ldbc_method_tostring(method), hash_value);
|
||||
free(inner_addr_str);
|
||||
free(outer_addr_str);
|
||||
#endif
|
||||
|
||||
return hash_value;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user