Sorry, I just figured out that I was doing it wrong. `requests->requestvb->name` works properly.
Thank you. On Thu, 16 Sept 2021 at 11:16, Hyundeok Park <p.hyundeo...@gmail.com> wrote: > Is it possible to retrieve an OID from a request in Net-SNMP? > > This is to allow the module to identify arguments passed to an OID. > > For example, the following OID > > ``` > .1.2.3.4.\"qwerty\" > ``` > > is translated into > > ``` > .1.2.3.4.113.119.101.114.116.121 > ^^^ ^^^ ^^^ ^^^ ^^^ ^^^ > q w e r t y > ``` > > The current implementation lets the `Netsnmp_Node_Handler` process > requests to each registered OID. > > This handler takes four parameters: > > ```c > handle_[NAME OF OBJECT](netsnmp_mib_handler *handler AEGIS_UNUSED, > netsnmp_handler_registration *reginfo AEGIS_UNUSED, > netsnmp_agent_request_info *reqinfo, > netsnmp_request_info *requests); > ``` > > And I couldn't find a way to retrieve an OID from each request. > > I tried using `reginfo->rootoid` and `requests->requestvb->name`. However, > they only returned `.1.3.6.1.4` when I registered the handler to a > different OID (`.1.3.6.1.4.1.99999.1.1`). > > I found that a function type `FindVarMethod` was used to handle requests > in UCD-SNMP: > > ```c > unsigned char *var_[NAME OF OBJECT](struct variable *vp, oid *name, > size_t *length, int exact, size_t > *var_len, > WriteMethod **write_method); > > ``` > > Is `oid *name` what I'm looking for? > > If so, is it possible to do so in Net-SNMP? > > Thank you. >
_______________________________________________ Net-snmp-users mailing list Net-snmp-users@lists.sourceforge.net Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users