2 * lib/fddi.c This file contains an implementation of the "FDDI"
5 * Version: $Id: fddi.c,v 1.7 2000/03/05 11:26:02 philip Exp $
7 * Author: Lawrence V. Stefani, <stefani@lkg.dec.com>
9 * 1998-07-01 - Arnaldo Carvalho de Melo <acme@conectiva.com.br> GNU gettext
11 * This program is free software; you can redistribute it
12 * and/or modify it under the terms of the GNU General
13 * Public License as published by the Free Software
14 * Foundation; either version 2 of the License, or (at
15 * your option) any later version.
22 #include <sys/types.h>
23 #include <sys/socket.h>
24 #include <net/if_arp.h>
26 #error "No FDDI Support in your current Kernelsource Tree."
27 #error "Disable HW Type FDDI"
30 #include <netinet/if_fddi.h>
32 #include <linux/if_fddi.h>
40 #include "net-support.h"
41 #include "pathnames.h"
45 extern struct hwtype fddi_hwtype
;
48 /* Display an FDDI address in readable format. */
49 static char *pr_fddi(unsigned char *ptr
)
53 snprintf(buff
, sizeof(buff
), "%02X-%02X-%02X-%02X-%02X-%02X",
54 (ptr
[0] & 0377), (ptr
[1] & 0377), (ptr
[2] & 0377),
55 (ptr
[3] & 0377), (ptr
[4] & 0377), (ptr
[5] & 0377)
61 /* Input an FDDI address and convert to binary. */
62 static int in_fddi(char *bufp
, struct sockaddr
*sap
)
68 sap
->sa_family
= fddi_hwtype
.type
;
73 while ((*bufp
!= '\0') && (i
< FDDI_K_ALEN
)) {
78 else if (c
>= 'a' && c
<= 'f')
80 else if (c
>= 'A' && c
<= 'F')
84 fprintf(stderr
, _("in_fddi(%s): invalid fddi address!\n"), orig
);
93 else if (c
>= 'a' && c
<= 'f')
95 else if (c
>= 'A' && c
<= 'F')
99 fprintf(stderr
, _("in_fddi(%s): invalid fddi address!\n"), orig
);
104 *ptr
++ = (unsigned char) (val
& 0377);
107 /* We might get a semicolon here - not required. */
109 if (i
== FDDI_K_ALEN
) {
111 fprintf(stderr
, _("in_fddi(%s): trailing : ignored!\n"),
120 /* That's it. Any trailing junk? */
121 if ((i
== FDDI_K_ALEN
) && (*bufp
!= '\0')) {
123 fprintf(stderr
, _("in_fddi(%s): trailing junk!\n"), orig
);
129 fprintf(stderr
, "in_fddi(%s): %s\n", orig
, pr_fddi(sap
->sa_data
));
136 struct hwtype fddi_hwtype
=
138 "fddi", NULL
, /*"Fiber Distributed Data Interface (FDDI)", */ ARPHRD_FDDI
, FDDI_K_ALEN
,
139 pr_fddi
, in_fddi
, NULL
143 #endif /* HAVE_HWFDDI */