/*
 * Copyright Notice:
 * Copyright Treck Incorporated  1997 - 2004
 * Copyright Elmic Systems Japan 1997 - 2004
 * No portions or the complete contents of this file may be copied or
 * distributed in any form (including but not limited to printed or electronic
 * forms) without the expressed written consent of Treck Incorporated OR
 * Elmic Systems.  Copyright laws and International Treaties protect the
 * contents of this file.  Unauthorized use is prohibited.
 * All rights reserved.
 *
 * Description:     System Description Macro's
 * This file is intended for the user to modify for their hardware/os platform
 * Filename:        trsystem.h
 * Author:          Odile & Paul
 * Date Created:    9/22/97
 * $Source: /cvs_tick/treck_stack/source/ossupport/netos/trsystem.h,v $
 *
 * Modification History
 * $Revision: 1.13.6.4 $
 * $Date: 2009/05/19 22:53:01 $
 * $Author: jrakhval $
 * $ProjectName: /home/mks/proj/tcpip.pj $
 * $ProjectRevision: 4.7.1.26 $
 */

#ifndef _TRSYSTEM_H_

#define _TRSYSTEM_H_

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

/*
 * A note about Digi Feature Management of Treck capabilities...
 *
 * A number of Treck stack features may be conditionally included in the
 * build of the library, using Digi feature management (MMS) defines. This
 * feature management is specified via entries in mms/xml/modules.xml, in
 * which individual features are enabled for particular Digi products.
 *
 * The following MMS defines are used to conditionally manage features of
 * the Treck stack build in this file:
 *
 *   IPV6_ENABLED       - IPv6 support
 *   VPN_ENABLED        - IPsec/IKE support
 *   FORWARDING_ENABLED - IP forwarding and static route support
 *   NAT_NAPT_ENABLED   - NAT support
 *   PPP_ENABLED        - PPP support
 *   ACL_ENABLED        - Access Control List (ACL) support
 *   DNS_PROXY_ENABLED  - DNS Proxy support
 *   FCC_ENABLED        - Raw socket support (NDS/FCC test use)
 *   NO_TRECK_XMIT_TASK_ENABLED - do not use a transmit task to send
 *
 *   TCP_DEF_OPTIONS_NO_TIMESTAMPS_ENABLED -
 *                    Disable use of TCP timestamps in the default TCP socket
 *                    options (see RFC 1323)
 *   TCP_DEF_OPTIONS_NO_WINDOW_SCALE_ENABLED -
 *                    Disable use of TCP window scale in the default TCP socket
 *                    options (see RFC 1323)
 *
 * Although these defines may be added locally (to this file) to enable the
 * related features of the Treck stack in a build of that library, it is
 * intended that these will be introduced via some external means.
 *
 * Disabling specific features of Treck contributes positively to products
 * that don't require them. Benefits include smaller firmware images and
 * more efficient stack operation, in that the stack need not perform
 * run-time conditional checks for whether a feature is enabled for use.
 * Of particular value in this regard are IPv6 and IPsec/IKE support.
 *
 * Decreased firmware image size lends itself directly to quicker image
 * decompression and loading, as well as an increase in the available RAM
 * for data purposes.
 */

#ifdef NET_OS_SPECIFIC
/* The following commented out defines are defined in the */
/* GNU Treck Makefiles and GHS Treck .gpj files           */
//#define VPN_ENABLED
#define FORWARDING_ENABLED
#define NAT_NAPT_ENABLED
#define PPP_ENABLED
#define ACL_ENABLED
#undef DNS_PROXY_ENABLED
#undef NO_TRECK_XMIT_TASK_ENABLED
#undef TCP_DEF_OPTIONS_NO_TIMESTAMPS_ENABLED
#undef TCP_DEF_OPTIONS_NO_WINDOW_SCALE_ENABLED
#endif /* NET_OS_SPECIFIC */

#define TM_DEBUG_LOGGING
#define TM_TRACE_LOGGING
#define TM_ERROR_LOGGING 

/*
 * Define TM_USE_SNIFF and TM_USE_INF_DRV_SNIFF to compile in code that captures
 * network trace data.  The original Treck version writes this data into files.
 * The Digi version discards all of the trace data except for PPP, and that is
 * sent over a TCP connection to a client utility program.
 */
/*
#define TM_USE_SNIFF
#define TM_USE_INF_DRV_SNIFF
*/

/*
#define TM_DEF_MAX_LOG_MSG_LEN 4096
#define TM_DEF_NUM_LOG_MSGS    10
#define TM_ERROR_CHECKING
*/
/*
 * Uncomment the following line(s) to enable direct use of Digi's NDS trace()
 * feature for Treck stack DEBUG or ERROR logging. These defines control the
 * definitions of tm_debug_logX and tm_error_logX in trmacro.h (X = [0-8]).
 *
 * The corresponding symbol TM_DEBUG_LOGGING or TM_ERROR_LOGGING also must
 * be defined, or the "use Digi trace" defines below will have no effect.
 *
 * Note that it is not necessary to define these symbols here to cause either
 * debug or error logging to be directed to NDS trace(), since there is a
 * linkage to NDS trace() in the tfLogMsg() implementation in trlog.c.
 * However, defining these symbols below results in direct calls to trace()
 * rather than calls to tfLogMsg(), which in turn calls trace().
 */
/* #define TM_USE_DIGI_TRACE_FOR_DEBUG_LOGGING */
/* #define TM_USE_DIGI_TRACE_FOR_ERROR_LOGGING */

#define TM_BSD_CLASH

/* comment out the following line if you do not want to use IPv4 protocols */
#define TM_USE_IPV4

#ifdef IPV6_ENABLED
/* uncomment the following line if you want to use IPv6 protocols */
#define TM_USE_IPV6
/* comment out the following line if you do not want to use DHCPv6 */
#define TM_6_USE_DHCP
#endif /* IPV6_ENABLED */

/* comment out the following line if you do not want to use DHCP */
#define TM_USE_DHCP

#ifdef PPP_ENABLED
/* comment out the following line if you do not want to use PPP protocols */
#define TM_USE_PPP
#endif /* PPP_ENABLED */

/* uncomment the following line if you want to use the new 802.3 Ethernet
   link-layer, which supports Ethernet II (DIX) in addition to IEEE 802.3 */
/* #define TM_USE_ETHER_8023_LL */

/*
 * Uncomment the following line if you want to use the PPPoE client link layer
 */
/* #define TM_USE_PPPOE_CLIENT */

/*
 * Uncomment the following line if you want to use the PPPoE server link layer
 */
/* #define TM_USE_PPPOE_SERVER */

/*
 * Uncomment the following line, if you want to use the netstat tool for
 * for outputting the routing entries, ARP entries and socket entries
 */
#define TM_USE_NETSTAT

/*
 * Uncomment the following line to enable support for splitting out IPv4
 * and IPv6 traffic in the send path to separate virtual channels to
 * simulate multiple hosts as multiple IP aliases. Note that this is
 * incompatible with the default mode of IPv6 operation, therefore IPv6
 * prefix discovery must be disabled.
 */
/* #define TM_USE_VCHAN */

/*
 * Uncomment the following line to speed up lookup in the recieve-path of IP
 * aliases configured on the interface. This is intended for situations where
 * the user has configured many (i.e. >50) IP aliases on a single interface. 
 */
/* #define TM_OPTIMIZE_MANY_MHOMES */

#define TM_SNMP_MIB

#ifdef NET_OS_SPECIFIC

#ifndef TM_SNMP_VERSION
#define TM_SNMP_VERSION 3
#endif /* !TM_SNMP_VERSION */

#else /* ! NET_OS_SPECIFIC */

/*
 * Uncomment the following line for SNMPv1 only.
 * (SNMP option only.)
 */
/* #define TM_SNMP_VERSION 1 */

/*
 * Uncomment the following line for SNMPv1 and SNMPv2c (bilingual).
 * (SNMP option only.)
 */
#define TM_SNMP_VERSION 2

/*
 * Uncomment the following line for SNMPv1, SNMPv2c and SNMPv3 (trilingual).
 * (SNMP option only.)
 */
/* #define TM_SNMP_VERSION 3 */
#endif /* NET_OS_SPECIFIC */

/*
 * Uncomment the TM_SNMP_CACHE macro if you want the stack to keep a cache of
 * the UDP sockets, TCP vectors, ARP table, and Routing table for SNMP.
 * (SNMP option only.)
 */
#define TM_SNMP_CACHE

/*
 * Comment out TM_USE_RFC1213_MIB2 if you do not want the deprecated RFC1213
 * MIB2 objects that are designed only for IPv4 to be included in the SNMP
 * agent.
 * This option requires to enable TM_USE_IPV4 and TM_USE_SNMP_CACHE to be fully
 * functional). If you are running the stack in dual mode (IPV4 and IPV6), V6
 * objects will not be displayed in those table.
 * (SNMP option only.)
 */
#define TM_USE_RFC1213_MIB2

/*
 * Comment out TM_USE_NG_MIB2 to disable the Next Generation MIB2, which
 * consists of tables that support both IPv4 and IPv6 entities.
 * This option requires to enable TM_SNMP_CACHE to be fully functional.
 * (SNMP option only.)
 */
#define TM_USE_NG_MIB2

/*
 * Uncomment the following line for 8-bit OIDs.
 * (SNMP option only.)
 */
/* #define TM_SNMP_8BIT_SUBIDS */

/*
 * Uncomment the following line 16-bit OIDs.
 * (SNMP option only.)
 */ 
/* #define TM_SNMP_16BIT_SUBIDS */

/*
 * Uncomment the TM_SNMP_SET_SYSTEM_VAR_NOTIFY macro to enable support for
 * user notification when certain system vars are changed (set) via SNMP.
 * The specific system variables that may be set, and for which notification
 * is performed, include (defined in snmpd/trconsts.h):
 *   TM_MIB_SYSCONTACT       4
 *   TM_MIB_SYSNAME          5
 *   TM_MIB_SYSLOCATION      6
 */
#define TM_SNMP_SET_SYSTEM_VAR_NOTIFY

/*
 * TM_IP_FRAGMENT macro. Enable support for IPv4 fragmentation.
 * Comment out to save code space when IPv4 fragmentation is not needed.
 */
