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 const char *pr_fddi(const 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)
66 /* Input an FDDI address and convert to binary. */
67 static int in_fddi(char *bufp, struct sockaddr *sap)
73 sap->sa_family = fddi_hwtype.type;
78 while ((*bufp != '\0') && (i < FDDI_K_ALEN)) {
83 else if (c >= 'a' && c <= 'f')
85 else if (c >= 'A' && c <= 'F')
89 fprintf(stderr, _("in_fddi(%s): invalid fddi address!\n"), orig);
97 else if (c >= 'a' && c <= 'f')
99 else if (c >= 'A' && c <= 'F')
103 fprintf(stderr, _("in_fddi(%s): invalid fddi address!\n"), orig);
107 *ptr++ = (unsigned char) (val & 0377);
110 /* We might get a semicolon here - not required. */
112 if (_DEBUG && i == FDDI_K_ALEN)
113 fprintf(stderr, _("in_fddi(%s): trailing : ignored!\n"),
119 /* That's it. Any trailing junk? */
120 if (_DEBUG && (i == FDDI_K_ALEN) && (*bufp != '\0')) {
121 fprintf(stderr, _("in_fddi(%s): trailing junk!\n"), orig);
126 fprintf(stderr, "in_fddi(%s): %s\n", orig, pr_fddi(sap->sa_data));
132 struct hwtype fddi_hwtype =
134 "fddi", NULL, /*"Fiber Distributed Data Interface (FDDI)", */ ARPHRD_FDDI, FDDI_K_ALEN,
135 pr_fddi, in_fddi, NULL
139 #endif /* HAVE_HWFDDI */