diff options
-rw-r--r-- | Makefile | 6 | ||||
-rw-r--r-- | include/arpa/ftp.h | 109 | ||||
-rw-r--r-- | include/arpa/inet.h | 101 | ||||
-rw-r--r-- | include/arpa/nameser.h | 64 | ||||
-rw-r--r-- | include/arpa/telnet.h | 11 | ||||
-rw-r--r-- | include/arpa/tftp.h | 4 | ||||
-rw-r--r-- | include/netinet/ether.h | 54 | ||||
-rw-r--r-- | include/netinet/icmp6.h | 232 | ||||
-rw-r--r-- | include/netinet/if_ether.h | 109 | ||||
-rw-r--r-- | include/netinet/if_fddi.h | 37 | ||||
-rw-r--r-- | include/netinet/if_tr.h | 41 | ||||
-rw-r--r-- | include/netinet/igmp.h | 95 | ||||
-rw-r--r-- | include/netinet/in.h | 289 | ||||
-rw-r--r-- | include/netinet/in_systm.h | 42 | ||||
-rw-r--r-- | include/netinet/ip.h | 291 | ||||
-rw-r--r-- | include/netinet/ip6.h | 106 | ||||
-rw-r--r-- | include/netinet/ip_icmp.h | 288 | ||||
-rw-r--r-- | include/netinet/tcp.h | 167 | ||||
-rw-r--r-- | include/netinet/udp.h | 56 | ||||
-rw-r--r-- | include/regex.h | 3754 | ||||
-rw-r--r-- | include/regexp.h | 241 | ||||
-rw-r--r-- | include/stdlib.h | 25 | ||||
-rw-r--r-- | include/sys/kd.h | 29 | ||||
-rw-r--r-- | include/sys/klog.h | 34 | ||||
-rw-r--r-- | include/sys/mtio.h | 277 | ||||
-rw-r--r-- | libc/misc/regex/Makefile | 17 | ||||
-rw-r--r-- | libc/misc/regex/rx.c | 7522 | ||||
-rw-r--r-- | libc/stdlib/Makefile | 2 | ||||
-rw-r--r-- | libc/stdlib/realpath.c | 168 |
29 files changed, 14004 insertions, 167 deletions
@@ -1,4 +1,4 @@ -DIRS = headers error getent malloc-simple misc regexp stdio2 \ +DIRS = headers error getent malloc-simple misc regex stdio2 \ string sysdeps termios time #rpc all: libc.a @@ -29,8 +29,8 @@ misc: dummy net: dummy make -C net -regexp: dummy - make -C regexp +regex: dummy + make -C regex rpc: dummy make -C rpc diff --git a/include/arpa/ftp.h b/include/arpa/ftp.h new file mode 100644 index 000000000..ac864aa70 --- /dev/null +++ b/include/arpa/ftp.h @@ -0,0 +1,109 @@ +/* + * Copyright (c) 1983, 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ftp.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef _ARPA_FTP_H +#define _ARPA_FTP_H 1 + +/* Definitions for FTP; see RFC-765. */ + +/* + * Reply codes. + */ +#define PRELIM 1 /* positive preliminary */ +#define COMPLETE 2 /* positive completion */ +#define CONTINUE 3 /* positive intermediate */ +#define TRANSIENT 4 /* transient negative completion */ +#define ERROR 5 /* permanent negative completion */ + +/* + * Type codes + */ +#define TYPE_A 1 /* ASCII */ +#define TYPE_E 2 /* EBCDIC */ +#define TYPE_I 3 /* image */ +#define TYPE_L 4 /* local byte size */ + +#ifdef FTP_NAMES +char *typenames[] = {"0", "ASCII", "EBCDIC", "Image", "Local" }; +#endif + +/* + * Form codes + */ +#define FORM_N 1 /* non-print */ +#define FORM_T 2 /* telnet format effectors */ +#define FORM_C 3 /* carriage control (ASA) */ +#ifdef FTP_NAMES +char *formnames[] = {"0", "Nonprint", "Telnet", "Carriage-control" }; +#endif + +/* + * Structure codes + */ +#define STRU_F 1 /* file (no record structure) */ +#define STRU_R 2 /* record structure */ +#define STRU_P 3 /* page structure */ +#ifdef FTP_NAMES +char *strunames[] = {"0", "File", "Record", "Page" }; +#endif + +/* + * Mode types + */ +#define MODE_S 1 /* stream */ +#define MODE_B 2 /* block */ +#define MODE_C 3 /* compressed */ +#ifdef FTP_NAMES +char *modenames[] = {"0", "Stream", "Block", "Compressed" }; +#endif + +/* + * Record Tokens + */ +#define REC_ESC '\377' /* Record-mode Escape */ +#define REC_EOR '\001' /* Record-mode End-of-Record */ +#define REC_EOF '\002' /* Record-mode End-of-File */ + +/* + * Block Header + */ +#define BLK_EOR 0x80 /* Block is End-of-Record */ +#define BLK_EOF 0x40 /* Block is End-of-File */ +#define BLK_ERRORS 0x20 /* Block is suspected of containing errors */ +#define BLK_RESTART 0x10 /* Block is Restart Marker */ + +#define BLK_BYTECOUNT 2 /* Bytes in this block */ + +#endif /* arpa/ftp.h */ diff --git a/include/arpa/inet.h b/include/arpa/inet.h index cf4cd3275..e34c4726a 100644 --- a/include/arpa/inet.h +++ b/include/arpa/inet.h @@ -1,12 +1,95 @@ -#ifndef __ARPA_INET_H -#define __ARPA_INET_H +/* Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. -#include <netinet/in.h> + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. -int inet_aton(const char *cp, struct in_addr *inp); - -unsigned long int inet_addr(const char *cp); + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. -char *inet_ntoa(struct in_addr in); - -#endif + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _ARPA_INET_H +#define _ARPA_INET_H 1 + +#include <features.h> + +#include <sys/types.h> +#include <netinet/in.h> /* To define `struct in_addr'. */ + +__BEGIN_DECLS + +/* Convert Internet host address from numbers-and-dots notation in CP + into binary data in network byte order. */ +extern u_int32_t inet_addr __P ((__const char *__cp)); + +/* Convert Internet host address from numbers-and-dots notation in CP + into binary data and store the result in the structure INP. */ +extern int inet_aton __P ((__const char *__cp, struct in_addr *__inp)); + +/* Return the local host address part of the Internet address in IN. */ +extern u_int32_t inet_lnaof __P ((struct in_addr __in)); + +/* Make Internet host address in network byte order by combining the + network number NET with the local address HOST. */ +extern struct in_addr inet_makeaddr __P ((u_int32_t __net, u_int32_t __host)); + +/* Format a network number NET into presentation format and place result + in buffer starting at BUF with length of LEN bytes. */ +extern char *inet_neta __P ((u_int32_t __net, char *__buf, size_t __len)); + +/* Return network number part of the Internet address IN. */ +extern u_int32_t inet_netof __P ((struct in_addr __in)); + +/* Extract the network number in network byte order from the address + in numbers-and-dots natation starting at CP. */ +extern u_int32_t inet_network __P ((__const char *__cp)); + +/* Convert network number for interface type AF in buffer starting at + CP to presentation format. The result will specifiy BITS bits of + the number. */ +extern char *inet_net_ntop __P ((int __af, __const void *__cp, int __bits, + char *__buf, size_t __len)); + +/* Convert network number for interface type AF from presentation in + buffer starting at CP to network format and store result int + buffer starting at BUF of size LEN. */ +extern int inet_net_pton __P ((int __af, __const char *__cp, + void *__buf, size_t __len)); + +/* Convert Internet number in IN to ASCII representation. The return value + is a pointer to an internal array containing the string. */ +extern char *inet_ntoa __P ((struct in_addr __in)); + +/* Convert from presentation format of an Internet number in buffer + starting at CP to the binary network format and store result for + interface type AF in buffer starting at BUF. */ +extern int inet_pton __P ((int __af, __const char *__cp, void *__buf)); + +/* Convert a Internet address in binary network format for interface + type AF in buffer starting at CP to presentation form and place + result in buffer of length LEN astarting at BUF. */ +extern __const char *inet_ntop __P ((int __af, __const void *__cp, + char *__buf, size_t __len)); + +/* Convert ASCII representation in hexadecimal form of the Internet + address to binary form and place result in buffer of length LEN + starting at BUF. */ +extern unsigned int inet_nsap_addr __P ((__const char *__cp, + unsigned char *__buf, int __len)); + +/* Convert internet address in binary form in LEN bytes starting at CP + a presentation form and place result in BUF. */ +extern char *inet_nsap_ntoa __P ((int __len, __const unsigned char *__cp, + char *__buf)); + +__END_DECLS + +#endif /* arpa/inet.h */ diff --git a/include/arpa/nameser.h b/include/arpa/nameser.h index e88ad8226..4a8ef67c7 100644 --- a/include/arpa/nameser.h +++ b/include/arpa/nameser.h @@ -77,23 +77,15 @@ /* * @(#)nameser.h 8.1 (Berkeley) 6/2/93 - * $Id: nameser.h,v 1.2 2000/05/14 06:07:30 erik Exp $ + * $Id: nameser.h,v 1.3 2000/07/09 06:39:14 andersen Exp $ */ -#ifndef _NAMESER_H_ -#define _NAMESER_H_ +#ifndef _ARPA_NAMESER_H +#define _ARPA_NAMESER_H 1 +#include <features.h> #include <sys/param.h> -#if (!defined(BSD)) || (BSD < 199306) -# include <sys/bitypes.h> -#else -# include <sys/types.h> -#endif -#include <sys/cdefs.h> - -#ifdef _AUX_SOURCE -# include <sys/types.h> -#endif +#include <sys/types.h> /* * revision information. this is the release date in YYYYMMDD format. @@ -254,46 +246,10 @@ #define CONV_BADCKSUM (-3) #define CONV_BADBUFLEN (-4) -#ifndef BYTE_ORDER -#if (BSD >= 199103) -# include <machine/endian.h> -#else -#ifdef __linux__ -# include <endian.h> -#else -#define LITTLE_ENDIAN 1234 /* least-significant byte first (vax, pc) */ -#define BIG_ENDIAN 4321 /* most-significant byte first (IBM, net) */ -#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long (pdp)*/ +/* glibc always has byte order info in <endian.h> */ +#include <endian.h> -#if defined(vax) || defined(ns32000) || defined(sun386) || defined(i386) || \ - defined(MIPSEL) || defined(_MIPSEL) || defined(BIT_ZERO_ON_RIGHT) || \ - defined(__alpha__) || defined(__alpha) -#define BYTE_ORDER LITTLE_ENDIAN -#endif - -#if defined(sel) || defined(pyr) || defined(mc68000) || defined(sparc) || \ - defined(is68k) || defined(tahoe) || defined(ibm032) || defined(ibm370) || \ - defined(MIPSEB) || defined(_MIPSEB) || defined(_IBMR2) || defined(DGUX) ||\ - defined(apollo) || defined(__convex__) || defined(_CRAY) || \ - defined(__hppa) || defined(__hp9000) || \ - defined(__hp9000s300) || defined(__hp9000s700) || \ - defined (BIT_ZERO_ON_LEFT) || defined(m68k) -#define BYTE_ORDER BIG_ENDIAN -#endif -#endif /* __linux__ */ -#endif /* BSD */ -#endif /* BYTE_ORDER */ - -#if !defined(BYTE_ORDER) || \ - (BYTE_ORDER != BIG_ENDIAN && BYTE_ORDER != LITTLE_ENDIAN && \ - BYTE_ORDER != PDP_ENDIAN) - /* you must determine what the correct bit order is for - * your compiler - the next line is an intentional error - * which will force your compiles to bomb until you fix - * the above macros. - */ - error "Undefined or invalid BYTE_ORDER"; -#endif +__BEGIN_DECLS /* * Structure for query header. The order of the fields is machine- and @@ -389,4 +345,6 @@ extern u_int32_t _getlong __P((const u_char *)); (cp) += INT32SZ; \ } -#endif /* !_NAMESER_H_ */ +__END_DECLS + +#endif /* arpa/nameser.h */ diff --git a/include/arpa/telnet.h b/include/arpa/telnet.h index 25085b89a..3309e5d72 100644 --- a/include/arpa/telnet.h +++ b/include/arpa/telnet.h @@ -34,7 +34,7 @@ */ #ifndef _ARPA_TELNET_H -#define _ARPA_TELNET_H +#define _ARPA_TELNET_H 1 /* * Definitions for the TELNET protocol. @@ -96,7 +96,7 @@ extern char *telcmds[]; #define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */ #define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */ #define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */ -#define TELOPT_XASCII 17 /* extended ascic character set */ +#define TELOPT_XASCII 17 /* extended ascii character set */ #define TELOPT_LOGOUT 18 /* force logout */ #define TELOPT_BM 19 /* byte macro */ #define TELOPT_DET 20 /* data entry terminal */ @@ -200,7 +200,7 @@ char *telopts[NTELOPTS+1] = { #define NSLC 18 /* - * For backwards compatability, we define SLC_NAMES to be the + * For backwards compatibility, we define SLC_NAMES to be the * list of names if SLC_NAMES is not defined. */ #define SLC_NAMELIST "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \ @@ -237,7 +237,7 @@ extern char *slc_names[]; #define NEW_ENV_VAR 0 #define NEW_ENV_VALUE 1 #define ENV_ESC 2 -#define ENV_USERVAR 3 +#define ENV_USERVAR 3 /* * AUTHENTICATION suboptions @@ -316,4 +316,5 @@ extern char *enctype_names[]; #define ENCTYPE_NAME_OK(x) ((unsigned int)(x) < ENCTYPE_CNT) #define ENCTYPE_NAME(x) enctype_names[x] -#endif /* _ARPA_TELNET_H */ + +#endif /* arpa/telnet.h */ diff --git a/include/arpa/tftp.h b/include/arpa/tftp.h index 0904407c7..69187da08 100644 --- a/include/arpa/tftp.h +++ b/include/arpa/tftp.h @@ -56,9 +56,9 @@ struct tftphdr { unsigned short tu_block; /* block # */ short tu_code; /* error code */ char tu_stuff[1]; /* request packet stuff */ - } th_u; + } __attribute__ ((__packed__)) th_u; char th_data[1]; /* data or error string */ -}; +} __attribute__ ((__packed__)); #define th_block th_u.tu_block #define th_code th_u.tu_code diff --git a/include/netinet/ether.h b/include/netinet/ether.h new file mode 100644 index 000000000..c7985d7ac --- /dev/null +++ b/include/netinet/ether.h @@ -0,0 +1,54 @@ +/* Functions for storing Ethernet addresses in ASCII and mapping to hostnames. + Copyright (C) 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _NETINET_ETHER_H +#define _NETINET_ETHER_H 1 + +#include <features.h> + +/* Get definition of `struct ether_addr'. */ +#include <netinet/if_ether.h> + +__BEGIN_DECLS + +/* Convert 48 bit Ethernet ADDRess to ASCII. */ +extern char *ether_ntoa __P ((__const struct ether_addr *__addr)); +extern char *ether_ntoa_r __P ((__const struct ether_addr *__addr, + char *__buf)); + +/* Convert ASCII string S to 48 bit Ethernet address. */ +extern struct ether_addr *ether_aton __P ((__const char *__asc)); +extern struct ether_addr *ether_aton_r __P ((__const char *__asc, + struct ether_addr *__addr)); + +/* Map 48 bit Ethernet number ADDR to HOSTNAME. */ +extern int ether_ntohost __P ((char *__hostname, + __const struct ether_addr *__addr)); + +/* Map HOSTNAME to 48 bit Ethernet address. */ +extern int ether_hostton __P ((__const char *__hostname, + struct ether_addr *__addr)); + +/* Scan LINE and set ADDR and HOSTNAME. */ +extern int ether_line __P ((__const char *__line, struct ether_addr *__addr, + char *__hostname)); + +__END_DECLS + +#endif /* netinet/ether.h */ diff --git a/include/netinet/icmp6.h b/include/netinet/icmp6.h new file mode 100644 index 000000000..5a3863953 --- /dev/null +++ b/include/netinet/icmp6.h @@ -0,0 +1,232 @@ +/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _NETINET_ICMP6_H +#define _NETINET_ICMP6_H 1 + +#include <inttypes.h> +#include <string.h> +#include <sys/types.h> +#include <netinet/in.h> + +#define ICMP6_FILTER 1 + +#define ICMP6_FILTER_BLOCK 1 +#define ICMP6_FILTER_PASS 2 +#define ICMP6_FILTER_BLOCKOTHERS 3 +#define ICMP6_FILTER_PASSONLY 4 + +struct icmp6_filter + { + uint32_t data[8]; + }; + +struct icmp6_hdr + { + uint8_t icmp6_type; /* type field */ + uint8_t icmp6_code; /* code field */ + uint16_t icmp6_cksum; /* checksum field */ + union + { + uint32_t icmp6_un_data32[1]; /* type-specific field */ + uint16_t icmp6_un_data16[2]; /* type-specific field */ + uint8_t icmp6_un_data8[4]; /* type-specific field */ + } icmp6_dataun; + }; + +#define icmp6_data32 icmp6_dataun.icmp6_un_data32 +#define icmp6_data16 icmp6_dataun.icmp6_un_data16 +#define icmp6_data8 icmp6_dataun.icmp6_un_data8 +#define icmp6_pptr icmp6_data32[0] /* parameter prob */ +#define icmp6_mtu icmp6_data32[0] /* packet too big */ +#define icmp6_id icmp6_data16[0] /* echo request/reply */ +#define icmp6_seq icmp6_data16[1] /* echo request/reply */ +#define icmp6_maxdelay icmp6_data16[0] /* mcast group membership */ + +#define ICMP6_DST_UNREACH 1 +#define ICMP6_PACKET_TOO_BIG 2 +#define ICMP6_TIME_EXCEEDED 3 +#define ICMP6_PARAM_PROB 4 + +#define ICMP6_INFOMSG_MASK 0x80 /* all informational messages */ + +#define ICMP6_ECHO_REQUEST 128 +#define ICMP6_ECHO_REPLY 129 +#define ICMP6_MEMBERSHIP_QUERY 130 +#define ICMP6_MEMBERSHIP_REPORT 131 +#define ICMP6_MEMBERSHIP_REDUCTION 132 + +#define ICMP6_DST_UNREACH_NOROUTE 0 /* no route to destination */ +#define ICMP6_DST_UNREACH_ADMIN 1 /* communication with destination */ + /* administratively prohibited */ +#define ICMP6_DST_UNREACH_NOTNEIGHBOR 2 /* not a neighbor */ +#define ICMP6_DST_UNREACH_ADDR 3 /* address unreachable */ +#define ICMP6_DST_UNREACH_NOPORT 4 /* bad port */ + +#define ICMP6_TIME_EXCEED_TRANSIT 0 /* Hop Limit == 0 in transit */ +#define ICMP6_TIME_EXCEED_REASSEMBLY 1 /* Reassembly time out */ + +#define ICMP6_PARAMPROB_HEADER 0 /* erroneous header field */ +#define ICMP6_PARAMPROB_NEXTHEADER 1 /* unrecognized Next Header */ +#define ICMP6_PARAMPROB_OPTION 2 /* unrecognized IPv6 option */ + +#define ICMP6_FILTER_WILLPASS(type, filterp) \ + ((((filterp)->data[(type) >> 5]) & (1 << ((type) & 31))) == 0) + +#define ICMP6_FILTER_WILLBLOCK(type, filterp) \ + ((((filterp)->data[(type) >> 5]) & (1 << ((type) & 31))) != 0) + +#define ICMP6_FILTER_SETPASS(type, filterp) \ + ((((filterp)->data[(type) >> 5]) &= ~(1 << ((type) & 31)))) + +#define ICMP6_FILTER_SETBLOCK(type, filterp) \ + ((((filterp)->data[(type) >> 5]) |= (1 << ((type) & 31)))) + +#define ICMP6_FILTER_SETPASSALL(filterp) \ + memset (filterp, 0, sizeof (struct icmp6_filter)); + +#define ICMP6_FILTER_SETBLOCKALL(filterp) \ + memset (filterp, 0xFF, sizeof (struct icmp6_filter)); + +#define ND_ROUTER_SOLICIT 133 +#define ND_ROUTER_ADVERT 134 +#define ND_NEIGHBOR_SOLICIT 135 +#define ND_NEIGHBOR_ADVERT 136 +#define ND_REDIRECT 137 + +struct nd_router_solicit /* router solicitation */ + { + struct icmp6_hdr nd_rs_hdr; + /* could be followed by options */ + }; + +#define nd_rs_type nd_rs_hdr.icmp6_type +#define nd_rs_code nd_rs_hdr.icmp6_code +#define nd_rs_cksum nd_rs_hdr.icmp6_cksum +#define nd_rs_reserved nd_rs_hdr.icmp6_data32[0] + +struct nd_router_advert /* router advertisement */ + { + struct icmp6_hdr nd_ra_hdr; + uint32_t nd_ra_reachable; /* reachable time */ + uint32_t nd_ra_retransmit; /* retransmit timer */ + /* could be followed by options */ + }; + +#define nd_ra_type nd_ra_hdr.icmp6_type +#define nd_ra_code nd_ra_hdr.icmp6_code +#define nd_ra_cksum nd_ra_hdr.icmp6_cksum +#define nd_ra_curhoplimit nd_ra_hdr.icmp6_data8[0] +#define nd_ra_flags_reserved nd_ra_hdr.icmp6_data8[1] +#define ND_RA_FLAG_MANAGED 0x80 +#define ND_RA_FLAG_OTHER 0x40 +#define nd_ra_router_lifetime nd_ra_hdr.icmp6_data16[1] + +struct nd_neighbor_solicit /* neighbor solicitation */ + { + struct icmp6_hdr nd_ns_hdr; + struct in6_addr nd_ns_target; /* target address */ + /* could be followed by options */ + }; + +#define nd_ns_type nd_ns_hdr.icmp6_type +#define nd_ns_code nd_ns_hdr.icmp6_code +#define nd_ns_cksum nd_ns_hdr.icmp6_cksum +#define nd_ns_reserved nd_ns_hdr.icmp6_data32[0] + +struct nd_neighbor_advert /* neighbor advertisement */ + { + struct icmp6_hdr nd_na_hdr; + struct in6_addr nd_na_target; /* target address */ + /* could be followed by options */ + }; + +#define nd_na_type nd_na_hdr.icmp6_type +#define nd_na_code nd_na_hdr.icmp6_code +#define nd_na_cksum nd_na_hdr.icmp6_cksum +#define nd_na_flags_reserved nd_na_hdr.icmp6_data32[0] +#if BYTE_ORDER == BIG_ENDIAN +#define ND_NA_FLAG_ROUTER 0x80000000 +#define ND_NA_FLAG_SOLICITED 0x40000000 +#define ND_NA_FLAG_OVERRIDE 0x20000000 +#else /* BYTE_ORDER == LITTLE_ENDIAN */ +#define ND_NA_FLAG_ROUTER 0x00000080 +#define ND_NA_FLAG_SOLICITED 0x00000040 +#define ND_NA_FLAG_OVERRIDE 0x00000020 +#endif + +struct nd_redirect /* redirect */ + { + struct icmp6_hdr nd_rd_hdr; + struct in6_addr nd_rd_target; /* target address */ + struct in6_addr nd_rd_dst; /* destination address */ + /* could be followed by options */ + }; + +#define nd_rd_type nd_rd_hdr.icmp6_type +#define nd_rd_code nd_rd_hdr.icmp6_code +#define nd_rd_cksum nd_rd_hdr.icmp6_cksum +#define nd_rd_reserved nd_rd_hdr.icmp6_data32[0] + +struct nd_opt_hdr /* Neighbor discovery option header */ + { + uint8_t nd_opt_type; + uint8_t nd_opt_len; /* in units of 8 octets */ + /* followed by option specific data */ + }; + +#define ND_OPT_SOURCE_LINKADDR 1 +#define ND_OPT_TARGET_LINKADDR 2 +#define ND_OPT_PREFIX_INFORMATION 3 +#define ND_OPT_REDIRECTED_HEADER 4 +#define ND_OPT_MTU 5 + +struct nd_opt_prefix_info /* prefix information */ + { + uint8_t nd_opt_pi_type; + uint8_t nd_opt_pi_len; + uint8_t nd_opt_pi_prefix_len; + uint8_t nd_opt_pi_flags_reserved; + uint32_t nd_opt_pi_valid_time; + uint32_t nd_opt_pi_preferred_time; + uint32_t nd_opt_pi_reserved2; + struct in6_addr nd_opt_pi_prefix; + }; + +#define ND_OPT_PI_FLAG_ONLINK 0x80 +#define ND_OPT_PI_FLAG_AUTO 0x40 + +struct nd_opt_rd_hdr /* redirected header */ + { + uint8_t nd_opt_rh_type; + uint8_t nd_opt_rh_len; + uint16_t nd_opt_rh_reserved1; + uint32_t nd_opt_rh_reserved2; + /* followed by IP header and data */ + }; + +struct nd_opt_mtu /* MTU option */ + { + uint8_t nd_opt_mtu_type; + uint8_t nd_opt_mtu_len; + uint16_t nd_opt_mtu_reserved; + uint32_t nd_opt_mtu_mtu; + }; + + +#endif /* netinet/icmpv6.h */ diff --git a/include/netinet/if_ether.h b/include/netinet/if_ether.h new file mode 100644 index 000000000..7194490f5 --- /dev/null +++ b/include/netinet/if_ether.h @@ -0,0 +1,109 @@ +/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef __NETINET_IF_ETHER_H + +#define __NETINET_IF_ETHER_H 1 +#include <features.h> +#include <sys/types.h> + +/* Get definitions from kernel header file. */ +#include <linux/if_ether.h> + +#ifdef __USE_BSD +/* + * Copyright (c) 1982, 1986, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)if_ether.h 8.3 (Berkeley) 5/2/95 + * $FreeBSD$ + */ + +#include <net/ethernet.h> +#include <net/if_arp.h> + +__BEGIN_DECLS +/* + * Ethernet Address Resolution Protocol. + * + * See RFC 826 for protocol description. Structure below is adapted + * to resolving internet addresses. Field names used correspond to + * RFC 826. + */ +struct ether_arp { + struct arphdr ea_hdr; /* fixed-size header */ + u_int8_t arp_sha[ETH_ALEN]; /* sender hardware address */ + u_int8_t arp_spa[4]; /* sender protocol address */ + u_int8_t arp_tha[ETH_ALEN]; /* target hardware address */ + u_int8_t arp_tpa[4]; /* target protocol address */ +}; +#define arp_hrd ea_hdr.ar_hrd +#define arp_pro ea_hdr.ar_pro +#define arp_hln ea_hdr.ar_hln +#define arp_pln ea_hdr.ar_pln +#define arp_op ea_hdr.ar_op + +/* + * Macro to map an IP multicast address to an Ethernet multicast address. + * The high-order 25 bits of the Ethernet address are statically assigned, + * and the low-order 23 bits are taken from the low end of the IP address. + */ +#define ETHER_MAP_IP_MULTICAST(ipaddr, enaddr) \ + /* struct in_addr *ipaddr; */ \ + /* u_char enaddr[ETH_ALEN]; */ \ +{ \ + (enaddr)[0] = 0x01; \ + (enaddr)[1] = 0x00; \ + (enaddr)[2] = 0x5e; \ + (enaddr)[3] = ((u_int8_t *)ipaddr)[1] & 0x7f; \ + (enaddr)[4] = ((u_int8_t *)ipaddr)[2]; \ + (enaddr)[5] = ((u_int8_t *)ipaddr)[3]; \ +} + +__END_DECLS +#endif /* __USE_BSD */ + +#endif /* netinet/if_ether.h */ diff --git a/include/netinet/if_fddi.h b/include/netinet/if_fddi.h new file mode 100644 index 000000000..d5d6dbdbe --- /dev/null +++ b/include/netinet/if_fddi.h @@ -0,0 |