#define TM_IP_FRAGMENT

/*
 * TM_IP_REASSEMBLY macro. Enable support for IPv4 reassembly.
 * Comment out to save code space when IPv4 reassembly is not needed.
 */
#define TM_IP_REASSEMBLY

/* 
 * This macro is commented out by default.
 * If you define TM_IP_FRAGMENT, and your device driver supports scattered 
 * send, then define TM_IP_FRAGMENT_NO_COPY to avoid an extra internal data
 * copy when an IP datagram is fragmented.
 */
#define TM_IP_FRAGMENT_NO_COPY

#ifdef ACL_ENABLED
/*
 * Uncomment the TM_IP_ACL_SOURCE_FILTERING macro to enable support for
 * IP layer Access Control List (ACL) source filtering.
 * Applicable for IPv4 only.
 */
#define TM_IP_ACL_SOURCE_FILTERING
#endif /* ACL_ENABLED */

#ifdef DNS_PROXY_ENABLED
/*
 * Uncomment the TM_USE_DNS_PROXY macro to enable support for DNS Proxy.
 */
#define TM_USE_DNS_PROXY
#endif /* DNS_PROXY_ENABLED */

/*
 * Added by Digi:
 *
 * Uncomment the TM_ALLOW_TRUNCATE_FLAG_ON_RECV macro, if you want to allow
 * the use of the MSG_TRUNC (or MSG_TRUNCATE) flag in the flags parameter
 * passed to the various data receive APIs. Treck's original code does not
 * permit this: the presence of that flag results in TM_EINVAL (EINVAL)
 * being returned as an error code to the caller.
 *
 * Uncomment the TM_DISABLE_RECV_TRUNCATE_ERRORS macro, if you want to
 * disable error returns from the various receive APIs, when received data
 * from a packet protocol (e.g., UDP) is truncated because the caller's
 * buffer is too small to contain all the data in the packet. Treck's
 * original code results in TM_EMSGSIZE (EMSGSIZE) being returned as an
 * error code to the caller. Note that packet TCP handling is not affected
 * by this macro.
 *
 * The affected receive APIs for these two macros are:
 *   recv                  (sockapi/trrecv.c)
 *   recvfrom              (sockapi/trrecvfr.c)
 *
 * The Treck implementation of these two APIs differs from the behavior we
 * desire and seemingly from other sockets APIs implementations (e.g., BSD).
 * Defining these two macros provides the behavior we prefer and preserves
 * the expectations of our NDS products and our development kit customers
 * for NET+OS.
 *
 * The following receive APIs will not return an error if the MSG_TRUNC
 * flag is specified in the flags parameter, but they will return an error
 * if the caller's buffer is too small to contain the data:
 *   tfRecvFromTo          (sockapi/trrecvto.c)
 *   tfRecvFromToInterface (sockapi/trrcvtif.c)
 *   tfZeroCopyRecv        (sockapi/trzrecv.c)
 *   tfZeroCopyRecvFrom    (sockapi/trzrcvfr.c)
 *
 * These behavior of these Treck APIs are not modified from their original
 * Treck implementation since there is no compatibility issue for NDS or
 * NET+OS development kit customers. Basically, the only effect is that the
 * presence of the MSG_TRUNC flag is ignored.
 */
#define TM_ALLOW_TRUNCATE_FLAG_ON_RECV
#define TM_DISABLE_RECV_TRUNCATE_ERRORS

/*
 * Added by Digi: (25 January 2007)
 *
 * Uncomment the TM_PROXY_ARP_ADDRESS_RANGES macro, if you want to include
 * an extension that permits proxy ARP entries that specify a range of
 * IP addresses in a single proxy ARP list entry, versus only one address
 * per entry. In the case where a range of addresses is to be proxied, it
 * is more efficient (conserves both memory and processing) to use a range
 * of addresses rather than a series of entries.
 * 
 * Please search the Treck source to identify the code this affects..
 */
/* #define TM_PROXY_ARP_ADDRESS_RANGES */

/*
 * Uncomment the TM_DISABLE_TELNETD macro, if you want to remove the TELNETD code.
 */
/* #define TM_DISABLE_TELNETD */

/*
 * Uncomment the TM_DISABLE_FTP macro, if you want to remove the FTP
 */
/* #define TM_DISABLE_FTP */

/*
 * Uncomment the TM_DISABLE_FTPD macro, if you want to remove the FTPD code.
 */
/* #define TM_DISABLE_FTPD */

/*
 * Uncomment the TM_DISABLE_TFTP macro, if you want to remove the TFTP
 */
/* #define TM_DISABLE_TFTP */

/*
 * Uncomment the TM_DISABLE_TFTPD macro, if you want to remove the TFTPD code.
 */
/* #define TM_DISABLE_TFTPD */

/*
 * Uncomment the TM_DISABLE_TCP macro, if you want to remove the TCP code.
 */
/* #define TM_DISABLE_TCP */

/*
 * Uncomment the TM_DISABLE_TCP_SACK macro, if you want to remove the TCP
 * Selective Acknowlegment Options (RFC2018) code.
 */
/* #define TM_DISABLE_TCP_SACK */

/*
 * Define the TM_TCP_FACK macro to enable the Forward Acknowledgement
 * algorithm. It can only be enabled if TM_DISABLE_TCP_SACK is not #define'd.
 * Enabling TM_TCP_FACK allows TCP SACK to retransmit more than one SACK'ed
 * segment (wireless TCP option only).
 */
/* #define TM_TCP_FACK */

/*
 * Uncomment the TM_DISABLE_TCP_RFC2414 macro, if you want to disable
 * the TCP Initial Send Window Increase as described in RFC 2414.
 */
/* #define TM_DISABLE_TCP_RFC2414 */

/*
 * Uncomment the TM_DISABLE_TCP_RFC2581 macro, if you want to remove the TCP
 * congestion control update to RFC2001 as described in RFC2581.
 */
/* #define TM_DISABLE_TCP_RFC2581 */

/*
 * Uncomment the TM_DISABLE_TCP_RFC3042 macro, if you want to remove the
 * Limited Transmit Algorithm that enhances TCP's Loss Recovery as described 
 * in RFC3042. 
 */
/* #define TM_DISABLE_TCP_RFC3042 */

/*
 * Comment out the TM_DISABLE_TCP_ACK_PUSH macro, if you want the
 * stack to send an immediate TCP ACK, when receiving a TCP segment with
 * the PUSH bit set.
 * (Important: this macro should be commented out when the peer runs
 *  windows 2000.)
 */
#define TM_DISABLE_TCP_ACK_PUSH

#ifdef TCP_DEF_OPTIONS_NO_TIMESTAMPS_ENABLED
/*
 * Uncomment the TM_DISABLE_TCP_DEF_OPTION_TIMESTAMPS macro, if you want to
 * remove TCP timestamps from the default TCP socket options. Timestamps are
 * defined in RFC 1323, "TCP Extensions for High Performance."
 *
 * Use of timestamps is negotiated when a TCP connection is established, and
 * both sides of the connection must agree to use them. The overhead per TCP
 * segment for timestamps is 10 bytes, which is significant for data links
 * such as PPP over cellular modem connections, both in terms of added
 * latency and cost (pay by the byte services).
 */
#define TM_DISABLE_TCP_DEF_OPTION_TIMESTAMPS
#endif /* TCP_DEF_OPTIONS_NO_TIMESTAMPS_ENABLED */

#ifdef TCP_DEF_OPTIONS_NO_WINDOW_SCALE_ENABLED
/*
 * Uncomment the TM_DISABLE_TCP_DEF_OPTION_WINDOW_SCALE macro, if you want to
 * remove TCP window scale from the default TCP socket options. Window scale
 * is defined in RFC 1323, "TCP Extensions for High Performance."
 *
 * Use of window scale is negotiated when a TCP connection is established, and
 * both sides of the connection must agree to use it. Although the overhead is
 * limited to the initial SYN segments in the connection establishment, this
 * option is not particularly suited for data links such as PPP over cellular
 * modem connections, as the high performance assumptions do not apply to such.
 */
#define TM_DISABLE_TCP_DEF_OPTION_WINDOW_SCALE
#endif /* TCP_DEF_OPTIONS_NO_WINDOW_SCALE_ENABLED */

/*
 * Uncomment the TM_DISABLE_PMTU_DISC macro, if you want to disable automatic
 * Path MTU discovery on indirect routes.
 */
/* #define TM_DISABLE_PMTU_DISC */

/*
 * Uncomment the TM_ARP_UPDATE_ON_RECV, if you want to avoid sending an ARP
 * request every 10 minutes on an active ARP entry, i.e. an ARP entry for
 * a destination IP address that the stack is actively sending to.
 * Note that uncommenting out this macro will affect speed and size, since
 * every incoming packet will be checked for an ARP cache match on its
 * destination IP address.
 */
/* #define TM_ARP_UPDATE_ON_RECV */

/*
 * Currently the stack will start sending with a full size TCP Initial Window
 * on direct routes
 * Uncomment the TM_USE_TCP_SMALL_IW_DIRECT, if you want the stack to start
 * sending using a reduced TCP Initial Window as it does on indirect routes.
 */
/* #define TM_USE_TCP_SMALL_IW_DIRECT */

/*
 * Currently the stack will discard any SYN segment that have the FIN, or PSH,
 * or URG bit set, and have the ACK bit not set, if there is no data.
 * Uncomment the TM_USE_TCP_CERT_VU464113 macro, if you want the stack
 * to discard these segments even when there is data. 
 * Note that defining this macro will not allow T/TCP to work.
 */
#define TM_USE_TCP_CERT_VU464113

/*
 * Uncomment the TM_USE_TCP_PACKET macro, if you want to modify the
 * TCP behaviour and force TCP to send data on user send packet boundaries.
 * Warning: uncommenting this macro, will make TCP less efficient, and
 * will also disable Path MTU discovery, and TCP Selective Acknowledgements.
 */
/* #define TM_USE_TCP_PACKET */

/*
 * Uncomment the TM_USE_REUSEADDR_LIST macro, if you want to use the
 * SO_REUSEADDR socket level option with setsockopt(). This enables use of
 * the socket reuse address list, i.e. enable binding on the same port using
 * different local IP addresses.
 * See also TM_USE_REUSEPORT (below).
 */
