aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--wiretap/5views.c14
-rw-r--r--wiretap/aethra.c10
-rw-r--r--wiretap/csids.c10
-rw-r--r--wiretap/erf.c8
-rw-r--r--wiretap/eyesdn.c2
-rw-r--r--wiretap/iptrace.c10
-rw-r--r--wiretap/k12.c44
-rw-r--r--wiretap/lanalyzer.c28
-rw-r--r--wiretap/netmon.c38
-rw-r--r--wiretap/netscaler.c44
-rw-r--r--wiretap/nettl.c36
-rw-r--r--wiretap/netxray.c34
-rw-r--r--wiretap/ngsniffer.c64
-rw-r--r--wiretap/pcap-common.c30
-rw-r--r--wiretap/peekclassic.c20
-rw-r--r--wiretap/peektagged.c16
-rw-r--r--wiretap/pppdump.c6
-rw-r--r--wiretap/radcom.c16
-rw-r--r--wiretap/snoop.c2
-rw-r--r--wiretap/stanag4607.c8
-rw-r--r--wiretap/visual.c26
-rw-r--r--wiretap/vwr.c50
-rw-r--r--wiretap/wtap-int.h73
23 files changed, 260 insertions, 329 deletions
diff --git a/wiretap/5views.c b/wiretap/5views.c
index 2359e4ae4a..538402f4ba 100644
--- a/wiretap/5views.c
+++ b/wiretap/5views.c
@@ -136,7 +136,7 @@ int _5views_open(wtap *wth, int *err, gchar **err_info)
/* Check Version */
Capture_Header.Info_Header.Version =
- pletohl(&Capture_Header.Info_Header.Version);
+ pletoh32(&Capture_Header.Info_Header.Version);
switch (Capture_Header.Info_Header.Version) {
case CST_5VW_INFO_RECORD_VERSION:
@@ -150,7 +150,7 @@ int _5views_open(wtap *wth, int *err, gchar **err_info)
/* Check File Type */
Capture_Header.Info_Header.FileType =
- pletohl(&Capture_Header.Info_Header.FileType);
+ pletoh32(&Capture_Header.Info_Header.FileType);
if((Capture_Header.Info_Header.FileType & CST_5VW_CAPTURE_FILE_TYPE_MASK) != CST_5VW_CAPTURE_FILEID)
{
*err = WTAP_ERR_UNSUPPORTED;
@@ -284,7 +284,7 @@ _5views_read_header(wtap *wth, FILE_T fh, t_5VW_TimeStamped_Header *hdr,
return FALSE;
}
- hdr->Key = pletohl(&hdr->Key);
+ hdr->Key = pletoh32(&hdr->Key);
if (hdr->Key != CST_5VW_RECORDS_HEADER_KEY) {
*err = WTAP_ERR_BAD_FILE;
*err_info = g_strdup_printf("5views: Time-stamped header has bad key value 0x%08X",
@@ -292,10 +292,10 @@ _5views_read_header(wtap *wth, FILE_T fh, t_5VW_TimeStamped_Header *hdr,
return FALSE;
}
- hdr->RecSubType = pletohl(&hdr->RecSubType);
- hdr->RecSize = pletohl(&hdr->RecSize);
- hdr->Utc = pletohl(&hdr->Utc);
- hdr->NanoSecondes = pletohl(&hdr->NanoSecondes);
+ hdr->RecSubType = pletoh32(&hdr->RecSubType);
+ hdr->RecSize = pletoh32(&hdr->RecSize);
+ hdr->Utc = pletoh32(&hdr->Utc);
+ hdr->NanoSecondes = pletoh32(&hdr->NanoSecondes);
phdr->presence_flags = WTAP_HAS_TS|WTAP_HAS_CAP_LEN;
phdr->ts.secs = hdr->Utc;
diff --git a/wiretap/aethra.c b/wiretap/aethra.c
index 2abb01f1af..43a387bc1f 100644
--- a/wiretap/aethra.c
+++ b/wiretap/aethra.c
@@ -161,9 +161,9 @@ int aethra_open(wtap *wth, int *err, gchar **err_info)
/*
* Convert the time stamp to a "time_t".
*/
- tm.tm_year = pletohs(&hdr.start_year) - 1900;
- tm.tm_mon = pletohs(&hdr.start_month) - 1;
- tm.tm_mday = pletohs(&hdr.start_day);
+ tm.tm_year = pletoh16(&hdr.start_year) - 1900;
+ tm.tm_mon = pletoh16(&hdr.start_month) - 1;
+ tm.tm_mday = pletoh16(&hdr.start_day);
tm.tm_hour = hdr.start_hour;
tm.tm_min = hdr.start_min;
tm.tm_sec = hdr.start_sec;
@@ -317,7 +317,7 @@ aethra_read_rec_header(wtap *wth, FILE_T fh, struct aethrarec_hdr *hdr,
return FALSE;
}
- rec_size = pletohs(hdr->rec_size);
+ rec_size = pletoh16(hdr->rec_size);
if (rec_size < (sizeof *hdr - sizeof hdr->rec_size)) {
/* The record is shorter than a record header. */
*err = WTAP_ERR_BAD_FILE;
@@ -329,7 +329,7 @@ aethra_read_rec_header(wtap *wth, FILE_T fh, struct aethrarec_hdr *hdr,
packet_size = rec_size - (guint32)(sizeof *hdr - sizeof hdr->rec_size);
- msecs = pletohl(hdr->timestamp);
+ msecs = pletoh32(hdr->timestamp);
phdr->presence_flags = WTAP_HAS_TS;
phdr->ts.secs = aethra->start + (msecs / 1000);
phdr->ts.nsecs = (msecs % 1000) * 1000000;
diff --git a/wiretap/csids.c b/wiretap/csids.c
index 7a372ca788..ff80ce5e1a 100644
--- a/wiretap/csids.c
+++ b/wiretap/csids.c
@@ -89,8 +89,8 @@ int csids_open(wtap *wth, int *err, gchar **err_info)
if( hdr.zeropad != 0 || hdr.caplen == 0 ) {
return 0;
}
- hdr.seconds = pntohl( &hdr.seconds );
- hdr.caplen = pntohs( &hdr.caplen );
+ hdr.seconds = pntoh32( &hdr.seconds );
+ hdr.caplen = pntoh16( &hdr.caplen );
bytesRead = file_read( &tmp, 2, wth->fh );
if( bytesRead != 2 ) {
*err = file_error( wth->fh, err_info );
@@ -107,7 +107,7 @@ int csids_open(wtap *wth, int *err, gchar **err_info)
}
return 0;
}
- iplen = pntohs(&iplen);
+ iplen = pntoh16(&iplen);
if ( iplen == 0 )
return 0;
@@ -196,8 +196,8 @@ csids_read_packet(FILE_T fh, csids_t *csids, struct wtap_pkthdr *phdr,
*err = WTAP_ERR_SHORT_READ;
return FALSE;
}
- hdr.seconds = pntohl(&hdr.seconds);
- hdr.caplen = pntohs(&hdr.caplen);
+ hdr.seconds = pntoh32(&hdr.seconds);
+ hdr.caplen = pntoh16(&hdr.caplen);
phdr->presence_flags = WTAP_HAS_TS;
phdr->len = hdr.caplen;
diff --git a/wiretap/erf.c b/wiretap/erf.c
index 238809390c..ee41894641 100644
--- a/wiretap/erf.c
+++ b/wiretap/erf.c
@@ -178,7 +178,7 @@ extern int erf_open(wtap *wth, int *err, gchar **err_info)
return 0;
}
- if ((ts = pletohll(&header.ts)) < prevts) {
+ if ((ts = pletoh64(&header.ts)) < prevts) {
/* reassembled AALx records may not be in time order, also records are not in strict time order between physical interfaces, so allow 1 sec fudge */
if ( ((prevts-ts)>>32) > 1 ) {
return 0;
@@ -375,7 +375,7 @@ static int erf_read_header(FILE_T fh,
}
{
- guint64 ts = pletohll(&erf_header->ts);
+ guint64 ts = pletoh64(&erf_header->ts);
phdr->presence_flags = WTAP_HAS_TS|WTAP_HAS_CAP_LEN|WTAP_HAS_INTERFACE_ID;
phdr->ts.secs = (long) (ts >> 32);
@@ -391,7 +391,7 @@ static int erf_read_header(FILE_T fh,
/* Copy the ERF pseudo header */
memset(&pseudo_header->erf, 0, sizeof(pseudo_header->erf));
- pseudo_header->erf.phdr.ts = pletohll(&erf_header->ts);
+ pseudo_header->erf.phdr.ts = pletoh64(&erf_header->ts);
pseudo_header->erf.phdr.type = erf_header->type;
pseudo_header->erf.phdr.flags = erf_header->flags;
pseudo_header->erf.phdr.rlen = g_ntohs(erf_header->rlen);
@@ -407,7 +407,7 @@ static int erf_read_header(FILE_T fh,
*bytes_read += (guint32)sizeof(erf_exhdr);
*packet_size -= (guint32)sizeof(erf_exhdr);
skiplen += (guint32)sizeof(erf_exhdr);
- erf_exhdr_sw = pntohll(erf_exhdr);
+ erf_exhdr_sw = pntoh64(erf_exhdr);
if (i < max)
memcpy(&pseudo_header->erf.ehdr_list[i].ehdr, &erf_exhdr_sw, sizeof(erf_exhdr_sw));
type = erf_exhdr[0];
diff --git a/wiretap/eyesdn.c b/wiretap/eyesdn.c
index ace3502a85..0c520b934d 100644
--- a/wiretap/eyesdn.c
+++ b/wiretap/eyesdn.c
@@ -218,7 +218,7 @@ read_eyesdn_rec(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf, int *err,
channel = hdr[8];
direction = hdr[9];
- pkt_len = pntohs(&hdr[10]);
+ pkt_len = pntoh16(&hdr[10]);
switch(direction >> 1) {
diff --git a/wiretap/iptrace.c b/wiretap/iptrace.c
index 4e5e8d4905..49c139f8b6 100644
--- a/wiretap/iptrace.c
+++ b/wiretap/iptrace.c
@@ -153,7 +153,7 @@ iptrace_read_rec_1_0(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
}
/* Read the packet metadata */
- packet_size = pntohl(&header[0]);
+ packet_size = pntoh32(&header[0]);
if (packet_size < IPTRACE_1_0_PDATA_SIZE) {
/*
* Uh-oh, the record isn't big enough to even have a
@@ -207,7 +207,7 @@ iptrace_read_rec_1_0(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
phdr->presence_flags = WTAP_HAS_TS;
phdr->len = packet_size;
phdr->caplen = packet_size;
- phdr->ts.secs = pntohl(&header[4]);
+ phdr->ts.secs = pntoh32(&header[4]);
phdr->ts.nsecs = 0;
/* Fill in the pseudo-header. */
@@ -349,7 +349,7 @@ iptrace_read_rec_2_0(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
#endif
/* Read the packet metadata */
- packet_size = pntohl(&header[0]);
+ packet_size = pntoh32(&header[0]);
if (packet_size < IPTRACE_2_0_PDATA_SIZE) {
/*
* Uh-oh, the record isn't big enough to even have a
@@ -403,8 +403,8 @@ iptrace_read_rec_2_0(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
phdr->presence_flags = WTAP_HAS_TS;
phdr->len = packet_size;
phdr->caplen = packet_size;
- phdr->ts.secs = pntohl(&header[32]);
- phdr->ts.nsecs = pntohl(&header[36]);
+ phdr->ts.secs = pntoh32(&header[32]);
+ phdr->ts.nsecs = pntoh32(&header[36]);
/* Fill in the pseudo_header. */
fill_in_pseudo_header(phdr->pkt_encap, &phdr->pseudo_header, header);
diff --git a/wiretap/k12.c b/wiretap/k12.c
index bba474e1b3..67d2139463 100644
--- a/wiretap/k12.c
+++ b/wiretap/k12.c
@@ -450,7 +450,7 @@ static gint get_record(k12_t *file_data, FILE_T fh, gint64 file_offset,
}
}
- left = pntohl(buffer + K12_RECORD_LEN);
+ left = pntoh32(buffer + K12_RECORD_LEN);
#ifdef DEBUG_K12
actual_len = left;
#endif
@@ -557,15 +557,15 @@ process_packet_data(struct wtap_pkthdr *phdr, Buffer *target, guint8 *buffer,
phdr->presence_flags = WTAP_HAS_TS;
- ts = pntohll(buffer + K12_PACKET_TIMESTAMP);
+ ts = pntoh64(buffer + K12_PACKET_TIMESTAMP);
phdr->ts.secs = (guint32) ((ts / 2000000) + 631152000);
phdr->ts.nsecs = (guint32) ( (ts % 2000000) * 500 );
- length = pntohl(buffer + K12_RECORD_FRAME_LEN) & 0x00001FFF;
+ length = pntoh32(buffer + K12_RECORD_FRAME_LEN) & 0x00001FFF;
phdr->len = phdr->caplen = length;
- type = pntohl(buffer + K12_RECORD_TYPE);
+ type = pntoh32(buffer + K12_RECORD_TYPE);
buffer_offset = (type == K12_REC_D0020) ? K12_PACKET_FRAME_D0020 : K12_PACKET_FRAME;
buffer_assure_space(target, length);
@@ -579,7 +579,7 @@ process_packet_data(struct wtap_pkthdr *phdr, Buffer *target, guint8 *buffer,
phdr->pseudo_header.k12.extra_info = (guint8*)buffer_start_ptr(&(k12->extra_info));
phdr->pseudo_header.k12.extra_length = extra_len;
- src_id = pntohl(buffer + K12_RECORD_SRC_ID);
+ src_id = pntoh32(buffer + K12_RECORD_SRC_ID);
K12_DBG(5,("process_packet_data: src_id=%.8x",src_id));
phdr->pseudo_header.k12.input = src_id;
@@ -603,8 +603,8 @@ process_packet_data(struct wtap_pkthdr *phdr, Buffer *target, guint8 *buffer,
switch(src_desc->input_type) {
case K12_PORT_ATMPVC:
if ((long)(buffer_offset + length + K12_PACKET_OFFSET_CID) < len) {
- phdr->pseudo_header.k12.input_info.atm.vp = pntohs(buffer + buffer_offset + length + K12_PACKET_OFFSET_VP);
- phdr->pseudo_header.k12.input_info.atm.vc = pntohs(buffer + buffer_offset + length + K12_PACKET_OFFSET_VC);
+ phdr->pseudo_header.k12.input_info.atm.vp = pntoh16(buffer + buffer_offset + length + K12_PACKET_OFFSET_VP);
+ phdr->pseudo_header.k12.input_info.atm.vc = pntoh16(buffer + buffer_offset + length + K12_PACKET_OFFSET_VC);
phdr->pseudo_header.k12.input_info.atm.cid = *((unsigned char*)(buffer + buffer_offset + length + K12_PACKET_OFFSET_CID));
break;
}
@@ -660,8 +660,8 @@ static gboolean k12_read(wtap *wth, int *err, gchar **err_info, gint64 *data_off
buffer = k12->seq_read_buff;
- type = pntohl(buffer + K12_RECORD_TYPE);
- src_id = pntohl(buffer + K12_RECORD_SRC_ID);
+ type = pntoh32(buffer + K12_RECORD_TYPE);
+ src_id = pntoh32(buffer + K12_RECORD_SRC_ID);
if ( ! (src_desc = (k12_src_desc_t*)g_hash_table_lookup(k12->src_by_id,GUINT_TO_POINTER(src_id))) ) {
@@ -817,8 +817,8 @@ int k12_open(wtap *wth, int *err, gchar **err_info) {
file_data = new_k12_file_data();
- file_data->file_len = pntohl( header_buffer + 0x8);
- file_data->num_of_records = pntohl( header_buffer + 0xC );
+ file_data->file_len = pntoh32( header_buffer + 0x8);
+ file_data->num_of_records = pntoh32( header_buffer + 0xC );
K12_DBG(5,("k12_open: FILE_HEADER OK: offset=%x file_len=%i records=%i",
offset,
@@ -850,7 +850,7 @@ int k12_open(wtap *wth, int *err, gchar **err_info) {
read_buffer = file_data->seq_read_buff;
- rec_len = pntohl( read_buffer + K12_RECORD_LEN );
+ rec_len = pntoh32( read_buffer + K12_RECORD_LEN );
if (rec_len < K12_RECORD_TYPE + 4) {
/* Record isn't long enough to have a type field */
*err = WTAP_ERR_BAD_FILE;
@@ -858,7 +858,7 @@ int k12_open(wtap *wth, int *err, gchar **err_info) {
rec_len, K12_RECORD_TYPE + 4);
return -1;
}
- type = pntohl( read_buffer + K12_RECORD_TYPE );
+ type = pntoh32( read_buffer + K12_RECORD_TYPE );
if ( (type & K12_MASK_PACKET) == K12_REC_PACKET ||
(type & K12_MASK_PACKET) == K12_REC_D0020) {
@@ -881,11 +881,11 @@ int k12_open(wtap *wth, int *err, gchar **err_info) {
rec_len, K12_SRCDESC_STACKLEN + 2);
return -1;
}
- extra_len = pntohs( read_buffer + K12_SRCDESC_EXTRALEN );
- name_len = pntohs( read_buffer + K12_SRCDESC_NAMELEN );
- stack_len = pntohs( read_buffer + K12_SRCDESC_STACKLEN );
+ extra_len = pntoh16( read_buffer + K12_SRCDESC_EXTRALEN );
+ name_len = pntoh16( read_buffer + K12_SRCDESC_NAMELEN );
+ stack_len = pntoh16( read_buffer + K12_SRCDESC_STACKLEN );
- rec->input = pntohl( read_buffer + K12_RECORD_SRC_ID );
+ rec->input = pntoh32( read_buffer + K12_RECORD_SRC_ID );
K12_DBG(5,("k12_open: INTERFACE RECORD offset=%x interface=%x",offset,rec->input));
@@ -906,7 +906,7 @@ int k12_open(wtap *wth, int *err, gchar **err_info) {
rec_len, K12_SRCDESC_EXTRATYPE + 4);
return -1;
}
- switch(( rec->input_type = pntohl( read_buffer + K12_SRCDESC_EXTRATYPE ) )) {
+ switch(( rec->input_type = pntoh32( read_buffer + K12_SRCDESC_EXTRATYPE ) )) {
case K12_PORT_DS0S:
if (rec_len < K12_SRCDESC_DS0_MASK + 32) {
/* Record isn't long enough to have a source descriptor extra type field */
@@ -932,8 +932,8 @@ int k12_open(wtap *wth, int *err, gchar **err_info) {
return -1;
}
- rec->input_info.atm.vp = pntohs( read_buffer + K12_SRCDESC_ATM_VPI );
- rec->input_info.atm.vc = pntohs( read_buffer + K12_SRCDESC_ATM_VCI );
+ rec->input_info.atm.vp = pntoh16( read_buffer + K12_SRCDESC_ATM_VPI );
+ rec->input_info.atm.vc = pntoh16( read_buffer + K12_SRCDESC_ATM_VCI );
break;
default:
break;
@@ -982,8 +982,8 @@ int k12_open(wtap *wth, int *err, gchar **err_info) {
continue;
} else if (type == K12_REC_STK_FILE) {
K12_DBG(1,("k12_open: K12_REC_STK_FILE"));
- K12_DBG(1,("Field 1: 0x%08x",pntohl( read_buffer + 0x08 )));
- K12_DBG(1,("Field 2: 0x%08x",pntohl( read_buffer + 0x0c )));
+ K12_DBG(1,("Field 1: 0x%08x",pntoh32( read_buffer + 0x08 )));
+ K12_DBG(1,("Field 2: 0x%08x",pntoh32( read_buffer + 0x0c )));
K12_ASCII_DUMP(1, read_buffer, rec_len, 0x10);
offset += len;
diff --git a/wiretap/lanalyzer.c b/wiretap/lanalyzer.c
index 9fc6fc49ad..0ff70265ef 100644
--- a/wiretap/lanalyzer.c
+++ b/wiretap/lanalyzer.c
@@ -301,8 +301,8 @@ int lanalyzer_open(wtap *wth, int *err, gchar **err_info)
return -1;
return 0;
}
- record_type = pletohs(rec_header.record_type);
- record_length = pletohs(rec_header.record_length); /* make sure to do this for while() loop */
+ record_type = pletoh16(rec_header.record_type);
+ record_length = pletoh16(rec_header.record_length); /* make sure to do this for while() loop */
if (record_type != RT_HeaderRegular && record_type != RT_HeaderCyclic) {
return 0;
@@ -361,8 +361,8 @@ int lanalyzer_open(wtap *wth, int *err, gchar **err_info)
return -1;
}
- record_type = pletohs(rec_header.record_type);
- record_length = pletohs(rec_header.record_length);
+ record_type = pletoh16(rec_header.record_type);
+ record_length = pletoh16(rec_header.record_length);
/*g_message("Record 0x%04X Length %d", record_type, record_length);*/
switch (record_type) {
@@ -386,7 +386,7 @@ int lanalyzer_open(wtap *wth, int *err, gchar **err_info)
*/
cr_day = summary[0];
cr_month = summary[1];
- cr_year = pletohs(&summary[2]);
+ cr_year = pletoh16(&summary[2]);
/*g_message("Day %d Month %d Year %d (%04X)", cr_day, cr_month,
cr_year, cr_year);*/
@@ -403,10 +403,10 @@ int lanalyzer_open(wtap *wth, int *err, gchar **err_info)
lanalyzer->start = mktime(&tm);
/*g_message("Day %d Month %d Year %d", tm.tm_mday,
tm.tm_mon, tm.tm_year);*/
- mxslc = pletohs(&summary[30]);
+ mxslc = pletoh16(&summary[30]);
wth->snapshot_length = mxslc;
- board_type = pletohs(&summary[188]);
+ board_type = pletoh16(&summary[188]);
switch (board_type) {
case BOARD_325:
wth->file_encap = WTAP_ENCAP_ETHERNET;
@@ -475,8 +475,8 @@ static gboolean lanalyzer_read_trace_record(wtap *wth, FILE_T fh,
return FALSE;
}
- record_type = pletohs(LE_record_type);
- record_length = pletohs(LE_record_length);
+ record_type = pletoh16(LE_record_type);
+ record_length = pletoh16(LE_record_length);
/* Only Trace Packet Data Records should occur now that we're in
* the middle of reading packets. If any other record type exists
@@ -510,8 +510,8 @@ static gboolean lanalyzer_read_trace_record(wtap *wth, FILE_T fh,
return FALSE;
}
- true_size = pletohs(&descriptor[4]);
- packet_size = pletohs(&descriptor[6]);
+ true_size = pletoh16(&descriptor[4]);
+ packet_size = pletoh16(&descriptor[6]);
/*
* OK, is the frame data size greater than than what's left of the
@@ -528,9 +528,9 @@ static gboolean lanalyzer_read_trace_record(wtap *wth, FILE_T fh,
phdr->presence_flags = WTAP_HAS_TS|WTAP_HAS_CAP_LEN;
- time_low = pletohs(&descriptor[8]);
- time_med = pletohs(&descriptor[10]);
- time_high = pletohs(&descriptor[12]);
+ time_low = pletoh16(&descriptor[8]);
+ time_med = pletoh16(&descriptor[10]);
+ time_high = pletoh16(&descriptor[12]);
t = (((guint64)time_low) << 0) + (((guint64)time_med) << 16) +
(((guint64)time_high) << 32);
tsecs = (time_t) (t/2000000);
diff --git a/wiretap/netmon.c b/wiretap/netmon.c
index 1c006752a3..7ec1668693 100644
--- a/wiretap/netmon.c
+++ b/wiretap/netmon.c
@@ -249,7 +249,7 @@ int netmon_open(wtap *wth, int *err, gchar **err_info)
return -1;
}
- hdr.network = pletohs(&hdr.network);
+ hdr.network = pletoh16(&hdr.network);
if (hdr.network >= NUM_NETMON_ENCAPS
|| netmon_encap[hdr.network] == WTAP_ENCAP_UNKNOWN) {
*err = WTAP_ERR_UNSUPPORTED_ENCAP;
@@ -278,12 +278,12 @@ int netmon_open(wtap *wth, int *err, gchar **err_info)
* Convert the time stamp to a "time_t" and a number of
* milliseconds.
*/
- tm.tm_year = pletohs(&hdr.ts_year) - 1900;
- tm.tm_mon = pletohs(&hdr.ts_month) - 1;
- tm.tm_mday = pletohs(&hdr.ts_day);
- tm.tm_hour = pletohs(&hdr.ts_hour);
- tm.tm_min = pletohs(&hdr.ts_min);
- tm.tm_sec = pletohs(&hdr.ts_sec);
+ tm.tm_year = pletoh16(&hdr.ts_year) - 1900;
+ tm.tm_mon = pletoh16(&hdr.ts_month) - 1;
+ tm.tm_mday = pletoh16(&hdr.ts_day);
+ tm.tm_hour = pletoh16(&hdr.ts_hour);
+ tm.tm_min = pletoh16(&hdr.ts_min);
+ tm.tm_sec = pletoh16(&hdr.ts_sec);
tm.tm_isdst = -1;
netmon->start_secs = mktime(&tm);
/*
@@ -300,7 +300,7 @@ int netmon_open(wtap *wth, int *err, gchar **err_info)
* intervals since 1601-01-01 00:00:00 "UTC", there, instead
* of stuffing a SYSTEMTIME, which is time-zone-dependent, there?).
*/
- netmon->start_nsecs = pletohs(&hdr.ts_msec)*1000000;
+ netmon->start_nsecs = pletoh16(&hdr.ts_msec)*1000000;
netmon->version_major = hdr.ver_major;
netmon->version_minor = hdr.ver_minor;
@@ -317,7 +317,7 @@ int netmon_open(wtap *wth, int *err, gchar **err_info)
/*
* Get the offset of the frame index table.
*/
- frame_table_offset = pletohl(&hdr.frametableoffset);
+ frame_table_offset = pletoh32(&hdr.frametableoffset);
/*
* It appears that some NetMon 2.x files don't have the
@@ -330,7 +330,7 @@ int netmon_open(wtap *wth, int *err, gchar **err_info)
* Therefore, we must read the frame table, and use the offsets
* in it as the offsets of the frames.
*/
- frame_table_length = pletohl(&hdr.frametablelength);
+ frame_table_length = pletoh32(&hdr.frametablelength);
frame_table_size = frame_table_length / (guint32)sizeof (guint32);
if ((frame_table_size * sizeof (guint32)) != frame_table_length) {
*err = WTAP_ERR_BAD_FILE;
@@ -388,7 +388,7 @@ int netmon_open(wtap *wth, int *err, gchar **err_info)
* OK, now byte-swap the frame table.
*/
for (i = 0; i < frame_table_size; i++)
- frame_table[i] = pletohl(&frame_table[i]);
+ frame_table[i] = pletoh32(&frame_table[i]);
#endif
/* Set up to start reading at the first frame. */
@@ -521,13 +521,13 @@ static gboolean netmon_process_rec_header(wtap *wth, FILE_T fh,
switch (netmon->version_major) {
case 1:
- orig_size = pletohs(&hdr.hdr_1_x.orig_len);
- packet_size = pletohs(&hdr.hdr_1_x.incl_len);
+ orig_size = pletoh16(&hdr.hdr_1_x.orig_len);
+ packet_size = pletoh16(&hdr.hdr_1_x.incl_len);
break;
case 2:
- orig_size = pletohl(&hdr.hdr_2_x.orig_len);
- packet_size = pletohl(&hdr.hdr_2_x.incl_len);
+ orig_size = pletoh32(&hdr.hdr_2_x.orig_len);
+ packet_size = pletoh32(&hdr.hdr_2_x.incl_len);
break;
}
if (packet_size > WTAP_MAX_PACKET_SIZE) {
@@ -585,11 +585,11 @@ static gboolean netmon_process_rec_header(wtap *wth, FILE_T fh,
* a gint64 such as delta, even after multiplying
* it by 1000000.
*
- * pletohl() returns a guint32; we cast it to gint64
+ * pletoh32() returns a guint32; we cast it to gint64
* before multiplying, so that the product doesn't
* overflow a guint32.
*/
- delta = ((gint64)pletohl(&hdr.hdr_1_x.ts_delta))*1000000;
+ delta = ((gint64)pletoh32(&hdr.hdr_1_x.ts_delta))*1000000;
break;
case 2:
@@ -606,7 +606,7 @@ static gboolean netmon_process_rec_header(wtap *wth, FILE_T fh,
* positive number-of-microseconds into a small
* negative number-of-100-nanosecond-increments.
*/
- delta = pletohll(&hdr.hdr_2_x.ts_delta)*10;
+ delta = pletoh64(&hdr.hdr_2_x.ts_delta)*10;
/*
* OK, it's now a signed value in 100-nanosecond
@@ -858,7 +858,7 @@ netmon_read_rec_trailer(FILE_T fh, int trlr_size, int *err, gchar **err_info)
return -1; /* error */
}
- network = pletohs(trlr.trlr_2_1.network);
+ network = pletoh16(trlr.trlr_2_1.network);
if ((network & 0xF000) == NETMON_NET_PCAP_BASE) {
/*
* Converted pcap file - the LINKTYPE_ value
diff --git a/wiretap/netscaler.c b/wiretap/netscaler.c
index 36aa11a645..897615c85a 100644
--- a/wiretap/netscaler.c
+++ b/wiretap/netscaler.c
@@ -470,14 +470,14 @@ typedef struct nspr_pktracepart_v26
__TNO(phdr,enumprefix,structprefix,structname,eth,Data)
#define TRACE_FULL_V10_REC_LEN_OFF(phdr,enumprefix,structprefix,structname) \
- (phdr)->len = pletohs(&(fp)->nsprRecordSize);\
+ (phdr)->len = pletoh16(&(fp)->nsprRecordSize);\
(phdr)->caplen = (phdr)->len;\
TRACE_V10_REC_LEN_OFF(phdr,enumprefix,structprefix,structname)
#define TRACE_PART_V10_REC_LEN_OFF(phdr,enumprefix,structprefix,structname) \
(phdr)->presence_flags |= WTAP_HAS_CAP_LEN;\
- (phdr)->len = pletohs(&pp->pp_PktSizeOrg) + nspr_pktracepart_v10_s;\
- (phdr)->caplen = pletohs(&pp->nsprRecordSize);\
+ (phdr)->len = pletoh16(&pp->pp_PktSizeOrg) + nspr_pktracepart_v10_s;\
+ (phdr)->caplen = pletoh16(&pp->nsprRecordSize);\
TRACE_V10_REC_LEN_OFF(phdr,enumprefix,structprefix,structname)
#define TRACE_V20_REC_LEN_OFF(phdr,enumprefix,structprefix,structname) \
@@ -756,8 +756,8 @@ nspm_signature_version(wtap *wth, gchar *nstrace_buf, gint32 len)
for ( ; len > (gint32)(MIN(sizeof(NSPR_SIGSTR_V10), sizeof(NSPR_SIGSTR_V20))); dp++, len--)
{
#define sigv10p ((nspr_signature_v10_t*)dp)
- if ((pletohs(&sigv10p->nsprRecordType) == NSPR_SIGNATURE_V10) &&
- (pletohs(&sigv10p->nsprRecordSize) <= len) &&
+ if ((pletoh16(&sigv10p->nsprRecordType) == NSPR_SIGNATURE_V10) &&
+ (pletoh16(&sigv10p->nsprRecordSize) <= len) &&
((gint32)sizeof(NSPR_SIGSTR_V10) <= len) &&
(!nspm_signature_isv10(sigv10p->sig_Signature)))
return WTAP_FILE_TYPE_SUBTYPE_NETSCALER_1_0;
@@ -776,8 +776,8 @@ nspm_signature_version(wtap *wth, gchar *nstrace_buf, gint32 len)
return 0; /* no version found */
}
-#define nspr_getv10recordtype(hdp) (pletohs(&hdp->nsprRecordType))
-#define nspr_getv10recordsize(hdp) (pletohs(&hdp->nsprRecordSize))
+#define nspr_getv10recordtype(hdp) (pletoh16(&hdp->nsprRecordType))
+#define nspr_getv10recordsize(hdp) (pletoh16(&hdp->nsprRecordSize))
#define nspr_getv20recordtype(hdp) (hdp->phd_RecordType)
#define nspr_getv20recordsize(hdp) \
(((hdp)->phd_RecordSizeLow & NSPR_V20RECORDSIZE_2BYTES)? \
@@ -802,7 +802,7 @@ nspm_signature_version(wtap *wth, gchar *nstrace_buf, gint32 len)
switch (nspr_getv##ver##recordtype(fp))\
{\
case NSPR_ABSTIME_V##ver:\
- ns_setabstime(nstrace, pletohl(&((nspr_abstime_v##ver##_t *) fp)->abs_Time), pletohs(&((nspr_abstime_v##ver##_t *) fp)->abs_RelTime));\
+ ns_setabstime(nstrace, pletoh32(&((nspr_abstime_v##ver##_t *) fp)->abs_Time), pletoh16(&((nspr_abstime_v##ver##_t *) fp)->abs_RelTime));\
nstrace->nstrace_buf_offset = nstrace_buf_offset + nspr_getv##ver##recordsize(fp);\
nstrace->nstrace_buflen = nstrace_buflen;\
return TRUE;\
@@ -890,7 +890,7 @@ static gboolean nstrace_read_v10(wtap *wth, int *err, gchar **err_info, gint64 *
* the previous packet.\
*/\
(phdr)->presence_flags = WTAP_HAS_TS;\
- nsg_creltime += ns_hrtime2nsec(pletohl(&fp->fp_RelTimeHr));\
+ nsg_creltime += ns_hrtime2nsec(pletoh32(&fp->fp_RelTimeHr));\
(phdr)->ts.secs = nstrace->nspm_curtime + (guint32) (nsg_creltime / 1000000000);\
(phdr)->ts.nsecs = (guint32) (nsg_creltime % 1000000000);\
TRACE_FULL_V##type##_REC_LEN_OFF(phdr,v##type##_full,fp,pktracefull_v##type);\
@@ -913,7 +913,7 @@ static gboolean nstrace_read_v10(wtap *wth, int *err, gchar **err_info, gint64 *
* the previous packet.\
*/\
(phdr)->presence_flags = WTAP_HAS_TS;\
- nsg_creltime += ns_hrtime2nsec(pletohl(&pp->pp_RelTimeHr));\
+ nsg_creltime += ns_hrtime2nsec(pletoh32(&pp->pp_RelTimeHr));\
(phdr)->ts.secs = nstrace->nspm_curtime + (guint32) (nsg_creltime / 1000000000);\
(phdr)->ts.nsecs = (guint32) (nsg_creltime % 1000000000);\
TRACE_PART_V##type##_REC_LEN_OFF(phdr,v##type##_part,pp,pktracepart_v##type);\
@@ -925,7 +925,7 @@ static gboolean nstrace_read_v10(wtap *wth, int *err, gchar **err_info, gint64 *
nstrace->nstrace_buflen = nstrace_buflen;\
return TRUE;\
- switch (pletohs(&(( nspr_header_v10_t*)&nstrace_buf[nstrace_buf_offset])->ph_RecordType))
+ switch (pletoh16(&(( nspr_header_v10_t*)&nstrace_buf[nstrace_buf_offset])->ph_RecordType))
{
GENERATE_CASE_FULL(&wth->phdr,10,100)
GENERATE_CASE_PART(&wth->phdr,10,100)
@@ -936,15 +936,15 @@ static gboolean nstrace_read_v10(wtap *wth, int *err, gchar **err_info, gint64 *
case NSPR_ABSTIME_V10:
fp = (nspr_pktracefull_v10_t *) &nstrace_buf[nstrace_buf_offset];
- ns_setabstime(nstrace, pletohl(((nspr_abstime_v10_t *) fp)->abs_Time), pletohl(&((nspr_abstime_v10_t *) fp)->abs_RelTime));
- nstrace_buf_offset += pletohs(&fp->nsprRecordSize);
+ ns_setabstime(nstrace, pletoh32(((nspr_abstime_v10_t *) fp)->abs_Time), pletoh32(&((nspr_abstime_v10_t *) fp)->abs_RelTime));
+ nstrace_buf_offset += pletoh16(&fp->nsprRecordSize);
break;
case NSPR_RELTIME_V10:
fp = (nspr_pktracefull_v10_t *) &nstrace_buf[nstrace_buf_offset];
- ns_setrelativetime(nstrace, pletohl(((nspr_abstime_v10_t *) fp)->abs_RelTime));
- nstrace_buf_offset += pletohs(&fp->nsprRecordSize);
+ ns_setrelativetime(nstrace, pletoh32(((nspr_abstime_v10_t *) fp)->abs_RelTime));
+ nstrace_buf_offset += pletoh16(&fp->nsprRecordSize);
break;
case NSPR_UNUSEDSPACE_V10:
@@ -955,7 +955,7 @@ static gboolean nstrace_read_v10(wtap *wth, int *err, gchar **err_info, gint64 *
default:
fp = (nspr_pktracefull_v10_t *) &nstrace_buf[nstrace_buf_offset];
- nstrace_buf_offset += pletohs(&fp->nsprRecordSize);
+ nstrace_buf_offset += pletoh16(&fp->nsprRecordSize);
break;
}
}
@@ -971,7 +971,7 @@ static gboolean nstrace_read_v10(wtap *wth, int *err, gchar **err_info, gint64 *
#define TIMEDEFV20(fp,type) \
do {\
wth->phdr.presence_flags |= WTAP_HAS_TS;\
- nsg_creltime += ns_hrtime2nsec(pletohl(fp->type##_RelTimeHr));\
+ nsg_creltime += ns_hrtime2nsec(pletoh32(fp->type##_RelTimeHr));\
wth->phdr.ts.secs = nstrace->nspm_curtime + (guint32) (nsg_creltime / 1000000000);\
wth->phdr.ts.nsecs = (guint32) (nsg_creltime % 1000000000);\
}while(0)
@@ -980,7 +980,7 @@ static gboolean nstrace_read_v10(wtap *wth, int *err, gchar **err_info, gint64 *
do {\
wth->phdr.presence_flags |= WTAP_HAS_TS;\
/* access _AbsTimeHr as a 64bit value */\
- nsg_creltime = pletohll(fp->type##_AbsTimeHr);\
+ nsg_creltime = pletoh64(fp->type##_AbsTimeHr);\
wth->phdr.ts.secs = (guint32) (nsg_creltime / 1000000000);\
wth->phdr.ts.nsecs = (guint32) (nsg_creltime % 1000000000);\
}while(0)
@@ -993,7 +993,7 @@ static gboolean nstrace_read_v10(wtap *wth, int *err, gchar **err_info, gint64 *
#define PPSIZEDEFV20(phdr,pp,ver) \
do {\
(phdr)->presence_flags |= WTAP_HAS_CAP_LEN;\
- (phdr)->len = pletohs(&pp->pp_PktSizeOrg) + nspr_pktracepart_v##ver##_s;\
+ (phdr)->len = pletoh16(&pp->pp_PktSizeOrg) + nspr_pktracepart_v##ver##_s;\
(phdr)->caplen = nspr_getv20recordsize((nspr_hd_v20_t *)pp);\
}while(0)
@@ -1102,14 +1102,14 @@ static gboolean nstrace_read_v20(wtap *wth, int *err, gchar **err_info, gint64 *
{
nspr_pktracefull_v20_t *fp20 = (nspr_pktracefull_v20_t *) &nstrace_buf[nstrace_buf_offset];
nstrace_buf_offset += nspr_getv20recordsize((nspr_hd_v20_t *)fp20);
- ns_setabstime(nstrace, pletohl(&((nspr_abstime_v20_t *) fp20)->abs_Time), pletohs(&((nspr_abstime_v20_t *) fp20)->abs_RelTime));
+ ns_setabstime(nstrace, pletoh32(&((nspr_abstime_v20_t *) fp20)->abs_Time), pletoh16(&((nspr_abstime_v20_t *) fp20)->abs_RelTime));
break;
}
case NSPR_RELTIME_V20:
{
nspr_pktracefull_v20_t *fp20 = (nspr_pktracefull_v20_t *) &nstrace_buf[nstrace_buf_offset];
- ns_setrelativetime(nstrace, pletohs(&((nspr_abstime_v20_t *) fp20)->abs_RelTime));
+ ns_setrelativetime(nstrace, pletoh16(&((nspr_abstime_v20_t *) fp20)->abs_RelTime));
nstrace_buf_offset += nspr_getv20recordsize((nspr_hd_v20_t *)fp20);
break;
}
@@ -1187,7 +1187,7 @@ static gboolean nstrace_seek_read_v10(wtap *wth, gint64 seek_off,
(phdr)->pseudo_header.nstr.rec_type = NSPR_HEADER_VERSION##acttype;\
break;
- switch (pletohs(&(( nspr_header_v10_t*)pd)->ph_RecordType))
+ switch (pletoh16(&(( nspr_header_v10_t*)pd)->ph_RecordType))
{
GENERATE_CASE_FULL(phdr,10,100)
GENERATE_CASE_PART(phdr,10,100)
diff --git a/wiretap/nettl.c b/wiretap/nettl.c
index 6c0d9e11c2..ee193592d9 100644
--- a/wiretap/nettl.c
+++ b/wiretap/nettl.c
@@ -384,11 +384,11 @@ nettl_read_rec(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
if (file_seek(fh, hdr_len, SEEK_CUR, err) == -1)
return FALSE;
- if ( (pntohl(&rec_hdr.kind) & NETTL_HDR_PDU_MASK) == 0 ) {
+ if ( (pntoh32(&rec_hdr.kind) & NETTL_HDR_PDU_MASK) == 0 ) {
/* not actually a data packet (PDU) trace record */
phdr->pkt_encap = WTAP_ENCAP_NETTL_RAW_IP;
- length = pntohl(&rec_hdr.length);
- caplen = pntohl(&rec_hdr.caplen);
+ length = pntoh32(&rec_hdr.length);
+ caplen = pntoh32(&rec_hdr.caplen);
padlen = 0;
} else switch (subsys) {
case NETTL_SUBSYS_LAN100 :
@@ -452,12 +452,12 @@ nettl_read_rec(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
phdr->pkt_encap = WTAP_ENCAP_NETTL_ETHERNET;
}
- length = pntohl(&rec_hdr.length);
- caplen = pntohl(&rec_hdr.caplen);
+ length = pntoh32(&rec_hdr.length);
+ caplen = pntoh32(&rec_hdr.caplen);
/* HPPB FDDI has different inbound vs outbound trace records */
if (subsys == NETTL_SUBSYS_HPPB_FDDI) {
- if (pntohl(&rec_hdr.kind) == NETTL_HDR_PDUIN) {
+ if (pntoh32(&rec_hdr.kind) == NETTL_HDR_PDUIN) {
/* inbound is very strange...
there are an extra 3 bytes after the DSAP and SSAP
for SNAP frames ???
@@ -523,8 +523,8 @@ nettl_read_rec(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
return FALSE;
}
- length = pntohs(&drv_eth_hdr.length);
- caplen = pntohs(&drv_eth_hdr.caplen);
+ length = pntoh16(&drv_eth_hdr.length);
+ caplen = pntoh16(&drv_eth_hdr.caplen);
/*
* XXX - is there a length field that would give the length
* of this header, so that we don't have to check for
@@ -559,8 +559,8 @@ nettl_read_rec(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
* And is "from_dce" at xxa[0] in the nettlrec_hdr structure?
*/
phdr->pkt_encap = WTAP_ENCAP_NETTL_X25;
- length = pntohl(&rec_hdr.length);
- caplen = pntohl(&rec_hdr.caplen);
+ length = pntoh32(&rec_hdr.length);
+ caplen = pntoh32(&rec_hdr.caplen);
padlen = 24; /* sizeof (struct nettlrec_sx25l2_hdr) - NETTL_REC_HDR_LEN + 4 */
if (file_seek(fh, padlen, SEEK_CUR, err) == -1)
return FALSE;
@@ -571,8 +571,8 @@ nettl_read_rec(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
subsystem -- We'll probably spew junks and core if it isn't... */
wth->file_encap = WTAP_ENCAP_PER_PACKET;
phdr->pkt_encap = WTAP_ENCAP_NETTL_ETHERNET;
- length = pntohl(&rec_hdr.length);
- caplen = pntohl(&rec_hdr.caplen);
+ length = pntoh32(&rec_hdr.length);
+ caplen = pntoh32(&rec_hdr.caplen);
padlen = 0;
break;
}
@@ -593,14 +593,14 @@ nettl_read_rec(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
}
datalen = caplen - padlen;
phdr->caplen = datalen;
- phdr->ts.secs = pntohl(&rec_hdr.sec);
- phdr->ts.nsecs = pntohl(&rec_hdr.usec) * 1000;
+ phdr->ts.secs = pntoh32(&rec_hdr.sec);
+ phdr->ts.nsecs = pntoh32(&rec_hdr.usec) * 1000;
pseudo_header->nettl.subsys = subsys;
- pseudo_header->nettl.devid = pntohl(&rec_hdr.devid);
- pseudo_header->nettl.kind = pntohl(&rec_hdr.kind);
- pseudo_header->nettl.pid = pntohl(&rec_hdr.pid);
- pseudo_header->nettl.uid = pntohs(&rec_hdr.uid);
+ pseudo_header->nettl.devid = pntoh32(&rec_hdr.devid);
+ pseudo_header->nettl.kind = pntoh32(&rec_hdr.kind);
+ pseudo_header->nettl.pid = pntoh32(&rec_hdr.pid);
+ pseudo_header->nettl.uid = pntoh16(&rec_hdr.uid);
if (phdr->caplen > WTAP_MAX_PACKET_SIZE) {
/*
diff --git a/wiretap/netxray.c b/wiretap/netxray.c
index 959ae97f33..6f6ec02f6f 100644
--- a/wiretap/netxray.c
+++ b/wiretap/netxray.c
@@ -487,8 +487,8 @@ int netxray_open(wtap *wth, int *err, gchar **err_info)
/*
* Figure out the time stamp units and start time stamp.
*/
- start_timestamp = (double)pletohl(&hdr.timelo)
- + (double)pletohl(&hdr.timehi)*4294967296.0;
+ start_timestamp = (double)pletoh32(&hdr.timelo)
+ + (double)pletoh32(&hdr.timehi)*4294967296.0;
switch (file_type) {
case WTAP_FILE_TYPE_SUBTYPE_NETXRAY_OLD:
@@ -542,7 +542,7 @@ int netxray_open(wtap *wth, int *err, gchar **err_info)
bug reports).
*/
if (hdr.timeunit == 2) {
- ticks_per_sec = pletohl(hdr.realtick);
+ ticks_per_sec = pletoh32(hdr.realtick);
}
else {
ticks_per_sec = TpS[hdr.timeunit];
@@ -780,7 +780,7 @@ int netxray_open(wtap *wth, int *err, gchar **err_info)
wth->subtype_seek_read = netxray_seek_read;
wth->file_encap = file_encap;
wth->snapshot_length = 0; /* not available in header */
- netxray->start_time = pletohl(&hdr.start_time);
+ netxray->start_time = pletoh32(&hdr.start_time);
netxray->ticks_per_sec = ticks_per_sec;
netxray->start_timestamp = start_timestamp;
netxray->version_major = version_major;
@@ -893,9 +893,9 @@ int netxray_open(wtap *wth, int *err, gchar **err_info)
* XXX: Remember 'start_offset' to help testing for 'short file' at EOF
*/
netxray->wrapped = FALSE;
- netxray->nframes = pletohl(&hdr.nframes);
- netxray->start_offset = pletohl(&hdr.start_offset);
- netxray->end_offset = pletohl(&hdr.end_offset);
+ netxray->nframes = pletoh32(&hdr.nframes);
+ netxray->start_offset = pletoh32(&hdr.start_offset);
+ netxray->end_offset = pletoh32(&hdr.end_offset);
/* Seek to the beginning of the data records. */
if (file_seek(wth->fh, netxray->start_offset, SEEK_SET, err) == -1) {
@@ -983,9 +983,9 @@ reread:
* Read the packet data.
*/
if (netxray->version_major == 0)
- packet_size = pletohs(&hdr.old_hdr.len);
+ packet_size = pletoh16(&hdr.old_hdr.len);
else
- packet_size = pletohs(&hdr.hdr_1_x.incl_len);
+ packet_size = pletoh16(&hdr.hdr_1_x.incl_len);
if (!wtap_read_packet_bytes(wth->fh, wth->frame_buffer, packet_size,
err, err_info))
return FALSE;
@@ -1324,7 +1324,7 @@ netxray_set_phdr(wtap *wth, Buffer *buf, int len,
if (hdr->hdr_2_x.xxx[9] & 0x04)
phdr->pseudo_header.atm.flags |= ATM_RAW_CELL;
phdr->pseudo_header.atm.vpi = hdr->hdr_2_x.xxx[11];
- phdr->pseudo_header.atm.vci = pletohs(&hdr->hdr_2_x.xxx[12]);
+ phdr->pseudo_header.atm.vci = pletoh16(&hdr->hdr_2_x.xxx[12]);
phdr->pseudo_header.atm.channel =
(hdr->hdr_2_x.xxx[15] & 0x10)? 1 : 0;
phdr->pseudo_header.atm.cells = 0;
@@ -1405,8 +1405,8 @@ netxray_set_phdr(wtap *wth, Buffer *buf, int len,
if (netxray->version_major == 0) {
phdr->presence_flags = WTAP_HAS_TS;
- t = (double)pletohl(&hdr->old_hdr.timelo)
- + (double)pletohl(&hdr->old_hdr.timehi)*4294967296.0;
+ t = (double)pletoh32(&hdr->old_hdr.timelo)
+ + (double)pletoh32(&hdr->old_hdr.timehi)*4294967296.0;
t /= netxray->ticks_per_sec;
t -= netxray->start_timestamp;
phdr->ts.secs = netxray->start_time + (long)t;
@@ -1416,13 +1416,13 @@ netxray_set_phdr(wtap *wth, Buffer *buf, int len,
* We subtract the padding from the packet size, so our caller
* doesn't see it.
*/
- packet_size = pletohs(&hdr->old_hdr.len);
+ packet_size = pletoh16(&hdr->old_hdr.len);
phdr->caplen = packet_size - padding;
phdr->len = phdr->caplen;
} else {
phdr->presence_flags = WTAP_HAS_TS|WTAP_HAS_CAP_LEN;
- t = (double)pletohl(&hdr->hdr_1_x.timelo)
- + (double)pletohl(&hdr->hdr_1_x.timehi)*4294967296.0;
+ t = (double)pletoh32(&hdr->hdr_1_x.timelo)
+ + (double)pletoh32(&hdr->hdr_1_x.timehi)*4294967296.0;
t /= netxray->ticks_per_sec;
t -= netxray->start_timestamp;
phdr->ts.secs = netxray->start_time + (time_t)t;
@@ -1432,9 +1432,9 @@ netxray_set_phdr(wtap *wth, Buffer *buf, int len,
* We subtract the padding from the packet size, so our caller
* doesn't see it.
*/
- packet_size = pletohs(&hdr->hdr_1_x.incl_len);
+ packet_size = pletoh16(&hdr->hdr_1_x.incl_len);
phdr->caplen = packet_size - padding;
- phdr->len = pletohs(&hdr->hdr_1_x.orig_len) - padding;
+ phdr->len = pletoh16(&hdr->hdr_1_x.orig_len) - padding;
}
}
diff --git a/wiretap/ngsniffer.c b/wiretap/ngsniffer.c
index 8c649e8f0d..af055a3cdb 100644
--- a/wiretap/ngsniffer.c
+++ b/wiretap/ngsniffer.c
@@ -618,7 +618,7 @@ ngsniffer_open(wtap *wth, int *err, gchar **err_info)
return -1;
}
- type = pletohs(record_type);
+ type = pletoh16(record_type);
if (type != REC_VERS) {
*err = WTAP_ERR_BAD_FILE;
@@ -676,7 +676,7 @@ ngsniffer_open(wtap *wth, int *err, gchar **err_info)
* for BRI ISDN files, and 0 for non-ISDN files; is that something
* the DOS Sniffer understands?
*/
- maj_vers = pletohs(&version.maj_vers);
+ maj_vers = pletoh16(&version.maj_vers);
if (process_header_records(wth, err, err_info, maj_vers,
version.network) < 0)
return -1;
@@ -694,7 +694,7 @@ ngsniffer_open(wtap *wth, int *err, gchar **err_info)
* ... and this is a version 1 capture; look
* at the first "rsvd" word.
*/
- switch (pletohs(&version.rsvd[0])) {
+ switch (pletoh16(&version.rsvd[0])) {
case 1:
case 2:
@@ -736,7 +736,7 @@ ngsniffer_open(wtap *wth, int *err, gchar **err_info)
ngsniffer = (ngsniffer_t *)g_malloc(sizeof(ngsniffer_t));
wth->priv = (void *)ngsniffer;
ngsniffer->maj_vers = maj_vers;
- ngsniffer->min_vers = pletohs(&version.min_vers);
+ ngsniffer->min_vers = pletoh16(&version.min_vers);
/* We haven't allocated any uncompression buffers yet. */
ngsniffer->seq.buf = NULL;
@@ -763,13 +763,13 @@ ngsniffer_open(wtap *wth, int *err, gchar **err_info)
ngsniffer->network = version.network;
/* Get capture start time */
- start_date = pletohs(&version.date);
+ start_date = pletoh16(&version.date);
tm.tm_year = ((start_date&DOS_YEAR_MASK)>>DOS_YEAR_SHIFT) + DOS_YEAR_OFFSET;
tm.tm_mon = ((start_date&DOS_MONTH_MASK)>>DOS_MONTH_SHIFT) + DOS_MONTH_OFFSET;
tm.tm_mday = ((start_date&DOS_DAY_MASK)>>DOS_DAY_SHIFT);
#if 0
/* The time does not appear to act as an offset; only the date */
- start_time = pletohs(&version.time);
+ start_time = pletoh16(&version.time);
tm.tm_hour = (start_time&0xf800)>>11;
tm.tm_min = (start_time&0x7e0)>>5;
tm.tm_sec = (start_time&0x1f)<<1;
@@ -826,7 +826,7 @@ process_header_records(wtap *wth, int *err, gchar **err_info, gint16 maj_vers,
return 0; /* EOF */
}
- type = pletohs(record_type);
+ type = pletoh16(record_type);
if ((type != REC_HEADER1) && (type != REC_HEADER2)
&& (type != REC_HEADER3) && (type != REC_HEADER4)
&& (type != REC_HEADER5) && (type != REC_HEADER6)
@@ -853,7 +853,7 @@ process_header_records(wtap *wth, int *err, gchar **err_info, gint16 maj_vers,
return -1;
}
- length = pletohs(record_length);
+ length = pletoh16(record_length);
/*
* Is this is an "Internetwork analyzer" capture, and
@@ -1109,12 +1109,12 @@ ngsniffer_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
/* Read error */
return FALSE;
}
- time_low = pletohs(&frame2.time_low);
- time_med = pletohs(&frame2.time_med);
+ time_low = pletoh16(&frame2.time_low);
+ time_med = pletoh16(&frame2.time_med);
time_high = frame2.time_high;
time_day = frame2.time_day;
- size = pletohs(&frame2.size);
- true_size = pletohs(&frame2.true_size);
+ size = pletoh16(&frame2.size);
+ true_size = pletoh16(&frame2.true_size);
length -= sizeof frame2; /* we already read that much */
@@ -1139,12 +1139,12 @@ ngsniffer_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
/* Read error */
return FALSE;
}
- time_low = pletohs(&frame4.time_low);
- time_med = pletohs(&frame4.time_med);
+ time_low = pletoh16(&frame4.time_low);
+ time_med = pletoh16(&frame4.time_med);
time_high = frame4.time_high;
time_day = frame4.time_day;
- size = pletohs(&frame4.size);
- true_size = pletohs(&frame4.true_size);
+ size = pletoh16(&frame4.size);
+ true_size = pletoh16(&frame4.true_size);
/*
* XXX - it looks as if some version 4 captures have
@@ -1170,12 +1170,12 @@ ngsniffer_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
/* Read error */
return FALSE;
}
- time_low = pletohs(&frame6.time_low);
- time_med = pletohs(&frame6.time_med);
+ time_low = pletoh16(&frame6.time_low);
+ time_med = pletoh16(&frame6.time_med);
time_high = frame6.time_high;
time_day = frame6.time_day;
- size = pletohs(&frame6.size);
- true_size = pletohs(&frame6.true_size);
+ size = pletoh16(&frame6.size);
+ true_size = pletoh16(&frame6.true_size);
length -= sizeof frame6; /* we already read that much */
@@ -1377,8 +1377,8 @@ ngsniffer_read_rec_header(wtap *wth, gboolean is_random, guint16 *typep,
return -1;
}
- *typep = pletohs(record_type);
- *lengthp = pletohs(record_length);
+ *typep = pletoh16(record_type);
+ *lengthp = pletoh16(record_length);
return 1; /* success */
}
@@ -1521,14 +1521,14 @@ set_pseudo_header_frame4(union wtap_pseudo_header *pseudo_header,
* Map flags from frame4.atm_info.StatusWord.
*/
pseudo_header->atm.flags = 0;
- StatusWord = pletohl(&frame4->atm_info.StatusWord);
+ StatusWord = pletoh32(&frame4->atm_info.StatusWord);
if (StatusWord & SW_RAW_CELL)
pseudo_header->atm.flags |= ATM_RAW_CELL;
aal_type = frame4->atm_info.AppTrafType & ATT_AALTYPE;
hl_type = frame4->atm_info.AppTrafType & ATT_HLTYPE;
- vpi = pletohs(&frame4->atm_info.Vpi);
- vci = pletohs(&frame4->atm_info.Vci);
+ vpi = pletoh16(&frame4->atm_info.Vpi);
+ vci = pletoh16(&frame4->atm_info.Vci);
switch (aal_type) {
@@ -1756,11 +1756,11 @@ set_pseudo_header_frame4(union wtap_pseudo_header *pseudo_header,
}
pseudo_header->atm.vpi = vpi;
pseudo_header->atm.vci = vci;
- pseudo_header->atm.channel = pletohs(&frame4->atm_info.channel);
- pseudo_header->atm.cells = pletohs(&frame4->atm_info.cells);
- pseudo_header->atm.aal5t_u2u = pletohs(&frame4->atm_info.Trailer.aal5t_u2u);
- pseudo_header->atm.aal5t_len = pletohs(&frame4->atm_info.Trailer.aal5t_len);
- pseudo_header->atm.aal5t_chksum = pntohl(&frame4->atm_info.Trailer.aal5t_chksum);
+ pseudo_header->atm.channel = pletoh16(&frame4->atm_info.channel);
+ pseudo_header->atm.cells = pletoh16(&frame4->atm_info.cells);
+ pseudo_header->atm.aal5t_u2u = pletoh16(&frame4->atm_info.Trailer.aal5t_u2u);
+ pseudo_header->atm.aal5t_len = pletoh16(&frame4->atm_info.Trailer.aal5t_len);
+ pseudo_header->atm.aal5t_chksum = pntoh32(&frame4->atm_info.Trailer.aal5t_chksum);
}
static gboolean
@@ -2296,7 +2296,7 @@ SnifferDecompress(unsigned char *inbuf, size_t inlen, unsigned char *outbuf,
if ( 0 == bit_mask )
{
bit_mask = 0x8000; /* start with the high bit */
- bit_value = pletohs(pin); /* get the next 16 bits */
+ bit_value = pletoh16(pin); /* get the next 16 bits */
pin += 2; /* skip over what we just grabbed */
if ( pin >= pin_end )
{
@@ -2602,7 +2602,7 @@ read_blob(FILE_T infile, ngsniffer_comp_stream_t *comp_stream, int *err,
return -1;
}
comp_stream->comp_offset += 2;
- blob_len_host = pletohs(&blob_len);
+ blob_len_host = pletoh16(&blob_len);
/* Compressed or uncompressed? */
if (blob_len_host < 0) {
diff --git a/wiretap/pcap-common.c b/wiretap/pcap-common.c
index e770348684..c4bca6e79e 100644
--- a/wiretap/pcap-common.c
+++ b/wiretap/pcap-common.c
@@ -808,7 +808,7 @@ pcap_read_sunatm_pseudoheader(FILE_T fh,
}
vpi = atm_phdr[SUNATM_VPI];
- vci = pntohs(&atm_phdr[SUNATM_VCI]);
+ vci = pntoh16(&atm_phdr[SUNATM_VCI]);
switch (atm_phdr[SUNATM_FLAGS] & 0x0F) {
@@ -896,7 +896,7 @@ pcap_read_nokiaatm_pseudoheader(FILE_T fh,
}
vpi = atm_phdr[NOKIAATM_VPI];
- vci = pntohs(&atm_phdr[NOKIAATM_VCI]);
+ vci = pntoh16(&atm_phdr[NOKIAATM_VCI]);
pseudo_header->atm.vpi = vpi;
pseudo_header->atm.vci = vci;
@@ -961,14 +961,14 @@ pcap_read_irda_pseudoheader(FILE_T fh, union wtap_pseudo_header *pseudo_header,
return FALSE;
}
- if (pntohs(&irda_phdr[IRDA_SLL_PROTOCOL_OFFSET]) != 0x0017) {
+ if (pntoh16(&irda_phdr[IRDA_SLL_PROTOCOL_OFFSET]) != 0x0017) {
*err = WTAP_ERR_BAD_FILE;
if (err_info != NULL)
*err_info = g_strdup("libpcap: IrDA capture has a packet with an invalid sll_protocol field");
return FALSE;
}
- pseudo_header->irda.pkttype = pntohs(&irda_phdr[IRDA_SLL_PKTTYPE_OFFSET]);
+ pseudo_header->irda.pkttype = pntoh16(&irda_phdr[IRDA_SLL_PKTTYPE_OFFSET]);
return TRUE;
}
@@ -990,7 +990,7 @@ pcap_read_mtp2_pseudoheader(FILE_T fh, union wtap_pseudo_header *pseudo_header,
pseudo_header->mtp2.sent = mtp2_hdr[MTP2_SENT_OFFSET];
pseudo_header->mtp2.annex_a_used = mtp2_hdr[MTP2_ANNEX_A_USED_OFFSET];
- pseudo_header->mtp2.link_number = pntohs(&mtp2_hdr[MTP2_LINK_NUMBER_OFFSET]);
+ pseudo_header->mtp2.link_number = pntoh16(&mtp2_hdr[MTP2_LINK_NUMBER_OFFSET]);
return TRUE;
}
@@ -1011,14 +1011,14 @@ pcap_read_lapd_pseudoheader(FILE_T fh, union wtap_pseudo_header *pseudo_header,
return FALSE;
}
- if (pntohs(&lapd_phdr[LAPD_SLL_PROTOCOL_OFFSET]) != ETH_P_LAPD) {
+ if (pntoh16(&lapd_phdr[LAPD_SLL_PROTOCOL_OFFSET]) != ETH_P_LAPD) {
*err = WTAP_ERR_BAD_FILE;
if (err_info != NULL)
*err_info = g_strdup("libpcap: LAPD capture has a packet with an invalid sll_protocol field");
return FALSE;
}
- pseudo_header->lapd.pkttype = pntohs(&lapd_phdr[LAPD_SLL_PKTTYPE_OFFSET]);
+ pseudo_header->lapd.pkttype = pntoh16(&lapd_phdr[LAPD_SLL_PKTTYPE_OFFSET]);
pseudo_header->lapd.we_network = !!lapd_phdr[LAPD_SLL_ADDR_OFFSET+0];
return TRUE;
@@ -1369,12 +1369,12 @@ pcap_read_erf_pseudoheader(FILE_T fh, struct wtap_pkthdr *whdr,
*err = WTAP_ERR_SHORT_READ;
return FALSE;
}
- pseudo_header->erf.phdr.ts = pletohll(&erf_hdr[0]); /* timestamp */
+ pseudo_header->erf.phdr.ts = pletoh64(&erf_hdr[0]); /* timestamp */
pseudo_header->erf.phdr.type = erf_hdr[8];
pseudo_header->erf.phdr.flags = erf_hdr[9];
- pseudo_header->erf.phdr.rlen = pntohs(&erf_hdr[10]);
- pseudo_header->erf.phdr.lctr = pntohs(&erf_hdr[12]);
- pseudo_header->erf.phdr.wlen = pntohs(&erf_hdr[14]);
+ pseudo_header->erf.phdr.rlen = pntoh16(&erf_hdr[10]);
+ pseudo_header->erf.phdr.lctr = pntoh16(&erf_hdr[12]);
+ pseudo_header->erf.phdr.wlen = pntoh16(&erf_hdr[14]);
/* The high 32 bits of the timestamp contain the integer number of seconds
* while the lower 32 bits contain the binary fraction of the second.
@@ -1418,7 +1418,7 @@ pcap_read_erf_exheader(FILE_T fh, union wtap_pseudo_header *pseudo_header,
return FALSE;
}
type = erf_exhdr[0];
- erf_exhdr_sw = pntohll(erf_exhdr);
+ erf_exhdr_sw = pntoh64(erf_exhdr);
if (i < max)
memcpy(&pseudo_header->erf.ehdr_list[i].ehdr, &erf_exhdr_sw, sizeof(erf_exhdr_sw));
*psize += 8;
@@ -1457,7 +1457,7 @@ pcap_read_erf_subheader(FILE_T fh, union wtap_pseudo_header *pseudo_header,
*err = WTAP_ERR_SHORT_READ;
return FALSE;
}
- pseudo_header->erf.subhdr.mc_hdr = pntohl(&erf_subhdr[0]);
+ pseudo_header->erf.subhdr.mc_hdr = pntoh32(&erf_subhdr[0]);
*psize = sizeof(erf_mc_header_t);
break;
case ERF_TYPE_ETH:
@@ -1472,7 +1472,7 @@ pcap_read_erf_subheader(FILE_T fh, union wtap_pseudo_header *pseudo_header,
*err = WTAP_ERR_SHORT_READ;
return FALSE;
}
- pseudo_header->erf.subhdr.eth_hdr = pntohs(&erf_subhdr[0]);
+ pseudo_header->erf.subhdr.eth_hdr = pntoh16(&erf_subhdr[0]);
*psize = sizeof(erf_eth_header_t);
break;
default:
@@ -1499,7 +1499,7 @@ pcap_read_i2c_pseudoheader(FILE_T fh, union wtap_pseudo_header *pseudo_header, i
pseudo_header->i2c.is_event = i2c_hdr.bus & 0x80 ? 1 : 0;
pseudo_header->i2c.bus = i2c_hdr.bus & 0x7f;
- pseudo_header->i2c.flags = pntohl(&i2c_hdr.flags);
+ pseudo_header->i2c.flags = pntoh32(&i2c_hdr.flags);
return TRUE;
}
diff --git a/wiretap/peekclassic.c b/wiretap/peekclassic.c
index f516775d47..6873953ec4 100644
--- a/wiretap/peekclassic.c
+++ b/wiretap/peekclassic.c
@@ -436,15 +436,15 @@ static int peekclassic_read_packet_v7(wtap *wth, FILE_T fh,
/* Extract the fields from the packet */
#if 0
- protoNum = pntohs(&ep_pkt[PEEKCLASSIC_V7_PROTONUM_OFFSET]);
+ protoNum = pntoh16(&ep_pkt[PEEKCLASSIC_V7_PROTONUM_OFFSET]);
#endif
- length = pntohs(&ep_pkt[PEEKCLASSIC_V7_LENGTH_OFFSET]);
- sliceLength = pntohs(&ep_pkt[PEEKCLASSIC_V7_SLICE_LENGTH_OFFSET]);
+ length = pntoh16(&ep_pkt[PEEKCLASSIC_V7_LENGTH_OFFSET]);
+ sliceLength = pntoh16(&ep_pkt[PEEKCLASSIC_V7_SLICE_LENGTH_OFFSET]);
#if 0
flags = ep_pkt[PEEKCLASSIC_V7_FLAGS_OFFSET];
#endif
status = ep_pkt[PEEKCLASSIC_V7_STATUS_OFFSET];
- timestamp = pntohll(&ep_pkt[PEEKCLASSIC_V7_TIMESTAMP_OFFSET]);
+ timestamp = pntoh64(&ep_pkt[PEEKCLASSIC_V7_TIMESTAMP_OFFSET]);
/* force sliceLength to be the actual length of the packet */
if (0 == sliceLength) {
@@ -558,18 +558,18 @@ static gboolean peekclassic_read_packet_v56(wtap *wth, FILE_T fh,
err_info);
/* Extract the fields from the packet */
- length = pntohs(&ep_pkt[PEEKCLASSIC_V56_LENGTH_OFFSET]);
- sliceLength = pntohs(&ep_pkt[PEEKCLASSIC_V56_SLICE_LENGTH_OFFSET]);
+ length = pntoh16(&ep_pkt[PEEKCLASSIC_V56_LENGTH_OFFSET]);
+ sliceLength = pntoh16(&ep_pkt[PEEKCLASSIC_V56_SLICE_LENGTH_OFFSET]);
#if 0
flags = ep_pkt[PEEKCLASSIC_V56_FLAGS_OFFSET];
status = ep_pkt[PEEKCLASSIC_V56_STATUS_OFFSET];
#endif
- timestamp = pntohl(&ep_pkt[PEEKCLASSIC_V56_TIMESTAMP_OFFSET]);
+ timestamp = pntoh32(&ep_pkt[PEEKCLASSIC_V56_TIMESTAMP_OFFSET]);
#if 0
- destNum = pntohs(&ep_pkt[PEEKCLASSIC_V56_DESTNUM_OFFSET]);
- srcNum = pntohs(&ep_pkt[PEEKCLASSIC_V56_SRCNUM_OFFSET]);
+ destNum = pntoh16(&ep_pkt[PEEKCLASSIC_V56_DESTNUM_OFFSET]);
+ srcNum = pntoh16(&ep_pkt[PEEKCLASSIC_V56_SRCNUM_OFFSET]);
#endif
- protoNum = pntohs(&ep_pkt[PEEKCLASSIC_V56_PROTONUM_OFFSET]);
+ protoNum = pntoh16(&ep_pkt[PEEKCLASSIC_V56_PROTONUM_OFFSET]);
#if 0
memcpy(protoStr, &ep_pkt[PEEKCLASSIC_V56_PROTOSTR_OFFSET],
sizeof protoStr);
diff --git a/wiretap/peektagged.c b/wiretap/peektagged.c
index d61925191f..b04a230ea3 100644
--- a/wiretap/peektagged.c
+++ b/wiretap/peektagged.c
@@ -426,7 +426,7 @@ peektagged_read_packet(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
return -1;
}
header_len += (int) sizeof(tag_value);
- tag = pletohs(&tag_value[0]);
+ tag = pletoh16(&tag_value[0]);
switch (tag) {
case TAG_PEEKTAGGED_LENGTH:
@@ -435,7 +435,7 @@ peektagged_read_packet(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
*err_info = g_strdup("peektagged: record has two length fields");
return -1;
}
- hdr_info.length = pletohl(&tag_value[2]);
+ hdr_info.length = pletoh32(&tag_value[2]);
saw_length = TRUE;
break;
@@ -445,7 +445,7 @@ peektagged_read_packet(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
*err_info = g_strdup("peektagged: record has two timestamp-lower fields");
return -1;
}
- hdr_info.timestamp.lower = pletohl(&tag_value[2]);
+ hdr_info.timestamp.lower = pletoh32(&tag_value[2]);
saw_timestamp_lower = TRUE;
break;
@@ -455,7 +455,7 @@ peektagged_read_packet(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
*err_info = g_strdup("peektagged: record has two timestamp-upper fields");
return -1;
}
- hdr_info.timestamp.upper = pletohl(&tag_value[2]);
+ hdr_info.timestamp.upper = pletoh32(&tag_value[2]);
saw_timestamp_upper = TRUE;
break;
@@ -464,15 +464,15 @@ peektagged_read_packet(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
break;
case TAG_PEEKTAGGED_CHANNEL:
- hdr_info.ieee_802_11.channel = pletohl(&tag_value[2]);
+ hdr_info.ieee_802_11.channel = pletoh32(&tag_value[2]);
break;
case TAG_PEEKTAGGED_RATE:
- hdr_info.ieee_802_11.data_rate = pletohl(&tag_value[2]);
+ hdr_info.ieee_802_11.data_rate = pletoh32(&tag_value[2]);
break;
case TAG_PEEKTAGGED_SIGNAL_PERC:
- hdr_info.ieee_802_11.signal_level = pletohl(&tag_value[2]);
+ hdr_info.ieee_802_11.signal_level = pletoh32(&tag_value[2]);
break;
case TAG_PEEKTAGGED_SIGNAL_DBM:
@@ -492,7 +492,7 @@ peektagged_read_packet(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
break;
case TAG_PEEKTAGGED_SLICE_LENGTH:
- hdr_info.sliceLength = pletohl(&tag_value[2]);
+ hdr_info.sliceLength = pletoh32(&tag_value[2]);
break;
default:
diff --git a/wiretap/pppdump.c b/wiretap/pppdump.c
index cc82c09485..1338d7eb8f 100644
--- a/wiretap/pppdump.c
+++ b/wiretap/pppdump.c
@@ -288,7 +288,7 @@ pppdump_open(wtap *wth, int *err, gchar **err_info)
state = (pppdump_t *)g_malloc(sizeof(pppdump_t));
wth->priv = (void *)state;
- state->timestamp = pntohl(&buffer[1]);
+ state->timestamp = pntoh32(&buffer[1]);
state->tenths = 0;
init_state(state);
@@ -663,14 +663,14 @@ collate(pppdump_t* state, FILE_T fh, int *err, gchar **err_info, guint8 *pd,
case PPPD_RESET_TIME:
wtap_file_read_unknown_bytes(&time_long, sizeof(guint32), fh, err, err_info);
state->offset += sizeof(guint32);
- state->timestamp = pntohl(&time_long);
+ state->timestamp = pntoh32(&time_long);
state->tenths = 0;
break;
case PPPD_TIME_STEP_LONG:
wtap_file_read_unknown_bytes(&time_long, sizeof(guint32), fh, err, err_info);
state->offset += sizeof(guint32);
- state->tenths += pntohl(&time_long);
+ state->tenths += pntoh32(&time_long);
if (state->tenths >= 10) {
state->timestamp += state->tenths / 10;
diff --git a/wiretap/radcom.c b/wiretap/radcom.c
index 8efcb91efc..d462bbd992 100644
--- a/wiretap/radcom.c
+++ b/wiretap/radcom.c
@@ -170,10 +170,10 @@ int radcom_open(wtap *wth, int *err, gchar **err_info)
wth->tsprecision = WTAP_FILE_TSPREC_USEC;
#if 0
- tm.tm_year = pletohs(&start_date.year)-1900;
+ tm.tm_year = pletoh16(&start_date.year)-1900;
tm.tm_mon = start_date.month-1;
tm.tm_mday = start_date.day;
- sec = pletohl(&start_date.sec);
+ sec = pletoh32(&start_date.sec);
tm.tm_hour = sec/3600;
tm.tm_min = (sec%3600)/60;
tm.tm_sec = sec%60;
@@ -329,7 +329,7 @@ radcom_read_rec(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
return FALSE;
}
- data_length = pletohs(&hdr.data_length);
+ data_length = pletoh16(&hdr.data_length);
if (data_length == 0) {
/*
* The last record appears to have 0 in its "data_length"
@@ -339,21 +339,21 @@ radcom_read_rec(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
*err = 0;
return FALSE;
}
- length = pletohs(&hdr.length);
- real_length = pletohs(&hdr.real_length);
+ length = pletoh16(&hdr.length);
+ real_length = pletoh16(&hdr.real_length);
phdr->presence_flags = WTAP_HAS_TS|WTAP_HAS_CAP_LEN;
- tm.tm_year = pletohs(&hdr.date.year)-1900;
+ tm.tm_year = pletoh16(&hdr.date.year)-1900;
tm.tm_mon = (hdr.date.month&0x0f)-1;
tm.tm_mday = hdr.date.day;
- sec = pletohl(&hdr.date.sec);
+ sec = pletoh32(&hdr.date.sec);
tm.tm_hour = sec/3600;
tm.tm_min = (sec%3600)/60;
tm.tm_sec = sec%60;
tm.tm_isdst = -1;
phdr->ts.secs = mktime(&tm);
- phdr->ts.nsecs = pletohl(&hdr.date.usec) * 1000;
+ phdr->ts.nsecs = pletoh32(&hdr.date.usec) * 1000;
switch (wth->file_encap) {
diff --git a/wiretap/snoop.c b/wiretap/snoop.c
index ccde4f57c4..558690b9f1 100644
--- a/wiretap/snoop.c
+++ b/wiretap/snoop.c
@@ -684,7 +684,7 @@ snoop_read_atm_pseudoheader(FILE_T fh, union wtap_pseudo_header *pseudo_header,
}
vpi = atm_phdr.vpi;
- vci = pntohs(&atm_phdr.vci);
+ vci = pntoh16(&atm_phdr.vci);
/*
* The lower 4 bits of the first byte of the header indicate
diff --git a/wiretap/stanag4607.c b/wiretap/stanag4607.c
index df521ebacb..ed02bd5bea 100644
--- a/wiretap/stanag4607.c
+++ b/wiretap/stanag4607.c
@@ -68,14 +68,14 @@ static gboolean stanag4607_read_file(wtap *wth, FILE_T fh, struct wtap_pkthdr *p
goto fail;
offset += bytes_read;
- if (!is_valid_id(pntohs(&stanag_pkt_hdr[0]))) {
+ if (!is_valid_id(pntoh16(&stanag_pkt_hdr[0]))) {
*err = WTAP_ERR_BAD_FILE;
*err_info = g_strdup("Bad version number");
return FALSE;
}
/* The next 4 bytes are the packet length */
- packet_size = pntohl(&stanag_pkt_hdr[2]);
+ packet_size = pntoh32(&stanag_pkt_hdr[2]);
phdr->caplen = packet_size;
phdr->len = packet_size;
@@ -101,7 +101,7 @@ static gboolean stanag4607_read_file(wtap *wth, FILE_T fh, struct wtap_pkthdr *p
goto fail;
offset += bytes_read;
- tm.tm_year = pntohs(&mseg[35]) - 1900;
+ tm.tm_year = pntoh16(&mseg[35]) - 1900;
tm.tm_mon = mseg[37] - 1;
tm.tm_mday = mseg[38];
tm.tm_hour = 0;
@@ -124,7 +124,7 @@ static gboolean stanag4607_read_file(wtap *wth, FILE_T fh, struct wtap_pkthdr *p
if (bytes_read != sizeof dseg)
goto fail;
offset += bytes_read;
- millisecs = pntohl(&dseg[15]);
+ millisecs = pntoh32(&dseg[15]);
}
if (0 != millisecs) {
secs = millisecs/1000;
diff --git a/wiretap/visual.c b/wiretap/visual.c
index af47c9925b..8c70495f9c 100644
--- a/wiretap/visual.c
+++ b/wiretap/visual.c
@@ -209,7 +209,7 @@ int visual_open(wtap *wth, int *err, gchar **err_info)
}
/* Verify the file version is known */
- vfile_hdr.file_version = pletohs(&vfile_hdr.file_version);
+ vfile_hdr.file_version = pletoh16(&vfile_hdr.file_version);
if (vfile_hdr.file_version != 1)
{
*err = WTAP_ERR_UNSUPPORTED;
@@ -225,7 +225,7 @@ int visual_open(wtap *wth, int *err, gchar **err_info)
the first packet is read.
XXX - should we use WTAP_ENCAP_PER_PACKET for that? */
- switch (pletohs(&vfile_hdr.media_type))
+ switch (pletoh16(&vfile_hdr.media_type))
{
case 6: /* ethernet-csmacd */
encap = WTAP_ENCAP_ETHERNET;
@@ -262,7 +262,7 @@ int visual_open(wtap *wth, int *err, gchar **err_info)
/* Fill in the wiretap struct with data from the file header */
wth->file_type_subtype = WTAP_FILE_TYPE_SUBTYPE_VISUAL_NETWORKS;
wth->file_encap = encap;
- wth->snapshot_length = pletohs(&vfile_hdr.max_length);
+ wth->snapshot_length = pletoh16(&vfile_hdr.max_length);
/* Set up the pointers to the handlers for this file type */
wth->subtype_read = visual_read;
@@ -272,8 +272,8 @@ int visual_open(wtap *wth, int *err, gchar **err_info)
/* Add Visual-specific information to the wiretap struct for later use. */
visual = (struct visual_read_info *)g_malloc(sizeof(struct visual_read_info));
wth->priv = (void *)visual;
- visual->num_pkts = pletohl(&vfile_hdr.num_pkts);
- visual->start_time = ((double) pletohl(&vfile_hdr.start_time)) * 1000000;
+ visual->num_pkts = pletoh32(&vfile_hdr.num_pkts);
+ visual->start_time = ((double) pletoh32(&vfile_hdr.start_time)) * 1000000;
visual->current_pkt = 1;
return 1;
@@ -352,21 +352,21 @@ visual_read_packet(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
}
/* Get the included length of data. This includes extra headers + payload */
- packet_size = pletohs(&vpkt_hdr.incl_len);
+ packet_size = pletoh16(&vpkt_hdr.incl_len);
phdr->presence_flags = WTAP_HAS_TS|WTAP_HAS_CAP_LEN;
/* Set the packet time and length. */
t = visual->start_time;
- t += ((double)pletohl(&vpkt_hdr.ts_delta))*1000;
+ t += ((double)pletoh32(&vpkt_hdr.ts_delta))*1000;
secs = (time_t)(t/1000000);
usecs = (guint32)(t - secs*1000000);
phdr->ts.secs = secs;
phdr->ts.nsecs = usecs * 1000;
- phdr->len = pletohs(&vpkt_hdr.orig_len);
+ phdr->len = pletoh16(&vpkt_hdr.orig_len);
- packet_status = pletohl(&vpkt_hdr.status);
+ packet_status = pletoh32(&vpkt_hdr.status);
/* Do encapsulation-specific processing.
@@ -511,7 +511,7 @@ visual_read_packet(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
case VN_AAL5:
phdr->pseudo_header.atm.aal = AAL_5;
phdr->pseudo_header.atm.type = TRAF_LLCMX;
- phdr->pseudo_header.atm.aal5t_len = pntohl(&vatm_hdr.data_length);
+ phdr->pseudo_header.atm.aal5t_len = pntoh32(&vatm_hdr.data_length);
break;
case VN_OAM:
@@ -527,9 +527,9 @@ visual_read_packet(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
phdr->pseudo_header.atm.aal = AAL_UNKNOWN;
break;
}
- phdr->pseudo_header.atm.vpi = pntohs(&vatm_hdr.vpi) & 0x0FFF;
- phdr->pseudo_header.atm.vci = pntohs(&vatm_hdr.vci);
- phdr->pseudo_header.atm.cells = pntohs(&vatm_hdr.cell_count);
+ phdr->pseudo_header.atm.vpi = pntoh16(&vatm_hdr.vpi) & 0x0FFF;
+ phdr->pseudo_header.atm.vci = pntoh16(&vatm_hdr.vci);
+ phdr->pseudo_header.atm.cells = pntoh16(&vatm_hdr.cell_count);
/* Using bit value of 1 (DCE -> DTE) to indicate From Network */
phdr->pseudo_header.atm.channel = vatm_hdr.info & FROM_NETWORK;
diff --git a/wiretap/vwr.c b/wiretap/vwr.c
index 32b149d808..dcb99b9b65 100644
--- a/wiretap/vwr.c
+++ b/wiretap/vwr.c
@@ -864,12 +864,12 @@ static int vwr_get_fpga_version(wtap *wth, int *err, gchar **err_info)
s_510006_ptr = &(rec[rec_size - v22_W_STATS_LEN]); /* point to 510006 WLAN */
/* stats block */
- data_length = pntohs(&s_510006_ptr[v22_W_OCTET_OFF]);
+ data_length = pntoh16(&s_510006_ptr[v22_W_OCTET_OFF]);
i = 0;
while (((data_length + i) % 4) != 0)
i = i + 1;
- frame_type = pntohl(&s_510006_ptr[v22_W_FRAME_TYPE_OFF]);
+ frame_type = pntoh32(&s_510006_ptr[v22_W_FRAME_TYPE_OFF]);
if (rec_size == (data_length + v22_W_STATS_LEN + i) && (frame_type & v22_W_IS_80211) == 0x1000000) {
fpga_version = S1_W_FPGA;
@@ -880,7 +880,7 @@ static int vwr_get_fpga_version(wtap *wth, int *err, gchar **err_info)
if ((rec_size > v22_E_STATS_LEN) && (fpga_version == 1000)) {
s_510012_ptr = &(rec[rec_size - v22_E_STATS_LEN]); /* point to 510012 enet */
/* stats block */
- data_length = pntohs(&s_510012_ptr[v22_E_OCTET_OFF]);
+ data_length = pntoh16(&s_510012_ptr[v22_E_OCTET_OFF]);
i = 0;
while (((data_length + i) % 4) != 0)
i = i + 1;
@@ -908,7 +908,7 @@ static int vwr_get_fpga_version(wtap *wth, int *err, gchar **err_info)
/* Finally the Series II Ethernet */
if ((rec_size > vVW510024_E_STATS_LEN) && (fpga_version == 1000)) {
s_510024_ptr = &(rec[rec_size - vVW510024_E_STATS_LEN]); /* point to 510024 ENET */
- data_length = pntohs(&s_510024_ptr[vVW510024_E_MSDU_LENGTH_OFF]);
+ data_length = pntoh16(&s_510024_ptr[vVW510024_E_MSDU_LENGTH_OFF]);
i = 0;
while (((data_length + i) % 4) != 0)
@@ -1081,8 +1081,8 @@ static int parse_s1_W_stats(wtap *wth, guint8 *rec, int rec_size, ext_rtap_field
s_ptr = &(rec[rec_size - 64]); /* point to it */
m_type = s_ptr[1] & 0x7;
f_tx = !(s_ptr[1] & 0x8);
- octets = pntohs(&s_ptr[8]);
- vc_id = pntohs(&s_ptr[2]) & 0x3ff;
+ octets = pntoh16(&s_ptr[8]);
+ vc_id = pntoh16(&s_ptr[2]) & 0x3ff;
flow_seq = s_ptr[4];
/* XXX - this is 48 bits, in a weird byte order */
@@ -1090,10 +1090,10 @@ static int parse_s1_W_stats(wtap *wth, guint8 *rec, int rec_size, ext_rtap_field
for (i = 0; i < 4; i++)
latency = (latency << 8) | s_ptr[40 + i];
- flow_id = pntohs(&s_ptr[6]); /* only 16 LSBs kept */
- errors = pntohs(&s_ptr[10]);
+ flow_id = pntoh16(&s_ptr[6]); /* only 16 LSBs kept */
+ errors = pntoh16(&s_ptr[10]);
- info = pntohs(&s_ptr[54]);
+ info = pntoh16(&s_ptr[54]);
rssi = (s_ptr[21] & 0x80) ? (-1 * (s_ptr[21] & 0x7f)) : s_ptr[21];
/* Decode OFDM or CCK PLCP header and determine rate and short preamble flag. */
@@ -1268,7 +1268,7 @@ static int parse_s2_W_stats(wtap *wth, guint8 *rec, int rec_size, ext_rtap_field
msdu_length = ((s_start_ptr[4] & 0x1f) << 8) + s_start_ptr[3];
actual_octets = msdu_length;
- vc_id = pntohs(&s_start_ptr[6]);
+ vc_id = pntoh16(&s_start_ptr[6]);
if (IS_TX)
{
rssi[0] = (s_start_ptr[2] & 0x80) ? -1 * (s_start_ptr[2] & 0x7f) : s_start_ptr[2] & 0x7f;
@@ -1299,7 +1299,7 @@ static int parse_s2_W_stats(wtap *wth, guint8 *rec, int rec_size, ext_rtap_field
}
msdu_length = pntoh24(&s_start_ptr[9]);
actual_octets = msdu_length;
- vc_id = pntohs(&s_start_ptr[14]) & 0x3ff;
+ vc_id = pntoh16(&s_start_ptr[14]) & 0x3ff;
for (i = 0; i < 4; i++)
{
if (IS_TX)
@@ -1327,11 +1327,11 @@ static int parse_s2_W_stats(wtap *wth, guint8 *rec, int rec_size, ext_rtap_field
for (i = 0; i < 4; i++)
tsid = (tsid << 8) | s_trail_ptr[36 + i];
- errors = pntohl(&s_trail_ptr[16]);
- info = pntohs(&s_trail_ptr[22]);
+ errors = pntoh32(&s_trail_ptr[16]);
+ info = pntoh16(&s_trail_ptr[22]);
if ((info & 0xFC00) != 0)
/* this length includes the Start_Spacing + Delimiter + MPDU + Padding for each piece of the aggregate*/
- ht_len = pletohs(&s_start_ptr[vwr->PLCP_LENGTH_OFF]);
+ ht_len = pletoh16(&s_start_ptr[vwr->PLCP_LENGTH_OFF]);
/* decode OFDM or CCK PLCP header and determine rate and short preamble flag */
@@ -1527,7 +1527,7 @@ static void vwr_read_rec_data_ethernet(wtap *wth, guint8 *data_ptr, guint8 *rec,
m_ptr = &(rec[0]); /* point to the data block */
s_ptr = &(rec[rec_size - vwr->STATS_LEN]); /* point to the stats block */
- msdu_length = pntohs(&s_ptr[vwr->OCTET_OFF]);
+ msdu_length = pntoh16(&s_ptr[vwr->OCTET_OFF]);
actual_octets = msdu_length;
/* Sanity check the msdu_length field to determine if it is OK (or segfaults result). */
/* If it's greater, then truncate to the indicated message length. */
@@ -1535,18 +1535,18 @@ static void vwr_read_rec_data_ethernet(wtap *wth, guint8 *data_ptr, guint8 *rec,
msdu_length = (rec_size - (int)vwr->STATS_LEN);
}
- vc_id = pntohs(&s_ptr[vwr->VCID_OFF]) & vwr->VCID_MASK;
+ vc_id = pntoh16(&s_ptr[vwr->VCID_OFF]) & vwr->VCID_MASK;
flow_seq = s_ptr[vwr->FLOWSEQ_OFF];
- frame_type = pntohl(&s_ptr[vwr->FRAME_TYPE_OFF]);
+ frame_type = pntoh32(&s_ptr[vwr->FRAME_TYPE_OFF]);
if (vwr->FPGA_VERSION == vVW510024_E_FPGA) {
- validityBits = pntohs(&s_ptr[vwr->VALID_OFF]);
+ validityBits = pntoh16(&s_ptr[vwr->VALID_OFF]);
f_flow = validityBits & vwr->FLOW_VALID;
mac_len = (validityBits & vwr->IS_VLAN) ? 16 : 14; /* MAC hdr length based on VLAN tag */
- errors = pntohs(&s_ptr[vwr->ERRORS_OFF]);
+ errors = pntoh16(&s_ptr[vwr->ERRORS_OFF]);
}
else {
f_flow = s_ptr[vwr->VALID_OFF] & vwr->FLOW_VALID;
@@ -1554,10 +1554,10 @@ static void vwr_read_rec_data_ethernet(wtap *wth, guint8 *data_ptr, guint8 *rec,
/* for older fpga errors is only represented by 16 bits) */
- errors = pntohs(&s_ptr[vwr->ERRORS_OFF]);
+ errors = pntoh16(&s_ptr[vwr->ERRORS_OFF]);
}
- info = pntohs(&s_ptr[vwr->INFO_OFF]);
+ info = pntoh16(&s_ptr[vwr->INFO_OFF]);
/* 24 LSBs */
flow_id = pntoh24(&s_ptr[vwr->FLOWID_OFF]);
@@ -1568,7 +1568,7 @@ static void vwr_read_rec_data_ethernet(wtap *wth, guint8 *data_ptr, guint8 *rec,
tsid = (tsid << 8) | s_ptr[vwr->LATVAL_OFF + i];
- l4id = pntohs(&s_ptr[vwr->L4ID_OFF]);
+ l4id = pntoh16(&s_ptr[vwr->L4ID_OFF]);
/* Calculate start & end times (in sec/usec), converting 64-bit times to usec. */
/* 64-bit times are "Corey-endian" */
@@ -1735,8 +1735,8 @@ static int decode_msg(vwr_t *vwr, guint8 *rec, int *v_type, int *IS_TX)
/* break up the message record into its pieces */
cmd = rec[0];
- wd2 = pntohl(&rec[8]);
- wd3 = pntohl(&rec[12]);
+ wd2 = pntoh32(&rec[8]);
+ wd3 = pntoh32(&rec[12]);
if (vwr != NULL) {
if ((cmd & vwr->HEADER_IS_TX) == vwr->HEADER_IS_TX)
@@ -2099,7 +2099,7 @@ guint64 get_signature_ts(guint8 *m_ptr,int sig_off)
else
ts_offset = 8;
- sig_ts = pletohl(&m_ptr[sig_off + ts_offset]);
+ sig_ts = pletoh32(&m_ptr[sig_off + ts_offset]);
return (sig_ts & 0xffffffff);
}
diff --git a/wiretap/wtap-int.h b/wiretap/wtap-int.h
index c0206eb6db..5804e3c90e 100644
--- a/wiretap/wtap-int.h
+++ b/wiretap/wtap-int.h
@@ -121,6 +121,8 @@ gint64 wtap_dump_file_tell(wtap_dumper *wdh, int *err);
extern gint wtap_num_file_types;
+#include <wsutil/pint.h>
+
/* Macros to byte-swap possibly-unaligned 64-bit, 32-bit and 16-bit quantities;
* they take a pointer to the quantity, and byte-swap it in place.
*/
@@ -158,77 +160,6 @@ extern gint wtap_num_file_types;
(p)[0] = tmp; \
}
-/* Pointer versions of ntohs and ntohl. Given a pointer to a member of a
- * byte array, returns the value of the two or four bytes at the pointer.
- * The pletoh[sl] versions return the little-endian representation.
- * We also provide pntohll and pletohll, which extract 64-bit integral
- * quantities.
- *
- * These will work regardless of the byte alignment of the pointer.
- */
-
-#ifndef pntohs
-#define pntohs(p) ((guint16) \
- ((guint16)*((const guint8 *)(p)+0)<<8| \
- (guint16)*((const guint8 *)(p)+1)<<0))
-#endif
-
-#ifndef pntoh24
-#define pntoh24(p) ((guint32)*((const guint8 *)(p)+0)<<16| \
- (guint32)*((const guint8 *)(p)+1)<<8| \
- (guint32)*((const guint8 *)(p)+2)<<0)
-#endif
-
-#ifndef pntohl
-#define pntohl(p) ((guint32)*((const guint8 *)(p)+0)<<24| \
- (guint32)*((const guint8 *)(p)+1)<<16| \
- (guint32)*((const guint8 *)(p)+2)<<8| \
- (guint32)*((const guint8 *)(p)+3)<<0)
-#endif
-
-#ifndef pntohll
-#define pntohll(p) ((guint64)*((const guint8 *)(p)+0)<<56| \
- (guint64)*((const guint8 *)(p)+1)<<48| \
- (guint64)*((const guint8 *)(p)+2)<<40| \
- (guint64)*((const guint8 *)(p)+3)<<32| \
- (guint64)*((const guint8 *)(p)+4)<<24| \
- (guint64)*((const guint8 *)(p)+5)<<16| \
- (guint64)*((const guint8 *)(p)+6)<<8| \
- (guint64)*((const guint8 *)(p)+7)<<0)
-#endif
-
-
-#ifndef pletohs
-#define pletohs(p) ((guint16) \
- ((guint16)*((const guint8 *)(p)+1)<<8| \
- (guint16)*((const guint8 *)(p)+0)<<0))
-#endif
-
-#ifndef pletoh24
-#define pletoh24(p) ((guint32)*((const guint8 *)(p)+2)<<16| \
- (guint32)*((const guint8 *)(p)+1)<<8| \
- (guint32)*((const guint8 *)(p)+0)<<0)
-#endif
-
-
-#ifndef pletohl
-#define pletohl(p) ((guint32)*((const guint8 *)(p)+3)<<24| \
- (guint32)*((const guint8 *)(p)+2)<<16| \
- (guint32)*((const guint8 *)(p)+1)<<8| \
- (guint32)*((const guint8 *)(p)+0)<<0)
-#endif
-
-
-#ifndef pletohll
-#define pletohll(p) ((guint64)*((const guint8 *)(p)+7)<<56| \
- (guint64)*((const guint8 *)(p)+6)<<48| \
- (guint64)*((const guint8 *)(p)+5)<<40| \
- (guint64)*((const guint8 *)(p)+4)<<32| \
- (guint64)*((const guint8 *)(p)+3)<<24| \
- (guint64)*((const guint8 *)(p)+2)<<16| \
- (guint64)*((const guint8 *)(p)+1)<<8| \
- (guint64)*((const guint8 *)(p)+0)<<0)
-#endif
/* Pointer routines to put items out in a particular byte order.
* These will work regardless of the byte alignment of the pointer.