]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - snmplib/snmp_pdu.c
SourceFormat Enforcement
[thirdparty/squid.git] / snmplib / snmp_pdu.c
index 84aa88d2cefcdcbf7f754adf31ac9cabaf9fed90..d5b4d4fdff26aa3643892a12c581197b7b237d8b 100644 (file)
@@ -33,7 +33,7 @@
  *
  **********************************************************************/
 
-#include "config.h"
+#include "squid.h"
 
 #include <stdio.h>
 
 #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
  */
 
 struct snmp_pdu *
-            snmp_pdu_create(int command) {
+snmp_pdu_create(int command) {
     struct snmp_pdu *pdu;
 
-#ifdef DEBUG_PDU
+#if DEBUG_PDU
     snmplib_debug(8, "PDU:  Creating\n");
 #endif
 
@@ -126,7 +126,7 @@ struct snmp_pdu *
     pdu->enterprise_length = 0;
     pdu->variables = NULL;
 
-#ifdef DEBUG_PDU
+#if DEBUG_PDU
     snmplib_debug(8, "PDU:  Created %x\n", (unsigned int) pdu);
 #endif
 
@@ -138,10 +138,10 @@ struct snmp_pdu *
 /* Clone an existing PDU.
  */
 struct snmp_pdu *
-            snmp_pdu_clone(struct snmp_pdu *Src) {
+snmp_pdu_clone(struct snmp_pdu *Src) {
     struct snmp_pdu *Dest;
 
-#ifdef DEBUG_PDU
+#if DEBUG_PDU
     snmplib_debug(8, "PDU %x:  Cloning\n", (unsigned int) Src);
 #endif
 
@@ -150,9 +150,9 @@ struct snmp_pdu *
         snmp_set_api_error(SNMPERR_OS_ERR);
         return (NULL);
     }
-    xmemcpy((char *) Dest, (char *) Src, sizeof(struct snmp_pdu));
+    memcpy((char *) Dest, (char *) Src, sizeof(struct snmp_pdu));
 
-#ifdef DEBUG_PDU
+#if DEBUG_PDU
     snmplib_debug(8, "PDU %x:  Created %x\n", (unsigned int) Src, (unsigned int) Dest);
 #endif
     return (Dest);
@@ -172,18 +172,18 @@ struct snmp_pdu *
  * be returned.
  */
 struct snmp_pdu *
-            snmp_pdu_fix(struct snmp_pdu *pdu, int command) {
+snmp_pdu_fix(struct snmp_pdu *pdu, int command) {
     return (snmp_fix_pdu(pdu, command));
 }
 
 struct snmp_pdu *
-            snmp_fix_pdu(struct snmp_pdu *pdu, int command) {
+snmp_fix_pdu(struct snmp_pdu *pdu, int command) {
     struct variable_list *var, *newvar;
     struct snmp_pdu *newpdu;
     int i;
     int copied = 0;
 
-#ifdef DEBUG_PDU
+#if DEBUG_PDU
     snmplib_debug(8, "PDU %x:  Fixing.  Err index is %d\n",
                   (unsigned int) pdu, (unsigned int) pdu->errindex);
 #endif
@@ -256,14 +256,13 @@ struct snmp_pdu *
         snmp_set_api_error(SNMPERR_UNABLE_TO_FIX);
         return (NULL);
     }
-#ifdef DEBUG_PDU
+#if DEBUG_PDU
     snmplib_debug(8, "PDU %x:  Fixed PDU is %x\n",
                   (unsigned int) pdu, (unsigned int) newpdu);
 #endif
     return (newpdu);
 }
 
-
 /**********************************************************************/
 
 void
@@ -347,7 +346,7 @@ snmp_pdu_encode(u_char * DestBuf, int *DestBufLen,
 {
     u_char *bufp;
 
-#ifdef DEBUG_PDU_ENCODE
+#if DEBUG_PDU_ENCODE
     snmplib_debug(8, "PDU: Encoding %d\n", PDU->command);
 #endif
 
@@ -355,7 +354,7 @@ snmp_pdu_encode(u_char * DestBuf, int *DestBufLen,
     switch (PDU->command) {
 
         /**********************************************************************/
-#ifdef TRP_REQ_MSG
+#if TRP_REQ_MSG
     case TRP_REQ_MSG:
 
         /* SNMPv1 Trap */
@@ -436,7 +435,7 @@ snmp_pdu_encode(u_char * DestBuf, int *DestBufLen,
         /* Normal PDU Encoding */
 
         /* request id */
-#ifdef DEBUG_PDU_ENCODE
+#if DEBUG_PDU_ENCODE
         snmplib_debug(8, "PDU: Request ID %d (0x%x)\n", PDU->reqid, DestBuf);
 #endif
         bufp = asn_build_int(DestBuf, DestBufLen,
@@ -446,7 +445,7 @@ snmp_pdu_encode(u_char * DestBuf, int *DestBufLen,
             return (NULL);
 
         /* error status */
-#ifdef DEBUG_PDU_ENCODE
+#if DEBUG_PDU_ENCODE
         snmplib_debug(8, "PDU: Error Status %d (0x%x)\n", PDU->errstat, bufp);
 #endif
         bufp = asn_build_int(bufp, DestBufLen,
@@ -456,7 +455,7 @@ snmp_pdu_encode(u_char * DestBuf, int *DestBufLen,
             return (NULL);
 
         /* error index */
-#ifdef DEBUG_PDU_ENCODE
+#if DEBUG_PDU_ENCODE
         snmplib_debug(8, "PDU: Error index %d (0x%x)\n", PDU->errindex, bufp);
 #endif
         bufp = asn_build_int(bufp, DestBufLen,
@@ -485,7 +484,7 @@ snmp_pdu_decode(u_char * Packet,    /* data */
     u_char *bufp;
     u_char PDUType;
     u_char ASNType;
-#ifdef UNUSED_CODE
+#if UNUSED_CODE
     int four;
     oid objid[MAX_NAME_LEN];
 #endif
@@ -494,14 +493,14 @@ snmp_pdu_decode(u_char * Packet,  /* data */
     if (bufp == NULL)
         ASN_PARSE_ERROR(NULL);
 
-#ifdef DEBUG_PDU_DECODE
+#if DEBUG_PDU_DECODE
     snmplib_debug(8, "PDU Type: %d\n", PDUType);
 #endif
 
     PDU->command = PDUType;
     switch (PDUType) {
 
-#ifdef TRP_REQ_MSG
+#if TRP_REQ_MSG
     case TRP_REQ_MSG:
 
         /* SNMPv1 Trap Message */
@@ -518,8 +517,8 @@ snmp_pdu_decode(u_char * Packet,    /* data */
             snmp_set_api_error(SNMPERR_OS_ERR);
             return (NULL);
         }
-        xmemcpy((char *) PDU->enterprise, (char *) objid,
-                PDU->enterprise_length * sizeof(oid));
+        memcpy((char *) PDU->enterprise, (char *) objid,
+               PDU->enterprise_length * sizeof(oid));
 
         /* Agent-addr */
         four = 4;
@@ -596,7 +595,7 @@ snmp_pdu_decode(u_char * Packet,    /* data */
         if (bufp == NULL)
             ASN_PARSE_ERROR(NULL);
 
-#ifdef DEBUG_PDU_DECODE
+#if DEBUG_PDU_DECODE
         snmplib_debug(8, "PDU Request ID: %d\n", PDU->reqid);
 #endif
 
@@ -607,7 +606,7 @@ snmp_pdu_decode(u_char * Packet,    /* data */
         if (bufp == NULL)
             ASN_PARSE_ERROR(NULL);
 
-#ifdef DEBUG_PDU_DECODE
+#if DEBUG_PDU_DECODE
         snmplib_debug(8, "PDU Error Status: %d\n", PDU->errstat);
 #endif
 
@@ -618,7 +617,7 @@ snmp_pdu_decode(u_char * Packet,    /* data */
         if (bufp == NULL)
             ASN_PARSE_ERROR(NULL);
 
-#ifdef DEBUG_PDU_DECODE
+#if DEBUG_PDU_DECODE
         snmplib_debug(8, "PDU Error Index: %d\n", PDU->errindex);
 #endif