---
name: "netsnmp_instance"
section: "3snmp"
platform: "linux"
package: "libsnmp-dev"
version: "5.4.3~dfsg-2.8+deb7u1"
release: "Debian 7 (Wheezy)"
platforms: ["linux"]
url: "https://new.carta.tech/netsnmp_instance"
---

# netsnmp\_instance(3snmp)

Process individual MIB instances easily.

## NAME

instance -

Process individual MIB instances easily.

### Functions

**netsnmp\_mib\_handler** \* **netsnmp\_get\_instance\_handler** (void)\
 *Creates an instance helper handler, calls netsnmp\_create\_handler, which then could be registered, using* **netsnmp\_register\_handler()***.*  int **netsnmp\_register\_instance** (**netsnmp\_handler\_registration** \*reginfo)\
 *This function registers an instance helper handler, which is a way of registering an exact OID such that GENEXT requests are handled entirely by the helper.*  int **netsnmp\_register\_read\_only\_instance** (**netsnmp\_handler\_registration** \*reginfo)\
 *This function injects a 'read only' handler into the handler chain prior to serializing/registering the handler.*  int **netsnmp\_register\_read\_only\_ulong\_instance** (const char \*name, oid \*reg\_oid, size\_t reg\_oid\_len, u\_long \*it, Netsnmp\_Node\_Handler \*subhandler)\
 int **netsnmp\_register\_ulong\_instance** (const char \*name, oid \*reg\_oid, size\_t reg\_oid\_len, u\_long \*it, Netsnmp\_Node\_Handler \*subhandler)\
 int **netsnmp\_register\_read\_only\_counter32\_instance** (const char \*name, oid \*reg\_oid, size\_t reg\_oid\_len, u\_long \*it, Netsnmp\_Node\_Handler \*subhandler)\
 int **netsnmp\_register\_read\_only\_long\_instance** (const char \*name, oid \*reg\_oid, size\_t reg\_oid\_len, long \*it, Netsnmp\_Node\_Handler \*subhandler)\
 int **netsnmp\_register\_long\_instance** (const char \*name, oid \*reg\_oid, size\_t reg\_oid\_len, long \*it, Netsnmp\_Node\_Handler \*subhandler)\
 int **netsnmp\_register\_read\_only\_uint\_instance** (const char \*name, oid \*reg\_oid, size\_t reg\_oid\_len, unsigned int \*it, Netsnmp\_Node\_Handler \*subhandler)\
 int **netsnmp\_register\_uint\_instance** (const char \*name, oid \*reg\_oid, size\_t reg\_oid\_len, unsigned int \*it, Netsnmp\_Node\_Handler \*subhandler)\
 int **netsnmp\_register\_read\_only\_int\_instance** (const char \*name, oid \*reg\_oid, size\_t reg\_oid\_len, int \*it, Netsnmp\_Node\_Handler \*subhandler)\
 int **register\_read\_only\_int\_instance** (const char \*name, oid \*reg\_oid, size\_t reg\_oid\_len, int \*it, Netsnmp\_Node\_Handler \*subhandler)\
 int **netsnmp\_register\_read\_only\_ulong\_instance\_context** (const char \*name, oid \*reg\_oid, size\_t reg\_oid\_len, u\_long \*it, Netsnmp\_Node\_Handler \*subhandler, const char \*contextName)\
 int **netsnmp\_register\_ulong\_instance\_context** (const char \*name, oid \*reg\_oid, size\_t reg\_oid\_len, u\_long \*it, Netsnmp\_Node\_Handler \*subhandler, const char \*contextName)\
 int **netsnmp\_register\_read\_only\_counter32\_instance\_context** (const char \*name, oid \*reg\_oid, size\_t reg\_oid\_len, u\_long \*it, Netsnmp\_Node\_Handler \*subhandler, const char \*contextName)\
 int **netsnmp\_register\_read\_only\_long\_instance\_context** (const char \*name, oid \*reg\_oid, size\_t reg\_oid\_len, long \*it, Netsnmp\_Node\_Handler \*subhandler, const char \*contextName)\
 int **netsnmp\_register\_long\_instance\_context** (const char \*name, oid \*reg\_oid, size\_t reg\_oid\_len, long \*it, Netsnmp\_Node\_Handler \*subhandler, const char \*contextName)\
 int **netsnmp\_register\_int\_instance\_context** (const char \*name, oid \*reg\_oid, size\_t reg\_oid\_len, int \*it, Netsnmp\_Node\_Handler \*subhandler, const char \*contextName)\
 int **netsnmp\_register\_read\_only\_int\_instance\_context** (const char \*name, oid \*reg\_oid, size\_t reg\_oid\_len, int \*it, Netsnmp\_Node\_Handler \*subhandler, const char \*contextName)\
 int **register\_read\_only\_int\_instance\_context** (const char \*name, oid \*reg\_oid, size\_t reg\_oid\_len, int \*it, Netsnmp\_Node\_Handler \*subhandler, const char \*contextName)\
 int **netsnmp\_register\_num\_file\_instance** (const char \*name, oid \*reg\_oid, size\_t reg\_oid\_len, char \*file\_name, int asn\_type, int mode, Netsnmp\_Node\_Handler \*subhandler, const char \*contextName)\
 int **netsnmp\_register\_int\_instance** (const char \*name, oid \*reg\_oid, size\_t reg\_oid\_len, int \*it, Netsnmp\_Node\_Handler \*subhandler)\
 *This function registers an int helper handler to a specified OID.*  int **netsnmp\_instance\_ulong\_handler** (**netsnmp\_mib\_handler** \*handler, **netsnmp\_handler\_registration** \*reginfo, **netsnmp\_agent\_request\_info** \*reqinfo, **netsnmp\_request\_info** \*requests)\
 int **netsnmp\_instance\_counter32\_handler** (**netsnmp\_mib\_handler** \*handler, **netsnmp\_handler\_registration** \*reginfo, **netsnmp\_agent\_request\_info** \*reqinfo, **netsnmp\_request\_info** \*requests)\
 int **netsnmp\_instance\_long\_handler** (**netsnmp\_mib\_handler** \*handler, **netsnmp\_handler\_registration** \*reginfo, **netsnmp\_agent\_request\_info** \*reqinfo, **netsnmp\_request\_info** \*requests)\
 int **netsnmp\_instance\_int\_handler** (**netsnmp\_mib\_handler** \*handler, **netsnmp\_handler\_registration** \*reginfo, **netsnmp\_agent\_request\_info** \*reqinfo, **netsnmp\_request\_info** \*requests)\
 int **netsnmp\_instance\_num\_file\_handler** (**netsnmp\_mib\_handler** \*handler, **netsnmp\_handler\_registration** \*reginfo, **netsnmp\_agent\_request\_info** \*reqinfo, **netsnmp\_request\_info** \*requests)\
 int **netsnmp\_instance\_uint\_handler** (**netsnmp\_mib\_handler** \*handler, **netsnmp\_handler\_registration** \*reginfo, **netsnmp\_agent\_request\_info** \*reqinfo, **netsnmp\_request\_info** \*requests)\
 int **netsnmp\_instance\_helper\_handler** (**netsnmp\_mib\_handler** \*handler, **netsnmp\_handler\_registration** \*reginfo, **netsnmp\_agent\_request\_info** \*reqinfo, **netsnmp\_request\_info** \*requests)\