#define TM_USE_REUSEADDR_LIST

/*
 * Uncomment the TM_USE_REUSEPORT macro, if you want to use the
 * SO_REUSEPORT socket level option with setsockopt(). This enables use of
 * the socket reuse address list, and enables binding several sockets on the
 * same port and same local IP address.
 * See also TM_USE_REUSEADDR_LIST (above).
 */
#define TM_USE_REUSEPORT

/*
 * Uncomment the TM_USE_AUTO_IP macro, if you want to use Auto configuration,
 * or want to add collision detection.
 */
#define TM_USE_AUTO_IP

/*
 * Uncomment TM_USE_DHCP_FQDN to enable the DHCP FQDN option
 */
#define TM_USE_DHCP_FQDN

/*
 * Uncomment the TM_USE_RAW_SOCKET macro, if you want to use raw sockets.
 * (tfRawSocket() need to be called, instead of socket())
 */
#if (defined(NDS_SPECIFIC) && defined(FCC_ENABLED))
#define TM_USE_RAW_SOCKET
#else /* !(NDS_SPECIFIC && FCC_ENABLED) */
/* #define TM_USE_RAW_SOCKET */
#endif /* (NDS_SPECIFIC && FCC_ENABLED) */

/*
 * Uncomment the TM_RAW_SOCKET_INPUT_ICMP_REQUESTS, if you want ICMP echo
 * requests, and ICMP address mask requests to be delivered to a raw ICMP
 * socket.
 */
#if (defined(NDS_SPECIFIC) && defined(FCC_ENABLED))
#define TM_RAW_SOCKET_INPUT_ICMP_REQUESTS
#else /* !(NDS_SPECIFIC && FCC_ENABLED) */
/* #define TM_RAW_SOCKET_INPUT_ICMP_REQUESTS */
#endif /* (NDS_SPECIFIC && FCC_ENABLED) */

/*
 * Uncomment TM_PING_REPLY_BROADCAST if you want ICMP replies to be sent
 * when the requested destination is a broadcast or a multicast address.
 */
#define TM_PING_REPLY_BROADCAST

/*
 * Uncomment TM_PING_REPLY_MULTICAST if you want ICMP replies to be sent
 * when the requested destination is a multicast address.
 * (not needed if TM_PING_REPLY_BROADCAST is enabled)
 */
#define TM_PING_REPLY_MULTICAST

/*
 * Uncomment the TM_IGMP macro, if you have purchased the IGMP protocol
 */
#define TM_IGMP

#ifdef PPP_ENABLED
/* 
 * PPP options 
 */
/*
 * Uncomment the TM_PPP_LQM macro, if you want PPP Link Quality Monitoring
 */
#define TM_PPP_LQM

/*
 * Uncomment the TM_USE_IPHC to enable IP header compression (RFC-2507) with
 * PPP.
 */
/* #define TM_USE_IPHC */

/*
 * Uncomment the TM_USE_EAP to enable Extensible Authentication Protocol with
 * PPP.
 */
/* #define TM_USE_EAP */

/* define the following macro to use MSCHAP */
/*#define TM_USE_PPP_MSCHAP*/
#endif /* PPP_ENABLED */

#ifdef NAT_NAPT_ENABLED
/*
 * NAT Options
 */

/*
 * Uncomment the TM_USE_NAT macro to enable support for NAT in IP.
 * Applicable for IPv4 only.
 */
#define TM_USE_NAT

#ifdef TM_USE_NAT
/* Enable NAT progress display with TM_ERROR_LOGGING, TM_DEBUG_LOGGING */
/* and/or TM_TRACE_LOGGING.  (TM_NAT_TRACE used to do this.)           */

/* To enable tfNatDump(), which can display a list of NAT triggers,    */
/* define TM_DEBUG_LOGGING in this file (TM_NAT_DUMP used to do this)  */
/* Digi note: some places in the Treck source still use TM_NAT_DUMP,   */
/* so define it here if TM_DEBUG_LOGGING is defined                    */
#ifdef TM_DEBUG_LOGGING
#define TM_NAT_DUMP
#endif /* TM_DEBUG_LOGGING */

/* Discard packets that NAT does not transform */
/* Digi note: do not define this symbol or the device will be          */
/* inaccessible from the mobile/public side except as a NAT only       */
/* #define TM_NAT_STRICT */

#endif /* TM_USE_NAT */
#endif /* NAT_NAPT_ENABLED */

/*
 * Uncomment the TM_USE_UPNP_DEVICE macro to enable UPnP network device
 * support.
 * NOTE: if you enable TM_USE_UPNP_DEVICE, you must also enable TM_USE_HTTPD
 * and TM_USE_HTTPD_SSI, since Treck UPnP uses Treck web server SSI.
 */
/* #define TM_USE_UPNP_DEVICE */

/*
 * Uncomment the TM_USE_SOAP macro to enable SOAP.
 * NOTE: if you enable TM_USE_SOAP, you must also enable TM_USE_HTTPD, since
 * Treck SOAP uses Treck web server.
 * NOTE: TM_USE_SOAP is automatically enabled for you when you enable
 * TM_USE_UPNP_DEVICE.
 */
/* #define TM_USE_SOAP */

/*
 * Uncomment the TM_USE_UNICODE macro to enable Treck UPnP support for
 * Unicode. By default, Treck UPnP assumes that all service state
 * variables of UPnP type "string" or "char" are ASCII, not Unicode.
 */
/* #define TM_USE_UNICODE */ 

/*
 * Uncomment the TM_USE_FLOATING_POINT macro to enable Treck UPnP support for
 * the UPnP floating point types "r4", "r8", "fixed.14.4" and "float".
 */
/* #define TM_USE_FLOATING_POINT */

/*
 * Uncomment the TM_USE_HTTPD to enable HTTPD (web server)
 */
/* #define TM_USE_HTTPD */

/*
 * Uncomment the TM_USE_HTTPD_CGI to enable CGI supprt of HTTPD (web server)
 */
/* #define TM_USE_HTTPD_CGI */

/*
 * Uncomment the TM_USE_POP3 to enable POP3
 */
/* #define TM_USE_POP3 */

/*
 * Uncomment the TM_USE_SMTP to enable SMTP
 */
/* #define TM_USE_SMTP */

/*
 * Uncomment the TM_MOBILE_IP4 macro, if you have purchased the Mobile IPv4
 * option.
 */
/* #define TM_MOBILE_IP4 */

#ifdef VPN_ENABLED
/*
 * IPsec Option
 * Uncomment the TM_USE_IPSEC macro, if you have purchased the IPSEC option.
 */
#define TM_USE_IPSEC

/*
 * IKE Option
 * Uncomment the TM_USE_IKE macro, if you are going to use KEY management rather
 * than manual keying
 */
#define TM_USE_IKE
#endif /* VPN_ENABLED */

/*
 * Enhanced Logging
 * Uncomment the TM_USE_LOGGING_LEVEL macro, if you want to use Enhanced
 * Logging.  Note that each module and level will also need to be defined
 * (i.e. TM_LOG_ENB_ALL_LEVELS and TM_LOG_ENB_ALL_MODULES or specific
 * levels/modules as required).  For more information, see trmacro.h or
 * consult the appropriate user documentation.
 */
/*define TM_USE_LOGGING_LEVELS */

/*
 * SSL Client Option
 * Uncomment the TM_USE_SSL_CLIENT macro, if you are going to use SSL client
 * functionality
 */
/*#define TM_USE_SSL_CLIENT */

/*
 * SSL Server Option
 * Uncomment the TM_USE_SSL_SERVER macro, if you are going to use SSL server
 * functionality
 */
/*#define TM_USE_SSL_SERVER */

/*
 * FTP client over SSL option
 * Uncomment the TM_USE_FTP_SSL macro, if you are going to use FTP client
 * over SSL functionality
 */
/*#define TM_USE_FTP_SSL */

/*
 * SSL Debuging option
 * Uncomment the TM_SSL_DEBUG macro, if you are going to debug SSL 
 * encrypt/decrypt, MAC, and padding
 */
/*#define TM_SSL_DEBUG */

/*
 * Allow the crypto engine to block while processing data
 */
/* #define TM_USE_ASYNC_CRYPTO */

/*
 * Uncomment the TM_DEV_SEND_OFFLOAD macro, if you want to use the
 * device driver TCP segmentation/checksum offload capabilities.
 */
/* #define TM_DEV_SEND_OFFLOAD */

/*
 * Uncomment the TM_DEV_RECV_OFFLOAD macro, if you want to use the
 * device driver recv packet checksum offload capabilities.
 */
/* #define TM_DEV_RECV_OFFLOAD */

/* 
 * Uncomment the TM_USE_DRV_ONE_SCAT_SEND macro, if you want to use
 * a single call to the device driver, passing the packet handle, even
 * when sending a frame with scattered buffers. Note that to enable 
 * this feature, this macro needs to be added, and tfUseInterfaceOneScatSend
 * needs to be called on the interface that supports it.
 */
#define TM_USE_DRV_ONE_SCAT_SEND

/* 
 * Uncomment the TM_USE_DRV_SCAT_RECV macro, if you want to allow
 * the device driver recv function to pass back a frame to the stack
 * in scattered buffers ("Gather Read"). Note that to enable this feature, 
 * this macro needs to be added, and  tfUseInterfaceScatRecv needs to be 
 * called on the interface that supports it.
 */
/* #define TM_USE_DRV_SCAT_RECV */

/*
 * Uncommment TM_NEED_ETHER_32BIT_ALIGNMENT and uncomment TM_USE_DRV_SCAT_RECV,
 * without using tfUseInterfaceScatRecv(),
 * if you want tfRecvInterface to make the TCP/IP header aligned on a
 * 4-byte boundary, if it is not aligned coming from a single buffer in
 * an Ethernet device driver.
 */
#define TM_NEED_ETHER_32BIT_ALIGNMENT

#define TM_ETHER_HW_ALIGN 4

/*
 * If your processor has a data cache and your network hardware supports DMA,
 * you should define this macro to be the cache line size (in bytes) of your
 * data cache. This ensures that all packet buffers will be allocated to start
 * and end at cache line boundaries, making cache flushing and invalidation in
 * the driver much easier to handle.
 * This option will cause extra RAM utilization in your system. Up to
 * ((2 * TM_PACKET_BUF_CACHE_ALIGN) - 2) extra bytes will be allocated for
 * each packet buffer to fulfill the alignment requirements.
 */
