-- *****************************************************************
-- QTECH-NTP-MIB.mib:  Qtech NTP MIB file
--
-- May 2009, linshuangfeng
--
-- Copyright (c) 2009 by Qtech Networks Co.,Ltd.
-- All rights reserved.
-- 
-- *****************************************************************
--

QTECH-NTP-MIB DEFINITIONS ::= BEGIN

IMPORTS
        MODULE-IDENTITY,
        OBJECT-TYPE,
        IpAddress,
        Integer32
                FROM SNMPv2-SMI
        RowStatus
                FROM  SNMPv2-TC
        MODULE-COMPLIANCE,
        OBJECT-GROUP
                FROM SNMPv2-CONF
        InetAddressType,
        InetAddress
                FROM INET-ADDRESS-MIB
        qtechMgmt
                FROM QTECH-SMI;

qtechNtpMIB MODULE-IDENTITY
        LAST-UPDATED "200905140000Z"
        ORGANIZATION "Qtech Networks Co.,Ltd."
        CONTACT-INFO
                " 
                Tel: 4008-111-000 

                E-mail: service@qtech.com.cn"
        DESCRIPTION
                "This module defines qtech ntp mibs."
        REVISION      "200905140000Z"
        DESCRIPTION
                "Initial version of this MIB module."
        ::= { qtechMgmt 49}

qtechNtpMIBObjects OBJECT IDENTIFIER ::= { qtechNtpMIB 1 }
qtechNtpMIBConformance OBJECT IDENTIFIER ::= { qtechNtpMIB 2 }
qtechntpSystem      OBJECT IDENTIFIER ::= { qtechNtpMIBObjects 1 }
qtechNtpMIBCompliances OBJECT IDENTIFIER ::= { qtechNtpMIBConformance 1 }
qtechNtpMIBGroups OBJECT IDENTIFIER ::= { qtechNtpMIBConformance 2 }

NTPTimeStamp ::= OCTET STRING(SIZE(8))
-- TEXTUAL-CONVENTION
--  Status
--    mandatory
--  Descr
--    NTP timestamps are represented as a 64-bit
--    unsigned fixed-point number, in seconds relative to
--    00:00 on 1 January 1900.  The integer part is in the
--    first 32 bits and the fraction part is in the last
--    32 bits.
--  Refer
--    D.L. Mills, 'Network Time Protocol (Version 3)',
--        RFC-1305, March 1992, Section 3.1

NTPLeapIndicator ::= INTEGER {
        -- enum value of zero may cause problems
        noWarning(0),
        addSecond(1),
        subtractSecond(2),
        alarm(3)
        }
-- TEXTUAL-CONVENTION
--  Status
--    mandatory
--  Descr
--    This is a two-bit code warning of an impending leap
--    second to be inserted in the NTP timescale.  The bits
--    are set before 23:59 on the day of insertion and reset
--    after 00:00 on the following day.  This causes the
--    number of seconds (rollover interval) in the day of
--    insertion to be increased or decreased by one.  The two
--    bits are coded as below,
--    00, no warning
--    01, last minute has 61 seconds
--    10, last minute has 59 seconds
--    11, alarm condition (clock not synchronized)
--  Refer
--    D.L. Mills, 'Network Time Protocol(Version 3)',
--        RFC-1305, March 1992, Section 3.2.1

NTPSignedTimeValue ::= OCTET STRING(SIZE(4))
-- TEXTUAL-CONVENTION
--  Status
--    mandatory
--  Descr
--    The time in seconds that could represent signed
--    quantities like time delay with respect to some
--    source.  This textual-convention is specific to 
--    implementation of NTP where 32-bit integers are used
--    for such quantities.  The signed integer part is in
--    the first 16 bits and the fraction part is in the
--    last 16 bits.
--  Refer
--    D.L. Mills, 'Network Time Protocol (Version 3)',
--        RFC-1305, March 1992, Sections 2,  3.2.1

NTPUnsignedTimeValue ::= OCTET STRING(SIZE(4))
-- TEXTUAL-CONVENTION
--  Status
--    mandatory
--  Descr
--    The time in seconds that could represent unsigned
--    quantities like maximum error of the local clock
--    with respect to some source.  This textual-convention
--    is specific to implementation of NTP where
--    32-bit integers are used for such quantities.  The
--    unsigned integer part is in the first 16 bits and the
--    fraction part is in the last 16 bits.
--  Refer
--    D.L. Mills, 'Network Time Protocol (Version 3)',
--        RFC-1305, March 1992, Sections 2, 3.2.1

