diff options
author | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2008-08-05 18:52:53 +0000 |
---|---|---|
committer | parsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2008-08-05 18:52:53 +0000 |
commit | 19bf3f820e78f0b5faf978bdc4c09b46ce2e6f8b (patch) | |
tree | 10f16522edb5de271a413ed9d2c673d20c91c99b /ACE/ASNMP/asnmp | |
parent | dd04d852afa0f63b82968fa555b92f6abf1a2e16 (diff) | |
download | ATCD-19bf3f820e78f0b5faf978bdc4c09b46ce2e6f8b.tar.gz |
ChangeLogTag: Tue Aug 5 18:51:02 UTC 2008 Jeff Parsons <j.parsons@vanderbilt.edu>
Diffstat (limited to 'ACE/ASNMP/asnmp')
-rw-r--r-- | ACE/ASNMP/asnmp/address.cpp | 43 | ||||
-rw-r--r-- | ACE/ASNMP/asnmp/asn1.cpp | 15 |
2 files changed, 37 insertions, 21 deletions
diff --git a/ACE/ASNMP/asnmp/address.cpp b/ACE/ASNMP/asnmp/address.cpp index 32f43b4ad4e..edc46f00e3c 100644 --- a/ACE/ASNMP/asnmp/address.cpp +++ b/ACE/ASNMP/asnmp/address.cpp @@ -662,23 +662,34 @@ void IpAddress::mask( const IpAddress& ipaddr) //======================================================================= -Address_Iter::Address_Iter(const char *hostname): valid_(0), count_(0), - entry_(0) -{ - ACE_OS::memset(&buffer_, 0, sizeof(ACE_HOSTENT_DATA)); - ACE_OS::memset(&lookupResult_, 0, sizeof(struct hostent)); - if (ACE_OS::inet_addr(hostname) == (unsigned long) -1) - valid_ = query_dns(hostname); - else { - ACE_ASSERT(0); // don't support dot-quad lookup yet - } +Address_Iter::Address_Iter (const char *hostname) + : valid_(0), + count_(0), + entry_(0) +{ + ACE_OS::memset (&buffer_, 0, sizeof (ACE_HOSTENT_DATA)); + ACE_OS::memset (&lookupResult_, 0, sizeof (struct hostent)); + + if (ACE_OS::inet_addr (hostname) == (unsigned long) -1) + { + valid_ = query_dns (hostname); + } + else + { + ACE_ASSERT (0); // don't support dot-quad lookup yet + } + + // count number of hostnames + int n; + char **pc; + + for (n = 0, pc = lookupResult_.h_addr_list; *pc != 0; ++n, ++pc) + { + // Do nothing. + } - // count number of hostnames - int n; - char **pc; - for (n = 0, pc = lookupResult_.h_addr_list; *pc != 0; ++n, ++pc); - count_ = n; // plus first one - entry_ = lookupResult_.h_addr_list; + count_ = n; // plus first one + entry_ = lookupResult_.h_addr_list; } int Address_Iter::valid() const diff --git a/ACE/ASNMP/asnmp/asn1.cpp b/ACE/ASNMP/asnmp/asn1.cpp index da973e52bc2..88a19b67b63 100644 --- a/ACE/ASNMP/asnmp/asn1.cpp +++ b/ACE/ASNMP/asnmp/asn1.cpp @@ -1020,13 +1020,18 @@ void cmu_snmp::add_var(struct snmp_pdu *pdu, struct variable_list *vars = 0; // if we don't have a vb list ,create one - if (pdu->variables == 0) { - ACE_NEW(pdu->variables, variable_list); - vars = pdu->variables; - } + if (pdu->variables == 0) + { + ACE_NEW(pdu->variables, variable_list); + vars = pdu->variables; + } else { // we have one, find the end - for(vars = pdu->variables; vars->next_variable; vars = vars->next_variable); + for (vars = pdu->variables; vars->next_variable; vars = vars->next_variable) + { + // Do nothing. + } + // create one ACE_NEW(vars->next_variable, variable_list); // bump ptr |