NetSNMP 0.3.2.1 → 0.3.2.2
raw patch · 2 files changed
+14/−5 lines, 2 filesPVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
API changes (from Hackage documentation)
+ Network.Protocol.NetSNMP: snmpBulkWalkN :: Hostname -> Community -> RawOID -> CLong -> IO (Either String [SnmpResult])
Files
- NetSNMP.cabal +1/−1
- src/Network/Protocol/NetSNMP.hsc +13/−4
NetSNMP.cabal view
@@ -1,5 +1,5 @@ name: NetSNMP-version: 0.3.2.1+version: 0.3.2.2 synopsis: Bindings for net-snmp's C API for clients description: Network.Protocol.NetSNMP is a partial binding to the library portion of the net-snmp package. It uses the
src/Network/Protocol/NetSNMP.hsc view
@@ -1,4 +1,3 @@- {-# LANGUAGE CPP, DoAndIfThenElse, ForeignFunctionInterface, EmptyDataDecls, OverloadedStrings #-} ----------------------------------------------------------------------@@ -22,7 +21,7 @@ -- ** Library Initialization initialize, -- ** Queries- snmpGet, snmpNext, snmpWalk, snmpBulkWalk,+ snmpGet, snmpNext, snmpWalk, snmpBulkWalk, snmpBulkWalkN, -- ** Miscellany showASNValue, )@@ -374,7 +373,16 @@ -> Community -- ^SNMP community (password) -> RawOID -- ^OID to be queried -> IO (Either String [SnmpResult])-snmpBulkWalk hostname community walkoid =+snmpBulkWalk hostname community walkoid = snmpBulkWalkN hostname community walkoid 30+ +snmpBulkWalkN+ :: Hostname -- ^IP or hostname of the agent to be queried. May have+ -- prefix of @tcp:@ or suffix of @:port@+ -> Community -- ^SNMP community (password)+ -> RawOID -- ^OID to be queried+ -> CLong -- ^Max Repititons+ -> IO (Either String [SnmpResult])+snmpBulkWalkN hostname community walkoid maxReps = B.useAsCString hostname $ \cshost -> B.useAsCString community $ \cscomm -> alloca $ \session ->@@ -385,12 +393,13 @@ where bulkWalk :: RawOID -> RawOID -> Session -> Trouble [SnmpResult] bulkWalk rootoid startoid session = do- vals <- filter (\r -> oid r `isSubIdOf` rootoid) <$> mkSnmpBulkGet 0 30 startoid session+ vals <- filter (\r -> oid r `isSubIdOf` rootoid) <$> mkSnmpBulkGet 0 maxReps startoid session case vals of [] -> return [] rs -> (vals ++) <$> bulkWalk rootoid (oid (last rs)) session isSubIdOf :: RawOID -> RawOID -> Bool isSubIdOf oa ob = ob `isPrefixOf` oa+ -- getbulk, using session info from a 'data Session' and -- the supplied oid