Dear All,
I have a struct as below and a pointer to the struct as such const struct pfring_pkthdr *h. I want to get all the value to be made one string delimited by comma to be inserted into db. So how to do it in C? E.g I want to combin is caplen,le,pkt_hash,parsed_header_len,eth_type,vlan_id,ip_version,ip_src,ip_dist.
struct pfring_pkthdr {
struct timeval ts;
u_int32_t caplen;
u_int32_t len;
struct pfring_extended_pkthdr extended_hdr;
};
struct pfring_extended_pkthdr {
u_int64_t timestamp_ns;
u_int8_t rx_direction;
int if_index;
u_int32_t pkt_hash;
u_int16_t parsed_header_len;
struct pkt_parsing_info parsed_pkt;
};
struct pkt_parsing_info {
u_int8_t dmac[ETH_ALEN], smac[ETH_ALEN];
u_int16_t eth_type;
u_int16_t vlan_id;
u_int8_t ip_version;
u_int8_t l3_proto, ip_tos;
ip_addr ip_src, ip_dst;
u_int16_t l4_src_port, l4_dst_port;
struct {
u_int8_t flags;
u_int32_t seq_num, ack_num;
} tcp;
u_int16_t last_matched_plugin_id;
u_int16_t last_matched_rule_id;
struct pkt_offset offset;
packet_user_detail pkt_detail;
};