TSG-20744 Service Chaining输出命中filter报文的measurements
This commit is contained in:
@@ -82,51 +82,68 @@ static inline int sf_id_tostring(struct selected_chaining *chain, char *buffer,
|
|||||||
return used;
|
return used;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PACKET_IO_TRACE(mr_ins, mr_buff, str) \
|
#define PACKET_TRACE_ON_NEW(mr_ins, mr_buff) \
|
||||||
|
do \
|
||||||
{ \
|
{ \
|
||||||
if (marsio_dp_trace_record_can_emit(mr_buff)) \
|
marsio_dp_trace_filter_exec(mr_ins, mr_buff); \
|
||||||
|
if (marsio_dp_trace_measurements_can_emit(mr_ins, mr_buff)) \
|
||||||
{ \
|
{ \
|
||||||
marsio_dp_trace_record_emit_str(mr_ins, mr_buff, "(Packet I/O)", str); \
|
marsio_dp_trace_measurement_emit_str(mr_ins, mr_buff, DP_TRACE_MEASUREMENT_TYPE_TRACE, "(Packet I/O)", "new packet"); \
|
||||||
} \
|
} \
|
||||||
}
|
} while (0)
|
||||||
|
|
||||||
#define PACKET_TRACE_ON_NEW(mr_ins, mr_buff) PACKET_IO_TRACE(mr_ins, mr_buff, "new packet")
|
#define PACKET_TRACE_ON_FREE(mr_ins, mr_buff) \
|
||||||
#define PACKET_TRACE_ON_FREE(mr_ins, mr_buff) PACKET_IO_TRACE(mr_ins, mr_buff, "free packet")
|
do \
|
||||||
|
{ \
|
||||||
|
if (marsio_dp_trace_measurements_can_emit(mr_ins, mr_buff)) \
|
||||||
|
{ \
|
||||||
|
marsio_dp_trace_measurement_emit_str(mr_ins, mr_buff, DP_TRACE_MEASUREMENT_TYPE_TRACE, "(Packet I/O)", "free packet"); \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
#define PACKET_TRACE_ON_CTRL(mr_ins, mr_buff, state) \
|
#define PACKET_TRACE_ON_CTRL(mr_ins, mr_buff, state) \
|
||||||
|
do \
|
||||||
{ \
|
{ \
|
||||||
if (marsio_dp_trace_record_can_emit(mr_buff)) \
|
if (marsio_dp_trace_measurements_can_emit(mr_ins, mr_buff)) \
|
||||||
{ \
|
{ \
|
||||||
marsio_dp_trace_record_emit_fmt(mr_ins, mr_buff, "(Session Synchronization)", "%s", control_packte_state_to_string(state)); \
|
marsio_dp_trace_measurement_emit_str(mr_ins, mr_buff, DP_TRACE_MEASUREMENT_TYPE_TRACE, "(Session Synchronization)", \
|
||||||
|
control_packte_state_to_string(state)); \
|
||||||
} \
|
} \
|
||||||
}
|
} while (0)
|
||||||
|
|
||||||
#define PACKET_TRACE_ON_POLICY(mr_ins, mr_buff, rule_ids, chain) \
|
#define PACKET_TRACE_ON_POLICY(mr_ins, mr_buff, rule_ids, chain) \
|
||||||
|
do \
|
||||||
{ \
|
{ \
|
||||||
if (marsio_dp_trace_record_can_emit(mr_buff)) \
|
if (marsio_dp_trace_measurements_can_emit(mr_ins, mr_buff)) \
|
||||||
{ \
|
{ \
|
||||||
char buffer1[1024] = {0}; \
|
char rule_id_str[1024] = {0}; \
|
||||||
char buffer2[1024] = {0}; \
|
char sf_id_str[1024] = {0}; \
|
||||||
rule_id_tostring(rule_ids, buffer1, sizeof(buffer1)); \
|
char buff[4096] = {0}; \
|
||||||
sf_id_tostring(chain, buffer2, sizeof(buffer2)); \
|
rule_id_tostring(rule_ids, rule_id_str, sizeof(rule_id_str)); \
|
||||||
marsio_dp_trace_record_emit_fmt(mr_ins, mr_buff, "(Policy)", "rule_list: %s, SFP_list: %s", buffer1, buffer2); \
|
sf_id_tostring(chain, sf_id_str, sizeof(sf_id_str)); \
|
||||||
|
snprintf(buff, sizeof(buff), "rule_list: %s, SFP_list: %s", rule_id_str, sf_id_str); \
|
||||||
|
marsio_dp_trace_measurement_emit_str(mr_ins, mr_buff, DP_TRACE_MEASUREMENT_TYPE_TRACE, "(Policy)", buff); \
|
||||||
|
marsio_dp_trace_measurement_emit_str(mr_ins, mr_buff, DP_TRACE_MEASUREMENT_TYPE_TELEMETRY, "(Policy)", buff); \
|
||||||
} \
|
} \
|
||||||
}
|
} while (0)
|
||||||
|
|
||||||
#define PACKET_TRACE_ON_CHAIN(mr_ins, mr_buff, sf, meta) \
|
#define PACKET_TRACE_ON_CHAIN(mr_ins, mr_buff, sf, meta) \
|
||||||
|
do \
|
||||||
{ \
|
{ \
|
||||||
if (marsio_dp_trace_record_can_emit(mr_buff)) \
|
if (marsio_dp_trace_measurements_can_emit(mr_ins, mr_buff)) \
|
||||||
{ \
|
{ \
|
||||||
marsio_dp_trace_record_emit_fmt(mr_ins, mr_buff, "(Forwarder)", \
|
char buff[2048] = {0}; \
|
||||||
"SF_id: %d, fwd_type: %s, pkt_dir: %s, pkt_type: %s, state: %s %s", \
|
snprintf(buff, sizeof(buff), "SF_id: %d, fwd_type: %s, pkt_dir: %s, pkt_type: %s, state: %s %s", \
|
||||||
(sf)->sf_profile_id, \
|
(sf)->sf_profile_id, \
|
||||||
forward_type_tostring((sf)->sff_forward_type), \
|
forward_type_tostring((sf)->sff_forward_type), \
|
||||||
((meta)->direction ? "E2I" : "I2E"), \
|
((meta)->direction ? "E2I" : "I2E"), \
|
||||||
((meta)->is_decrypted ? "decrypted" : "raw"), \
|
((meta)->is_decrypted ? "decrypted" : "raw"), \
|
||||||
((sf)->sf_action == SESSION_ACTION_FORWARD ? "success" : "failure"), \
|
((sf)->sf_action == SESSION_ACTION_FORWARD ? "success" : "failure"), \
|
||||||
((sf)->sf_action == SESSION_ACTION_FORWARD ? "" : action_desc_tostring((sf)->sf_action_desc))); \
|
((sf)->sf_action == SESSION_ACTION_FORWARD ? "" : action_desc_tostring((sf)->sf_action_desc))); \
|
||||||
|
marsio_dp_trace_measurement_emit_str(mr_ins, mr_buff, DP_TRACE_MEASUREMENT_TYPE_TRACE, "(Forwarder)", buff); \
|
||||||
|
marsio_dp_trace_measurement_emit_str(mr_ins, mr_buff, DP_TRACE_MEASUREMENT_TYPE_TELEMETRY, "(Forwarder)", buff); \
|
||||||
} \
|
} \
|
||||||
}
|
} while (0)
|
||||||
|
|
||||||
#ifdef __cpluscplus
|
#ifdef __cpluscplus
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -486,17 +486,21 @@ marsio_buff_t *marsio_mbuff_dup(marsio_buff_t *m)
|
|||||||
return mbuf;
|
return mbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
int marsio_dp_trace_record_can_emit(const marsio_buff_t *mbuf)
|
void marsio_dp_trace_filter_exec(struct mr_instance *instance, marsio_buff_t *mbuf)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
int marsio_dp_trace_measurements_can_emit(struct mr_instance *instance, const marsio_buff_t *mbuf)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int marsio_dp_trace_record_emit_str(struct mr_instance *instance, marsio_buff_t *mbuf, const char *module, const char *str)
|
int marsio_dp_trace_measurement_emit_str(struct mr_instance *instance, marsio_buff_t *mbuf, enum dp_trace_measurements_type type, const char *module, const char *str)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int marsio_dp_trace_record_emit_fmt(struct mr_instance *instance, marsio_buff_t *mbuf, const char *module, const char *format, ...)
|
int marsio_dp_trace_measurement_emit_fmt(struct mr_instance *instance, marsio_buff_t *mbuf, enum dp_trace_measurements_type type, const char *module, const char *format, ...)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user