]> The Tcpdump Group git mirrors - tcpdump/commit
Add EXTRACT_ macros/functions for IPv4 addresses, get rid of structure wrappers.
authorGuy Harris <[email protected]>
Wed, 20 Dec 2017 09:07:48 +0000 (01:07 -0800)
committerGuy Harris <[email protected]>
Wed, 20 Dec 2017 09:07:48 +0000 (01:07 -0800)
commitb347189ca62c553b60c53c3b6978ebd354c1c88b
tree945fc78450c36df7190d47fa18a19ef173e0638f
parentacbfc682d6c3ced52b76062d37d5d6a08caa8e78
Add EXTRACT_ macros/functions for IPv4 addresses, get rid of structure wrappers.

Add EXTRACT_IPV4_TO_HOST_ORDER() and EXTRACT_IPV4_TO_NETWORK_ORDER();
the former extracts a possibly-unaligned IPv4 address, in network byte
order, returning a uint32_t in host byte order, and the latter extracts
a possibly-unaligned IPv4 address, in network byte order, returning a
uint32_t in *network* byte order.  Some APIs take an address in network
byte order, and some operations are more easily done in host byte order,
so both are useful.

Remove the structure wrappers around nd_ipv4 and nd_ipv6; that makes it
easier to pass variables of those types to functions/macros that take a
byte pointer as an argument (because they might be used either with
pointers to structure members or raw buffer pointers), and the structure
probably wouldn't do much to prevent people from using EXTRACT_BE_U_4()
when they really want to extract the value in *network* byte order;
using the above EXTRACT_IPV4_ calls should do more to encourage that.
cpack.c
extract.h
netdissect.h
print-decnet.c
print-ip.c