]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - snmplib/coexistance.c
SourceFormat Enforcement
[thirdparty/squid.git] / snmplib / coexistance.c
index 6da3b2ecd3e5b4d0418f6c973139482a6c17c32f..dd8e209b60baab55096e7ef010c81884a08a6f26 100644 (file)
@@ -4,9 +4,9 @@
 /**********************************************************************
  *
  *           Copyright 1997 by Carnegie Mellon University
- * 
+ *
  *                       All Rights Reserved
- * 
+ *
  * Permission to use, copy, modify, and distribute this software and its
  * documentation for any purpose and without fee is hereby granted,
  * provided that the above copyright notice appear in all copies and that
@@ -14,7 +14,7 @@
  * supporting documentation, and that the name of CMU not be
  * used in advertising or publicity pertaining to distribution of the
  * software without specific, written prior permission.
- * 
+ *
  * CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  * CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  * 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.
- * 
+ *
  * Author: Ryan Troll <ryan+@andrew.cmu.edu>
- * 
+ *
  **********************************************************************/
 
-#include "config.h"
-
-#include "config.h"
+#include "squid.h"
 
 #include <stdio.h>
 
 #endif
 #if HAVE_GNUMALLOC_H
 #include <gnumalloc.h>
-#elif HAVE_MALLOC_H && !defined(_SQUID_FREEBSD_) && !defined(_SQUID_NEXT_)
+#elif HAVE_MALLOC_H
 #include <malloc.h>
 #endif
 #if HAVE_MEMORY_H
 #include <memory.h>
 #endif
-#ifdef HAVE_STRING_H
+#if HAVE_STRING_H
 #include <string.h>
 #endif
-#ifdef HAVE_STRINGS_H
+#if HAVE_STRINGS_H
 #include <strings.h>
 #endif
 #if HAVE_BSTRING_H
 #include <netdb.h>
 #endif
 
-#include "snmp.h"
 #include "asn1.h"
-#include "snmp_vars.h"
-#include "snmp_pdu.h"
-#include "snmp_error.h"
+#include "snmp.h"
 #include "snmp_api_error.h"
+#include "snmp_error.h"
+#include "snmp_pdu.h"
+#include "snmp_vars.h"
 
 #include "util.h"
 
  *   V2 PDUs from an ** MANAGER ** to V1 PDUs for an ** AGENT **
  *
  * We will never convert V1 information from a manager into V2 PDUs.  V1
- * requests are always honored by V2 agents, and the responses will be 
+ * requests are always honored by V2 agents, and the responses will be
  * valid V1 responses.  (I think. XXXXX)
  *
  */
-int snmp_coexist_V2toV1(struct snmp_pdu *PDU)
+int
+snmp_coexist_V2toV1(struct snmp_pdu *PDU)
 {
-  /* Per 3.1.1:
-   */
-  switch (PDU->command) {
-    
-  case SNMP_PDU_GET:
-  case SNMP_PDU_GETNEXT:
-  case SNMP_PDU_SET:
-    return(1);
-    break;
+    /* Per 3.1.1:
+     */
+    switch (PDU->command) {
+
+    case SNMP_PDU_GET:
+    case SNMP_PDU_GETNEXT:
+#if SNMP_PDU_SET
+    case SNMP_PDU_SET:
+#endif
+        return (1);
+        break;
 
-  case SNMP_PDU_GETBULK:
-    PDU->non_repeaters = 0;
-    PDU->max_repetitions = 0;
-    PDU->command = SNMP_PDU_GETNEXT;
-    return(1);
-    break;
+    case SNMP_PDU_GETBULK:
+        PDU->non_repeaters = 0;
+        PDU->max_repetitions = 0;
+        PDU->command = SNMP_PDU_GETNEXT;
+        return (1);
+        break;
 
-  default:
-    snmplib_debug(2, "Unable to translate PDU %d to SNMPv1!\n", PDU->command);
-    snmp_set_api_error(SNMPERR_PDU_TRANSLATION);
-    return(0);
-  }
+    default:
+        snmplib_debug(2, "Unable to translate PDU %d to SNMPv1!\n", PDU->command);
+        snmp_set_api_error(SNMPERR_PDU_TRANSLATION);
+        return (0);
+    }
 }
-