diff options
Diffstat (limited to 'newlib/libc/sys/linux/include')
-rw-r--r-- | newlib/libc/sys/linux/include/arpa/nameser.h | 174 | ||||
-rw-r--r-- | newlib/libc/sys/linux/include/hesiod.h | 102 | ||||
-rw-r--r-- | newlib/libc/sys/linux/include/libc_private.h | 72 | ||||
-rw-r--r-- | newlib/libc/sys/linux/include/net/ethernet.h | 166 | ||||
-rw-r--r-- | newlib/libc/sys/linux/include/net/if_atm.h | 107 | ||||
-rw-r--r-- | newlib/libc/sys/linux/include/net/if_media.h | 409 | ||||
-rw-r--r-- | newlib/libc/sys/linux/include/net/if_ppp.h | 148 | ||||
-rw-r--r-- | newlib/libc/sys/linux/include/net/if_pppvar.h | 109 | ||||
-rw-r--r-- | newlib/libc/sys/linux/include/netdb.h | 50 | ||||
-rw-r--r-- | newlib/libc/sys/linux/include/netinet/if_atm.h | 47 | ||||
-rw-r--r-- | newlib/libc/sys/linux/include/netinet/if_ether.h | 3 | ||||
-rw-r--r-- | newlib/libc/sys/linux/include/netinet/ip_flow.h | 57 | ||||
-rw-r--r-- | newlib/libc/sys/linux/include/nsswitch.h | 184 | ||||
-rw-r--r-- | newlib/libc/sys/linux/include/resolv.h | 115 | ||||
-rw-r--r-- | newlib/libc/sys/linux/include/sched.h | 3 | ||||
-rw-r--r-- | newlib/libc/sys/linux/include/stdint.h | 29 |
16 files changed, 1324 insertions, 451 deletions
diff --git a/newlib/libc/sys/linux/include/arpa/nameser.h b/newlib/libc/sys/linux/include/arpa/nameser.h index 6209afdf7..8735b8bd3 100644 --- a/newlib/libc/sys/linux/include/arpa/nameser.h +++ b/newlib/libc/sys/linux/include/arpa/nameser.h @@ -202,11 +202,7 @@ typedef enum __ns_rcode { ns_r_nxrrset = 8, /* RRset does not exist */ ns_r_notauth = 9, /* Not authoritative for zone */ ns_r_notzone = 10, /* Zone of record different from zone section */ - ns_r_max = 11, - /* The following are TSIG extended errors */ - ns_r_badsig = 16, - ns_r_badkey = 17, - ns_r_badtime = 18 + ns_r_max = 11 } ns_rcode; /* BIND_UPDATE */ @@ -217,104 +213,6 @@ typedef enum __ns_update_operation { } ns_update_operation; /* - * * This structure is used for TSIG authenticated messages - * */ -struct ns_tsig_key { - char name[NS_MAXDNAME], alg[NS_MAXDNAME]; - unsigned char *data; - int len; -}; -typedef struct ns_tsig_key ns_tsig_key; - -/* - * * This structure is used for TSIG authenticated TCP messages - * */ -struct ns_tcp_tsig_state { - int counter; - struct dst_key *key; - void *ctx; - unsigned char sig[NS_PACKETSZ]; - int siglen; -}; -typedef struct ns_tcp_tsig_state ns_tcp_tsig_state; - -#define NS_TSIG_FUDGE 300 -#define NS_TSIG_TCP_COUNT 100 -#define NS_TSIG_ALG_HMAC_MD5 "HMAC-MD5.SIG-ALG.REG.INT" - -#define NS_TSIG_ERROR_NO_TSIG -10 -#define NS_TSIG_ERROR_NO_SPACE -11 -#define NS_TSIG_ERROR_FORMERR -12 - -/* - * Currently defined type values for resources and queries. - */ -typedef enum __ns_type { - ns_t_invalid = 0, /* Cookie. */ - ns_t_a = 1, /* Host address. */ - ns_t_ns = 2, /* Authoritative server. */ - ns_t_md = 3, /* Mail destination. */ - ns_t_mf = 4, /* Mail forwarder. */ - ns_t_cname = 5, /* Canonical name. */ - ns_t_soa = 6, /* Start of authority zone. */ - ns_t_mb = 7, /* Mailbox domain name. */ - ns_t_mg = 8, /* Mail group member. */ - ns_t_mr = 9, /* Mail rename name. */ - ns_t_null = 10, /* Null resource record. */ - ns_t_wks = 11, /* Well known service. */ - ns_t_ptr = 12, /* Domain name pointer. */ - ns_t_hinfo = 13, /* Host information. */ - ns_t_minfo = 14, /* Mailbox information. */ - ns_t_mx = 15, /* Mail routing information. */ - ns_t_txt = 16, /* Text strings. */ - ns_t_rp = 17, /* Responsible person. */ - ns_t_afsdb = 18, /* AFS cell database. */ - ns_t_x25 = 19, /* X_25 calling address. */ - ns_t_isdn = 20, /* ISDN calling address. */ - ns_t_rt = 21, /* Router. */ - ns_t_nsap = 22, /* NSAP address. */ - ns_t_nsap_ptr = 23, /* Reverse NSAP lookup (deprecated). */ - ns_t_sig = 24, /* Security signature. */ - ns_t_key = 25, /* Security key. */ - ns_t_px = 26, /* X.400 mail mapping. */ - ns_t_gpos = 27, /* Geographical position (withdrawn). */ - ns_t_aaaa = 28, /* Ip6 Address. */ - ns_t_loc = 29, /* Location Information. */ - ns_t_nxt = 30, /* Next domain (security). */ - ns_t_eid = 31, /* Endpoint identifier. */ - ns_t_nimloc = 32, /* Nimrod Locator. */ - ns_t_srv = 33, /* Server Selection. */ - ns_t_atma = 34, /* ATM Address */ - ns_t_naptr = 35, /* Naming Authority PoinTeR */ - ns_t_kx = 36, /* Key Exchange */ - ns_t_cert = 37, /* Certification record */ - ns_t_a6 = 38, /* IPv6 address (deprecates AAAA) */ - ns_t_dname = 39, /* Non-terminal DNAME (for IPv6) */ - ns_t_sink = 40, /* Kitchen sink (experimentatl) */ - ns_t_opt = 41, /* EDNS0 option (meta-RR) */ - ns_t_tsig = 250, /* Transaction signature. */ - ns_t_ixfr = 251, /* Incremental zone transfer. */ - ns_t_axfr = 252, /* Transfer zone of authority. */ - ns_t_mailb = 253, /* Transfer mailbox records. */ - ns_t_maila = 254, /* Transfer mail agent records. */ - ns_t_any = 255, /* Wildcard match. */ - ns_t_zxfr = 256, /* BIND-specific, nonstandard. */ - ns_t_max = 65536 -} ns_type; - -/* Exclusively a QTYPE? (not also an RTYPE) */ -#define ns_t_qt_p(t) (ns_t_xfr_p(t) || (t) == ns_t_any || \ - (t) == ns_t_mailb || (t) == ns_t_maila) -/* Some kind of meta-RR? (not a QTYPE, but also not an RTYPE) */ -#define ns_t_mrr_p(t) ((t) == ns_t_tsig || (t) == ns_t_opt) -/* Exclusively an RTYPE? (not also a QTYPE or a meta-RR) */ -#define ns_t_rr_p(t) (!ns_t_qt_p(t) && !ns_t_mrr_p(t)) -#define ns_t_udp_p(t) ((t) != ns_t_axfr && (t) != ns_t_zxfr) -#define ns_t_xfr_p(t) ((t) == ns_t_axfr || (t) == ns_t_ixfr || \ - (t) == ns_t_zxfr) - - -/* * This RR-like structure is particular to UPDATE. */ struct ns_updrec { @@ -336,6 +234,54 @@ struct ns_updrec { }; typedef struct ns_updrec ns_updrec; +/* + * Currently defined type values for resources and queries. + */ +typedef enum __ns_type { + ns_t_a = 1, /* Host address. */ + ns_t_ns = 2, /* Authoritative server. */ + ns_t_md = 3, /* Mail destination. */ + ns_t_mf = 4, /* Mail forwarder. */ + ns_t_cname = 5, /* Canonical name. */ + ns_t_soa = 6, /* Start of authority zone. */ + ns_t_mb = 7, /* Mailbox domain name. */ + ns_t_mg = 8, /* Mail group member. */ + ns_t_mr = 9, /* Mail rename name. */ + ns_t_null = 10, /* Null resource record. */ + ns_t_wks = 11, /* Well known service. */ + ns_t_ptr = 12, /* Domain name pointer. */ + ns_t_hinfo = 13, /* Host information. */ + ns_t_minfo = 14, /* Mailbox information. */ + ns_t_mx = 15, /* Mail routing information. */ + ns_t_txt = 16, /* Text strings. */ + ns_t_rp = 17, /* Responsible person. */ + ns_t_afsdb = 18, /* AFS cell database. */ + ns_t_x25 = 19, /* X_25 calling address. */ + ns_t_isdn = 20, /* ISDN calling address. */ + ns_t_rt = 21, /* Router. */ + ns_t_nsap = 22, /* NSAP address. */ + ns_t_nsap_ptr = 23, /* Reverse NSAP lookup (deprecated). */ + ns_t_sig = 24, /* Security signature. */ + ns_t_key = 25, /* Security key. */ + ns_t_px = 26, /* X.400 mail mapping. */ + ns_t_gpos = 27, /* Geographical position (withdrawn). */ + ns_t_aaaa = 28, /* Ip6 Address. */ + ns_t_loc = 29, /* Location Information. */ + ns_t_nxt = 30, /* Next domain (security). */ + ns_t_eid = 31, /* Endpoint identifier. */ + ns_t_nimloc = 32, /* Nimrod Locator. */ + ns_t_srv = 33, /* Server Selection. */ + ns_t_atma = 34, /* ATM Address */ + ns_t_naptr = 35, /* Naming Authority PoinTeR */ + ns_t_opt = 41, /* OPT pseudo-RR, RFC2761 */ + /* Query type values which do not appear in resource records. */ + ns_t_ixfr = 251, /* Incremental zone transfer. */ + ns_t_axfr = 252, /* Transfer zone of authority. */ + ns_t_mailb = 253, /* Transfer mailbox records. */ + ns_t_maila = 254, /* Transfer mail agent records. */ + ns_t_any = 255, /* Wildcard match. */ + ns_t_max = 65536 +} ns_type; /* * Values for class field @@ -351,24 +297,6 @@ typedef enum __ns_class { ns_c_max = 65536 } ns_class; -/* DNSSEC constants. */ - -typedef enum __ns_key_types { - ns_kt_rsa = 1, /* key type RSA/MD5 */ - ns_kt_dh = 2, /* Diffie Hellman */ - ns_kt_dsa = 3, /* Digital Signature Standard (MANDATORY) */ - ns_kt_private = 254 /* Private key type starts with OID */ -} ns_key_types; - -typedef enum __ns_cert_types { - cert_t_pkix = 1, /* PKIX (X.509v3) */ - cert_t_spki = 2, /* SPKI */ - cert_t_pgp = 3, /* PGP */ - cert_t_url = 253, /* URL private type */ - cert_t_oid = 254 /* OID private type */ -} ns_cert_types; - - /* * Flags field of the KEY RR rdata */ @@ -399,10 +327,6 @@ typedef enum __ns_cert_types { /* The Algorithm field of the KEY and SIG RR's is an integer, {1..254} */ #define NS_ALG_MD5RSA 1 /* MD5 with RSA */ -#define NS_ALG_DH 2 /* Diffie Hellman KEY */ -#define NS_ALG_DSA 3 /* DSA KEY */ -#define NS_ALG_DSS NS_ALG_DSA - #define NS_ALG_EXPIRE_ONLY 253 /* No alg, no security */ #define NS_ALG_PRIVATE_OID 254 /* Key begins with OID giving alg */ diff --git a/newlib/libc/sys/linux/include/hesiod.h b/newlib/libc/sys/linux/include/hesiod.h index 82fce3076..c7dbeee33 100644 --- a/newlib/libc/sys/linux/include/hesiod.h +++ b/newlib/libc/sys/linux/include/hesiod.h @@ -1,5 +1,42 @@ +/* $NetBSD: hesiod.h,v 1.3 1999/01/24 23:53:18 lukem Exp $ */ +/* $FreeBSD: src/include/hesiod.h,v 1.2 2002/03/23 17:24:53 imp Exp $ */ + + +/*- + * Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc. + * 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 NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ + /* - * Copyright (c) 1996,1999 by Internet Software Consortium. + * Copyright (c) 1996 by Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -15,26 +52,47 @@ * SOFTWARE. */ -/* - * This file is primarily maintained by <tytso@mit.edu> and <ghudson@mit.edu>. - */ +#ifndef _HESIOD_H_ +#define _HESIOD_H_ -/* - * $BINDId: hesiod.h,v 1.7 1999/01/08 19:22:45 vixie Exp $ - */ + /* Application-visible indication that we have the new interfaces */ + +#define HESIOD_INTERFACES + + /* Configuration information. */ + +#ifndef _PATH_HESIOD_CONF /* Configuration file. */ +#define _PATH_HESIOD_CONF "/etc/hesiod.conf" +#endif + +#define DEF_RHS "" /* Defaults if HESIOD_CONF */ +#define DEF_LHS "" /* file is not present. */ + + /* Error codes (for backwards compatibility) */ + +#define HES_ER_UNINIT -1 /* uninitialized */ +#define HES_ER_OK 0 /* no error */ +#define HES_ER_NOTFOUND 1 /* Hesiod name not found by server */ +#define HES_ER_CONFIG 2 /* local problem (no config file?) */ +#define HES_ER_NET 3 /* network problem */ + + /* Declaration of routines */ + +#include <sys/cdefs.h> + +__BEGIN_DECLS +int hesiod_init(void **); +char **hesiod_resolve(void *, const char *, const char *); +void hesiod_free_list(void *, char **); +char *hesiod_to_bind(void *, const char *, const char *); +void hesiod_end(void *); + + /* backwards compatibility */ +int hes_init(void); +char *hes_to_bind(const char *, const char *); +char **hes_resolve(const char *, const char *); +int hes_error(void); +void hes_free(char **); +__END_DECLS -#ifndef _HESIOD_H_INCLUDED -#define _HESIOD_H_INCLUDED - -int hesiod_init (void **context); -void hesiod_end (void *context); -char * hesiod_to_bind (void *context, const char *name, - const char *type); -char ** hesiod_resolve (void *context, const char *name, - const char *type); -void hesiod_free_list (void *context, char **list); -struct __res_state * __hesiod_res_get (void *context); -void __hesiod_res_set (void *context, struct __res_state *, - void (*)(void *)); - -#endif /*_HESIOD_H_INCLUDED*/ +#endif /* ! _HESIOD_H_ */ diff --git a/newlib/libc/sys/linux/include/libc_private.h b/newlib/libc/sys/linux/include/libc_private.h new file mode 100644 index 000000000..af7df8c8b --- /dev/null +++ b/newlib/libc/sys/linux/include/libc_private.h @@ -0,0 +1,72 @@ +/* + * Copyright (c) 1998 John Birrell <jb@cimlogic.com.au>. + * 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 John Birrell. + * 4. Neither the name of the author nor the names of any co-contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL 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. + * + * $FreeBSD: src/lib/libc/include/libc_private.h,v 1.5 2002/03/29 22:43:42 markm Exp $ + * + * Private definitions for libc, libc_r and libpthread. + * + */ + +#ifndef _LIBC_PRIVATE_H_ +#define _LIBC_PRIVATE_H_ + +/* + * This global flag is non-zero when a process has created one + * or more threads. It is used to avoid calling locking functions + * when they are not required. + */ +extern int __isthreaded; + +/* + * File lock contention is difficult to diagnose without knowing + * where locks were set. Allow a debug library to be built which + * records the source file and line number of each lock call. + */ +#ifdef _FLOCK_DEBUG +#define _FLOCKFILE(x) _flockfile_debug(x, __FILE__, __LINE__) +#else +#define _FLOCKFILE(x) _flockfile(x) +#endif + +/* + * Macros for locking and unlocking FILEs. These test if the + * process is threaded to avoid locking when not required. + */ +#define FLOCKFILE(fp) if (__isthreaded) _FLOCKFILE(fp) +#define FUNLOCKFILE(fp) if (__isthreaded) _funlockfile(fp) + +/* + * This is a pointer in the C run-time startup code. It is used + * by getprogname() and setprogname(). + */ +extern const char *__progname; + +#endif /* _LIBC_PRIVATE_H_ */ diff --git a/newlib/libc/sys/linux/include/net/ethernet.h b/newlib/libc/sys/linux/include/net/ethernet.h index 7ca8e8348..6b1d1c9be 100644 --- a/newlib/libc/sys/linux/include/net/ethernet.h +++ b/newlib/libc/sys/linux/include/net/ethernet.h @@ -1,66 +1,75 @@ -/* Copyright (C) 1997, 1999, 2001 Free Software Foundation, Inc. - This file is part of the GNU C Library. +/* + * Fundamental constants relating to ethernet. + * + * $FreeBSD: src/sys/net/ethernet.h,v 1.20 2002/04/04 05:42:09 luigi Exp $ + * + */ - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. +#ifndef _NET_ETHERNET_H_ +#define _NET_ETHERNET_H_ - 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 - Lesser General Public License for more details. +/* + * The number of bytes in an ethernet (MAC) address. + */ +#define ETHER_ADDR_LEN 6 - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ +/* + * The number of bytes in the type field. + */ +#define ETHER_TYPE_LEN 2 -/* Based on the FreeBSD version of this file. Curiously, that file - lacks a copyright in the header. */ +/* + * The number of bytes in the trailing CRC field. + */ +#define ETHER_CRC_LEN 4 -#ifndef __NET_ETHERNET_H -#define __NET_ETHERNET_H 1 +/* + * The length of the combined header. + */ +#define ETHER_HDR_LEN (ETHER_ADDR_LEN*2+ETHER_TYPE_LEN) -#include <sys/cdefs.h> -#include <sys/types.h> -#include <linux/if_ether.h> /* IEEE 802.3 Ethernet constants */ +/* + * The minimum packet length. + */ +#define ETHER_MIN_LEN 64 -__BEGIN_DECLS +/* + * The maximum packet length. + */ +#define ETHER_MAX_LEN 1518 -/* This is a name for the 48 bit ethernet address available on many - systems. */ -struct ether_addr -{ - u_int8_t ether_addr_octet[ETH_ALEN]; -} __attribute__ ((__packed__)); - -/* 10Mb/s ethernet header */ -struct ether_header -{ - u_int8_t ether_dhost[ETH_ALEN]; /* destination eth addr */ - u_int8_t ether_shost[ETH_ALEN]; /* source ether addr */ - u_int16_t ether_type; /* packet type ID field */ -} __attribute__ ((__packed__)); - -/* Ethernet protocol ID's */ -#define ETHERTYPE_PUP 0x0200 /* Xerox PUP */ -#define ETHERTYPE_IP 0x0800 /* IP */ -#define ETHERTYPE_ARP 0x0806 /* Address resolution */ -#define ETHERTYPE_REVARP 0x8035 /* Reverse ARP */ - -#define ETHER_ADDR_LEN ETH_ALEN /* size of ethernet addr */ -#define ETHER_TYPE_LEN 2 /* bytes in type field */ -#define ETHER_CRC_LEN 4 /* bytes in CRC field */ -#define ETHER_HDR_LEN ETH_HLEN /* total octets in header */ -#define ETHER_MIN_LEN (ETH_ZLEN + ETHER_CRC_LEN) /* min packet length */ -#define ETHER_MAX_LEN (ETH_FRAME_LEN + ETHER_CRC_LEN) /* max packet length */ - -/* make sure ethenet length is valid */ +/* + * A macro to validate a length with + */ #define ETHER_IS_VALID_LEN(foo) \ ((foo) >= ETHER_MIN_LEN && (foo) <= ETHER_MAX_LEN) /* + * Structure of a 10Mb/s Ethernet header. + */ +struct ether_header { + u_char ether_dhost[ETHER_ADDR_LEN]; + u_char ether_shost[ETHER_ADDR_LEN]; + u_short ether_type; +}; + +/* + * Structure of a 48-bit Ethernet address. + */ +struct ether_addr { + u_char octet[ETHER_ADDR_LEN]; +}; + +#define ETHERTYPE_PUP 0x0200 /* PUP protocol */ +#define ETHERTYPE_IP 0x0800 /* IP protocol */ +#define ETHERTYPE_ARP 0x0806 /* Addr. resolution protocol */ +#define ETHERTYPE_REVARP 0x8035 /* reverse Addr. resolution protocol */ +#define ETHERTYPE_VLAN 0x8100 /* IEEE 802.1Q VLAN tagging */ +#define ETHERTYPE_IPV6 0x86dd /* IPv6 */ +#define ETHERTYPE_LOOPBACK 0x9000 /* used to test interfaces */ +/* XXX - add more useful types here */ + +/* * The ETHERTYPE_NTRAILER packet types starting at ETHERTYPE_TRAIL have * (type-ETHERTYPE_TRAIL)*512 bytes of data followed * by an ETHER type (as given above) and then the (variable-length) header. @@ -68,9 +77,58 @@ struct ether_header #define ETHERTYPE_TRAIL 0x1000 /* Trailer packet */ #define ETHERTYPE_NTRAILER 16 -#define ETHERMTU ETH_DATA_LEN -#define ETHERMIN (ETHER_MIN_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN) +#define ETHERMTU (ETHER_MAX_LEN-ETHER_HDR_LEN-ETHER_CRC_LEN) +#define ETHERMIN (ETHER_MIN_LEN-ETHER_HDR_LEN-ETHER_CRC_LEN) +#ifdef _KERNEL + +/* + * For device drivers to specify whether they support BPF or not + */ +#define ETHER_BPF_UNSUPPORTED 0 +#define ETHER_BPF_SUPPORTED 1 + +struct ifnet; +struct mbuf; + +extern void (*ng_ether_input_p)(struct ifnet *ifp, + struct mbuf **mp, struct ether_header *eh); +extern void (*ng_ether_input_orphan_p)(struct ifnet *ifp, + struct mbuf *m, struct ether_header *eh); +extern int (*ng_ether_output_p)(struct ifnet *ifp, struct mbuf **mp); +extern void (*ng_ether_attach_p)(struct ifnet *ifp); +extern void (*ng_ether_detach_p)(struct ifnet *ifp); + +extern int (*vlan_input_p)(struct ether_header *eh, struct mbuf *m); +extern int (*vlan_input_tag_p)(struct ether_header *eh, struct mbuf *m, + u_int16_t t); + +#define VLAN_INPUT_TAG(eh, m, t) do { \ + /* XXX: lock */ \ + if (vlan_input_tag_p != NULL) \ + (*vlan_input_tag_p)(eh, m, t); \ + else { \ + (m)->m_pkthdr.rcvif->if_noproto++; \ + m_freem(m); \ + } \ + /* XXX: unlock */ \ +} while (0) + +#else /* _KERNEL */ + +#include <sys/cdefs.h> + +/* + * Ethernet address conversion/parsing routines. + */ +__BEGIN_DECLS +struct ether_addr *ether_aton(const char *); +int ether_hostton(const char *, struct ether_addr *); +int ether_line(const char *, struct ether_addr *, char *); +char *ether_ntoa(const struct ether_addr *); +int ether_ntohost(char *, const struct ether_addr *); __END_DECLS -#endif /* net/ethernet.h */ +#endif /* !_KERNEL */ + +#endif /* !_NET_ETHERNET_H_ */ diff --git a/newlib/libc/sys/linux/include/net/if_atm.h b/newlib/libc/sys/linux/include/net/if_atm.h new file mode 100644 index 000000000..c9ff107c0 --- /dev/null +++ b/newlib/libc/sys/linux/include/net/if_atm.h @@ -0,0 +1,107 @@ +/* $NetBSD: if_atm.h,v 1.7 1996/11/09 23:02:27 chuck Exp $ */ +/* $FreeBSD: src/sys/net/if_atm.h,v 1.5 2002/03/19 21:54:16 alfred Exp $ */ + +/* + * + * Copyright (c) 1996 Charles D. Cranor and Washington University. + * 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 Charles D. Cranor and + * Washington University. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. + */ + +/* + * net/if_atm.h + */ + +#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) +#define RTALLOC1(A,B) rtalloc1((A),(B)) +#elif defined(__FreeBSD__) +#define RTALLOC1(A,B) rtalloc1((A),(B),0UL) +#endif + +/* + * pseudo header for packet transmission + */ +struct atm_pseudohdr { + u_int8_t atm_ph[4]; /* flags+VPI+VCI1(msb)+VCI2(lsb) */ +}; + +#define ATM_PH_FLAGS(X) ((X)->atm_ph[0]) +#define ATM_PH_VPI(X) ((X)->atm_ph[1]) +#define ATM_PH_VCI(X) ((((X)->atm_ph[2]) << 8) | ((X)->atm_ph[3])) +#define ATM_PH_SETVCI(X,V) { \ + (X)->atm_ph[2] = ((V) >> 8) & 0xff; \ + (X)->atm_ph[3] = ((V) & 0xff); \ +} + +#define ATM_PH_AAL5 0x01 /* use AAL5? (0 == aal0) */ +#define ATM_PH_LLCSNAP 0x02 /* use the LLC SNAP encoding (iff aal5) */ + +#define ATM_PH_DRIVER7 0x40 /* reserve for driver's use */ +#define ATM_PH_DRIVER8 0x80 /* reserve for driver's use */ + +#define ATMMTU 9180 /* ATM MTU size for IP */ + /* XXX: could be 9188 with LLC/SNAP according + to comer */ + +/* user's ioctl hook for raw atm mode */ +#define SIOCRAWATM _IOWR('a', 122, int) /* set driver's raw mode */ + +/* atm_pseudoioctl: turns on and off RX VCIs [for internal use only!] */ +struct atm_pseudoioctl { + struct atm_pseudohdr aph; + void *rxhand; +}; +#define SIOCATMENA _IOWR('a', 123, struct atm_pseudoioctl) /* enable */ +#define SIOCATMDIS _IOWR('a', 124, struct atm_pseudoioctl) /* disable */ + + +/* + * XXX forget all the garbage in if_llc.h and do it the easy way + */ + +#define ATMLLC_HDR "\252\252\3\0\0\0" +struct atmllc { + u_int8_t llchdr[6]; /* aa.aa.03.00.00.00 */ + u_int8_t type[2]; /* "ethernet" type */ +}; + +/* ATM_LLC macros: note type code in host byte order */ +#define ATM_LLC_TYPE(X) (((X)->type[0] << 8) | ((X)->type[1])) +#define ATM_LLC_SETTYPE(X,V) { \ + (X)->type[1] = ((V) >> 8) & 0xff; \ + (X)->type[0] = ((V) & 0xff); \ +} + +#ifdef _KERNEL +void atm_ifattach(struct ifnet *); +void atm_input(struct ifnet *, struct atm_pseudohdr *, + struct mbuf *, void *); +int atm_output(struct ifnet *, struct mbuf *, struct sockaddr *, + struct rtentry *); +#endif + diff --git a/newlib/libc/sys/linux/include/net/if_media.h b/newlib/libc/sys/linux/include/net/if_media.h new file mode 100644 index 000000000..80599bdc0 --- /dev/null +++ b/newlib/libc/sys/linux/include/net/if_media.h @@ -0,0 +1,409 @@ +/* $NetBSD: if_media.h,v 1.3 1997/03/26 01:19:27 thorpej Exp $ */ +/* $FreeBSD: src/sys/net/if_media.h,v 1.17 2002/05/07 18:16:39 imp Exp $ */ + +/* + * Copyright (c) 1997 + * Jonathan Stone and Jason R. Thorpe. All rights reserved. + * + * This software is derived from information provided by Matt Thomas. + * + * 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 Jonathan Stone + * and Jason R. Thorpe for the NetBSD Project. + * 4. The names of the authors may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHOR 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. + */ + +#ifndef _NET_IF_MEDIA_H_ +#define _NET_IF_MEDIA_H_ + +/* + * Prototypes and definitions for BSD/OS-compatible network interface + * media selection. + * + * Where it is safe to do so, this code strays slightly from the BSD/OS + * design. Software which uses the API (device drivers, basically) + * shouldn't notice any difference. + * + * Many thanks to Matt Thomas for providing the information necessary + * to implement this interface. + */ + +#ifdef _KERNEL + +#include <sys/queue.h> + +/* + * Driver callbacks for media status and change requests. + */ +typedef int (*ifm_change_cb_t)(struct ifnet *ifp); +typedef void (*ifm_stat_cb_t)(struct ifnet *ifp, struct ifmediareq *req); + +/* + * In-kernel representation of a single supported media type. + */ +struct ifmedia_entry { + LIST_ENTRY(ifmedia_entry) ifm_list; + int ifm_media; /* description of this media attachment */ + int ifm_data; /* for driver-specific use */ + void *ifm_aux; /* for driver-specific use */ +}; + +/* + * One of these goes into a network interface's softc structure. + * It is used to keep general media state. + */ +struct ifmedia { + int ifm_mask; /* mask of changes we don't care about */ + int ifm_media; /* current user-set media word */ + struct ifmedia_entry *ifm_cur; /* currently selected media */ + LIST_HEAD(, ifmedia_entry) ifm_list; /* list of all supported media */ + ifm_change_cb_t ifm_change; /* media change driver callback */ + ifm_stat_cb_t ifm_status; /* media status driver callback */ +}; + +/* Initialize an interface's struct if_media field. */ +void ifmedia_init(struct ifmedia *ifm, int dontcare_mask, + ifm_change_cb_t change_callback, ifm_stat_cb_t status_callback); + +/* Remove all mediums from a struct ifmedia. */ +void ifmedia_removeall( struct ifmedia *ifm); + +/* Add one supported medium to a struct ifmedia. */ +void ifmedia_add(struct ifmedia *ifm, int mword, int data, void *aux); + +/* Add an array (of ifmedia_entry) media to a struct ifmedia. */ +void ifmedia_list_add(struct ifmedia *mp, struct ifmedia_entry *lp, + int count); + +/* Set default media type on initialization. */ +void ifmedia_set(struct ifmedia *ifm, int mword); + +/* Common ioctl function for getting/setting media, called by driver. */ +int ifmedia_ioctl(struct ifnet *ifp, struct ifreq *ifr, + struct ifmedia *ifm, u_long cmd); + +#endif /*_KERNEL */ + +/* + * if_media Options word: + * Bits Use + * ---- ------- + * 0-4 Media variant + * 5-7 Media type + * 8-15 Type specific options + * 16-19 RFU + * 20-27 Shared (global) options + * 28-31 Instance + */ + +/* + * Ethernet + */ +#define IFM_ETHER 0x00000020 +#define IFM_10_T 3 /* 10BaseT - RJ45 */ +#define IFM_10_2 4 /* 10Base2 - Thinnet */ +#define IFM_10_5 5 /* 10Base5 - AUI */ +#define IFM_100_TX 6 /* 100BaseTX - RJ45 */ +#define IFM_100_FX 7 /* 100BaseFX - Fiber */ +#define IFM_100_T4 8 /* 100BaseT4 - 4 pair cat 3 */ +#define IFM_100_VG 9 /* 100VG-AnyLAN */ +#define IFM_100_T2 10 /* 100BaseT2 */ +#define IFM_1000_SX 11 /* 1000BaseSX - multi-mode fiber */ +#define IFM_10_STP 12 /* 10BaseT over shielded TP */ +#define IFM_10_FL 13 /* 10BaseFL - Fiber */ +#define IFM_1000_LX 14 /* 1000baseLX - single-mode fiber */ +#define IFM_1000_CX 15 /* 1000baseCX - 150ohm STP */ +#define IFM_1000_T 16 /* 1000baseT - 4 pair cat 5 */ +#define IFM_HPNA_1 17 /* HomePNA 1.0 (1Mb/s) */ +/* note 31 is the max! */ + +#define IFM_ETH_MASTER 0x00000100 /* master mode (1000baseT) */ + +/* + * Token ring + */ +#define IFM_TOKEN 0x00000040 +#define IFM_TOK_STP4 3 /* Shielded twisted pair 4m - DB9 */ +#define IFM_TOK_STP16 4 /* Shielded twisted pair 16m - DB9 */ +#define IFM_TOK_UTP4 5 /* Unshielded twisted pair 4m - RJ45 */ +#define IFM_TOK_UTP16 6 /* Unshielded twisted pair 16m - RJ45 */ +#define IFM_TOK_STP100 7 /* Shielded twisted pair 100m - DB9 */ +#define IFM_TOK_UTP100 8 /* Unshielded twisted pair 100m - RJ45 */ +#define IFM_TOK_ETR 0x00000200 /* Early token release */ +#define IFM_TOK_SRCRT 0x00000400 /* Enable source routing features */ +#define IFM_TOK_ALLR 0x00000800 /* All routes / Single route bcast */ +#define IFM_TOK_DTR 0x00002000 /* Dedicated token ring */ +#define IFM_TOK_CLASSIC 0x00004000 /* Classic token ring */ +#define IFM_TOK_AUTO 0x00008000 /* Automatic Dedicate/Classic token ring */ + +/* + * FDDI + */ +#define IFM_FDDI 0x00000060 +#define IFM_FDDI_SMF 3 /* Single-mode fiber */ +#define IFM_FDDI_MMF 4 /* Multi-mode fiber */ +#define IFM_FDDI_UTP 5 /* CDDI / UTP */ +#define IFM_FDDI_DA 0x00000100 /* Dual attach / single attach */ + +/* + * IEEE 802.11 Wireless + */ +#define IFM_IEEE80211 0x00000080 +#define IFM_IEEE80211_FH1 3 /* Frequency Hopping 1Mbps */ +#define IFM_IEEE80211_FH2 4 /* Frequency Hopping 2Mbps */ +#define IFM_IEEE80211_DS1 5 /* Direct Sequence 1Mbps */ +#define IFM_IEEE80211_DS2 6 /* Direct Sequence 2Mbps */ +#define IFM_IEEE80211_DS5 7 /* Direct Sequence 5.5Mbps */ +#define IFM_IEEE80211_DS11 8 /* Direct Sequence 11Mbps */ +#define IFM_IEEE80211_DS22 9 /* Direct Sequence 22Mbps */ +#define IFM_IEEE80211_ADHOC 0x00000100 /* Operate in Adhoc mode */ +#define IFM_IEEE80211_HOSTAP 0x00000200 /* Operate in Host AP mode */ +#define IFM_IEEE80211_IBSS 0x00000400 /* Operate in IBSS mode */ +#define IFM_IEEE80211_IBSSMASTER 0x00000800 /* Operate as an IBSS master */ + +/* + * Shared media sub-types + */ +#define IFM_AUTO 0 /* Autoselect best media */ +#define IFM_MANUAL 1 /* Jumper/dipswitch selects media */ +#define IFM_NONE 2 /* Deselect all media */ + +/* + * Shared options + */ +#define IFM_FDX 0x00100000 /* Force full duplex */ +#define IFM_HDX 0x00200000 /* Force half duplex */ +#define IFM_FLAG0 0x01000000 /* Driver defined flag */ +#define IFM_FLAG1 0x02000000 /* Driver defined flag */ +#define IFM_FLAG2 0x04000000 /* Driver defined flag */ +#define IFM_LOOP 0x08000000 /* Put hardware in loopback */ + +/* + * Masks + */ +#define IFM_NMASK 0x000000e0 /* Network type */ +#define IFM_TMASK 0x0000001f /* Media sub-type */ +#define IFM_IMASK 0xf0000000 /* Instance */ +#define IFM_ISHIFT 28 /* Instance shift */ +#define IFM_OMASK 0x0000ff00 /* Type specific options */ +#define IFM_GMASK 0x0ff00000 /* Global options */ + +/* + * Status bits + */ +#define IFM_AVALID 0x00000001 /* Active bit valid */ +#define IFM_ACTIVE 0x00000002 /* Interface attached to working net */ + +/* + * Macros to extract various bits of information from the media word. + */ +#define IFM_TYPE(x) ((x) & IFM_NMASK) +#define IFM_SUBTYPE(x) ((x) & IFM_TMASK) +#define IFM_TYPE_OPTIONS(x) ((x) & IFM_OMASK) +#define IFM_INST(x) (((x) & IFM_IMASK) >> IFM_ISHIFT) +#define IFM_OPTIONS(x) ((x) & (IFM_OMASK|IFM_GMASK)) + +#define IFM_INST_MAX IFM_INST(IFM_IMASK) + +/* + * Macro to create a media word. + */ +#define IFM_MAKEWORD(type, subtype, options, instance) \ + ((type) | (subtype) | (options) | ((instance) << IFM_ISHIFT)) + +/* + * NetBSD extension not defined in the BSDI API. This is used in various + * places to get the canonical description for a given type/subtype. + * + * NOTE: all but the top-level type descriptions must contain NO whitespace! + * Otherwise, parsing these in ifconfig(8) would be a nightmare. + */ +struct ifmedia_description { + int ifmt_word; /* word value; may be masked */ + const char *ifmt_string; /* description */ +}; + +#define IFM_TYPE_DESCRIPTIONS { \ + { IFM_ETHER, "Ethernet" }, \ + { IFM_TOKEN, "Token ring" }, \ + { IFM_FDDI, "FDDI" }, \ + { IFM_IEEE80211, "IEEE 802.11 Wireless Ethernet" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_ETHERNET_DESCRIPTIONS { \ + { IFM_10_T, "10baseT/UTP" }, \ + { IFM_10_2, "10base2/BNC" }, \ + { IFM_10_5, "10base5/AUI" }, \ + { IFM_100_TX, "100baseTX" }, \ + { IFM_100_FX, "100baseFX" }, \ + { IFM_100_T4, "100baseT4" }, \ + { IFM_100_VG, "100baseVG" }, \ + { IFM_100_T2, "100baseT2" }, \ + { IFM_10_STP, "10baseSTP" }, \ + { IFM_10_FL, "10baseFL" }, \ + { IFM_1000_SX, "1000baseSX" }, \ + { IFM_1000_LX, "1000baseLX" }, \ + { IFM_1000_CX, "1000baseCX" }, \ + { IFM_1000_T, "1000baseTX" }, \ + { IFM_1000_T, "1000baseT" }, \ + { IFM_HPNA_1, "homePNA" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_ETHERNET_ALIASES { \ + { IFM_10_T, "UTP" }, \ + { IFM_10_T, "10UTP" }, \ + { IFM_10_2, "BNC" }, \ + { IFM_10_2, "10BNC" }, \ + { IFM_10_5, "AUI" }, \ + { IFM_10_5, "10AUI" }, \ + { IFM_100_TX, "100TX" }, \ + { IFM_100_T4, "100T4" }, \ + { IFM_100_VG, "100VG" }, \ + { IFM_100_T2, "100T2" }, \ + { IFM_10_STP, "10STP" }, \ + { IFM_10_FL, "10FL" }, \ + { IFM_1000_SX, "1000SX" }, \ + { IFM_1000_LX, "1000LX" }, \ + { IFM_1000_CX, "1000CX" }, \ + { IFM_1000_T, "1000TX" }, \ + { IFM_1000_T, "1000T" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_ETHERNET_OPTION_DESCRIPTIONS { \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_TOKENRING_DESCRIPTIONS { \ + { IFM_TOK_STP4, "DB9/4Mbit" }, \ + { IFM_TOK_STP16, "DB9/16Mbit" }, \ + { IFM_TOK_UTP4, "UTP/4Mbit" }, \ + { IFM_TOK_UTP16, "UTP/16Mbit" }, \ + { IFM_TOK_STP100, "STP/100Mbit" }, \ + { IFM_TOK_UTP100, "UTP/100Mbit" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_TOKENRING_ALIASES { \ + { IFM_TOK_STP4, "4STP" }, \ + { IFM_TOK_STP16, "16STP" }, \ + { IFM_TOK_UTP4, "4UTP" }, \ + { IFM_TOK_UTP16, "16UTP" }, \ + { IFM_TOK_STP100, "100STP" }, \ + { IFM_TOK_UTP100, "100UTP" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_TOKENRING_OPTION_DESCRIPTIONS { \ + { IFM_TOK_ETR, "EarlyTokenRelease" }, \ + { IFM_TOK_SRCRT, "SourceRouting" }, \ + { IFM_TOK_ALLR, "AllRoutes" }, \ + { IFM_TOK_DTR, "Dedicated" }, \ + { IFM_TOK_CLASSIC,"Classic" }, \ + { IFM_TOK_AUTO, " " }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_FDDI_DESCRIPTIONS { \ + { IFM_FDDI_SMF, "Single-mode" }, \ + { IFM_FDDI_MMF, "Multi-mode" }, \ + { IFM_FDDI_UTP, "UTP" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_FDDI_ALIASES { \ + { IFM_FDDI_SMF, "SMF" }, \ + { IFM_FDDI_MMF, "MMF" }, \ + { IFM_FDDI_UTP, "CDDI" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_FDDI_OPTION_DESCRIPTIONS { \ + { IFM_FDDI_DA, "Dual-attach" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_IEEE80211_DESCRIPTIONS { \ + { IFM_IEEE80211_FH1, "FH/1Mbps" }, \ + { IFM_IEEE80211_FH2, "FH/2Mbps" }, \ + { IFM_IEEE80211_DS1, "DS/1Mbps" }, \ + { IFM_IEEE80211_DS2, "DS/2Mbps" }, \ + { IFM_IEEE80211_DS5, "DS/5.5Mbps" }, \ + { IFM_IEEE80211_DS11, "DS/11Mbps" }, \ + { IFM_IEEE80211_DS22, "DS/22Mbps" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_IEEE80211_ALIASES { \ + { IFM_IEEE80211_FH1, "FH1" }, \ + { IFM_IEEE80211_FH2, "FH2" }, \ + { IFM_IEEE80211_FH1, "FrequencyHopping/1Mbps" }, \ + { IFM_IEEE80211_FH2, "FrequencyHopping/2Mbps" }, \ + { IFM_IEEE80211_DS1, "DS1" }, \ + { IFM_IEEE80211_DS2, "DS2" }, \ + { IFM_IEEE80211_DS5, "DS5.5" }, \ + { IFM_IEEE80211_DS11, "DS11" }, \ + { IFM_IEEE80211_DS22, "DS22" }, \ + { IFM_IEEE80211_DS1, "DirectSequence/1Mbps" }, \ + { IFM_IEEE80211_DS2, "DirectSequence/2Mbps" }, \ + { IFM_IEEE80211_DS5, "DirectSequence/5.5Mbps" }, \ + { IFM_IEEE80211_DS11, "DirectSequence/11Mbps" }, \ + { IFM_IEEE80211_DS22, "DirectSequence/22Mbps" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_IEEE80211_OPTION_DESCRIPTIONS { \ + { IFM_IEEE80211_ADHOC, "adhoc" }, \ + { IFM_IEEE80211_HOSTAP, "hostap" }, \ + { IFM_IEEE80211_IBSS, "ibss" }, \ + { IFM_IEEE80211_IBSSMASTER, "ibss-master" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_SHARED_DESCRIPTIONS { \ + { IFM_AUTO, "autoselect" }, \ + { IFM_MANUAL, "manual" }, \ + { IFM_NONE, "none" }, \ + { 0, NULL }, \ +} + +#define IFM_SUBTYPE_SHARED_ALIASES { \ + { IFM_AUTO, "auto" }, \ + { 0, NULL }, \ +} + +#define IFM_SHARED_OPTION_DESCRIPTIONS { \ + { IFM_FDX, "full-duplex" }, \ + { IFM_HDX, "half-duplex" }, \ + { IFM_FLAG0, "flag0" }, \ + { IFM_FLAG1, "flag1" }, \ + { IFM_FLAG2, "flag2" }, \ + { IFM_LOOP, "hw-loopback" }, \ + { 0, NULL }, \ +} + +#endif /* _NET_IF_MEDIA_H_ */ diff --git a/newlib/libc/sys/linux/include/net/if_ppp.h b/newlib/libc/sys/linux/include/net/if_ppp.h index bf5ec8387..0d4b6078f 100644 --- a/newlib/libc/sys/linux/include/net/if_ppp.h +++ b/newlib/libc/sys/linux/include/net/if_ppp.h @@ -1,78 +1,41 @@ -/* From: if_ppp.h,v 1.3 1995/06/12 11:36:50 paulus Exp */ - /* * if_ppp.h - Point-to-Point Protocol definitions. * - * Copyright (c) 1989 Carnegie Mellon University. - * - * 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. 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. + * Copyright (c) 1989 Carnegie Mellon University. + * All rights reserved. * - * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY 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 UNIVERSITY 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. - * - */ - -/* - * ==FILEVERSION 960926== + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by Carnegie Mellon University. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * NOTE TO MAINTAINERS: - * If you modify this file at all, please set the above date. - * if_ppp.h is shipped with a PPP distribution as well as with the kernel; - * if everyone increases the FILEVERSION number above, then scripts - * can do the right thing when deciding whether to install a new if_ppp.h - * file. Don't change the format of that line otherwise, so the - * installation script can recognize it. + * $FreeBSD: src/sys/net/if_ppp.h,v 1.14 1999/08/28 00:48:20 peter Exp $ */ +#ifndef _IF_PPP_H_ +#define _IF_PPP_H_ -#ifndef __NET_IF_PPP_H -#define __NET_IF_PPP_H 1 - -#include <sys/types.h> -#include <sys/cdefs.h> - -#include <net/if.h> -#include <sys/ioctl.h> +/* XXX this used to be self-contained. */ #include <net/ppp_defs.h> - -__BEGIN_DECLS +#include <net/if.h> /* * Packet sizes */ - #define PPP_MTU 1500 /* Default MTU (size of Info field) */ #define PPP_MAXMRU 65000 /* Largest MRU we allow */ -#define PPP_VERSION "2.2.0" -#define PPP_MAGIC 0x5002 /* Magic value for the ppp structure */ -#define PROTO_IPX 0x002b /* protocol numbers */ -#define PROTO_DNA_RT 0x0027 /* DNA Routing */ - +#define PPP_MAXMTU 16384 /* Largest MTU we allow */ /* * Bit definitions for flags. */ - #define SC_COMP_PROT 0x00000001 /* protocol compression (output) */ #define SC_COMP_AC 0x00000002 /* header compression (output) */ #define SC_COMP_TCP 0x00000004 /* TCP (VJ) compression (output) */ @@ -81,57 +44,57 @@ __BEGIN_DECLS #define SC_REJ_COMP_TCP 0x00000020 /* reject TCP (VJ) comp. on input */ #define SC_CCP_OPEN 0x00000040 /* Look at CCP packets */ #define SC_CCP_UP 0x00000080 /* May send/recv compressed packets */ -#define SC_ENABLE_IP 0x00000100 /* IP packets may be exchanged */ -#define SC_COMP_RUN 0x00001000 /* compressor has been inited */ -#define SC_DECOMP_RUN 0x00002000 /* decompressor has been inited */ #define SC_DEBUG 0x00010000 /* enable debug messages */ #define SC_LOG_INPKT 0x00020000 /* log contents of good pkts recvd */ #define SC_LOG_OUTPKT 0x00040000 /* log contents of pkts sent */ #define SC_LOG_RAWIN 0x00080000 /* log all chars received */ #define SC_LOG_FLUSH 0x00100000 /* log all chars flushed */ -#define SC_MASK 0x0fE0ffff /* bits that user can change */ +#define SC_RCV_B7_0 0x01000000 /* have rcvd char with bit 7 = 0 */ +#define SC_RCV_B7_1 0x02000000 /* have rcvd char with bit 7 = 1 */ +#define SC_RCV_EVNP 0x04000000 /* have rcvd char with even parity */ +#define SC_RCV_ODDP 0x08000000 /* have rcvd char with odd parity */ +#define SC_MASK 0x0fff00ff /* bits that user can change */ -/* state bits */ -#define SC_ESCAPED 0x80000000 /* saw a PPP_ESCAPE */ +/* + * State bits in sc_flags, not changeable by user. + */ +#define SC_TIMEOUT 0x00000400 /* timeout is currently pending */ +#define SC_VJ_RESET 0x00000800 /* need to reset VJ decomp */ +#define SC_COMP_RUN 0x00001000 /* compressor has been initiated */ +#define SC_DECOMP_RUN 0x00002000 /* decompressor has been initiated */ +#define SC_DC_ERROR 0x00004000 /* non-fatal decomp error detected */ +#define SC_DC_FERROR 0x00008000 /* fatal decomp error detected */ +#define SC_TBUSY 0x10000000 /* xmitter doesn't need a packet yet */ +#define SC_PKTLOST 0x20000000 /* have lost or dropped a packet */ #define SC_FLUSH 0x40000000 /* flush input until next PPP_FLAG */ -#define SC_VJ_RESET 0x20000000 /* Need to reset the VJ decompressor */ -#define SC_XMIT_BUSY 0x10000000 /* ppp_write_wakeup is active */ -#define SC_RCV_ODDP 0x08000000 /* have rcvd char with odd parity */ -#define SC_RCV_EVNP 0x04000000 /* have rcvd char with even parity */ -#define SC_RCV_B7_1 0x02000000 /* have rcvd char with bit 7 = 1 */ -#define SC_RCV_B7_0 0x01000000 /* have rcvd char with bit 7 = 0 */ -#define SC_DC_FERROR 0x00800000 /* fatal decomp error detected */ -#define SC_DC_ERROR 0x00400000 /* non-fatal decomp error detected */ +#define SC_ESCAPED 0x80000000 /* saw a PPP_ESCAPE */ /* * Ioctl definitions. */ struct npioctl { - int protocol; /* PPP protocol, e.g. PPP_IP */ + int protocol; /* PPP procotol, e.g. PPP_IP */ enum NPmode mode; }; /* Structure describing a CCP configuration option, for PPPIOCSCOMPRESS */ struct ppp_option_data { - u_int8_t *ptr; - u_int32_t length; - int transmit; + u_char *ptr; + u_int length; + int transmit; }; struct ifpppstatsreq { - struct ifreq b; - struct ppp_stats stats; /* statistic information */ + char ifr_name[IFNAMSIZ]; + struct ppp_stats stats; }; struct ifpppcstatsreq { - struct ifreq b; - struct ppp_comp_stats stats; + char ifr_name[IFNAMSIZ]; + struct ppp_comp_stats stats; }; -#define ifr__name b.ifr_ifrn.ifrn_name -#define stats_ptr b.ifr_ifru.ifru_data - /* * Ioctl definitions. */ @@ -152,18 +115,23 @@ struct ifpppcstatsreq { #define PPPIOCSCOMPRESS _IOW('t', 77, struct ppp_option_data) #define PPPIOCGNPMODE _IOWR('t', 76, struct npioctl) /* get NP mode */ #define PPPIOCSNPMODE _IOW('t', 75, struct npioctl) /* set NP mode */ -#define PPPIOCGDEBUG _IOR('t', 65, int) /* Read debug level */ -#define PPPIOCSDEBUG _IOW('t', 64, int) /* Set debug level */ -#define PPPIOCGIDLE _IOR('t', 63, struct ppp_idle) /* get idle time */ +#define PPPIOCGIDLE _IOR('t', 74, struct ppp_idle) /* get idle time */ +#define PPPIOCSPASS _IOW('t', 71, struct bpf_program) /* set pass filter */ +#define PPPIOCSACTIVE _IOW('t', 70, struct bpf_program) /* set active filt */ -#define SIOCGPPPSTATS (SIOCDEVPRIVATE + 0) -#define SIOCGPPPVER (SIOCDEVPRIVATE + 1) /* NEVER change this!! */ -#define SIOCGPPPCSTATS (SIOCDEVPRIVATE + 2) +/* PPPIOC[GS]MTU are alternatives to SIOC[GS]IFMTU, used under Ultrix */ +#define PPPIOCGMTU _IOR('t', 73, int) /* get interface MTU */ +#define PPPIOCSMTU _IOW('t', 72, int) /* set interface MTU */ + +/* + * These two are interface ioctls so that pppstats can do them on + * a socket without having to open the serial device. + */ +#define SIOCGPPPSTATS _IOWR('i', 123, struct ifpppstatsreq) +#define SIOCGPPPCSTATS _IOWR('i', 122, struct ifpppcstatsreq) #if !defined(ifr_mtu) #define ifr_mtu ifr_ifru.ifru_metric #endif -__END_DECLS - -#endif /* net/if_ppp.h */ +#endif /* _IF_PPP_H_ */ diff --git a/newlib/libc/sys/linux/include/net/if_pppvar.h b/newlib/libc/sys/linux/include/net/if_pppvar.h new file mode 100644 index 000000000..b4380f4ec --- /dev/null +++ b/newlib/libc/sys/linux/include/net/if_pppvar.h @@ -0,0 +1,109 @@ +/* + * if_pppvar.h - private structures and declarations for PPP. + * + * Copyright (c) 1994 The Australian National University. + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation is hereby granted, provided that the above copyright + * notice appears in all copies. This software is provided without any + * warranty, express or implied. The Australian National University + * makes no representations about the suitability of this software for + * any purpose. + * + * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY + * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF + * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO + * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, + * OR MODIFICATIONS. + * + * Copyright (c) 1989 Carnegie Mellon University. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by Carnegie Mellon University. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * $FreeBSD: src/sys/net/if_pppvar.h,v 1.19 2002/03/24 09:34:04 bde Exp $ + */ + +/* + * Supported network protocols. These values are used for + * indexing sc_npmode. + */ +#define NP_IP 0 /* Internet Protocol */ +#define NUM_NP 1 /* Number of NPs. */ + +/* + * Structure describing each ppp unit. + */ +struct ppp_softc { + struct ifnet sc_if; /* network-visible interface */ +/*hi*/ u_int sc_flags; /* control/status bits; see if_ppp.h */ + struct callout_handle sc_ch; /* Used for scheduling timeouts */ + void *sc_devp; /* pointer to device-dep structure */ + void (*sc_start)(struct ppp_softc *); /* start output proc */ + void (*sc_ctlp)(struct ppp_softc *); /* rcvd control pkt */ + void (*sc_relinq)(struct ppp_softc *); /* relinquish ifunit */ + void (*sc_setmtu)(struct ppp_softc *); /* set mtu */ + short sc_mru; /* max receive unit */ + pid_t sc_xfer; /* used in transferring unit */ +/*hi*/ struct ifqueue sc_rawq; /* received packets */ +/*net*/ struct ifqueue sc_inq; /* queue of input packets for daemon */ +/*net*/ struct ifqueue sc_fastq; /* interactive output packet q */ + struct mbuf *sc_npqueue; /* output packets not to be sent yet */ + struct mbuf **sc_npqtail; /* ptr to last next ptr in npqueue */ + struct pppstat sc_stats; /* count of bytes/pkts sent/rcvd */ + enum NPmode sc_npmode[NUM_NP]; /* what to do with each NP */ + struct compressor *sc_xcomp; /* transmit compressor */ + void *sc_xc_state; /* transmit compressor state */ + struct compressor *sc_rcomp; /* receive decompressor */ + void *sc_rc_state; /* receive decompressor state */ + time_t sc_last_sent; /* time (secs) last NP pkt sent */ + time_t sc_last_recv; /* time (secs) last NP pkt rcvd */ +#ifdef PPP_FILTER + struct bpf_program sc_pass_filt; /* filter for packets to pass */ + struct bpf_program sc_active_filt; /* filter for "non-idle" packets */ +#endif /* PPP_FILTER */ +#ifdef VJC + struct slcompress *sc_comp; /* vjc control buffer */ +#endif + + /* Device-dependent part for async lines. */ + ext_accm sc_asyncmap; /* async control character map */ + u_long sc_rasyncmap; /* receive async control char map */ + struct mbuf *sc_outm; /* mbuf chain currently being output */ + struct mbuf *sc_m; /* pointer to input mbuf chain */ + struct mbuf *sc_mc; /* pointer to current input mbuf */ + char *sc_mp; /* ptr to next char in input mbuf */ + short sc_ilen; /* length of input packet so far */ + u_short sc_fcs; /* FCS so far (input) */ + u_short sc_outfcs; /* FCS so far for output packet */ + u_char sc_rawin[16]; /* chars as received */ + int sc_rawin_count; /* # in sc_rawin */ +}; + +struct ppp_softc *pppalloc(pid_t pid); +void pppdealloc(struct ppp_softc *sc); +int pppioctl(struct ppp_softc *sc, u_long cmd, caddr_t data, int flag, + struct thread *td); +int pppoutput(struct ifnet *ifp, struct mbuf *m0, struct sockaddr *dst, + struct rtentry *rtp); +void ppp_restart(struct ppp_softc *sc); +void ppppktin(struct ppp_softc *sc, struct mbuf *m, int lost); +struct mbuf *ppp_dequeue(struct ppp_softc *sc); diff --git a/newlib/libc/sys/linux/include/netdb.h b/newlib/libc/sys/linux/include/netdb.h index 9e57ffe9c..e92b269e2 100644 --- a/newlib/libc/sys/linux/include/netdb.h +++ b/newlib/libc/sys/linux/include/netdb.h @@ -83,12 +83,8 @@ typedef _BSD_SOCKLEN_T_ socklen_t; #define _PATH_NETWORKS "/etc/networks" #define _PATH_PROTOCOLS "/etc/protocols" #define _PATH_SERVICES "/etc/services" -#define _PATH_NSSWITCH_CONF "/etc/nsswitch.conf" - -extern int *__h_errno_location(void); - -#define h_errno (*(__h_errno_location())) +extern int h_errno; #define MAXALIASES 35 /* For now, only support one return address. */ @@ -162,27 +158,20 @@ struct addrinfo { /* * Error return codes from getaddrinfo() */ -/* Error values for `getaddrinfo' function. */ -# define EAI_BADFLAGS -1 /* Invalid value for `ai_flags' field. */ -# define EAI_NONAME -2 /* NAME or SERVICE is unknown. */ -# define EAI_AGAIN -3 /* Temporary failure in name resolution. */ -# define EAI_FAIL -4 /* Non-recoverable failure in name res. */ -# define EAI_NODATA -5 /* No address associated with NAME. */ -# define EAI_FAMILY -6 /* `ai_family' not supported. */ -# define EAI_SOCKTYPE -7 /* `ai_socktype' not supported. */ -# define EAI_SERVICE -8 /* SERVICE not supported for `ai_socktype'. */ -# define EAI_ADDRFAMILY -9 /* Address family for NAME not supported. */ -# define EAI_MEMORY -10 /* Memory allocation failure. */ -# define EAI_SYSTEM -11 /* System error returned in `errno'. */ -# define EAI_OVERFLOW -12 /* Argument buffer overflow. */ -# ifdef __USE_GNU -# define EAI_INPROGRESS -100 /* Processing request in progress. */ -# define EAI_CANCELED -101 /* Request canceled. */ -# define EAI_NOTCANCELED -102 /* Request not canceled. */ -# define EAI_ALLDONE -103 /* All requests done. */ -# define EAI_INTR -104 /* Interrupted by a signal. */ -# define EAI_IDN_ENCODE -105 /* IDN encoding failed. */ -# endif +#define EAI_ADDRFAMILY 1 /* address family for hostname not supported */ +#define EAI_AGAIN 2 /* temporary failure in name resolution */ +#define EAI_BADFLAGS 3 /* invalid value for ai_flags */ +#define EAI_FAIL 4 /* non-recoverable failure in name resolution */ +#define EAI_FAMILY 5 /* ai_family not supported */ +#define EAI_MEMORY 6 /* memory allocation failure */ +#define EAI_NODATA 7 /* no address associated with hostname */ +#define EAI_NONAME 8 /* hostname nor servname provided, or not known */ +#define EAI_SERVICE 9 /* servname not supported for ai_socktype */ +#define EAI_SOCKTYPE 10 /* ai_socktype not supported */ +#define EAI_SYSTEM 11 /* system error returned in errno */ +#define EAI_BADHINTS 12 +#define EAI_PROTOCOL 13 +#define EAI_MAX 14 /* * Flag values for getaddrinfo() @@ -190,7 +179,6 @@ struct addrinfo { #define AI_PASSIVE 0x00000001 /* get address to use bind() */ #define AI_CANONNAME 0x00000002 /* fill ai_canonname */ #define AI_NUMERICHOST 0x00000004 /* prevent name resolution */ -#define AI_NUMERICSERV 0x00000008 /* don't use name resolution. */ /* valid flags for addrinfo */ #define AI_MASK \ (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_ADDRCONFIG) @@ -231,14 +219,14 @@ void endnetgrent(void); void endprotoent(void); void endservent(void); void freehostent(struct hostent *); -struct hostent *gethostbyaddr(const void *, socklen_t, int); +struct hostent *gethostbyaddr(const char *, int, int); struct hostent *gethostbyname(const char *); struct hostent *gethostbyname2(const char *, int); struct hostent *gethostent(void); int gethostent_r(struct hostent *, char *, int, int *, FILE **); struct hostent *getipnodebyaddr(const void *, size_t, int, int *); struct hostent *getipnodebyname(const char *, int, int, int *); -struct netent *getnetbyaddr(uint32_t, int); +struct netent *getnetbyaddr(unsigned long, int); struct netent *getnetbyname(const char *); struct netent *getnetent(void); int getnetgrent(char **, char **, char **); @@ -259,10 +247,10 @@ void setprotoent(int); int getaddrinfo(const char *, const char *, const struct addrinfo *, struct addrinfo **); int getnameinfo(const struct sockaddr *, socklen_t, char *, - socklen_t, char *, socklen_t, unsigned int); + size_t, char *, size_t, int); void freeaddrinfo(struct addrinfo *); char *gai_strerror(int); -int setnetgrent(const char *); +void setnetgrent(const char *); void setservent(int); /* diff --git a/newlib/libc/sys/linux/include/netinet/if_atm.h b/newlib/libc/sys/linux/include/netinet/if_atm.h new file mode 100644 index 000000000..04ce13ea2 --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet/if_atm.h @@ -0,0 +1,47 @@ +/* $FreeBSD: src/sys/netinet/if_atm.h,v 1.5 2002/03/19 21:25:46 alfred Exp $ */ +/* $NetBSD: if_atm.h,v 1.2 1996/07/03 17:17:17 chuck Exp $ */ + +/* + * + * Copyright (c) 1996 Charles D. Cranor and Washington University. + * 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 Charles D. Cranor and + * Washington University. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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_atm.h + */ + +struct atm_pseudohdr; +struct mbuf; +struct rtentry; +struct sockaddr; + +void atm_rtrequest(int, struct rtentry *, struct rt_addrinfo *); +int atmresolve(struct rtentry *, struct mbuf *, struct sockaddr *, + struct atm_pseudohdr *); diff --git a/newlib/libc/sys/linux/include/netinet/if_ether.h b/newlib/libc/sys/linux/include/netinet/if_ether.h index 4bba84912..ec65a3e58 100644 --- a/newlib/libc/sys/linux/include/netinet/if_ether.h +++ b/newlib/libc/sys/linux/include/netinet/if_ether.h @@ -37,9 +37,6 @@ #ifndef _NETINET_IF_ETHER_H_ #define _NETINET_IF_ETHER_H_ -#include <sys/types.h> -#include <sys/socket.h> -#include <libc-symbols.h> #include <net/ethernet.h> #include <net/if_arp.h> diff --git a/newlib/libc/sys/linux/include/netinet/ip_flow.h b/newlib/libc/sys/linux/include/netinet/ip_flow.h new file mode 100644 index 000000000..90561f07b --- /dev/null +++ b/newlib/libc/sys/linux/include/netinet/ip_flow.h @@ -0,0 +1,57 @@ +/*- + * Copyright (c) 1998 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by the 3am Software Foundry ("3am"). It was developed by Matt Thomas. + * + * 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 NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + * + * $FreeBSD: src/sys/netinet/ip_flow.h,v 1.4 2000/05/26 02:05:46 jake Exp $ + */ + +#ifndef _NETINET_IP_FLOW_H +#define _NETINET_IP_FLOW_H + +struct ipflow { + LIST_ENTRY(ipflow) ipf_next; /* next ipflow in bucket */ + struct in_addr ipf_dst; /* destination address */ + struct in_addr ipf_src; /* source address */ + + u_int8_t ipf_tos; /* type-of-service */ + struct route ipf_ro; /* associated route entry */ + u_long ipf_uses; /* number of uses in this period */ + + int ipf_timer; /* remaining lifetime of this entry */ + u_long ipf_dropped; /* ENOBUFS returned by if_output */ + u_long ipf_errors; /* other errors returned by if_output */ + u_long ipf_last_uses; /* number of uses in last period */ +}; + +#endif diff --git a/newlib/libc/sys/linux/include/nsswitch.h b/newlib/libc/sys/linux/include/nsswitch.h new file mode 100644 index 000000000..3a578e4ff --- /dev/null +++ b/newlib/libc/sys/linux/include/nsswitch.h @@ -0,0 +1,184 @@ +/* $NetBSD: nsswitch.h,v 1.6 1999/01/26 01:04:07 lukem Exp $ */ +/* $FreeBSD: src/include/nsswitch.h,v 1.2 2002/03/23 17:24:53 imp Exp $ */ + +/*- + * Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Luke Mewburn. + * + * 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 NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ + +#ifndef _NSSWITCH_H +#define _NSSWITCH_H 1 + +#include <sys/types.h> + +#include <stdarg.h> + +#ifndef _PATH_NS_CONF +#define _PATH_NS_CONF "/etc/nsswitch.conf" +#endif + +#define NS_CONTINUE 0 +#define NS_RETURN 1 + +#define NS_SUCCESS (1<<0) /* entry was found */ +#define NS_UNAVAIL (1<<1) /* source not responding, or corrupt */ +#define NS_NOTFOUND (1<<2) /* source responded 'no such entry' */ +#define NS_TRYAGAIN (1<<3) /* source busy, may respond to retrys */ +#define NS_STATUSMASK 0x000000ff /* bitmask to get the status flags */ + +/* + * currently implemented sources + */ +#define NSSRC_FILES "files" /* local files */ +#define NSSRC_DNS "dns" /* DNS; IN for hosts, HS for others */ +#define NSSRC_NIS "nis" /* YP/NIS */ +#define NSSRC_COMPAT "compat" /* passwd,group in YP compat mode */ + +/* + * currently implemented databases + */ +#define NSDB_HOSTS "hosts" +#define NSDB_GROUP "group" +#define NSDB_GROUP_COMPAT "group_compat" +#define NSDB_NETGROUP "netgroup" +#define NSDB_NETWORKS "networks" +#define NSDB_PASSWD "passwd" +#define NSDB_PASSWD_COMPAT "passwd_compat" +#define NSDB_SHELLS "shells" + +/* + * suggested databases to implement + */ +#define NSDB_ALIASES "aliases" +#define NSDB_AUTH "auth" +#define NSDB_AUTOMOUNT "automount" +#define NSDB_BOOTPARAMS "bootparams" +#define NSDB_ETHERS "ethers" +#define NSDB_EXPORTS "exports" +#define NSDB_NETMASKS "netmasks" +#define NSDB_PHONES "phones" +#define NSDB_PRINTCAP "printcap" +#define NSDB_PROTOCOLS "protocols" +#define NSDB_REMOTE "remote" +#define NSDB_RPC "rpc" +#define NSDB_SENDMAILVARS "sendmailvars" +#define NSDB_SERVICES "services" +#define NSDB_TERMCAP "termcap" +#define NSDB_TTYS "ttys" + +/* + * ns_dtab - `nsswitch dispatch table' + * contains an entry for each source and the appropriate function to call + */ +typedef struct { + const char *src; + int (*callback)(void *retval, void *cb_data, va_list ap); + void *cb_data; +} ns_dtab; + +/* + * macros to help build an ns_dtab[] + */ +#define NS_FILES_CB(F,C) { NSSRC_FILES, F, C }, +#define NS_COMPAT_CB(F,C) { NSSRC_COMPAT, F, C }, + +#ifdef HESIOD +# define NS_DNS_CB(F,C) { NSSRC_DNS, F, C }, +#else +# define NS_DNS_CB(F,C) +#endif + +#ifdef YP +# define NS_NIS_CB(F,C) { NSSRC_NIS, F, C }, +#else +# define NS_NIS_CB(F,C) +#endif + +/* + * ns_src - `nsswitch source' + * used by the nsparser routines to store a mapping between a source + * and its dispatch control flags for a given database. + */ +typedef struct { + const char *name; + u_int32_t flags; +} ns_src; + + +/* + * default sourcelist (if nsswitch.conf is missing, corrupt, + * or the requested database doesn't have an entry. + */ +extern const ns_src __nsdefaultsrc[]; + + +#ifdef _NS_PRIVATE + +/* + * private data structures for back-end nsswitch implementation + */ + +/* + * ns_dbt - `nsswitch database thang' + * for each database in /etc/nsswitch.conf there is a ns_dbt, with its + * name and a list of ns_src's containing the source information. + */ +typedef struct { + const char *name; /* name of database */ + ns_src *srclist; /* list of sources */ + int srclistsize; /* size of srclist */ +} ns_dbt; + +#endif /* _NS_PRIVATE */ + + +#include <sys/cdefs.h> + +__BEGIN_DECLS +extern int nsdispatch(void *, const ns_dtab [], const char *, + const char *, const ns_src [], ...); + +#ifdef _NS_PRIVATE +extern void _nsdbtaddsrc(ns_dbt *, const ns_src *); +extern void _nsdbtdump(const ns_dbt *); +extern const ns_dbt *_nsdbtget(const char *); +extern void _nsdbtput(const ns_dbt *); +extern void _nsyyerror(const char *); +extern int _nsyylex(void); +extern int _nsyylineno; +#endif /* _NS_PRIVATE */ + +__END_DECLS + +#endif /* !_NSSWITCH_H */ diff --git a/newlib/libc/sys/linux/include/resolv.h b/newlib/libc/sys/linux/include/resolv.h index 35db205d9..1114f2d92 100644 --- a/newlib/libc/sys/linux/include/resolv.h +++ b/newlib/libc/sys/linux/include/resolv.h @@ -94,27 +94,6 @@ #define RES_TIMEOUT 5 /* min. seconds between retries */ #define MAXRESOLVSORT 10 /* number of net to sort on */ #define RES_MAXNDOTS 15 /* should reflect bit field size */ -#define RES_MAXRETRANS 30 /* only for resolv.conf/RES_OPTIONS */ -#define RES_MAXRETRY 5 /* only for resolv.conf/RES_OPTIONS */ -#define RES_DFLRETRY 2 /* Default #/tries. */ -#define RES_MAXTIME 65535 /* Infinity, in milliseconds. */ - - -typedef enum { res_goahead, res_nextns, res_modified, res_done, res_error } - res_sendhookact; -typedef res_sendhookact (*res_send_qhook) (struct sockaddr_in * const *ns, const u_char **query, - int *querylen, - u_char *ans, - int anssiz, - int *resplen); - -typedef res_sendhookact (*res_send_rhook) (const struct sockaddr_in *ns, - const u_char *query, - int querylen, - u_char *ans, - int anssiz, - int *resplen); - struct __res_state { int retrans; /* retransmition time interval */ @@ -135,31 +114,9 @@ struct __res_state { struct in_addr addr; u_int32_t mask; } sort_list[MAXRESOLVSORT]; - res_send_qhook qhook; /* query hook */ - res_send_rhook rhook; /* response hook */ - int res_h_errno; /* last one set for this context */ - int _vcsock; /* PRIVATE: for res_send VC i/o */ - u_int _flags; /* PRIVATE: see below */ - union { - char pad[52]; /* On an i386 this means 512b total. */ - struct { - u_int16_t nscount; - u_int16_t nsmap[MAXNS]; - int nssocks[MAXNS]; - u_int16_t nscount6; - u_int16_t nsinit; - struct sockaddr_in6 *nsaddrs[MAXNS]; - unsigned long long int initstamp - __attribute__((packed)); -#if 0 - unsigned int _initstamp[2]; -#endif - } _ext; - } _u; + char pad[72]; /* on an i386 this means 512b total */ }; -typedef struct __res_state *res_state; - /* for INET6 */ /* * replacement of __res_state, separated to keep binary compatibility. @@ -176,15 +133,6 @@ struct __res_state_ext { }; /* - * * Resolver flags (used to be discrete per-module statics ints). - * */ -#define RES_F_VC 0x00000001 /* socket is TCP */ -#define RES_F_CONN 0x00000002 /* socket is connected */ - -/* res_findzonecut() options */ -#define RES_EXHAUSTIVE 0x00000001 /* always do all queries */ - -/* * Resolver options (keep these in synch with res_debug.c, please) */ #define RES_INIT 0x00000001 /* address initialized */ @@ -201,16 +149,11 @@ struct __res_state_ext { #define RES_INSECURE2 0x00000800 /* type 2 security disabled */ #define RES_NOALIASES 0x00001000 /* shuts off HOSTALIASES feature */ #define RES_USE_INET6 0x00002000 /* use/map IPv6 in gethostbyname() */ -#define RES_ROTATE 0x00004000 /* rotate ns list after each query */ -#define RES_NOCHECKNAME 0x00008000 /* do not check names for sanity. */ -#define RES_KEEPTSIG 0x00010000 /* do not strip TSIG records */ -#define RES_BLAST 0x00020000 /* blast all recursive servers */ -#define RES_USEBSTRING 0x00040000 /* IPv6 reverse lookup with byte - strings */ -#define RES_NOIP6DOTINT 0x00080000 /* Do not use .ip6.int in IPv6 - reverse lookup */ +#define RES_NOTLDQUERY 0x00004000 /* Don't query TLD names */ +/* KAME extensions: use higher bit to avoid conflict with ISC use */ +#define RES_USE_EDNS0 0x40000000 /* use EDNS0 */ -#define RES_DEFAULT (RES_RECURSE|RES_DEFNAMES|RES_DNSRCH|RES_NOIP6DOTINT) +#define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH) /* * Resolver "pfcode" values. Used by dig. @@ -232,13 +175,22 @@ struct __res_state_ext { #define RES_PRF_INIT 0x00004000 /* 0x00008000 */ -#define RES_SET_H_ERRNO(r,x) \ - do \ - { \ - (r)->res_h_errno = x; \ - h_errno = (x); \ - } \ - while (0) +typedef enum { res_goahead, res_nextns, res_modified, res_done, res_error } + res_sendhookact; + +typedef res_sendhookact (*res_send_qhook)(struct sockaddr_in * const *ns, + const u_char **query, + int *querylen, + u_char *ans, + int anssiz, + int *resplen); + +typedef res_sendhookact (*res_send_rhook)(const struct sockaddr_in *ns, + const u_char *query, + int querylen, + u_char *ans, + int anssiz, + int *resplen); struct res_sym { int number; /* Identifying number, like T_MX */ @@ -255,7 +207,6 @@ extern const struct res_sym __p_type_syms[]; /* Private routines shared between libc/net, named, nslookup and others. */ #define res_hnok __res_hnok -#define res_hostalias __res_hostalias #define res_ownok __res_ownok #define res_mailok __res_mailok #define res_dnok __res_dnok @@ -276,7 +227,6 @@ extern const struct res_sym __p_type_syms[]; #define putlong __putlong #define putshort __putshort #define p_class __p_class -#define p_rcode __p_rcode #define p_time __p_time #define p_type __p_type #define p_query __p_query @@ -299,15 +249,6 @@ extern const struct res_sym __p_type_syms[]; #define res_send __res_send #define res_isourserver __res_isourserver #define res_nameinquery __res_nameinquery -#define res_nclose __res_nclose -#define res_ninit __res_ninit -#define res_nmkquery __res_nmkquery -#define res_npquery __res_npquery -#define res_nquery __res_nquery -#define res_nquerydomain __res_nquerydomain -#define res_nsearch __res_nsearch -#define res_nsend __res_nsend -#define res_nisourserver __res_nisourserver #define res_queriesmatch __res_queriesmatch #define res_close __res_close #define res_opt __res_opt @@ -335,7 +276,6 @@ const char * hostalias(const char *); void putlong(u_int32_t, u_char *); void putshort(u_int16_t, u_char *); const char * p_class(int); -const char * p_rcode (int); const char * p_time(u_int32_t); const char * p_type(int); void p_query(const u_char *); @@ -362,18 +302,6 @@ int res_send(const u_char *, int, u_char *, int); int res_isourserver(const struct sockaddr_in *); int res_nameinquery(const char *, int, int, const u_char *, const u_char *); -void res_npquery (const res_state, const u_char *, int, FILE *); -const char * res_hostalias (const res_state, const char *, char *, size_t); -int res_nquery (res_state, const char *, int, int, u_char *, int); -int res_nsearch (res_state, const char *, int, int, u_char *, int); -int res_nquerydomain (res_state, const char *, const char *, int, - int, u_char *, int); -int res_nmkquery (res_state, int, const char *, int, int, - const u_char *, int, const u_char *, u_char *, - int); -int res_nsend (res_state, const u_char *, int, u_char *, int); -void res_nclose (res_state); - int res_queriesmatch(const u_char *, const u_char *, const u_char *, const u_char *); void res_close(void); @@ -386,7 +314,6 @@ int res_mkupdate(ns_updrec *, u_char *, int); ns_updrec * res_mkupdrec(int, const char *, u_int, u_int, u_long); void res_freeupdrec(ns_updrec *); #endif - __END_DECLS #endif /* !_RESOLV_H_ */ diff --git a/newlib/libc/sys/linux/include/sched.h b/newlib/libc/sys/linux/include/sched.h index 91a7a7e7b..becad0f36 100644 --- a/newlib/libc/sys/linux/include/sched.h +++ b/newlib/libc/sys/linux/include/sched.h @@ -22,9 +22,6 @@ #include <features.h> -#define __need_size_t -#include <stddef.h> - /* Get type definitions. */ #include <bits/types.h> diff --git a/newlib/libc/sys/linux/include/stdint.h b/newlib/libc/sys/linux/include/stdint.h index 682af1f7a..d1197f66c 100644 --- a/newlib/libc/sys/linux/include/stdint.h +++ b/newlib/libc/sys/linux/include/stdint.h @@ -15,7 +15,6 @@ #define _STDINT_H #include <sys/types.h> -#include <bits/wordsize.h> #ifdef __cplusplus extern "C" { @@ -88,34 +87,6 @@ typedef uint32_t uint_least16_t; #endif #endif -/* Fast types. */ - -/* Signed. */ -typedef signed char int_fast8_t; -#if __WORDSIZE == 64 -typedef long int int_fast16_t; -typedef long int int_fast32_t; -typedef long int int_fast64_t; -#else -typedef int int_fast16_t; -typedef int int_fast32_t; -__extension__ -typedef long long int int_fast64_t; -#endif - -/* Unsigned. */ -typedef unsigned char uint_fast8_t; -#if __WORDSIZE == 64 -typedef unsigned long int uint_fast16_t; -typedef unsigned long int uint_fast32_t; -typedef unsigned long int uint_fast64_t; -#else -typedef unsigned int uint_fast16_t; -typedef unsigned int uint_fast32_t; -__extension__ -typedef unsigned long long int uint_fast64_t; -#endif - #if __STDINT_EXP(LONG_MAX) > 0x7fffffff #define __int64_t_defined 1 #define __have_long64 1 |