[Winpcap-users] Winpcap in Intanium machine
Guy Harris
guy at alum.mit.edu
Sat Oct 10 11:37:48 PDT 2009
On Oct 10, 2009, at 9:11 AM, Gianluca Varenni wrote:
> 2. when we access the packet contents for filtering, the header
> fields are
> inevitably misaligned. In that case the only solution would be using
> macros
> when reading the header fields from the packets to avoid
> misalignment errors
> on architectures like Itanium
You mean macros such as
#define EXTRACT_SHORT(p)\
((((u_short)(((u_char*)p)[0])) << 8) |\
(((u_short)(((u_char*)p)[1])) << 0))
and
#define EXTRACT_LONG(p)\
((((u_int32)(((u_char*)p)[0])) << 24) |\
(((u_int32)(((u_char*)p)[1])) << 16) |\
(((u_int32)(((u_char*)p)[2])) << 8 ) |\
(((u_int32)(((u_char*)p)[3])) << 0 ))
Unless I'm missing something, or you mean something other than BPF
filtering by "filtering", WinPcap's BPF interpreter *already* uses
macros when reading data from packets - it's done that for ages (BPF
dates back to about 1993; it appears they did the development on a
SPARCstation, and SPARC processors don't do unaligned accesses).
More information about the Winpcap-users
mailing list