2 * Copyright (c) 2006 The FreeBSD Project
5 * Author: Shteryana Shopova <syrinx@FreeBSD.org>
7 * Redistribution of this software and documentation and use in source and
8 * binary forms, with or without modification, are permitted provided that
9 * the following conditions are met:
11 * 1. Redistributions of source code or documentation must retain the above
12 * copyright notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * Textual conventions for snmp
34 #ifndef _BSNMP_TEXT_CONV_H_
35 #define _BSNMP_TEXT_CONV_H_
37 /* Variable display length string. */
38 #define SNMP_VAR_STRSZ -1
41 * 11 bytes - octets that represent DateAndTime Textual convention
42 * and the size of string used to diplay that.
44 #define SNMP_DATETIME_OCTETS 11
45 #define SNMP_DATETIME_STRSZ 32
48 * 6 bytes - octets that represent PhysAddress Textual convention
49 * and the size of string used to diplay that.
51 #define SNMP_PHYSADDR_OCTETS 6
52 #define SNMP_PHYSADDR_STRSZ 19
55 #define SNMP_NTP_TS_OCTETS 8
56 #define SNMP_NTP_TS_STRSZ 10
59 #define SNMP_BRIDGEID_OCTETS 8
60 #define SNMP_BRIDGEID_STRSZ 25
61 #define SNMP_MAX_BRIDGE_PRIORITY 65535
64 #define SNMP_BPORT_OCTETS 2
65 #define SNMP_BPORT_STRSZ 7
66 #define SNMP_MAX_BPORT_PRIORITY 255
69 #define SNMP_INADDRS_STRSZ INET6_ADDRSTRLEN
73 SNMP_DISPLAYSTRING = 1,
77 SNMP_NTP_TIMESTAMP = 5,
83 SNMP_UNKNOWN, /* keep last */
86 typedef char * (*snmp_oct2tc_f) (uint32_t len, char *octs, char *buf);
87 typedef char * (*snmp_tc2oid_f) (char *str, struct asn_oid *oid);
88 typedef int32_t (*snmp_tc2oct_f) (struct snmp_value *value, char *string);
90 enum snmp_tc snmp_get_tc(char *str);
91 char *snmp_oct2tc(enum snmp_tc tc, uint32_t len, char *octets);
92 char *snmp_tc2oid(enum snmp_tc tc, char *str, struct asn_oid *oid);
93 int32_t snmp_tc2oct(enum snmp_tc tc, struct snmp_value *value, char *string);
95 #endif /* _BSNMP_TEXT_CONV_H_ */