/* #define TM_PACKET_BUF_CACHE_ALIGN 64 */

/*
 * This macro causes the stack to manage data cache coherency internally. If
 * this is defined, the API's tfUseInterfaceCacheInvalFunc,
 * tfUseInterfaceCacheFlushFunc, and tfGetCacheSafeDrvBuf become available. The
 * driver buffer pool (tfPoolXXX) is also modified to use this functionality.
 * The stack will call the registered callback functions to flush or invalidate
 * data packets as needed. tfGetCacheSafeDrvBuf can be called to pre-allocate
 * receive buffers in the driver, if necessary.
 * TM_PACKET_BUF_CACHE_ALIGN must be correctly defined for this to work.
 * Note: This will not work on byte-stuffing interfaces (PPP, SLIP, etc.)
 */
/* #define TM_USE_DCACHE_MANAGEMENT */

/*
 * Uncomment the TM_LOOP_TO_DRIVER, if you want to loop back all the way
 * to the driver when sending to an Ethernet interface IP address.
 */
/* #define TM_LOOP_TO_DRIVER */

/*
 * Undefine/delete the TM_INDRV_INLINE_SEND_RECV macro to test intra 
 * machine driver with a separate recv task. In that case the intra machine 
 * received data will no longer be processed in the send path, but will be 
 * processed when tfRecvInterface/tfRecvScatInterface is called. In the
 * examples directory, the txscatlp.c, and txscatdr.c modules contain sample
 * code that uses this feature.
 */
#define TM_INDRV_INLINE_SEND_RECV

/*
 * Uncomment the TM_USE_INDRT, if you want to use the GHS INDRT debugging
 * tools . You also need to call tfUseIndrt() on the Ethernet interface
 * you want the INDRT debug messages to be sent and received on.
 */
/* #define TM_USE_INDRT */

/*
 * Uncomment the TM_MULTIPLE_CONTEXT macro, if you want to use multiple
 * instances of the Treck stack.
 */
/* #define TM_MULTIPLE_CONTEXT */

/*
 * Uncomment the TM_USE_STRONG_ESL macro, if you want to bind a socket
 * to an interface/device, which will restrict traffic to and from
 * that socket to traffic on the bound device.
 */
/* #define TM_USE_STRONG_ESL */

/*
 * Uncomment the TM_USE_STRICT_STRONG_ESL macro, if you want the stack
 * to automatically bind a TCP accepted socket (whose listening socket
 * was not bound to a device) to the incoming device.
 */
/* #define TM_USE_STRICT_STRONG_ESL */

/*
 * By default the prototypes in the header files are not declared extern.
 * If your linker dictates that they should be declared extern, then
 * uncomment the following macro.
 */

/* #define TM_PROTO_EXTERN extern */

/*
 * Uncomment the TM_DISABLE_ANSI_LINE_FILE macro if your compiler does not
 * support the ANSI __LINE__ and __FILE__ macros.
 * The tm_assert() macro will use the ANSI __LINE__ and __FILE__ macros (if
 * available) to print the source line number and source file name identifying
 * where in the code an assertion failure occurred for debugging purposes.
 */
/* #define TM_DISABLE_ANSI_LINE_FILE */

/* Uncomment the TM_PC_LINT macro, if you are using PC-LINT */
/*#define TM_PC_LINT */


/*
 * Thread stop is used to stop a thread which has had an unrecoverable error
 * by default defined to be a forever loop
 *
 * Unrecoverable errors dictate that the system MUST be reset!
 * You can define this to the reset for your board
 */

/* #define tm_thread_stop rtosReset() */

/*
 * Define the TM_PING_MILLISECONDS_INTERVAL macro, if you want the
 * pingInterval parameter passed to the obsolete tfPingOpenStart API
 * to be in milliseconds rather than in seconds.
 */
/* #define TM_PING_MILLISECONDS_INTERVAL */

/*
 * Define the TM_PING_USE_KERNEL_CLOCK macro, if you want the tfPingSendPacket
 * and tfPingRecvCB functions to use the API tfKernelGetSystemTimeMs32 to
 * obtain the 32-bit clock time in milliseconds, rather than use the global
 * variable tvTime. This is useful if tfKernelGetSystemTimeMs32 can return a
 * value with a better resolution than is stored in tvTime. Better resolution
 * will result in more accurate round trip times for PING echo request/reply
 * exchanges.
 */
#define TM_PING_USE_KERNEL_CLOCK


/*
 * Performance Macros
 */

/*
 * If we are using ethernet, we can use it inline to increase speed.
 */
#define TM_BYPASS_ETHER_LL

/*
 * Optimize for speed
 */
#define TM_OPTIMIZE_SPEED

/*
 * Optimize for size
 */
/* #define TM_OPTIMIZE_SIZE */

/*
 * If you have only a single interface, and you only configure a single IP
 * address on that interface (i.e. multi-homing is not required), then
 * uncomment the TM_SINGLE_INTERFACE_HOME macro to reduce code size.
 *
 * Warning: Defining this will prevent addition of the loop back device.
 * 1. Packets sent to the single interface IP address will be sent all the
 *    way to the driver, instead of being loop back by the stack.
 * 2. Packets cannot be sent to the IP loop back address, 127.0.0.1.
 */
/* #define TM_SINGLE_INTERFACE_HOME */

/*
 * If you have only a single interface, and you are using IPv6, then
 * uncomment the TM_SINGLE_INTERFACE macro to reduce code size. Note that
 * all IPv6 interfaces are multi-homed, so you cannot use the
 * TM_SINGLE_INTERFACE_HOME macro with IPv6.
 */
/* #define TM_SINGLE_INTERFACE */

/*
 * If you want to use AutoIP on multiple interfaces with Treck dual stack
 * IPv4+IPv6, then uncomment the TM_4_USE_SCOPE_ID macro. When
 * TM_4_USE_SCOPE_ID is enabled, any non-global scope IPv4 address matching
 * 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 or 169.254.0.0/16 (refer to the
 * macro IN4_IS_ADDR_LINKLOCAL in trmacro.h) must be stored in IPv4-mapped
 * IPv6 address format using "struct sockaddr_in6", and you must call the API
 * tf6SockaddrSetScopeId to set the scope ID on this "struct sockaddr_in6"
 * before passing it to any Treck API.
 */
/* #define TM_4_USE_SCOPE_ID */

/*
 * User defined checksum routines.
 * One of either TM_USER_OCS or TM_CUSTOM_OCS may be defined.
 * 1. If neither is defined, the stack will use a standard C implementation of
 *    the checksum or include a CPU-specific implementation if the user has
 *    defined an additional CPU specific macro such as TM_BORLAND_ASM_OCS,
 *    TM_GNUXSCALE_ASM_OCS, etc.
 * 2. TM_USER_OCS will cause the stack to include the file ocksum/trcsuser.c,
 *    which must be created by the user and must contain the function
 *    tfPacketChecksum().
 * 3. TM_CUSTOM_OCS will cause the stack to not compile in any checksum
 *    routine, meaning the user must link in a module containing the function
 *    tfPacketChecksum().
 *
 *    See the file trpkt.c for the standard implementation of this function.
 */
/* #define TM_USER_OCS */
/* #define TM_CUSTOM_OCS */
#ifdef NDS_SPECIFIC
#if ARCH == ARM
#define TM_GNUARM7_ASM_OCS  /* Use assembly version of ARM7 for GNU. */
#endif /* ARCH == ARM */
#else /* !NDS_SPECIFIC */
#ifdef NETOS_GNU_TOOLS
#define TM_GNUARM7_ASM_OCS  /* Use assembly version of ARM7 for GNU. */
#elif defined(__ghs__)
#define TM_COMPILER_GHS_ARM
#elif defined NETOS_ARM_TOOLS
#define TM_COMPILER_ARM
#define TM_GNUARM7_ASM_OCS
#define SLOW_WAY
#endif /* tools */
#endif /* NDS_SPECIFIC */

/* 
 * User defined random number generator
 * TM_USE_KERNEL_RNG will cause Treck's internal random number generator
 * to be replaced by the user-defined tfKernelGetRandom function.
 */
/* #define TM_USE_KERNEL_RNG */

/* If you have an different keyword for interrupt, then #define TM_INTERRUPT
   here to be that keyword
*/
/* #define TM_INTERRUPT interrupt */

/* !! NOTE about TM_GLOBAL_QLF and TM_GLOBAL_NEAR: *
 * 
 * Only one of them can be redefined to have a value, otherwise compiler
 * errors will occur
 */

/* Default qualifier for global variables. If you would like to put all global
 * variables into one memory type (e.g. far, huge, near), then #define
 * TM_GLOBAL_QLF here to be that qualifier and leave TM_GLOBAL_NEAR undefined
 */
/* #define TM_GLOBAL_QLF */

/* Default qualifier for frequently used global variables.
 * If you would like to put the frequently used global variables into 
 * one memory type (e.g. near) and the rest of them into a different
 * memory type (e.g. far, huge), then #define the memory type for frequently
 * used global variables here as TM_GLOBAL_NEAR and leave TM_GLOBAL_QLF
 * undefined
 */
/* #define TM_GLOBAL_NEAR */


/* Default qulifier for constants. If you would like to put all constants
 * into one memory type (e.g. far, huge, near), the #define TM_CONST_QLF
 * here to be that qualifier.
 */
/* #define TM_CONST_QLF */

/*
 * Uncomment the TM_USE_SHEAP macro if your RTOS does not provide heap
 * management routines, or if you do not want the Treck stack to allocate its
 * blocks of memory from the RTOS heap. When TM_USE_SHEAP is defined, the stack
 * allocates its blocks of memory from the Treck simple heap static array.
 */
/* #define TM_USE_SHEAP */

/*
 * Simple heap size (used by simple heap allocation routines in trsheap.c)
 * This is used by tfSheapMalloc() and tfSheapFree() provided in
 * trsheap.c, and called by tfKernelMalloc() and tfKernelFree() when
 * the RTOS does not provide heap support, and you do not want to use
 * C library malloc and free.
 * This is not documented because it is an OS supplement.
 * On a DSP platform, the heap size should be specified in words; on all
 * other targets the heap size should be specified in bytes.
 */
