/*
 * 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:  Interfaces between MIB-II retrieval functions and Treck stack
 * Filename:     trmib2.h
 * Author:       Leonard
 * Date Created: 12/04/01
 * $Source: /cvs_tick/treck_stack/snmpd/trmib2.h,v $
 *
 * Modification History
 * $Revision: 1.9 $
 * $Date: 2005/12/07 23:12:21 $
 * $Author: cgordon $
 * $ProjectName: /home/mks/proj/snmpdprj $
 * $ProjectRevision: 4.0.2.53 $
 */

/***********************************************************
        Copyright 1988 by Carnegie Mellon University
 
                      All Rights Reserved
 
Permission to use, copy, modify, and distribute this software and its 
documentation for any purpose and without fee is hereby granted, 
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in 
supporting documentation, and that the name of CMU not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.  
 
CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/

/**************************************************************************
*  File Description:  
    This file is solely for communications between
    SNMP retrieve and assign functions and system
    dependent functions actually doing the work
**************************************************************************/

#ifndef _TRMIB2_H_
#define _TRMIB2_H_

#ifdef __cplusplus
extern "C" {
#endif


/* IPForward possible values */
#define TM_SNMP_IP_FORWARDING       1
#define TM_SNMP_IP_NOTFORWARDING    2

/* SMI address type (family) used in SMI ipAddress type */
#define TM_SNMP_INET_ADDR_TYPE_UNKNOWN      0
#define TM_SNMP_INET_ADDR_TYPE_IPV4         1
#define TM_SNMP_INET_ADDR_TYPE_IPV6         2

#ifdef TM_USE_NG_MIB2
typedef struct tsMib2UdpEndPointTable
{
    tt32Bit     udpEndPointLocalAddressType;
    ttIpAddress udpEndPointLocalAddress;
    tt32Bit     udpEndPointLocalPort;
    ttIpAddress udpEndPointRemoteAddress;
    tt16Bit     udpEndPointLocaladdressLen;
    tt16Bit     udpEndPointRemoteAddressLen;
    tt32Bit     udpEndPointRemotePort;
    tt32Bit     udpEndPointInstance;
    tt32Bit     udpEndPointInDatagrams;
    tt64Bit     udpEndPointHCInDatagrams;
    tt32Bit     udpEndPointOutDatagrams;
    tt64Bit     udpEndPointHCOutDatagrams;
    tt32Bit     udpEndPointInOctets;
    tt64Bit     udpEndPointHCInOctets;
    tt32Bit     udpEndPointOutOctets;
    tt64Bit     udpEndPointHCOutOctets;
    tt32Bit     udpEndPointStartTime;
    tt32Bit     udpEndPointProcess;
} ttMib2UdpEndPointTable;
typedef ttMib2UdpEndPointTable     TM_FAR * ttMib2UdpEndPointTablePtr;
typedef const ttMib2UdpEndPointTable TM_FAR * ttConstMib2UdpEndPointTablePtr;
#endif /* TM_USE_NG_MIB2 */

#ifdef TM_USE_RFC1213_MIB2
typedef struct tsMib2UdpListener
{
    ttIpAddress udpLocalAddr;
    ttIpPort udpLocalPort;
} ttMib2UdpListener;
typedef ttMib2UdpListener     TM_FAR * ttMib2UdpListenerPtr;
typedef const ttMib2UdpListener TM_FAR * ttConstMib2UdpListenerPtr;
#endif /* TM_USE_RFC1213_MIB2 */

/* data structures for the two icmp tables */
typedef struct tsMib2InetIcmpTable
{
    tt32Bit inetIcmpAfType;
    tt32Bit inetIcmpInMsgs;
    tt32Bit inetIcmpInErrors;
    tt32Bit inetIcmpOutMsgs;
    tt32Bit inetIcmpOutErrors;
} ttMib2InetIcmpTable;
typedef ttMib2InetIcmpTable     TM_FAR * ttMib2InetIcmpTablePtr;
typedef const ttMib2InetIcmpTable TM_FAR * ttConstMib2InetIcmpTablePtr;

typedef struct tsMib2InetIcmpMsgTable
{
    tt32Bit inetIcmpMsgAfType;
    tt32Bit inetIcmpMsgType;
    tt32Bit inetIcmpMsgInPkts;
    tt32Bit inetIcmpMsgOutPkts;
} ttMib2InetIcmpMsgTable;
typedef ttMib2InetIcmpMsgTable     TM_FAR * ttMib2InetIcmpMsgTablePtr;
typedef const ttMib2InetIcmpMsgTable TM_FAR * ttConstMib2InetIcmpMsgTablePtr;

#define TM_SNMP_TCP_CLOSED      1
#define TM_SNMP_TCP_LISTEN      2
#define TM_SNMP_TCP_SYNSENT     3
#define TM_SNMP_TCP_SYNRECVD    4
#define TM_SNMP_TCP_ESTABL      5
#define TM_SNMP_TCP_FINWAIT1    6
#define TM_SNMP_TCP_FINWAIT2    7
#define TM_SNMP_TCP_CLOSEWAIT   8
#define TM_SNMP_TCP_LASTACK     9
#define TM_SNMP_TCP_CLOSING     10
#define TM_SNMP_TCP_TIMEWAIT    11
#define TM_SNMP_TCP_DELETE_TCB  12

#if (defined(TM_USE_NG_MIB2) || defined(TM_USE_RFC1213_MIB2))
typedef struct tsMib2TcpConnection
{
    tt32Bit     tcpConnLocalAddrType;
    ttIpAddress tcpConnLocalAddr;
    tt32Bit     tcpConnRemoteAddrType;
    ttIpAddress tcpConnRemoteAddr;
    ttIpPort    tcpConnLocalPort;
    ttIpPort    tcpConnRemotePort;
    tt16Bit     tcpConnLocalAddrLen;
    tt16Bit     tcpConnRemoteAddrLen;
    tt32Bit     tcpConnState;
    tt32Bit     tcpConnProcess;
} ttMib2TcpConnection;
typedef ttMib2TcpConnection     TM_FAR * ttMib2TcpConnectionPtr;
typedef const ttMib2TcpConnection TM_FAR * ttConstMib2TcpConnectionPtr;
#endif /* TM_USE_NG_MIB2 || TM_USE_RFC1213_MIB2 */

#ifdef TM_USE_NG_MIB2
typedef struct tsMib2TcpListener
{
    tt32Bit     tcpListenerLocalAddrType;
    ttIpAddress tcpListenerLocalAddr;
    tt16Bit     tcpListenerLocalAddressLen;
    tt8Bit      tcpListenerPad[2];
    tt32Bit     tcpListenerLocalPort;
    tt32Bit     tcpListenerProcess;
} ttMib2TcpListener;
typedef ttMib2TcpListener     TM_FAR * ttMib2TcpListenerPtr;
typedef const ttMib2TcpListener TM_FAR * ttConstMib2TcpListenerPtr;
#endif /* TM_USE_NG_MIB2 */

typedef struct tsMib2IpNetToMediaEntry
{
    ttUserIpAddress n2mNetAddr;
    unsigned int    n2mIfIndex;

#define TM_SNMP_N2M_TYPE_OTHER      1
#define TM_SNMP_N2M_TYPE_INVALID    2
#define TM_SNMP_N2M_TYPE_DYNAMIC    3 /* Dynamic ARP entry */
#define TM_SNMP_N2M_TYPE_STATIC     4 /* Static ARP Entry */
    unsigned int n2mType;

    tt8Bit n2mPhysAddr[6];
    char n2mPad[2];
} ttMib2IpNetToMediaEntry;
typedef ttMib2IpNetToMediaEntry     TM_FAR * ttMib2IpNetToMediaEntryPtr;
typedef const ttMib2IpNetToMediaEntry TM_FAR * ttConstMib2IpNetToMediaEntryPtr;

typedef struct tsMib2IpAddressEntry
{
    tt16Bit     ipAddressAddrType;  /* address family (V4, V6, etc...)     */
    tt16Bit     ipAddressAddrLen;
    ttIpAddress ipAddressAddr;
    tt8Bit      ipAddressIfIndex;
    tt8Bit      ipAddressType;      /* address type (ucast, mcast, etc...) */
    tt8Bit      ipAddressPrefixLen;
    tt8Bit      padding;
    oid         ipAddressPrefix[TM_SNMP_MAX_NAME_LEN];
    tt32Bit     ipAddressOrigin;
    tt32Bit     ipAddressStatus;
    tt32Bit     ipAddressCreated;
    tt32Bit     ipAddressLastChanged;
} ttMib2IpAddressEntry;
typedef ttMib2IpAddressEntry     TM_FAR * ttMib2IpAddressEntryPtr;
typedef const ttMib2IpAddressEntry TM_FAR * ttConstMib2IpAddressEntryPtr;

typedef struct tsMib2IpAddrEntry
{
    ttIpAddress ipAdEntAddr;
    ttIpAddress ipAdEntNetMask;
    unsigned int ipAdEntIfIndex;
    unsigned int ipAdEntBcastAddr;
    unsigned int ipAdEntReasmMaxSize;
} ttMib2IpAddrEntry;
typedef ttMib2IpAddrEntry     TM_FAR * ttMib2IpAddrEntryPtr;
typedef const ttMib2IpAddrEntry TM_FAR * ttConstMib2IpAddrEntryPtr;

#if (defined(TM_USE_NG_MIB2) && defined(TM_TRECK_OS))
typedef struct tsIpAddressTableEntry
{
    tt32Bit     ipAddressAddrType;  /* INET6, INET4, etc...         */
    ttIpAddress ipAddressAddr;
    tt32Bit     ipAddressIfIndex;
    tt32Bit     ipAddressType;      /* unicast, broadcast, etc...   */
#define TM_SNMP_IP_TYPE_UNICAST     1
#define TM_SNMP_IP_TYPE_ANYCAST     2
#define TM_SNMP_IP_TYPE_BROADCAST   3
    tt8Bit      ipAddressAddrLen;
    tt8Bit      ipAddresspPefixLen;
    tt8Bit      pad[2];
    ttOidPtr    ipAddressPrefix;
    tt32Bit     ipAddressOrigin;
#define TM_SNMP_IP_ORIGIN_OTHER     1
#define TM_SNMP_IP_ORIGIN_MANUAL    2
#define TM_SNMP_IP_ORIGIN_WELLKNOWN 3
#define TM_SNMP_IP_ORIGIN_DHCP      4
#define TM_SNMP_IP_ORIGIN_LINKLAYER 5
#define TM_SNMP_IP_ORIGIN_RANDOM    6
    tt32Bit     ipAddressStatus;
#define TM_SNMP_IP_STATUS_PREFERRED     1
#define TM_SNMP_IP_STATUS_DEPRECATED    2
#define TM_SNMP_IP_STATUS_INVALID       3
#define TM_SNMP_IP_STATUS_INACCESSIBLE  4    
#define TM_SNMP_IP_STATUS_UNKNOWN       5
#define TM_SNMP_IP_STATUS_TENTATIVE     6
#define TM_SNMP_IP_STATUS_DUPLICATE     7
    tt32Bit     ipAddressCreated;
    tt32Bit     ipAddressLastChanged;
} ttIpAddressTableEntry;
typedef ttIpAddressTableEntry     TM_FAR * ttIpAddressTableEntryPtr;
typedef const ttIpAddressTableEntry TM_FAR * ttConstIpAddressTableEntryPtr;

typedef struct tsIpIfStatsTableEntry
{
    tt32Bit        ipIfStatsAftype;
    tt32Bit        ipIfStatsIfindex;
    ttIfStatMibPtr stats;
} ttIpIfStatsTableEntry;
typedef ttIpIfStatsTableEntry     TM_FAR * ttIpIfStatsTableEntryPtr;
typedef const ttIpIfStatsTableEntry TM_FAR * ttConstIpIfStatsTableEntryPtr;

typedef struct tsIpSystemStatsTableEntry
{
    tt32Bit        ipIfStatsAfType;
    ttIfStatMibPtr stats;
} ttIpSystemStatsTableEntry;
typedef ttIpSystemStatsTableEntry     TM_FAR * ttIpSystemStatsTableEntryPtr;
typedef const ttIpSystemStatsTableEntry TM_FAR * ttConstIpSystemStatsTableEntryPtr;

typedef struct tsIpv4InterfaceTableEntry
{
    tt32Bit  ipv4InterfaceIfIndex;
    tt32Bit  ipv4InterfaceReasmMaxSize;
    tt32Bit  ipv4InterfaceAdminStatus;
} ttIpv4InterfaceTableEntry;
typedef ttIpv4InterfaceTableEntry     TM_FAR * ttIpv4InterfaceTableEntryPtr;
typedef const ttIpv4InterfaceTableEntry TM_FAR * ttConstIpv4InterfaceTableEntryPtr;

typedef struct tsIpv6InterfaceTableEntry
{
    tt32Bit ipv6InterfaceIfIndex;
    tt32Bit ipv6InterfaceReasmMaxSize;
    tt8Bit  ipv6InterfaceIdentifier[MAX_STRING_LEN];
    tt32Bit ipv6InterfaceIdentifierLen;
    tt8Bit  ipv6InterfacePhysicalAddress[tm_align(TM_MAX_PHYS_ADDR)];
    tt32Bit ipv6InterfacePhysicalAddressLen;
    tt32Bit ipv6InterfaceAdminStatus;
    tt32Bit ipv6InterfaceReachableTime;
    tt32Bit ipv6InterfaceRetransmitTime;
} ttIpv6InterfaceTableEntry;
typedef ttIpv6InterfaceTableEntry     TM_FAR * ttIpv6InterfaceTableEntryPtr;
typedef const ttIpv6InterfaceTableEntry TM_FAR * ttConstIpv6InterfaceTableEntryPtr;

typedef struct tsInetCidrRouteTableEntry
{
    tt32Bit        inetCidrRouteDestType;
    ttIpAddress    inetCidrRouteDest;
    tt32Bit        inetCidrRouteDestLen;
    tt32Bit        inetCidrRoutePfxlen;
    oid            inetCidrRoutePolicy[MAX_STRING_LEN];
    tt32Bit        inetCidrRoutePolicyLen;
    tt32Bit        inetCidrRouteNextHopType;
    ttIpAddress    inetCidrRouteNextHop;
    tt32Bit        inetCidrRouteNextHopLen;
    tt32Bit        inetCidrRouteIfIndex;
    tt32Bit        inetCidrRouteType;
    tt32Bit        inetCidrRouteProto;
    tt32Bit        inetCidrRouteAge;
    tt32Bit        inetCidrRouteNextHopAS;
    tt32Bit        inetCidrRouteMetric1;
    tt32Bit        inetCidrRouteMetric2;
    tt32Bit        inetCidrRouteMetric3;
    tt32Bit        inetCidrRouteMetric4;
    tt32Bit        inetCidrRouteMetric5;
    tt32Bit        inetCidrRouteStatus;
} ttInetCidrRouteTableEntry;
typedef ttInetCidrRouteTableEntry     TM_FAR * ttInetCidrRouteTableEntryPtr;
typedef const ttInetCidrRouteTableEntry TM_FAR * ttConstInetCidrRouteTableEntryPtr;

#endif /* TM_TRECK_OS && TM_USE_NG_MIB2 */

#if (defined(TM_USE_NG_MIB2) && defined(TM_TRECK_OS))
typedef struct tsInetNetToMediaTableEntry
{
    tt32Bit     inetNetToMediaIfIndex;
    tt32Bit     inetNetToMediaNetAddressType;
    ttIpAddress inetNetToMediaNetAddress;
    tt8Bit      inetNetToMediaPhysAddress[16];
    tt8Bit      inetNetToMediaPhysAddressLen;
    tt8Bit      inetNetToMediaNetAddressLen;
    tt8Bit      pad[2];
    tt32Bit     inetNetToMediaLastUpdated;
    tt32Bit     inetNetToMediaType;
    tt32Bit     inetNetToMediaState;
} ttInetNetToMediaTableEntry;
typedef ttInetNetToMediaTableEntry     TM_FAR * ttInetNetToMediaTableEntryPtr;
typedef const ttInetNetToMediaTableEntry TM_FAR * ttConstInetNetToMediaTableEntryPtr;
#endif /* TM_TRECK_OS && TM_USE_NG_MIB2 */

#if (defined(TM_USE_NG_MIB2) && defined(TM_TRECK_OS) && defined(TM_USE_IPV6))
typedef struct tsIpV6ScopeZoneIndexTableEntry
{
    tt32Bit  ipV6ScopeZoneIndexIfIndex;
    tt32Bit  ipV6ScopeZoneIndexLinkLocal;
    tt32Bit  ipV6ScopeZoneIndexSubnetLocal;
    tt32Bit  ipV6ScopeZoneIndexAdminLocal;
    tt32Bit  ipV6ScopeZoneIndexSiteLocal;
    tt32Bit  ipV6ScopeZoneIndex6;
    tt32Bit  ipV6ScopeZoneIndex7;
    tt32Bit  ipV6ScopeZoneIndexOrganizationLocal;
    tt32Bit  ipV6ScopeZoneIndex9;
    tt32Bit  ipV6ScopeZoneIndexA;
    tt32Bit  ipV6ScopeZoneIndexB;
    tt32Bit  ipV6ScopeZoneIndexC;
    tt32Bit  ipV6ScopeZoneIndexD;
} ttIpV6ScopeZoneIndexTableEntry;
typedef ttIpV6ScopeZoneIndexTableEntry     TM_FAR * ttIpV6ScopeZoneIndexTableEntryPtr;
typedef const ttIpV6ScopeZoneIndexTableEntry TM_FAR * ttConstIpV6ScopeZoneIndexTableEntryPtr;

typedef struct tsIpDefaultRouterTableEntry
{
    tt32Bit     ipDefaultRouterAfType;
    ttIpAddress ipDefaultRouterAddress;
    tt32Bit     ipDefaultRouterAddressLen;
    tt32Bit     ipDefaultRouterIfIndex;
    tt32Bit     ipDefaultRouterLifetime;
    tt32Bit     ipDefaultRouterPreference;
} ttIpDefaultRouterTableEntry;
typedef ttIpDefaultRouterTableEntry     TM_FAR * ttIpDefaultRouterTableEntryPtr;
typedef const ttIpDefaultRouterTableEntry TM_FAR * ttConstIpDefaultRouterTableEntryPtr;

typedef struct tsIpV6RouterAdvertTableEntry
{
    tt32Bit ipV6RouterAdvertIfIndex;
    tt32Bit ipV6RouterAdvertSendAdverts;
    tt32Bit ipV6RouterAdvertMaxInterval;
    tt32Bit ipV6RouterAdvertMinInterval;
    tt32Bit ipV6RouterAdvertManagedFlag;
    tt32Bit ipV6RouterAdvertOtherConfigFlag;
    tt32Bit ipV6RouterAdvertLinkMtu;
    tt32Bit ipV6RouterAdvertReachableTime;
    tt32Bit ipV6RouterAdvertRetransmitTime;
    tt32Bit ipV6RouterAdvertCurHopLimit;
    tt32Bit ipV6RouterAdvertDefaultLifetime;
    tt32Bit ipV6RouterAdvertRowStatus;
} ttIpV6RouterAdvertTableEntry;
typedef ttIpV6RouterAdvertTableEntry     TM_FAR * ttIpV6RouterAdvertTableEntryPtr;
typedef const ttIpV6RouterAdvertTableEntry TM_FAR * ttConstIpV6RouterAdvertTableEntryPtr;
#endif /* TM_TRECK_OS && TM_USE_NG_MIB2 && TM_USE_IPV6 */

typedef struct tsMib2IpRouteEntry
{
    ttIpAddress ipRouteDest;
    ttIpAddress ipRouteNextHop;
    ttIpAddress ipRouteMask;
    tt32Bit     ipRouteInfo[TM_SNMP_MAX_NAME_LEN];
    unsigned int ipRouteIfIndex;
    unsigned int ipRouteMetric[5];

#define TM_SNMP_RTE_TYPE_OTHER          1
#define TM_SNMP_RTE_TYPE_INVALID        2
#define TM_SNMP_RTE_TYPE_DIRECT         3
#define TM_SNMP_RTE_TYPE_INDIRECT       4 /* indirect route */
    unsigned int ipRouteType;

#define TM_SNMP_PROT_OTHER      1
#define TM_SNMP_PROT_LOCAL      2 /* user created */
#define TM_SNMP_PROT_NETMGMT    3 /* SNMP manager created */
#define TM_SNMP_PROT_ICMP       4 /* REDIRECT, Router discovery */
#define TM_SNMP_PROT_RIP        8 /* RIP protocol */
    unsigned int ipRouteProto;

    unsigned int ipRouteAge;
    unsigned int ipRouteInfoLen;
} ttMib2IpRouteEntry;
typedef ttMib2IpRouteEntry     TM_FAR * ttMib2IpRouteEntryPtr;
typedef const ttMib2IpRouteEntry TM_FAR * ttConstMib2IpRouteEntryPtr;

#ifdef __cplusplus
}
#endif

#endif /* #ifndef _TRMIB2_H_ */

/* Processed by Treck Shipping Tool v2.48 
 * 2005/11/16 15:13:15      For: Digi
 * File Name: trmib2.h      File Revision: 4.0.2.4 
 * Project Name: snmpdprj   Project Release: 4.0.2.53
 * Input checksum: 20442    Output checksum: 13233
 */
