/*
 * 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: Global Definitions for trinit.c.
 * Filename: trglobal.h
 * Author: Odile & Paul
 * Date Created:
 * $Source: /cvs_tick/treck_stack/include/trglobal.h,v $
 *
 * Modification History
 * $Revision: 1.21.24.3 $
 * $Date: 2009/05/19 22:52:08 $
 * $Author: jrakhval $
 * $ProjectName: /home/mks/proj/tcpip.pj $
 * $ProjectRevision: 4.7.1.26 $
 */

#ifndef _TRGLOBAL_H_

#define _TRGLOBAL_H_

#ifdef __cplusplus
extern "C" {
#endif


/* 
 * All global variables are either in ttGlobal (true global), or in 
 * ttContext (per context variables). If user does not use multiple context
 * context variables are true global variables, but are still kept in separate
 * ttContext structure.
 */
typedef struct tsGlobal
{
#if ( (defined(TM_LOCK_NEEDED) || defined(TM_PEND_POST_NEEDED)) )
/* Counting semaphores recycle list */
    ttCountSemPtr                       tvCountSemListPtr;
/* Pre-allocated block of counting semaphores */
    ttCountSemPtr                       tvCountSemAllocPtr;
/* used counting semaphores in current block allocation */
    int                                 tvCountSemUsedCount; 
#endif  /* ( (defined(TM_LOCK_NEEDED) || defined(TM_PEND_POST_NEEDED))  */

#ifdef TM_PEND_POST_NEEDED
/* Select pend entry recycle list */
    ttList                              tvSelPendEntryHead;
#ifdef TM_LOCK_NEEDED
/* Lock for select pend entry recycle list */
    ttLockEntry                         tvSelPendEntryLock;
#endif /* TM_LOCK_NEEDED */
#endif /* TM_PEND_POST_NEEDED */

#ifdef TM_ERROR_CHECKING
/* Temporary buffer used by tm_assert() to build the error message */
    char                                tvAssertTempBuf[256];
#endif  /* TM_ERROR_CHECKING */
/* Low Water Mark for notifying device send completes. Accessed in ISR. */
    tt32Bit                             tvNotifySendCompLowWater;


#ifdef TM_USE_SHEAP
/* Simple heap variables */
    ttRawMemoryPtr                      tvSheapFreeListPtr;
    ttRawMemoryPtr                      tvSheapFragmentListPtr;
    tt32Bit                             tvSheapUsedLongs;
#ifdef TM_LOCK_NEEDED
    ttLockEntry                         tvSheapLock;
/* Simple heap counting semaphore for lock/unlock */
    ttCountSem                          tvSheapCountSem; 
/* Simple heap counting semaphore for lock/unlock has been created */
    tt8Bit                              tvSheapCountSemCreated; 
#endif /* TM_LOCK_NEEDED */
#endif /* TM_USE_SHEAP */

#if (defined(TM_USER_PACKET_DATA_ALLOC) && defined(TM_LOCK_NEEDED))
/* enable packet data buffers to be allocated in on-chip RAM */
    ttLockEntry                         tvPacketDataAllocLock;
#endif /* TM_USER_PACKET_DATA_ALLOC and TM_LOCK_NEEDED */

#ifdef TM_ERROR_CHECKING
    tt32Bit                             tvGetRawCount;
    tt32Bit                             tvFreeRawCount;
#ifdef TM_USE_ANSI_LINE_FILE
#if (defined(TM_KERNEL_VISUAL_X86) || defined(TM_KERNEL_WIN32_X86) \
     || defined(TM_MEMORY_LOGGING))
#if (defined(TM_KERNEL_VISUAL_X86) || defined(TM_KERNEL_WIN32_X86))
    FILE *                              tvMemoryLeakDetector;
#endif /* defined(TM_KERNEL_VISUAL_X86) || defined(TM_KERNEL_WIN32_X86) */
#ifdef TM_LOCK_NEEDED
    ttLockEntry                         tvMemoryLeakLock;
#endif /* TM_LOCK_NEEDED */
#endif /* Win32 or TM_MEMORY_LOGGING */
#endif /*  TM_USE_ANSI_LINE_FILE */
#endif /* TM_ERROR_CHECKING */
/*
 * Only used for dynamic memory management.
 */
#ifdef TM_USE_DYNAMIC_MEMORY
/*
 * Raw Memory Queues
 */
    ttRawMemoryPtr                      tvBufQxListPtr;
    ttRawMemoryPtr                      tvBufQ0ListPtr;
    ttRawMemoryPtr                      tvBufQ1ListPtr;
    ttRawMemoryPtr                      tvBufQ2ListPtr;
    ttRawMemoryPtr                      tvBufQ3ListPtr;
    ttRawMemoryPtr                      tvBufQ4ListPtr;
    ttRawMemoryPtr                      tvBufQ5ListPtr;
    ttRawMemoryPtr                      tvBufQ6ListPtr;

/* 
 * Recycled buffer lists.
 */
/* Queue of recycled timers */
    ttRcylPtr                           tvTimListPtr;
/* List of recycled packet buffers */
    ttRcylPtr                           tvPakListPtr;
/* Queue of recycled routing entries / ARP entries */
    ttRcylPtr                           tvRteListPtr;
/* Queue of recycled UDP/ICMP sockets */
    ttRcylPtr                           tvSocListPtr;
/* Queue of recycled TCP sockets/state vectors combination */
    ttRcylPtr                           tvTcpListPtr;


#ifdef TM_LOCK_NEEDED
/*
 * Dynamic Memory Queue Lock
 */
    ttLockEntry                         tvDynMemLockEntry;
#endif /* TM_LOCK_NEEDED */
/* Digi: Amount of memory in use by the stack (on recycle lists, not freed) */
    tt32Bit                             tvMemRecycledBytes;
/* Digi: Amount of memory in use by the stack (in use or recycled, not freed) */
    tt32Bit                             tvMemAllocatedBytes;
/* Digi: Amount of memory in use by the stack (in use, not recycled or freed) */
    tt32Bit                             tvMemInUseBytes;
/* Digi: Maximum value observed for tvMemRecycledBytes */
    tt32Bit                             tvMemRecycledBytesMax;
/* Digi: Maximum value observed for tvMemAllocatedBytes */
    tt32Bit                             tvMemAllocatedBytesMax;
/* Digi: Maximum value observed for tvMemInUseBytes */
    tt32Bit                             tvMemInUseBytesMax;
#endif /* TM_USE_DYNAMIC_MEMORY */

/* RAM file system: RAM drive pointer */
    ttVoidPtr                           tvRamfsPtr;
#ifdef TM_MULTIPLE_CONTEXT
/*
 * The current network ID used for multiple context interface driver
 */
    ttUser32Bit                         tvCurrNetworkId;
#endif /* TM_MULTIPLE_CONTEXT */
#ifdef TM_USE_DOS_FS
/* Dos Root */
    char                       TM_FAR * tvRootDirPtr;
#endif /* TM_USE_DOS_FS */
/*
 * Ethernet global variables
 */
    ttEnetAddressUnion                  tvEtherBroadcast;
    char                                tv1ChapEmptyString[1];
} ttGlobal;

