forked from osmocom/wireshark
Rename some of pint.h macros to match common style (bits number on the end).
pntohs -> pntoh16 pntohl -> pntoh32 pletohs -> pletoh16 pletohl -> pletoh32 phtons -> phton16 phtonl -> phton32 svn path=/trunk/; revision=53652
This commit is contained in:
parent
288efa5128
commit
5ac6474c94
|
@ -790,7 +790,7 @@ if (h245_pi != NULL)
|
|||
gefx = gef_ctx_get(actx->private_data);
|
||||
if (gefx) {
|
||||
buf = (guint8 *)wmem_new(actx->pinfo->pool, guint16);
|
||||
phtons(buf, value);
|
||||
phton16(buf, value);
|
||||
value_tvb = tvb_new_child_real_data(tvb, buf, sizeof(guint16), sizeof(guint16));
|
||||
/* DEBUG */ /*proto_tree_add_text(tree, tvb, offset>>3, 0, "*** DEBUG dissector_try_string: %%s", gefx->key);*/
|
||||
add_new_data_source(%(ACTX)s->pinfo, value_tvb, "unsignedMin");
|
||||
|
@ -807,7 +807,7 @@ if (h245_pi != NULL)
|
|||
gefx = gef_ctx_get(actx->private_data);
|
||||
if (gefx) {
|
||||
buf = (guint8 *)wmem_new(actx->pinfo->pool, guint16);
|
||||
phtons(buf, value);
|
||||
phton16(buf, value);
|
||||
value_tvb = tvb_new_child_real_data(tvb, buf, sizeof(guint16), sizeof(guint16));
|
||||
/* DEBUG */ /*proto_tree_add_text(tree, tvb, offset>>3, 0, "*** DEBUG dissector_try_string: %%s", gefx->key);*/
|
||||
add_new_data_source(%(ACTX)s->pinfo, value_tvb, "unsignedMax");
|
||||
|
@ -824,7 +824,7 @@ if (h245_pi != NULL)
|
|||
gefx = gef_ctx_get(actx->private_data);
|
||||
if (gefx) {
|
||||
buf = (guint8 *)wmem_new(actx->pinfo->pool, guint32);
|
||||
phtonl(buf, value);
|
||||
phton32(buf, value);
|
||||
value_tvb = tvb_new_child_real_data(tvb, buf, sizeof(guint32), sizeof(guint32));
|
||||
/* DEBUG */ /*proto_tree_add_text(tree, tvb, offset>>3, 0, "*** DEBUG dissector_try_string: %%s", gefx->key);*/
|
||||
add_new_data_source(%(ACTX)s->pinfo, value_tvb, "unsigned32Min");
|
||||
|
@ -841,7 +841,7 @@ if (h245_pi != NULL)
|
|||
gefx = gef_ctx_get(actx->private_data);
|
||||
if (gefx) {
|
||||
buf = (guint8 *)wmem_new(actx->pinfo->pool, guint32);
|
||||
phtonl(buf, value);
|
||||
phton32(buf, value);
|
||||
value_tvb = tvb_new_child_real_data(tvb, buf, sizeof(guint32), sizeof(guint32));
|
||||
/* DEBUG */ /*proto_tree_add_text(tree, tvb, offset>>3, 0, "*** DEBUG dissector_try_string: %%s", gefx->key);*/
|
||||
add_new_data_source(%(ACTX)s->pinfo, value_tvb, "unsigned32Max");
|
||||
|
|
|
@ -2475,8 +2475,8 @@ upon the conversation index and values inside the request packets.
|
|||
conversation = find_or_create_conversation(pinfo);
|
||||
|
||||
request_key.conversation = conversation->index;
|
||||
request_key.service = pntohs(&rxh->serviceId);
|
||||
request_key.callnumber = pntohl(&rxh->callNumber);
|
||||
request_key.service = pntoh16(&rxh->serviceId);
|
||||
request_key.callnumber = pntoh32(&rxh->callNumber);
|
||||
|
||||
request_val = (struct afs_request_val *)g_hash_table_lookup(
|
||||
afs_request_hash, &request_key);
|
||||
|
@ -2489,7 +2489,7 @@ upon the conversation index and values inside the request packets.
|
|||
*new_request_key = request_key;
|
||||
|
||||
request_val = wmem_alloc(wmem_file_scope(), sizeof(struct afs_request_val));
|
||||
request_val -> opcode = pntohl(&afsh->opcode);
|
||||
request_val -> opcode = pntoh32(&afsh->opcode);
|
||||
opcode = request_val->opcode;
|
||||
|
||||
g_hash_table_insert(afs_request_hash, new_request_key,
|
||||
|
|
|
@ -275,7 +275,7 @@ ipx_addr_to_str(const guint32 net, const guint8 *ad)
|
|||
gchar*
|
||||
ipxnet_to_string(const guint8 *ad)
|
||||
{
|
||||
guint32 addr = pntohl(ad);
|
||||
guint32 addr = pntoh32(ad);
|
||||
return ipxnet_to_str_punct(addr, ' ');
|
||||
}
|
||||
|
||||
|
@ -296,9 +296,9 @@ vines_addr_to_str_buf(const guint8 *addrp, gchar *buf, int buf_len)
|
|||
return;
|
||||
}
|
||||
|
||||
buf = dword_to_hex(buf, pntohl(&addrp[0])); /* 8 bytes */
|
||||
buf = dword_to_hex(buf, pntoh32(&addrp[0])); /* 8 bytes */
|
||||
*buf++ = '.'; /* 1 byte */
|
||||
buf = word_to_hex(buf, pntohs(&addrp[4])); /* 4 bytes */
|
||||
buf = word_to_hex(buf, pntoh16(&addrp[4])); /* 4 bytes */
|
||||
*buf = '\0'; /* 1 byte */
|
||||
}
|
||||
|
||||
|
@ -347,10 +347,10 @@ tvb_eui64_to_str(tvbuff_t *tvb, const gint offset, const guint encoding)
|
|||
static void
|
||||
usb_addr_to_str_buf(const guint8 *addrp, gchar *buf, int buf_len)
|
||||
{
|
||||
if(pletohl(&addrp[0])==0xffffffff){
|
||||
if(pletoh32(&addrp[0])==0xffffffff){
|
||||
g_snprintf(buf, buf_len, "host");
|
||||
} else {
|
||||
g_snprintf(buf, buf_len, "%d.%d", pletohl(&addrp[0]), pletohl(&addrp[4]));
|
||||
g_snprintf(buf, buf_len, "%d.%d", pletoh32(&addrp[0]), pletoh32(&addrp[4]));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -621,7 +621,7 @@ address_to_str_buf(const address *addr, gchar *buf, int buf_len)
|
|||
(addrdata[6] >> 1) & 0x0f );
|
||||
break;
|
||||
case AT_IEEE_802_15_4_SHORT:
|
||||
ieee_802_15_4_short_addr = pletohs(addr->data);
|
||||
ieee_802_15_4_short_addr = pletoh16(addr->data);
|
||||
if (ieee_802_15_4_short_addr == 0xffff)
|
||||
g_snprintf(buf, buf_len, "Broadcast");
|
||||
else
|
||||
|
|
|
@ -350,10 +350,10 @@ AirPDcapDecryptWPABroadcastKey(const EAPOL_RSN_KEY *pEAPKey, guint8 *decryption
|
|||
key_version = AIRPDCAP_EAP_KEY_DESCR_VER(pEAPKey->key_information[1]);
|
||||
if (key_version == AIRPDCAP_WPA_KEY_VER_NOT_CCMP){
|
||||
/* TKIP */
|
||||
key_len = pntohs(pEAPKey->key_length);
|
||||
key_len = pntoh16(pEAPKey->key_length);
|
||||
}else if (key_version == AIRPDCAP_WPA_KEY_VER_AES_CCMP){
|
||||
/* AES */
|
||||
key_len = pntohs(pEAPKey->key_data_len);
|
||||
key_len = pntoh16(pEAPKey->key_data_len);
|
||||
}
|
||||
if (key_len > sizeof(RSN_IE) || key_len == 0) { /* Don't read past the end of pEAPKey->ie */
|
||||
return;
|
||||
|
@ -512,7 +512,7 @@ static INT AirPDcapScanForGroupKey(
|
|||
}
|
||||
|
||||
/* get and check the body length (IEEE 802.1X-2004, pg. 25) */
|
||||
bodyLength=pntohs(data+offset+2);
|
||||
bodyLength=pntoh16(data+offset+2);
|
||||
if ((tot_len-offset-4) < bodyLength) {
|
||||
AIRPDCAP_DEBUG_PRINT_LINE("AirPDcapScanForGroupKey", "EAPOL body too short", AIRPDCAP_DEBUG_LEVEL_3);
|
||||
return AIRPDCAP_RET_NO_VALID_HANDSHAKE;
|
||||
|
@ -721,7 +721,7 @@ INT AirPDcapPacketProcess(
|
|||
}
|
||||
|
||||
/* get and check the body length (IEEE 802.1X-2004, pg. 25) */
|
||||
bodyLength=pntohs(data+offset+2);
|
||||
bodyLength=pntoh16(data+offset+2);
|
||||
if ((tot_len-offset-4) < bodyLength) {
|
||||
AIRPDCAP_DEBUG_PRINT_LINE("AirPDcapPacketProcess", "EAPOL body too short", AIRPDCAP_DEBUG_LEVEL_5);
|
||||
return AIRPDCAP_RET_NO_VALID_HANDSHAKE;
|
||||
|
@ -1329,7 +1329,7 @@ AirPDcapRsna4WHandshake(
|
|||
sa->wpa.ptk);
|
||||
|
||||
/* verify the MIC (compare the MIC in the packet included in this message with a MIC calculated with the PTK) */
|
||||
eapol_len=pntohs(data+offset-3)+4;
|
||||
eapol_len=pntoh16(data+offset-3)+4;
|
||||
memcpy(eapol, &data[offset-5], (eapol_len<AIRPDCAP_EAPOL_MAX_LEN?eapol_len:AIRPDCAP_EAPOL_MAX_LEN));
|
||||
ret_value=AirPDcapRsnaMicCheck(eapol, /* eapol frame (header also) */
|
||||
eapol_len, /* eapol frame length */
|
||||
|
|
|
@ -134,7 +134,7 @@ static const UINT16 Sbox[256] = {
|
|||
#define Mk16(hi, lo) \
|
||||
((UINT16)((lo) | (((UINT16) (hi)) << 8)))
|
||||
|
||||
#define Mk16_le(v) ((UINT16)pletohs(v))
|
||||
#define Mk16_le(v) ((UINT16)pletoh16(v))
|
||||
|
||||
#define _S_(v) \
|
||||
((UINT16)(Sbox[Lo8(v)] ^ ((Sbox[Hi8(v)] << 8) | (Sbox[Hi8(v)] >> 8))))
|
||||
|
|
|
@ -60,7 +60,7 @@ capture_ap1394(const guchar *pd, int offset, int len, packet_counts *ld)
|
|||
/* Skip destination and source addresses */
|
||||
offset += 16;
|
||||
|
||||
etype = pntohs(&pd[offset]);
|
||||
etype = pntoh16(&pd[offset]);
|
||||
offset += 2;
|
||||
capture_ethertype(etype, pd, offset, len, ld);
|
||||
}
|
||||
|
|
|
@ -1147,11 +1147,11 @@ dissect_reassembled_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
{
|
||||
call_dissector(llc_handle, next_tvb, pinfo, tree);
|
||||
}
|
||||
else if ((pntohs(octet) & 0xff) == PPP_IP)
|
||||
else if ((pntoh16(octet) & 0xff) == PPP_IP)
|
||||
{
|
||||
call_dissector(ppp_handle, next_tvb, pinfo, tree);
|
||||
}
|
||||
else if (pntohs(octet) == 0x00)
|
||||
else if (pntoh16(octet) == 0x00)
|
||||
{
|
||||
/* assume vc muxed bridged ethernet */
|
||||
proto_tree_add_text(tree, tvb, 0, 2, "Pad: 0x0000");
|
||||
|
|
|
@ -113,7 +113,7 @@ capture_chdlc( const guchar *pd, int offset, int len, packet_counts *ld ) {
|
|||
ld->other++;
|
||||
return;
|
||||
}
|
||||
switch (pntohs(&pd[offset + 2])) {
|
||||
switch (pntoh16(&pd[offset + 2])) {
|
||||
case ETHERTYPE_IP:
|
||||
capture_ip(pd, offset + 4, len, ld);
|
||||
break;
|
||||
|
|
|
@ -1460,7 +1460,7 @@ static void
|
|||
dissect_cip_safety_data( proto_tree *tree, proto_item *item, tvbuff_t *tvb, int item_length, packet_info *pinfo)
|
||||
{
|
||||
int base_length, io_data_size;
|
||||
gboolean multicast = (((pntohl(pinfo->dst.data)) & 0xf0000000) == 0xe0000000);
|
||||
gboolean multicast = (((pntoh32(pinfo->dst.data)) & 0xf0000000) == 0xe0000000);
|
||||
gboolean server_dir = FALSE;
|
||||
enum enip_connid_type conn_type = ECIDT_UNKNOWN;
|
||||
enum cip_safety_format_type format = CIP_SAFETY_BASE_FORMAT;
|
||||
|
|
|
@ -76,7 +76,7 @@ capture_enc(const guchar *pd, int len, packet_counts *ld)
|
|||
return;
|
||||
}
|
||||
|
||||
af = pntohl(pd + offsetof(struct enchdr, af));
|
||||
af = pntoh32(pd + offsetof(struct enchdr, af));
|
||||
switch (af) {
|
||||
|
||||
case BSD_AF_INET:
|
||||
|
|
|
@ -327,12 +327,12 @@ dissect_esis(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
|
|||
(ehdr.esis_type&BIT_7) ? "1" : "0",
|
||||
(ehdr.esis_type&BIT_6) ? "1" : "0");
|
||||
|
||||
tmp_uint = pntohs( ehdr.esis_holdtime );
|
||||
tmp_uint = pntoh16( ehdr.esis_holdtime );
|
||||
proto_tree_add_uint_format_value(esis_tree, hf_esis_holdtime, tvb, 5, 2,
|
||||
tmp_uint, "%u seconds",
|
||||
tmp_uint );
|
||||
|
||||
tmp_uint = pntohs( ehdr.esis_checksum );
|
||||
tmp_uint = pntoh16( ehdr.esis_checksum );
|
||||
|
||||
switch (calc_checksum( tvb, 0, ehdr.esis_length, tmp_uint )) {
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ capture_eth(const guchar *pd, int offset, int len, packet_counts *ld)
|
|||
return;
|
||||
}
|
||||
|
||||
etype = pntohs(&pd[offset+12]);
|
||||
etype = pntoh16(&pd[offset+12]);
|
||||
|
||||
if (etype <= IEEE_802_3_MAX_LEN) {
|
||||
/* Oh, yuck. Cisco ISL frames require special interpretation of the
|
||||
|
|
|
@ -1954,9 +1954,9 @@ static gboolean try_heuristic_giop_dissector(tvbuff_t *tvb, packet_info *pinfo,
|
|||
gboolean stream_is_big_endian = is_big_endian (header);
|
||||
|
||||
if (stream_is_big_endian)
|
||||
message_size = pntohl (&header->message_size);
|
||||
message_size = pntoh32 (&header->message_size);
|
||||
else
|
||||
message_size = pletohl (&header->message_size);
|
||||
message_size = pletoh32 (&header->message_size);
|
||||
|
||||
if (*offset > message_size)
|
||||
return FALSE;
|
||||
|
|
|
@ -371,7 +371,7 @@ dissect_gmtrailer(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void
|
|||
vec.ptr = tvb_get_ptr(tvb, offset, vec.len);
|
||||
|
||||
comp_cksum = in_cksum(&vec, 1);
|
||||
if (pntohs(&comp_cksum) != cksum) {
|
||||
if (pntoh16(&comp_cksum) != cksum) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3739,7 +3739,7 @@ dissect_h245_T_unsignedMin(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _
|
|||
gefx = gef_ctx_get(actx->private_data);
|
||||
if (gefx) {
|
||||
buf = (guint8 *)wmem_new(actx->pinfo->pool, guint16);
|
||||
phtons(buf, value);
|
||||
phton16(buf, value);
|
||||
value_tvb = tvb_new_child_real_data(tvb, buf, sizeof(guint16), sizeof(guint16));
|
||||
/* DEBUG */ /*proto_tree_add_text(tree, tvb, offset>>3, 0, "*** DEBUG dissector_try_string: %s", gefx->key);*/
|
||||
add_new_data_source(actx->pinfo, value_tvb, "unsignedMin");
|
||||
|
@ -3766,7 +3766,7 @@ dissect_h245_T_unsignedMax(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _
|
|||
gefx = gef_ctx_get(actx->private_data);
|
||||
if (gefx) {
|
||||
buf = (guint8 *)wmem_new(actx->pinfo->pool, guint16);
|
||||
phtons(buf, value);
|
||||
phton16(buf, value);
|
||||
value_tvb = tvb_new_child_real_data(tvb, buf, sizeof(guint16), sizeof(guint16));
|
||||
/* DEBUG */ /*proto_tree_add_text(tree, tvb, offset>>3, 0, "*** DEBUG dissector_try_string: %s", gefx->key);*/
|
||||
add_new_data_source(actx->pinfo, value_tvb, "unsignedMax");
|
||||
|
@ -3793,7 +3793,7 @@ dissect_h245_T_unsigned32Min(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx
|
|||
gefx = gef_ctx_get(actx->private_data);
|
||||
if (gefx) {
|
||||
buf = (guint8 *)wmem_new(actx->pinfo->pool, guint32);
|
||||
phtonl(buf, value);
|
||||
phton32(buf, value);
|
||||
value_tvb = tvb_new_child_real_data(tvb, buf, sizeof(guint32), sizeof(guint32));
|
||||
/* DEBUG */ /*proto_tree_add_text(tree, tvb, offset>>3, 0, "*** DEBUG dissector_try_string: %s", gefx->key);*/
|
||||
add_new_data_source(actx->pinfo, value_tvb, "unsigned32Min");
|
||||
|
@ -3820,7 +3820,7 @@ dissect_h245_T_unsigned32Max(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx
|
|||
gefx = gef_ctx_get(actx->private_data);
|
||||
if (gefx) {
|
||||
buf = (guint8 *)wmem_new(actx->pinfo->pool, guint32);
|
||||
phtonl(buf, value);
|
||||
phton32(buf, value);
|
||||
value_tvb = tvb_new_child_real_data(tvb, buf, sizeof(guint32), sizeof(guint32));
|
||||
/* DEBUG */ /*proto_tree_add_text(tree, tvb, offset>>3, 0, "*** DEBUG dissector_try_string: %s", gefx->key);*/
|
||||
add_new_data_source(actx->pinfo, value_tvb, "unsigned32Max");
|
||||
|
|
|
@ -244,7 +244,7 @@ capture_prism(const guchar *pd, int offset, int len, packet_counts *ld)
|
|||
}
|
||||
|
||||
/* Some captures with DLT_PRISM have the AVS WLAN header */
|
||||
cookie = pntohl(pd);
|
||||
cookie = pntoh32(pd);
|
||||
if ((cookie == WLANCAP_MAGIC_COOKIE_V1) ||
|
||||
(cookie == WLANCAP_MAGIC_COOKIE_V2)) {
|
||||
capture_wlancap(pd, offset, len, ld);
|
||||
|
|
|
@ -35,8 +35,8 @@
|
|||
|
||||
#define le16_to_cpu GINT16_FROM_LE
|
||||
#define le32_to_cpu GINT32_FROM_LE
|
||||
#define get_unaligned_le16 pletohs
|
||||
#define get_unaligned_le32 pletohl
|
||||
#define get_unaligned_le16 pletoh16
|
||||
#define get_unaligned_le32 pletoh32
|
||||
|
||||
#include "packet-ieee80211-radiotap-iter.h"
|
||||
|
||||
|
|
|
@ -880,7 +880,7 @@ capture_radiotap(const guchar * pd, int offset, int len, packet_counts * ld)
|
|||
return;
|
||||
}
|
||||
hdr = (struct ieee80211_radiotap_header *)pd;
|
||||
it_len = pletohs(&hdr->it_len);
|
||||
it_len = pletoh16(&hdr->it_len);
|
||||
if (!BYTES_ARE_IN_FRAME(offset, len, it_len)) {
|
||||
ld->other++;
|
||||
return;
|
||||
|
@ -898,7 +898,7 @@ capture_radiotap(const guchar * pd, int offset, int len, packet_counts * ld)
|
|||
return;
|
||||
}
|
||||
|
||||
present = pletohl(&hdr->it_present);
|
||||
present = pletoh32(&hdr->it_present);
|
||||
offset += (int)sizeof(struct ieee80211_radiotap_header);
|
||||
it_len -= (int)sizeof(struct ieee80211_radiotap_header);
|
||||
|
||||
|
@ -909,7 +909,7 @@ capture_radiotap(const guchar * pd, int offset, int len, packet_counts * ld)
|
|||
ld->other++;
|
||||
return;
|
||||
}
|
||||
xpresent = pletohl(pd + offset);
|
||||
xpresent = pletoh32(pd + offset);
|
||||
offset += 4;
|
||||
it_len -= 4;
|
||||
}
|
||||
|
@ -1058,7 +1058,7 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
|
|||
ENC_NA);
|
||||
|
||||
for (i = 0; i < n_bitmaps; i++) {
|
||||
guint32 bmap = pletohl(bmap_start + 4 * i);
|
||||
guint32 bmap = pletoh32(bmap_start + 4 * i);
|
||||
|
||||
rtap_ns_offset = rtap_ns_offset_next;
|
||||
rtap_ns_offset_next += 32;
|
||||
|
|
|
@ -75,7 +75,7 @@ capture_wlancap(const guchar *pd, int offset, int len, packet_counts *ld)
|
|||
return;
|
||||
}
|
||||
|
||||
length = pntohl(pd+sizeof(guint32));
|
||||
length = pntoh32(pd+sizeof(guint32));
|
||||
|
||||
if (!BYTES_ARE_IN_FRAME(offset, len, length)) {
|
||||
ld->other++;
|
||||
|
|
|
@ -4815,7 +4815,7 @@ capture_ieee80211_common (const guchar * pd, int offset, int len,
|
|||
return;
|
||||
}
|
||||
|
||||
fcf = pletohs (&pd[offset]);
|
||||
fcf = pletoh16 (&pd[offset]);
|
||||
|
||||
if (IS_PROTECTED(FCF_FLAGS(fcf)) && (wlan_ignore_wep == WLAN_IGNORE_WEP_NO)) {
|
||||
ld->other += 1;
|
||||
|
@ -4841,7 +4841,7 @@ capture_ieee80211_common (const guchar * pd, int offset, int len,
|
|||
guint8 mesh_flags = pd[hdr_length];
|
||||
guint16 qosoff = hdr_length - 2;
|
||||
qosoff -= (is_ht ? 4 : 0);
|
||||
if (has_mesh_control(fcf, pletohs(&pd[qosoff]), mesh_flags)) {
|
||||
if (has_mesh_control(fcf, pletoh16(&pd[qosoff]), mesh_flags)) {
|
||||
hdr_length += find_mesh_control_length(mesh_flags);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ capture_ieee8021ah(const guchar *pd, int offset, int len, packet_counts *ld)
|
|||
ld->other++;
|
||||
return;
|
||||
}
|
||||
encap_proto = pntohs( &pd[offset + IEEE8021AH_LEN - 2] );
|
||||
encap_proto = pntoh16( &pd[offset + IEEE8021AH_LEN - 2] );
|
||||
if (encap_proto <= IEEE_802_3_MAX_LEN) {
|
||||
if ( pd[offset + IEEE8021AH_LEN] == 0xff
|
||||
&& pd[offset + IEEE8021AH_LEN + 1] == 0xff ) {
|
||||
|
|
|
@ -114,7 +114,7 @@ dissect_ixiatrailer(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, voi
|
|||
vec.len = trailer_length + 3;
|
||||
vec.ptr = tvb_get_ptr(tvb, offset, vec.len);
|
||||
comp_cksum = in_cksum(&vec, 1);
|
||||
if (pntohs(&comp_cksum) != cksum) {
|
||||
if (pntoh16(&comp_cksum) != cksum) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ fill_fp_info(fp_info *p_fp_info, guchar *extra_info, guint32 length)
|
|||
{
|
||||
guint adj = 0;
|
||||
/* 0x11=control frame 0x30=data frame */
|
||||
guint info_type = pntohs(extra_info);
|
||||
guint info_type = pntoh16(extra_info);
|
||||
/* 1=FDD, 2=TDD 3.84, 3=TDD 1.28 */
|
||||
guchar radio_mode = extra_info[14];
|
||||
guchar channel_type = 0;
|
||||
|
@ -103,7 +103,7 @@ fill_fp_info(fp_info *p_fp_info, guchar *extra_info, guint32 length)
|
|||
p_fp_info->division = (enum division_type)radio_mode;
|
||||
|
||||
/* Format used by K15, later fields are shifted by 8 bytes. */
|
||||
if (pntohs(extra_info+2) == 5)
|
||||
if (pntoh16(extra_info+2) == 5)
|
||||
adj = 8;
|
||||
|
||||
p_fp_info->iface_type = IuB_Interface;
|
||||
|
@ -172,10 +172,10 @@ fill_fp_info(fp_info *p_fp_info, guchar *extra_info, guint32 length)
|
|||
/* For each channel */
|
||||
for (i = 0; i < (guint)p_fp_info->num_chans && (36+i*104+adj) <= length; ++i) {
|
||||
/* Read TB size */
|
||||
p_fp_info->chan_tf_size[i] = pntohl(extra_info+28+i*104+adj);
|
||||
p_fp_info->chan_tf_size[i] = pntoh32(extra_info+28+i*104+adj);
|
||||
if (p_fp_info->chan_tf_size[i])
|
||||
/* Work out number of TBs on this channel */
|
||||
p_fp_info->chan_num_tbs[i] = pntohl(extra_info+32+i*104+adj)
|
||||
p_fp_info->chan_num_tbs[i] = pntoh32(extra_info+32+i*104+adj)
|
||||
/ p_fp_info->chan_tf_size[i];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -353,7 +353,7 @@ capture_snap(const guchar *pd, int offset, int len, packet_counts *ld)
|
|||
}
|
||||
|
||||
oui = pd[offset] << 16 | pd[offset+1] << 8 | pd[offset+2];
|
||||
etype = pntohs(&pd[offset+3]);
|
||||
etype = pntoh16(&pd[offset+3]);
|
||||
switch (oui) {
|
||||
|
||||
case OUI_ENCAP_ETHER:
|
||||
|
|
|
@ -392,18 +392,18 @@ capture_ppi(const guchar *pd, int len, packet_counts *ld)
|
|||
guint offset = PPI_V0_HEADER_LEN;
|
||||
gboolean is_htc = FALSE;
|
||||
|
||||
ppi_len = pletohs(pd+2);
|
||||
ppi_len = pletoh16(pd+2);
|
||||
if(ppi_len < PPI_V0_HEADER_LEN || !BYTES_ARE_IN_FRAME(0, len, ppi_len)) {
|
||||
ld->other++;
|
||||
return;
|
||||
}
|
||||
|
||||
dlt = pletohl(pd+4);
|
||||
dlt = pletoh32(pd+4);
|
||||
|
||||
/* Figure out if we're +HTC */
|
||||
while (offset < ppi_len) {
|
||||
data_type = pletohs(pd+offset);
|
||||
data_len = pletohs(pd+offset+2) + 4;
|
||||
data_type = pletoh16(pd+offset);
|
||||
data_len = pletoh16(pd+offset+2) + 4;
|
||||
offset += data_len;
|
||||
|
||||
if (data_type == PPI_80211N_MAC || data_type == PPI_80211N_MAC_PHY) {
|
||||
|
|
|
@ -1734,7 +1734,7 @@ capture_ppp_hdlc(const guchar *pd, int offset, int len, packet_counts *ld)
|
|||
ld->other++;
|
||||
return;
|
||||
}
|
||||
switch (pntohs(&pd[offset + 2])) {
|
||||
switch (pntoh16(&pd[offset + 2])) {
|
||||
case PPP_IP:
|
||||
capture_ip(pd, offset + 4, len, ld);
|
||||
break;
|
||||
|
|
|
@ -3560,8 +3560,8 @@ find_rpc_over_tcp_reply_start(tvbuff_t *tvb, int offset)
|
|||
|
||||
/* got a match in zero-fill region, verify reply ID and
|
||||
* record mark fields */
|
||||
ulMsgType = pntohl (pbWholeBuf + ibSearchStart - 4);
|
||||
ulRecMark = pntohl (pbWholeBuf + ibSearchStart - ibPatternStart);
|
||||
ulMsgType = pntoh32 (pbWholeBuf + ibSearchStart - 4);
|
||||
ulRecMark = pntoh32 (pbWholeBuf + ibSearchStart - ibPatternStart);
|
||||
|
||||
if ((ulMsgType == RPC_REPLY) &&
|
||||
((ulRecMark & ~0x80000000) <= (unsigned) max_rpc_tcp_pdu_size)) {
|
||||
|
|
|
@ -2013,7 +2013,7 @@ dissect_rtmpt_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, rtmpt_
|
|||
|
||||
id = id & 0x3f;
|
||||
if (id==0) id = tf->saved.d[1] + 64;
|
||||
else if (id==1) id = pletohs(tf->saved.d+1) + 64;
|
||||
else if (id==1) id = pletoh16(tf->saved.d+1) + 64;
|
||||
}
|
||||
|
||||
/* Calculate header values, defaulting from previous packets with same id */
|
||||
|
@ -2021,7 +2021,7 @@ dissect_rtmpt_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, rtmpt_
|
|||
if (id<=RTMPT_ID_MAX) ti = (rtmpt_id_t *)wmem_tree_lookup32(rconv->ids[cdir], id);
|
||||
if (ti) tp = (rtmpt_packet_t *)wmem_tree_lookup32_le(ti->packets, seq+offset-1);
|
||||
|
||||
if (header_type==0) src = tf ? pntohl(tf->saved.d+basic_hlen+7) : tvb_get_ntohl(tvb, offset+basic_hlen+7);
|
||||
if (header_type==0) src = tf ? pntoh32(tf->saved.d+basic_hlen+7) : tvb_get_ntohl(tvb, offset+basic_hlen+7);
|
||||
else if (ti) src = ti->src;
|
||||
else src = 0;
|
||||
|
||||
|
@ -2069,13 +2069,13 @@ dissect_rtmpt_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, rtmpt_
|
|||
if (header_type==0) {
|
||||
ts = tf ? pntoh24(tf->saved.d+basic_hlen) : tvb_get_ntoh24(tvb, offset+basic_hlen);
|
||||
if (ts==0xffffff) {
|
||||
ts = tf ? pntohl(tf->saved.d+basic_hlen+11) : tvb_get_ntohl(tvb, offset+basic_hlen+11);
|
||||
ts = tf ? pntoh32(tf->saved.d+basic_hlen+11) : tvb_get_ntohl(tvb, offset+basic_hlen+11);
|
||||
}
|
||||
tsd = ts - ti->ts;
|
||||
} else if (header_type<3) {
|
||||
tsd = tf ? pntoh24(tf->saved.d+basic_hlen) : tvb_get_ntoh24(tvb, offset+basic_hlen);
|
||||
if (tsd==0xffffff) {
|
||||
ts = tf ? pntohl(tf->saved.d+basic_hlen+message_hlen-4) : tvb_get_ntohl(tvb, offset+basic_hlen+message_hlen-4);
|
||||
ts = tf ? pntoh32(tf->saved.d+basic_hlen+message_hlen-4) : tvb_get_ntohl(tvb, offset+basic_hlen+message_hlen-4);
|
||||
tsd = ti->tsd; /* questionable */
|
||||
} else {
|
||||
ts = ti->ts + tsd;
|
||||
|
|
|
@ -146,7 +146,7 @@ capture_sll(const guchar *pd, int len, packet_counts *ld)
|
|||
ld->other++;
|
||||
return;
|
||||
}
|
||||
protocol = pntohs(&pd[14]);
|
||||
protocol = pntoh16(&pd[14]);
|
||||
if (protocol <= 1536) { /* yes, 1536 - that's how Linux does it */
|
||||
/*
|
||||
* "proto" is *not* a length field, it's a Linux internal
|
||||
|
|
|
@ -243,7 +243,7 @@ capture_tr(const guchar *pd, int offset, int len, packet_counts *ld) {
|
|||
*/
|
||||
if (!source_routed && trn_rif_bytes > 0) {
|
||||
if (pd[offset + 0x0e] != pd[offset + 0x0f]) {
|
||||
first2_sr = pntohs(&pd[offset + 0xe0 + trn_rif_bytes]);
|
||||
first2_sr = pntoh16(&pd[offset + 0xe0 + trn_rif_bytes]);
|
||||
if (
|
||||
(first2_sr == 0xaaaa &&
|
||||
pd[offset + 0x10 + trn_rif_bytes] == 0x03) ||
|
||||
|
|
|
@ -106,7 +106,7 @@ capture_vlan(const guchar *pd, int offset, int len, packet_counts *ld ) {
|
|||
ld->other++;
|
||||
return;
|
||||
}
|
||||
encap_proto = pntohs( &pd[offset+2] );
|
||||
encap_proto = pntoh16( &pd[offset+2] );
|
||||
if ( encap_proto <= IEEE_802_3_MAX_LEN) {
|
||||
if ( pd[offset+4] == 0xff && pd[offset+5] == 0xff ) {
|
||||
capture_ipx(ld);
|
||||
|
|
|
@ -522,7 +522,7 @@ static tvbuff_t *wcp_uncompress( tvbuff_t *src_tvb, int offset, packet_info *pin
|
|||
offset, 3, ENC_NA);
|
||||
sub_tree = proto_item_add_subtree(ti, ett_wcp_field);
|
||||
proto_tree_add_uint(sub_tree, hf_wcp_offset, src_tvb,
|
||||
offset, 2, pntohs(src));
|
||||
offset, 2, pntoh16(src));
|
||||
|
||||
proto_tree_add_item( sub_tree, hf_wcp_long_len, src_tvb,
|
||||
offset+2, 1, ENC_BIG_ENDIAN);
|
||||
|
@ -537,7 +537,7 @@ static tvbuff_t *wcp_uncompress( tvbuff_t *src_tvb, int offset, packet_info *pin
|
|||
proto_tree_add_uint( sub_tree, hf_wcp_short_len, src_tvb,
|
||||
offset, 1, *src);
|
||||
proto_tree_add_uint(sub_tree, hf_wcp_offset, src_tvb,
|
||||
offset, 2, pntohs(src));
|
||||
offset, 2, pntoh16(src));
|
||||
}
|
||||
src += 2;
|
||||
offset += 2;
|
||||
|
|
|
@ -57,7 +57,7 @@ sna_fid_to_str_buf(const address *addr, gchar *buf, int buf_len)
|
|||
|
||||
case 2:
|
||||
addrdata = (guint8 *)addr->data;
|
||||
g_snprintf(buf, buf_len, "%04X", pntohs(&addrdata[0]));
|
||||
g_snprintf(buf, buf_len, "%04X", pntoh16(&addrdata[0]));
|
||||
break;
|
||||
|
||||
case SNA_FID_TYPE_4_ADDR_LEN:
|
||||
|
|
|
@ -216,7 +216,7 @@ test(tvbuff_t *tvb, const gchar* name,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
expected32 = pntohl(expected_data);
|
||||
expected32 = pntoh32(expected_data);
|
||||
if (val32 != expected32) {
|
||||
printf("08: Failed TVB=%s guint32 @ 0 %u != expected %u\n",
|
||||
name, val32, expected32);
|
||||
|
@ -243,7 +243,7 @@ test(tvbuff_t *tvb, const gchar* name,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
expected32 = pntohl(&expected_data[length-4]);
|
||||
expected32 = pntoh32(&expected_data[length-4]);
|
||||
if (val32 != expected32) {
|
||||
printf("10: Failed TVB=%s guint32 @ -4 %u != expected %u\n",
|
||||
name, val32, expected32);
|
||||
|
|
|
@ -810,7 +810,7 @@ tvb_get_ntohs(tvbuff_t *tvb, const gint offset)
|
|||
const guint8 *ptr;
|
||||
|
||||
ptr = fast_ensure_contiguous(tvb, offset, sizeof(guint16));
|
||||
return pntohs(ptr);
|
||||
return pntoh16(ptr);
|
||||
}
|
||||
|
||||
guint32
|
||||
|
@ -828,7 +828,7 @@ tvb_get_ntohl(tvbuff_t *tvb, const gint offset)
|
|||
const guint8 *ptr;
|
||||
|
||||
ptr = fast_ensure_contiguous(tvb, offset, sizeof(guint32));
|
||||
return pntohl(ptr);
|
||||
return pntoh32(ptr);
|
||||
}
|
||||
|
||||
guint64
|
||||
|
@ -1076,7 +1076,7 @@ tvb_get_letohs(tvbuff_t *tvb, const gint offset)
|
|||
const guint8 *ptr;
|
||||
|
||||
ptr = fast_ensure_contiguous(tvb, offset, sizeof(guint16));
|
||||
return pletohs(ptr);
|
||||
return pletoh16(ptr);
|
||||
}
|
||||
|
||||
guint32
|
||||
|
@ -1094,7 +1094,7 @@ tvb_get_letohl(tvbuff_t *tvb, const gint offset)
|
|||
const guint8 *ptr;
|
||||
|
||||
ptr = fast_ensure_contiguous(tvb, offset, sizeof(guint32));
|
||||
return pletohl(ptr);
|
||||
return pletoh32(ptr);
|
||||
}
|
||||
|
||||
guint64
|
||||
|
@ -1220,9 +1220,9 @@ tvb_get_ntohguid(tvbuff_t *tvb, const gint offset, e_guid_t *guid)
|
|||
{
|
||||
const guint8 *ptr = ensure_contiguous(tvb, offset, GUID_LEN);
|
||||
|
||||
guid->data1 = pntohl(ptr + 0);
|
||||
guid->data2 = pntohs(ptr + 4);
|
||||
guid->data3 = pntohs(ptr + 6);
|
||||
guid->data1 = pntoh32(ptr + 0);
|
||||
guid->data2 = pntoh16(ptr + 4);
|
||||
guid->data3 = pntoh16(ptr + 6);
|
||||
memcpy(guid->data4, ptr + 8, sizeof guid->data4);
|
||||
}
|
||||
|
||||
|
@ -1231,9 +1231,9 @@ tvb_get_letohguid(tvbuff_t *tvb, const gint offset, e_guid_t *guid)
|
|||
{
|
||||
const guint8 *ptr = ensure_contiguous(tvb, offset, GUID_LEN);
|
||||
|
||||
guid->data1 = pletohl(ptr + 0);
|
||||
guid->data2 = pletohs(ptr + 4);
|
||||
guid->data3 = pletohs(ptr + 6);
|
||||
guid->data1 = pletoh32(ptr + 0);
|
||||
guid->data2 = pletoh16(ptr + 4);
|
||||
guid->data3 = pletoh16(ptr + 6);
|
||||
memcpy(guid->data4, ptr + 8, sizeof guid->data4);
|
||||
}
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ get_xdlc_control(const guchar *pd, int offset, gboolean is_extended)
|
|||
* Supervisory or Information frame.
|
||||
*/
|
||||
if (is_extended)
|
||||
control = pletohs(&pd[offset]);
|
||||
control = pletoh16(&pd[offset]);
|
||||
else
|
||||
control = pd[offset];
|
||||
break;
|
||||
|
|
|
@ -59,10 +59,10 @@
|
|||
/* extract the byte at the given nibble address 'n' of buffer 'b' */
|
||||
#define NIB_BYTE(n,b) \
|
||||
(n) & 1 \
|
||||
? (pntohs( (b)+(n)/2 ) >> 4) & BYTE_MASK \
|
||||
? (pntoh16( (b)+(n)/2 ) >> 4) & BYTE_MASK \
|
||||
: (b)[(n)/2]
|
||||
/*
|
||||
? (pletohs((b)+(n)/2) >> 4) & BYTE_MASK \
|
||||
? (pletoh16((b)+(n)/2) >> 4) & BYTE_MASK \
|
||||
*/
|
||||
|
||||
/* extract 12 bits at the given nibble address */
|
||||
|
@ -72,21 +72,21 @@
|
|||
/* extract the word at the given nibble address 'n' of buffer 'b' */
|
||||
#define NIB_WORD(n,b) \
|
||||
(n) & 1 \
|
||||
? (gint)((pntohl(((b) + (n)/2)) >> 12) & 0x0000FFFF) \
|
||||
: pntohs((b) + (n)/2)
|
||||
? (gint)((pntoh32(((b) + (n)/2)) >> 12) & 0x0000FFFF) \
|
||||
: pntoh16((b) + (n)/2)
|
||||
/*
|
||||
: pletohs((b) + (n)/2)
|
||||
? (pletohl((b)+(n)/2) >> 12) & 0x0000FFFF \
|
||||
: pletoh16((b) + (n)/2)
|
||||
? (pletoh32((b)+(n)/2) >> 12) & 0x0000FFFF \
|
||||
*/
|
||||
|
||||
/* extract the word at the given nibble address 'n' of buffer 'b' */
|
||||
#define NIB_LONG(n,b) \
|
||||
(n) & 1 \
|
||||
? (pntohl(((b) + (n)/2)) << 4) | (((b)[(n)/2 + 4] >> 4) & NIBBLE_MASK) \
|
||||
: pntohl((b) + (n)/2)
|
||||
? (pntoh32(((b) + (n)/2)) << 4) | (((b)[(n)/2 + 4] >> 4) & NIBBLE_MASK) \
|
||||
: pntoh32((b) + (n)/2)
|
||||
/*
|
||||
? (pletohl((b) + (n)/2) << 4) | (((b)[(n)/2 + 4] >> 4) & NIBBLE_MASK) \
|
||||
: pletohl((b) + (n)/2)
|
||||
? (pletoh32((b) + (n)/2) << 4) | (((b)[(n)/2 + 4] >> 4) & NIBBLE_MASK) \
|
||||
: pletoh32((b) + (n)/2)
|
||||
*/
|
||||
|
||||
/* Only currently used with nib == 1 or 2 */
|
||||
|
@ -156,7 +156,7 @@
|
|||
* num ... length of bitfield
|
||||
*/
|
||||
#define BIT_BITS16(bit, buf, num) \
|
||||
(( pntohs(buf+ADDR16(bit)) >> SHIFT16(bit,num) ) & MASK16(num))
|
||||
(( pntoh16(buf+ADDR16(bit)) >> SHIFT16(bit,num) ) & MASK16(num))
|
||||
|
||||
/* extract bitfield up to 24 bits
|
||||
* bit ... bit address
|
||||
|
@ -165,14 +165,14 @@
|
|||
*/
|
||||
|
||||
#define BIT_BITS32(bit, buf, num) \
|
||||
((pntohl(buf+ADDR32(bit)) >> SHIFT32(bit,num) ) & MASK32(num))
|
||||
((pntoh32(buf+ADDR32(bit)) >> SHIFT32(bit,num) ) & MASK32(num))
|
||||
|
||||
/* bitfield up to 32 bits */
|
||||
#define BIT_BITS64a(bit, buf, num) \
|
||||
((pntohl(buf+ADDR32(bit)) & MASK64a(bit)) << SHIFT64a(bit,num))
|
||||
((pntoh32(buf+ADDR32(bit)) & MASK64a(bit)) << SHIFT64a(bit,num))
|
||||
|
||||
#define BIT_BITS64b(bit, buf, num) \
|
||||
((pntohl(buf+ADDR32(bit)+4) >> SHIFT64b(bit,num) ) & MASK64b(bit,num))
|
||||
((pntoh32(buf+ADDR32(bit)+4) >> SHIFT64b(bit,num) ) & MASK64b(bit,num))
|
||||
|
||||
#define BIT_BITS64(bit, buf, num) \
|
||||
( (OFFSET32(bit)+(num)) <= 32 \
|
||||
|
|
|
@ -741,7 +741,7 @@ draw_hostlist_table_data(hostlist_table *hl)
|
|||
/* Filled in from the GeoIP config, if any */
|
||||
for (j = 0; j < NUM_GEOIP_COLS; j++) {
|
||||
if (host->myaddress.type == AT_IPv4 && j < geoip_db_num_dbs()) {
|
||||
const guchar *name = geoip_db_lookup_ipv4(j, pntohl(host->myaddress.data), "-");
|
||||
const guchar *name = geoip_db_lookup_ipv4(j, pntoh32(host->myaddress.data), "-");
|
||||
geoip[j] = g_strdup(name);
|
||||
} else if (host->myaddress.type == AT_IPv6 && j < geoip_db_num_dbs()) {
|
||||
const guchar *name;
|
||||
|
|
|
@ -2384,7 +2384,7 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t *
|
|||
/* First we write the .au header. XXX Hope this is endian independent */
|
||||
/* the magic word 0x2e736e64 == .snd */
|
||||
/* XXX: Should we be checking for write errors below ? */
|
||||
phtonl(pd, 0x2e736e64);
|
||||
phton32(pd, 0x2e736e64);
|
||||
fwritten = ws_write(to_fd, pd, 4);
|
||||
if ((fwritten < 4) || (fread_cnt == (size_t)-1)) {
|
||||
ws_close(forw_fd);
|
||||
|
@ -2394,7 +2394,7 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t *
|
|||
return FALSE;
|
||||
}
|
||||
/* header offset == 24 bytes */
|
||||
phtonl(pd, 24);
|
||||
phton32(pd, 24);
|
||||
fwritten = ws_write(to_fd, pd, 4);
|
||||
if ((fwritten < 4) || (fread_cnt == (size_t)-1)) {
|
||||
ws_close(forw_fd);
|
||||
|
@ -2404,7 +2404,7 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t *
|
|||
return FALSE;
|
||||
}
|
||||
/* total length, it is permited to set this to 0xffffffff */
|
||||
phtonl(pd, -1);
|
||||
phton32(pd, -1);
|
||||
fwritten = ws_write(to_fd, pd, 4);
|
||||
if ((fwritten < 4) || (fread_cnt == (size_t)-1)) {
|
||||
ws_close(forw_fd);
|
||||
|
@ -2414,7 +2414,7 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t *
|
|||
return FALSE;
|
||||
}
|
||||
/* encoding format == 16-bit linear PCM */
|
||||
phtonl(pd, 3);
|
||||
phton32(pd, 3);
|
||||
fwritten = ws_write(to_fd, pd, 4);
|
||||
if ((fwritten < 4) || (fread_cnt == (size_t)-1)) {
|
||||
ws_close(forw_fd);
|
||||
|
@ -2424,7 +2424,7 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t *
|
|||
return FALSE;
|
||||
}
|
||||
/* sample rate == 8000 Hz */
|
||||
phtonl(pd, 8000);
|
||||
phton32(pd, 8000);
|
||||
fwritten = ws_write(to_fd, pd, 4);
|
||||
if ((fwritten < 4) || (fread_cnt == (size_t)-1)) {
|
||||
ws_close(forw_fd);
|
||||
|
@ -2434,7 +2434,7 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t *
|
|||
return FALSE;
|
||||
}
|
||||
/* channels == 1 */
|
||||
phtonl(pd, 1);
|
||||
phton32(pd, 1);
|
||||
fwritten = ws_write(to_fd, pd, 4);
|
||||
if ((fwritten < 4) || (fread_cnt == (size_t)-1)) {
|
||||
ws_close(forw_fd);
|
||||
|
@ -2461,11 +2461,11 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t *
|
|||
|
||||
if (user_data->forward.statinfo.pt == AST_FORMAT_ULAW) {
|
||||
sample = ulaw2linear(*f_pd);
|
||||
phtons(pd, sample);
|
||||
phton16(pd, sample);
|
||||
}
|
||||
else if (user_data->forward.statinfo.pt == AST_FORMAT_ALAW) {
|
||||
sample = alaw2linear(*f_pd);
|
||||
phtons(pd, sample);
|
||||
phton16(pd, sample);
|
||||
}
|
||||
else{
|
||||
ws_close(forw_fd);
|
||||
|
@ -2502,11 +2502,11 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t *
|
|||
|
||||
if (user_data->reversed.statinfo.pt == AST_FORMAT_ULAW) {
|
||||
sample = ulaw2linear(*r_pd);
|
||||
phtons(pd, sample);
|
||||
phton16(pd, sample);
|
||||
}
|
||||
else if (user_data->reversed.statinfo.pt == AST_FORMAT_ALAW) {
|
||||
sample = alaw2linear(*r_pd);
|
||||
phtons(pd, sample);
|
||||
phton16(pd, sample);
|
||||
}
|
||||
else{
|
||||
ws_close(forw_fd);
|
||||
|
@ -2587,12 +2587,12 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t *
|
|||
if ((user_data->forward.statinfo.pt == AST_FORMAT_ULAW)
|
||||
&& (user_data->reversed.statinfo.pt == AST_FORMAT_ULAW)) {
|
||||
sample = (ulaw2linear(*r_pd) + ulaw2linear(*f_pd)) / 2;
|
||||
phtons(pd, sample);
|
||||
phton16(pd, sample);
|
||||
}
|
||||
else if ((user_data->forward.statinfo.pt == AST_FORMAT_ALAW)
|
||||
&& (user_data->reversed.statinfo.pt == AST_FORMAT_ALAW)) {
|
||||
sample = (alaw2linear(*r_pd) + alaw2linear(*f_pd)) / 2;
|
||||
phtons(pd, sample);
|
||||
phton16(pd, sample);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -2501,32 +2501,32 @@ copy_file(gchar *dest, gint channels, gint format, user_data_t *user_data)
|
|||
{
|
||||
/* First we write the .au header. XXX Hope this is endian independent */
|
||||
/* the magic word 0x2e736e64 == .snd */
|
||||
phtonl(pd, 0x2e736e64);
|
||||
phton32(pd, 0x2e736e64);
|
||||
nchars = fwrite(pd, 1, 4, to_stream);
|
||||
if (nchars != 4)
|
||||
goto copy_file_err;
|
||||
/* header offset == 24 bytes */
|
||||
phtonl(pd, 24);
|
||||
phton32(pd, 24);
|
||||
nchars = fwrite(pd, 1, 4, to_stream);
|
||||
if (nchars != 4)
|
||||
goto copy_file_err;
|
||||
/* total length; it is permitted to set this to 0xffffffff */
|
||||
phtonl(pd, -1);
|
||||
phton32(pd, -1);
|
||||
nchars = fwrite(pd, 1, 4, to_stream);
|
||||
if (nchars != 4)
|
||||
goto copy_file_err;
|
||||
/* encoding format == 16-bit linear PCM */
|
||||
phtonl(pd, 3);
|
||||
phton32(pd, 3);
|
||||
nchars = fwrite(pd, 1, 4, to_stream);
|
||||
if (nchars != 4)
|
||||
goto copy_file_err;
|
||||
/* sample rate == 8000 Hz */
|
||||
phtonl(pd, 8000);
|
||||
phton32(pd, 8000);
|
||||
nchars = fwrite(pd, 1, 4, to_stream);
|
||||
if (nchars != 4)
|
||||
goto copy_file_err;
|
||||
/* channels == 1 */
|
||||
phtonl(pd, 1);
|
||||
phton32(pd, 1);
|
||||
nchars = fwrite(pd, 1, 4, to_stream);
|
||||
if (nchars != 4)
|
||||
goto copy_file_err;
|
||||
|
@ -2549,11 +2549,11 @@ copy_file(gchar *dest, gint channels, gint format, user_data_t *user_data)
|
|||
|
||||
if (user_data->forward.statinfo.pt == PT_PCMU) {
|
||||
sample = ulaw2linear((unsigned char)f_rawvalue);
|
||||
phtons(pd, sample);
|
||||
phton16(pd, sample);
|
||||
}
|
||||
else if (user_data->forward.statinfo.pt == PT_PCMA) {
|
||||
sample = alaw2linear((unsigned char)f_rawvalue);
|
||||
phtons(pd, sample);
|
||||
phton16(pd, sample);
|
||||
}
|
||||
else{
|
||||
goto copy_file_err;
|
||||
|
@ -2582,11 +2582,11 @@ copy_file(gchar *dest, gint channels, gint format, user_data_t *user_data)
|
|||
|
||||
if (user_data->reversed.statinfo.pt == PT_PCMU) {
|
||||
sample = ulaw2linear((unsigned char)r_rawvalue);
|
||||
phtons(pd, sample);
|
||||
phton16(pd, sample);
|
||||
}
|
||||
else if (user_data->reversed.statinfo.pt == PT_PCMA) {
|
||||
sample = alaw2linear((unsigned char)r_rawvalue);
|
||||
phtons(pd, sample);
|
||||
phton16(pd, sample);
|
||||
}
|
||||
else{
|
||||
goto copy_file_err;
|
||||
|
@ -2668,13 +2668,13 @@ copy_file(gchar *dest, gint channels, gint format, user_data_t *user_data)
|
|||
&& (user_data->reversed.statinfo.pt == PT_PCMU)) {
|
||||
sample = (ulaw2linear((unsigned char)r_rawvalue)
|
||||
+ ulaw2linear((unsigned char)f_rawvalue)) / 2;
|
||||
phtons(pd, sample);
|
||||
phton16(pd, sample);
|
||||
}
|
||||
else if ((user_data->forward.statinfo.pt == PT_PCMA)
|
||||
&& (user_data->reversed.statinfo.pt == PT_PCMA)) {
|
||||
sample = (alaw2linear((unsigned char)r_rawvalue)
|
||||
+ alaw2linear((unsigned char)f_rawvalue)) / 2;
|
||||
phtons(pd, sample);
|
||||
phton16(pd, sample);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -64,7 +64,7 @@ static void byteReverse(guint32 *buf, unsigned longs)
|
|||
{
|
||||
guint32 t;
|
||||
do {
|
||||
t = pletohl(buf);
|
||||
t = pletoh32(buf);
|
||||
*buf = t;
|
||||
buf++;
|
||||
} while (--longs);
|
||||
|
|
|
@ -31,10 +31,10 @@
|
|||
|
||||
/* Pointer versions of g_ntohs and g_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.
|
||||
* The pletohXX versions return the little-endian representation.
|
||||
*/
|
||||
|
||||
#define pntohs(p) ((guint16) \
|
||||
#define pntoh16(p) ((guint16) \
|
||||
((guint16)*((const guint8 *)(p)+0)<<8| \
|
||||
(guint16)*((const guint8 *)(p)+1)<<0))
|
||||
|
||||
|
@ -42,7 +42,7 @@
|
|||
(guint32)*((const guint8 *)(p)+1)<<8| \
|
||||
(guint32)*((const guint8 *)(p)+2)<<0)
|
||||
|
||||
#define pntohl(p) ((guint32)*((const guint8 *)(p)+0)<<24| \
|
||||
#define pntoh32(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)
|
||||
|
@ -78,7 +78,7 @@
|
|||
(guint64)*((const guint8 *)(p)+7)<<0)
|
||||
|
||||
|
||||
#define pletohs(p) ((guint16) \
|
||||
#define pletoh16(p) ((guint16) \
|
||||
((guint16)*((const guint8 *)(p)+1)<<8| \
|
||||
(guint16)*((const guint8 *)(p)+0)<<0))
|
||||
|
||||
|
@ -86,7 +86,7 @@
|
|||
(guint32)*((const guint8 *)(p)+1)<<8| \
|
||||
(guint32)*((const guint8 *)(p)+0)<<0)
|
||||
|
||||
#define pletohl(p) ((guint32)*((const guint8 *)(p)+3)<<24| \
|
||||
#define pletoh32(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)
|
||||
|
@ -125,13 +125,13 @@
|
|||
* These will work regardless of the byte alignment of the pointer.
|
||||
*/
|
||||
|
||||
#define phtons(p, v) \
|
||||
#define phton16(p, v) \
|
||||
{ \
|
||||
((guint8*)(p))[0] = (guint8)((v) >> 8); \
|
||||
((guint8*)(p))[1] = (guint8)((v) >> 0); \
|
||||
}
|
||||
|
||||
#define phtonl(p, v) \
|
||||
#define phton32(p, v) \
|
||||
{ \
|
||||
((guint8*)(p))[0] = (guint8)((v) >> 24); \
|
||||
((guint8*)(p))[1] = (guint8)((v) >> 16); \
|
||||
|
|
Loading…
Reference in New Issue