]>
git.ipfire.org Git - thirdparty/squid.git/blob - lib/snmplib/coexistance.c
2 * Copyright (C) 1996-2014 The Squid Software Foundation and contributors
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.
10 * RFC 1908: Coexistence between SNMPv1 and SNMPv2
12 /**********************************************************************
14 * Copyright 1997 by Carnegie Mellon University
18 * Permission to use, copy, modify, and distribute this software and its
19 * documentation for any purpose and without fee is hereby granted,
20 * provided that the above copyright notice appear in all copies and that
21 * both that copyright notice and this permission notice appear in
22 * supporting documentation, and that the name of CMU not be
23 * used in advertising or publicity pertaining to distribution of the
24 * software without specific, written prior permission.
26 * CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
27 * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
28 * CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
29 * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
30 * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
31 * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
34 * Author: Ryan Troll <ryan+@andrew.cmu.edu>
36 **********************************************************************/
47 #include <sys/types.h>
53 #include <gnumalloc.h>
70 #include <sys/socket.h>
73 #include <netinet/in.h>
76 #include <arpa/inet.h>
87 #include "snmp_api_error.h"
88 #include "snmp_error.h"
90 #include "snmp_vars.h"
95 * RFC 1908: Coexistence between SNMPv1 and SNMPv2
99 * V1 PDUs from an ** AGENT ** to V2 PDUs for an ** MANAGER **
100 * V2 PDUs from an ** MANAGER ** to V1 PDUs for an ** AGENT **
102 * We will never convert V1 information from a manager into V2 PDUs. V1
103 * requests are always honored by V2 agents, and the responses will be
104 * valid V1 responses. (I think. XXXXX)
108 snmp_coexist_V2toV1(struct snmp_pdu
*PDU
)
112 switch (PDU
->command
) {
115 case SNMP_PDU_GETNEXT
:
122 case SNMP_PDU_GETBULK
:
123 PDU
->non_repeaters
= 0;
124 PDU
->max_repetitions
= 0;
125 PDU
->command
= SNMP_PDU_GETNEXT
;
130 snmplib_debug(2, "Unable to translate PDU %d to SNMPv1!\n", PDU
->command
);
131 snmp_set_api_error(SNMPERR_PDU_TRANSLATION
);