/*#define TM_SHEAP_SIZE TM_UL(512)*TM_UL(1024) */

/*
 * Minimum block size in bytes when using the simple heap, either when
 * allocating a new block, or when refragmenting a freed block. 
 * If not defined here, default value is 8 if TM_ERROR_CHECKING is
 * defined, 4 otherwise.
 */
/* #define TM_SHEAP_MIN_BLOCK_SIZE 16 */

/*
 * Uncomment the TM_SHEAP_MARK_MEMORY macro, so that simple heap
 * initial memory is filled with 0xFE, so that allocated simple heap memory
 * is filled with 0xA0, and that, freed simple heap memory is filled with 0xFA.
 * This helps check whether memory is accessed after having been freed.
 */
/* #define TM_SHEAP_MARK_MEMORY */

/*
 * Uncomment the TM_DYNAMIC_CREATE_SHEAP macro if you want the Treck simple
 * heap to be dynamically allocated by calling tfKernelSheapCreate rather
 * than implemented as a static array. It is usually necessary to define
 * TM_DYNAMIC_CREATE_SHEAP, if TM_SHEAP_NUM_PAGE is bigger than 1 (see below).
 */
/* #define TM_DYNAMIC_CREATE_SHEAP */

/*
 * Number of memory pages. Instead of a unique array, the simple heap can be
 * divided into several ones. Uncomment TM_SHEAP_NUM_PAGE and indicate the
 * number of pages if you are using the simple heap with a system that has
 * paged memory and that one page is too small to hold the whole simple heap
 * memory (static or preallocated by tfKernelSheapCreate).
 * In this case the simple heap will be divided in several non-contiguous
 * pages. If you do define TM_SHEAP_NUM_PAGE to a number bigger than 1,
 * then you will likely need to define TM_DYNAMIC_CREATE_SHEAP also.
 * The default for TM_SHEAP_NUM_PAGE is 1. Each page of memory must
 * have the same size. The page size is TM_SHEAP_SIZE/TM_SHEAP_NUM_PAGE.
 * If the page size is lower or equal to 4Kb (TM_BUF_Q6_SIZE), you cannot
 * use dynamic memory and must define TM_DISABLE_DYNAMIC_MEMORY.
 */
/* #define TM_SHEAP_NUM_PAGE 8 */

/*
 * Uncomment TM_DISABLE_DYNAMIC_MEMORY if you need to save ROM and RAM space.
 * Note that this will disable the Treck internal recycled buffer lists, which
 * is part of the "Treck Learn" feature. The system will require less
 * memory, but will be slower, because the system will not be able to take
 * advantage of the "Treck Learn" feature.
 */
/* #define TM_DISABLE_DYNAMIC_MEMORY */

/*
 * Uncomment TM_USE_FILTERING to allow IP Fragments to be delivered
 * to a user-specified callback function on a per-interface basis.  These
 * callbacks can be enabled/disabled for each device however this macro must
 * be enabled before any filter callback processing logic is processed.
 */
#define TM_USE_FILTERING

/*
 * Uncomment TM_6_USE_FILTERING to allow IPv6 datagrams to be delivered
 * to a user-specified callback function on a per-interface basis.  These
 * callbacks can be enabled/disabled for each device however this macro must
 * be enabled before any filter callback processing logic is processed.
 * When TM_6_USE_FILTERING is defined only the IPv6 header followed by
 * two bytes is guaranteed to be contiguous.
 * Please see also TM_6_USE_FILTERING_CONT_DATA below
 */
#define TM_6_USE_FILTERING

/*
 * Uncomment TM_6_USE_FILTERING_CONT_DATA, if you already have uncommented
 * TM_6_USE_FILTERING, and if you wish to peek at the ULP, and/or data in the
 * user-specified call back routine. In that case the ULP and data will be
 * contiguous with the IPv6 header.
 */
#define TM_6_USE_FILTERING_CONT_DATA

/*
 * Uncomment TM_USE_LBCAST_CONFIG to provide dynamic configuration of IPv4
 * Limited Broadcasting through the use of the TM_OPTION_IP_LBCAST_ENABLE
 * option to tfSetTreckOptions.
 */
/* #define TM_USE_LBCAST_CONFIG */

/*
 * Uncomment TM_USE_ECHO_CONFIG to provide dynamic configuration of IPv4
 * ICMP Echo Reples through the use of the TM_OPTION_ICMP_ECHO_ENABLE
 * option to tfSetTreckOptions.
 */
/* #define TM_USE_ECHO_CONFIG */

/* Enable only one of the following to choose the file system */
/* #define TM_USE_DOS_FS */
/* #define TM_USE_RAM_FS */
/* #define TM_USE_ROM_FS */

/* preconfigured Win32 projects */
/* #define TM_TRECK_DEMO */
/* #define TM_AUTO_TEST */

/*
 * RTOS/Kernel Macros
 */

/* #define TM_KERNEL_WIN32_X86 */
/* #define TM_KERNEL_VISUAL_X86 */
/* #define TM_KERNEL_LINUX_APP */
/* #define TM_KERNEL_ELX_86 */
/* #define TM_KERNEL_UCOS_CPU32 */
/* #define TM_KERNEL_UCOS_X86 */
/* #define TM_KERNEL_UCOS_PPC */
/* #define TM_KERNEL_UCOS_MIPS */
/* #define TM_KERNEL_AMX_CPU32 */
/* #define TM_KERNEL_AMX_X86 */
/* #define TM_KERNEL_DOS_X86 */
#define TM_KERNEL_THREADX_ARM7
/* #define TM_KERNEL_THREADX_CPU32 */
/* #define TM_KERNEL_NONE_EZ80 */
/* #define TM_KERNEL_RZK_EZ80 */
/* #define TM_KERNEL_UCOS_XSCALE */
/* #define TM_KERNEL_NONE_H8S */
/* #define TM_KERNEL_UCOS_SH2 */
/* #define TM_KERNEL_CMX_C16X */
/* #define TM_KERNEL_REALOS_FR */
/* #define TM_KERNEL_TI_DSP_BIOS */
/* #define TM_KERNEL_QUADROS */
/* #define TM_KERNEL_NONE_S56XX */

/*
 * Do we have seperate tasks for processing receive or send complete
 */

/*
 * Received packets are processed in a seperate Receive task
 * This all depends on how we setup our device driver and if we
 * are using mode 2 or mode 4 (see below)
 */
#define TM_TASK_RECV

/*
 * By default, packets are sent in the context of the application
 * sending the data, or of the timer task for retransmission of data,
 * or of the receive task for TCP acks, or PING echo replies for
 * example. If you wish to use a separate transmit task to
 * send the data to the driver, then define TM_TASK_XMIT.
 */
#ifndef NO_TRECK_XMIT_TASK_ENABLED
#define TM_TASK_XMIT
#endif /* !NO_TRECK_XMIT_TASK_ENABLED */

/*
 * When a send complete occurs, we process it in a seperate task
 * This all depends on how we setup our device driver and if we
 * are using mode 2 or mode 4 (see below)
 */
#define TM_TASK_SEND

/*
 * Device driver macros
 */

/* #define TM_QUICC */


/*
 * Compiler macros to take advantage on inline assembly (when needed)
 */

/* #define TM_COMPILER_SDS */     /* The SDS Crosscode Compiler for 68K */
/* #define TM_COMPILER_DDI_PPC */ /* The Diab Data Compiler for the PPC */
/* #define TM_COMPILER_GHS_PPC */ /* The Green Hills Compiler for the PPC */
/* #define TM_COMPILER_MRI_68K */ /* The MRI Compiler for 68K           */

/* #define TM_COMPILER_GHS_ARM */ /* The Green Hills Compiler for the ARM */

/* #define TM_COMPILER_GHS_68K */ /* The Green Hills Compiler for the 68K */
/* #define TM_COMPILER_GNU_PPC */ /* GNU GCC Compiler for the PPC */
/* #define TM_COMPILER_CW_5282 */ /* Metrowerks CodeWarrior for Motorola 5282*/

/* 
 * Define this macro, if compiler cannot handle nested braces
 * in the constant initialization of in6_addr structure 
 * (trsocket.h/trglobal.h/trinit.c)
 */
/* #define TM_IN6ADDR_NO_NESTED_BRACES */
/* 
 * Define this macro, if compiler cannot handle nested braces
 * in the constant initialization of tlFtpdCmdArray array (trftpd.c)
 */
/* #define TM_NO_NESTED_BRACES */

/*--------------------------------------------------------------------------*/

/*
 * The following macros are primitives that can be turned on/off to suite
 * your design (use these if you do NOT use the RTOS macros)
 */

/*
 * Processor Macros
 */
/* #define TM_EZ80 */
/* #define TM_INTEL_X86 */
/* #define TM_INTEL_XSCALE */
/* #define TM_MOTOROLA_CPU32 */
/* #define TM_MOTOROLA_68K */
/* #define TM_MOTOROLA_COLDFIRE */
/* #define TM_MOTOROLA_PPC */
/* #define TM_TMS320_C3 */
/* #define TM_TMS320_C3_BIG_ENDIAN */ /* For TI C3 like DSP with byte order reversed */
/* #define TM_TMS320_C5 */
/* #define TM_TMS320_C6 */

/*
 * Word Order
 */

/* #define TM_LITTLE_ENDIAN */

#ifdef eosdebug
/* To perform internal checking for the Treck Stack */
#define TM_ERROR_CHECKING
#endif /* eosdebug */

/*
 * Number of milliseconds per tick
 */
#define TM_TICK_LENGTH  10

/*
 * Power save macro:
 * Uncomment TM_USE_TIMER_CB if the user wants to avoid calling
 * tfTimerUpdate/tfTimerExecute periodically, and would rather
 * have the stack call a user defined CB function (registered when the
 * user calls tfRegisterTimerCB()) that lets the user know when to call
 * tfTimerExecute() next.
 * In that case, the user is responsible for updating tvTime, and
 * tvTimeRollOver prior to calling tfTimerExecute().
 */
/* #define TM_USE_TIMER_CB */