typedef ttGlobal TM_FAR * ttGlobalPtr;

/*
 * Per context variables.
 */

typedef struct tsContext
{
#ifdef TM_USE_TIMER_CB
    ttUserTimerCBFuncPtr        tvTimerCBFuncPtr;
    ttUserGenericUnion          tvTimerCBParam;
    tt32Bit                     tvTimerCBExpTime;
    tt32Bit                     tvTimerCBExpRollOver;
#endif /* TM_USE_TIMER_CB */

#ifdef TM_USE_SOAP
    tt32Bit                     tvSoapOptions;
#endif /* TM_USE_SOAP */



#ifdef TM_USE_PKI
    ttVoidPtr           tvPkiPtr;
#ifdef TM_LOCK_NEEDED
    ttLockEntry         tvPkiLockEntry;
#endif /* TM_LOCK_NEEDED */
#endif /* TM_USE_PKI */
/* 
 * all crypto engine, software engine or hifn7951 
 * hardware crypto engine, are linked here.
 */
   ttVoidPtr            tvCryptoLibPtr;
#ifdef TM_LOCK_NEEDED
   ttLockEntry          tvCryptoLockEntry;
#endif /* TM_LOCK_NEEDED */

#ifdef TM_USE_IPSEC
/* IPsec global variable, of type ttIpsecEntryPtr */
    ttVoidPtr           tvIpsecPtr;
/* IPsec global structure, of type ttIpsecFuncEntry */
    ttIpsecFuncEntry    tvIpsecFunc;
#ifdef TM_LOCK_NEEDED
    ttLockEntry         tvIpsecLockEntry;
#endif /* TM_LOCK_NEEDED */
#ifdef TM_USE_IPSEC_TASK
    ttList              tvIpsecTaskList;
    ttEventEntry        tvIpsecTaskEvent;
#ifdef TM_LOCK_NEEDED
    ttLockEntry         tvIpsecTaskLockEntry;
    ttLockEntry         tvIpsecTaskProcLockEntry;
#endif /* TM_LOCK_NEEDED */
    int                 tvIpsecTaskQSize;
    tt8Bit              tvIpsecTaskRunning;
#endif /* TM_USE_IPSEC_TASK */
#ifdef TM_USE_IPSEC_HANDOFF_TASK
    ttList              tvIpsecHandoffTaskList;
    ttEventEntry        tvIpsecHandoffTaskEvent;
#ifdef TM_LOCK_NEEDED
    ttLockEntry         tvIpsecHandoffTaskLockEntry;
    ttLockEntry         tvIpsecHandoffTaskProcLockEntry;
#endif /* TM_LOCK_NEEDED */
    int                 tvIpsecHandoffTaskQSize;
    tt8Bit              tvIpsecHandoffTaskRunning;
#endif /* TM_USE_IPSEC_HANDOFF_TASK */
#endif /* TM_USE_IPSEC */

#ifdef TM_USE_ASYNC_CRYPTO
    ttEventEntry        tvAsyncCryptoEvent;
    ttLockEntry         tvAsyncCryptoLockEntry;
#endif /* TM_USE_ASYNC_CRYPTO */


#ifdef TM_USE_PRIORITIES
    ttLockEntry         tvPriLock;
    ttVoidPtr           tvPriListPtr;
    ttVoidPtr           tvPriUsedListPtr;
#endif /* TM_USE_PRIORITIES */

#ifdef TM_USE_IKE
/* IKE global variable, of type ttIkeGlobalPtr */
    ttVoidPtr           tvIkePtr;
#ifdef TM_LOCK_NEEDED
    ttLockEntry         tvIkeLockEntry;
#endif /* TM_LOCK_NEEDED */
#ifdef TM_USE_IKE_TASK
#if ( (defined(TM_LOCK_NEEDED) || defined(TM_PEND_POST_NEEDED)) )
    ttLockEntry         tvIkeExecuteLockEntry;
#endif  /* ( (defined(TM_LOCK_NEEDED) || defined(TM_PEND_POST_NEEDED))  */
#ifdef TM_PEND_POST_NEEDED
    ttPendEntry         tvIkePendSem;
#endif  /* TM_PEND_POST_NEEDED */
/*
 * Controls freeing the IKE global structure with the EXEC lock on.
 * Could be moved to the ikeGlobal structure if we use a single
 * IKE lock
 */
    tt8Bit              tvIkeShutdown;
#endif /* TM_USE_IKE_TASK */
#endif /* TM_USE_IKE */


/* when multiple PPP authentication method is used, such as CHAP, 
 * PAP and MSCHAP, we need assign priority value to each method, 
 * so that the authenticator can control the proposal order according
 * to the priority.
 * If MS-CHAP is not used, we always prefer CHAP to PAP
 */
    tt32Bit             tvPppAuthPriority;

#ifdef TM_SNMP_MIB
    ttVoidPtr           tvSnmpdPtr;
#endif /* TM_SNMP_MIB */

#ifdef TM_SNMP_CACHE
    ttSnmpdCacheHead    tvSnmpdCaches[TM_SNMPD_CACHES];
#endif /* TM_SNMP_CACHE */

#ifdef TM_USE_IPV6
    ttDeviceEntryPtr    tv6McastDevPtr;

#ifdef TM_6_USE_PREFIX_DISCOVERY
/* Stateless Address Auto-Configuration prefix aging timer */
    ttTimerPtr          tv6RtPrefixAgingTimerPtr;
#endif /* TM_6_USE_PREFIX_DISCOVERY */

#ifdef TM_6_USE_NUD
/* Neighbor Unreachability Detection reachable timer */
    ttTimerPtr          tv6ReachableTimerPtr;
#endif /* TM_6_USE_NUD */

#ifdef TM_6_IP_REASSEMBLY
/* Timer used for IPv6 reassembly timeouts. */
    ttTimerPtr          tv6IpFHTimerPtr;

/* Queue of fragment heads */
    tt6IpFHEntryPtr     tv6IpFHPtr;
#endif /* TM_6_IP_REASSEMBLY */

/* IPv6-over-IPv4 virtual link layer handle. */
    ttLinkLayerEntryPtr tv6Ipv4TunnelLinkLayerHandle;

/* IPv6-over-IPv6 virtual link layer handle. */    
    ttLinkLayerEntryPtr tv6Ipv6TunnelLinkLayerHandle; 

/* Default configured tunnel device entry pointer. */
    ttDeviceEntryPtr    tv6Ipv4DefGwTunnelPtr;

/* IPv6-over-IPv4 automatic tunnel device entry pointer. */
    ttDeviceEntryPtr    tv6Ipv4AutoTunnelPtr;

/* Handles ICMPv6 errors in an IPv6 tunnel */
    tt6TunnelIcmpErrorFuncPtr tv6Ipv6IcmpTunnelFuncPtr;

/* Handles ICMPv4 errors in an IPv6 tunnel */
    tt6TunnelIcmpErrorFuncPtr tv6Ipv4IcmpTunnelFuncPtr;
    
#ifdef TM_6_IP_REASSEMBLY
#ifdef TM_LOCK_NEEDED
/* Lock for the fragment head list. */
    ttLockEntry         tv6IpFHLock;
#endif /* TM_LOCK_NEEDED */
#endif /* TM_6_IP_REASSEMBLY */

/* IPv6 cached routing entry. */
    ttRtCacheEntry      tv6RtIpForwCache;

/* IPv6 cached routing entry lock - needed even if TM_LOCK_NEEDED is not
   defined. */
    ttLockEntry         tv6RtIpForwCacheLock;

/* IPv6 send routing cache entry. */
    ttRtCacheEntry      tv6RtIpSendCache;

/* IPv6 send routing cache lock entry.
   Needed also when TM_LOCK_NEEDED not defined */
    ttLockEntry         tv6RtIpSendCacheLock;

#ifdef TM_6_USE_RAW_SOCKET
/* IPv6 raw socket cache lock */
    ttLockEntry         tv6RawCacheLock;

/* Cached IPv6 raw socket. */
    ttSocketEntryPtr    tv6RawSocketPtr;
#endif /* TM_6_USE_RAW_SOCKET */
    
#ifdef TM_6_IP_REASSEMBLY
/* Fragmentation resolution (default, 60 seconds). */
    tt32Bit             tv6FragResolution;

/* Maximum size in bytes of an IPv6 datagram waiting to be reassembled */
    tt32Bit             tv6FragEntryMaxSize;
#endif /* TM_6_IP_REASSEMBLY */
    
/* Maximum number of times to send unicast Neighbor Solicitation 
   when trying to resolve an address. */
    tt32Bit             tv6NdUnicastRequestTries;

/* Maximum number of times to send multicast Neighbor Solicitation 
   when trying to resolve an address. */
    tt32Bit             tv6NdMcastRequestTries;

/* Limit the rate at which ICMPv6 error messages are sent.
   ([RFC2463].R2.4:100) */
    tt32Bit             tv6IcmpTxErrLastTickCnt;

/* Refer to TM_6_OPTION_ICMP_TX_ERR_LIMIT. ([RFC2463].R2.4:110) */
    tt32Bit             tv6IcmpTxErrLimitMsec;



#ifdef TM_6_PMTU_DISC
/* The amount of time (in seconds) to wait before increasing an IPv6
   Path MTU estimate. */
    tt32Bit             tv6RtPathMtuTimeout;
#endif /* TM_6_PMTU_DISC */
#endif /* TM_USE_IPV6 */

#ifdef TM_USE_LOGGING_LEVELS
    ttLogLevelStoragePtr       tvLogLevelStoragePtr;
#endif /* TM_USE_LOGGING_LEVELS */
#if (defined(TM_DEBUG_LOGGING) || defined(TM_TRACE_LOGGING) || \
     defined(TM_ERROR_LOGGING) || defined(TM_MEMORY_LOGGING) || \
     defined(TM_USE_LOGGING_LEVELS))
