Use the wsutil/pint.h functions to fill in "exported PDU" headers.

That makes the code cleaner, including making it clearer that the fields
in those headers are big-endian.
This commit is contained in:
Guy Harris 2021-08-20 00:35:33 -07:00
parent 1b54c40a5b
commit d679564d7b
7 changed files with 111 additions and 166 deletions

View File

@ -36,6 +36,7 @@
#include "packet-x509ce.h"
#include "packet-ber.h"
#include <wsutil/wsgcrypt.h>
#include <wsutil/pint.h>
void proto_register_dvbci(void);
void proto_reg_handoff_dvbci(void);
@ -3353,10 +3354,8 @@ static int exp_pdu_data_dvbci_size(packet_info *pinfo _U_, void* data _U_)
static int exp_pdu_data_dvbci_populate_data(packet_info *pinfo, void* data, guint8 *tlv_buffer, guint32 buffer_size _U_)
{
tlv_buffer[0] = 0;
tlv_buffer[1] = EXP_PDU_TAG_DVBCI_EVT;
tlv_buffer[2] = 0;
tlv_buffer[3] = EXP_PDU_TAG_DVBCI_EVT_LEN;
phton16(&tlv_buffer[0], EXP_PDU_TAG_DVBCI_EVT);
phton16(&tlv_buffer[2], EXP_PDU_TAG_DVBCI_EVT_LEN);
tlv_buffer[4] = dvbci_get_evt_from_addrs(pinfo);
return exp_pdu_data_dvbci_size(pinfo, data);

View File

@ -1260,29 +1260,15 @@ static int exp_pdu_tcp_dissector_data_populate_data(packet_info *pinfo _U_, void
{
struct tcpinfo* dissector_data = (struct tcpinfo*)data;
tlv_buffer[0] = 0;
tlv_buffer[1] = EXP_PDU_TAG_TCP_INFO_DATA;
tlv_buffer[2] = 0;
tlv_buffer[3] = EXP_PDU_TCP_INFO_DATA_LEN; /* tag length */
tlv_buffer[4] = 0;
tlv_buffer[5] = EXP_PDU_TCP_INFO_VERSION;
tlv_buffer[6] = (dissector_data->seq & 0xff000000) >> 24;
tlv_buffer[7] = (dissector_data->seq & 0x00ff0000) >> 16;
tlv_buffer[8] = (dissector_data->seq & 0x0000ff00) >> 8;
tlv_buffer[9] = (dissector_data->seq & 0x000000ff);
tlv_buffer[10] = (dissector_data->nxtseq & 0xff000000) >> 24;
tlv_buffer[11] = (dissector_data->nxtseq & 0x00ff0000) >> 16;
tlv_buffer[12] = (dissector_data->nxtseq & 0x0000ff00) >> 8;
tlv_buffer[13] = (dissector_data->nxtseq & 0x000000ff);
tlv_buffer[14] = (dissector_data->lastackseq & 0xff000000) >> 24;
tlv_buffer[15] = (dissector_data->lastackseq & 0x00ff0000) >> 16;
tlv_buffer[16] = (dissector_data->lastackseq & 0x0000ff00) >> 8;
tlv_buffer[17] = (dissector_data->lastackseq & 0x000000ff);
phton16(&tlv_buffer[0], EXP_PDU_TAG_TCP_INFO_DATA);
phton16(&tlv_buffer[2], EXP_PDU_TCP_INFO_DATA_LEN); /* tag length */
phton16(&tlv_buffer[4], EXP_PDU_TCP_INFO_VERSION);
phton32(&tlv_buffer[6], dissector_data->seq);
phton32(&tlv_buffer[10], dissector_data->nxtseq);
phton32(&tlv_buffer[14], dissector_data->lastackseq);
tlv_buffer[18] = dissector_data->is_reassembled;
tlv_buffer[19] = (dissector_data->flags & 0xff00) >> 8;
tlv_buffer[20] = (dissector_data->flags & 0x00ff);
tlv_buffer[21] = (dissector_data->urgent_pointer & 0xff00) >> 8;
tlv_buffer[22] = (dissector_data->urgent_pointer & 0x00ff);
phton16(&tlv_buffer[19], dissector_data->flags);
phton16(&tlv_buffer[21], dissector_data->urgent_pointer);
return exp_pdu_tcp_dissector_data_size(pinfo, data);
}

View File

@ -18,6 +18,8 @@
#include <epan/address_types.h>
#include <epan/tap.h>
#include <wsutil/pint.h>
static GSList *export_pdu_tap_name_list = NULL;
static int exp_pdu_data_ip_size(const address* addr)
@ -39,17 +41,13 @@ static int exp_pdu_data_src_ip_size(packet_info *pinfo, void* data _U_)
static int exp_pdu_data_src_ip_populate_data(packet_info *pinfo, void* data _U_, guint8 *tlv_buffer, guint32 buffer_size _U_)
{
if(pinfo->net_src.type == AT_IPv4){
tlv_buffer[0] = 0;
tlv_buffer[1] = EXP_PDU_TAG_IPV4_SRC;
tlv_buffer[2] = 0;
tlv_buffer[3] = EXP_PDU_TAG_IPV4_LEN; /* tag length */
phton16(tlv_buffer+0, EXP_PDU_TAG_IPV4_SRC);
phton16(tlv_buffer+2, EXP_PDU_TAG_IPV4_LEN); /* tag length */
memcpy(tlv_buffer+4, pinfo->net_src.data, EXP_PDU_TAG_IPV4_LEN);
return 4 + EXP_PDU_TAG_IPV4_LEN;
}else if(pinfo->net_src.type == AT_IPv6){
tlv_buffer[0] = 0;
tlv_buffer[1] = EXP_PDU_TAG_IPV6_SRC;
tlv_buffer[2] = 0;
tlv_buffer[3] = EXP_PDU_TAG_IPV6_LEN; /* tag length */
phton16(tlv_buffer+0, EXP_PDU_TAG_IPV6_SRC);
phton16(tlv_buffer+2, EXP_PDU_TAG_IPV6_LEN); /* tag length */
memcpy(tlv_buffer+4, pinfo->net_src.data, EXP_PDU_TAG_IPV6_LEN);
return 4 + EXP_PDU_TAG_IPV6_LEN;
}
@ -65,17 +63,13 @@ static int exp_pdu_data_dst_ip_size(packet_info *pinfo, void* data _U_)
static int exp_pdu_data_dst_ip_populate_data(packet_info *pinfo, void* data _U_, guint8 *tlv_buffer, guint32 buffer_size _U_)
{
if(pinfo->net_dst.type == AT_IPv4){
tlv_buffer[0] = 0;
tlv_buffer[1] = EXP_PDU_TAG_IPV4_DST;
tlv_buffer[2] = 0;
tlv_buffer[3] = EXP_PDU_TAG_IPV4_LEN; /* tag length */
phton16(tlv_buffer+0, EXP_PDU_TAG_IPV4_DST);
phton16(tlv_buffer+2, EXP_PDU_TAG_IPV4_LEN); /* tag length */
memcpy(tlv_buffer+4, pinfo->net_dst.data, EXP_PDU_TAG_IPV4_LEN);
return 4 + EXP_PDU_TAG_IPV4_LEN;
}else if(pinfo->net_dst.type == AT_IPv6){
tlv_buffer[0] = 0;
tlv_buffer[1] = EXP_PDU_TAG_IPV6_DST;
tlv_buffer[2] = 0;
tlv_buffer[3] = EXP_PDU_TAG_IPV6_LEN; /* tag length */
phton16(tlv_buffer+0, EXP_PDU_TAG_IPV6_DST);
phton16(tlv_buffer+2, EXP_PDU_TAG_IPV6_LEN); /* tag length */
memcpy(tlv_buffer+4, pinfo->net_dst.data, EXP_PDU_TAG_IPV6_LEN);
return 4 + EXP_PDU_TAG_IPV6_LEN;
}
@ -126,15 +120,10 @@ static int exp_pdu_data_port_type_populate_data(packet_info *pinfo, void* data,
{
guint pt;
tlv_buffer[0] = 0;
tlv_buffer[1] = EXP_PDU_TAG_PORT_TYPE;
tlv_buffer[2] = 0;
tlv_buffer[3] = EXP_PDU_TAG_PORT_TYPE_LEN; /* tag length */
phton16(tlv_buffer+0, EXP_PDU_TAG_PORT_TYPE);
phton16(tlv_buffer+2, EXP_PDU_TAG_PORT_TYPE_LEN); /* tag length */
pt = exp_pdu_new_to_old_port_type(pinfo->ptype);
tlv_buffer[4] = (pt & 0xff000000) >> 24;
tlv_buffer[5] = (pt & 0x00ff0000) >> 16;
tlv_buffer[6] = (pt & 0x0000ff00) >> 8;
tlv_buffer[7] = (pt & 0x000000ff);
phton32(tlv_buffer+4, pt);
return exp_pdu_data_port_type_size(pinfo, data);
}
@ -146,14 +135,9 @@ static int exp_pdu_data_port_size(packet_info *pinfo _U_, void* data _U_)
static int exp_pdu_data_port_populate_data(guint32 port, guint8 porttype, guint8 *tlv_buffer, guint32 buffer_size _U_)
{
tlv_buffer[0] = 0;
tlv_buffer[1] = porttype;
tlv_buffer[2] = 0;
tlv_buffer[3] = EXP_PDU_TAG_PORT_LEN; /* tag length */
tlv_buffer[4] = (port & 0xff000000) >> 24;
tlv_buffer[5] = (port & 0x00ff0000) >> 16;
tlv_buffer[6] = (port & 0x0000ff00) >> 8;
tlv_buffer[7] = (port & 0x000000ff);
phton16(tlv_buffer+0, porttype);
phton16(tlv_buffer+2, EXP_PDU_TAG_PORT_LEN); /* tag length */
phton32(tlv_buffer+4, port);
return EXP_PDU_TAG_PORT_LEN + 4;
}
@ -175,14 +159,9 @@ static int exp_pdu_data_orig_frame_num_size(packet_info *pinfo _U_, void* data _
static int exp_pdu_data_orig_frame_num_populate_data(packet_info *pinfo, void* data, guint8 *tlv_buffer, guint32 buffer_size _U_)
{
tlv_buffer[0] = 0;
tlv_buffer[1] = EXP_PDU_TAG_ORIG_FNO;
tlv_buffer[2] = 0;
tlv_buffer[3] = EXP_PDU_TAG_ORIG_FNO_LEN; /* tag length */
tlv_buffer[4] = (pinfo->num & 0xff000000) >> 24;
tlv_buffer[5] = (pinfo->num & 0x00ff0000) >> 16;
tlv_buffer[6] = (pinfo->num & 0x0000ff00) >> 8;
tlv_buffer[7] = (pinfo->num & 0x000000ff);
phton16(tlv_buffer+0, EXP_PDU_TAG_ORIG_FNO);
phton16(tlv_buffer+2, EXP_PDU_TAG_ORIG_FNO_LEN); /* tag length */
phton32(tlv_buffer+4, pinfo->num);
return exp_pdu_data_orig_frame_num_size(pinfo, data);
}
@ -196,14 +175,9 @@ WS_DLL_PUBLIC int exp_pdu_data_dissector_table_num_value_populate_data(packet_in
{
guint32 value = GPOINTER_TO_UINT(data);
tlv_buffer[0] = 0;
tlv_buffer[1] = EXP_PDU_TAG_DISSECTOR_TABLE_NAME_NUM_VAL;
tlv_buffer[2] = 0;
tlv_buffer[3] = EXP_PDU_TAG_DISSECTOR_TABLE_NUM_VAL_LEN; /* tag length */
tlv_buffer[4] = (value & 0xff000000) >> 24;
tlv_buffer[5] = (value & 0x00ff0000) >> 16;
tlv_buffer[6] = (value & 0x0000ff00) >> 8;
tlv_buffer[7] = (value & 0x000000ff);
phton16(tlv_buffer+0, EXP_PDU_TAG_DISSECTOR_TABLE_NAME_NUM_VAL);
phton16(tlv_buffer+2, EXP_PDU_TAG_DISSECTOR_TABLE_NUM_VAL_LEN); /* tag length */
phton32(tlv_buffer+4, value);
return exp_pdu_data_dissector_table_num_value_size(pinfo, data);
}
@ -275,10 +249,8 @@ export_pdu_create_tags(packet_info *pinfo, const char* proto_name, guint16 tag_t
buf_remaining = exp_pdu_data->tlv_buffer_len;
/* Start by adding protocol name as a tag */
buffer_data[0] = (tag_type & 0xff00) >> 8;
buffer_data[1] = tag_type & 0x00ff;
buffer_data[2] = (proto_tag_len & 0xff00) >> 8;
buffer_data[3] = proto_tag_len & 0x00ff; /* tag length */
phton16(buffer_data+0, tag_type);
phton16(buffer_data+2, proto_tag_len); /* tag length */
memcpy(buffer_data+4, proto_name, proto_str_len);
buffer_data += (proto_tag_len+4);
buf_remaining -= (proto_tag_len+4);

View File

@ -44,6 +44,7 @@
#include <wsutil/socket.h>
#include <wsutil/please_report_bug.h>
#include <wsutil/wslog.h>
#include <wsutil/pint.h>
#include <cli_main.h>
@ -190,11 +191,9 @@ static void add_proto_name(guint8* mbuf, guint* offset, const char* proto_name)
size_t proto_str_len = strlen(proto_name);
guint16 proto_name_len = (guint16)((proto_str_len + 3) & 0xfffffffc);
mbuf[*offset] = 0;
mbuf[*offset+1] = EXP_PDU_TAG_PROTO_NAME;
phton16(mbuf + *offset, EXP_PDU_TAG_PROTO_NAME);
*offset += 2;
mbuf[*offset] = proto_name_len >> 8;
mbuf[*offset+1] = proto_name_len & 0xff;
phton16(mbuf + *offset, proto_name_len);
*offset += 2;
memcpy(mbuf + *offset, proto_name, proto_str_len);
@ -203,22 +202,20 @@ static void add_proto_name(guint8* mbuf, guint* offset, const char* proto_name)
static void add_ip_source_address(guint8* mbuf, guint* offset, uint32_t source_address)
{
mbuf[*offset] = 0x00;
mbuf[*offset+1] = EXP_PDU_TAG_IPV4_SRC;
mbuf[*offset+2] = 0;
mbuf[*offset+3] = 4;
*offset += 4;
phton16(mbuf + *offset, EXP_PDU_TAG_IPV4_SRC);
*offset += 2;
phton16(mbuf + *offset, 4);
*offset += 2;
memcpy(mbuf + *offset, &source_address, 4);
*offset += 4;
}
static void add_ip_dest_address(guint8* mbuf, guint* offset, uint32_t dest_address)
{
mbuf[*offset] = 0;
mbuf[*offset+1] = EXP_PDU_TAG_IPV4_DST;
mbuf[*offset+2] = 0;
mbuf[*offset+3] = 4;
*offset += 4;
phton16(mbuf + *offset, EXP_PDU_TAG_IPV4_DST);
*offset += 2;
phton16(mbuf + *offset, 4);
*offset += 2;
memcpy(mbuf + *offset, &dest_address, 4);
*offset += 4;
}
@ -227,11 +224,10 @@ static void add_udp_source_port(guint8* mbuf, guint* offset, uint16_t src_port)
{
uint32_t port = htonl(src_port);
mbuf[*offset] = 0;
mbuf[*offset+1] = EXP_PDU_TAG_SRC_PORT;
mbuf[*offset+2] = 0;
mbuf[*offset+3] = 4;
*offset += 4;
phton16(mbuf + *offset, EXP_PDU_TAG_SRC_PORT);
*offset += 2;
phton16(mbuf + *offset, 4);
*offset += 2;
memcpy(mbuf + *offset, &port, 4);
*offset += 4;
}
@ -240,11 +236,10 @@ static void add_udp_dst_port(guint8* mbuf, guint* offset, uint16_t dst_port)
{
uint32_t port = htonl(dst_port);
mbuf[*offset] = 0;
mbuf[*offset+1] = EXP_PDU_TAG_DST_PORT;
mbuf[*offset+2] = 0;
mbuf[*offset+3] = 4;
*offset += 4;
phton16(mbuf + *offset, EXP_PDU_TAG_DST_PORT);
*offset += 2;
phton16(mbuf + *offset, 4);
*offset += 2;
memcpy(mbuf + *offset, &port, 4);
*offset += 4;
}

View File

@ -85,8 +85,8 @@ busmaster_gen_packet(wtap_rec *rec, Buffer *buf,
memset(buf_data, 0, packet_length);
buf_data[1] = EXP_PDU_TAG_PROTO_NAME;
buf_data[3] = proto_name_length;
phton16(buf_data + 0, EXP_PDU_TAG_PROTO_NAME);
phton16(buf_data + 2, proto_name_length);
memcpy(buf_data + 4, proto_name, strlen(proto_name));
if (!priv_entry)

View File

@ -59,8 +59,8 @@ candump_write_packet(wtap_rec *rec, Buffer *buf, const msg_t *msg)
memset(buf_data, 0, packet_length);
buf_data[1] = EXP_PDU_TAG_PROTO_NAME;
buf_data[3] = proto_name_length;
phton16(buf_data + 0, EXP_PDU_TAG_PROTO_NAME);
phton16(buf_data + 2, proto_name_length);
memcpy(buf_data + 4, proto_name, strlen(proto_name));
if (msg->is_fd)

View File

@ -497,38 +497,37 @@ nettrace_msg_to_packet(nettrace_3gpp_32_423_file_info_t *file_info, wtap_rec *re
/* Fill packet buff */
if (use_proto_table == FALSE) {
*packet_buf++ = 0;
*packet_buf++ = EXP_PDU_TAG_PROTO_NAME;
*packet_buf++ = 0;
*packet_buf++ = tag_str_len;
phton16(packet_buf, EXP_PDU_TAG_PROTO_NAME);
packet_buf += 2;
phton16(packet_buf, tag_str_len);
packet_buf += 2;
memset(packet_buf, 0, tag_str_len);
memcpy(packet_buf, proto_name_str, proto_str_len);
packet_buf += tag_str_len;
}
else {
*packet_buf++ = 0;
*packet_buf++ = EXP_PDU_TAG_DISSECTOR_TABLE_NAME;
*packet_buf++ = 0;
*packet_buf++ = tag_str_len;
phton16(packet_buf, EXP_PDU_TAG_DISSECTOR_TABLE_NAME);
packet_buf += 2;
phton16(packet_buf, tag_str_len);
packet_buf += 2;
memset(packet_buf, 0, tag_str_len);
memcpy(packet_buf, dissector_table_str, dissector_table_str_len);
packet_buf += tag_str_len;
*packet_buf++ = 0;
*packet_buf++ = EXP_PDU_TAG_DISSECTOR_TABLE_NAME_NUM_VAL;
*packet_buf++ = 0;
*packet_buf++ = 4; /* option length */
*packet_buf++ = 0;
*packet_buf++ = 0;
*packet_buf++ = 0;
*packet_buf++ = dissector_table_val;
phton16(packet_buf, EXP_PDU_TAG_DISSECTOR_TABLE_NAME_NUM_VAL);
packet_buf += 2;
phton16(packet_buf, 4); /* option length */
packet_buf += 2;
phton32(packet_buf, dissector_table_val);
packet_buf += 4;
}
if (exported_pdu_info.presence_flags & EXP_PDU_TAG_COL_PROT_BIT) {
*packet_buf++ = 0;
*packet_buf++ = EXP_PDU_TAG_COL_PROT_TEXT;
*packet_buf++ = 0;
*packet_buf++ = (guint8)strlen(exported_pdu_info.proto_col_str);
phton16(packet_buf, EXP_PDU_TAG_COL_PROT_TEXT);
packet_buf += 2;
/* XXX - what if it's longer than 65535 bytes? */
phton16(packet_buf, (guint16)strlen(exported_pdu_info.proto_col_str));
packet_buf += 2;
for (j = 0; j < (int)strlen(exported_pdu_info.proto_col_str); j++) {
*packet_buf++ = exported_pdu_info.proto_col_str[j];
}
@ -537,68 +536,62 @@ nettrace_msg_to_packet(nettrace_3gpp_32_423_file_info_t *file_info, wtap_rec *re
}
if (exported_pdu_info.presence_flags & EXP_PDU_TAG_IP_SRC_BIT) {
*packet_buf++ = 0;
*packet_buf++ = EXP_PDU_TAG_IPV4_SRC;
*packet_buf++ = 0;
*packet_buf++ = EXP_PDU_TAG_IPV4_LEN;
phton16(packet_buf, EXP_PDU_TAG_IPV4_SRC);
packet_buf += 2;
phton16(packet_buf, EXP_PDU_TAG_IPV4_LEN);
packet_buf += 2;
memcpy(packet_buf, exported_pdu_info.src_ip, EXP_PDU_TAG_IPV4_LEN);
packet_buf += EXP_PDU_TAG_IPV4_LEN;
}
if (exported_pdu_info.presence_flags & EXP_PDU_TAG_IP_DST_BIT) {
*packet_buf++ = 0;
*packet_buf++ = EXP_PDU_TAG_IPV4_DST;
*packet_buf++ = 0;
*packet_buf++ = EXP_PDU_TAG_IPV4_LEN;
phton16(packet_buf, EXP_PDU_TAG_IPV4_DST);
packet_buf += 2;
phton16(packet_buf, EXP_PDU_TAG_IPV4_LEN);
packet_buf += 2;
memcpy(packet_buf, exported_pdu_info.dst_ip, EXP_PDU_TAG_IPV4_LEN);
packet_buf += EXP_PDU_TAG_IPV4_LEN;
}
if (exported_pdu_info.presence_flags & EXP_PDU_TAG_IP6_SRC_BIT) {
*packet_buf++ = 0;
*packet_buf++ = EXP_PDU_TAG_IPV6_SRC;
*packet_buf++ = 0;
*packet_buf++ = EXP_PDU_TAG_IPV6_LEN;
phton16(packet_buf, EXP_PDU_TAG_IPV6_SRC);
packet_buf += 2;
phton16(packet_buf, EXP_PDU_TAG_IPV6_LEN);
packet_buf += 2;
memcpy(packet_buf, exported_pdu_info.src_ip, EXP_PDU_TAG_IPV6_LEN);
packet_buf += EXP_PDU_TAG_IPV6_LEN;
}
if (exported_pdu_info.presence_flags & EXP_PDU_TAG_IP6_DST_BIT) {
*packet_buf++ = 0;
*packet_buf++ = EXP_PDU_TAG_IPV6_DST;
*packet_buf++ = 0;
*packet_buf++ = EXP_PDU_TAG_IPV6_LEN;
phton16(packet_buf, EXP_PDU_TAG_IPV6_DST);
packet_buf += 2;
phton16(packet_buf, EXP_PDU_TAG_IPV6_LEN);
packet_buf += 2;
memcpy(packet_buf, exported_pdu_info.dst_ip, EXP_PDU_TAG_IPV6_LEN);
packet_buf += EXP_PDU_TAG_IPV6_LEN;
}
if (exported_pdu_info.presence_flags & (EXP_PDU_TAG_SRC_PORT_BIT | EXP_PDU_TAG_DST_PORT_BIT)) {
*packet_buf++ = 0;
*packet_buf++ = EXP_PDU_TAG_PORT_TYPE;
*packet_buf++ = 0;
*packet_buf++ = EXP_PDU_TAG_PORT_TYPE_LEN;
*packet_buf++ = (exported_pdu_info.ptype & 0xff000000) >> 24;
*packet_buf++ = (exported_pdu_info.ptype & 0x00ff0000) >> 16;
*packet_buf++ = (exported_pdu_info.ptype & 0x0000ff00) >> 8;
*packet_buf++ = (exported_pdu_info.ptype & 0x000000ff);
phton16(packet_buf, EXP_PDU_TAG_PORT_TYPE);
packet_buf += 2;
phton16(packet_buf, EXP_PDU_TAG_PORT_TYPE_LEN);
packet_buf += 2;
phton32(packet_buf, exported_pdu_info.ptype);
packet_buf += 4;
}
if (exported_pdu_info.presence_flags & EXP_PDU_TAG_SRC_PORT_BIT) {
*packet_buf++ = 0;
*packet_buf++ = EXP_PDU_TAG_SRC_PORT;
*packet_buf++ = 0;
*packet_buf++ = EXP_PDU_TAG_PORT_LEN;
*packet_buf++ = (exported_pdu_info.src_port & 0xff000000) >> 24;
*packet_buf++ = (exported_pdu_info.src_port & 0x00ff0000) >> 16;
*packet_buf++ = (exported_pdu_info.src_port & 0x0000ff00) >> 8;
*packet_buf++ = (exported_pdu_info.src_port & 0x000000ff);
phton16(packet_buf, EXP_PDU_TAG_SRC_PORT);
packet_buf += 2;
phton16(packet_buf, EXP_PDU_TAG_PORT_LEN);
packet_buf += 2;
phton32(packet_buf, exported_pdu_info.src_port);
packet_buf += 4;
}
if (exported_pdu_info.presence_flags & EXP_PDU_TAG_DST_PORT_BIT) {
*packet_buf++ = 0;
*packet_buf++ = EXP_PDU_TAG_DST_PORT;
*packet_buf++ = 0;
*packet_buf++ = EXP_PDU_TAG_PORT_LEN;
*packet_buf++ = (exported_pdu_info.dst_port & 0xff000000) >> 24;
*packet_buf++ = (exported_pdu_info.dst_port & 0x00ff0000) >> 16;
*packet_buf++ = (exported_pdu_info.dst_port & 0x0000ff00) >> 8;
*packet_buf++ = (exported_pdu_info.dst_port & 0x000000ff);
phton16(packet_buf, EXP_PDU_TAG_DST_PORT);
packet_buf += 2;
phton16(packet_buf, EXP_PDU_TAG_PORT_LEN);
packet_buf += 4;
phton32(packet_buf, exported_pdu_info.dst_port);
packet_buf += 4;
}
/* Add end of options */