## Detailed Description

Process individual MIB instances easily.

## Function Documentation

### netsnmp\_mib\_handler\* netsnmp\_get\_instance\_handler (void)

Creates an instance helper handler, calls netsnmp\_create\_handler, which then could be registered, using **netsnmp\_register\_handler()**. **Returns:**

Returns a pointer to a netsnmp\_mib\_handler struct which contains the handler's name and the access method

Definition at line 48 of file instance.c.

### int netsnmp\_instance\_num\_file\_handler (netsnmp\_mib\_handler \* handler, netsnmp\_handler\_registration \* reginfo, netsnmp\_agent\_request\_info \* reqinfo, netsnmp\_request\_info \* requests)

fall through

Definition at line 741 of file instance.c.

### int netsnmp\_register\_instance (netsnmp\_handler\_registration \* reginfo)

This function registers an instance helper handler, which is a way of registering an exact OID such that GENEXT requests are handled entirely by the helper. First need to inject it into the calling chain of the handler defined by the netsnmp\_handler\_registration struct, reginfo. The new handler is injected at the top of the list and will be the new handler to be called first. This function also injects a serialize handler before actually calling netsnmp\_register\_handle, registering reginfo.

**Parameters:**

*reginfo* a handler registration structure which could get created using netsnmp\_create\_handler\_registration. Used to register an instance helper handler.

**Returns:**

MIB\_REGISTERED\_OK is returned if the registration was a success. Failures are MIB\_REGISTRATION\_FAILED and MIB\_DUPLICATE\_REGISTRATION.

**Examples:**  **delayed\_instance.c**.

Definition at line 73 of file instance.c.

### int netsnmp\_register\_int\_instance (const char \* name, oid \* reg\_oid, size\_t reg\_oid\_len, int \* it, Netsnmp\_Node\_Handler \* subhandler)

This function registers an int helper handler to a specified OID. **Parameters:**

*name* the name used for registration pruposes.\
 *reg\_oid* the OID where you want to register your integer at\
 *reg\_oid\_len* the length of the OID\
 *it* the integer value to be registered during initialization\
 *subhandler* a handler to do whatever you want to do, otherwise use NULL to use the default int handler.

**Returns:**

MIB\_REGISTERED\_OK is returned if the registration was a success. Failures are MIB\_REGISTRATION\_FAILED and MIB\_DUPLICATE\_REGISTRATION.

**Examples:**  **scalar\_int.c**.

Definition at line 460 of file instance.c.

### int netsnmp\_register\_read\_only\_instance (netsnmp\_handler\_registration \* reginfo)

This function injects a 'read only' handler into the handler chain prior to serializing/registering the handler. The only purpose of this 'read only' handler is to return an appropriate error for any requests passed to it in a SET mode. Inserting it into your handler chain will ensure you're never asked to perform a SET request so you can ignore those error conditions.

**Parameters:**

*reginfo* a handler registration structure which could get created using netsnmp\_create\_handler\_registration. Used to register a read only instance helper handler.

**Returns:**

MIB\_REGISTERED\_OK is returned if the registration was a success. Failures are MIB\_REGISTRATION\_FAILED and MIB\_DUPLICATE\_REGISTRATION.

Definition at line 100 of file instance.c.

## Author

Generated automatically by Doxygen for net-snmp from the source code.