/* support for debug, error and trace logging to circular buffer */
    ttLogCtrlBlkPtr     tvLogCtrlBlkPtr;
#endif

/* lookup table used to optimize storage of device pointer so that it only
   requires a 16-bit SNMP device index (1-based). */
    ttDeviceEntryPtr    tvDevIndexToDevPtr[TM_MAX_NUM_IFS + 1];

#if (defined(TM_OPTIMIZE_MANY_MHOMES) && !defined(TM_SINGLE_INTERFACE_HOME))
/* sort IP addresses to improve performance of IP address lookup in the
   receive-path when many IP aliases are configured on a single interface.
   The SNMP Agent can use this to speed up non-exact match processing
   in tfIpAddrTableEntryGet. */

#ifdef TM_USE_IPV4
    ttSortedIpAddrCache tv4SortedIpAddrCache;
#endif /* TM_USE_IPV4 */

#ifdef TM_USE_IPV6
    ttSortedIpAddrCache tv6SortedIpAddrCache;
#endif /* TM_USE_IPV6 */
#endif /* TM_OPTIMIZE_MANY_MHOMES and not TM_SINGLE_INTERFACE_HOME */

/* 
 * Globals Initialized Flag
 */
    tt32Bit               tvContextGlobalsSet;
/*
 * Timer variables.
 */
/* Control block for managing timer queues */
    ttTimerCtrl           tvTimerCtrl;
#ifdef TM_DEMO_TIME_LIMIT
    ttTimer               tvDemoTimer;
#endif /* TM_DEMO_TIME_LIMIT */

/*
 * ARP Resolve Queue
 */
    ttPacketPtr           tvArpResolveQueuePtr;
#ifdef TM_LOCK_NEEDED
    ttLockEntry           tvArpResolveQLock;
    ttLockEntry           tvArpResolveLockEntry;
#endif /* TM_LOCK_NEEDED */

/*
 * ARP resolution
 */

    tt32Bit               tvArpRequestTries;
    tt32Bit               tvArpRetryTime;
    tt32Bit               tvArpQuietTime;


/* 
 * ARP cache
 */

/* ARP entry timeout in milliseconds (600,000) */
    tt32Bit               tvArpTimeout;
/* ARP entries timer resolution in milliseconds (60,000) */
    tt32Bit               tvArpResolution;
/* Maximum number of ARP cache entries */
    int                   tvArpMaxEntries;
/* No socket errorCode */
    int                   tvErrorCode;
/*
 * Proxy ARP table
 */
/* Pointer to first element of proxy Arp table */
    ttProxyEntryPtr       tvProxyHeadPtr;
/* Proxy Lock */
    ttLockEntry           tvProxyLockEntry;


/* array of socket pointers */
    ttSocketEntryPtrPtr   tvSocketArray;
    tt16BitPtr            tvSocketErrorArray;
/* Maximum number of sockets */
    tt32Bit               tvMaxNumberSockets;
/* Number of open sockets */
    tt32Bit               tvNumberOpenSockets;
/* Maximum number of allocated TCP sockets */
    tt32Bit               tvMaxTcpVectAllocCount;
/* Number of allocated TCP sockets */
    tt32Bit               tvTcpVectAllocCount;
/* Last slot used in the socket array */
    tt32Bit               tvSocketSearchIndex;
/* Digi: Number of open file sockets (added by Digi) */
    tt32Bit               tvNumberOpenFileSockets;
/* Digi: Number of open device sockets (added by Digi) */
    tt32Bit               tvNumberOpenDeviceSockets;
#ifdef ZIGBEE_ENABLED
/* Digi: Number of open ZigBee sockets (added by Digi) */
    tt32Bit               tvNumberOpenZigBeeSockets;
#endif /* ZIGBEE_ENABLED */
#ifdef TM_LOCK_NEEDED
/* Socket array lock */
    ttLockEntry           tvSocketArrayLock;