/*
 * Power save macro:
 * Uncomment TM_USE_TIMER_INTERVAL_QUERY if the user wants to query
 * the stack (tfTimerIntervalQuery()) for the interval before the next call
 * to tfTimerExecute() before going into power save mode.
 * The user is responsible for updating tvTime, and tvTimeRollOver prior
 * to calling tfTimerExecute(), and tfTimerIntervalQuery().
 */
/* #define TM_USE_TIMER_INTERVAL_QUERY */


/*
 * Mode 1:
 * Treck TCP/IP is used without an RTOS or Kernel
 */
/* #define TM_TRECK_NO_KERNEL */

/*
 * Mode 2:
 * Treck TC/IP is used as a shared library on a non-preemptive RTOS
 */
/* #define TM_TRECK_NONPREEMPTIVE_KERNEL */

/*
 * Mode 3:
 * Treck TCP/IP is used as an independent task on an RTOS
 * (preemptive or nonpreemtive)
 */
/* #define TM_TRECK_TASK */

/*
 * Mode 4:
 * Treck TCP/IP is used as a shared library on a premptive kernel
 */
#define TM_TRECK_PREEMPTIVE_KERNEL

#ifdef  TM_TRECK_DEMO
/*
 * Predefined Kernel Macros
 */
#define TM_USE_MIME
#define TM_PROBE_INTERVAL   100
#define TM_MAX_PROBE        2
#define TM_ERROR_CHECKING
#define TM_TRACE_LOGGING
#define TM_ERROR_LOGGING
#define TM_USE_TIMER_CB
#define TM_USE_REUSEADDR_LIST
#define TM_USE_REUSEPORT
#define TM_LOOP_TO_DRIVER
#define TM_KERNEL_WIN32_X86
#define TM_USE_NETSTAT
#define TM_USE_IPV6
#define TM_USE_IPV4
#define TM_USE_AUTO_IP
#ifndef TM_USE_RAM_FS /* not enough room in RAM FS for pcap file */
#define TM_USE_SNIFF
#endif /* TM_USE_RAM_FS */
#define TM_APP_CREATE_TIMER_THREAD
#define TM_USE_TEST_POINTS
#define TM_USE_SMTP
#define TM_USE_HTTPC
#define TM_USE_POP3
#define TM_USE_IPSEC
#define TM_USE_PRIORITIES
#define TM_USE_IKE
#define TM_USE_IKE_POLICIES
#define TM_USE_PKI
#ifdef _DEBUG
#define TM_IKE_PHASE1_NULL_ENCRYPT
#define TM_IKE_PHASE1_REKEYING_TEST
#define TM_IKE_DEBUG
#else /* _DEBUG */
#ifdef TM_ERROR_CHECKING
/* undef TM_ERROR_CHECKING so that we don't generate memoryleak.dat */
#undef TM_ERROR_CHECKING
#endif /* TM_ERROR_CHECKING*/
#endif /* _DEBUG */
#define TM_SNMP_VERSION     2
#define TM_SNMP_CACHE
#define TM_IGMP

/* #define TM_TAHI_TEST */
#ifdef TM_TAHI_TEST
#define TM_TAHI_TEST_INTF_NUM     2
#define TM_TAHI_TEST_INTF_IP_ADDR "30.0.0.201"
#define TM_TAHI_TEST_INTF_GW      "30.0.0.201"
#define TM_TAHI_TEST_INTF_NETMASK "255.255.255.0"
#undef TM_USE_DHCP
#undef TM_USE_IPSEC
#undef TM_USE_PRIORITIES
#undef TM_USE_IKE
#undef TM_USE_IKE_POLICIES
#undef TM_USE_PKI
#undef TM_SNMP_CACHE
#undef TM_USE_SNIFF
#undef TM_DEBUG_LOGGING
#undef TM_TRACE_LOGGING
#undef TM_ERROR_LOGGING
#undef TM_USE_LOGGING_LEVELS
#endif /* TM_TAHI_TEST */

#endif /* TM_TRECK_DEMO */

#ifdef  TM_AUTO_TEST
#define TM_USE_FILTERING
#define TM_USE_FILTERING_CONTIGUOUS_DATA
#define TM_6_USE_FILTERING
#define TM_6_USE_FILTERING_CONT_DATA
#define TM_IGMP
#define TM_LOCK_NEEDED
#define TM_TRACE_LOGGING
#define TM_SNMP_CACHE
#define TM_MULTIPLE_CONTEXT
#define TM_KERNEL_VISUAL_X86
#define TM_USE_REUSEADDR_LIST
#define TM_USE_REUSEPORT
#define TM_USE_NETSTAT
#ifndef TM_USE_RAM_FS /* not enough room in RAM FS for pcap file */
#define TM_USE_SNIFF
#endif /* TM_USE_RAM_FS */
#define TM_USE_TEST_POINTS
#define TM_USE_IPSEC
#define TM_USE_SEC_STAT
#define TM_USE_MULTIPLE_PROPOSALS
#define TM_USE_PRIORITIES
#define TM_USE_IKE
#define TM_USE_IKE_POLICIES
#define TM_USE_IKE_DPD
#define TM_USE_NATT
#define TM_USE_PKI
#define TM_IKE_PHASE1_REKEYING_TEST
#define TM_USE_IPV6
#define TM_6_USE_RAW_SOCKET
#define TM_USE_PPP_MSCHAP
#define TM_USE_EAP
#define TM_USE_IPHC
#define TM_USE_RAW_SOCKET
#define TM_SOC_RECV_Q_DGRAMS  30
#ifdef TM_SINGLE_INTERFACE_HOME
#undef TM_USE_IPV6
#endif /* TM_SINGLE_INTERFACE_HOME */
#endif /* TM_AUTO_TEST */

#ifdef TM_KERNEL_THREADX_ARM7
/*
 * ThreadX for the ARM7
 */
#define TM_ARM7
#define TM_TICK_LENGTH 10
#define TM_TRECK_PREEMPTIVE_KERNEL
#define TM_TASK_RECV
#define TM_BYPASS_ETHER_LL
#endif /* TM_KERNEL_THREADX_ARM7 */


#ifdef TM_ARM7
/*
 * ARM7 Core
 */
/* #define TM_LITTLE_ENDIAN */

#ifdef TM_COMPILER_GHS_ARM
#define TM_GHSARM7_ASM_CRITICAL
#ifndef TM_GHSARM7_ASM_OCS
#define TM_GHSARM7_ASM_OCS
#endif
#endif /* TM_COMPILER_GHS_ASM */

#endif /* TM_ARM7 */


#ifdef TM_LITTLE_ENDIAN
#undef TM_BIG_ENDIAN
#else /* !TM_LITTLE_ENDIAN */
#define TM_BIG_ENDIAN
#endif /* TM_LITTLE_ENDIAN */


#ifndef TM_TICK_LENGTH
#define TM_TICK_LENGTH 0
#endif /* !TM_TICK_LENGTH */


#ifdef TM_USE_IPV6
/*
 * TM_6_IP_FRAGMENT macro. Enable support for IPv6 fragmentation.
 * Comment out to save code space when IPv6 fragmentation is 
 * not needed.
 */
#define TM_6_IP_FRAGMENT

/*
 * TM_6_IP_REASSEMBLY macro. Enable support for IPv6 reassembly.
 * Comment out to save code space when IPv6 reassembly is
 * not needed.
 */
#define TM_6_IP_REASSEMBLY


/*
 * TM_6_USE_IP_FORWARD macro. Enable IPv6 forwarding code. Comment out to save
 * code space when IPv6 forwarding is not needed.
 */
/* #define TM_6_USE_IP_FORWARD */

/* Uncomment the TM_6_IP_SRC_ERROR_CHECKING macro if you want validation of
   the source address of received IPv6 packets. */
/* #define TM_6_IP_SRC_ERROR_CHECKING */

/*
 * Uncomment the TM_6_DISABLE_PMTU_DISC macro, if you want to disable automatic
 * IPv6 Path MTU discovery.
 */
/* #define TM_6_DISABLE_PMTU_DISC */

/* 
 * TM_6_USE_NUD macro. Enable IPv6 Neighbor Unreachability Detection code.
 * Comment out to save code space when IPv6 Neighbor Unreachability Detection
 * is not needed.
 */
#define TM_6_USE_NUD

/* 
 * TM_6_USE_MLD macro. Enable IPv6 Multicast Listener Discovery code. Comment
 * out to save code space when IPv6 Multicast Listener Discovery is not needed.
 */
#define TM_6_USE_MLD

/* 
 * TM_USE_RFC_3590 macro.  Enable Source Address Selection for the Multicast 
 * Listener Discovery (MLD) Protocol as defined in RFC 3590.
 */
/* #define TM_USE_RFC_3590 */

/* 
 * TM_6_USE_DAD macro. Enable IPv6 Duplicate Address Detection code. Comment
 * out to save code space when IPv6 Duplicate Address Detection is not needed.
 */
#define TM_6_USE_DAD

/* 
 * TM_6_USE_PREFIX_DISCOVERY macro. Enable IPv6 Prefix Discovery code, part
 * of stateless address auto-configuration. Comment out to save code space
 * when IPv6 Prefix Discovery is not needed.
 */
#define TM_6_USE_PREFIX_DISCOVERY

/* 
 * TM_6_USE_MIP_CN macro. Enable Mobile IPv6 correspondent node code.
 * Comment out to save code space when Mobile IPv6 correspondent node
 * functionality is not needed.
 */
/* #define TM_6_USE_MIP_CN */

/* 
 * TM_6_USE_MIP_MN macro. Enable Mobile IPv6 mobile node code. Comment out
 * to save code space when Mobile IPv6 mobile node functionality is not
 * needed.
 */
/* #define TM_6_USE_MIP_MN */

/*
 * TM_6_MIP_DRAFT24 macro. Use Mobility Header protocol ID and ICMPv6
 * message types per draft-ietf-mobileip-ipv6-24.txt, rather than IANA
 * assignments.
 */
/* #define TM_6_MIP_DRAFT24 */

/* 
 * TM_6_USE_MIP_HA macro. Enable Mobile IPv6 home agent code. Comment out
 * to save code space when Mobile IPv6 mobile node functionality is not
 * needed.
 * NOTE: As of IPv6 phase II release, this is only a HA lite that dones't 
 *       implement the whole functionality of a MIP6 home agent
 */
