本文整理汇总了C++中Flow::setJSONInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ Flow::setJSONInfo方法的具体用法?C++ Flow::setJSONInfo怎么用?C++ Flow::setJSONInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Flow
的用法示例。
在下文中一共展示了Flow::setJSONInfo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: flow_processing
void NetworkInterface::flow_processing(ZMQ_Flow *zflow)
{
bool src2dst_direction;
Flow *flow;
if((time_t)zflow->last_switched > (time_t)last_pkt_rcvd)
last_pkt_rcvd = zflow->last_switched;
/* Updating Flow */
flow = getFlow(zflow->src_mac, zflow->dst_mac,
zflow->vlan_id,
&zflow->src_ip, &zflow->dst_ip,
zflow->src_port, zflow->dst_port,
zflow->l4_proto, &src2dst_direction,
zflow->first_switched,
zflow->last_switched);
if(flow == NULL) return;
if(zflow->l4_proto == IPPROTO_TCP) flow->updateTcpFlags(zflow->tcp_flags);
flow->addFlowStats(src2dst_direction,
zflow->pkt_sampling_rate*zflow->in_pkts,
zflow->pkt_sampling_rate*zflow->in_bytes,
zflow->pkt_sampling_rate*zflow->out_pkts,
zflow->pkt_sampling_rate*zflow->out_bytes,
zflow->last_switched);
flow->setDetectedProtocol(zflow->l7_proto);
flow->setJSONInfo(json_object_to_json_string(zflow->additional_fields));
flow->updateActivities();
incStats(zflow->src_ip.isIPv4() ? ETHERTYPE_IP : ETHERTYPE_IPV6,
flow->get_detected_protocol(),
zflow->pkt_sampling_rate*(zflow->in_bytes + zflow->out_bytes),
zflow->pkt_sampling_rate*(zflow->in_pkts + zflow->out_pkts),
24 /* 8 Preamble + 4 CRC + 12 IFG */ + 14 /* Ethernet header */);
purgeIdle(zflow->last_switched);
}