#endif /* TM_LOCK_NEEDED */

/* The root of the user socket table (red-black tree, or linked list) */
    ttSocketEntryPtr      tvSocketTableRootPtr;
#ifdef TM_LOCK_NEEDED
/* Note: this one lock actually locks ALL of the red-black trees,
   connection-oriented and connectionless, for this context. */
    ttLockEntry           tvSocketRootLock;
/* To lock the number of open sockets */
    ttLockEntry           tvSocketOpenLock;
#endif /* TM_LOCK_NEEDED */

/* 
 * Default Socket Queue Sizes
 */
    tt32Bit               tvDefRecvQueueBytes; /* receive queue */
    tt32Bit               tvDefSendQueueBytes; /* send queue */
    tt16Bit               tvDefRecvQueueDgrams; /* receive queue - datagrams */
    tt16Bit               tvDefSendQueueDgrams; /* send queue - datagrams */
/* send OOB data queue */
    tt32Bit               tvDefSendOobQueueBytes;

/* 
 * IP global variables
 */
 
#ifdef TM_USE_IPV4
#ifdef TM_IP_REASSEMBLY
/* Ip collection (reassembly) */
/* default fragmentation timer resolution is 1 second */
    tt32Bit               tvFragResolution; /* in milliseconds */
/* Maximum size in bytes of an IP datagram waiting to be reassembled */
    tt32Bit               tvFragEntryMaxSize;
#endif /* TM_IP_REASSEMBLY */
#endif /* TM_USE_IPV4 */

    tt4IpAddress          tvRouterId; /* Router Id */

#ifdef TM_USE_IPV4
    ttUserIpForwCBFuncPtr tvIpForwCBFuncPtr;
#endif /* TM_USE_IPV4 */
#ifdef TM_USE_IPV6
    tt6UserIpForwCBFuncPtr tv6IpForwCBFuncPtr;
#endif /* TM_USE_IPV6 */

#ifdef TM_USE_IP_FILT_CB
/* Added by Digi. */
    ttUserIpFiltCBFuncPtr tvIpFiltCBFuncPtr;
#endif /* TM_USE_IP_FILT_CB */

#ifdef TM_USE_IPV4
/* Single routing cache entry for forwarding IP packets */
    ttRtCacheEntry        tvRtIpForwCache;
/*
 * single routing cache entry for sending IP packets (used by non socket
 * IP Send's)
 */
    ttRtCacheEntry        tvRtIpSendCache;
#ifdef TM_LOCK_NEEDED
/* Lock entry to access last sent packet routing cache */
    ttLockEntry           tvRtIpSendCacheLock;
/* Lock entry to access last forwarded packet routing cache */
    ttLockEntry           tvRtIpForwCacheLock;
#endif /* TM_LOCK_NEEDED */

#ifdef TM_IP_REASSEMBLY
/*
 * IP Reassembly global variables.
 */
/* queue of fragment heads */
    ttIpFHEntryPtr        tvIpFHPtr;
#ifdef TM_LOCK_NEEDED
/*
 * lock for the fragment heads list, and recycle queue of fragment heads
 * Use only one lock for the 2 lists, since the recycle list is always
 * accessed when the fragment head list is accessed.
 */
    ttLockEntry           tvIpFHLock;
#endif /* TM_LOCK_NEEDED */
/* Aging timer for fragments */
    ttTimerPtr            tvIpFHTimerPtr;
#endif /* TM_IP_REASSEMBLY */
 
/* 
 * Pointer to IP decapsulation routine.  Initialized to null by 
 * tfGlobalVarsInit and set by tfUseIpTunneling
 */
    ttIpHandlerFuncPtr    tvIpDecapFuncPtr;

/*
 * BOOTP/DHCP global variables
 */
/* BOOTP/DHCP client socket */
    int                   tvBootSocketDescriptor;
/* BOOTP/DHCP relay agent socket */
    int                   tvBootRelayAgentDescriptor;
/* BOOTP/DHCP Relay variables */
    ttDeviceEntryPtr      tvBootServDevEntryPtr;
    tt4IpAddress          tvBootServIpAddress;

/*
 * Maximum user DHCP entries per device (on top of the TM_MAX_IPS_PER_IF
 * automatic configuration entries.)
 * (Default 0)
 */
    int                   tvMaxUserDhcpEntries;
#endif /* TM_USE_IPV4 */

/*
 * Router global variables
 */
#ifdef TM_USE_IPV4
/* RIP socket */
    int                   tvRipSocketDescriptor;
#endif /* TM_USE_IPV4 */
/*
 * Maximum number of routing entries, not including ARP cache entries
 */
    int                   tvRtMaxEntries;
#ifdef TM_ERROR_CHECKING
/* Number of routing entries out of the tree, but not in the recycle queue */
    int                    tvRteLimboCount;
#endif /* TM_ERROR_CHECKING */
/* Number of dynamic routing entries */
    int                    tvRtEntriesCount;

/* Number of ARP entries and cloned multicast entries */
    int                    tvRtArpEntriesCount;

#ifdef TM_USE_IPV4
/* Number of IPv4 ARP entries and cloned multicast entries. */
    int                    tv4RtArpEntriesCount;
#endif /* TM_USE_IPV4 */
    
/* Aging Router timer resolution */
    tt32Bit               tvRtTimerResolution;
/* Default RIP/Redirect entry timeout value */
    tt32Bit               tvRtTimeout;

#ifdef TM_PMTU_DISC
/*
 * Default Path MTU host routing entry timeout when the Path MTU estimate
 * is decreased in milliseconds. (10 minutes).
 */
    tt32Bit               tvRtDecreasedMtuTimeout;
/*
 * Default Path MTU host routing entry timeout when a larger path MTU estimate
 * is attempted in milliseconds. (2 minutes).
 */
    tt32Bit               tvRtLargerMtuTimeout;
#endif /* TM_PMTU_DISC */

/*
 * Empty Routing Table:
 * Structure containing three radix root nodes in the Patricia tree.
 * The middle one is the head of the tree. The left one is the root
 * leaf with all bits 0, and the right one is the root leaf with all
 * bits 1 (invalid route entry). (The default gateway in the Patricia
 * tree will be stored as a duplicate of the root left leaf.)
 */
    ttRtRadixHeadEntry     tvRtRadixTreeHead;
/* Point to the top radix node (middle one in tvRtRadixTreeHead) */
    ttRtRadixNodePtr       tvRtTreeHeadPtr;

#ifdef TM_LOCK_NEEDED
/* To lock the tree for read or write access */
    ttLockEntry            tvRtTreeLock;
#endif  

/* Aging route timer */
    ttTimerPtr             tvRtTimerPtr;
    ttTimerPtr             tvRtArpTimerPtr;
/*
 * IGMP global variables
 */
#if (defined(TM_IGMP) && defined(TM_USE_IPV4))
/* Default IGMP V1 Router present timeout in milliseconds (400 seconds) */
    int                   tvIgmpRouterV1Timeout;