/* #define TM_6_USE_MIP_HA */

/* 
 * TM_6_USE_MIP_RO macro. Enable Mobile IPv6 route optimization. Comment
 * out to save code space when Mobile IPv6 route optimization is not needed.
 * ([MIPV6_18++].R14.4.5:10, [MIPV6_18++]R14.4.5:20)
 */

/* 
 * TM_6_MN_DISABLE_HOME_DETECT macro. Disable Mobile IPv6 Mobile Node home
 * detection/return to home functionality. If you know that the mobile node
 * never returns home, then you can define this macro to save some code
 * space.
 */
/* #define TM_6_MN_DISABLE_HOME_DETECT */

/*
 * TM_6_USE_MIP_RA_RTR_ADDR macro. When enabled, the mobile node uses the
 * Router Address option (when available) in received Router Advertisement
 * messages to determine if a Router Advertisement is from the current
 * default router.
 */

#endif /* TM_USE_IPV6 */


/*
 * For phase 1 negotiation, Elmic IKE supports digital signature
 * authentication method. It includes RSA/DSA algorithm, PEM/DER 
 * certification, X509v3 and ASN1 format, multi CA and CRL. TM_USE_PKI
 * macro shoule be defined in order to use this part. Whenever you define
 * TM_USE_SSL_CLIENT or TM_USE_SSL_SERVER, this macro is automatically
 * defined
 */
/* #define TM_USE_PKI */


#ifdef TM_USE_IPSEC
/*
 * IPsec and IKE Options
 */

/* 
 * Define TM_IPSEC_DEBUG to debug encryption/authentication in IPsec
 */
#define TM_IPSEC_DEBUG

/* 
 * Define TM_IKE_DEBUG to debug IKE
 */
#define TM_IKE_DEBUG

/*
 * Run IPsec as its own task
 */
/* #define TM_USE_IPSEC_TASK */

/*
 * When running IPsec as its own task, the maximum amount of allocated memory
 * that the task queue can contain
 */
/* #define TM_IPSEC_TASK_MAX_QUEUE_SIZE 16384 */

/*
 * If you are using the IPsec task (TM_USE_IPSEC_TASK), this macro will allow
 * you to set up another task to finish transmission of the packet after
 * crypto processing has completed. This will allow the IPsec task to push
 * another packet into the crypto engine as quickly as possible.
 */
/* #define TM_USE_IPSEC_HANDOFF_TASK */

/*
 * When running the IPsec handoff task, the maximum amount of allocated memory
 * that the task queue can contain
 */
/* #define TM_IPSEC_HANDOFF_TASK_MAX_QUEUE_SIZE 16384 */

/*
 * IPsec SA Timer Option
 * Uncomment the TM_DISABLE_IPSEC_SA_TIMERS macro, if you want to disable the
 * lifetime timers.  If this is done, there should be some external timer that
 * manages the callback to invoke the soft and hard lifetime logic.
 */
/*#define TM_DISABLE_IPSEC_SA_TIMERS */

/*
 * Uncomment this to set the minimum percentage of the IKE SA hard 
 * byte lifetime allowed before the soft byte lifetime expires to 20%.
 * If not set, this defaults to 20%.
 */
/* #define TM_ISAKMPSA_VLIFETIME_SOFT_MARGIN_PCT 20 */

/*
 * Uncomment this to set the minimum percentage of the IPsec SA hard 
 * byte lifetime allowed before the soft byte lifetime expires to 20%.
 * If not set, this defaults to 20%.
 */
/* #define TM_IPSECSA_VLIFETIME_SOFT_MARGIN_PCT 20 */


/*
 * Uncomment the TM_USE_IKE_TASK macro, if you want to
 * run IKE as its own task while processing received packets from the network.
 */
/* #define TM_USE_IKE_TASK */

/*
 * Uncomment the TM_USE_IKE_DPD macro, if you want to enable the
 * Dead Peer Detection code in IKE.
 * Needs TM_USE_IKE_POLICIES to be defined.
 */
/* #define TM_USE_IKE_DPD */

/*
 * Uncomment the TM_USE_NATT macro, if you want to enable the
 * Nat traversal code in IKE.
 * Needs TM_USE_IKE_POLICIES to be defined.
 */
/* #define TM_USE_NATT */

/*
 * Multiple Proposal Options
 * Uncomment the TM_USE_MULTIPLE_PROPOSALS macro, if you are going to use 
 * bundled SAs (i.e. AH/ESP/IPComp, for example).
 */
/*#define TM_USE_MULTIPLE_PROPOSALS */

/*
 * IKE Policy Option
 * Uncomment the TM_USE_IKE_POLICIES macro, if you are going to use IKE
 * policies in conjunction with IPsec policies.
 */
/*#define TM_USE_IKE_POLICIES */

/*
 * IKE Policy Incoming Outgoing Option
 * Uncomment the TM_IKE_VALIDATE_OUTGOING macro, if you want to check to see
 * that outgoing packet selectors match the addresses specified in the IPsec's
 * associated IKE policy.
 */
/*#define TM_IKE_VALIDATE_OUTGOING */

/*
 * IPsec Priorities
 * Uncomment the TM_USE_PRIORITIES macro, if you are going to use IKE policies
 * or Multiple proposals.
 */
/*#define TM_USE_PRIORITIES */

/*
 * IPsec Priority Processing
 * Uncomment the TM_USE_PRI_PROC macro, if you want to process IPsec policies
 * in Priority-based order instead of Index-based order.  This requires
 * TM_USE_PRIORITIES.
 */
/*define TM_USE_PRI_PROC */
 
/* 
 * For IPsec sequence, define the TM_IPSEC_USE_ANTIREPLAY to check the 
 * sequence number. Even this macro is defined, in the following cases,
 * we don't do antireplay checking. 1) not authenticated ESP packet
 * 2)Elmic recommends not to define anti-replay in manual keying
 * (if we do anti-replay in manual keying, all cycled
 * sequence packets will be dropped, unless the user manually update
 * the SA before the cycle happens.)
 */
/* #define TM_IPSEC_USE_ANTIREPLAY */

/* 
 * If we don't want to do ICMP incoming policy check at all, define this
 */
#define TM_IPSEC_INCOMING_ICMP_BYPASS

/* 
 * If a router is tunneling ICMP packet generated by other
 * routers, the source address of the inner header will not 
 * be the tunnel ends address, the source address check at the destination
 * will fail. Define TM_IPSEC_INCOMING_ICMP_NOSRCCHK to skip ICMP
 * source address checking, 

 * If TM_IPSEC_INCOMING_ICMP_BYPASS is defined, we don't do 
 * ICMP policy check at all 
 */

/*#define TM_IPSEC_INCOMING_ICMP_NOSRCCHK */

/* 
 * If you want to bypass IPsec protection to avoid the chicken-and-egg problem
 * for ICMPv6 ND and MLD message, please define this. If TM_USE_IKE is defined, 
 * you should define this macro, otherwise, you have to manually add the 
 * corresponding SA as the first thing.
 */
#define TM_6_IPSEC_ICMPV6_NDMLD_BYPASS 

/* 
 * The replay window size, default is 32 
 */
#define TM_IPSEC_DEFAULT_REPLAY_SIZE          32

/* 
 * IPsec SA Limit
 * The following defines the total number of IPsec SA pairs that can be 
 * present at one time.  When this limit is met, any new SA creation results
 * in the removal of the oldest SA.  The default is 100 pairs (100 incoming,
 * (100 outgoing).  To override this value, define a new value here.
 * To make the number of allowable SAs unlimited, set this to 0.
 * Note:  This is limited to a tt16Bit value.
 */
/*#define TM_IPSEC_SAD_MAX_SIZE 100 */

/* 
 * IKE SA Limit
 * The following defines the total number of IKE SAs that can be present
 * at one time.  When this limit is met, any new SA creation results in
 * the removal of the oldest SA.  The default is 100.  To override this
 * value, define a new value here.  To make the number of allowable SAs
 * unlimited, set this to 0.  Note:  This is limited to a tt16Bit value.
 */
/*#define TM_IKE_SAD_MAX_SIZE 100 */

/* 
 * IKE queued bytes limit.
 * Each policy content can only hold this maximum data waiting for IKE 
 * negotiation results. The default is 8000 bytes. To override this value
 * define a new value here. To prevent any data from being queued, set
 * this value to 0.
 */
/* #define TM_IKE_PACKET_MAX_QUEUE_BYTES  8000 */

/* Diffe-Hellman local secret size, NIST value = 256bits */
#define TM_IKE_DHSECRET_DEFAULT_SIZE          32

/* TM_IKE_PFS_KEY is set to require phase 2 PFS of key.
 * PFS of identity is set to require PFS of identity 
 */
#define TM_IKE_PFS_KEY_ENABLED

/* define AGGRESSIVE mode to use AGGRESSIVE mode rather than 
 * MAIN_MODE if we are the initiator for phase 1 negotiation 
 */
/*#define TM_IKE_PHASE1_AGGRESSIVE_ENABLED*/

/* for aggressive mode, we must know which Diffie-Hellman 
 * group we are going to use. (in order to send proper KE payload)
 */

#define TM_IKE_AGGRESSIVE_DHGROUP     TM_DHGROUP_2

/* INITIAL_CONTACT will be sent after we have encryption and
 * auth keys, and we only accept protected INITIAL_CONTACT message
 */
#define TM_IKE_INITIAL_CONTACT_ENABLED

/* For phase 1 negotiation, and use pre-sharedkey as the 
 * authentication method, Elmic IKE will try to find the 
 * pre-shared key for specified identification, if no pre-shared 
 * key found, and if TM_IKE_USE_DEFAULT_PRESHARED_KEY is defined, 
 * Elmic IKE will use the default preshared key to negotiate. 
 * If it is not defined and no preshared key is found, error will 
 * be returned.
 */

/* #define TM_IKE_USE_DEFAULT_PRESHARED_KEY */

/* Define the following macro to bypass any nested IKE packet, don't do any 
 * protection for nested IKE packet. Otherwise, if the following macro is
 * not defined, nested IKE packets are subject to policy check.
 */
/* #define TM_IPSEC_BYPASS_NESTIKE_PACKET */
#endif /* TM_USE_IPSEC */


