Announcement

Collapse
No announcement yet.

WinSnmp.inc changes

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • WinSnmp.inc changes

    I had to make two changes to WinSnmp.inc so 64-bit counters can be read correctly (using SNMPv2). This is because the smiCNTR64 structure contains a 64-bit unsigned integer, while PB only has signed 64-bit integers.

    Changed hipart from DWORD to LONG:
    Code:
    TYPE smiCNTR64 DWORD
    '   hipart AS DWORD   ' smiUINT32
       hipart AS LONG   ' smiUINT32
       lopart AS DWORD   ' smiUINT32
    END TYPE
    Changed hNumber from QUAD to smiCNTR64:
    Code:
    UNION smiVALUE_UNION DWORD
       sNumber AS INTEGER     ' smiINT
       uNumber AS DWORD       ' smiUINT32
    '   hNumber AS QUAD        ' smiCNTR64
       hNumber AS smiCNTR64
       string  AS smiOCTETS   ' smiOCTETS
       oid     AS smiOID      ' smiOID
       empty   AS BYTE        ' smiBYTE
    END UNION

    Then I used MAK(QUAD) to get the value:
    Code:
    'for brevity, some SNMP initializing lines has been snipped, then I call SnmpGetVb to extract the returned value...
    LOCAL entryName AS smiOID
    LOCAL entryValue AS smiVALUE
    SnmpGetVb(hVbl, 1, entryName, entryValue)
    quadVal = MAK(QUAD, entryValue.value.hNumber.lopart, entryValue.value.hNumber.hipart)

    This is a work in progress, so I can't say I'm 100% correct. But it took a few hours just to get to the point where I could successfully read a 64-bit counter.

    I tried to post these changes to Jose's forum, but it wouldn't let me log in.
    An Error Has Occurred!
    Your session timed out while posting. Please go back and try again.

  • #2
    Special thanks to Michael Mattias.

    https://forum.powerbasic.com/forum/u...764#post500764

    I don't think that's the exact post, but he's the only reason I was able to solve my problem.

    Thanks, Michael, and never mind the negative comments some of these others might say. You're on par with Mr. Zale himself.

    Comment

    Working...
    X