/* Default IGMP Unsolicited Report interval (10 secons) */
    int                   tvIgmpUnsolReportIntv;
#endif /* TM_IGMP and TM_USE_IPV4 */

#if (defined(TM_IGMP) || defined(TM_USE_IPV6))
/*
 * Number of Ethernet multicast entries that can be allocated per allocation.
 */
    int                   tvEnetMcastBlockEntries;
/* Maximum number of successive tvEnetMcastBlockEntries allocations */
    int                   tvEnetMcastMaxAllocations;
#endif /* TM_IGMP || TM_USE_IPV6 */
    
#ifdef TM_USE_IPV4
/*
 * Arp collision detection global variables.
 */
    ttArpChkIn            tvArpChkInCBFunc;
#ifdef TM_LOCK_NEEDED
    ttLockEntry           tvArpChkListLock;
#endif /* TM_LOCK_NEEDED */
    ttArpChkEntryPtr      tvArpChkList;
    int                   tvArpChkActiveEntries;
#endif /* TM_USE_IPV4 */
#if (defined(TM_USE_AUTO_IP) && defined(TM_USE_IPV4))
/* Auto IP global variable */
    tt4IpAddress          tvAutoIpAddress; /* Current AUTO IP address */
#endif /* (defined(TM_USE_AUTO_IP) && defined(TM_USE_IPV4)) */
/*
 * Raw socket global variables
 */
    ttSocketEntryPtr      tvRawSocketPtr;
    ttLockEntry           tvRawCacheLock;

/*
 * UDP global variable
 */
    ttSocketEntryPtr      tvUdpSocketPtr;
    ttLockEntry           tvUdpCacheLock;

#ifdef TM_USE_TCP
/*
 * TCP global context variables
 */
/* TCP delay ACK timeout in milli-seconds. Disabled is set to zero. */
    tt32Bit               tvTcpDelayAckTime;
/* Tcp connection timeout in milli-seconds */
    tt32Bit               tvTcpConnTime;
/* Default Tcp retransmission time in milli-seconds */
    tt32Bit               tvTcpDefRtoTime;
/* min Tcp retransmission time in milli-seconds */
    tt32Bit               tvTcpMinRtoTime;
/* max Tcp retransmission time in milli-seconds */
    tt32Bit               tvTcpMaxRtoTime;
/* min Tcp zero window probe time in milli-seconds */
    tt32Bit               tvTcpMinProbeWndTime;
/* max Tcp zero window probe time in milli-seconds */
    tt32Bit               tvTcpMaxProbeWndTime;
/* Max retransmission count */
    int                   tvTcpMaxReXmitCnt;
/*
 * Amount of time to stay in FIN WAIT 2 when socket has been closed
 * (Default 10 minutes)
 */
    int                   tvTcpFinWt2Time; /* in seconds */
/* 2 * Maximum segment life time (2 * 30 seconds) (TIME WAIT time) */
    int                   tvTcp2MSLTime; /* in seconds */
/* Keep alive time (2 hours) in seconds */
    int                   tvTcpKeepAliveTime; /* in seconds */
/* Keep alive Probe Interval/Idle update time (75s) in seconds */
    int                   tvTcpIdleIntvTime; /* in seconds */
/* Keep alive Max Probe count (8) */
    int                   tvTcpKeepAliveProbeCnt;

/* One cache entry for TCP incoming packets */
    ttTcpVectPtr          tvTcpVectPtr;
#ifdef TM_LOCK_NEEDED
/* Lock for the one cache entry for TCP incoming packets */
    ttLockEntry           tvTcpCacheLock;
#endif /* TM_LOCK_NEEDED */
/*
 * One empty TCP state vector pointer (to allow usage of state functions for
 * destination with no TCP state vector)
 */
    ttTcpVectPtr          tvTcpClosedVectPtr;
#endif /* TM_USE_TCP */
/*
 * Device Entries
 */
    ttDeviceEntryPtr      tvDeviceList; /* The first Active Device */
#ifdef TM_LOCK_NEEDED
/* Device List Lock */
    ttLockEntry           tvDeviceListLock;
#endif /* TM_LOCK_NEEDED */
    ttDeviceEntryPtr      tvLoopbackDevPtr; /* loop back device */

    ttLinkLayerEntryPtr   tvLinkLayerListPtr;
#ifdef TM_LOCK_NEEDED
    ttLockEntry           tvLinkLayerListLock;
#endif /* TM_LOCK_NEEDED */
    ttLinkLayerEntryPtr   tvNullLinkLayerHandle; /* Null link layer */

/* Size of trailer to add to tail of outgoing packets.  Initialized to zero */
    ttPktLen              tvPakPktSendTrailerSize;

#ifdef TM_USE_TFTP
/*
 * TFTP client global variable. 
 */
    ttVoidPtr             tvTftpClientPtr;
#endif /* TM_USE_TFTP */
#ifdef TM_USE_TFTPD
/*
 * TFTP server global variable. 
 */
    ttVoidPtr             tvTftpSrvPtr;
#endif /* TM_USE_TFTPD */


/* maximum number of timers we execute in a single call to tfTimerExecute,
   a value of 0 means there is no limit */
    int                   tvTimerMaxExecute;

    

#if (defined(TM_SNMP_MIB) || defined(TM_PPP_LQM))
/*
 * SNMP AGENT MIB variable shared with PPP LQM.
 */
#ifdef TM_USE_IPV4
    ttIfStatMib           tvDevIpv4Data;
#endif /* TM_USE_IPV4 */
#endif /* TM_SNMP_MIB || TM_PPP_LQM */
#ifdef TM_SNMP_MIB
/*
 * SNMP AGENT MIB variables
 */
#ifdef TM_USE_IPV4
    ttIpMib               tvIpData;
    ttIcmpMib             tvIcmpData;
#endif /* TM_USE_IPV4 */
#ifdef TM_USE_IPV6
    tt6Icmpv6Mib          tvIcmpv6Data;
    ttIfStatMib           tvDevIpv6Data;
#endif /* TM_USE_IPV6 */
    ttUdpMib              tvUdpData;
#ifdef TM_USE_TCP
    ttTcpMib              tvTcpData;
#endif /* TM_USE_TCP */
#endif /* TM_SNMP_MIB */


#ifdef TM_LOCK_NEEDED
/*
 * tfVSScanF() lock
 */
/* Proxy Arp lock */
    ttLockEntry           tvScanfLockEntry;
#endif /* TM_LOCK_NEEDED */


/*
 * DNS resolver variables
 */
/* List of DNS servers in order of priority (index 0 is primary, etc) */
    struct sockaddr_storage tvDnsServerList[TM_DNS_MAX_SERVERS];

/* Points to the start of the DNS cache */
    ttDnsCacheEntryPtr    tvDnsCachePtr;

    ttLockEntry           tvDnsLockEntry;
/* TTL to use for DNS cache entries */
    tt32Bit               tvDnsCacheTtl;
/* Socket used for all DNS resolver activity */
    int                   tvDnsSocket;