#ifdef TM_USE_PKI
/* Whether check that a certificate is alive. If enable, TM_PKI_TIME 
 * must be defined as current time in order to compare before/after
 * time, and the default value of TM_PKI_TIME is "030514000000Z" that 
 * means 2003, May.14 and Z means  Zulu, or Greenwich Mean Time.
 */
/*#define  TM_PKI_CERT_CHECK_ALIVE */

/* Whether verify a certificate. If enable, all Certificates
 * except root CA's will be verified by their and chain's CAs. 
 */
/*#define TM_PKI_CERT_NOT_VERIFY */
#endif /* TM_USE_PKI */

#if (defined(TM_USE_IPSEC) || defined(TM_USE_SSL_CLIENT) || defined(TM_USE_SSL_SERVER))

/* if you want to use software implementation of any hash
 * algorithm (MD5 or SHA1 or RIPEMD), or cryptography algorithm (DES, 3DES
 * BLOWFISH, RC4, RC5, CAST128, TWOFISH, AES, DIFFIE-HELLMAN exchange,
 * RSA, DSA. you must define the following macro. If your hardware accelertor
 * supports all algorithms (including Diffie-Hellman key exchange),
 * you may want to comment out TM_USE_SW_CRYPTOENGINE to get
 * the minimal code size
 */
#define TM_USE_SW_CRYPTOENGINE

/* Define the following macro to use HIFN 7951 hardware accelerator */
/*#define TM_USE_HF7951_CRYPTOENGINE */

/* Define the following macro to use MCF5235 hardware accelerator */
/*#define TM_USE_MCF5235_CRYPTOENGINE*/

#ifdef TM_USE_SW_CRYPTOENGINE
/* Define the following software implemenation of cryptography algorithms.
 * If any of the following algorithms are supported by your hardware
 * accelerator, you may want to comment them out to reduce code size.
 */
/* DES and 3DES uses the same module */
/* #define TM_USE_MD2 */
#define TM_USE_MD5
#define TM_USE_SHA1
#define TM_USE_RIPEMD
#define TM_USE_DES 
#define TM_USE_3DES 
/* #define TM_USE_BLOWFISH */
/* #define TM_USE_RC2 */
/*Must have patent license to use RC5 */
/*#define TM_USE_RC5*/
/* #define TM_USE_CAST128 */
#define TM_USE_AES
/* #define TM_USE_TWOFISH */
#define TM_USE_ARCFOUR
#define TM_PUBKEY_USE_DIFFIEHELLMAN
#define TM_USE_DIFFIEHELLMAN_PADDING
#ifdef TM_USE_PKI
#define TM_PUBKEY_USE_RSA
#define TM_PUBKEY_USE_DSA
#endif /* TM_USE_PKI */
#endif /* TM_USE_SW_CRYPTOENGINE */

#ifdef TM_USE_MCF5235_CRYPTOENGINE
#ifndef TM_USE_MD5
#define TM_USE_MD5
#endif /* TM_USE_MD5 */
#ifndef TM_USE_SHA1
#define TM_USE_SHA1
#endif /* TM_USE_SHA1 */
#ifndef TM_USE_DES
#define TM_USE_DES 
#endif /* TM_USE_DES */
#ifndef TM_USE_3DES
#define TM_USE_3DES 
#endif /* TM_USE_3DES */
#ifndef TM_USE_AES
#define TM_USE_AES
#endif /* TM_USE_AES */
#endif /* TM_USE_MCF5235_CRYPTOENGINE */

#endif /* TM_USE_IPSEC || TM_USE_SSL_CLIENT || TM_USE_SSL_SERVER */


/*
 * SSL TLS options
 */
/* Uncomment the following macro if user doesn't want SSL 3.0 */
#define TM_USE_SSL_VERSION_30

/* Uncomment the following macro if user doesn't want SSL 3.1, i.e TLS 1.0 */
#define TM_USE_SSL_VERSION_31

/* uncomment the following macro if you don't want to accept SSL 2.0 hello */
#define TM_SSL_ACCEPT_20_CLIENTHELLO
/* If the following macro is defined, upon receiving close_notify, we will
 * immediately flush our send queue and send back close_notify to the peer,
 * and shutdown SSL send path. If this macro is not defined, it is up to the 
 * user to call tfSslConnectUserClose or tfClose to shutdown the SSL send 
 * path. Note that, if user doesn't call anything, the SSL send path is 
 * still ON until the socket is closed.
 */
#define TM_SSL_IMMEDIATE_CLOSE_NOTIFY

/* The minimum user data bytes to TRIGGER SSL send. Data less than this size 
 * will not trigger SSL send, instead, it will be queued.  Once SSL send
 * has been triggered up, all pending user data will be sent out and after
 * that SSL waits for the next trigger event to send again. The default value
 * is set to zero, ie, SSL wont queue any packet. If user chooses to set it
 * to something else, user should be aware that if application data is smaller
 * than this threshold, it won't be sent out unless user flush the channel
 * by calling tfSslUserSendFlush()
 */
#define TM_SSL_SEND_DATA_MIN_SIZE                0

/* The maximum value of user data in one single SSL record. By RFC, this value
 * is 16384. However, considering that peer may not have enough receive buffer
 * to queue, we use the following value (8000). So if user wants to send more 
 * than 8000 bytes of data, see 8100 bytes, we have to cut it into two SSL 
 * records, one contains 8000 user data bytes, another one contains 100 user 
 * data bytes (Note that even if 100 is less than TM_SSL_SEND_DATA_MIN_SIZE, 
 * we still send it out, because we used 8100 bytes to trigger up SSL send.)
 */
#define TM_SSL_SEND_DATA_MAX_SIZE                8000 

/* uncomment the following macro, if you don't want to use any ephemeral
 * Diffie-Hellman key exchange method. For example, if your SSL cipher suite
 * is something like SSL_RSA_XXXX or TLS_RSA_XXXX (The most popular case in 
 * real world), you don't need this macro.
 */
#define TM_SSL_USE_EPHEMERAL_DH

/* uncomment the following macro if you don't want do mutual authentication*/
#define TM_SSL_USE_MUTUAL_AUTH

/* If you don't define TM_EXPORT_RESTRICT, you may want to reject any 
 * exportable cipher suites by defining the following macro. Note that, 
 * by defining the following macro, you get higher security because you
 * reject any exportable cipher suite, the cost is that you may not be 
 * able to negotiation with clients which offer exportable cipher suites
 * only. If you do define TM_EXPORT_RESTRICT, this macro has no effect
 * to the behavior. Default not to be defined
 */
/*#define TM_SSL_REJECT_EXPORTABLE_CIPHER*/

/* uncomment the following macro only if 1) you want to negotiate EDH_DSS_XXX
 * cipher 2) negotiate with Netscape only 3) in SSL version 3.0 version only. 
 * If any of these three conditions is false, don't uncomment this macro.
 * The description of how to encode DSS signature in the SSLv3 specification 
 * is insufficiently specific and Netscape interprets it differently from most
 * other vendors. Instead of DER encoding r and s, Netscape merely 
 * concatenates them into a single 40-byte field. Thus, although Netscape 
 * implements DSS for client authentication, it is not interoperable with 
 * other implementations. Despite widespread agreement on the "right thing" 
 * Netscape has refused to change their implementation, claiming that it 
 * complies with the SSL v3 specification and citing installed base. The TLS
 * specification clears up this issue; ALL TLS implementations must DER 
 * encode DSS signature 
 */
/* #define TM_SSL30_DSSSIGN_NETSCAPE_FORMAT */

/*The following Diffie-Hellman parameters take effect only if Ephemeral Diffie
 * hellman is enabled and is chosen as the key exchange method.
 */

/* if you don't have export restrict, we use OAKLEY group 1 prime
 * (768 bits)if Ephemeral Diffie-Hellman is going to be used. TM_
 * DHGROUP_2 is 1024 bits, and TM_DHGROUP_EXPORT is 512 bits. According
 * to draft draft-ietf-tls-56-bit-ciphersuites-01.txt, Changes in US export
 * regulations in 1999 permitted the export of software programs 
 * using 56-bit data encryption and 1024-bit key exchange
 */
#define TM_SSL_DHE_PRIME_GROUP             TM_DHGROUP_1

/* Diffie-Hellman generator is 2 */
#define TM_SSL_DHE_GENERATOR               TM_DH_GENERATOR_2

/* Diffie-Hellman private secret default size*/
#define TM_SSL_DHSECRET_DEFAULT_SIZE       32


/* Uncomment the following macro if the client allows no certificate 
 * operation even in client-authentication situation. If the macro is
 * defined, the SSL_CLIENT will ignore Cert_Request message if it
 * doesn't have any certificate, and continue normal SSL negotiation. 
 * To close the connection or not will be up to the server to decide. 
 * In any case the client will send an alert-warning message to server.
 */
/* #define TM_SSL_CLIENT_ALLOW_NO_CERT */

/*
 * Uncomment the following line, if you want to use C library routines,
 * instead of the equivalent library routines provided by the Turbo Treck 
 * stack.
 */
#define TM_USE_CLIB

#ifdef TM_USE_CLIB
/* NOTE: you may need to modify the following, if you #define TM_USE_CLIB
 *
 * For isupper, tolower ... */
#include <ctype.h>
/* For memcpy, strchr ...   */
#include <string.h>
/* For printf, sprintf...   */
#include <stdio.h>
/* For strtoul... */
#include <stdlib.h>
#endif /* TM_USE_CLIB */

/* 
 * if TM_USE_SNIFF is defined, interface drivers will dump the packets to the
 * file system in libpcap format, to be opened by tcpdump, windump, ethereal, 
 * or other libpcap file readers.
 */
#ifndef TM_USE_RAM_FS /* not enough room in RAM FS for pcap file */
/* #define TM_USE_SNIFF */
#endif /* !TM_USE_RAM_FS */


#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif /* _TRSYSTEM_H_ */

/* Processed by Treck Shipping Tool v2.52 
 * 2007/10/04 15:41:19      For: Digi
 * File Name: trsystem.h    File Revision: 4.7.2.12 
 * Project Name: tcpip.pj   Project Release: 4.7.1.26
 * Input checksum: 21082    Output checksum: 49517
 */
