3 Packet assembly code, originally contributed by Archie Cobbs. */
6 * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
7 * Copyright (c) 1996-2003 by Internet Software Consortium
9 * Permission to use, copy, modify, and distribute this software for any
10 * purpose with or without fee is hereby granted, provided that the above
11 * copyright notice and this permission notice appear in all copies.
13 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
14 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
16 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
19 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21 * Internet Systems Consortium, Inc.
23 * Redwood City, CA 94063
27 * This software has been written for Internet Systems Consortium
28 * by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc.
29 * To learn more about Internet Systems Consortium, see
30 * ``http://www.isc.org/''. To learn more about Vixie Enterprises,
31 * see ``http://www.vix.com''. To learn more about Nominum, Inc., see
32 * ``http://www.nominum.com''.
36 static char copyright
[] =
37 "$Id$ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n";
42 #if defined (DEC_FDDI)
43 #include <netinet/if_fddi.h>
44 #include <net/if_llc.h>
46 #if defined (PACKET_ASSEMBLY) || defined (PACKET_DECODING)
47 #include "includes/netinet/if_ether.h"
48 #endif /* PACKET_ASSEMBLY || PACKET_DECODING */
50 #if defined (PACKET_ASSEMBLY)
51 /* Assemble an hardware header... */
53 void assemble_fddi_header (interface
, buf
, bufix
, to
)
54 struct interface_info
*interface
;
59 struct fddi_header fh
;
62 if (to
&& to
-> hlen
== 7)
63 memcpy (fh
.fddi_dhost
, &to
-> hbuf
[1],
64 sizeof (fh
.fddi_dhost
));
65 memcpy (fh
.fddi_shost
,
66 &interface
-> hw_address
.hbuf
[1], sizeof (fh
.fddi_shost
));
67 fh
.fddi_fc
= FDDIFC_LLC_ASYNC
;
68 memcpy (&buf
[*bufix
], &fh
, sizeof fh
);
71 lh
.llc_dsap
= LLC_SNAP_LSAP
;
72 lh
.llc_ssap
= LLC_SNAP_LSAP
;
73 lh
.llc_un
.type_snap
.control
= LLC_UI
;
74 lh
.llc_un
.type_snap
.ether_type
= htons (ETHERTYPE_IP
);
75 memcpy (&buf
[*bufix
], &lh
, LLC_SNAP_LEN
);
76 *bufix
+= LLC_SNAP_LEN
;
78 #endif /* PACKET_ASSEMBLY */
80 #ifdef PACKET_DECODING
81 /* Decode a hardware header... */
83 ssize_t
decode_fddi_header (interface
, buf
, bufix
, from
)
84 struct interface_info
*interface
;
87 struct hardware
*from
;
89 struct fddi_header fh
;
92 from
-> hbuf
[0] = HTYPE_FDDI
;
93 memcpy (&from
-> hbuf
[1], fh
.fddi_shost
, sizeof fh
.fddi_shost
);
94 return FDDI_HEADER_SIZE
+ LLC_SNAP_LEN
;
96 #endif /* PACKET_DECODING */