/* Number of entries current in the DNS cache */
    int                   tvDnsCacheEntries;
/* indicates blocking mode of resolver: TM_BLOCKING_ON or TM_BLOCKING_OFF */
    int                   tvDnsBlockingMode;
/* Maximum number of entries in the DNS cache.  Settable by user. */
    int                   tvDnsCacheSize;
/* Maximum number of query retransmissions to attempt */
    int                   tvDnsRetries;
/* Time (in seconds) to wait for a response to come back from the DNS server */
    int                   tvDnsTimeout;

#ifdef TM_USE_IPV6

#endif /* TM_USE_IPV6 */

/*
 * Variables used for random seed generator.
 */
    tt16Bit               tvVector1;
    tt16Bit               tvVector2;
/*
 * Threshold in bytes below which we try and append to previous send buffer
 * for TCP
 */
    tt16Bit               tvDefSendAppendThreshold;
/*
 * Fraction use of the buffer below which we try and append to previous
 * recv buffer for TCP
 */
    tt16Bit               tvDefRecvAppendFraction;
/*
 * Fraction use of the buffer below which we try and copy to a smaller
 * recv buffer for UDP
 */
    tt16Bit               tvDefRecvCopyFraction;

/* Default Linger time when closing a TCP socket */
    tt16Bit               tvDefLingerTime;

/* Default TCP options: window scale, selective ACK, time stamp options, plus
 * default congestion avoidance
 */
    tt16Bit               tvTcpDefOptions;

/*
 * TCP global variables
 */
    tt16Bit               tvTcpDefMss; /* Default TCP MSS */

#ifdef TM_USE_IPV4
/* 
 * ICMP global variables
 */
    tt16Bit               tvIcmpSeqno; /* for request/reply */
/*
 * SLIP global variables
 */
    tt16Bit               tvSlipMtu;
/*
 * BOOTP/DHCP variables.
 */
    tt16Bit               tvBootServMhomeIndex;
#endif /* TM_USE_IPV4 */

#ifdef TM_USE_DHCP_FQDN
/*
 * FQDN structure
 */
    ttFqdn                              tvFqdnStruct;
#ifdef TM_LOCK_NEEDED
/* Lock for select pend entry recycle list */
    ttLockEntry                         tvFqdnStructLock;
#endif /* TM_LOCK_NEEDED */

#endif /* TM_USE_DHCP_FQDN */

/*
 * DNS resolver variables
 */
/* Last request ID to be sent. */
    tt16Bit               tvDnsRequestId;

/* Default socket options */
    tt16Bit               tvSocDefOptions;

#ifdef TM_USE_IPV6
#if (defined(TM_6_USE_PREFIX_DISCOVERY) || defined(TM_6_TAHI_MN_TEST))
    tt16Bit               tv6RtPrefixMhomeIndex;
/* IPv6 prefix aging timer resolution */
    tt16Bit               tv6PrefixTimerResSec;
#endif /* TM_6_USE_PREFIX_DISCOVERY or TM_6_TAHI_MN_TEST */
#endif /* TM_USE_IPV6 */

#ifdef TM_USE_IPV4
#ifdef TM_IP_FRAGMENT
/* Fragment bigger than MTU packets */
    tt8Bit                tvIpFragment;  /* default 0 */
#endif /* TM_IP_FRAGMENT */
#ifdef TM_IP_REASSEMBLY
/* Ip collection (reassembly) */
/* Maximum allowed number of IP datagrams waiting to be reassembled. */
    tt8Bit                tvFragMaxQSize;
/* Actual number of IP datagrams waiting to be reassembled */
    tt8Bit                tvFragQSize;
/* Number of IP datagrams that were too big to reassemble, but we're still
 * tracking in case more fragments come in */
    tt8Bit                tvFragFailedQSize;
/* Maximum number of "too big" datagrams to track */
    tt8Bit                tvFragFailedMaxQSize;
#endif /* TM_IP_REASSEMBLY */
#if defined(TM_IP_REASSEMBLY) || defined(TM_SNMP_VERSION)
/* IP Reassembly timeout in seconds. Default is 60 */
    tt8Bit                tvFragTtl;
#endif /* TM_IP_REASSEMBLY || TM_SNMP_VERSION */ 
#endif /* TM_USE_IPV4 */

#ifdef TM_USE_IPV4
/*
 * ARP cache
 */
/* Whether to store gratuitious ARP cache mappings */
    tt8Bit                tvArpSmart;
/* 
 * IP global variables
 */
/* Host(do not forward) or Router (forward) */
    tt8Bit                tvIpForward; /* 0 means host, 1 router */
/* Forward directed broadcast IP packets (default is 1) */
    tt8Bit                tvIpDbcastForward;
#ifdef TM_IP_MCAST_FORWARD
/* 1 means multicast router */
    tt8Bit                tvIpMcastForward;
#endif /* TM_IP_MCAST_FORWARD */
#ifdef TM_USE_LBCAST_CONFIG
    tt8Bit                tvIpLbcastEnable; /* 1 (def) enabled, 0 disabled */
#endif /* TM_USE_LBCAST_CONFIG */
/* default IP time to live */
    tt8Bit                tvIpDefTtl;
/* Default IP TOS */
    tt8Bit                tvIpDefTos;
#ifdef TM_IP_ACL_SOURCE_FILTERING
/* Digi: Filter incoming IP packets by source address (default is 0) */
    tt8Bit                tvIpAclSourceFilter;
#ifdef TM_LOCK_NEEDED
/* Digi: ACL array lock */
    ttLockEntry           tvIpAclArrayLock;
#endif /* TM_LOCK_NEEDED */
#endif /* TM_IP_ACL_SOURCE_FILTERING */

/*
 * RIP variables
 */
/* Rip enabled/disabled */
    tt8Bit                tvRipOn;
/*
 * tvRipSendMode has 4 possible values that determine the RIP packets being
 * sent: TM_RIP_NONE (no RIP packets are being sent),
 * TM_RIP_1 (only RIP 1 packets are being sent), TM_RIP_1_COMPAT
 * (default, sending only RIP 2 packets, broadcasting them ),
 * TM_RIP_2 (sending only RIP 2 packets, multicasting them)
 */
    tt8Bit                tvRipSendMode;
/*
 * tvRipRecvMode has 4 possible values that determine the RIP packets being
 * received: TM_RIP_NONE (no RIP packets are being received),
 * TM_RIP_1 (only RIP 1 packets are being received),
 * TM_RIP_2 (only RIP 2 packets are being received),
 * TM_RIP_1|TM_RIP_2 (both RIP 1 and Rip 2 packets are being received)
 */
    tt8Bit                tvRipRecvMode;
/* 
 * ICMP global variables
 */
    tt8Bit                tvIcmpAddrMaskAgent;
    tt8Bit                tvIcmpRouteReply;
#ifdef TM_USE_ECHO_CONFIG
    tt8Bit                tvIcmpEchoEnable;
#endif /* TM_USE_ECHO_CONFIG */

