[BACK]Return to mib.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / snmp

File: [local] / src / usr.bin / snmp / mib.c (download)

Revision 1.3, Mon Aug 3 14:45:54 2020 UTC (3 years, 9 months ago) by martijn
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8, HEAD
Changes since 1.2: +3 -1 lines

Add support for UTF-8 DISPLAY-HINTs with octet length. For now only
sysContact is supported with SnmpAdminString, but more shall follow
soon(tm).

Note that this will change output even in the C locale: Previously every
unprintable byte would be tranformed to a '.', with this diff a valid UTF-8
multibyte or unprintable character will be squished into a single dot to
give a better understanding of the intention of the original message.
Invalid bytes will now be printed as question marks.

Lot's of help and back and forth with schwarze@ who also kindly offered to
walk away when I mentioned looking through MIB files for more objects to
convert to this new code, which is understandable.

OK schwarze@

/*	$OpenBSD: mib.c,v 1.3 2020/08/03 14:45:54 martijn Exp $	*/

/*
 * Copyright (c) 2012 Joel Knight <joel@openbsd.org>
 * Copyright (c) 2007, 2008, 2012 Reyk Floeter <reyk@openbsd.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */


#include <sys/tree.h>
#include <sys/types.h>
#include <sys/queue.h>

#include "ber.h"
#include "mib.h"
#include "smi.h"

static struct oid mib_tree[] = MIB_TREE;
static struct textconv textconv_tree[] = TEXTCONV_TREE;

void
mib_init(void)
{
	smi_mibtree(mib_tree);
	smi_textconvtree(textconv_tree);
}