]>
git.ipfire.org Git - thirdparty/squid.git/blob - snmplib/coexistance.c
2 * RFC 1908: Coexistence between SNMPv1 and SNMPv2
4 /**********************************************************************
6 * Copyright 1997 by Carnegie Mellon University
10 * Permission to use, copy, modify, and distribute this software and its
11 * documentation for any purpose and without fee is hereby granted,
12 * provided that the above copyright notice appear in all copies and that
13 * both that copyright notice and this permission notice appear in
14 * supporting documentation, and that the name of CMU not be
15 * used in advertising or publicity pertaining to distribution of the
16 * software without specific, written prior permission.
18 * CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
19 * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
20 * CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
21 * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
22 * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
23 * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
26 * Author: Ryan Troll <ryan+@andrew.cmu.edu>
28 **********************************************************************/
43 #include <sys/types.h>
49 #include <gnumalloc.h>
50 #elif HAVE_MALLOC_H && !defined(_SQUID_FREEBSD_) && !defined(_SQUID_NEXT_)
66 #include <sys/socket.h>
69 #include <netinet/in.h>
72 #include <arpa/inet.h>
83 #include "snmp_vars.h"
85 #include "snmp_error.h"
86 #include "snmp_api_error.h"
91 * RFC 1908: Coexistence between SNMPv1 and SNMPv2
95 * V1 PDUs from an ** AGENT ** to V2 PDUs for an ** MANAGER **
96 * V2 PDUs from an ** MANAGER ** to V1 PDUs for an ** AGENT **
98 * We will never convert V1 information from a manager into V2 PDUs. V1
99 * requests are always honored by V2 agents, and the responses will be
100 * valid V1 responses. (I think. XXXXX)
104 snmp_coexist_V2toV1(struct snmp_pdu
*PDU
)
108 switch (PDU
->command
) {
111 case SNMP_PDU_GETNEXT
:
118 case SNMP_PDU_GETBULK
:
119 PDU
->non_repeaters
= 0;
120 PDU
->max_repetitions
= 0;
121 PDU
->command
= SNMP_PDU_GETNEXT
;
126 snmplib_debug(2, "Unable to translate PDU %d to SNMPv1!\n", PDU
->command
);
127 snmp_set_api_error(SNMPERR_PDU_TRANSLATION
);