#ifndef TM_SINGLE_INTERFACE_HOME
    tt8Bit                tvIcmpErrDstAsSrc;
#endif /* TM_SINGLE_INTERFACE_HOME */
	tt8Bit				  tvIcmpRouterDiscovery;	/* added by DIGI */
#endif /* TM_USE_IPV4 */
/*
 * UDP global variable
 */
/* Enable/disable Udp cheksum. Default is 1 (enabled). */
    tt8Bit                tvUdpChecksumOn;
/* Enable/disable Incoming check on Udp cheksum. Default is 1 (enabled). */
    tt8Bit                tvUdpIncomingChecksumOn;
/* Enable/disable Incoming check on TCP cheksum. Default is 1 (enabled). */
    tt8Bit                tvTcpIncomingChecksumOn;

/*
 * Device entries
 */
/*
 * Number of added interfaces. Adding interfaces increments this value.
 * Initialized to zero. Does not include Loop back interface.
 */
    tt8Bit                tvAddedInterfaces;
#ifdef TM_USE_IPV6

#ifdef TM_6_IP_REASSEMBLY
/* Maximum allowed number of IP datagrams waiting to be reassembled. */
    tt8Bit                tv6FragMaxQSize;
    
/* Actual number of IP datagrams waiting to be reassembled */
    tt8Bit                tv6FragQSize;

/* Maximum number of "too big" datagrams to track */
    tt8Bit                tv6FragFailedMaxQSize;

/* Number of IP datagrams that were too big to reassemble, but we're still
 * tracking in case more fragments come in */
    tt8Bit                tv6FragFailedQSize;
#endif /* TM_6_IP_REASSEMBLY */

#if defined(TM_6_IP_REASSEMBLY) || defined(TM_SNMP_VERSION)
/* IP Reassembly timeout in seconds. Default is 60 */
    tt8Bit                tv6FragTtl;
#endif /* TM_6_IP_REASSEMBLY || TM_SNMP_VERSION */ 
    
/* Enables/disables IPv6 forwarding at the IPv6 level. Refer to 
   TM_6_OPTION_IP_FORWARDING. */
    tt8Bit                tv6IpForward;
/* Refer to TM_6_OPTION_IP_DEPRECATE_ADDR. ([RFC2462].R5.5.4:70) */
    tt8Bit                tv6IpDeprecateAddr;

#ifdef TM_6_IP_FRAGMENT
/* Refer to TM_6_OPTION_IP_FRAGMENT. ([RFC2460].R5:70) */
    tt8Bit                tv6IpFragment;
#endif /* TM_6_IP_FRAGMENT */



#endif /* TM_USE_IPV6 */

#ifdef TM_USE_TIMER_CB
    tt8Bit                tvTimerCBActive;
#endif /* TM_USE_TIMER_CB */

/* Context Globals */
#ifdef TM_6_USE_DHCP
    tt6DhcpDuidPtr  tv6DhcpDuidPtr;  /* Pointer to the DHCPv6 client DUID*/
    tt8Bit          tv6DhcpDuidLen;  /* Length of the  DHCPv6 client DUID*/
    int             tv6DhcpSocket;   /* DHCPv6 UDP socket    */
#endif /* TM_6_USE_DHCP */

#ifdef TM_USE_FILTERING
    ttUserFilterCallback tvUserFilterCallback;
#endif /* TM_USE_FILTERING */
#ifdef TM_USE_IPV6
#ifdef TM_6_USE_FILTERING
    tt6UserFilterCallback       tv6UserFilterCallback;
#endif /* TM_6_USE_FILTERING */
#endif /* TM_USE_IPV6 */
} ttContext;

typedef ttContext TM_FAR * ttContextPtr;

/*
 * Global variables for all contexts.
 */
/* Current context */
#ifdef TM_MULTIPLE_CONTEXT
TM_EXTERN ttContextPtr          TM_GLOBAL_QLF tvCurrentContext;
#else /* !TM_MULTIPLE_CONTEXT */
TM_EXTERN ttContext             TM_GLOBAL_QLF tvCurrentContextStruct;
#endif /* !TM_MULTIPLE_CONTEXT */

/* Structure containing global variables, other than per context */
TM_EXTERN ttGlobal              TM_GLOBAL_QLF tvGlobals;

/* Pointer to global variables */
TM_EXTERN ttGlobalPtr           TM_GLOBAL_QLF tvGlobalsPtr;

/*
 * (non context) Global variables set or not. Cannot be in ttGlobal, 
 * because it is checked prior to tvGlobalsPtr initialization.
 */
TM_EXTERN tt32Bit               TM_GLOBAL_QLF tvGlobalsSet;

/*
 * Timer global variables
 */
/* 
 * tvTime not declared in ttGlobal structure to save value across reboots 
 * and because can be changed from Timer ISR.
 * Note: User could define tvTime/tvTimeRollOver in their trsystem.h file
 * so that they can keep track of the time themselves, and avoid having
 * to call tfTimerUpdate() periodically.
 */
#ifndef tvTime
TM_EXTERN tt32Bit               TM_GLOBAL_QLF tvTime;
#endif /* tvTime */
#ifndef tvTimeRollOver
TM_EXTERN tt32Bit               TM_GLOBAL_QLF tvTimeRollOver;
#endif /* tvTimeRollOver */
/* tvTimerTickLength used during timer ISR */
TM_EXTERN unsigned              TM_GLOBAL_QLF tvTimerTickLength;
#ifdef TM_USE_TCP
/*
 * TCP global variables.
 */
/* 
 * tvTcpIss not declared in ttGlobal structure to save value across reboots 
 * and because can be changed from Timer ISR.
 * Initial sequence number (incremented by 1 every 4us) and used by
 * the TCP code to initialize the initial sequence number (corresponding
 * to the SYN) of a new connection.
 */
TM_EXTERN tt32Bit               TM_GLOBAL_QLF tvTcpIss;
/* 
 * Tcp time stamp to keep track of time changes for update of tvTcpIss in
 * tfTcpGetIss(). 
 */
TM_EXTERN tt32Bit               TM_GLOBAL_QLF tvTcpTimerTime;
#endif /* TM_USE_TCP */

#ifdef TM_USE_KERNEL_CRITICAL_STATUS
/* Not in ttGlobal because just used to store/restore critical status */
TM_EXTERN ttUserKernelCriticalStatus tvKernelCriticalStatus;
#endif /* TM_USE_KERNEL_CRITICAL_STATUS */

/*
 * IP header Id incremented every time an IP datagram is sent. Not in
 * ttGlobal, because we want to preserve value across reboots
 */

TM_EXTERN tt16Bit               TM_GLOBAL_QLF tvIpId;
/*
 * Pend/Post global variable. Not in ttGlobal, because can be initialized
 * in tfKernelInitialize().
 */
TM_EXTERN tt8Bit                TM_GLOBAL_QLF tvPendPostEnabled;

#ifdef TM_LOCK_NEEDED
/*
 * lock global variable.
 */
