summaryrefslogtreecommitdiff
path: root/ACE/ASNMP/examples
diff options
context:
space:
mode:
authorWilliam R. Otte <wotte@dre.vanderbilt.edu>2008-03-04 13:56:48 +0000
committerWilliam R. Otte <wotte@dre.vanderbilt.edu>2008-03-04 13:56:48 +0000
commitc4078c377d74290ebe4e66da0b4975da91732376 (patch)
tree1816ef391e42a07929304908ac0e21f4c2f6cb7b /ACE/ASNMP/examples
parent700d1c1a6be348c6c70a2085e559baeb8f4a62ea (diff)
downloadATCD-c4078c377d74290ebe4e66da0b4975da91732376.tar.gz
swap in externals for ACE and TAO
Diffstat (limited to 'ACE/ASNMP/examples')
-rw-r--r--ACE/ASNMP/examples/Makefile.am17
-rw-r--r--ACE/ASNMP/examples/get/Makefile.am62
-rw-r--r--ACE/ASNMP/examples/get/get.cpp206
-rw-r--r--ACE/ASNMP/examples/get/get.mpc23
-rw-r--r--ACE/ASNMP/examples/get/get_async.cpp215
-rw-r--r--ACE/ASNMP/examples/next/Makefile.am41
-rw-r--r--ACE/ASNMP/examples/next/next.cpp204
-rw-r--r--ACE/ASNMP/examples/next/next.mpc13
-rw-r--r--ACE/ASNMP/examples/set/Makefile.am41
-rw-r--r--ACE/ASNMP/examples/set/set.cpp275
-rw-r--r--ACE/ASNMP/examples/set/set.mpc13
-rw-r--r--ACE/ASNMP/examples/trap/Makefile.am41
-rw-r--r--ACE/ASNMP/examples/trap/trap.cpp192
-rw-r--r--ACE/ASNMP/examples/trap/trap.mpc12
-rw-r--r--ACE/ASNMP/examples/walk/Makefile.am41
-rw-r--r--ACE/ASNMP/examples/walk/walk.cpp270
-rw-r--r--ACE/ASNMP/examples/walk/walk.mpc12
17 files changed, 0 insertions, 1678 deletions
diff --git a/ACE/ASNMP/examples/Makefile.am b/ACE/ASNMP/examples/Makefile.am
deleted file mode 100644
index ba48f01c667..00000000000
--- a/ACE/ASNMP/examples/Makefile.am
+++ /dev/null
@@ -1,17 +0,0 @@
-## Process this file with automake to create Makefile.in
-##
-## $Id$
-##
-## This file was generated by MPC. Any changes made directly to
-## this file will be lost the next time it is generated.
-##
-## MPC Command:
-## ./bin/mwc.pl -type automake -noreldefs ACE.mwc
-
-SUBDIRS = \
- get \
- next \
- set \
- trap \
- walk
-
diff --git a/ACE/ASNMP/examples/get/Makefile.am b/ACE/ASNMP/examples/get/Makefile.am
deleted file mode 100644
index 0c3a6e4ea95..00000000000
--- a/ACE/ASNMP/examples/get/Makefile.am
+++ /dev/null
@@ -1,62 +0,0 @@
-## Process this file with automake to create Makefile.in
-##
-## $Id$
-##
-## This file was generated by MPC. Any changes made directly to
-## this file will be lost the next time it is generated.
-##
-## MPC Command:
-## ./bin/mwc.pl -type automake -noreldefs ACE.mwc
-
-ACE_BUILDDIR = $(top_builddir)
-ACE_ROOT = $(top_srcdir)
-
-noinst_PROGRAMS =
-
-## Makefile.asnmp_example_get.am
-
-if !BUILD_USES_WCHAR
-
-noinst_PROGRAMS += get
-
-get_CPPFLAGS = \
- -I$(ACE_ROOT) \
- -I$(ACE_BUILDDIR) \
- -I$(ACE_ROOT)/ASNMP
-
-get_SOURCES = \
- get.cpp
-
-get_LDADD = \
- $(top_builddir)/ASNMP/asnmp/libasnmp.la \
- $(ACE_BUILDDIR)/ace/libACE.la
-
-endif !BUILD_USES_WCHAR
-
-## Makefile.asnmp_example_get_async.am
-
-if !BUILD_USES_WCHAR
-
-noinst_PROGRAMS += get_async
-
-get_async_CPPFLAGS = \
- -I$(ACE_ROOT) \
- -I$(ACE_BUILDDIR) \
- -I$(ACE_ROOT)/ASNMP
-
-get_async_SOURCES = \
- get_async.cpp
-
-get_async_LDADD = \
- $(top_builddir)/ASNMP/asnmp/libasnmp.la \
- $(ACE_BUILDDIR)/ace/libACE.la
-
-endif !BUILD_USES_WCHAR
-
-## Clean up template repositories, etc.
-clean-local:
- -rm -f *~ *.bak *.rpo *.sym lib*.*_pure_* core core.*
- -rm -f gcctemp.c gcctemp so_locations *.ics
- -rm -rf cxx_repository ptrepository ti_files
- -rm -rf templateregistry ir.out
- -rm -rf ptrepository SunWS_cache Templates.DB
diff --git a/ACE/ASNMP/examples/get/get.cpp b/ACE/ASNMP/examples/get/get.cpp
deleted file mode 100644
index 1829c381442..00000000000
--- a/ACE/ASNMP/examples/get/get.cpp
+++ /dev/null
@@ -1,206 +0,0 @@
-// $Id$
-
-// ============================================================================
-//
-// = LIBRARY
-// asnmp
-//
-// = FILENAME
-// get.cpp
-//
-// = DESCRIPTION
-// Sample application demonstrating synchronous Snmp::get API
-// to access an SNMP Version 1 agent.
-//
-// = AUTHOR
-// Peter E. Mellquist original code
-// Michael R MacFaden mrm@cisco.com rework API/ACE integration
-//
-// ============================================================================
-
-/*===================================================================
- Copyright (c) 1996
- Hewlett-Packard Company
-
- ATTENTION: USE OF THIS SOFTWARE IS SUBJECT TO THE FOLLOWING TERMS.
- Permission to use, copy, modify, distribute and/or sell this software
- and/or its documentation is hereby granted without fee. User agrees
- to display the above copyright notice and this license notice in all
- copies of the software and any documentation of the software. User
- agrees to assume all liability for the use of the software; Hewlett-Packard
- makes no representations about the suitability of this software for any
- purpose. It is provided "AS-IS without warranty of any kind,either express
- or implied. User hereby grants a royalty-free license to any and all
- derivatives based upon this software code base.
-=====================================================================*/
-
-#include "asnmp/snmp.h"
-#include "ace/Argv_Type_Converter.h"
-#include "ace/Get_Opt.h"
-
-// FUZZ: disable check_for_streams_include
-#include "ace/streams.h"
-
-ACE_RCSID(get, get, "$Id$")
-
-//
-// SNMPv1 Get Application
-//
-class getapp {
- public:
- getapp(int argc, char **argv); // process command line args
- int valid() const; // verify transaction can proceed
- int run(); // issue transaction
- static void usage(); // operator help message
-
- private:
- getapp(const getapp&);
-
- UdpAddress address_;
- Pdu pdu_; // construct a request Pdu
- Oid oid_;
- OctetStr community_;
- Snmp snmp_;
- UdpTarget target_;
- int valid_;
-};
-
-
-// main entry point
-int main( int argc, char *argv[])
-{
- getapp get(argc, argv);
- if (get.valid())
- return get.run();
- else
- getapp::usage();
- return 1;
-}
-
-int getapp::valid() const
-{
- return valid_;
-}
-getapp::getapp(int argc, char *argv[]): valid_(0)
-{
- Oid req, def_oid("1.3.6.1.2.1.1.1.0"); // default is sysDescr
- if ( argc < 2)
- return;
-
- address_ = argv[argc - 1];
- if ( !address_.valid()) {
- cout << "ERROR: Invalid IPv4 address or DNS hostname: " \
- << argv[argc] << "\n";
- return;
- }
-
- ACE_Argv_Type_Converter to_tchar (argc, argv);
- ACE_Get_Opt get_opt (argc,
- to_tchar.get_TCHAR_argv (),
- ACE_TEXT ("o:c:r:t:p:"));
- for (int c; (c = get_opt ()) != -1; )
- switch (c)
- {
- case 'o':
- req = ACE_TEXT_ALWAYS_CHAR (get_opt.opt_arg());
- if (req.valid() == 0)
- cout << "ERROR: oid value: "
- << ACE_TEXT_ALWAYS_CHAR (get_opt.opt_arg())
- << "is not valid. using default.\n";
- break;
-
- case 'c':
- community_ = ACE_TEXT_ALWAYS_CHAR (get_opt.opt_arg());
- target_.set_read_community(community_);
- break;
-
- case 'r':
- target_.set_retry(ACE_OS::atoi (get_opt.opt_arg()));
- break;
-
- case 't':
- target_.set_timeout(ACE_OS::atoi (get_opt.opt_arg()));
- break;
-
- default:
- break;
- }
-
- Vb vb; // construct a Vb object
- if (req.valid())
- vb.set_oid( req); // set the Oid portion of the Vb
- else {
- vb.set_oid( def_oid); // set the Oid portion of the Vb
- }
- pdu_ += vb;
- vb.get_oid(oid_); // store for later use
- valid_ = 1;
-}
-
-void getapp::usage()
-{
- cout << "Usage:\n";
- cout << "get [options] dotted-quad | DNSName[:port]\n";
- cout << " -o OID defaults to 1.3.6.1.2.1.1.1.0 (mibII sysDescr.0) \n";
- cout << " -c Community_name, default is 'public' \n";
- cout << " -r N retries default is N = 1 retry\n";
- cout << " -t N timeout in seconds default is 1 second" << endl;
-}
-
-
-int getapp::run()
-{
-
- //----------[ create a ASNMP session ]-----------------------------------
- if ( snmp_.valid() != SNMP_CLASS_SUCCESS) {
- cout << "\nASNMP:ERROR:Create session failed: "<<
- snmp_.error_string()<< "\n";
- return 1;
- }
-
- //--------[ build up ASNMP object needed ]-------------------------------
- if (address_.get_port() == 0)
- address_.set_port(DEF_AGENT_PORT);
- target_.set_address( address_); // make a target using the address
-
- //-------[ issue the request, blocked mode ]-----------------------------
- cout << "\nASNMP:INFO:SNMP Version " << (target_.get_version()+ 1) << \
- " GET SAMPLE PROGRAM \nOID: " << oid_.to_string() << "\n";
- target_.get_address(address_); // target updates port used
- int rc;
- const char *name = address_.resolve_hostname(rc);
-
- cout << "Device: " << address_ << " ";
-
- //FUZZ: disable check_for_lack_ACE_OS
- cout << (rc ? "<< did not resolve via gethostbyname() >>" : name) << "\n";
- //FUZZ: enable check_for_lack_ACE_OS
-
- cout << "[ Retries=" << target_.get_retry() << " \
- Timeout=" << target_.get_timeout() <<" ms " << "Community=" << \
- community_.to_string() << " ]"<< endl;
-
- if (snmp_.get( pdu_, target_) == SNMP_CLASS_SUCCESS) {
- Vb vb;
- // check to see if there are any errors
- if (pdu_.get_error_status()) {
- cout << "ERROR: agent replied as follows\n";
- cout << pdu_.agent_error_reason() << endl;
- }
- else {
- VbIter iter(pdu_);
- while (iter.next(vb)) {
- cout << "\tOid = " << vb.to_string_oid() << "\n";
- cout << "\tValue = " << vb.to_string_value() << "\n";
- }
- }
- }
- else {
- const char *ptr = snmp_.error_string();
- cout << "ASNMP:ERROR: get command failed reason: " << ptr << endl;
- }
-
- cout << "\nASNMP:INFO: command completed normally.\n"<< endl;
- return 0;
-}
-
diff --git a/ACE/ASNMP/examples/get/get.mpc b/ACE/ASNMP/examples/get/get.mpc
deleted file mode 100644
index ffa5a2a5f53..00000000000
--- a/ACE/ASNMP/examples/get/get.mpc
+++ /dev/null
@@ -1,23 +0,0 @@
-// $Id$
-
-project (asnmp_example_get) : aceexe {
- exename = get
- after += asnmp_lib
- libs += asnmp
- avoids += uses_wchar
- includes += $(ACE_ROOT)/ASNMP
- source_files {
- get.cpp
- }
-}
-
-project (asnmp_example_get_async) : aceexe {
- exename = get_async
- after += asnmp_lib
- libs += asnmp
- avoids += uses_wchar
- includes += $(ACE_ROOT)/ASNMP
- source_files {
- get_async.cpp
- }
-}
diff --git a/ACE/ASNMP/examples/get/get_async.cpp b/ACE/ASNMP/examples/get/get_async.cpp
deleted file mode 100644
index 163d559f58e..00000000000
--- a/ACE/ASNMP/examples/get/get_async.cpp
+++ /dev/null
@@ -1,215 +0,0 @@
-// ============================================================================
-// $Id$
-// = LIBRARY
-// asnmp
-//
-// = FILENAME
-// get.cpp
-//
-// = DESCRIPTION
-// Sample application demonstrating synchronous Snmp::get API
-// to access an SNMP Version 1 agent.
-//
-// = AUTHOR
-// Peter E. Mellquist original code
-// Michael R MacFaden mrm@cisco.com rework API/ACE integration
-//
-// ============================================================================
-
-/*===================================================================
- Copyright (c) 1996
- Hewlett-Packard Company
-
- ATTENTION: USE OF THIS SOFTWARE IS SUBJECT TO THE FOLLOWING TERMS.
- Permission to use, copy, modify, distribute and/or sell this software
- and/or its documentation is hereby granted without fee. User agrees
- to display the above copyright notice and this license notice in all
- copies of the software and any documentation of the software. User
- agrees to assume all liability for the use of the software; Hewlett-Packard
- makes no representations about the suitability of this software for any
- purpose. It is provided "AS-IS without warranty of any kind,either express
- or implied. User hereby grants a royalty-free license to any and all
- derivatives based upon this software code base.
-=====================================================================*/
-
-#include "asnmp/snmp.h"
-#include "ace/Argv_Type_Converter.h"
-#include "ace/Get_Opt.h"
-
-// FUZZ: disable check_for_streams_include
-#include "ace/streams.h"
-
-ACE_RCSID(get, get_async, "$Id$")
-
-//
-// SNMPv1 Get Application
-//
-class getapp : public Snmp_Result {
- public:
- getapp(int argc, char **argv); // process command line args
- int valid() const; // verify transaction can proceed
- int run(); // issue transaction
- static void usage(); // operator help message
-
- virtual void result(Snmp * r, int rc);
-
- private:
- getapp(const getapp&);
-
- UdpAddress address_;
- Pdu pdu_; // construct a request Pdu
- Oid oid_;
- OctetStr community_;
- Snmp snmp_;
- UdpTarget target_;
- int valid_;
-};
-
-
-// main entry point
-int main( int argc, char *argv[])
-{
- getapp get(argc, argv);
- if (get.valid())
- return get.run();
- else
- getapp::usage();
- return 1;
-}
-
-int getapp::valid() const
-{
- return valid_;
-}
-getapp::getapp(int argc, char *argv[]): valid_(0)
-{
- Oid req, def_oid("1.3.6.1.2.1.1.1.0"); // default is sysDescr
- if ( argc < 2)
- return;
-
- address_ = argv[argc - 1];
- if ( !address_.valid()) {
- cout << "ERROR: Invalid IPv4 address or DNS hostname: " \
- << argv[argc] << "\n";
- return;
- }
-
- ACE_Argv_Type_Converter to_tchar (argc, argv);
- ACE_Get_Opt get_opt (argc,
- to_tchar.get_TCHAR_argv (),
- ACE_TEXT ("o:c:r:t:p:"));
- for (int c; (c = get_opt ()) != -1; )
- switch (c)
- {
- case 'o':
- req = ACE_TEXT_ALWAYS_CHAR (get_opt.opt_arg());
- if (req.valid() == 0)
- cout << "ERROR: oid value: "
- << ACE_TEXT_ALWAYS_CHAR (get_opt.opt_arg())
- << "is not valid. using default.\n";
- break;
-
- case 'c':
- community_ = ACE_TEXT_ALWAYS_CHAR (get_opt.opt_arg());
- target_.set_read_community(community_);
- break;
-
- case 'r':
- target_.set_retry(ACE_OS::atoi (get_opt.opt_arg()));
- break;
-
- case 't':
- target_.set_timeout(ACE_OS::atoi (get_opt.opt_arg()));
- break;
-
- default:
- break;
- }
-
- Vb vb; // construct a Vb object
- if (req.valid())
- vb.set_oid( req); // set the Oid portion of the Vb
- else {
- vb.set_oid( def_oid); // set the Oid portion of the Vb
- }
- pdu_ += vb;
- vb.get_oid(oid_); // store for later use
- valid_ = 1;
-}
-
-void getapp::usage()
-{
- cout << "Usage:\n";
- cout << "get [options] dotted-quad | DNSName[:port]\n";
- cout << " -o OID defaults to 1.3.6.1.2.1.1.1.0 (mibII sysDescr.0) \n";
- cout << " -c Community_name, default is 'public' \n";
- cout << " -r N retries default is N = 1 retry\n";
- cout << " -t N timeout in seconds default is 1 second" << endl;
-}
-
-
-int getapp::run()
-{
-
- //----------[ create a ASNMP session ]-----------------------------------
- if ( snmp_.valid() != SNMP_CLASS_SUCCESS) {
- cout << "\nASNMP:ERROR:Create session failed: "<<
- snmp_.error_string()<< "\n";
- return 1;
- }
-
- //--------[ build up ASNMP object needed ]-------------------------------
- if (address_.get_port() == 0)
- address_.set_port(DEF_AGENT_PORT);
- target_.set_address( address_); // make a target using the address
-
- //-------[ issue the request, blocked mode ]-----------------------------
- cout << "\nASNMP:INFO:SNMP Version " << (target_.get_version()+ 1) << \
- " GET SAMPLE PROGRAM \nOID: " << oid_.to_string() << "\n";
- target_.get_address(address_); // target updates port used
- int rc;
- const char *name = address_.resolve_hostname(rc);
-
- cout << "Device: " << address_ << " ";
-
- //FUZZ: disable check_for_lack_ACE_OS
- cout << (rc ? "<< did not resolve via gethostbyname() >>" : name) << "\n";
- //FUZZ: enable check_for_lack_ACE_OS
-
- cout << "[ Retries=" << target_.get_retry() << " \
- Timeout=" << target_.get_timeout() <<" ms " << "Community=" << \
- community_.to_string() << " ]"<< endl;
-
- if (snmp_.get( pdu_, target_, this) != SNMP_CLASS_SUCCESS) {
- const char *ptr = snmp_.error_string();
- cout << "ASNMP:ERROR: get command failed reason: " << ptr << endl;
- } else {
- ACE_Reactor::instance()->run_reactor_event_loop();
- }
- return 0;
-}
-
-void getapp::result(Snmp *, int rc)
-{
- Vb vb;
- if (rc < 0)
- {
- const char *ptr = snmp_.error_string();
- cout << "ASNMP:ERROR: get command failed reason: " << ptr << endl;
- } else {
- // check to see if there are any errors
- if (pdu_.get_error_status()) {
- cout << "ERROR: agent replied as follows\n";
- cout << pdu_.agent_error_reason() << endl;
- }
- else {
- VbIter iter(pdu_);
- while (iter.next(vb)) {
- cout << "\tOid = " << vb.to_string_oid() << "\n";
- cout << "\tValue = " << vb.to_string_value() << "\n";
- }
- }
- }
- cout << "\nASNMP:INFO: command completed normally.\n"<< endl;
- ACE_Reactor::instance()->end_reactor_event_loop();
-}
diff --git a/ACE/ASNMP/examples/next/Makefile.am b/ACE/ASNMP/examples/next/Makefile.am
deleted file mode 100644
index a7b4c2a1256..00000000000
--- a/ACE/ASNMP/examples/next/Makefile.am
+++ /dev/null
@@ -1,41 +0,0 @@
-## Process this file with automake to create Makefile.in
-##
-## $Id$
-##
-## This file was generated by MPC. Any changes made directly to
-## this file will be lost the next time it is generated.
-##
-## MPC Command:
-## ./bin/mwc.pl -type automake -noreldefs ACE.mwc
-
-ACE_BUILDDIR = $(top_builddir)
-ACE_ROOT = $(top_srcdir)
-
-
-## Makefile.asnmp_example_next.am
-
-if !BUILD_USES_WCHAR
-
-noinst_PROGRAMS = next
-
-next_CPPFLAGS = \
- -I$(ACE_ROOT) \
- -I$(ACE_BUILDDIR) \
- -I$(ACE_ROOT)/ASNMP
-
-next_SOURCES = \
- next.cpp
-
-next_LDADD = \
- $(top_builddir)/ASNMP/asnmp/libasnmp.la \
- $(ACE_BUILDDIR)/ace/libACE.la
-
-endif !BUILD_USES_WCHAR
-
-## Clean up template repositories, etc.
-clean-local:
- -rm -f *~ *.bak *.rpo *.sym lib*.*_pure_* core core.*
- -rm -f gcctemp.c gcctemp so_locations *.ics
- -rm -rf cxx_repository ptrepository ti_files
- -rm -rf templateregistry ir.out
- -rm -rf ptrepository SunWS_cache Templates.DB
diff --git a/ACE/ASNMP/examples/next/next.cpp b/ACE/ASNMP/examples/next/next.cpp
deleted file mode 100644
index a246c1ce549..00000000000
--- a/ACE/ASNMP/examples/next/next.cpp
+++ /dev/null
@@ -1,204 +0,0 @@
-// $Id$
-
-// ============================================================================
-//
-// = LIBRARY
-// asnmp
-//
-// = FILENAME
-// next.cpp
-//
-// = DESCRIPTION
-// Sample application demonstrating synchronous Snmp::get_next API
-// to access an SNMP Version 1 agent.
-//
-// = AUTHOR
-// Peter E. Mellquist original code
-// Michael R MacFaden mrm@cisco.com rework API/ACE integration
-//
-// ============================================================================
-/*===================================================================
- Copyright (c) 1996
- Hewlett-Packard Company
-
- ATTENTION: USE OF THIS SOFTWARE IS SUBJECT TO THE FOLLOWING TERMS.
- Permission to use, copy, modify, distribute and/or sell this software
- and/or its documentation is hereby granted without fee. User agrees
- to display the above copyright notice and this license notice in all
- copies of the software and any documentation of the software. User
- agrees to assume all liability for the use of the software; Hewlett-Packard
- makes no representations about the suitability of this software for any
- purpose. It is provided "AS-IS without warranty of any kind,either express
- or implied. User hereby grants a royalty-free license to any and all
- derivatives based upon this software code base.
-=====================================================================*/
-
-#include "asnmp/snmp.h"
-#include "ace/Argv_Type_Converter.h"
-#include "ace/Get_Opt.h"
-
-// FUZZ: disable check_for_streams_include
-#include "ace/streams.h"
-
-ACE_RCSID(next, next, "$Id$")
-
-//
-// SNMPv1 Get Next Application
-//
-class nextapp {
- public:
- nextapp(int argc, char **argv); // process command line args
- int valid() const; // verify transaction can proceed
- int run(); // issue transaction
- static void usage(); // operator help message
-
- private:
- nextapp(const nextapp&);
-
- UdpAddress address_;
- Pdu pdu_; // construct a request Pdu
- Oid oid_;
- OctetStr community_;
- Snmp snmp_;
- UdpTarget target_;
- int valid_;
-};
-
-
-// main entry point
-int main( int argc, char *argv[])
-{
- nextapp get(argc, argv);
- if (get.valid())
- return get.run();
- else
- nextapp::usage();
- return 1;
-}
-
-int nextapp::valid() const
-{
- return valid_;
-}
-nextapp::nextapp(int argc, char *argv[]): valid_(0)
-{
- Oid req, def_oid("1.3.6.1.2.1.1.1.0"); // default is sysDescr
- if ( argc < 2)
- return;
-
- address_ = argv[argc - 1];
- if ( !address_.valid()) {
- cout << "ERROR: Invalid IPv4 address or DNS hostname: " \
- << argv[argc] << "\n";
- return;
- }
-
- ACE_Argv_Type_Converter to_tchar (argc, argv);
- ACE_Get_Opt get_opt (argc,
- to_tchar.get_TCHAR_argv (),
- ACE_TEXT ("o:c:r:t:"));
- for (int c; (c = get_opt ()) != -1; )
- switch (c)
- {
- case 'o':
- req = ACE_TEXT_ALWAYS_CHAR (get_opt.opt_arg());
- if (req.valid() == 0)
- cout << "ERROR: oid value: "
- << ACE_TEXT_ALWAYS_CHAR (get_opt.opt_arg())
- << "is not valid. using default.\n";
- break;
-
- case 'c':
- community_ = ACE_TEXT_ALWAYS_CHAR (get_opt.opt_arg());
- target_.set_read_community(community_);
- break;
-
- case 'r':
- target_.set_retry(ACE_OS::atoi (get_opt.opt_arg()));
- break;
-
- case 't':
- target_.set_timeout(ACE_OS::atoi (get_opt.opt_arg()));
- break;
-
- default:
- break;
- }
-
- Vb vb; // construct a Vb object
- if (req.valid())
- vb.set_oid( req); // set the Oid portion of the Vb
- else {
- vb.set_oid( def_oid); // set the Oid portion of the Vb
- }
- pdu_ += vb;
- vb.get_oid(oid_); // store for later use
- valid_ = 1;
-}
-
-void nextapp::usage()
-{
- cout << "Usage:\n";
- cout << "next [options] dotted-quad | DNSName[:port]\n";
- cout << " -o OID starts with oid after 1.3.6.1.2.1.1.1.0 (mibII sysDescr.0) \n";
- cout << " -c Community_name, default is 'public' \n";
- cout << " -r N retries default is N = 1 retry\n";
- cout << " -t N timeout in seconds default is 1 second" << endl;
-}
-
-
-int nextapp::run()
-{
-
- //----------[ create a ASNMP session ]-----------------------------------
- if ( snmp_.valid() != SNMP_CLASS_SUCCESS) {
- cout << "\nASNMP:ERROR:Create session failed: "<<
- snmp_.error_string()<< "\n";
- return 1;
- }
-
- //--------[ build up ASNMP object needed ]-------------------------------
- if (address_.get_port() == 0)
- address_.set_port(DEF_AGENT_PORT);
- target_.set_address( address_); // make a target using the address
-
- //-------[ issue the request, blocked mode ]-----------------------------
- cout << "\nASNMP:INFO:SNMP Version " << (target_.get_version()+ 1) << \
- " GET_NEXT SAMPLE PROGRAM \nOID: " << oid_.to_string() << "\n";
- target_.get_address(address_); // target updates port used
- int rc;
- const char *name = address_.resolve_hostname(rc);
-
- cout << "Device: " << address_ << " ";
-
- //FUZZ: disable check_for_lack_ACE_OS
- cout << (rc ? "<< did not resolve via gethostbyname() >>" : name) << "\n";
- //FUZZ: enable check_for_lack_ACE_OS
-
- cout << "[ Retries=" << target_.get_retry() << " \
- Timeout=" << target_.get_timeout() <<" ms " << "Community=" << \
- community_.to_string() << " ]"<< endl;
-
- if (snmp_.get_next( pdu_, target_) == SNMP_CLASS_SUCCESS) {
- Vb vb;
- // check to see if there are any errors
- if (pdu_.get_error_status()) {
- cout << "ERROR: agent replied as follows\n";
- cout << pdu_.agent_error_reason() << endl;
- }
- else {
- VbIter iter(pdu_);
- while (iter.next(vb)) {
- cout << "\tOid = " << vb.to_string_oid() << "\n";
- cout << "\tValue = " << vb.to_string_value() << "\n";
- }
- }
- }
- else {
- const char *ptr = snmp_.error_string();
- cout << "ASNMP:ERROR: get_next command failed reason: " << ptr << endl;
- }
- cout << "ASNMP:INFO:command completed normally. ACE Rocks...\n"<< endl;
- return 0;
-}
-
diff --git a/ACE/ASNMP/examples/next/next.mpc b/ACE/ASNMP/examples/next/next.mpc
deleted file mode 100644
index f0022cb46a2..00000000000
--- a/ACE/ASNMP/examples/next/next.mpc
+++ /dev/null
@@ -1,13 +0,0 @@
-// $Id$
-
-project (asnmp_example_next) : aceexe {
- exename = next
- after += asnmp_lib
- libs += asnmp
- avoids += uses_wchar
- includes += $(ACE_ROOT)/ASNMP
- source_files {
- next.cpp
- }
-}
-
diff --git a/ACE/ASNMP/examples/set/Makefile.am b/ACE/ASNMP/examples/set/Makefile.am
deleted file mode 100644
index 94f708ec8e1..00000000000
--- a/ACE/ASNMP/examples/set/Makefile.am
+++ /dev/null
@@ -1,41 +0,0 @@
-## Process this file with automake to create Makefile.in
-##
-## $Id$
-##
-## This file was generated by MPC. Any changes made directly to
-## this file will be lost the next time it is generated.
-##
-## MPC Command:
-## ./bin/mwc.pl -type automake -noreldefs ACE.mwc
-
-ACE_BUILDDIR = $(top_builddir)
-ACE_ROOT = $(top_srcdir)
-
-
-## Makefile.asnmp_example_set.am
-
-if !BUILD_USES_WCHAR
-
-noinst_PROGRAMS = set
-
-set_CPPFLAGS = \
- -I$(ACE_ROOT) \
- -I$(ACE_BUILDDIR) \
- -I$(ACE_ROOT)/ASNMP
-
-set_SOURCES = \
- set.cpp
-
-set_LDADD = \
- $(top_builddir)/ASNMP/asnmp/libasnmp.la \
- $(ACE_BUILDDIR)/ace/libACE.la
-
-endif !BUILD_USES_WCHAR
-
-## Clean up template repositories, etc.
-clean-local:
- -rm -f *~ *.bak *.rpo *.sym lib*.*_pure_* core core.*
- -rm -f gcctemp.c gcctemp so_locations *.ics
- -rm -rf cxx_repository ptrepository ti_files
- -rm -rf templateregistry ir.out
- -rm -rf ptrepository SunWS_cache Templates.DB
diff --git a/ACE/ASNMP/examples/set/set.cpp b/ACE/ASNMP/examples/set/set.cpp
deleted file mode 100644
index 8cd8752f48a..00000000000
--- a/ACE/ASNMP/examples/set/set.cpp
+++ /dev/null
@@ -1,275 +0,0 @@
-// $Id$
-
-// ============================================================================
-//
-// = LIBRARY
-// asnmp
-//
-// = FILENAME
-// set.cpp
-//
-// = DESCRIPTION
-// Sample application demonstrating synchronous Snmp::set API
-// to update an oid in an SNMP Version 1 agent.
-//
-// = AUTHOR
-// Peter E. Mellquist original code
-// Michael R MacFaden mrm@cisco.com rework API/ACE integration
-//
-// ============================================================================
-/*===================================================================
- Copyright (c) 1996
- Hewlett-Packard Company
-
- ATTENTION: USE OF THIS SOFTWARE IS SUBJECT TO THE FOLLOWING TERMS.
- Permission to use, copy, modify, distribute and/or sell this software
- and/or its documentation is hereby granted without fee. User agrees
- to display the above copyright notice and this license notice in all
- copies of the software and any documentation of the software. User
- agrees to assume all liability for the use of the software; Hewlett-Packard
- makes no representations about the suitability of this software for any
- purpose. It is provided "AS-IS without warranty of any kind,either express
- or implied. User hereby grants a royalty-free license to any and all
- derivatives based upon this software code base.
-=====================================================================*/
-
-#include "asnmp/snmp.h"
-#include "ace/Argv_Type_Converter.h"
-#include "ace/Get_Opt.h"
-
-// FUZZ: disable check_for_streams_include
-#include "ace/streams.h"
-
-ACE_RCSID(set, set, "$Id$")
-
-//
-// SNMPv1 Set Application
-//
-class set {
- public:
- set(int argc, char **argv); // process command line args
- int valid() const; // verify transaction can proceed
- int run(); // issue transaction
- static void usage(); // operator help message
-
- private:
- set(const set&);
-
- UdpAddress address_;
- Pdu pdu_; // construct a request Pdu
- Oid oid_;
- OctetStr community_;
- Snmp snmp_;
- UdpTarget target_;
- int valid_;
-};
-
-
-// main entry point
-int main( int argc, char *argv[])
-{
- set get(argc, argv);
- if (get.valid())
- return get.run();
- else
- set::usage();
- return 1;
-}
-
-int
-set::valid() const
-{
- return valid_;
-}
-
-set::set(int argc, char *argv[]): valid_(0)
-{
- Vb vb; // construct a Vb object
- Oid req;
- if ( argc < 2)
- return;
- target_.get_write_community(community_);
- address_ = argv[argc - 1];
- if ( !address_.valid()) {
- cout << "ERROR: Invalid IPv4 address or DNS hostname: " \
- << argv[argc] << "\n";
- return;
- }
-
- ACE_Argv_Type_Converter to_tchar (argc, argv);
- ACE_Get_Opt get_opt (argc,
- to_tchar.get_TCHAR_argv (),
- ACE_TEXT ("o:c:r:t:I:U:C:G:T:O:S:P:"));
- for (int c; (c = get_opt ()) != -1; )
- switch (c)
- {
- case 'o':
- req = ACE_TEXT_ALWAYS_CHAR (get_opt.opt_arg());
- if (req.valid() == 0)
- cout << "ERROR: oid value: "
- << ACE_TEXT_ALWAYS_CHAR (get_opt.opt_arg())
- << "is not valid. using default.\n";
- break;
-
- case 'c':
- community_ = ACE_TEXT_ALWAYS_CHAR (get_opt.opt_arg());
- target_.set_write_community(community_);
- break;
-
- case 'r':
- target_.set_retry(ACE_OS::atoi (get_opt.opt_arg()));
- break;
-
- case 't':
- target_.set_timeout(ACE_OS::atoi (get_opt.opt_arg()));
- break;
-
- case 'I': // Integer32
- {
- SnmpInt32 o(ACE_OS::atoi(get_opt.opt_arg()));
- vb.set_value(o);
- pdu_ += vb;
- }
- break;
-
- case 'U': // Unsigned32
- {
- SnmpUInt32 o(ACE_OS::atoi(get_opt.opt_arg()));
- vb.set_value(o);
- pdu_ += vb;
- }
- break;
-
- case 'C': // Counter32
- {
- Counter32 o(ACE_OS::atoi(get_opt.opt_arg()));
- vb.set_value(o);
- pdu_ += vb;
- }
- break;
-
- case 'G': // Gauge32
- {
- Gauge32 o(ACE_OS::atoi(get_opt.opt_arg()));
- vb.set_value(o);
- pdu_ += vb;
- }
- break;
-
- case 'T': // TimeTicks
- {
- TimeTicks o(ACE_OS::atoi(get_opt.opt_arg()));
- vb.set_value(o);
- pdu_ += vb;
- }
- break;
-
- case 'O': // Oid as a variable identifier
- {
- oid_ = ACE_TEXT_ALWAYS_CHAR (get_opt.opt_arg());
- vb.set_oid(oid_); // when value is set, pdu updated
- }
- break;
-
- case 'S': // Octet String
- {
- OctetStr o(ACE_TEXT_ALWAYS_CHAR (get_opt.opt_arg()));
- vb.set_value(o); // set the Oid portion of the Vb
- pdu_ += vb;
- }
- break;
-
- case 'P': // Oid String as a value
- {
- Oid o(ACE_TEXT_ALWAYS_CHAR (get_opt.opt_arg()));
- vb.set_value(o); // set the Oid portion of the Vb
- pdu_ += vb;
- }
- break;
-
- default:
- break;
- }
-
- // if user didn't set anything use defaults
- if (pdu_.get_vb_count() == 0) {
- Oid def_oid("1.3.6.1.2.1.1.4.0"); // defualt is sysName
- OctetStr def_value("sysName.0 updated by ASNMP set command");
- vb.set_oid(def_oid);
- vb.set_value(def_value);
- pdu_ += vb;
- cout << "INFO: using defaults, setting sysName to : " << \
- def_value.to_string() << endl;
- }
-
- valid_ = 1;
-}
-
-void set::usage()
-{
- cout << "Usage:\n";
- cout << "next [options] dotted-quad | DNSName[:port]\n";
- cout << " -o OID starts with oid after 1.3.6.1.2.1.1.1.0 (mibII sysDescr.0) \n";
- cout << " -c Community_name, default is 'private' \n";
- cout << " -r N retries default is N = 1 retry\n";
- cout << " -t N timeout in seconds default is 1 second\n";
- cout << " -O oid_to_set -{I,U,G,S,P} value\n";
- cout << " where I=int32, U=uint32, G=gauge32, S=octet, P=oid" << endl;
-}
-
-
-int set::run()
-{
-
- //----------[ create a ASNMP session ]-----------------------------------
- if ( snmp_.valid() != SNMP_CLASS_SUCCESS) {
- cout << "\nASNMP:ERROR:Create session failed: "<<
- snmp_.error_string()<< "\n";
- return 1;
- }
-
- //--------[ build up ASNMP object needed ]-------------------------------
- if (address_.get_port() == 0)
- address_.set_port(DEF_AGENT_PORT);
- target_.set_address( address_); // make a target using the address
-
- //-------[ issue the request, blocked mode ]-----------------------------
- cout << "\nASNMP:INFO:SNMP Version " << (target_.get_version()+ 1) << \
- " SET SAMPLE PROGRAM \nOID: " << oid_.to_string() << "\n";
- target_.get_address(address_); // target updates port used
- int rc;
- const char *name = address_.resolve_hostname(rc);
-
- cout << "Device: " << address_ << " ";
-
- //FUZZ: disable check_for_lack_ACE_OS
- cout << (rc ? "<< did not resolve via gethostbyname() >>" : name) << "\n";
- //FUZZ: enable check_for_lack_ACE_OS
-
- cout << "[ Retries=" << target_.get_retry() << " \
- Timeout=" << target_.get_timeout() <<" ms " << "Community=" << \
- community_.to_string() << " ]"<< endl;
-
- if (snmp_.set( pdu_, target_) == SNMP_CLASS_SUCCESS) {
- Vb vb;
- // check to see if there are any errors
- if (pdu_.get_error_status()) {
- cout << "ERROR: agent replied as follows\n";
- cout << pdu_.agent_error_reason() << endl;
- }
- else {
- VbIter iter(pdu_);
- while (iter.next(vb)) {
- cout << "\tOid = " << vb.to_string_oid() << "\n";
- cout << "\tValue = " << vb.to_string_value() << "\n";
- }
- }
- }
- else {
- const char *ptr = snmp_.error_string();
- cout << "ASNMP:ERROR: set command failed reason: " << ptr << endl;
- }
- cout << "ASNMP:INFO:command completed normally.\n"<< endl;
- return 0;
-}
-
diff --git a/ACE/ASNMP/examples/set/set.mpc b/ACE/ASNMP/examples/set/set.mpc
deleted file mode 100644
index bb40f93e6df..00000000000
--- a/ACE/ASNMP/examples/set/set.mpc
+++ /dev/null
@@ -1,13 +0,0 @@
-// $Id$
-
-project (asnmp_example_set) : aceexe {
- exename = set
- after += asnmp_lib
- libs += asnmp
- avoids += uses_wchar
- includes += $(ACE_ROOT)/ASNMP
- source_files {
- set.cpp
- }
-}
-
diff --git a/ACE/ASNMP/examples/trap/Makefile.am b/ACE/ASNMP/examples/trap/Makefile.am
deleted file mode 100644
index a60adce7d30..00000000000
--- a/ACE/ASNMP/examples/trap/Makefile.am
+++ /dev/null
@@ -1,41 +0,0 @@
-## Process this file with automake to create Makefile.in
-##
-## $Id$
-##
-## This file was generated by MPC. Any changes made directly to
-## this file will be lost the next time it is generated.
-##
-## MPC Command:
-## ./bin/mwc.pl -type automake -noreldefs ACE.mwc
-
-ACE_BUILDDIR = $(top_builddir)
-ACE_ROOT = $(top_srcdir)
-
-
-## Makefile.asnmp_example_trap.am
-
-if !BUILD_USES_WCHAR
-
-noinst_PROGRAMS = trap
-
-trap_CPPFLAGS = \
- -I$(ACE_ROOT) \
- -I$(ACE_BUILDDIR) \
- -I$(ACE_ROOT)/ASNMP
-
-trap_SOURCES = \
- trap.cpp
-
-trap_LDADD = \
- $(top_builddir)/ASNMP/asnmp/libasnmp.la \
- $(ACE_BUILDDIR)/ace/libACE.la
-
-endif !BUILD_USES_WCHAR
-
-## Clean up template repositories, etc.
-clean-local:
- -rm -f *~ *.bak *.rpo *.sym lib*.*_pure_* core core.*
- -rm -f gcctemp.c gcctemp so_locations *.ics
- -rm -rf cxx_repository ptrepository ti_files
- -rm -rf templateregistry ir.out
- -rm -rf ptrepository SunWS_cache Templates.DB
diff --git a/ACE/ASNMP/examples/trap/trap.cpp b/ACE/ASNMP/examples/trap/trap.cpp
deleted file mode 100644
index 29ef6e4b7d8..00000000000
--- a/ACE/ASNMP/examples/trap/trap.cpp
+++ /dev/null
@@ -1,192 +0,0 @@
-// $Id$
-
-// ============================================================================
-//
-// = LIBRARY
-// asnmp
-//
-// = FILENAME
-// trap.cpp
-//
-// = DESCRIPTION
-// Sample application demonstrating synchronous Snmp::trap API
-// to send to an SNMP Version 1 trap listener app.
-//
-// = AUTHOR
-// Peter E. Mellquist original code
-// Michael R MacFaden mrm@cisco.com rework OO, API/ACE integration
-//
-// ============================================================================
-/*===================================================================
- Copyright (c) 1996
- Hewlett-Packard Company
-
- ATTENTION: USE OF THIS SOFTWARE IS SUBJECT TO THE FOLLOWING TERMS.
- Permission to use, copy, modify, distribute and/or sell this software
- and/or its documentation is hereby granted without fee. User agrees
- to display the above copyright notice and this license notice in all
- copies of the software and any documentation of the software. User
- agrees to assume all liability for the use of the software; Hewlett-Packard
- makes no representations about the suitability of this software for any
- purpose. It is provided "AS-IS without warranty of any kind,either express
- or implied. User hereby grants a royalty-free license to any and all
- derivatives based upon this software code base.
-=====================================================================*/
-
-#include "asnmp/snmp.h"
-#define DEFINE_TRAP_CONSTANTS_
-#include "asnmp/enttraps.h" // enterprise standard traps
-#include "ace/Argv_Type_Converter.h"
-#include "ace/Get_Opt.h"
-
-// FUZZ: disable check_for_streams_include
-#include "ace/streams.h"
-
-ACE_RCSID(trap, trap, "$Id$")
-
-//
-// SNMPv1 Trap Application
-//
-class trapapp {
- public:
- trapapp(int argc, char **argv); // process command line args
- int valid() const; // verify transaction can proceed
- int run(); // issue transaction
- static void usage(); // operator help message
-
- private:
- trapapp(const trapapp&);
-
- UdpAddress address_;
- Pdu pdu_; // construct a request Pdu
- Oid oid_;
- OctetStr community_;
- Snmp snmp_;
- UdpTarget target_;
- int valid_;
-};
-
-
-// main entry point
-int main( int argc, char *argv[])
-{
- trapapp get(argc, argv);
- if (get.valid())
- return get.run();
- else
- trapapp::usage();
- return 1;
-}
-
-int trapapp::valid() const
-{
- return valid_;
-}
-trapapp::trapapp(int argc, char *argv[]): valid_(0)
-{
- Oid def_ent_oid("1.3.6.1.2.1.1.1.2.0.1"); // def enterprise oid
- Oid ent, trap; // user specified values
-
- if ( argc < 2) // hostname mandatory
- return;
-
- address_ = argv[argc - 1];
- if ( !address_.valid()) {
- cout << "ERROR: Invalid IPv4 address or DNS hostname: " \
- << argv[argc] << "\n";
- return;
- }
-
- ACE_Argv_Type_Converter to_tchar (argc, argv);
- ACE_Get_Opt get_opt (argc,
- to_tchar.get_TCHAR_argv (),
- ACE_TEXT ("c:e:t:"));
- for (int c; (c = get_opt ()) != -1; )
- switch (c)
- {
- case 'c': // community string
- community_ = ACE_TEXT_ALWAYS_CHAR (get_opt.opt_arg());
- target_.set_read_community(community_);
- break;
-
- case 'e': // trap oid to send
- ent = ACE_TEXT_ALWAYS_CHAR (get_opt.opt_arg());
- break;
-
- case 't': // trap oid
- trap = ACE_TEXT_ALWAYS_CHAR (get_opt.opt_arg());
- break;;
-
- default:
- break;
- }
-
- if (ent.valid())
- pdu_.set_notify_enterprise( ent); // set up the enterprise of the trap
- else
- pdu_.set_notify_enterprise( def_ent_oid);
-
- if (trap.valid())
- pdu_.set_notify_id( trap); // set the id of the trap
- else
- pdu_.set_notify_id( coldStart); // set the id of the trap
-
- Oid detail_oid("1.3.6.1.4.1.11.2.16.2");
- OctetStr detail_value("SNMP++ Trap Send Test");
- Vb vb(detail_oid, detail_value);
- pdu_ += vb;
-
- pdu_.get_notify_id(oid_); // store for later use
- valid_ = 1;
-}
-
-void trapapp::usage()
-{
- cout << "Usage:\n";
- cout << "trap [options] dotted-quad | DNSName[:port]\n";
- cout << " -c Community_name, default is 'public' \n";
- cout << " -r N retries default is N = 1 retry\n";
- cout << " -t N timeout in seconds default is 1 second" << endl;
- cout << " -e oid enterprise oid default is 1.3.6.1.2.1.1.1.2.0.1\n";
- cout << " -O oid trap id default is coldStart 1.3.6.1.6.3.1.1.5.1\n";
-}
-
-int trapapp::run()
-{
- if ( snmp_.valid() != SNMP_CLASS_SUCCESS) {
- cout << "\nASNMP:ERROR:Create session failed: "<<
- snmp_.error_string()<< "\n";
- return 1;
- }
-
- if (address_.get_port() == 0)
- address_.set_port(DEF_TRAP_PORT);
- target_.set_address( address_); // make a target using the address
-
- //-------[ issue the request, blocked mode ]-----------------------------
- cout << "\nASNMP:INFO:SNMP Version " << (target_.get_version()+ 1) << \
- " TRAP GENERATOR SAMPLE PROGRAM \nOID: " << oid_.to_string() << "\n";
- target_.get_address(address_); // target updates port used
- int rc;
- const char *name = address_.resolve_hostname(rc);
-
- cout << "Device: " << address_ << " ";
-
- //FUZZ: disable check_for_lack_ACE_OS
- cout << (rc ? "<< did not resolve via gethostbyname() >>" : name) << "\n";
- //FUZZ: enable check_for_lack_ACE_OS
-
- cout << "[ Community=" << community_.to_string() << " ]"<< endl;
-
- if (snmp_.trap( pdu_, target_) == SNMP_CLASS_SUCCESS) {
- cout << "Trap was written to network...\n";
- }
- else {
- const char *ptr = snmp_.error_string();
- cout << "ASNMP:ERROR: trap command failed reason: " << ptr << endl;
- }
-
- cout << "ASNMP:INFO:command completed normally.\n"<< endl;
- return 0;
-}
-
diff --git a/ACE/ASNMP/examples/trap/trap.mpc b/ACE/ASNMP/examples/trap/trap.mpc
deleted file mode 100644
index d0d6dc8e897..00000000000
--- a/ACE/ASNMP/examples/trap/trap.mpc
+++ /dev/null
@@ -1,12 +0,0 @@
-// $Id$
-
-project (asnmp_example_trap) : aceexe {
- exename = trap
- after += asnmp_lib
- libs += asnmp
- avoids += uses_wchar
- includes += $(ACE_ROOT)/ASNMP
- source_files {
- trap.cpp
- }
-}
diff --git a/ACE/ASNMP/examples/walk/Makefile.am b/ACE/ASNMP/examples/walk/Makefile.am
deleted file mode 100644
index 9cff32a49de..00000000000
--- a/ACE/ASNMP/examples/walk/Makefile.am
+++ /dev/null
@@ -1,41 +0,0 @@
-## Process this file with automake to create Makefile.in
-##
-## $Id$
-##
-## This file was generated by MPC. Any changes made directly to
-## this file will be lost the next time it is generated.
-##
-## MPC Command:
-## ./bin/mwc.pl -type automake -noreldefs ACE.mwc
-
-ACE_BUILDDIR = $(top_builddir)
-ACE_ROOT = $(top_srcdir)
-
-
-## Makefile.asnmp_example_walk.am
-
-if !BUILD_USES_WCHAR
-
-noinst_PROGRAMS = walk
-
-walk_CPPFLAGS = \
- -I$(ACE_ROOT) \
- -I$(ACE_BUILDDIR) \
- -I$(ACE_ROOT)/ASNMP
-
-walk_SOURCES = \
- walk.cpp
-
-walk_LDADD = \
- $(top_builddir)/ASNMP/asnmp/libasnmp.la \
- $(ACE_BUILDDIR)/ace/libACE.la
-
-endif !BUILD_USES_WCHAR
-
-## Clean up template repositories, etc.
-clean-local:
- -rm -f *~ *.bak *.rpo *.sym lib*.*_pure_* core core.*
- -rm -f gcctemp.c gcctemp so_locations *.ics
- -rm -rf cxx_repository ptrepository ti_files
- -rm -rf templateregistry ir.out
- -rm -rf ptrepository SunWS_cache Templates.DB
diff --git a/ACE/ASNMP/examples/walk/walk.cpp b/ACE/ASNMP/examples/walk/walk.cpp
deleted file mode 100644
index 2e67e2b4438..00000000000
--- a/ACE/ASNMP/examples/walk/walk.cpp
+++ /dev/null
@@ -1,270 +0,0 @@
-// $Id$
-
-// ============================================================================
-//
-// = LIBRARY
-// asnmp
-//
-// = FILENAME
-// walk.cpp
-//
-// = DESCRIPTION
-// Sample application demonstrating synchronous Snmp::get, get_next API
-// to access an SNMP Version 1 agent.
-//
-// = AUTHOR
-// Peter E. Mellquist original code
-// Michael R MacFaden mrm@cisco.com rework API/ACE integration
-//
-// ============================================================================
-/*===================================================================
- Copyright (c) 1996
- Hewlett-Packard Company
-
- ATTENTION: USE OF THIS SOFTWARE IS SUBJECT TO THE FOLLOWING TERMS.
- Permission to use, copy, modify, distribute and/or sell this software
- and/or its documentation is hereby granted without fee. User agrees
- to display the above copyright notice and this license notice in all
- copies of the software and any documentation of the software. User
- agrees to assume all liability for the use of the software; Hewlett-Packard
- makes no representations about the suitability of this software for any
- purpose. It is provided "AS-IS without warranty of any kind,either express
- or implied. User hereby grants a royalty-free license to any and all
- derivatives based upon this software code base.
-=====================================================================*/
-
-#include "asnmp/snmp.h"
-#include "ace/Argv_Type_Converter.h"
-#include "ace/Get_Opt.h"
-// FUZZ: disable check_for_streams_include
-#include "ace/streams.h"
-
-ACE_RCSID(walk, walk, "$Id$")
-
-//
-// SNMPv1 Walk Mib Application
-//
-class walkapp {
- public:
- walkapp(int argc, char **argv); // process command line args
- int valid() const; // verify transaction can proceed
- int run(); // issue transaction
- static void usage(); // operator help message
-
- private:
- walkapp(const walkapp&);
-
- UdpAddress address_;
- Pdu pdu_; // construct a request Pdu
- Oid oid_;
- OctetStr community_;
- Snmp snmp_;
- UdpTarget target_;
- int valid_;
-};
-
-
-// main entry point
-int main( int argc, char *argv[])
-{
- walkapp get(argc, argv);
- if (get.valid())
- return get.run();
- else
- walkapp::usage();
- return 1;
-}
-
-int walkapp::valid() const
-{
- return valid_;
-}
-
-walkapp::walkapp(int argc, char *argv[]): valid_(0)
-{
- Oid req, def_oid("1.3.6.1.2.1.1.1.0"); // default begin walk with MIBII
- if ( argc < 2)
- return;
-
- address_ = argv[argc - 1];
- if ( !address_.valid()) {
- cout << "ERROR: Invalid IPv4 address or DNS hostname: " \
- << argv[argc] << "\n";
- return;
- }
-
- ACE_Argv_Type_Converter to_tchar (argc, argv);
- ACE_Get_Opt get_opt (argc,
- to_tchar.get_TCHAR_argv (),
- ACE_TEXT ("o:c:r:t:"));
- for (int c; (c = get_opt ()) != -1; )
- switch (c)
- {
- case 'o':
- req = ACE_TEXT_ALWAYS_CHAR (get_opt.opt_arg());
- if (req.valid() == 0)
- cout << "ERROR: oid value: "
- << ACE_TEXT_ALWAYS_CHAR (get_opt.opt_arg())
- << "is not valid. using default.\n";
- break;
-
- case 'c':
- community_ = ACE_TEXT_ALWAYS_CHAR (get_opt.opt_arg());
- target_.set_read_community(community_);
- break;
-
- case 'r':
- target_.set_retry(ACE_OS::atoi (get_opt.opt_arg()));
- break;
-
- case 't':
- target_.set_timeout(ACE_OS::atoi (get_opt.opt_arg()));
- break;
-
- default:
- break;
- }
-
- Vb vb; // construct a Vb object
- if (req.valid())
- vb.set_oid( req); // set the Oid portion of the Vb
- else {
- vb.set_oid( def_oid); // set the Oid portion of the Vb
- }
- pdu_ += vb;
- vb.get_oid(oid_); // store for later use
- valid_ = 1;
-}
-
-void walkapp::usage()
-{
- cout << "Usage:\n";
- cout << "walk [options] dotted-quad | DNSName[:port]\n";
- cout << " -o OID starts with oid after 1.3.6.1.2.1.1.1.0 (mibII sysDescr.0) \n";
- cout << " -c Community_name, default is 'public' \n";
- cout << " -r N retries default is N = 1 retry\n";
- cout << " -t N timeout in seconds default is 1 second" << endl;
-}
-
-
-//
-// simple mib iterator class
-//
-class MibIter {
- public:
- // Pdu must contain initial oid to begin with
- MibIter(Snmp *snmp, Pdu& pdu, UdpTarget* target);
- int next(Vb& vb, char *&err_reason); // return next oid in mib
-
- private:
- Snmp *snmp_;
- UdpTarget *target_;
- Pdu pdu_;
- Vb vb_;
- int first_; // flag to obtain first entry
- int valid_; // flag to obtain first entry
-};
-
-MibIter::MibIter(Snmp* snmp, Pdu& pdu, UdpTarget *target):
- snmp_(snmp), target_(target), pdu_(pdu), first_(0),
- valid_(0)
-{
- // verify we have a valid oid to begin iterating with
- Oid oid;
- Vb vb;
- pdu.get_vb(vb, 0);
- vb.get_oid(oid);
- if (oid.valid())
- valid_ = 1;
-}
-
-// return vb of next oid in agent tree, return 1 else return 0, reason set
-int MibIter::next(Vb& vb, char *& reason)
-{
- int rc;
-
- if (valid_ == 0) // not valid object
- return -1;
-
- // 1. poll for value
- if (first_ == 0) {
- rc = snmp_->get( pdu_, *target_);
- first_++;
- }
- else {
- rc = snmp_->get_next( pdu_, *target_);
- }
-
- if (rc != SNMP_CLASS_SUCCESS) {
- reason = const_cast <char*> (snmp_->error_string());
- return 0;
- }
-
- // 2. check for problems
- if (pdu_.get_error_status()) {
- reason = const_cast <char*> (pdu_.agent_error_reason());
- return 0;
- }
-
- // 3. return vb to caller
- pdu_.get_vb(vb, 0);
- Oid nextoid;
- vb.get_oid(nextoid); // and setup next oid to get
- Vb nextvb(nextoid);
- pdu_.delete_all_vbs();
- pdu_ += nextvb; // can't do set_vb as there are no entries to replace
-
- return 1; // ok
-}
-
-int walkapp::run()
-{
-
- //----------[ create a ASNMP session ]-----------------------------------
- if ( snmp_.valid() != SNMP_CLASS_SUCCESS) {
- cout << "\nASNMP:ERROR:Create session failed: "<<
- snmp_.error_string()<< "\n";
- return 1;
- }
-
- //--------[ build up ASNMP object needed ]-------------------------------
- if (address_.get_port() == 0)
- address_.set_port(DEF_AGENT_PORT);
- target_.set_address( address_); // make a target using the address
-
- //-------[ issue the request, blocked mode ]-----------------------------
- cout << "\nASNMP:INFO:SNMP Version " << (target_.get_version()+ 1) << \
- " WALK SAMPLE PROGRAM \nOID: " << oid_.to_string() << "\n";
- target_.get_address(address_); // target updates port used
- int rc;
- const char *name = address_.resolve_hostname(rc);
-
- cout << "Device: " << address_ << " ";
-
- //FUZZ: disable check_for_lack_ACE_OS
- cout << (rc ? "<< did not resolve via gethostbyname() >>" : name) << "\n";
- //FUZZ: enable check_for_lack_ACE_OS
-
- cout << "[ Retries=" << target_.get_retry() << " \
- Timeout=" << target_.get_timeout() <<" ms " << "Community=" << \
- community_.to_string() << " ]"<< endl;
-
- MibIter iter(&snmp_, pdu_, &target_);
- char *err_str = 0;
- Vb vb;
- unsigned ctr = 0;
- while (iter.next(vb, err_str)) {
- cout << "\tOid = " << vb.to_string_oid() << "\n";
- cout << "\tValue = " << vb.to_string_value() << "\n";
- ctr++;
- }
-
- if (!err_str) {
- cout << "ERROR: walk: " << err_str << endl;
- return 0;
- }
-
- cout << "ASNMP:INFO:command completed normally. ACE Rocks...\n"<< endl;
- return 0;
-}
-
diff --git a/ACE/ASNMP/examples/walk/walk.mpc b/ACE/ASNMP/examples/walk/walk.mpc
deleted file mode 100644
index aff0fb98d35..00000000000
--- a/ACE/ASNMP/examples/walk/walk.mpc
+++ /dev/null
@@ -1,12 +0,0 @@
-// $Id$
-
-project (asnmp_example_walk) : aceexe {
- exename = walk
- after += asnmp_lib
- libs += asnmp
- avoids += uses_wchar
- includes += $(ACE_ROOT)/ASNMP
- source_files {
- walk.cpp
- }
-}