SNMP Manager Programmer's Guide
Reference Summary
SNMP Manager Programmer’s Guide–134249
9-8
Common Utility Functions
str_to_trap()
The str_to_trap() function converts the string value of a generic trap to its corresponding
integer value.
str_to_type()
The str_to_type() function converts a string depicting an SNMP type into its
corresponding Manager Services representation.
include "printh"
generic-trap-number str_to_trap(generic-trap-string);
int
string_to_trap(char *generic-trap-string);
generic-trap-
number
One of the following integers, which correspond to the generic
trap strings defined in RFC 1157: 0 (coldStart), 1 (warmStart), 2
(linkDown), 3 (linkUp), 4 (authenticationFailure), 5
(egpNeighborLoss), 6 (enterpriseSpecific).
generic-trap-
string
A pointer to one of the generic trap strings described above.
include "printh"
rcode = str_to_type(type-string);
int
str_to_type(char *type-string);
rcode
An integer indicating the outcome of the call. A value of -1
indicates failure.
type-string
A pointer to one of the following strings; the Manager Services
representation of each string is shown in parentheses:
INTEGER (VT_NUMBER)
OCTET_STRING (VT_STRING)
DisplayString (VT_STRING)
OBJECT_IDENTIFIER (VT_OBJECT)
NULL (VT_EMPTY)
IpAddress (VT_IPADDRESS)
Counter (VT_COUNTER)
Gauge (VT_GAUGE)
TimeTicks (VT_TIMETICKS)
Opaque (VT_OPAQUE)