NetBurner 3.5.7
PDF Version
SNMPWriteObject Class Reference

Registers a scalar write callback with the SNMP agent. More...

#include <snmp_table.h>

Public Member Functions

 SNMPWriteObject (const char *oid, int typ, PutpIFunc *pf, uint32_t commmask)
 Register a write callback for one SNMP scalar.
 

Detailed Description

Registers a scalar write callback with the SNMP agent.

Application code does not instantiate this class directly — use the SNMPWRITEFUNC macro, which constructs a file-static instance so the callback is registered before main() runs. The constructor is overloaded on every write-callback signature in Read/write callback function signatures; the compiler picks the overload that matches your setter, which in turn selects the matching ASN.1 dispatcher.

Example
int WriteOutput(int var, int bTest) {
if (bTest) return (var == 0 || var == 1) ? SNMP_SET_OK : SNMP_SET_FAIL;
g_output_on = var;
return SNMP_SET_OK;
}
SNMPWRITEFUNC(OUTPUT, "1.3.6.1.4.1.8174.10.2.0", ASN_typeInteger32,
WriteOutput, WRITE_COMMUNITY_MASK);
#define WRITE_COMMUNITY_MASK
Bitmask indicating write community access.
Definition snmp.h:313
#define SNMPWRITEFUNC(w, x, y, z, q)
Register a write callback for one SNMP scalar at file scope.
Definition snmp_table.h:471
#define SNMP_SET_OK
Value is acceptable / applied successfully.
Definition snmp_table.h:90
#define ASN_typeInteger32
Use with snmp_typeInteger32.
Definition snmp_table.h:139
#define SNMP_SET_FAIL
Value is invalid or the set cannot be applied.
Definition snmp_table.h:89

Constructor & Destructor Documentation

◆ SNMPWriteObject()

SNMPWriteObject::SNMPWriteObject ( const char * oid,
int typ,
PutpIFunc * pf,
uint32_t commmask )
inline

Register a write callback for one SNMP scalar.

Parameters
oidDotted-decimal OID string. Scalars end in .0.
typOne of the ASN_type* tags (e.g. ASN_typeInteger32).
pfPointer to the setter; the overload chosen follows from its signature.
commmaskCommunity mask (typically WRITE_COMMUNITY_MASK).

The documentation for this class was generated from the following file: