397
399
sv_setiv(arg, (IV) handler);
398
400
XPUSHs(sv_2mortal(rarg));
399
401
rarg = newSViv(0);
400
arg = newSVrv(rarg, "NetSNMP::agent::reginfo");
402
arg = newSVrv(rarg, "NetSNMP::agent::netsnmp_handler_registrationPtr");
401
403
sv_setiv(arg, (IV) reginfo);
402
404
XPUSHs(sv_2mortal(rarg));
403
405
rarg = newSViv(0);
495
497
MODULE = NetSNMP::agent PACKAGE = NetSNMP::agent::netsnmp_handler_registration PREFIX = nsahr_
497
netsnmp_handler_registration *
499
NetSNMP::agent::netsnmp_handler_registration
498
500
nsahr_new(name, regoid, perlcallback)
870
/* We want an integer here */
871
if ((SvTYPE(value) == SVt_IV) || (SvTYPE(value) == SVt_PVMG)) {
872
/* Good - got a real one (or a blessed scalar which we have to hope will turn out OK) */
873
ulltmp = SvIV(value);
874
c64.high = (uint32_t)(ulltmp >> 32);
875
c64.low = (uint32_t)ulltmp;
876
snmp_set_var_typed_value(request->requestvb, (u_char)type,
877
(u_char *) &c64, sizeof(struct counter64));
881
else if (SvPOKp(value)) {
882
/* Might be OK - got a string, so try to convert it, allowing base 10, octal, and hex forms */
883
stringptr = SvPV(value, stringlen);
885
ulltmp = strtoul( stringptr, NULL, 0 );
887
ulltmp = strtoull( stringptr, NULL, 0 );
889
if (errno == EINVAL) {
890
snmp_log(LOG_ERR, "Could not convert string to number in setValue: '%s'", stringptr);
895
c64.high = (uint32_t)(ulltmp >> 32);
896
c64.low = (uint32_t)ulltmp;
897
snmp_set_var_typed_value(request->requestvb, (u_char)type,
898
(u_char *) &c64, sizeof(struct counter64));
903
snmp_log(LOG_ERR, "Non-unsigned-integer value passed to setValue with ASN_COUNTER64: type was %d\n",
865
909
case ASN_OCTET_STR:
866
910
case ASN_BIT_STR:
867
911
/* Check that we have been passed something with a string value (or a blessed scalar) */