Path: blob/main/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.h
108529 views
/*-1* Copyright (c) 2006 The FreeBSD Project2* All rights reserved.3*4* Author: Shteryana Shopova <[email protected]>5*6* Redistribution of this software and documentation and use in source and7* binary forms, with or without modification, are permitted provided that8* the following conditions are met:9*10* 1. Redistributions of source code or documentation must retain the above11* copyright notice, this list of conditions and the following disclaimer.12* 2. Redistributions in binary form must reproduce the above copyright13* notice, this list of conditions and the following disclaimer in the14* documentation and/or other materials provided with the distribution.15*16* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND17* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE18* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE19* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE20* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL21* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS22* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)23* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT24* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY25* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF26* SUCH DAMAGE.27*28* Textual conventions for snmp29*/3031#ifndef _BSNMP_TEXT_CONV_H_32#define _BSNMP_TEXT_CONV_H_3334/* Variable display length string. */35#define SNMP_VAR_STRSZ -13637/*38* 11 bytes - octets that represent DateAndTime Textual convention39* and the size of string used to display that.40*/41#define SNMP_DATETIME_OCTETS 1142#define SNMP_DATETIME_STRSZ 324344/*45* 6 bytes - octets that represent PhysAddress Textual convention46* and the size of string used to display that.47*/48#define SNMP_PHYSADDR_OCTETS 649#define SNMP_PHYSADDR_STRSZ 195051/* NTPTimeStamp. */52#define SNMP_NTP_TS_OCTETS 853#define SNMP_NTP_TS_STRSZ 105455/* BridgeId. */56#define SNMP_BRIDGEID_OCTETS 857#define SNMP_BRIDGEID_STRSZ 2558#define SNMP_MAX_BRIDGE_PRIORITY 655355960/* BridgePortId. */61#define SNMP_BPORT_OCTETS 262#define SNMP_BPORT_STRSZ 763#define SNMP_MAX_BPORT_PRIORITY 2556465/* InetAddress. */66#define SNMP_INADDRS_STRSZ INET6_ADDRSTRLEN6768enum snmp_tc {69SNMP_STRING = 0,70SNMP_DISPLAYSTRING = 1,71SNMP_DATEANDTIME = 2,72SNMP_PHYSADDR = 3,73SNMP_ATMESI = 4,74SNMP_NTP_TIMESTAMP = 5,75SNMP_MACADDRESS = 6,76SNMP_BRIDGE_ID = 7,77SNMP_BPORT_ID = 8,78SNMP_INETADDRESS = 9,79SNMP_TC_OWN = 10,80SNMP_UNKNOWN, /* keep last */81};8283typedef char * (*snmp_oct2tc_f) (uint32_t len, char *octs, char *buf);84typedef char * (*snmp_tc2oid_f) (char *str, struct asn_oid *oid);85typedef int32_t (*snmp_tc2oct_f) (struct snmp_value *value, char *string);8687enum snmp_tc snmp_get_tc(char *str);88char *snmp_oct2tc(enum snmp_tc tc, uint32_t len, char *octets);89char *snmp_tc2oid(enum snmp_tc tc, char *str, struct asn_oid *oid);90int32_t snmp_tc2oct(enum snmp_tc tc, struct snmp_value *value, char *string);9192#endif /* _BSNMP_TEXT_CONV_H_ */939495