NTPStratum ::= INTEGER(0..255)
-- TEXTUAL-CONVENTION
--  Status
--    mandatory
--  Descr
--    Indicates the stratum of the clock.  The stratum
--    defines the accuracy of a time server.  Higher the
--    stratum, lower the accuracy.
--    0, unspecified
--    1, primary reference (e.g., calibrated atomic clock,
--       radio clock)
--    2-255, secondary reference (via NTP)
--  Refer
--    D.L. Mills, 'Network Time Protocol (Version 3)',
--        RFC-1305, March 1992, Section 2.2

NTPRefId ::= OCTET STRING(SIZE(4))
-- TEXTUAL-CONVENTION
--  Status
--    mandatory
--  Descr
--    The reference clock identifier.  In the case of
--    stratum 0 (unspecified) or stratum 1 (primary
--    reference source), this is a four-octet,
--    left-justified, zero-padded ASCII string as defined
--    in RFC-1305.  In the case of stratum 2 and greater
--    (secondary reference) this is the four-octet Internet
--    address of the peer selected for synchronization.
--    
--    Some examples of stratum 0 identifiers are,
--    DCN, DCN routing protocol
--    NIST, NIST public modem
--    TSP, TSP time protocol
--    DTS, Digital Time Service
--    
--    Some examples of stratum 1 identifiers are,
--    ATOM, Atomic clock (calibrated)
--    VLF, VLF radio (OMEGA,, etc.)
--    LORC, LORAN-C radionavigation
--    GOES, GOES UHF environment satellite
--    GPS, GPS UHF satellite positioning
--  Refer
--    D.L. Mills, Network Time Protocol (Version 3)',
--        RFC-1305, March 1992, Section 3.2.1

qtechntpSysLeap OBJECT-TYPE
    SYNTAX NTPLeapIndicator
--    Rsyntax INTEGER {
--        enum value of zero may cause problems
--        noWarning(0),
--        addSecond(1),
--        subtractSecond(2),
--        alarm(3)
--        }
    MAX-ACCESS read-write
    STATUS current
    DESCRIPTION
        "Two-bit code warning of an impending leap second to
        be inserted in the NTP timescale. This object can be
        set only when the qtechntpSysStratum has a value of 1."
    ::= { qtechntpSystem 1 }

qtechntpSysStratum OBJECT-TYPE
    SYNTAX NTPStratum
--    Rsyntax INTEGER(0..255)
    MAX-ACCESS read-write
    STATUS current
    DESCRIPTION
        "The stratum of the local clock. If the value is set
        to 1, i.e., this is a primary reference, then the
        Primary-Clock procedure described in Section 3.4.6,
        in RFC-1305 is invoked."
    ::= { qtechntpSystem 2 }

qtechntpSysPrecision OBJECT-TYPE
    SYNTAX INTEGER(-24..24)
    MAX-ACCESS read-only
    STATUS current
    DESCRIPTION
        "Signed integer indicating the precision
        of the system clock, in seconds to the nearest
        power of two.  The value must be rounded to the
        next larger power of two; for instance, a 50-Hz
        (20 ms) or 60-Hz (16.67 ms) power-frequency clock
        would be assigned the value -5 (31.25 ms), while a
        1000-Hz (1 ms) crystal-controlled clock would be
        assigned the value -9 (1.95 ms)."
    ::= { qtechntpSystem 3 }

qtechntpSysRootDelay OBJECT-TYPE
    SYNTAX NTPSignedTimeValue
--    Rsyntax OCTET STRING(SIZE(4))
--  Units
--    seconds
    MAX-ACCESS read-only
    STATUS current
    DESCRIPTION
        "A signed fixed-point number indicating the total
        round-trip delay in seconds, to the primary reference
        source at the root of the synchronization subnet."
    REFERENCE
        "D.L. Mills, 'Network Time Protocol (Version 3)',
            RFC-1305, March 1992, Sections 2.2, 3.2.1"
    ::= { qtechntpSystem 4 }

qtechntpSysRootDispersion OBJECT-TYPE
    SYNTAX NTPUnsignedTimeValue
--    Rsyntax OCTET STRING(SIZE(4))
--  Units
--    seconds
    MAX-ACCESS read-only
    STATUS current
    DESCRIPTION
        "The maximum error in seconds, relative to the
        primary reference source at the root of the
        synchronization subnet.  Only positive values greater
        than zero are possible."
    REFERENCE
        "D.L. Mills, 'Network Time Protocol (Version 3)',
            RFC-1305, March 1992, Sections 2, 2.2, 3.2.1"
    ::= { qtechntpSystem 5 }

qtechntpSysRefId OBJECT-TYPE
    SYNTAX NTPRefId
