📄 ipport.h
字号:
/*
* Copyright 2002 InterNiche Technologies. All rights reserved.
*
* All the platform specific defines for each port go here.
* All these should be re-examined with each new port of the code.
*/
#ifndef _IPPORT_H_
#define _IPPORT_H_ 1
/* TTYIO.C has redefintions of printf, sprintf. So to resolve declarations,
* we don't include stdio.h for compiling this file
*/
#ifndef _IN_TTYIO_
#include "stdio.h" /* C compiler files */
#endif
#include "stdlib.h"
#include "stdarg.h"
#include "nptypes.h" /* NetPort data types */
/* Options to trade off features for size. Do not enable options
* for modules you don't have or your link will get unresolved
* externals.
*/
#define DEBUG_PRINTF 0
/*#define WEBPORT 1 will be linked with WebPort Web (HTTP) Server (yaxon del) */
/*#define FTP_SERVER 1 include FTP server code (yaxon del) */
#define FULL_ICMP 1 /* use all ICMP || ping only */
/*#define INCLUDE_ARP 1 use Ethernet ARP (yaxon del) */
#define INCLUDE_TCP 1 /* this link will include NetPort TCP w/MIB */
/*#define IN_MENUS 1 support for InterNiche menus system (yaxon del) */
/*#define IP_FRAGMENTS 1 IP fragment reassembly (yaxon del) */
/*#define IP_ROUTING 1 do real IP routing, not imbedded agent fake route (yaxon del) */
/*#define MAC_LOOPBACK 1 use MAC layer pseudo-Ethernet loopback driver (yaxon del) */
/*#define MULTI_HOMED 1 more than one net interface (yaxon modify) */
#define MUTE_WARNS 1 /* mute investigated compiler warnings */
#define NB_CONNECT 1 /* support Non-Blocking connects (TCP, PPP et al) */
#define NET_STATS 1 /* include statistics printfs */
/*#define PING_APP 1 application provides a pingUpcall (yaxon del) */
#define TCP_ZEROCOPY 1 /* enable zero-copy Sockets extension */
/*#define TELNET_SVR 1 include Telnet server code (yaxon del) */
/*#define VFS_FILES 1 include Virtual File System (yaxon del) */
/*#define DYNAMIC_IFACES 1 runtime iface creation/deletion (yaxon del) */
/*#define FTP_CLIENT 1 include FTP client code (yaxon del) */
/*#define FTP_SERVER 1 include FTP server code (yaxon del) */
/*#define INICHE_TIMERS 1 build interval timer support (yaxon del) */
/*#define MAC_LOOPBACK 1 use MAC layer pseudo-Ethernet loopback driver (yaxon del) */
/*#define SERVER_PUSH 1 web server: support "server push" web pages (yaxon del) */
/*#define TELNET_SVR 1 include Telnet server code (yaxon del) */
#define PRINTF_STDARG 1 /* use <stdarg.h> for ...printf() */
#define MEM_WRAPPERS 1 /* wrap heap functions (diagnostics) */
#define HEAP_STATS 1 /* Include heap display menu */
#define BLOCKING_APPS 1
#define TK_IDLE_HOOK 1 /* we need an idle hook */
#define UDP_ECHO_SVR 1 /* enable built-in (to UDP) UDP Echo service */
#define NO_UDP_CKSUM 1 /* don't do UDP checksums */
#define CHRONOS 1 /* Use the RTOS */
/*#define DHCP_CLIENT 1 include DHCP client code (yaxon del) */
/*#define USE_AUTOIP 1 Automatic IPv4 address aquisition (yaxon del) */
/*#define USE_UPNP 1 Universal Plug & Pray (yaxon del) */
/*#define USE_COMPORT 1 support PPP/SLIP over direct-connect serial (yaxon del) */
#define USE_MODEM 1 /* support PPP/SLIP on modems */
#define USE_PPP 1 /* support PPP MAC iface(s) */
/*#define PPP_MENU 1 include PPP control menus (yaxon del) */
#define HT_LOCALFS 1 /* support for local file system */ /* (yaxon add) */
//#define CONPRINTF_DPRINTF /* (yaxon add) */
//#define NPDEBUG 1 /* turn on debugging dprintf()s */ /* (yaxon add) */
#define MINI_IP 1 /* Use minmal size version of IP, ICMP */ /* (yaxon add) */
#define MINI_PING 1 /* Use small ping option(not PING_APP) for mini-IP */ /* (yaxon add) */
#define INCLUDE_ICMP 1 /* Include ICMP for mini-IP */ /* (yaxon add) */
#define MINI_TCP 1 /* Use minmal size version of TCP */ /* (yaxon add) */
#define BSDISH_RECV 1 /* Include the mini-TCP m_recv() routine */ /* (yaxon add) */
#define BSDISH_SEND 1 /* Include the mini-TCP m_send() routine */ /* (yaxon add) */
#define INCLUDE_UDP 1 /* Include UDP support in bulid */ /* (yaxon add) */
/* (yaxon add) */
#define PPP_VJC 1 /* VJ header compression */
#define CHAP_SUPPORT 1 /* CHAP authentication */
#define PAP_SUPPORT 1 /* Password authentication */
/*#define LB_XOVER 1 cross 2 loopback lines for test */
/*#define USE_PPPOE 1 cross 2 loopback lines for test */
/*#define PPP_DHCP_CLIENT 1 PPP - get IP address via PPP */
#define PPP_CHARIO 1 /* PPP - support character read/write routines */
/*#define PPP_MULTILINK 1 PPP - Multilink(RFC1990) support */
/*#define PPP_LOGFILE 1 PPP - ConPrintf() log to file option */
/*#define PPP_DNS 1 exchange DNS information in IPCP */
/*#define DEBUG_PRINTF 1 turn on debugging dprintf()s */
#ifdef NOT_USED
Make sure "NOT_USED" is really undefined
#define DNS_CLIENT 1 /* include DNS client code */
#define ROUTE_TEST 1 /* Add menu & pseudo device for route metrics */
#define USE_PPPOE 1 /* support PPP over Ethernet */
#define INICHE_TASKS 1 /* build to run within InterNiche NicheTask */
#define USE_PROFILER 1 /* include profiling support */
#define NPDEBUG 1 /* turn on debugging dprintf()s */
#define SUPERLOOP 1 /* use superloop */
#define DNS_CLIENT 1 /* include DNS client code */
#define BOOTPTAB 1 /* DHCP supports a UNIX-ish bootptab file - DOESNT WORK */
#define BSD_SOCKETS 1 /* build BSD sockets porting aid */
#define UDPSTEST 1 /* UDP Echo Sockets test app */
#define DHCP_SERVER 1 /* bring in DHCP server */
#define DNS_CLIENT 1 /* include DNS client code */
#define DNS_CLIENT_UPDT 1 /* do Dynamic DNS Update */
#define HT_LOCALFS 1 /* support for local file system */
#define IEEE_802_3 1 /* Support IEEE 802.3 (RFC-1042) */
#define INCLUDE_SNMP 1 /* SNMPv1 library, agent & hook */
#define INCLUDE_SNMPV3 1 /* SNMPv3 library, agent & hook */
#define IP_MULTICAST 1 /* support IP multicast capability in stack */
#define IP_PMTU 1 /* support Path MTU discovery */
#define TCP_ECHOTEST 1 /* include a TCP echo test */
#define LOSSY_IO 1 /* Do lossy packet IO for testing */
#define NATIVE_PRINTF 1 /* use target build environments printf function */
#define NATRT 1 /* enable NAT routing feature */
#define NET_STATS 1 /* include statistics printfs */
#define POP3_CLIENT 1 /* include POP3 client API code */
#define RIP_SUPPORT 1 /* enable RIP routing feature */
#define SMTP_ALERTS 1 /* send email trouble alerts */
#define SNMP_SOCKETS 1 /* SNMP over Sockets, not low-overhead UDP */
#define TCP_ECHOTEST 1 /* include a TCP Echo test */
#define TCP_SACK 1 /* Selective ACK per rfc2018 */
#define THREADX 1 /* build to run within Express Logic ThreadX */
#define TFTP_CLIENT 1 /* include TFTP client code */
#define TFTP_SERVER 1 /* include TFTP server code */
#define UART_LEDS 1 /* show UART buffer status on LEDs */
#define UDPSTEST 1 /* UDP Echo Sockets test app */
#define USE_SLIP 1 /* support SLIP driver iface(s) */
#define ALIGNMENT_CHECK 1 /* enable alignment checking (only use if you have MMU) */
#define PROTOCOL_LIBS 1 /* Build protocol libraries for binary release */
#endif
/**** end of option list ***/
/* default setups of some sub-options */
#ifdef INCLUDE_SNMP
#if !defined(PREBIND_AGENT) && !defined(SNMP_SOCKETS)
#define PREBIND_AGENT 1 /* hardcode SNMP port into UDP */
#endif
#endif
#ifdef LB_XOVER
#ifndef MULTI_HOMED
#define MULTI_HOMED 1
#endif
#endif
#ifdef MULTI_HOMED
#ifndef IP_ROUTING
#define IP_ROUTING 1 /* force IP routing on multi-homed compiles */
#endif
#endif
#ifdef INCLUDE_TCP
#ifndef FULL_ICMP
#define FULL_ICMP 1 /* force full ICMP for TCP support */
#endif
#endif
#ifdef MULTI_HOMED
#define STATIC_NETS 4 /* static network interfaces to allow for... */
#else
#define STATIC_NETS 1
#endif
#ifdef DYNAMIC_IFACES
#define MAXNETS 8 /* max ifaces to support at one time */
#else
#define MAXNETS STATIC_NETS
#endif
#ifdef IP_FRAGMENTS
#ifndef MAX_FRAG_PKTS
#define MAX_FRAG_PKTS 5 /* max IP pkts we can simultaneously reassemble */
#endif
#endif
#if defined(USE_OLICOM)
#ifndef USE_PCMCIA
#define USE_PCMCIA 1 /* need PCMCIA support routines */
#endif
#endif
#ifdef VFS_FILES
#define HT_EXTDEV 1 /* allow custom file devices (memdev, null, etc.) */
#define HT_RWVFS 1 /* support read/write VFS */
#define VFS_STRIPPATH 1 /* used to strip path from filenames in vfsfiles.c */
#define UNIX_VFS 1 /* make VFS look UNIX-like */
#ifdef NOTDEF /* unused VFS options */
#define HT_SYNCDEV 1 /* support sync to flash device */
#endif /* NOTDEF */
#define vfs_lock() /* define pesky macros away */
#define vfs_unlock()
#endif /* VFS_FILES */
#if defined(IN_MENUS) && defined(NATIVE_PRINTF)
#error IN_MENUS do not work with NATIVE_PRINTF.
#endif
#if defined(INICHE_TASKS) && defined(CHRONOS)
#error INICHE_TASKS or CHRONOS should be defined.
#endif
#if defined(INICHE_TASKS) && defined(CHRONOS)
#error Only one of INICHE_TASKS or CHRONOS should be defined.
#endif
/*#define OSPORT_H "../xa_h3/osport.h"*/
#define OSPORT_H "osport.h"
extern unsigned long cticks; /* clock ticks since startup */
void clock_init(void); /* start clock tick counting; called at init time */
void clock_c(void); /* undo effects of clock_init (ie: restore ISR vector */
#define TPS 20 /* cticks per second */
/* (yaxon add) */
#ifdef MINI_IP
/* permit shutdown of the NicheLite console-mode application */
extern void exit_os(unsigned short);
#define netexit exit_os
#endif /* MINI_IP */
/* define preferred data buffer boundary, usually 2 or 4 */
#define ALIGN_TYPE 4 /* 32 bit alignment */
/* convert little/big endian - these should be efficient,
* inline code or MACROs
*/
extern u_long lswap(u_long l); /* swap bytes in 32 bit long */
extern u_short sswap(u_short s); /* swap bytes in 16 bit long */ /* (yaxon add) */
#define ENDIAN_LITTLE /* yaxon add */
/* start endian setup. ENDIAN_BIG should come from ../cflags.mak */
#ifdef ENDIAN_BIG
#define htonl(l) (l)
#define ntohl(l) (l)
#define htons(s) (s)
#define ntohs(s) (s)
#else
#define htonl(l) lswap(l)
#define ntohl(l) lswap(l)
/* (yaxon modify) */
/*#define htons(s) ((u_short)(((u_short)(s) >> 8) | ((u_short)(s) << 8)))*/
/*#define ntohs(s) htons(s)*/
#define htons(s) sswap(s)
#define ntohs(s) sswap(s)
#endif
/* Stack supports two methods of protecting its queues and data
* structs from destructive re-entries by ISRs, multiple tasks, etc. One
* is to lock a "resource ID" which makes code wait when trying to access
* a shared resource, the other is a CRITICAL SECTION frame. You should
* use one or the other, not both. See manual for details.
*/
#ifdef CHRONOS
#include "tk_crnos.h"
#include "includes.h"
#define USE_RESOURCE_LOCKS 1
#define TCPWAKE_ALREADY 1 /* ChronOS has it's own tcp_sleep & tcp_wakeup */
extern void SignalPktDemux(void); /* SignalPktDemux() is a routine */
#endif /* CHRONOS */
#ifdef SUPERLOOP
/* port routine/macro to wake packet demuxer task after receives have
* been placed in rcvdq by drivers. Define to NULL for Superloop demo:
*/
#define SignalPktDemux()
#endif /* SUPERLOOP */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -