summaryrefslogtreecommitdiff
path: root/ASNMP
diff options
context:
space:
mode:
authordhinton <dhinton@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-08-25 22:11:47 +0000
committerdhinton <dhinton@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2003-08-25 22:11:47 +0000
commit238966c168836a678a9613841b15deab3e2ca385 (patch)
tree0f4e8f278f2b5060331bf3277e916715d242a916 /ASNMP
parent78cc8db8224d1b21c719fef172d807285e85a5dd (diff)
downloadATCD-238966c168836a678a9613841b15deab3e2ca385.tar.gz
ChangeLogTag:Mon Aug 25 22:03:43 UTC 2003 Don Hinton <dhinton@dresystems.com>
Diffstat (limited to 'ASNMP')
-rw-r--r--ASNMP/asnmp/address.cpp20
-rw-r--r--ASNMP/asnmp/address.h22
-rw-r--r--ASNMP/asnmp/ctr64.cpp2
-rw-r--r--ASNMP/asnmp/ctr64.h2
-rw-r--r--ASNMP/asnmp/integer.cpp4
-rw-r--r--ASNMP/asnmp/integer.h4
-rw-r--r--ASNMP/asnmp/target.cpp2
-rw-r--r--ASNMP/asnmp/target.h2
-rw-r--r--ASNMP/asnmp/timetick.cpp2
-rw-r--r--ASNMP/asnmp/timetick.h2
-rw-r--r--ASNMP/tests/Address_Test.cpp3
-rw-r--r--ASNMP/tests/Target_Test.cpp1
-rw-r--r--ASNMP/tests/test_config.h9
-rw-r--r--ASNMP/tests/tests.mpc91
14 files changed, 125 insertions, 41 deletions
diff --git a/ASNMP/asnmp/address.cpp b/ASNMP/asnmp/address.cpp
index 9517ef4deaf..7458ca8f93b 100644
--- a/ASNMP/asnmp/address.cpp
+++ b/ASNMP/asnmp/address.cpp
@@ -411,7 +411,7 @@ SnmpSyntax *IpAddress::clone() const
}
//-------[ return the Fully Qualified Domain Name ]----------------------
-char *IpAddress::resolve_hostname(int &status)
+const char *IpAddress::resolve_hostname(int &status)
{
if ((iv_friendly_name_[0] == 0) && valid_flag)
addr_to_friendly();
@@ -609,7 +609,7 @@ IpAddress::operator const char *() const
}
//----[ IP address get char representation ]--------------------------
-char * IpAddress::to_string()
+const char * IpAddress::to_string()
{
return (char *)output_buffer;
}
@@ -934,7 +934,7 @@ UdpAddress::operator const char *() const
}
//----[ UDP address get char representation ]--------------------------
-char * UdpAddress::to_string()
+const char * UdpAddress::to_string()
{
return (char *)output_buffer;
}
@@ -1062,7 +1062,7 @@ NetbiosAddress::~NetbiosAddress()
{
}
-char *NetbiosAddress::to_string()
+const char *NetbiosAddress::to_string()
{
return (char *)output_buffer;
}
@@ -1429,7 +1429,7 @@ IpxAddress::operator const char *() const
}
//----[ IPX address get char representation ]--------------------------
-char * IpxAddress::to_string()
+const char * IpxAddress::to_string()
{
return (char *)output_buffer;
}
@@ -1650,7 +1650,7 @@ IpxSockAddress::operator const char *() const
}
//----[ IPXSock address get char representation ]--------------------------
-char * IpxSockAddress::to_string()
+const char * IpxSockAddress::to_string()
{
return (char *)output_buffer;
}
@@ -1939,7 +1939,7 @@ MacAddress::operator const char *() const
return (char *)output_buffer;
}
//----[ MAC address get char representation ]--------------------------
-char * MacAddress::to_string()
+const char * MacAddress::to_string()
{
return (char *)output_buffer;
}
@@ -2367,7 +2367,7 @@ GenAddress::operator const char *() const
}
// to_string form of the contained address
-char * GenAddress::to_string()
+const char * GenAddress::to_string()
{
if ( address != 0)
return address->to_string(); // pass thru
@@ -2453,7 +2453,7 @@ DecNetAddress::~DecNetAddress()
{
}
-char *DecNetAddress::to_string()
+const char *DecNetAddress::to_string()
{
return (char *)output_buffer;
}
@@ -2589,7 +2589,7 @@ AppleTalkAddress::~AppleTalkAddress()
{
}
-char *AppleTalkAddress::to_string()
+const char *AppleTalkAddress::to_string()
{
return (char *)output_buffer;
}
diff --git a/ASNMP/asnmp/address.h b/ASNMP/asnmp/address.h
index 898e6968f56..f4837ef67db 100644
--- a/ASNMP/asnmp/address.h
+++ b/ASNMP/asnmp/address.h
@@ -160,7 +160,7 @@ public:
unsigned char& operator[]( const int position);
// for non const [], allows reading and writing
- virtual char *to_string() = 0;
+ virtual const char *to_string() = 0;
// get a printable ASCII value
virtual SnmpSyntax *clone() const = 0;
@@ -228,11 +228,11 @@ public:
SnmpSyntax *clone() const;
// create a new instance of this Value
- char *resolve_hostname(int& was_found);
+ const char *resolve_hostname(int& was_found);
// return the DNS Fully Qualified Domain Name (host.domain)
// on failure returns dotted_quad string
- virtual char *to_string() ;
+ virtual const char *to_string() ;
// return string representation of object (dotted quad returned)
virtual operator const char *() const;
@@ -367,7 +367,7 @@ public:
SnmpSyntax *clone() const;
// create a new instance of this Value
- virtual char *to_string() ;
+ virtual const char *to_string() ;
// output in the form of address:port
virtual operator const char *() const;
@@ -430,7 +430,7 @@ public:
SnmpSyntax *clone() const;
// create a new instance of this Value
- virtual char *to_string();
+ virtual const char *to_string();
// create a string to internal class storage representing object
virtual operator const char *() const;
@@ -480,7 +480,7 @@ public:
~NetbiosAddress();
- virtual char *to_string();
+ virtual const char *to_string();
NetbiosAddress& operator=( const NetbiosAddress &nbaddr);
@@ -535,7 +535,7 @@ class ACE_Export DecNetAddress : public Address
~DecNetAddress();
- virtual char *to_string();
+ virtual const char *to_string();
DecNetAddress& operator=( const DecNetAddress &decaddr);
@@ -581,7 +581,7 @@ class ACE_Export AppleTalkAddress : public Address
~AppleTalkAddress();
- virtual char *to_string();
+ virtual const char *to_string();
AppleTalkAddress& operator=( const AppleTalkAddress &atkaddr);
@@ -655,7 +655,7 @@ public:
SnmpSyntax *clone() const;
// create a new instance of this Value
- virtual char *to_string();
+ virtual const char *to_string();
// create string represtation of object value
virtual operator const char *() const;
@@ -727,7 +727,7 @@ public:
unsigned short get_socket() const;
// get the socket number
- virtual char *to_string();
+ virtual const char *to_string();
// create string representation of object value
virtual operator const char *() const;
@@ -781,7 +781,7 @@ public:
SnmpSyntax& operator=( SnmpSyntax &val);
// copy an instance of this Value
- virtual char *to_string();
+ virtual const char *to_string();
// string representation of object value
virtual operator const char *() const;
diff --git a/ASNMP/asnmp/ctr64.cpp b/ASNMP/asnmp/ctr64.cpp
index bd227753d2e..45d12cca277 100644
--- a/ASNMP/asnmp/ctr64.cpp
+++ b/ASNMP/asnmp/ctr64.cpp
@@ -201,7 +201,7 @@ int Counter64::valid() const
//----------[ return ASCII format ]-------------------------
// TODO: Fix up to do real 64bit decimal value printing...
// For now, print > 32-bit values in hex
-char * Counter64::to_string()
+const char * Counter64::to_string()
{
if ( high() != 0 )
sprintf(output_buffer, "0x%X%08X",
diff --git a/ASNMP/asnmp/ctr64.h b/ASNMP/asnmp/ctr64.h
index f9dc641a94a..50d4dab74bf 100644
--- a/ASNMP/asnmp/ctr64.h
+++ b/ASNMP/asnmp/ctr64.h
@@ -88,7 +88,7 @@ public:
Counter64& operator=( const Counter64 &rhs);
// overloaded assignment
- char *to_string();
+ const char *to_string();
// get a printable ASCII representation
SnmpSyntax *clone() const;
diff --git a/ASNMP/asnmp/integer.cpp b/ASNMP/asnmp/integer.cpp
index aa7f24b7f1f..ca399336053 100644
--- a/ASNMP/asnmp/integer.cpp
+++ b/ASNMP/asnmp/integer.cpp
@@ -122,7 +122,7 @@ SnmpSyntax* SnmpUInt32::clone() const
}
// ASCII format return
-char * SnmpUInt32::to_string()
+const char * SnmpUInt32::to_string()
{
sprintf(output_buffer, "%d", (int) (this->smival.value.uNumber));
return output_buffer;
@@ -222,7 +222,7 @@ SnmpSyntax* SnmpInt32::clone() const
// ASCII format return
-char *SnmpInt32::to_string()
+const char *SnmpInt32::to_string()
{
sprintf(output_buffer, "%d", (int) (long) this->smival.value.sNumber);
return output_buffer;
diff --git a/ASNMP/asnmp/integer.h b/ASNMP/asnmp/integer.h
index d0dc2972742..6c82571ec44 100644
--- a/ASNMP/asnmp/integer.h
+++ b/ASNMP/asnmp/integer.h
@@ -73,7 +73,7 @@ class ACE_Export SnmpUInt32: public SnmpSyntax
operator unsigned long();
// otherwise, behave like an unsigned long int
- virtual char *to_string();
+ virtual const char *to_string();
// get a printable ASCII value
virtual SnmpSyntax *clone() const;
@@ -125,7 +125,7 @@ class ACE_Export SnmpInt32: public SnmpSyntax
SnmpSyntax& operator=( SnmpSyntax &val);
// copy an instance of this Value
- char *to_string();
+ const char *to_string();
// get a printable ASCII value
int valid() const;
diff --git a/ASNMP/asnmp/target.cpp b/ASNMP/asnmp/target.cpp
index c9e27865f31..ac395792b4b 100644
--- a/ASNMP/asnmp/target.cpp
+++ b/ASNMP/asnmp/target.cpp
@@ -290,7 +290,7 @@ UdpTarget& UdpTarget::operator=( const UdpTarget& lhs)
return *this;
}
-char *UdpTarget::to_string()
+const char *UdpTarget::to_string()
{
sprintf(output_buffer_,"UdpTarget: [ valid: %d addr: %s rd: %s wr: %s \
ver: %d, timeout: %d, retries: %d max_pdu_size: %d]",
diff --git a/ASNMP/asnmp/target.h b/ASNMP/asnmp/target.h
index 7dfc14ab5d8..1fc7bc2157e 100644
--- a/ASNMP/asnmp/target.h
+++ b/ASNMP/asnmp/target.h
@@ -230,7 +230,7 @@ class ACE_Export UdpTarget: public SnmpTarget
friend int operator==( const UdpTarget &lhs, const UdpTarget &rhs);
// compare two C targets
- char *to_string();
+ const char *to_string();
// string representation of object
SnmpTarget *clone() const;
diff --git a/ASNMP/asnmp/timetick.cpp b/ASNMP/asnmp/timetick.cpp
index 5b4128540d0..aeb8427c43e 100644
--- a/ASNMP/asnmp/timetick.cpp
+++ b/ASNMP/asnmp/timetick.cpp
@@ -109,7 +109,7 @@ TimeTicks::operator unsigned long()
// ASCII format return
-char * TimeTicks::to_string()
+const char * TimeTicks::to_string()
/* Should do something nicer like days:hours:minutes... */
{
unsigned long tt, hseconds, seconds, minutes, hours, days;
diff --git a/ASNMP/asnmp/timetick.h b/ASNMP/asnmp/timetick.h
index 8e4609c124b..6012f99a570 100644
--- a/ASNMP/asnmp/timetick.h
+++ b/ASNMP/asnmp/timetick.h
@@ -60,7 +60,7 @@ class ACE_Export TimeTicks: public SnmpUInt32
SmiUINT32 get_syntax();
// syntax type
- char *to_string();
+ const char *to_string();
// get a printable ASCII value
SnmpSyntax *clone() const;
diff --git a/ASNMP/tests/Address_Test.cpp b/ASNMP/tests/Address_Test.cpp
index cadca2722dc..e398892dbfb 100644
--- a/ASNMP/tests/Address_Test.cpp
+++ b/ASNMP/tests/Address_Test.cpp
@@ -262,8 +262,7 @@ static void TestNetbiosAddress()
ACE_ASSERT(strcmp((const char *)n1, (const char *)n4) == 0);
n1.set_service_type(nb_server);
- nb_service x = n1.get_service_type();
- ACE_ASSERT(x == nb_server);
+ ACE_ASSERT(x == n1.get_service_type());
}
// --------------- IPX ---------------
diff --git a/ASNMP/tests/Target_Test.cpp b/ASNMP/tests/Target_Test.cpp
index dbbc848e401..30f002b03ad 100644
--- a/ASNMP/tests/Target_Test.cpp
+++ b/ASNMP/tests/Target_Test.cpp
@@ -91,7 +91,6 @@ static void TestSnmpTarget()
OctetStr rd("rd_comm"), wr("wr_comm");
ACE_ASSERT(rd.valid() == 1);
ACE_ASSERT(wr.valid() == 1);
- char *crd = "rd_comm", *cwr = "wr_comm";
// constructor and get tests
UdpAddress ga;
diff --git a/ASNMP/tests/test_config.h b/ASNMP/tests/test_config.h
index 1eba5209a6e..42c4230453d 100644
--- a/ASNMP/tests/test_config.h
+++ b/ASNMP/tests/test_config.h
@@ -17,8 +17,7 @@
#include "ace/ACE.h"
#include "ace/Log_Msg.h"
-#include <iostream.h>
-#include <fstream.h>
+#include "ace/streams.h"
#if !defined (ACE_HAS_TEMPLATE_SPECIALIZATION)
class KEY
@@ -145,11 +144,7 @@ ACE_Test_Output::set_output (const char *filename, int append)
ACE::basename (filename, ACE_DIRECTORY_SEPARATOR_CHAR),
".log");
- int flags = ios::out;
- if (append)
- flags |= ios::app;
-
- this->output_file_.open (temp, flags);
+ this->output_file_.open (temp, ios::out | (append ? ios::app : ios::trunc));
if (this->output_file_.bad ())
return -1;
diff --git a/ASNMP/tests/tests.mpc b/ASNMP/tests/tests.mpc
new file mode 100644
index 00000000000..ab2acb9c657
--- /dev/null
+++ b/ASNMP/tests/tests.mpc
@@ -0,0 +1,91 @@
+// $Id$
+
+project (asnmp_tests_Oid_Test) : aceexe {
+ exename = Oid_Test
+ after += asnmp_lib
+ libs += asnmp
+ includes += $(ACE_ROOT)/ASNMP
+ source_files {
+ Oid_Test
+ }
+}
+
+project (asnmp_tests_Counter_Test) : aceexe {
+ exename = Counter_Test
+ after += asnmp_lib
+ libs += asnmp
+ includes += $(ACE_ROOT)/ASNMP
+ source_files {
+ Counter_Test
+ }
+}
+
+project (asnmp_tests_Counter64_Test) : aceexe {
+ exename = Counter64_Test
+ after += asnmp_lib
+ libs += asnmp
+ includes += $(ACE_ROOT)/ASNMP
+ source_files {
+ Counter64_Test
+ }
+}
+
+project (asnmp_tests_Integer_Test) : aceexe {
+ exename = Integer_Test
+ after += asnmp_lib
+ libs += asnmp
+ includes += $(ACE_ROOT)/ASNMP
+ source_files {
+ Integer_Test
+ }
+}
+
+project (asnmp_tests_Octet_Test) : aceexe {
+ exename = Octet_Test
+ after += asnmp_lib
+ libs += asnmp
+ includes += $(ACE_ROOT)/ASNMP
+ source_files {
+ Octet_Test
+ }
+}
+
+project (asnmp_tests_Gauge_Test) : aceexe {
+ exename = Gauge_Test
+ after += asnmp_lib
+ libs += asnmp
+ includes += $(ACE_ROOT)/ASNMP
+ source_files {
+ Gauge_Test
+ }
+}
+
+project (asnmp_tests_Address_Test) : aceexe {
+ exename = Address_Test
+ after += asnmp_lib
+ libs += asnmp
+ includes += $(ACE_ROOT)/ASNMP
+ source_files {
+ Address_Test
+ }
+}
+
+project (asnmp_tests_Target_Test) : aceexe {
+ exename = Target_Test
+ after += asnmp_lib
+ libs += asnmp
+ includes += $(ACE_ROOT)/ASNMP
+ source_files {
+ Target_Test
+ }
+}
+
+project (asnmp_tests_Varbind_Test) : aceexe {
+ exename = Varbind_Test
+ after += asnmp_lib
+ libs += asnmp
+ includes += $(ACE_ROOT)/ASNMP
+ source_files {
+ Varbind_Test
+ }
+}