version 1.1, 2012/02/21 22:30:18
|
version 1.1.1.1, 2012/10/09 09:06:54
|
Line 3
|
Line 3
|
Packet assembly code, originally contributed by Archie Cobbs. */ |
Packet assembly code, originally contributed by Archie Cobbs. */ |
|
|
/* |
/* |
* Copyright (c) 2004,2005,2007,2009 by Internet Systems Consortium, Inc. ("ISC") | * Copyright (c) 2009,2012 by Internet Systems Consortium, Inc. ("ISC") |
| * Copyright (c) 2004,2005,2007 by Internet Systems Consortium, Inc. ("ISC") |
* Copyright (c) 1996-2003 by Internet Software Consortium |
* Copyright (c) 1996-2003 by Internet Software Consortium |
* |
* |
* Permission to use, copy, modify, and distribute this software for any |
* Permission to use, copy, modify, and distribute this software for any |
Line 105 void assemble_hw_header (interface, buf, bufix, to)
|
Line 106 void assemble_hw_header (interface, buf, bufix, to)
|
unsigned *bufix; |
unsigned *bufix; |
struct hardware *to; |
struct hardware *to; |
{ |
{ |
#if defined (HAVE_TR_SUPPORT) | switch (interface->hw_address.hbuf[0]) { |
if (interface -> hw_address.hbuf [0] == HTYPE_IEEE802) | #if defined(HAVE_TR_SUPPORT) |
assemble_tr_header (interface, buf, bufix, to); | case HTYPE_IEEE802: |
else | assemble_tr_header(interface, buf, bufix, to); |
| break; |
#endif |
#endif |
#if defined (DEC_FDDI) |
#if defined (DEC_FDDI) |
if (interface -> hw_address.hbuf [0] == HTYPE_FDDI) | case HTYPE_FDDI: |
assemble_fddi_header (interface, buf, bufix, to); | assemble_fddi_header(interface, buf, bufix, to); |
else | break; |
#endif |
#endif |
assemble_ethernet_header (interface, buf, bufix, to); | case HTYPE_INFINIBAND: |
| log_error("Attempt to assemble hw header for infiniband"); |
| break; |
| case HTYPE_ETHER: |
| default: |
| assemble_ethernet_header(interface, buf, bufix, to); |
| break; |
| } |
} |
} |
|
|
/* UDP header and IP header assembled together for convenience. */ |
/* UDP header and IP header assembled together for convenience. */ |
Line 184 void assemble_udp_ip_header (interface, buf, bufix,
|
Line 192 void assemble_udp_ip_header (interface, buf, bufix,
|
|
|
#ifdef PACKET_DECODING |
#ifdef PACKET_DECODING |
/* Decode a hardware header... */ |
/* Decode a hardware header... */ |
/* XXX currently only supports ethernet; doesn't check for other types. */ | /* Support for ethernet, TR and FDDI |
| * Doesn't support infiniband yet as the supported oses shouldn't get here |
| */ |
|
|
ssize_t decode_hw_header (interface, buf, bufix, from) |
ssize_t decode_hw_header (interface, buf, bufix, from) |
struct interface_info *interface; |
struct interface_info *interface; |
Line 192 ssize_t decode_hw_header (interface, buf, bufix, from)
|
Line 202 ssize_t decode_hw_header (interface, buf, bufix, from)
|
unsigned bufix; |
unsigned bufix; |
struct hardware *from; |
struct hardware *from; |
{ |
{ |
|
switch(interface->hw_address.hbuf[0]) { |
#if defined (HAVE_TR_SUPPORT) |
#if defined (HAVE_TR_SUPPORT) |
if (interface -> hw_address.hbuf [0] == HTYPE_IEEE802) | case HTYPE_IEEE802: |
return decode_tr_header (interface, buf, bufix, from); | return (decode_tr_header(interface, buf, bufix, from)); |
else | |
#endif |
#endif |
#if defined (DEC_FDDI) |
#if defined (DEC_FDDI) |
if (interface -> hw_address.hbuf [0] == HTYPE_FDDI) | case HTYPE_FDDI: |
return decode_fddi_header (interface, buf, bufix, from); | return (decode_fddi_header(interface, buf, bufix, from)); |
else | |
#endif |
#endif |
return decode_ethernet_header (interface, buf, bufix, from); | case HTYPE_INFINIBAND: |
| log_error("Attempt to decode hw header for infiniband"); |
| return (0); |
| case HTYPE_ETHER: |
| default: |
| return (decode_ethernet_header(interface, buf, bufix, from)); |
| } |
} |
} |
|
|
/* UDP header and IP header decoded together for convenience. */ |
/* UDP header and IP header decoded together for convenience. */ |