]> git.ipfire.org Git - thirdparty/squid.git/blame - lib/snmplib/snmp_error.c
SourceFormat Enforcement
[thirdparty/squid.git] / lib / snmplib / snmp_error.c
CommitLineData
c04fda28 1/*
bde978a6 2 * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
c04fda28
AJ
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
85269fdf 9/*
10 * The possible SNMP Error messages, from the SNMP Protocol Operations
11 * [ RFC 1905 ]
12 */
13/**********************************************************************
14 *
15 * Copyright 1997 by Carnegie Mellon University
26ac0430 16 *
85269fdf 17 * All Rights Reserved
26ac0430 18 *
85269fdf 19 * Permission to use, copy, modify, and distribute this software and its
20 * documentation for any purpose and without fee is hereby granted,
21 * provided that the above copyright notice appear in all copies and that
22 * both that copyright notice and this permission notice appear in
23 * supporting documentation, and that the name of CMU not be
24 * used in advertising or publicity pertaining to distribution of the
25 * software without specific, written prior permission.
26ac0430 26 *
85269fdf 27 * CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
28 * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
29 * CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
30 * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
31 * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
32 * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
33 * SOFTWARE.
26ac0430 34 *
85269fdf 35 **********************************************************************/
36
f7f3304a 37#include "squid.h"
85269fdf 38#include "snmp_error.h"
39
a0a5f63e
AJ
40static const char *error_string[25] = {
41 /* 0x00 - 0x05 */
43d4303e 42 "No Error",
43 "Response message would have been too large.",
44 "There is no such variable name in this MIB.",
45 "The value given has the wrong type, length, or value",
46 "This variable is read only",
47 "A general failure occured",
85269fdf 48
a0a5f63e 49 /* 0x06 - 0x09 */
26ac0430 50 /* SNMPv2 Errors */
43d4303e 51 "NOACCESS",
52 "WRONGTYPE",
53 "WRONGLENGTH",
54 "WRONGENCODING",
c3ae32cc 55
a0a5f63e
AJ
56 /* 0x0A - 0x0F */
57 "UNDEFINED",
58 "UNDEFINED",
59 "UNDEFINED",
60 "UNDEFINED",
61 "UNDEFINED",
62 "UNDEFINED",
c3ae32cc 63
a0a5f63e 64 /* 0x10 - 0x18 */
43d4303e 65 "WRONGVALUE",
66 "NOCREATION",
67 "INCONSISTENTVALUE",
68 "RESOURCEUNAVAILABLE",
69 "COMMITFAILED",
70 "UNDOFAILED",
71 "AUTHORIZATIONERROR",
72 "NOTWRITABLE",
73 "INCONSISTENTNAME",
85269fdf 74
75};
76
5c52f59a 77const char *
43d4303e 78snmp_errstring(int errstat)
85269fdf 79{
43d4303e 80 if ((errstat <= (SNMP_ERR_INCONSISTENTNAME)) &&
26ac0430
AJ
81 (errstat >= (SNMP_ERR_NOERROR))) {
82 return error_string[errstat];
43d4303e 83 } else {
26ac0430 84 return "Unknown Error";
43d4303e 85 }
85269fdf 86}
f53969cc 87