TM_EXTERN tt8Bit                TM_GLOBAL_QLF tvLockEnabled;
#endif /* TM_LOCK_NEEDED */


/* Default file system working direectory has been set */
TM_EXTERN tt8Bit                TM_GLOBAL_QLF tvFSInitWorkingDirSet;
/* Initial File system drive */
TM_EXTERN int                   TM_GLOBAL_QLF tvFSInitDrive;


#ifdef TM_USE_SHEAP
/* 
 * tvSheapPageSize not declared in ttGlobal structure because could
 * be used before tvGlobalsPtr initialization. 
 */
TM_EXTERN tt32Bit               TM_GLOBAL_QLF tvSheapPageSize;
#endif /* TM_USE_SHEAP */

/*
 * Lookup table used to convert prefix length to netmask. Not declared
 * in ttGlobal, because pointer to constant table.
 */
TM_EXTERN tt4ConstIpAddressPtr  TM_GLOBAL_QLF tvRt32ContiguousBitsPtr;

#if (defined(TM_USE_HTTPD) || defined(TM_USE_HTTPC) || defined(TM_USE_HTTPU))
/* 
 * HTTP pointers to shared constant tables, defined in trhttp.c.
 * Not declared in ttGlobal, because pointers to constant table
 */
TM_EXTERN ttConstCharPtrConstPtr TM_GLOBAL_QLF tvHttpVersionStr;
TM_EXTERN ttConstCharPtrConstPtr TM_GLOBAL_QLF tvHttpMethodStr;
TM_EXTERN ttConstCharPtrConstPtr TM_GLOBAL_QLF tvHttpHeaderNames;
#endif /* !(TM_USE_HTTPD) || TM_USE_HTTPC || TM_USE_HTTPU) */

/*
 * Device driver ISR parameters global variable. Not in ttGlobal because
 * accessed from device driver ISR.
 */
TM_EXTERN ttDeviceIsrPara       TM_GLOBAL_QLF tvDeviceIsrPara[
                                                    TM_MAX_NUMBER_DEVICES];

/*
 * Win32 Thread Local Storage index, needed for each thread to store
 * and retriece it's context pointer. Not in ttGlobal, because win32 variable.
 */
#if ( defined(TM_KERNEL_WIN32_X86) && defined(TM_MULTIPLE_CONTEXT) )
TM_EXTERN tt32Bit               TM_GLOBAL_QLF tvTlsIndex;
#endif /* defined(TM_KERNEL_WIN32_X86) && defined(TM_MULTIPLE_CONTEXT) */

/*
 * PPP global variables. Kludge to return a non null pointer to the user.
 * Will always have zero in it. Not declared in ttGlobal, because pointer
 * to a constant.
 */
TM_EXTERN char  TM_FAR * TM_GLOBAL_QLF tvChapEmptyString;


#ifdef TM_USE_IPV6
/* Used to populate Identification field in IPv6 Fragment extension header. Not
   in ttGlobal, so that the value can be preserved across reboots.
   ([RFC2460].R4.5:30) */
TM_EXTERN tt32Bit               TM_GLOBAL_QLF tv6IpFragId;

#ifdef TM_GLOBAL
/* 
 * These variables are not part of ttGlobal because they are just constant
 * initialized at compile time.
 */
/* Initialized only when included by trinit.c which defines TM_GLOBAL */
TM_EXTERN const struct in6_addr TM_CONST_QLF in6addr_any = 
        IN6ADDR_ANY_INIT;
TM_EXTERN const struct in6_addr TM_CONST_QLF in6addr_loopback = 
        IN6ADDR_LOOPBACK_INIT;
TM_EXTERN const struct in6_addr TM_CONST_QLF in6addr_nodelocal_allnodes =
        IN6ADDR_NODELOCAL_ALLNODES_INIT;
TM_EXTERN const struct in6_addr TM_CONST_QLF in6addr_linklocal_allnodes =
        IN6ADDR_LINKLOCAL_ALLNODES_INIT;
TM_EXTERN const struct in6_addr TM_CONST_QLF in6addr_linklocal_allrouters =
        IN6ADDR_LINKLOCAL_ALLROUTERS_INIT;
TM_EXTERN const struct in6_addr TM_CONST_QLF tvIn6AddrHostMask = 
        TM_IN6ADDR_HOST_MASK;
TM_EXTERN const struct in6_addr TM_CONST_QLF tvIn6AddrIpv4Any = 
    TM_IN6ADDR_IPV4_ANY_INIT;
#else /* !TM_GLOBAL */
/* Declared here because, not declared in trsocket.h */
TM_EXTERN const struct in6_addr TM_CONST_QLF tvIn6AddrHostMask;
TM_EXTERN const struct in6_addr TM_CONST_QLF tvIn6AddrIpv4Any;
#endif /* !TM_GLOBAL */
#endif /* TM_USE_IPV6 */


#ifdef TM_USE_IKE_DPD
/*
 * DPD Vendor ID Hash. 
 * Not declared in ttGlobal, because pointer to constant table.
 */
TM_EXTERN ttConst8BitPtr  TM_GLOBAL_QLF tvDpdVendorIdPtr;
#endif /* TM_USE_IKE_DPD */

#ifdef TM_USE_NATT
/*
 * NAT-Traversal Vendor ID Hash. 
 * Not declared in ttGlobal, because pointer to constant table.
 */
TM_EXTERN ttConst8BitPtr  TM_GLOBAL_QLF tvNattVendorIdPtr;
/*
 * Digi added tvNattVendorIdDraft02Ptr to support older implementations
 * of NAT-T that obey versions 0-3 of the IETF draft.  Drafts 0 and 1
 * use the same ID.
 */
TM_EXTERN ttConst8BitPtr  TM_GLOBAL_QLF tvNattVendorIdDraft01Ptr;
TM_EXTERN ttConst8BitPtr  TM_GLOBAL_QLF tvNattVendorIdDraft02Ptr;
TM_EXTERN ttConst8BitPtr  TM_GLOBAL_QLF tvNattVendorIdDraft03Ptr;
#endif /* TM_USE_NATT */
/*
 * Treck IKE Vendor ID Hash. 
 * Not declared in ttGlobal, because pointer to constant table.
 */
TM_EXTERN ttConst8BitPtr  TM_GLOBAL_QLF tvTreckVendorIdPtr;

#ifdef TM_USE_IPSEC_64BIT_KB_LIFETIMES
/* IPsec 64-bit KByte lifetime max value */
TM_EXTERN ttUser64Bit TM_GLOBAL_QLF tvIpsecMaxLifetime;
#endif /* TM_USE_IPSEC_64BIT_KB_LIFETIMES */

#ifdef __cplusplus
}
#endif

#endif /* _TRGLOBAL_H_ */

/* Processed by Treck Shipping Tool v2.52 
 * 2007/10/04 15:41:18      For: Digi
 * File Name: trglobal.h    File Revision: 4.7.2.9 
 * Project Name: tcpip.pj   Project Release: 4.7.1.26
 * Input checksum:  2555    Output checksum: 64906
 */
