octetstring(3N) octetstring(3N)
NAME
octetstring - Operations on OctetStrings
SYNOPSIS
#include <snmp/snmp.h>
void free_octetstring(os_ptr) OctetString *os_ptr;
OctetString *make_octet_from_hex(hex_string) char
*hex_string; /* Hexadecimal to be converted */
OctetString *make_octetstring(in_string, length) char
*in_string; /* The octetstring's value - byte
string */ long length; /* length of the byte
string */
#include <snmp/snmp.h> #include <snmp/snmpuser.h>
OctetString *make_octet_from_text(text_string) char
*text_string; /* Text to be converted to an
octetstring */
short print_ascii(octet_ptr) OctetString *octet_ptr; /*
pointer to octetstring to be displayed */
void print_octet_string_out(octet_ptr, wrap) OctetString
*octet_ptr; /* pointer to octetstring to be displayed */
long wrap; /* number of bytes to display per line
*/
DESCRIPTION
free_octetstring frees all memory associated with an
OctetString data structure, including the memory allocated to
the individual octets.
make_octet_from_hex converts a hex text string into a library
format OctetString data structure for use by calls to
make_varbind and make_authentication. The format of these
strings is a hex value (1 or more hex digits, upper or lower
case) followed by a space, with more hex values and spaces to
complete the string. For example, to create an OctetString of
length two with a hex 15 in the first octet and a hex 3D in
the second octet, the text string could be ``15 3d'' or ``0x15
0x3D''. The OctetString construct returned by this call can be
freed by a call to free_octetstring. Usually, this is
unnecessary as the construct is most often passed to another
Copyright 1994 Novell, Inc. Page 1
octetstring(3N) octetstring(3N)
library routine for inclusion in a larger ASN.1 construct, and
that library's free counterpart will perform the memory
recovery.
make_octetstring produces a library OctetString construct from
an input byte string and length. This construct is usually
passed to other library calls, such as make_varbind or
make_authentication, and linked into a larger library
construct of an ASN.1 entity. free_octetstring recovers all
memory malloc'ed by make_octetstring, but should not be used
if the octetstring is passed to another library routine. The
free_* counterparts to those routines free up all memory that
has been linked to the higher level ASN.1 structure.
make_octet_from_text is used to create a library format
OctetString data structure for use by calls to make_varbind
and make_authentication from text strings.
If an OctetString's value contains only printable characters,
print_ascii prints out the value's contents as an ASCII
string. It is called with a pointer to the OctetString
construct and checks if the string is printable. If it isn't
printable, print_ascii returns a -1 value; otherwise it
returns a 1.
print_octet_string_out prints out the contents of an
OctetString's value in hex. It is called with a pointer to the
OctetString construct and the number of bytes to display on
one line (the variable `wrap'). This call is used by the
print_varbind routine to actually print out OctetString
values.
SEE ALSO
smux_util(3N), snmp_authentication(3N), snmp_pdu(3N),
varbind(3N).
Copyright 1994 Novell, Inc. Page 2