--------------------- PatchSet 6031 Date: 2007/10/29 09:41:42 Author: amosjeffries Branch: squid3-ipv6 Tag: (none) Log: SNMP Agent Fixes - formatting - wrap IPv6 code away from IPv4 builds - its also a SquidTime user. Members: src/snmp_agent.cc:1.7.4.12->1.7.4.13 Index: squid3/src/snmp_agent.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/snmp_agent.cc,v retrieving revision 1.7.4.12 retrieving revision 1.7.4.13 diff -u -r1.7.4.12 -r1.7.4.13 --- squid3/src/snmp_agent.cc 28 Oct 2007 15:38:44 -0000 1.7.4.12 +++ squid3/src/snmp_agent.cc 29 Oct 2007 09:41:42 -0000 1.7.4.13 @@ -1,6 +1,5 @@ - /* - * $Id: snmp_agent.cc,v 1.7.4.12 2007/10/28 15:38:44 rmartinez Exp $ + * $Id: snmp_agent.cc,v 1.7.4.13 2007/10/29 09:41:42 amosjeffries Exp $ * * DEBUG: section 49 SNMP Interface * AUTHOR: Kostas Anagnostakis @@ -33,11 +32,11 @@ * */ - #include "squid.h" #include "cache_snmp.h" #include "Store.h" #include "mem_node.h" +#include "SquidTime.h" /************************************************************************ @@ -228,32 +227,34 @@ break; case MESH_PTBL_ADDR_TYPE: - { - int ival; - ival = laddr.IsIPv4() ? INETADDRESSTYPE_IPV4 : INETADDRESSTYPE_IPV6 ; - Answer = snmp_var_new_integer(Var->name, Var->name_length, - ival, SMI_INTEGER); - } - break; + { + int ival; + ival = laddr.IsIPv4() ? INETADDRESSTYPE_IPV4 : INETADDRESSTYPE_IPV6 ; + Answer = snmp_var_new_integer(Var->name, Var->name_length, + ival, SMI_INTEGER); + } + break; case MESH_PTBL_ADDR: - { - Answer = snmp_var_new(Var->name, Var->name_length); - // InetAddress doesn't have its own ASN.1 type, - // like IpAddr does (SMI_IPADDRESS) - // See: rfc4001.txt - Answer->type = ASN_OCTET_STR; - if (laddr.IsIPv4()) { - Answer->val_len = sizeof(struct in_addr); - struct in_addr *iaddr4 = (struct in_addr *)Answer->val.string; - laddr.GetInAddr(*iaddr4); - } else /* It's an IPv6 value */ - { - Answer->val_len = sizeof(struct in6_addr); - struct in6_addr *iaddr6 = (struct in6_addr *)Answer->val.string; - laddr.GetInAddr(*iaddr6); + { + Answer = snmp_var_new(Var->name, Var->name_length); + // InetAddress doesn't have its own ASN.1 type, + // like IpAddr does (SMI_IPADDRESS) + // See: rfc4001.txt + Answer->type = ASN_OCTET_STR; + if (laddr.IsIPv4()) { + Answer->val_len = sizeof(struct in_addr); + struct in_addr *iaddr4 = (struct in_addr *)Answer->val.string; + laddr.GetInAddr(*iaddr4); + } +#if USE_IPV6 + else { /* It's an IPv6 value */ + Answer->val_len = sizeof(struct in6_addr); + struct in6_addr *iaddr6 = (struct in6_addr *)Answer->val.string; + laddr.GetInAddr(*iaddr6); + } +#endif /* USE_IPV6 */ } - } - break; + break; case MESH_PTBL_HTTP: Answer = snmp_var_new_integer(Var->name, Var->name_length,