URL
https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk
Subversion Repositories openrisc_me
Compare Revisions
- This comparison shows the changes necessary to convert path
/openrisc/trunk/rtos/ecos-2.0/packages/net/common/v2_0/include
- from Rev 27 to Rev 174
- ↔ Reverse comparison
Rev 27 → Rev 174
/network.h
0,0 → 1,84
//========================================================================== |
// |
// include/network.h |
// |
// Misc network support |
// |
//========================================================================== |
//####BSDCOPYRIGHTBEGIN#### |
// |
// ------------------------------------------- |
// |
// Portions of this software may have been derived from OpenBSD or other sources, |
// and are covered by the appropriate copyright disclaimers included herein. |
// |
// ------------------------------------------- |
// |
//####BSDCOPYRIGHTEND#### |
//========================================================================== |
//#####DESCRIPTIONBEGIN#### |
// |
// Author(s): gthomas |
// Contributors: gthomas |
// Date: 2000-01-10 |
// Purpose: |
// Description: |
// |
// |
//####DESCRIPTIONEND#### |
// |
//========================================================================== |
|
#ifndef _NETWORK_H_ |
#define _NETWORK_H_ |
|
#define NO_LIBKERN_INLINE // Avoid kernel inline functions |
|
#include <pkgconf/system.h> |
#include <pkgconf/net.h> |
#undef _KERNEL |
#include <sys/param.h> |
#include <sys/socket.h> |
#include <sys/ioctl.h> |
#include <sys/errno.h> |
|
#include <net/if.h> |
#include <netinet/in.h> |
#include <netinet/ip.h> |
#include <netinet/ip_icmp.h> |
#include <net/route.h> |
|
#include <cyg/infra/diag.h> |
#include <cyg/kernel/kapi.h> |
|
#include <netdb.h> |
#include <bootp.h> |
|
#ifdef CYGHWR_NET_DRIVER_ETH0 |
extern struct bootp eth0_bootp_data; |
extern cyg_bool_t eth0_up; |
extern const char *eth0_name; |
#endif |
#ifdef CYGHWR_NET_DRIVER_ETH1 |
extern struct bootp eth1_bootp_data; |
extern cyg_bool_t eth1_up; |
extern const char *eth1_name; |
#endif |
|
__externC void init_all_network_interfaces(void); |
|
__externC void cyg_route_reinit(void); |
__externC void perror(const char *); |
__externC int close(int); |
__externC ssize_t read(int, void *, size_t); |
__externC ssize_t write(int, const void *, size_t); |
__externC int select(int, fd_set *, fd_set *, fd_set *, struct timeval *tv); |
|
// This API is for our own automated network tests. |
// It's not at all supported. |
#define CYG_NET_GET_MEM_STATS_MISC 0 // Misc mpool |
#define CYG_NET_GET_MEM_STATS_MBUFS 1 // Mbufs pool |
#define CYG_NET_GET_MEM_STATS_CLUST 2 // Clust pool |
int cyg_net_get_mem_stats( int which, cyg_mempool_info *p ); |
|
#endif // _NETWORK_H_ |
/tftp_support.h
0,0 → 1,91
//========================================================================== |
// |
// include/tftp_support.h |
// |
// TFTP support |
// |
//========================================================================== |
//####BSDCOPYRIGHTBEGIN#### |
// |
// ------------------------------------------- |
// |
// Portions of this software may have been derived from OpenBSD or other sources, |
// and are covered by the appropriate copyright disclaimers included herein. |
// |
// ------------------------------------------- |
// |
//####BSDCOPYRIGHTEND#### |
//========================================================================== |
//#####DESCRIPTIONBEGIN#### |
// |
// Author(s): gthomas |
// Contributors: gthomas |
// Date: 2000-04-06 |
// Purpose: |
// Description: |
// |
// |
//####DESCRIPTIONEND#### |
// |
//========================================================================== |
|
#ifndef _TFTP_SUPPORT_H_ |
#define _TFTP_SUPPORT_H_ |
|
/* |
* File transfer modes |
*/ |
#define TFTP_NETASCII 0 // Text files |
#define TFTP_OCTET 1 // Binary files |
|
/* |
* Errors |
*/ |
|
// These initial 7 are passed across the net in "ERROR" packets. |
#define TFTP_ENOTFOUND 1 /* file not found */ |
#define TFTP_EACCESS 2 /* access violation */ |
#define TFTP_ENOSPACE 3 /* disk full or allocation exceeded */ |
#define TFTP_EBADOP 4 /* illegal TFTP operation */ |
#define TFTP_EBADID 5 /* unknown transfer ID */ |
#define TFTP_EEXISTS 6 /* file already exists */ |
#define TFTP_ENOUSER 7 /* no such user */ |
// These extensions are return codes in our API, *never* passed on the net. |
#define TFTP_TIMEOUT 8 /* operation timed out */ |
#define TFTP_NETERR 9 /* some sort of network error */ |
#define TFTP_INVALID 10 /* invalid parameter */ |
#define TFTP_PROTOCOL 11 /* protocol violation */ |
#define TFTP_TOOLARGE 12 /* file is larger than buffer */ |
|
/* |
* Server support |
*/ |
|
struct tftpd_fileops { |
int (*open)(const char *, int); |
int (*close)(int); |
int (*write)(int, const void *, int); |
int (*read)(int, void *, int); |
}; |
|
// Flags - passed to "open" |
#ifndef O_RDONLY |
#define O_RDONLY 1 |
#define O_WRONLY 2 |
#endif |
|
__externC int tftpd_start(int, struct tftpd_fileops *); |
__externC int tftpd_stop(int); |
|
/* |
* Client support |
*/ |
|
__externC int tftp_get(char *, struct sockaddr_in *, char *, int, int, int *); |
__externC int tftp_put(char *, struct sockaddr_in *, char *, int, int, int *); |
|
#define TFTP_TIMEOUT_PERIOD 5 // Seconds between retries |
#define TFTP_TIMEOUT_MAX 50 // Max timeouts over all blocks |
#define TFTP_RETRIES_MAX 5 // retries per block before giving up |
|
#endif // _TFTP_SUPPORT_H_ |
/ifaddrs.h
0,0 → 1,74
//========================================================================== |
// |
// include/ifaddrs.h |
// |
//========================================================================== |
//####BSDCOPYRIGHTBEGIN#### |
// |
// ------------------------------------------- |
// |
// Portions of this software may have been derived from OpenBSD, |
// FreeBSD or other sources, and are covered by the appropriate |
// copyright disclaimers included herein. |
// |
// Portions created by Red Hat are |
// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. |
// |
// ------------------------------------------- |
// |
//####BSDCOPYRIGHTEND#### |
//========================================================================== |
/* $KAME: ifaddrs.h,v 1.3 2001/01/26 08:14:55 itojun Exp $ */ |
|
/* |
* Copyright (c) 1995, 1999 |
* Berkeley Software Design, 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. |
* |
* THIS SOFTWARE IS PROVIDED BY Berkeley Software Design, Inc. ``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 Berkeley Software Design, Inc. 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. |
* |
* BSDI ifaddrs.h,v 2.5 2000/02/23 14:51:59 dab Exp |
*/ |
|
#ifndef _IFADDRS_H_ |
#define _IFADDRS_H_ |
|
struct ifaddrs { |
struct ifaddrs *ifa_next; |
char *ifa_name; |
u_int ifa_flags; |
struct sockaddr *ifa_addr; |
struct sockaddr *ifa_netmask; |
struct sockaddr *ifa_dstaddr; |
void *ifa_data; |
}; |
|
/* |
* This may have been defined in <net/if.h>. Note that if <net/if.h> is |
* to be included it must be included before this header file. |
*/ |
#ifndef ifa_broadaddr |
#define ifa_broadaddr ifa_dstaddr /* broadcast address interface */ |
#endif |
|
__BEGIN_DECLS |
extern int getifaddrs __P((struct ifaddrs **)); |
extern void freeifaddrs __P((struct ifaddrs *)); |
__END_DECLS |
|
#endif |
/arpa/ftp.h
0,0 → 1,130
//========================================================================== |
// |
// include/arpa/ftp.h |
// |
//========================================================================== |
//####BSDCOPYRIGHTBEGIN#### |
// |
// ------------------------------------------- |
// |
// Portions of this software may have been derived from OpenBSD, |
// FreeBSD or other sources, and are covered by the appropriate |
// copyright disclaimers included herein. |
// |
// Portions created by Red Hat are |
// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. |
// |
// ------------------------------------------- |
// |
//####BSDCOPYRIGHTEND#### |
//========================================================================== |
|
/* |
* Copyright (c) 1983, 1989 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 5.6 (Berkeley) 4/3/91 |
*/ |
|
#ifndef _ARPA_FTP_H_ |
#define _ARPA_FTP_H_ |
|
/* 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_ */ |
/arpa/nameser.h
0,0 → 1,251
//========================================================================== |
// |
// include/arpa/nameser.h |
// |
//========================================================================== |
//####BSDCOPYRIGHTBEGIN#### |
// |
// ------------------------------------------- |
// |
// Portions of this software may have been derived from OpenBSD, |
// FreeBSD or other sources, and are covered by the appropriate |
// copyright disclaimers included herein. |
// |
// Portions created by Red Hat are |
// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. |
// |
// ------------------------------------------- |
// |
//####BSDCOPYRIGHTEND#### |
//========================================================================== |
|
/* |
* Copyright (c) 1983, 1989 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. |
* |
* @(#)nameser.h 5.25 (Berkeley) 4/3/91 |
*/ |
|
#ifndef _ARPA_NAMESER_H_ |
#define _ARPA_NAMESER_H_ |
|
/* |
* Define constants based on rfc883 |
*/ |
#define PACKETSZ 512 /* maximum packet size */ |
#define MAXDNAME 256 /* maximum domain name */ |
#define MAXCDNAME 255 /* maximum compressed domain name */ |
#define MAXLABEL 63 /* maximum length of domain label */ |
/* Number of bytes of fixed size data in query structure */ |
#define QFIXEDSZ 4 |
/* number of bytes of fixed size data in resource record */ |
#define RRFIXEDSZ 10 |
|
/* |
* Internet nameserver port number |
*/ |
#define NAMESERVER_PORT 53 |
|
/* |
* Currently defined opcodes |
*/ |
#define QUERY 0x0 /* standard query */ |
#define IQUERY 0x1 /* inverse query */ |
#define STATUS 0x2 /* nameserver status query */ |
// #define xxx 0x3 /* 0x3 reserved */ |
/* non standard */ |
#define UPDATEA 0x9 /* add resource record */ |
#define UPDATED 0xa /* delete a specific resource record */ |
#define UPDATEDA 0xb /* delete all nemed resource record */ |
#define UPDATEM 0xc /* modify a specific resource record */ |
#define UPDATEMA 0xd /* modify all named resource record */ |
|
#define ZONEINIT 0xe /* initial zone transfer */ |
#define ZONEREF 0xf /* incremental zone referesh */ |
|
/* |
* Currently defined response codes |
*/ |
#define NOERROR 0 /* no error */ |
#define FORMERR 1 /* format error */ |
#define SERVFAIL 2 /* server failure */ |
#define NXDOMAIN 3 /* non existent domain */ |
#define NOTIMP 4 /* not implemented */ |
#define REFUSED 5 /* query refused */ |
/* non standard */ |
#define NOCHANGE 0xf /* update failed to change db */ |
|
/* |
* Type values for resources and queries |
*/ |
#define T_A 1 /* host address */ |
#define T_NS 2 /* authoritative server */ |
#define T_MD 3 /* mail destination */ |
#define T_MF 4 /* mail forwarder */ |
#define T_CNAME 5 /* connonical name */ |
#define T_SOA 6 /* start of authority zone */ |
#define T_MB 7 /* mailbox domain name */ |
#define T_MG 8 /* mail group member */ |
#define T_MR 9 /* mail rename name */ |
#define T_NULL 10 /* null resource record */ |
#define T_WKS 11 /* well known service */ |
#define T_PTR 12 /* domain name pointer */ |
#define T_HINFO 13 /* host information */ |
#define T_MINFO 14 /* mailbox information */ |
#define T_MX 15 /* mail routing information */ |
#define T_TXT 16 /* text strings */ |
/* non standard */ |
#define T_UINFO 100 /* user (finger) information */ |
#define T_UID 101 /* user ID */ |
#define T_GID 102 /* group ID */ |
#define T_UNSPEC 103 /* Unspecified format (binary data) */ |
/* Query type values which do not appear in resource records */ |
#define T_AXFR 252 /* transfer zone of authority */ |
#define T_MAILB 253 /* transfer mailbox records */ |
#define T_MAILA 254 /* transfer mail agent records */ |
#define T_ANY 255 /* wildcard match */ |
|
/* |
* Values for class field |
*/ |
|
#define C_IN 1 /* the arpa internet */ |
#define C_CHAOS 3 /* for chaos net at MIT */ |
#define C_HS 4 /* for Hesiod name server at MIT */ |
/* Query class values which do not appear in resource records */ |
#define C_ANY 255 /* wildcard match */ |
|
/* |
* Status return codes for T_UNSPEC conversion routines |
*/ |
#define CONV_SUCCESS 0 |
#define CONV_OVERFLOW -1 |
#define CONV_BADFMT -2 |
#define CONV_BADCKSUM -3 |
#define CONV_BADBUFLEN -4 |
|
#include <machine/endian.h> |
|
/* |
* Structure for query header, the order of the fields is machine and |
* compiler dependent, in our case, the bits within a byte are assignd |
* least significant first, while the order of transmition is most |
* significant first. This requires a somewhat confusing rearrangement. |
*/ |
|
typedef struct { |
u_short id; /* query identification number */ |
#if BYTE_ORDER == BIG_ENDIAN |
/* fields in third byte */ |
u_char qr:1; /* response flag */ |
u_char opcode:4; /* purpose of message */ |
u_char aa:1; /* authoritive answer */ |
u_char tc:1; /* truncated message */ |
u_char rd:1; /* recursion desired */ |
/* fields in fourth byte */ |
u_char ra:1; /* recursion available */ |
u_char pr:1; /* primary server required (non standard) */ |
u_char unused:2; /* unused bits */ |
u_char rcode:4; /* response code */ |
#endif |
#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN |
/* fields in third byte */ |
u_char rd:1; /* recursion desired */ |
u_char tc:1; /* truncated message */ |
u_char aa:1; /* authoritive answer */ |
u_char opcode:4; /* purpose of message */ |
u_char qr:1; /* response flag */ |
/* fields in fourth byte */ |
u_char rcode:4; /* response code */ |
u_char unused:2; /* unused bits */ |
u_char pr:1; /* primary server required (non standard) */ |
u_char ra:1; /* recursion available */ |
#endif |
/* remaining bytes */ |
u_short qdcount; /* number of question entries */ |
u_short ancount; /* number of answer entries */ |
u_short nscount; /* number of authority entries */ |
u_short arcount; /* number of resource entries */ |
} HEADER; |
|
/* |
* Defines for handling compressed domain names |
*/ |
#define INDIR_MASK 0xc0 |
|
/* |
* Structure for passing resource records around. |
*/ |
struct rrec { |
short r_zone; /* zone number */ |
short r_class; /* class number */ |
short r_type; /* type number */ |
u_long r_ttl; /* time to live */ |
int r_size; /* size of data area */ |
char *r_data; /* pointer to data */ |
}; |
|
/* |
* Inline versions of get/put short/long. |
* Pointer is advanced; we assume that both arguments |
* are lvalues and will already be in registers. |
* cp MUST be u_char *. |
*/ |
#define GETSHORT(s, cp) { \ |
(s) = *(cp)++ << 8; \ |
(s) |= *(cp)++; \ |
} |
|
#define GETLONG(l, cp) { \ |
(l) = *(cp)++ << 8; \ |
(l) |= *(cp)++; (l) <<= 8; \ |
(l) |= *(cp)++; (l) <<= 8; \ |
(l) |= *(cp)++; \ |
} |
|
|
#define PUTSHORT(s, cp) { \ |
*(cp)++ = (s) >> 8; \ |
*(cp)++ = (s); \ |
} |
|
/* |
* Warning: PUTLONG destroys its first argument. |
*/ |
#define PUTLONG(l, cp) { \ |
(cp)[3] = l; \ |
(cp)[2] = (l >>= 8); \ |
(cp)[1] = (l >>= 8); \ |
(cp)[0] = l >> 8; \ |
(cp) += sizeof(u_long); \ |
} |
|
#endif /* !_ARPA_NAMESER_H_ */ |
/arpa/telnet.h
0,0 → 1,331
//========================================================================== |
// |
// include/arpa/telnet.h |
// |
//========================================================================== |
//####BSDCOPYRIGHTBEGIN#### |
// |
// ------------------------------------------- |
// |
// Portions of this software may have been derived from OpenBSD, |
// FreeBSD or other sources, and are covered by the appropriate |
// copyright disclaimers included herein. |
// |
// Portions created by Red Hat are |
// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. |
// |
// ------------------------------------------- |
// |
//####BSDCOPYRIGHTEND#### |
//========================================================================== |
|
/* |
* Copyright (c) 1983 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. |
* |
* @(#)telnet.h 5.14 (Berkeley) 4/3/91 |
*/ |
|
#ifndef _ARPA_TELNET_H_ |
#define _ARPA_TELNET_H_ |
|
/* |
* Definitions for the TELNET protocol. |
*/ |
#define IAC 255 /* interpret as command: */ |
#define DONT 254 /* you are not to use option */ |
#define DO 253 /* please, you use option */ |
#define WONT 252 /* I won't use option */ |
#define WILL 251 /* I will use option */ |
#define SB 250 /* interpret as subnegotiation */ |
#define GA 249 /* you may reverse the line */ |
#define EL 248 /* erase the current line */ |
#define EC 247 /* erase the current character */ |
#define AYT 246 /* are you there */ |
#define AO 245 /* abort output--but let prog finish */ |
#define IP 244 /* interrupt process--permanently */ |
#define BREAK 243 /* break */ |
#define DM 242 /* data mark--for connect. cleaning */ |
#define NOP 241 /* nop */ |
#define SE 240 /* end sub negotiation */ |
#define EOR 239 /* end of record (transparent mode) */ |
#define ABORT 238 /* Abort process */ |
#define SUSP 237 /* Suspend process */ |
#define xEOF 236 /* End of file: EOF is already used... */ |
|
#define SYNCH 242 /* for telfunc calls */ |
|
#ifdef TELCMDS |
char *telcmds[] = { |
"EOF", "SUSP", "ABORT", "EOR", |
"SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC", |
"EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", 0, |
}; |
#else |
extern char *telcmds[]; |
#endif |
|
#define TELCMD_FIRST xEOF |
#define TELCMD_LAST IAC |
#define TELCMD_OK(x) ((x) <= TELCMD_LAST && (x) >= TELCMD_FIRST) |
#define TELCMD(x) telcmds[(x)-TELCMD_FIRST] |
|
/* telnet options */ |
#define TELOPT_BINARY 0 /* 8-bit data path */ |
#define TELOPT_ECHO 1 /* echo */ |
#define TELOPT_RCP 2 /* prepare to reconnect */ |
#define TELOPT_SGA 3 /* suppress go ahead */ |
#define TELOPT_NAMS 4 /* approximate message size */ |
#define TELOPT_STATUS 5 /* give status */ |
#define TELOPT_TM 6 /* timing mark */ |
#define TELOPT_RCTE 7 /* remote controlled transmission and echo */ |
#define TELOPT_NAOL 8 /* negotiate about output line width */ |
#define TELOPT_NAOP 9 /* negotiate about output page size */ |
#define TELOPT_NAOCRD 10 /* negotiate about CR disposition */ |
#define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */ |
#define TELOPT_NAOHTD 12 /* negotiate about horizontal tab disposition */ |
#define TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */ |
#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_LOGOUT 18 /* force logout */ |
#define TELOPT_BM 19 /* byte macro */ |
#define TELOPT_DET 20 /* data entry terminal */ |
#define TELOPT_SUPDUP 21 /* supdup protocol */ |
#define TELOPT_SUPDUPOUTPUT 22 /* supdup output */ |
#define TELOPT_SNDLOC 23 /* send location */ |
#define TELOPT_TTYPE 24 /* terminal type */ |
#define TELOPT_EOR 25 /* end or record */ |
#define TELOPT_TUID 26 /* TACACS user identification */ |
#define TELOPT_OUTMRK 27 /* output marking */ |
#define TELOPT_TTYLOC 28 /* terminal location number */ |
#define TELOPT_3270REGIME 29 /* 3270 regime */ |
#define TELOPT_X3PAD 30 /* X.3 PAD */ |
#define TELOPT_NAWS 31 /* window size */ |
#define TELOPT_TSPEED 32 /* terminal speed */ |
#define TELOPT_LFLOW 33 /* remote flow control */ |
#define TELOPT_LINEMODE 34 /* Linemode option */ |
#define TELOPT_XDISPLOC 35 /* X Display Location */ |
#define TELOPT_ENVIRON 36 /* Environment variables */ |
#define TELOPT_AUTHENTICATION 37/* Authenticate */ |
#define TELOPT_ENCRYPT 38 /* Encryption option */ |
#define TELOPT_EXOPL 255 /* extended-options-list */ |
|
|
#define NTELOPTS (1+TELOPT_ENCRYPT) |
#ifdef TELOPTS |
char *telopts[NTELOPTS+1] = { |
"BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME", |
"STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP", |
"NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS", |
"NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO", |
"DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT", |
"SEND LOCATION", "TERMINAL TYPE", "END OF RECORD", |
"TACACS UID", "OUTPUT MARKING", "TTYLOC", |
"3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW", |
"LINEMODE", "XDISPLOC", "ENVIRON", "AUTHENTICATION", |
"ENCRYPT", |
0, |
}; |
#define TELOPT_FIRST TELOPT_BINARY |
#define TELOPT_LAST TELOPT_ENCRYPT |
#define TELOPT_OK(x) ((x) <= TELOPT_LAST && (x) >= TELOPT_FIRST) |
#define TELOPT(x) telopts[(x)-TELOPT_FIRST] |
#endif |
|
/* sub-option qualifiers */ |
#define TELQUAL_IS 0 /* option is... */ |
#define TELQUAL_SEND 1 /* send option */ |
#define TELQUAL_INFO 2 /* ENVIRON: informational version of IS */ |
#define TELQUAL_REPLY 2 /* AUTHENTICATION: client version of IS */ |
#define TELQUAL_NAME 3 /* AUTHENTICATION: client version of IS */ |
|
/* |
* LINEMODE suboptions |
*/ |
|
#define LM_MODE 1 |
#define LM_FORWARDMASK 2 |
#define LM_SLC 3 |
|
#define MODE_EDIT 0x01 |
#define MODE_TRAPSIG 0x02 |
#define MODE_ACK 0x04 |
#define MODE_SOFT_TAB 0x08 |
#define MODE_LIT_ECHO 0x10 |
|
#define MODE_MASK 0x1f |
|
/* Not part of protocol, but needed to simplify things... */ |
#define MODE_FLOW 0x0100 |
#define MODE_ECHO 0x0200 |
#define MODE_INBIN 0x0400 |
#define MODE_OUTBIN 0x0800 |
#define MODE_FORCE 0x1000 |
|
#define SLC_SYNCH 1 |
#define SLC_BRK 2 |
#define SLC_IP 3 |
#define SLC_AO 4 |
#define SLC_AYT 5 |
#define SLC_EOR 6 |
#define SLC_ABORT 7 |
#define SLC_EOF 8 |
#define SLC_SUSP 9 |
#define SLC_EC 10 |
#define SLC_EL 11 |
#define SLC_EW 12 |
#define SLC_RP 13 |
#define SLC_LNEXT 14 |
#define SLC_XON 15 |
#define SLC_XOFF 16 |
#define SLC_FORW1 17 |
#define SLC_FORW2 18 |
|
#define NSLC 18 |
|
/* |
* For backwards compatability, 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", \ |
"ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \ |
"LNEXT", "XON", "XOFF", "FORW1", "FORW2", 0, |
#ifdef SLC_NAMES |
char *slc_names[] = { |
SLC_NAMELIST |
}; |
#else |
extern char *slc_names[]; |
#define SLC_NAMES SLC_NAMELIST |
#endif |
|
#define SLC_NAME_OK(x) ((x) >= 0 && (x) < NSLC) |
#define SLC_NAME(x) slc_names[x] |
|
#define SLC_NOSUPPORT 0 |
#define SLC_CANTCHANGE 1 |
#define SLC_VARIABLE 2 |
#define SLC_DEFAULT 3 |
#define SLC_LEVELBITS 0x03 |
|
#define SLC_FUNC 0 |
#define SLC_FLAGS 1 |
#define SLC_VALUE 2 |
|
#define SLC_ACK 0x80 |
#define SLC_FLUSHIN 0x40 |
#define SLC_FLUSHOUT 0x20 |
|
#define ENV_VALUE 0 |
#define ENV_VAR 1 |
#define ENV_ESC 2 |
|
/* |
* AUTHENTICATION suboptions |
*/ |
|
/* |
* Who is authenticating who ... |
*/ |
#define AUTH_WHO_CLIENT 0 /* Client authenticating server */ |
#define AUTH_WHO_SERVER 1 /* Server authenticating client */ |
#define AUTH_WHO_MASK 1 |
|
/* |
* amount of authentication done |
*/ |
#define AUTH_HOW_ONE_WAY 0 |
#define AUTH_HOW_MUTUAL 2 |
#define AUTH_HOW_MASK 2 |
|
#define AUTHTYPE_NULL 0 |
#define AUTHTYPE_KERBEROS_V4 1 |
#define AUTHTYPE_KERBEROS_V5 2 |
#define AUTHTYPE_SPX 3 |
#define AUTHTYPE_MINK 4 |
#define AUTHTYPE_CNT 5 |
|
#define AUTHTYPE_TEST 99 |
|
#ifdef AUTH_NAMES |
char *authtype_names[] = { |
"NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", 0, |
}; |
#else |
extern char *authtype_names[]; |
#endif |
|
#define AUTHTYPE_NAME_OK(x) ((x) >= 0 && (x) < AUTHTYPE_CNT) |
#define AUTHTYPE_NAME(x) authtype_names[x] |
|
/* |
* ENCRYPTion suboptions |
*/ |
#define ENCRYPT_IS 0 /* I pick encryption type ... */ |
#define ENCRYPT_SUPPORT 1 /* I support encryption types ... */ |
#define ENCRYPT_REPLY 2 /* Initial setup response */ |
#define ENCRYPT_START 3 /* Am starting to send encrypted */ |
#define ENCRYPT_END 4 /* Am ending encrypted */ |
#define ENCRYPT_REQSTART 5 /* Request you start encrypting */ |
#define ENCRYPT_REQEND 6 /* Request you send encrypting */ |
#define ENCRYPT_ENC_KEYID 7 |
#define ENCRYPT_DEC_KEYID 8 |
#define ENCRYPT_CNT 9 |
|
#define ENCTYPE_ANY 0 |
#define ENCTYPE_DES_CFB64 1 |
#define ENCTYPE_DES_OFB64 2 |
#define ENCTYPE_CNT 3 |
|
#ifdef ENCRYPT_NAMES |
char *encrypt_names[] = { |
"IS", "SUPPORT", "REPLY", "START", "END", |
"REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID", |
0, |
}; |
char *enctype_names[] = { |
"ANY", "DES_CFB64", "DES_OFB64", 0, |
}; |
#else |
extern char *encrypt_names[]; |
extern char *enctype_names[]; |
#endif |
|
|
#define ENCRYPT_NAME_OK(x) ((x) >= 0 && (x) < ENCRYPT_CNT) |
#define ENCRYPT_NAME(x) encrypt_names[x] |
|
#define ENCTYPE_NAME_OK(x) ((x) >= 0 && (x) < ENCTYPE_CNT) |
#define ENCTYPE_NAME(x) enctype_names[x] |
|
#endif /* !_ARPA_TELNET_H_ */ |
/arpa/tftp.h
0,0 → 1,101
//========================================================================== |
// |
// include/arpa/tftp.h |
// |
//========================================================================== |
//####BSDCOPYRIGHTBEGIN#### |
// |
// ------------------------------------------- |
// |
// Portions of this software may have been derived from OpenBSD, |
// FreeBSD or other sources, and are covered by the appropriate |
// copyright disclaimers included herein. |
// |
// Portions created by Red Hat are |
// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. |
// |
// ------------------------------------------- |
// |
//####BSDCOPYRIGHTEND#### |
//========================================================================== |
|
/* |
* Copyright (c) 1983 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. |
* |
* @(#)tftp.h 5.4 (Berkeley) 4/3/91 |
*/ |
|
#ifndef _ARPA_TFTP_H_ |
#define _ARPA_TFTP_H_ |
|
/* |
* Trivial File Transfer Protocol (IEN-133) |
*/ |
#define SEGSIZE 512 /* data segment size */ |
|
/* |
* Packet types. |
*/ |
#define RRQ 01 /* read request */ |
#define WRQ 02 /* write request */ |
#define DATA 03 /* data packet */ |
#define ACK 04 /* acknowledgement */ |
#define ERROR 05 /* error code */ |
|
struct tftphdr { |
short th_opcode; /* packet type */ |
union { |
unsigned short tu_block; /* block # */ |
short tu_code; /* error code */ |
char tu_stuff[1]; /* request packet stuff */ |
} __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 |
#define th_stuff th_u.tu_stuff |
#define th_msg th_data |
|
/* |
* Error codes. |
*/ |
#define EUNDEF 0 /* not defined */ |
#define ENOTFOUND 1 /* file not found */ |
#define EACCESS 2 /* access violation */ |
#define ENOSPACE 3 /* disk full or allocation exceeded */ |
#define EBADOP 4 /* illegal TFTP operation */ |
#define EBADID 5 /* unknown transfer ID */ |
#define EEXISTS 6 /* file already exists */ |
#define ENOUSER 7 /* no such user */ |
|
#endif /* !_ARPA_TFTP_H_ */ |
/arpa/inet.h
0,0 → 1,72
//========================================================================== |
// |
// include/arpa/inet.h |
// |
//========================================================================== |
//####BSDCOPYRIGHTBEGIN#### |
// |
// ------------------------------------------- |
// |
// Portions of this software may have been derived from OpenBSD, |
// FreeBSD or other sources, and are covered by the appropriate |
// copyright disclaimers included herein. |
// |
// Portions created by Red Hat are |
// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. |
// |
// ------------------------------------------- |
// |
//####BSDCOPYRIGHTEND#### |
//========================================================================== |
|
/* |
* Copyright (c) 1983 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. |
* |
* @(#)inet.h 5.7 (Berkeley) 4/3/91 |
*/ |
|
#ifndef _ARPA_INET_H_ |
#define _ARPA_INET_H_ |
|
/* External definitions for functions in inet(3) */ |
|
__BEGIN_DECLS |
extern in_addr_t inet_addr __P((const char *)); |
extern int inet_aton __P((const char *, struct in_addr *)); |
extern unsigned long inet_lnaof __P((struct in_addr)); |
extern struct in_addr inet_makeaddr __P((u_long , u_long)); |
extern unsigned long inet_netof __P((struct in_addr)); |
extern unsigned long inet_network __P((const char *)); |
extern char *inet_ntoa __P((struct in_addr)); |
__END_DECLS |
|
#endif /* !_ARPA_INET_H_ */ |
/machine/ansi.h
0,0 → 1,41
//========================================================================== |
// |
// include/machine/ansi.h |
// |
// Architecture/platform specifics |
// |
//========================================================================== |
//####BSDCOPYRIGHTBEGIN#### |
// |
// ------------------------------------------- |
// |
// Portions of this software may have been derived from OpenBSD or other sources, |
// and are covered by the appropriate copyright disclaimers included herein. |
// |
// ------------------------------------------- |
// |
//####BSDCOPYRIGHTEND#### |
//========================================================================== |
//#####DESCRIPTIONBEGIN#### |
// |
// Author(s): gthomas |
// Contributors: gthomas |
// Date: 2000-01-10 |
// Purpose: |
// Description: |
// |
// |
//####DESCRIPTIONEND#### |
// |
//========================================================================== |
|
#ifndef _MACHINE_ANSI_H_ |
#define _MACHINE_ANSI_H_ |
|
// Mappings of BSD-style functions used in networking code to those provided |
// by the eCos environment. |
|
// Nothing to do here any more. |
|
#endif // _MACHINE_ANSI_H_ |
|
/machine/endian.h
0,0 → 1,47
//========================================================================== |
// |
// include/machine/endian.h |
// |
// Architecture/platform specific byte ordering support |
// |
//========================================================================== |
//####BSDCOPYRIGHTBEGIN#### |
// |
// ------------------------------------------- |
// |
// Portions of this software may have been derived from OpenBSD or other sources, |
// and are covered by the appropriate copyright disclaimers included herein. |
// |
// ------------------------------------------- |
// |
//####BSDCOPYRIGHTEND#### |
//========================================================================== |
//#####DESCRIPTIONBEGIN#### |
// |
// Author(s): gthomas |
// Contributors: gthomas |
// Date: 2000-01-10 |
// Purpose: |
// Description: |
// |
// |
//####DESCRIPTIONEND#### |
// |
//========================================================================== |
|
|
#ifndef _MACHINE_ENDIAN_H_ |
#define _MACHINE_ENDIAN_H_ |
|
#include <cyg/hal/basetype.h> |
|
#if CYG_BYTEORDER == CYG_MSBFIRST |
#define BYTE_ORDER BIG_ENDIAN |
#else |
#define BYTE_ORDER LITTLE_ENDIAN |
#endif |
#include <sys/endian.h> |
|
#endif // _MACHINE_ENDIAN_H_ |
|
|
/dhcp.h
0,0 → 1,240
#ifndef CYGONCE_NET_TCPIP_DHCP_H |
#define CYGONCE_NET_TCPIP_DHCP_H |
|
//========================================================================== |
// |
// include/dhcp.h |
// |
// DHCP protocol support |
// |
//========================================================================== |
//####BSDCOPYRIGHTBEGIN#### |
// |
// ------------------------------------------- |
// |
// Portions of this software may have been derived from OpenBSD or other sources, |
// and are covered by the appropriate copyright disclaimers included herein. |
// |
// ------------------------------------------- |
// |
//####BSDCOPYRIGHTEND#### |
//========================================================================== |
//#####DESCRIPTIONBEGIN#### |
// |
// Author(s): hmt |
// Contributors: gthomas |
// Date: 2000-07-01 |
// Purpose: Support DHCP initialization in eCos TCPIP stack |
// Description: |
// |
// |
//####DESCRIPTIONEND#### |
// |
//========================================================================== |
|
// |
// DHCP. RFC2131, RFC1533, RFC1534 |
// See also bootp.h |
// |
|
#include <pkgconf/system.h> |
#include <pkgconf/net.h> |
|
#ifdef CYGPKG_NET_DHCP |
|
#include <machine/types.h> |
|
#include <cyg/kernel/kapi.h> |
|
#include <bootp.h> |
|
// DHCP messages; these are sent in the tag TAG_DHCP_MESS_TYPE already |
// defined in bootp.h |
|
#define DHCPDISCOVER 1 |
#define DHCPOFFER 2 |
#define DHCPREQUEST 3 |
#define DHCPDECLINE 4 |
#define DHCPACK 5 |
#define DHCPNAK 6 |
#define DHCPRELEASE 7 |
|
// DHCP interface state machine states; these are published so that app |
// code can know what to do... (see page 35 of RFC2131) |
|
// These we will use in the normal course of events |
#define DHCPSTATE_INIT 1 |
#define DHCPSTATE_SELECTING 2 // wait for replies to b/c DISCOVER |
#define DHCPSTATE_REQUESTING 3 |
#define DHCPSTATE_REQUEST_RECV 4 // wait for replies to b/c REQUEST |
#define DHCPSTATE_BOUND 5 |
#define DHCPSTATE_RENEWING 6 // wait for replies to u/c REQUEST |
#define DHCPSTATE_RENEW_RECV 7 |
#define DHCPSTATE_REBINDING 8 // wait for replies to b/c REQUEST |
#define DHCPSTATE_REBIND_RECV 9 |
#define DHCPSTATE_BOOTP_FALLBACK 10 // fall back to plain bootp |
#define DHCPSTATE_NOTBOUND 11 // To let app tidy up |
#define DHCPSTATE_FAILED 12 // Net is down |
#define DHCPSTATE_DO_RELEASE 13 // Force release of the current lease |
// These we don't use |
//#define DHCPSTATE_INITREBOOT |
//#define DHCPSTATE_REBOOTING |
|
// These are to let the app inspect the state of the interfaces when |
// managing them itself, by analogy with eth0_up &c; eth0_bootp_data and so |
// on will still be used with DHCP. |
#ifdef CYGHWR_NET_DRIVER_ETH0 |
extern cyg_uint8 eth0_dhcpstate; |
#endif |
#ifdef CYGHWR_NET_DRIVER_ETH1 |
extern cyg_uint8 eth1_dhcpstate; |
#endif |
|
// This is public so the app can wait on it or poll it when managing DHCP |
// itself. It will be zero while the app should wait, and posted when a |
// call to do_dhcp() is needed. If, instead, the app wishes to manage DHCP |
// with a thread per interface somehow, then separate semaphores may be used. |
// See the dhcp_lease structure definition below. |
extern cyg_sem_t dhcp_needs_attention; |
|
// This routine is used at startup time, and after relinquishing leases or |
// after a lease timeout: it does DHCP or bootp or static setup according |
// to configuration. |
extern void init_all_network_interfaces(void); |
|
// This routine does the work of renewing leases &c. |
// return value: 1 => everything OK, no change. |
// 0 => close your connections, then call do_dhcp_halt() to halt the |
// interface(s) in question (it knows because the state will be NOTBOUND). |
// After that you can return to the start and use |
// init_all_network_interfaces() as usual. |
extern int dhcp_bind( void ); |
|
// Shutdown any interface which is not already shut down - whether |
// initialized by DHCP or not. Reason: because of the broadcast-while-not- |
// -fully-initialized nature of the DHCP conversation, all other interfaces |
// must be shut down during that. So one down, all down, is required. |
extern int dhcp_halt( void ); |
|
// Release (and set state to DHCPSTATE_NOTBOUND) all interfaces - we are |
// closing down. (unlikely but useful for testing) |
// Interfaces are left up; use dhcp_halt() to bring them right down, then |
// call init_all_network_interfaces() as usual to restart all. |
extern int dhcp_release( void ); |
|
// The intent with this API is that a simple DHCP client thread, which |
// maintains the state of the interfaces, can go as follows: |
// (after init_all_networks is called from elsewhere) |
// |
// while ( 1 ) { |
// while ( 1 ) { |
// cyg_semaphore_wait( &dhcp_needs_attention ); |
// if ( ! dhcp_bind() ) // a lease expired |
// break; // If we need to re-bind |
// } |
// dhcp_halt(); // tear everything down |
// init_all_network_interfaces(); // re-initialize |
// } |
// |
// and if the application does not want to suffer the overhead of a |
// separate thread and its stack for this, this functionality can be placed |
// in the app's server loop in an obvious fashion. That is the goal of |
// breaking out these internal elements. For example, some server might |
// be arranged to poll DHCP from time to time like this: |
// |
// while ( 1 ) { |
// init_all_network_interfaces(); |
// open-my-listen-sockets(); |
// while ( 1 ) { |
// serve-one-request(); |
// // sleeps if no connections, but not forever; so this loop is |
// // polled a few times a minute... |
// if ( cyg_semaphore_trywait( &dhcp_needs_attention )) { |
// if ( ! dhcp_bind() ) { |
// close-my-listen-sockets(); |
// dhcp_halt(); |
// break; |
// } |
// } |
// } |
// } |
// |
// ------------------------------------------------------------------------ |
|
#ifdef CYGOPT_NET_DHCP_DHCP_THREAD |
// Then we provide such a thread... |
|
// Provide a separate thread to renew DHCP leases; otherwise the |
// application MUST periodically examine the semaphore dhcp_needs_attention |
// and call dhcp_bind() if it is signalled. If enabled, this thread does |
// all that for you. Independent of this option, initialization of the |
// interfaces still occurs in init_all_network_interfaces() and your |
// startup code must call that. It will start the DHCP management thread |
// if necessary. If a lease fails to be renewed, the management thread |
// will shut down all interfaces and attempt to initialize all the |
// interfaces again from scratch. This may cause chaos in the app, which |
// is why managing the DHCP state in an application aware thread is |
// actually better, just far less convenient for testing. |
|
extern cyg_handle_t dhcp_mgt_thread_h; // To allow its external manipulation. |
extern cyg_thread dhcp_mgt_thread; // The object itself |
|
extern void dhcp_start_dhcp_mgt_thread( void ); |
|
#endif |
|
// The function is provided unconditionally so that the app can put it in a |
// thread of its own. If the parameter is true, it loops forever; if |
// false, the call returns if a lease expires, and the caller must tidy up |
// or reboot the whole machine. |
extern cyg_thread_entry_t dhcp_mgt_entry; |
extern void dhcp_mgt_entry( cyg_addrword_t loop_on_failure ); // the function |
|
// --------------------------------------------------------------------------- |
// These are rather more internal routines, internal to the protocol engine |
// in dhcp_prot.c - those above are in dhcp_support.c |
|
#define DHCP_LEASE_T1 1 |
#define DHCP_LEASE_T2 2 |
#define DHCP_LEASE_EX 4 |
|
struct dhcp_lease { |
// Client settable: Semaphore to signal when attention is needed: |
cyg_sem_t *needs_attention; |
// Initialize all the rest to zero: |
cyg_tick_count_t t1, t2, expiry; |
volatile cyg_uint8 next; |
volatile cyg_uint8 which; |
cyg_handle_t alarm; |
// except this one, which is just some space: |
cyg_alarm alarm_obj; |
}; |
|
// These dhcp_lease objects are initialized to use |
// extern cyg_sem_t dhcp_needs_attention; |
// for the semaphore. |
#ifdef CYGHWR_NET_DRIVER_ETH0 |
extern struct dhcp_lease eth0_lease; |
#endif |
#ifdef CYGHWR_NET_DRIVER_ETH1 |
extern struct dhcp_lease eth1_lease; |
#endif |
|
extern int |
do_dhcp(const char *interface, struct bootp *res, |
cyg_uint8 *pstate, struct dhcp_lease *lease); |
// NB *res and *pstate and *lease are all INOUT; *res must point to a valid |
// record from "last time". |
|
extern int |
do_dhcp_down_net(const char *intf, struct bootp *res, |
cyg_uint8 *pstate, struct dhcp_lease *lease); |
|
extern int |
do_dhcp_release(const char *intf, struct bootp *res, |
cyg_uint8 *pstate, struct dhcp_lease *lease); |
|
#endif // CYGPKG_NET_DHCP |
|
#endif // CYGONCE_NET_TCPIP_DHCP_H |
// EOF dhcp.h |
/net/netdb.h
0,0 → 1,144
//========================================================================== |
// |
// include/netdb.h |
// |
// eCos implementations of network "database" functions |
// |
//========================================================================== |
//####BSDCOPYRIGHTBEGIN#### |
// |
// ------------------------------------------- |
// |
// Portions of this software may have been derived from OpenBSD or other sources, |
// and are covered by the appropriate copyright disclaimers included herein. |
// |
// ------------------------------------------- |
// |
//####BSDCOPYRIGHTEND#### |
//========================================================================== |
//#####DESCRIPTIONBEGIN#### |
// |
// Author(s): gthomas |
// Contributors: gthomas |
// Date: 2000-01-10 |
// Purpose: |
// Description: |
// |
// |
//####DESCRIPTIONEND#### |
// |
//========================================================================== |
|
// |
// Support for various "network databases" |
// |
|
#ifndef _NETDB_H_ |
#define _NETDB_H_ |
|
#ifdef __cplusplus |
extern "C" { |
#endif |
|
// Internet protocols |
struct protoent { |
char *p_name; |
int p_proto; |
}; |
|
struct protoent *getprotobyname(const char *); |
struct protoent *getprotobynumber(const int); |
|
// Internet services |
struct servent { |
char *s_name; /* official service name */ |
char **s_aliases; /* alias list */ |
int s_port; /* port number */ |
char *s_proto; /* protocol to use */ |
}; |
|
struct servent *getservbyname(const char *name, const char *proto); |
struct servent *getservbyport(int port, const char *proto); |
|
// Name/address manipulation |
struct addrinfo { |
int ai_flags; /* AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST */ |
int ai_family; /* PF_xxx */ |
int ai_socktype; /* SOCK_xxx */ |
int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ |
size_t ai_addrlen; /* length of ai_addr */ |
char *ai_canonname; /* canonical name for hostname */ |
struct sockaddr *ai_addr; /* binary address */ |
struct addrinfo *ai_next; /* next structure in linked list */ |
}; |
|
/* |
* Error return codes from getaddrinfo(), getnameinfo() |
*/ |
#define EAI_NONE 0 /* valid return - no errors */ |
#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_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 /* inconsistent hints */ |
#define EAI_PROTOCOL 13 |
#define EAI_MAX 14 |
|
/* |
* Flag values for getaddrinfo() |
*/ |
#define AI_PASSIVE 0x00000001 /* get address to use bind() */ |
#define AI_CANONNAME 0x00000002 /* fill ai_canonname */ |
#define AI_NUMERICHOST 0x00000004 /* prevent name resolution */ |
/* valid flags for addrinfo */ |
#define AI_MASK \ |
(AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_ADDRCONFIG) |
|
#define AI_ALL 0x00000100 /* IPv6 and IPv4-mapped (with AI_V4MAPPED) */ |
#define AI_V4MAPPED_CFG 0x00000200 /* accept IPv4-mapped if kernel supports */ |
#define AI_ADDRCONFIG 0x00000400 /* only if any address is assigned */ |
#define AI_V4MAPPED 0x00000800 /* accept IPv4-mapped IPv6 address */ |
/* special recommended flags for getipnodebyname */ |
#define AI_DEFAULT (AI_V4MAPPED_CFG | AI_ADDRCONFIG) |
|
int getaddrinfo(const char *, const char *, |
const struct addrinfo *, struct addrinfo **); |
void freeaddrinfo(struct addrinfo *); |
char *gai_strerror(int); |
|
/* |
* Support for getnameinfo() |
*/ |
|
#define NI_MAXHOST 1025 |
#define NI_MAXSERV 32 |
|
#define NI_NUMERICHOST 1 /* Don't try to look up hostname. */ |
#define NI_NUMERICSERV 2 /* Don't convert port number to name. */ |
#define NI_NOFQDN 4 /* Only return nodename portion. */ |
#define NI_NAMEREQD 8 /* Don't return numeric addresses. */ |
#define NI_DGRAM 16 /* Look up UDP service rather than TCP. */ |
|
/* Translate a socket address to a location and service name. */ |
int getnameinfo (const struct sockaddr *sa, socklen_t salen, |
char *host, socklen_t hostlen, |
char *serv, socklen_t servlen, |
unsigned int flags); |
|
// Miscellaneous address manipulation functions |
#include <netinet/in.h> |
char *inet_ntoa(struct in_addr); |
char *inet_ntop(int af, char *src, char *dst, size_t len); |
int inet_pton(int af, char *src, char *dst); |
char *_inet_ntop(struct sockaddr *sa, char *dst, size_t len); |
u_int16_t _inet_port(struct sockaddr *sa); |
|
#ifdef __cplusplus |
} |
#endif |
#endif // _NETDB_H_ |
/bootp.h
0,0 → 1,362
//========================================================================== |
// |
// include/bootp.h |
// |
//========================================================================== |
//####BSDCOPYRIGHTBEGIN#### |
// |
// ------------------------------------------- |
// |
// Portions of this software may have been derived from OpenBSD, |
// FreeBSD or other sources, and are covered by the appropriate |
// copyright disclaimers included herein. |
// |
// Portions created by Red Hat are |
// Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. |
// |
// ------------------------------------------- |
// |
//####BSDCOPYRIGHTEND#### |
//========================================================================== |
|
/************************************************************************ |
Copyright 1988, 1991 by Carnegie Mellon University |
|
All Rights Reserved |
|
Permission to use, copy, modify, and distribute this software and its |
documentation for any purpose and without fee is hereby granted, provided |
that the above copyright notice appear in all copies and that both that |
copyright notice and this permission notice appear in supporting |
documentation, and that the name of Carnegie Mellon University not be used |
in advertising or publicity pertaining to distribution of the software |
without specific, written prior permission. |
|
CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS |
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. |
IN NO EVENT SHALL CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL |
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS |
ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS |
SOFTWARE. |
************************************************************************/ |
|
#ifndef _BOOTP_H_ |
#define _BOOTP_H_ |
|
/* |
* Bootstrap Protocol (BOOTP). RFC951 and RFC1395. |
* |
* This file specifies the "implementation-independent" BOOTP protocol |
* information which is common to both client and server. |
* |
*/ |
|
#ifdef __ECOS |
|
#include <pkgconf/system.h> |
#include <pkgconf/net.h> |
|
#include <machine/types.h> |
#else |
#include "bptypes.h" /* for int32, u_int32 */ |
#endif |
|
#define BP_CHADDR_LEN 16 |
#define BP_SNAME_LEN 64 |
#define BP_FILE_LEN 128 |
|
/* std min packet size to transmit for DHCP relays to work */ |
#define BP_STD_TX_MINPKTSZ (300) |
|
#ifdef CYGPKG_NET_DHCP |
// The standard requires only 312 bytes here |
#define BP_VEND_LEN (312 + 32) |
#define BP_MINPKTSZ 576 |
#else |
#define BP_VEND_LEN 64 |
#define BP_MINPKTSZ 300 /* to check sizeof(struct bootp) */ |
#endif |
|
#define BP_MAX_OPTION_LEN 256 |
|
struct bootp { |
unsigned char bp_op; /* packet opcode type */ |
unsigned char bp_htype; /* hardware addr type */ |
unsigned char bp_hlen; /* hardware addr length */ |
unsigned char bp_hops; /* gateway hops */ |
#ifdef __ECOS |
u_int32_t bp_xid; /* transaction ID */ |
#else |
unsigned int bp_xid; /* transaction ID */ |
#endif |
unsigned short bp_secs; /* seconds since boot began */ |
unsigned short bp_flags; /* RFC1532 broadcast, etc. */ |
struct in_addr bp_ciaddr; /* client IP address */ |
struct in_addr bp_yiaddr; /* 'your' IP address */ |
struct in_addr bp_siaddr; /* server IP address */ |
struct in_addr bp_giaddr; /* gateway IP address */ |
unsigned char bp_chaddr[BP_CHADDR_LEN]; /* client hardware address */ |
char bp_sname[BP_SNAME_LEN]; /* server host name */ |
char bp_file[BP_FILE_LEN]; /* boot file name */ |
unsigned char bp_vend[BP_VEND_LEN]; /* vendor-specific area */ |
/* note that bp_vend can be longer, extending to end of packet. */ |
}; |
|
/* |
* UDP port numbers, server and client. |
*/ |
#define IPPORT_BOOTPS 67 |
#define IPPORT_BOOTPC 68 |
|
#define BOOTREPLY 2 |
#define BOOTREQUEST 1 |
|
/* |
* Hardware types from Assigned Numbers RFC. |
*/ |
#define HTYPE_ETHERNET 1 |
#define HTYPE_EXP_ETHERNET 2 |
#define HTYPE_AX25 3 |
#define HTYPE_PRONET 4 |
#define HTYPE_CHAOS 5 |
#define HTYPE_IEEE802 6 |
#define HTYPE_ARCNET 7 |
|
/* |
* Vendor magic cookie (v_magic) for CMU |
*/ |
#define VM_CMU "CMU" |
|
/* |
* Vendor magic cookie (v_magic) for RFC1048 |
*/ |
#define VM_RFC1048 { 99, 130, 83, 99 } |
|
|
|
/* |
* Tag values used to specify what information is being supplied in |
* the vendor (options) data area of the packet. |
*/ |
/* RFC 1048 */ |
/* End of cookie */ |
#define TAG_END ((unsigned char) 255) |
/* padding for alignment */ |
#define TAG_PAD ((unsigned char) 0) |
/* Subnet mask */ |
#define TAG_SUBNET_MASK ((unsigned char) 1) |
/* Time offset from UTC for this system */ |
#define TAG_TIME_OFFSET ((unsigned char) 2) |
/* List of routers on this subnet */ |
#define TAG_GATEWAY ((unsigned char) 3) |
/* List of rfc868 time servers available to client */ |
#define TAG_TIME_SERVER ((unsigned char) 4) |
/* List of IEN 116 name servers */ |
#define TAG_NAME_SERVER ((unsigned char) 5) |
/* List of DNS name servers */ |
#define TAG_DOMAIN_SERVER ((unsigned char) 6) |
/* List of MIT-LCS UDL log servers */ |
#define TAG_LOG_SERVER ((unsigned char) 7) |
/* List of rfc865 cookie servers */ |
#define TAG_COOKIE_SERVER ((unsigned char) 8) |
/* List of rfc1179 printer servers (in order to try) */ |
#define TAG_LPR_SERVER ((unsigned char) 9) |
/* List of Imagen Impress servers (in prefered order) */ |
#define TAG_IMPRESS_SERVER ((unsigned char) 10) |
/* List of rfc887 Resourse Location servers */ |
#define TAG_RLP_SERVER ((unsigned char) 11) |
/* Hostname of client */ |
#define TAG_HOST_NAME ((unsigned char) 12) |
/* boot file size */ |
#define TAG_BOOT_SIZE ((unsigned char) 13) |
/* RFC 1395 */ |
/* path to dump to in case of crash */ |
#define TAG_DUMP_FILE ((unsigned char) 14) |
/* domain name for use with the DNS */ |
#define TAG_DOMAIN_NAME ((unsigned char) 15) |
/* IP address of the swap server for this machine */ |
#define TAG_SWAP_SERVER ((unsigned char) 16) |
/* The path name to the root filesystem for this machine */ |
#define TAG_ROOT_PATH ((unsigned char) 17) |
/* RFC 1497 */ |
/* filename to tftp with more options in it */ |
#define TAG_EXTEN_FILE ((unsigned char) 18) |
/* RFC 1533 */ |
/* The following are in rfc1533 and may be used by BOOTP/DHCP */ |
/* IP forwarding enable/disable */ |
#define TAG_IP_FORWARD ((unsigned char) 19) |
/* Non-Local source routing enable/disable */ |
#define TAG_IP_NLSR ((unsigned char) 20) |
/* List of pairs of addresses/masks to allow non-local source routing to */ |
#define TAG_IP_POLICY_FILTER ((unsigned char) 21) |
/* Maximum size of datagrams client should be prepared to reassemble */ |
#define TAG_IP_MAX_DRS ((unsigned char) 22) |
/* Default IP TTL */ |
#define TAG_IP_TTL ((unsigned char) 23) |
/* Timeout in seconds to age path MTU values found with rfc1191 */ |
#define TAG_IP_MTU_AGE ((unsigned char) 24) |
/* Table of MTU sizes to use when doing rfc1191 MTU discovery */ |
#define TAG_IP_MTU_PLAT ((unsigned char) 25) |
/* MTU to use on this interface */ |
#define TAG_IP_MTU ((unsigned char) 26) |
/* All subnets are local option */ |
#define TAG_IP_SNARL ((unsigned char) 27) |
/* broadcast address */ |
#define TAG_IP_BROADCAST ((unsigned char) 28) |
/* perform subnet mask discovery using ICMP */ |
#define TAG_IP_SMASKDISC ((unsigned char) 29) |
/* act as a subnet mask server using ICMP */ |
#define TAG_IP_SMASKSUPP ((unsigned char) 30) |
/* perform rfc1256 router discovery */ |
#define TAG_IP_ROUTERDISC ((unsigned char) 31) |
/* address to send router solicitation requests */ |
#define TAG_IP_ROUTER_SOL_ADDR ((unsigned char) 32) |
/* list of static routes to addresses (addr, router) pairs */ |
#define TAG_IP_STATIC_ROUTES ((unsigned char) 33) |
/* use trailers (rfc893) when using ARP */ |
#define TAG_IP_TRAILER_ENC ((unsigned char) 34) |
/* timeout in seconds for ARP cache entries */ |
#define TAG_ARP_TIMEOUT ((unsigned char) 35) |
/* use either Ethernet version 2 (rfc894) or IEEE 802.3 (rfc1042) */ |
#define TAG_ETHER_IEEE ((unsigned char) 36) |
/* default TCP TTL when sending TCP segments */ |
#define TAG_IP_TCP_TTL ((unsigned char) 37) |
/* time for client to wait before sending a keepalive on a TCP connection */ |
#define TAG_IP_TCP_KA_INT ((unsigned char) 38) |
/* don't send keepalive with an octet of garbage for compatability */ |
#define TAG_IP_TCP_KA_GARBAGE ((unsigned char) 39) |
/* NIS domainname */ |
#define TAG_NIS_DOMAIN ((unsigned char) 40) |
/* list of NIS servers */ |
#define TAG_NIS_SERVER ((unsigned char) 41) |
/* list of NTP servers */ |
#define TAG_NTP_SERVER ((unsigned char) 42) |
/* and stuff vendors may want to add */ |
#define TAG_VEND_SPECIFIC ((unsigned char) 43) |
/* NetBios over TCP/IP name server */ |
#define TAG_NBNS_SERVER ((unsigned char) 44) |
/* NetBios over TCP/IP NBDD servers (rfc1001/1002) */ |
#define TAG_NBDD_SERVER ((unsigned char) 45) |
/* NetBios over TCP/IP node type option for use with above */ |
#define TAG_NBOTCP_OTPION ((unsigned char) 46) |
/* NetBios over TCP/IP scopt option for use with above */ |
#define TAG_NB_SCOPE ((unsigned char) 47) |
/* list of X Window system font servers */ |
#define TAG_XFONT_SERVER ((unsigned char) 48) |
/* list of systems running X Display Manager (xdm) available to this client */ |
#define TAG_XDISPLAY_SERVER ((unsigned char) 49) |
|
/* While the following are only allowed for DHCP */ |
/* DHCP requested IP address */ |
#define TAG_DHCP_REQ_IP ((unsigned char) 50) |
/* DHCP time for lease of IP address */ |
#define TAG_DHCP_LEASE_TIME ((unsigned char) 51) |
/* DHCP options overload */ |
#define TAG_DHCP_OPTOVER ((unsigned char) 52) |
/* DHCP message type */ |
#define TAG_DHCP_MESS_TYPE ((unsigned char) 53) |
/* DHCP server identification */ |
#define TAG_DHCP_SERVER_ID ((unsigned char) 54) |
/* DHCP ordered list of requested parameters */ |
#define TAG_DHCP_PARM_REQ_LIST ((unsigned char) 55) |
/* DHCP reply message */ |
#define TAG_DHCP_TEXT_MESSAGE ((unsigned char) 56) |
/* DHCP maximum packet size willing to accept */ |
#define TAG_DHCP_MAX_MSGSZ ((unsigned char) 57) |
/* DHCP time 'til client needs to renew */ |
#define TAG_DHCP_RENEWAL_TIME ((unsigned char) 58) |
/* DHCP time 'til client needs to rebind */ |
#define TAG_DHCP_REBIND_TIME ((unsigned char) 59) |
/* DHCP class identifier */ |
#define TAG_DHCP_CLASSID ((unsigned char) 60) |
/* DHCP client unique identifier */ |
#define TAG_DHCP_CLIENTID ((unsigned char) 61) |
|
/* XXX - Add new tags here */ |
|
|
/* |
* "vendor" data permitted for CMU bootp clients. |
*/ |
|
struct cmu_vend { |
char v_magic[4]; /* magic number */ |
#ifdef __ECOS |
u_int32_t v_flags; /* flags/opcodes, etc. */ |
#else |
unsigned int32 v_flags; /* flags/opcodes, etc. */ |
#endif |
struct in_addr v_smask; /* Subnet mask */ |
struct in_addr v_dgate; /* Default gateway */ |
struct in_addr v_dns1, v_dns2; /* Domain name servers */ |
struct in_addr v_ins1, v_ins2; /* IEN-116 name servers */ |
struct in_addr v_ts1, v_ts2; /* Time servers */ |
#ifdef __ECOS |
int32_t v_unused[6]; /* currently unused */ |
#else |
int32 v_unused[6]; /* currently unused */ |
#endif |
}; |
|
|
/* v_flags values */ |
#define VF_SMASK 1 /* Subnet mask field contains valid data */ |
|
#ifdef __ECOS |
#ifdef CYGHWR_NET_DRIVER_ETH0 |
extern struct bootp eth0_bootp_data; |
extern cyg_bool_t eth0_up; |
extern const char *eth0_name; |
#endif |
#ifdef CYGHWR_NET_DRIVER_ETH1 |
extern struct bootp eth1_bootp_data; |
extern cyg_bool_t eth1_up; |
extern const char *eth1_name; |
#endif |
|
// ------------------------------------------------------------------------ |
// Initialize your own bootp record however you like, as far as is needed |
// to bring up an interface. |
__externC void |
build_bootp_record(struct bootp *bp, |
const char *if_name, |
const char *addrs_ip, |
const char *addrs_netmask, |
const char *addrs_broadcast, |
const char *addrs_gateway, |
const char *addrs_server); |
|
// Do bootp to fill in the bootp record from the net (other interfaces must |
// be down for this to work, because of the "half-up" state of the |
// interface in use) |
__externC cyg_bool_t do_bootp(const char *interface, struct bootp *res); |
|
// Initialize an interface (which is down) according to a bootp structure |
__externC cyg_bool_t init_net(const char *interface, struct bootp *res); |
#ifdef CYGPKG_NET_INET6 |
__externC cyg_bool_t init_net_IPv6(const char *intf, struct bootp *bp, char *prefix); |
#endif |
|
// Dump contents to diag_printf |
__externC void show_bootp(const char *interface, struct bootp *res); |
|
// Interrogate a bootp record for a particular option |
__externC cyg_bool_t get_bootp_option(struct bootp *bp, unsigned char tag, void *res, unsigned int * length); |
|
// ------------------------------------------------------------------------ |
// This isn't exactly the right place for this since bootp is not involved |
// BUT you will only be using this API if you are using bootp-style |
// initialization of the other interfaces; it fits here in a documentation |
// sense. |
__externC cyg_bool_t init_loopback_interface(int lo); |
|
// ------------------------------------------------------------------------ |
// Do all the above automatically according to the configuration. Do not |
// mix using this and making the above calls yourself. |
// (this is also declared in the much simpler API in network.h) |
__externC void init_all_network_interfaces(void); |
|
#endif |
|
#endif // _BOOTP_H_ |