static void cap_serialize(struct proto_info const *info_, uint8_t **buf) { struct cap_proto_info const *info = DOWNCAST(info_, info, cap_proto_info); proto_info_serialize(info_, buf); serialize_2(buf, info->dev_id); timeval_serialize(&info->tv, buf); }
static void sip_serialize(struct proto_info const *info_, uint8_t **buf) { struct sip_proto_info const *info = DOWNCAST(info_, info, sip_proto_info); proto_info_serialize(info_, buf); serialize_2(buf, info->set_values); if (info->set_values & SIP_CMD_SET) serialize_1(buf, info->cmd); if (info->set_values & SIP_FROM_SET) serialize_str(buf, info->from); if (info->set_values & SIP_TO_SET) serialize_str(buf, info->to); if (info->set_values & SIP_CALLID_SET) serialize_str(buf, info->call_id); if (info->set_values & SIP_MIME_SET) serialize_str(buf, info->mime_type); if (info->set_values & SIP_VIA_SET) { serialize_1(buf, info->via.protocol); ip_addr_serialize(&info->via.addr, buf); serialize_2(buf, info->via.port); } if (info->set_values & SIP_LENGTH_SET) serialize_4(buf, info->content_length); if (info->set_values & SIP_CODE_SET) serialize_4(buf, info->code); if (info->set_values & SIP_CSEQ_SET) serialize_4(buf, info->cseq); }
static void rtp_serialize(struct proto_info const *info_, uint8_t **buf) { struct rtp_proto_info const *info = DOWNCAST(info_, info, rtp_proto_info); proto_info_serialize(info_, buf); serialize_4(buf, info->sync_src); serialize_2(buf, info->seq_num); serialize_1(buf, info->payload_type); serialize_4(buf, info->timestamp); }
static void eth_serialize(struct proto_info const *info_, uint8_t **buf) { struct eth_proto_info const *info = DOWNCAST(info_, info, eth_proto_info); proto_info_serialize(info_, buf); serialize_3(buf, info->vlan_id); // 16 bits for vlan itself, +we need to handle -1 for UNSET serialize_n(buf, info->addr[0], ETH_ADDR_LEN); serialize_n(buf, info->addr[1], ETH_ADDR_LEN); serialize_2(buf, info->protocol); }
static void sdp_serialize(struct proto_info const *info_, uint8_t **buf) { struct sdp_proto_info const *info = DOWNCAST(info_, info, sdp_proto_info); proto_info_serialize(info_, buf); serialize_1(buf, info->set_values); if (info->set_values & SDP_HOST_SET) ip_addr_serialize(&info->host, buf); if (info->set_values & SDP_PORT_SET) serialize_2(buf, info->port); }
static void dhcp_serialize(struct proto_info const *info_, uint8_t **buf) { struct dhcp_proto_info const *info = DOWNCAST(info_, info, dhcp_proto_info); proto_info_serialize(info_, buf); serialize_1(buf, info->hw_addr_is_eth + (info->opcode << 1U)); serialize_4(buf, info->xid); serialize_1(buf, info->set_values); if (info->set_values & DHCP_CLIENT_SET) ip_addr_serialize(&info->client, buf); serialize_n(buf, info->client_mac, sizeof(info->client_mac)); serialize_str(buf, info->server_name); }
static void tcp_serialize(struct proto_info const *info_, uint8_t **buf) { struct tcp_proto_info const *info = DOWNCAST(info_, info, tcp_proto_info); proto_info_serialize(info_, buf); serialize_2(buf, info->key.port[0]); serialize_2(buf, info->key.port[1]); serialize_1(buf, info->syn + (info->ack<<1) + (info->rst<<2) + (info->fin<<3) + (info->urg<<4) + (info->psh<<5) + (info->to_srv<<6)); serialize_2(buf, info->window); serialize_2(buf, info->urg_ptr); serialize_4(buf, info->ack_num); serialize_4(buf, info->seq_num); serialize_4(buf, info->rel_seq_num); serialize_1(buf, info->set_values); serialize_2(buf, info->mss); serialize_1(buf, info->wsf); serialize_1(buf, info->nb_options); for (unsigned o = 0; o < info->nb_options; o++) { serialize_1(buf, info->options[o]); } }
static void skinny_serialize(struct proto_info const *info_, uint8_t **buf) { struct skinny_proto_info const *info = DOWNCAST(info_, info, skinny_proto_info); proto_info_serialize(&info->info, buf); // TODO }