--    Rsyntax OCTET STRING(SIZE(4))
    MAX-ACCESS read-only
    STATUS current
    DESCRIPTION
        "The reference identifier of the local clock."
    ::= { qtechntpSystem 6 }

qtechntpSysRefTime OBJECT-TYPE
    SYNTAX NTPTimeStamp
--    Rsyntax OCTET STRING(SIZE(8))
    MAX-ACCESS read-only
    STATUS current
    DESCRIPTION
        "The local time when the local clock was last
        updated.  If the local clock has never been
        synchronized, the value is zero."
    ::= { qtechntpSystem 7 }

qtechNTPServerIPAdd OBJECT-TYPE
    SYNTAX IpAddress
    MAX-ACCESS read-write
    STATUS current
    DESCRIPTION
        "NTP Server address."
    ::= { qtechntpSystem 8 }

qtechTimeAfterNTPCal OBJECT-TYPE
    SYNTAX OCTET STRING(SIZE(8))
    MAX-ACCESS read-only
    STATUS current
    DESCRIPTION
        "Time After NTP Call."
    ::= { qtechntpSystem 9 }

qtechTimeSyncPeriod OBJECT-TYPE
    SYNTAX Integer32(0..8640000)
    MAX-ACCESS read-write
    STATUS current
    DESCRIPTION
        "Time Sync Period."
    ::= { qtechntpSystem 10 }    

-- ntp server table
qtechNtpServerTable OBJECT-TYPE
    SYNTAX SEQUENCE OF QtechNtpServerEntry
    MAX-ACCESS not-accessible
    STATUS current
    DESCRIPTION
        "The table about NTP server infomation."
    ::= { qtechntpSystem 11 } 

qtechNtpServerEntry OBJECT-TYPE
    SYNTAX QtechNtpServerEntry
    MAX-ACCESS not-accessible
    STATUS current
    DESCRIPTION
        "The entry of qtechNtpServerTable."
    INDEX { 
        qtechNtpServerNetType,
        qtechNtpServerNetAddr
    }
    ::= { qtechNtpServerTable 1 }

QtechNtpServerEntry ::=
    SEQUENCE {
        qtechNtpServerNetType    InetAddressType,
        qtechNtpServerNetAddr    InetAddress,
        qtechNtpServerVersion    INTEGER,
        qtechNtpServerStatus     RowStatus
    }

qtechNtpServerNetType  OBJECT-TYPE
    SYNTAX InetAddressType
    MAX-ACCESS read-only           
    STATUS current               
    DESCRIPTION               
        "Address type of NTP server:
         ipv4(1),
         ipv6(2)"           
    ::= { qtechNtpServerEntry 1 }   

qtechNtpServerNetAddr OBJECT-TYPE
    SYNTAX InetAddress               
    MAX-ACCESS read-only             
    STATUS current 
    DESCRIPTION
        "Address of NTP server."               
    ::= { qtechNtpServerEntry 2 } 

qtechNtpServerVersion OBJECT-TYPE
    SYNTAX INTEGER {
         version1(1),
         version2(2),
         version3(3)
    }       
    MAX-ACCESS read-create            
    STATUS current             
    DESCRIPTION               
        "Version of NTP server."
    ::= { qtechNtpServerEntry 3 } 

qtechNtpServerStatus OBJECT-TYPE               
    SYNTAX RowStatus               
    MAX-ACCESS read-create           
    STATUS current          
    DESCRIPTION
        "RowStatus of NTP server."
    ::= { qtechNtpServerEntry 4 } 


-- compliance statements
qtechNtpSysGroup OBJECT-GROUP
          OBJECTS {
          qtechntpSysLeap, 
          qtechntpSysStratum, 
          qtechntpSysPrecision,
          qtechntpSysRootDelay, 
          qtechntpSysRootDispersion, 
          qtechntpSysRefId,
          qtechntpSysRefTime,
          qtechNTPServerIPAdd,
          qtechTimeAfterNTPCal,
          qtechTimeSyncPeriod,
          qtechNtpServerNetType,
          qtechNtpServerNetAddr,
          qtechNtpServerVersion,
          qtechNtpServerStatus
        }
        STATUS  current
        DESCRIPTION
                "The NTP system variables."
        ::= { qtechNtpMIBGroups 1 }

qtechNtpMIBCompliance MODULE-COMPLIANCE
        STATUS  current
        DESCRIPTION
                "The compliance statement for agents which implement the NTP MIB."
        MODULE  -- this module
                MANDATORY-GROUPS { qtechNtpMIBGroups
                 }
        ::= { qtechNtpMIBCompliances 1 }

END

