Blame README.win32

Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
*
Packit Service b38f0b
* README.win32
Packit Service b38f0b
*
Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
Packit Service b38f0b
This guide describes how to build Net-SNMP with Microsoft Visual C++, the
Packit Service b38f0b
MinGW gcc compiler or the Cygwin gcc compiler.  As developers build with other
Packit Service b38f0b
Win32 environments, their notes will be included here.
Packit Service b38f0b
Packit Service b38f0b
The sections in this guide are:
Packit Service b38f0b
Packit Service b38f0b
Current Status for Win32 platforms
Packit Service b38f0b
Interactions with Other Vendor's Products
Packit Service b38f0b
Running Net-SNMP as a replacement for the Microsoft SNMP service
Packit Service b38f0b
Co-existence with Microsoft SNMP services
Packit Service b38f0b
Installing Platform SDK
Packit Service b38f0b
Microsoft Visual C++ - Overview
Packit Service b38f0b
Microsoft Visual C++ - Configure / nmake - Building
Packit Service b38f0b
Microsoft Visual C++ - Workspace - Building
Packit Service b38f0b
Microsoft Visual C++ - Workspace - Building the DLL
Packit Service b38f0b
Microsoft Visual C++ - Workspace - Building the Perl SNMP modules
Packit Service b38f0b
Microsoft Visual C++ - Workspace - Installing
Packit Service b38f0b
Microsoft Visual C++ - Building with OpenSSL
Packit Service b38f0b
Microsoft Visual C++ - Building with IPv6
Packit Service b38f0b
Microsoft Visual C++ - Building your own applications with snmplib
Packit Service b38f0b
Microsoft Visual C++ - Extending the Agent
Packit Service b38f0b
GCC on Windows
Packit Service b38f0b
Cygwin - Building
Packit Service b38f0b
MinGW - Building
Packit Service b38f0b
MinGW - Building with OpenSSL
Packit Service b38f0b
Configuring Net-SNMP
Packit Service b38f0b
How to Register the Net-SNMP Agent and Trap Daemon as Windows services
Packit Service b38f0b
Notes on SET support for WIN32 ports
Packit Service b38f0b
Notes on preprocessor defines for MSVC, MinGW and Cygwin
Packit Service b38f0b
Acknowledgements
Packit Service b38f0b
Packit Service b38f0b
Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
*
Packit Service b38f0b
* Net-SNMP status for Win32 platforms
Packit Service b38f0b
*
Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
Packit Service b38f0b
All applications build with Microsoft Visual C++ 6.0, Microsoft Development
Packit Service b38f0b
Environment 2003 (MSVC 7.0/7.1), Microsoft Visual Studio 2005, Microsoft
Packit Service b38f0b
Visual Studio 2008, Microsoft Visual Studio 2010, gcc under Cygwin and gcc
Packit Service b38f0b
under MinGW.
Packit Service b38f0b
Packit Service b38f0b
  -  All of the applications work (snmpwalk, snmpget, snmpset, snmptrap, ...).
Packit Service b38f0b
  -  The system, snmp, ip, tcp, udp and icmp MIB-groups work (requires the
Packit Service b38f0b
     Platform SDK).
Packit Service b38f0b
  -  The Net-SNMP agent runs as an AgentX master agent or as subagent.
Packit Service b38f0b
  -  smux is working.
Packit Service b38f0b
  -  The target, notification, disman/mte groups compile but are not tested.
Packit Service b38f0b
  -  The TCP/IPv6 and UDP/IPv6 transports compile but are not tested.
Packit Service b38f0b
  -  Extending the agent to support enterprise-specific MIBs works.
Packit Service b38f0b
  -  Running the agent on a non-standard UDP or TCP port works.
Packit Service b38f0b
  -  Snmpd can be registered as a Windows service.
Packit Service b38f0b
  -  Snmptrapd can be registered as a Windows service.
Packit Service b38f0b
  -  Some build environments allow long pathnames that contain
Packit Service b38f0b
     embedded spaces.  As this is not true for Cygwin "configure",
Packit Service b38f0b
     the documented example scripts will refer to "c:/usr"
Packit Service b38f0b
     as the base directory for installed Net-SNMP software.
Packit Service b38f0b
  -  When using the winExtDLL extension agent, the Net-SNMP agent will
Packit Service b38f0b
     load the Windows SNMP Service extension DLLs.
Packit Service b38f0b
Packit Service b38f0b
The next subsection relates to items that are built using Visual Studio
Packit Service b38f0b
Packit Service b38f0b
  -  All Visual Studio project (.dsp) files are cleaned, and 
Packit Service b38f0b
     a) Generate code to use Multi-Threaded DLL (/MD) "C" run-time library;
Packit Service b38f0b
     b) Provide the same preprocessor defines (WIN32,_CONSOLE,_MBCS);
Packit Service b38f0b
     c) Remove unnecessary references to GDI, ODBC, and "C" libraries;
Packit Service b38f0b
     d) Debug versions build source browsing and debugging information;
Packit Service b38f0b
     e) Provide consistent include search paths.
Packit Service b38f0b
Packit Service b38f0b
  -  All Debug and Release targets linked with libsnmp project targets
Packit Service b38f0b
     build without errors, and are fully functional.
Packit Service b38f0b
Packit Service b38f0b
  -  Both building via the interactive development environment and via the
Packit Service b38f0b
     command line (nmake) is supported.
Packit Service b38f0b
Packit Service b38f0b
  -  With Visual Studio 2005 and later, the Net-SNMP source code can be
Packit Service b38f0b
     compiled into either 32-bit or 64-bit executables (the amd64/x64
Packit Service b38f0b
     architecture). Previous Visual Studio versions support 32-bit executables
Packit Service b38f0b
     only.
Packit Service b38f0b
Packit Service b38f0b
Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
*
Packit Service b38f0b
* Interactions with Other Vendor's Products
Packit Service b38f0b
*
Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
Packit Service b38f0b
  -  Install scripts etc are written assuming Windows NT / 2000 or higher
Packit Service b38f0b
Packit Service b38f0b
  -  Running the Net-SNMP Agent or trap receiver on Windows 95 or Win3.1
Packit Service b38f0b
     is not supported.
Packit Service b38f0b
Packit Service b38f0b
  -  Running the Net-SNMP Agent or trap receiver as a service on Windows 95
Packit Service b38f0b
     or Windows 98 is not supported.
Packit Service b38f0b
Packit Service b38f0b
  -  The Net-SNMP agent and trap receiver will fail to start if either 
Packit Service b38f0b
     cannot bind to their connect port (161 for agent, 162 for trap receiver).
Packit Service b38f0b
     Check the Services panel to be sure no other SNMP program conflicts. See
Packit Service b38f0b
     the section titled 'Co-existence with Microsoft SNMP services' below.
Packit Service b38f0b
Packit Service b38f0b
  -  The Net-SNMP agent can be used instead of the MS supplied one while
Packit Service b38f0b
     retaining all functionality and with slightly better SNMP conformance.
Packit Service b38f0b
     See the section titled 'Co-existence with Microsoft SNMP services' below.
Packit Service b38f0b
Packit Service b38f0b
  -  The Net-SNMP agent does not use the MS SNMP.dll, therefore it cannot 
Packit Service b38f0b
     run as an extensible part of the MS agent.  It is possible to use a third
Packit Service b38f0b
     party proxy agent for the MS agent to 'proxy' requests to the Net-SNMP
Packit Service b38f0b
     agent listening on a different UDP port on the same machine.
Packit Service b38f0b
Packit Service b38f0b
  -  Snmptrapd does not "share" nor multiplex traps with SNMPTRAP.EXE,
Packit Service b38f0b
     a program that is available from Microsoft or ACE#COMM.
Packit Service b38f0b
Packit Service b38f0b
Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
*
Packit Service b38f0b
* Running Net-SNMP as a replacement for the Microsoft SNMP service
Packit Service b38f0b
*
Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
Packit Service b38f0b
As of Net-SNMP 5.4, the Net-SNMP agent is able to load the Windows SNMP
Packit Service b38f0b
service extension DLLs by using the Net-SNMP winExtDLL extension.
Packit Service b38f0b
Packit Service b38f0b
The Windows SNMP service must be installed, but the service must be disabled.  
Packit Service b38f0b
This is required so that the extension DLLs are available for loading, and 
Packit Service b38f0b
also because this extension and the existing Windows extensions use the 
Packit Service b38f0b
Windows SNMP API from snmpapi.dll.
Packit Service b38f0b
Packit Service b38f0b
An alternative to winExtDLL is to proxy requests from Net-SNMP to the Windows
Packit Service b38f0b
SNMP service.  See the section 'Co-existence with Microsoft SNMP services'.
Packit Service b38f0b
Packit Service b38f0b
Packit Service b38f0b
Limitations
Packit Service b38f0b
-----------
Packit Service b38f0b
Packit Service b38f0b
- When using HP Insight Agents, some parts of the enterprises.232 tree are not
Packit Service b38f0b
  accessible.  The cause of this is not known.
Packit Service b38f0b
Packit Service b38f0b
- When using winExtDLL, there is an offset of up to one second between the
Packit Service b38f0b
  value of the sysUpTime varbind included in the traps generated by SNMP
Packit Service b38f0b
  extension DLLs (e.g. linkUp and linkDown) and the value of the sysUpTime
Packit Service b38f0b
  varbind included in traps generated by Net-SNMP itself (e.g. coldStart).
Packit Service b38f0b
 
Packit Service b38f0b
- When using winExtDLL, hrSystemUptime.0 reports the system uptime in thousands
Packit Service b38f0b
  of a second instead of hundreds of a second. This is well known behavior of
Packit Service b38f0b
  the Microsoft DLL that implements this MIB object. For more information,
Packit Service b38f0b
  see also https://connect.microsoft.com/onecare/feedback/ViewFeedback.aspx?FeedbackID=504908.
Packit Service b38f0b
Packit Service b38f0b
Packit Service b38f0b
Enabling the Windows SNMP extension agents
Packit Service b38f0b
------------------------------------------
Packit Service b38f0b
Packit Service b38f0b
When installing Net-SNMP using the binary available from the web site, select 
Packit Service b38f0b
'With Windows Extension DLL support' for the 'Net-SNMP Agent Service'.
Packit Service b38f0b
Packit Service b38f0b
The recommended way to start snmpd is with the following command line:
Packit Service b38f0b
Packit Service b38f0b
 snmpd.exe -I-udp,udpTable,tcp,tcpTable,icmp,ip,interfaces,system_mib,sysORTable
Packit Service b38f0b
Packit Service b38f0b
The above command will exclude all the Net-SNMP extensions that overlap with 
Packit Service b38f0b
the default Windows (2003) extensions included with Windows.  Other Net-SNMP 
Packit Service b38f0b
modules take precedence over the modules loaded by winExtDLL.
Packit Service b38f0b
Packit Service b38f0b
The binary install of Net-SNMP includes shortcuts in the Start menu for
Packit Service b38f0b
registering and unregistering snmpd and snmptrapd as a service with the
Packit Service b38f0b
correct command line options.
Packit Service b38f0b
Packit Service b38f0b
A simple test to see if winExtDLL is working is to get the sysDescr string.
Packit Service b38f0b
Packit Service b38f0b
 snmpget -v 1 -c public localhost sysDescr.0
Packit Service b38f0b
Packit Service b38f0b
If you see something similar to:
Packit Service b38f0b
Packit Service b38f0b
 Hardware: x86 Family 15 Model 12 Stepping 0 AT/AT COMPATIBLE - Software:
Packit Service b38f0b
 Windows 2000 Version 5.0 (Build 2195 Uniprocessor Free)
Packit Service b38f0b
Packit Service b38f0b
instead of the usual Net-SNMP:
Packit Service b38f0b
Packit Service b38f0b
 Windows host1 5.0.2195 Service Pack 4 2000 Server x86 Family 15 Model 12
Packit Service b38f0b
 Stepping 0
Packit Service b38f0b
Packit Service b38f0b
then it's using the Windows DLLs.  You may also notice that your floppy 
Packit Service b38f0b
drive is accessed when starting the service.  This is from one of the 
Packit Service b38f0b
Windows extensions.
Packit Service b38f0b
Packit Service b38f0b
To see what Windows modules are being loaded, you can shut down the 
Packit Service b38f0b
service and then run snmpd.exe from the command line with winExtDLL 
Packit Service b38f0b
debugging enabled using (all on one line):
Packit Service b38f0b
Packit Service b38f0b
 snmpd.exe -Lo -I-udp,udpTable,tcp,tcpTable,icmp,ip,interfaces,system_mib,
Packit Service b38f0b
 sysORTable -DwinExtDLL
Packit Service b38f0b
Packit Service b38f0b
The Windows DLL snmpmib.dll (SNMPMIB) contains SNMP traffic statistics
Packit Service b38f0b
(.1.3.6.1.2.1.11).  As we are using Net-SNMP and not the Windows SNMP Service,
Packit Service b38f0b
no values will be returned from the Windows extension.  To allow SNMP 
Packit Service b38f0b
statistics to be received, the Net-SNMP module snmp_mib is permitted to load 
Packit Service b38f0b
by not excluding it in the above command line.  As stated above, this module 
Packit Service b38f0b
will take precedence over the Windows module.
Packit Service b38f0b
Packit Service b38f0b
Packit Service b38f0b
Registry Information
Packit Service b38f0b
--------------------
Packit Service b38f0b
Packit Service b38f0b
Warning:  Improper use of the registry editor can damage to your operating
Packit Service b38f0b
          system and should only be used by experienced users.
Packit Service b38f0b
Packit Service b38f0b
The following registry keys are used by the Windows SNMP Service to determine
Packit Service b38f0b
what extension DLLs to load:
Packit Service b38f0b
Packit Service b38f0b
HKLM\SYSTEM\CurrentControlSet\Services\SNMP\Parameters\ExtensionAgents
Packit Service b38f0b
       
Packit Service b38f0b
Each REG_SZ value contains the registry path to an extension agent which 
Packit Service b38f0b
contains the path to the DLL.  For example:
Packit Service b38f0b
Packit Service b38f0b
Name    Type    Value
Packit Service b38f0b
1       REG_SZ  SOFTWARE\Microsoft\LANManagerMIB2Agent\CurrentVersion
Packit Service b38f0b
Packit Service b38f0b
To prevent winExtDLL from loading the above extension, change the registry
Packit Service b38f0b
path to an invalid path such as:
Packit Service b38f0b
Packit Service b38f0b
Name    Type    Value
Packit Service b38f0b
1       REG_SZ  SOFTWARE\Microsoft\LANManagerMIB2Agent\CurrentVersion!!!
Packit Service b38f0b
Packit Service b38f0b
Packit Service b38f0b
Service dependencies
Packit Service b38f0b
--------------------
Packit Service b38f0b
Packit Service b38f0b
Services that depend on the SNMP Service will have to be modified to depend on
Packit Service b38f0b
Net-SNMP instead of SNMP by modifying the registry.  See Microsoft article 
Packit Service b38f0b
193888 for more information.
Packit Service b38f0b
Packit Service b38f0b
Packit Service b38f0b
Compiling Net-SNMP with the winExtDLL extension (MSVC)
Packit Service b38f0b
------------------------------------------------------
Packit Service b38f0b
Packit Service b38f0b
When building with MSVC 6, the Microsoft Platform SDK is required. Note: the
Packit Service b38f0b
most recent Platform SDK version that is still compatible with MSVC 6 is the
Packit Service b38f0b
February 2003 edition. This edition is no longer available online but can be
Packit Service b38f0b
ordered via http://mssdk.orderport.net/22221848/showall.asp.
Packit Service b38f0b
Packit Service b38f0b
Configure / nmake:
Packit Service b38f0b
Packit Service b38f0b
-add --with-winextdll to the Configure command line.
Packit Service b38f0b
Packit Service b38f0b
Workspace:
Packit Service b38f0b
Packit Service b38f0b
-in file win32\net-snmp\net-snmp-config.h modify
Packit Service b38f0b
 /* #undef USING_WINEXTDLL_MODULE */ into the following:
Packit Service b38f0b
 #define USING_WINEXTDLL_MODULE 1
Packit Service b38f0b
Packit Service b38f0b
Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
*
Packit Service b38f0b
* Co-existence with Microsoft SNMP services
Packit Service b38f0b
*
Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
Packit Service b38f0b
If the Microsoft SNMP agent service (SNMP Service) is running, the Net-SNMP 
Packit Service b38f0b
agent (snmpd) will fail to start as it will not be able to bind to the default
Packit Service b38f0b
TCP/IP port of 161.
Packit Service b38f0b
Packit Service b38f0b
If the Microsoft SNMP Trap Receiver service is running, the Net-SNMP trap 
Packit Service b38f0b
receiver (snmptrapd) will fail to start as it will not be able to bind to the 
Packit Service b38f0b
default TCP/IP port of 162.
Packit Service b38f0b
Packit Service b38f0b
It is not a requirement to install the Net-SNMP agent (snmpd) or trap receiver
Packit Service b38f0b
(snmptrapd).  All the command line utilities such as snmpget.exe, snmpset.exe 
Packit Service b38f0b
and the Perl modules will work without the Net-SNMP services.  All the 
Packit Service b38f0b
utilities will work against any SNMP agent.
Packit Service b38f0b
Packit Service b38f0b
The main benefit of running the Microsoft SNMP agent instead of the Net-SNMP 
Packit Service b38f0b
agent is that many Windows applications such as Microsoft SQL Server, 
Packit Service b38f0b
Microsoft Exchange etc, extend the Microsoft agent.  Net-SNMP is NOT a drop 
Packit Service b38f0b
in replacement for the Microsoft agent unless the winExtDLL Net-SNMP extension
Packit Service b38f0b
is used (see the section 'Running Net-SNMP as a replacement for the Microsoft 
Packit Service b38f0b
SNMP service').  Running Net-SNMP in place of the Microsoft agent (without
Packit Service b38f0b
winExtDLL) will prevent the other applications from working with SNMP.  Also,
Packit Service b38f0b
the Net-SNMP agent does not contain as many MIBs as the Microsoft agent.  For
Packit Service b38f0b
example, as of August 2005, the HOST-RESOURCES (host) MIB is not yet 
Packit Service b38f0b
implemented in Net-SNMP.
Packit Service b38f0b
Packit Service b38f0b
There are many benefits of running the Net-SNMP agent instead of the Microsoft
Packit Service b38f0b
such as you can extend the agent using various features found in snmpd.conf 
Packit Service b38f0b
such as pass and pass_persist (support for others are being added), you can
Packit Service b38f0b
use SNMP v3, and there is more granular access control.
Packit Service b38f0b
Packit Service b38f0b
To allow both the Microsoft and Net-SNMP agent / trap receiver to run at the 
Packit Service b38f0b
same time, the default TCP/IP port must be changed on either the Microsoft or 
Packit Service b38f0b
Net-SNMP version of the application.
Packit Service b38f0b
Packit Service b38f0b
The Net-SNMP ports for snmpd and snmptrapd can be modified via snmpd.conf and 
Packit Service b38f0b
snmptrapd.conf or by using a command line option with each program.  See the 
Packit Service b38f0b
Net-SNMP Help file for instructions on changing the port number.
Packit Service b38f0b
Packit Service b38f0b
The Microsoft services use the 'snmp' and 'snmptrap' entries in the SERVICES 
Packit Service b38f0b
file (%SystemRoot%\system32\drivers\etc\services) to determine the port to bind
Packit Service b38f0b
the service to when the service starts.  Simply modify the entries and restart 
Packit Service b38f0b
the affected services.
Packit Service b38f0b
Packit Service b38f0b
Note:  Changing the default port the service listens on will prevent it from 
Packit Service b38f0b
       accepting requests or receiving traps from standard SNMP devices and 
Packit Service b38f0b
       management stations unless they have also been reconfigured to use the 
Packit Service b38f0b
       new port numbers.
Packit Service b38f0b
Packit Service b38f0b
It is possible to configure Net-SNMP agent to listen on the default UDP port
Packit Service b38f0b
(161), have the Microsoft agent listen on another port such as 1161, and have
Packit Service b38f0b
Net-SNMP proxy (forward) requests to the Microsoft agent.  This will allow you
Packit Service b38f0b
to use the advanced features of Net-SNMP while still being able to query
Packit Service b38f0b
the Microsoft agent and subagents.  To this, follow these steps:
Packit Service b38f0b
Packit Service b38f0b
 1.  Change the port that the Microsoft agent listens on.
Packit Service b38f0b
Packit Service b38f0b
 2.  Configure the Microsoft agent to only accept requests from localhost.  
Packit Service b38f0b
     This can be set in the Security tab for the SNMP service in Windows 2000+.
Packit Service b38f0b
     This is recommended to prevent users from querying the Microsoft agent
Packit Service b38f0b
     directly.
Packit Service b38f0b
 
Packit Service b38f0b
 3.  Add a r/c community string to the Microsoft agent.  This can be set in 
Packit Service b38f0b
     the Security tab for the SNMP service in Windows 2000+.  This will give 
Packit Service b38f0b
     Net-SNMP full SNMP access.  User access can be restricted by Net-SNMP
Packit Service b38f0b
     as explained below.
Packit Service b38f0b
 
Packit Service b38f0b
 4.  Restart the Microsoft SNMP service.
Packit Service b38f0b
Packit Service b38f0b
 5.  Configure Net-SNMP to proxy requests to the Microsoft agent.  To have it
Packit Service b38f0b
     forward ALL requests to the Microsoft agent, add the following line to 
Packit Service b38f0b
     snmpd.conf:
Packit Service b38f0b
 
Packit Service b38f0b
       proxy  -v 1 -c public localhost:1161 .1.3
Packit Service b38f0b
 
Packit Service b38f0b
     To only forward a section of the MIB tree such as the host section, use:
Packit Service b38f0b
 
Packit Service b38f0b
       proxy  -v 1 -c public localhost:1161 host
Packit Service b38f0b
 
Packit Service b38f0b
 6.  Start the Net-SNMP agent.
Packit Service b38f0b
 
Packit Service b38f0b
     Notes: If Net-SNMP has built in support for an OID and the proxy statement
Packit Service b38f0b
            is not for a specific OID, then it will respond instead of proxying
Packit Service b38f0b
            the request.  For example, if you proxy the 'system' tree and issue
Packit Service b38f0b
            an snmpget for sysDescr.0, Net-SNMP will respond with it's own 
Packit Service b38f0b
            version of sysDescr.0 instead of forwarding it.  To prevent Net-SNMP
Packit Service b38f0b
            from doing this, you must prevent the system MIB from being 
Packit Service b38f0b
            initialized when snmpd.exe is started by specifying what MIBS to 
Packit Service b38f0b
            initialize using the -I switch.
Packit Service b38f0b
  
Packit Service b38f0b
            If you are forwarding everything to the Microsoft agent (.1.3), 
Packit Service b38f0b
            start snmpd.exe using:
Packit Service b38f0b
 
Packit Service b38f0b
              snmpd.exe -Ivacm_conf,proxy,pass,pass_persist
Packit Service b38f0b
 
Packit Service b38f0b
            The above will enable proxy, pass and pass_persist support.  See the
Packit Service b38f0b
            snmpd man page for more information on the -I switch.
Packit Service b38f0b
 
Packit Service b38f0b
            If you are forwarding a section of the tree that is not implemented
Packit Service b38f0b
            in Net-SNMP such as 'host', you do not need to use the -I switch as
Packit Service b38f0b
            Net-SNMP will forward the request.  This may cause issues in the 
Packit Service b38f0b
            future if newer versions of Net-SNMP implement the section of the
Packit Service b38f0b
            tree you are forwarding, such as the HOST-RESOURCES MIB.
Packit Service b38f0b
 
Packit Service b38f0b
            The pass and pass_persist commands will work even if the entire 
Packit Service b38f0b
            tree is proxied to the Microsoft Agent.
Packit Service b38f0b
 
Packit Service b38f0b
 7.  Test the agent.  If you have forwarded the entire tree, issue an snmpget
Packit Service b38f0b
     for sysDescr.0.  For example:
Packit Service b38f0b
 
Packit Service b38f0b
       snmpget -v 1 -c public localhost sysDescr.0
Packit Service b38f0b
 
Packit Service b38f0b
     The Microsoft agent will respond in a format similar to:
Packit Service b38f0b
 
Packit Service b38f0b
       Hardware: x86 Family 15 Model 12 Stepping 0 AT/AT COMPATIBLE - Software: 
Packit Service b38f0b
        Windows 2000 Version 5.0 (Build 2195 Uniprocessor Free)
Packit Service b38f0b
  
Packit Service b38f0b
     The Net-SNMP agent would normally respond in a format similar to:
Packit Service b38f0b
 
Packit Service b38f0b
       Windows host1 5.0.2195 Service Pack 4 2000 Server x86 Family 15 Model 12
Packit Service b38f0b
        Stepping 0
Packit Service b38f0b
Packit Service b38f0b
If you had previously configured the Microsoft agent with multiple community 
Packit Service b38f0b
strings to restrict who can read and write to the OID tree, the security
Packit Service b38f0b
settings should be transferred to snmpd.conf.  For example, if the Microsoft
Packit Service b38f0b
agent was configured with:
Packit Service b38f0b
Packit Service b38f0b
 Community              Rights
Packit Service b38f0b
 ---------------------------------
Packit Service b38f0b
 public                 read
Packit Service b38f0b
 S3cur39876             read/write
Packit Service b38f0b
 Sn0wb0ard345           read/create
Packit Service b38f0b
Packit Service b38f0b
Add the following to snmpd.conf:
Packit Service b38f0b
Packit Service b38f0b
 rocommunity  public
Packit Service b38f0b
 rwcommunity  S3cur39876
Packit Service b38f0b
 rwcommunity  Sn0wb0ard345
Packit Service b38f0b
Packit Service b38f0b
It is possible to add more granular security using Net-SNMP.  For example, to 
Packit Service b38f0b
restrict the public community string to only read the system tree, use:
Packit Service b38f0b
Packit Service b38f0b
 rocommunity  public 0.0.0.0 system
Packit Service b38f0b
Packit Service b38f0b
See the snmpd.conf man page for more information on configuring security.
Packit Service b38f0b
Packit Service b38f0b
Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
*
Packit Service b38f0b
* Installing Platform SDK
Packit Service b38f0b
*
Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
Packit Service b38f0b
If you are using Microsoft Visual Studio 6.0, you will have to install the
Packit Service b38f0b
Platform SDK (PSDK) first.
Packit Service b38f0b
Packit Service b38f0b
Once the PSDK has been installed, select the following action from the Start
Packit Service b38f0b
Menu: Programs / Microsoft Windows SDK / Visual Studio Registration / Windows
Packit Service b38f0b
SDK Configuration Tool.
Packit Service b38f0b
Packit Service b38f0b
If you are using any of the following environments, the PSDK download is not
Packit Service b38f0b
necessary as the required parts of the PSDK are included:
Packit Service b38f0b
    - Microsoft Visual Studio 2002 or later.
Packit Service b38f0b
    - Cygwin.
Packit Service b38f0b
    - MinGW.
Packit Service b38f0b
Packit Service b38f0b
In order for the process part of the host resources MIB to work under Windows
Packit Service b38f0b
NT you will need to obtain PSAPI.DLL. This is available under the download 
Packit Service b38f0b
section of www.microsoft.com.  The DLL is included with Windows 2000 and XP, 
Packit Service b38f0b
and is also part of the VC++ distribution.  
Packit Service b38f0b
Packit Service b38f0b
If you are building Net-SNMP using Cygwin, go now to "Cygwin - Building".
Packit Service b38f0b
If you are building Net-SNMP using MinGW, go now to "MinGW - Building".
Packit Service b38f0b
Otherwise, see the Building section below.
Packit Service b38f0b
Packit Service b38f0b
Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
*
Packit Service b38f0b
* Microsoft Visual C++ - Overview
Packit Service b38f0b
*
Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
Packit Service b38f0b
There are two ways to build Net-SNMP using Microsoft Visual C++.  The first
Packit Service b38f0b
and easiest method is using Configure and nmake on the command line, and the 
Packit Service b38f0b
second is using the Workspace files inside the interactive development
Packit Service b38f0b
environment.
Packit Service b38f0b
Packit Service b38f0b
To use nmake on the command line, the Configure script is run first to create
Packit Service b38f0b
the various makefiles.  Once these have been created, nmake is used to build
Packit Service b38f0b
the applications.  Perl is required to use this method, as the Configure
Packit Service b38f0b
script is written in Perl.  ActiveState ActivePerl is available at:
Packit Service b38f0b
Packit Service b38f0b
        http://www.activestate.com/Products/ActivePerl/
Packit Service b38f0b
Packit Service b38f0b
The make file system is based on and uses the directory structure of the 
Packit Service b38f0b
projects contained in the Workspace files which are described below.  It is
Packit Service b38f0b
recommended that you read and understand how the workspaces are configured
Packit Service b38f0b
even if you will only be using the command line Configure / nmake system.
Packit Service b38f0b
Packit Service b38f0b
For building via the interactive development environment, there are the Win32
Packit Service b38f0b
workspaces win32.dsw and libdll.dsw. The last workspace allows to build a DLL
Packit Service b38f0b
version of snmplib (netsnmp.dll).
Packit Service b38f0b
Packit Service b38f0b
There is one core development library ('libsnmp'), together with a number 
Packit Service b38f0b
of utility projects for the individual executable commands ('snmpget', 
Packit Service b38f0b
'snmpwalk', etc...).  All of these projects require the .lib created by 
Packit Service b38f0b
the libsnmp project.
Packit Service b38f0b
Packit Service b38f0b
The agent requires the core library plus the other two library projects
Packit Service b38f0b
('libagent' and 'netsnmpmibs') together with the main agent project ('snmpd').
Packit Service b38f0b
Packit Service b38f0b
The final application project is the trap handler 'snmptrapd'.  This also
Packit Service b38f0b
requires the agent libraries ('libagent' and 'netsnmpmibs') as well as the
Packit Service b38f0b
core development library.
Packit Service b38f0b
Packit Service b38f0b
There is a Debug version and Release version for each subproject.  This is so
Packit Service b38f0b
the Debug and Release versions of an application can be built and tested
Packit Service b38f0b
separately.
Packit Service b38f0b
Packit Service b38f0b
VC++ 6.0, 7.1, 8.0 (2005), 9.0 (2008) and 10.0 (2010) have been tested.
Packit Service b38f0b
Building with earlier Microsoft compiler versions is no longer supported.
Packit Service b38f0b
Packit Service b38f0b
Note: if you want to distribute the generated executable, you will also need
Packit Service b38f0b
to distribute the Microsoft Visual Studio Redistributable Package. Check the
Packit Service b38f0b
EULA included with that package before redistributing it.
Packit Service b38f0b
Packit Service b38f0b
OpenSSL is required to support the encryption capabilities in SNMPv3,
Packit Service b38f0b
or SHA authentication.
Packit Service b38f0b
Packit Service b38f0b
Since the MSVC build environment does not natively use "configure" nor "make"
Packit Service b38f0b
to generate the various pathnames that the programs require, the header files 
Packit Service b38f0b
need to be manually modified when using the IDE, and an install script is
Packit Service b38f0b
provided.  When using the Perl Configure / nmake system, the header files are
Packit Service b38f0b
automatically modified and require no manual editing.
Packit Service b38f0b
Packit Service b38f0b
The projects are arranged so that ALL of the usable products, the .exe files,
Packit Service b38f0b
are written to the win32\bin directory.  The win32\lib directory is used only 
Packit Service b38f0b
to build the the files in the win32\bin directory.  Once building is 
Packit Service b38f0b
completed, there is no further use for the files in the win32\lib directory.
Packit Service b38f0b
Packit Service b38f0b
Debug Information
Packit Service b38f0b
-----------------
Packit Service b38f0b
Packit Service b38f0b
Note that VC++ 6.0 has options for debugging information - the 'Program 
Packit Service b38f0b
Database'.  This option is set in the Project settings, C/C++ tab, 'General' 
Packit Service b38f0b
category, and is turned on by default during the conversion of the project 
Packit Service b38f0b
files. This option is not for use with a library, as it embeds debug 
Packit Service b38f0b
information into the library that references an external file that will 
Packit Service b38f0b
not be available to the linking application. If you get an error message 
Packit Service b38f0b
along the lines of 'debugging information not available in file vc60.pdb, 
Packit Service b38f0b
make sure the library debug option is set to 'Program Database' or "/Zi".
Packit Service b38f0b
Packit Service b38f0b
Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
*
Packit Service b38f0b
* Microsoft Visual C++ - Configure / nmake - Building
Packit Service b38f0b
*
Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
Packit Service b38f0b
There are two ways to build Net-SNMP using the Configure / nmake system.  
Packit Service b38f0b
The first and easiest method is by running the win32\build.bat script.  The
Packit Service b38f0b
second is manually running Configure and nmake.
Packit Service b38f0b
Packit Service b38f0b
Note:  Perl is required to use this method as the Configure script is 
Packit Service b38f0b
       written in Perl.  ActiveState ActivePerl is available at:
Packit Service b38f0b
Packit Service b38f0b
        http://www.activestate.com/Products/ActivePerl/
Packit Service b38f0b
Packit Service b38f0b
Packit Service b38f0b
Win32\build.bat script
Packit Service b38f0b
======================
Packit Service b38f0b
Packit Service b38f0b
The build.bat script is an easy menu driven system that allows you to select
Packit Service b38f0b
how Net-SNMP should be built, and where it should be installed.  Follow these
Packit Service b38f0b
steps to build using build.bat:
Packit Service b38f0b
Packit Service b38f0b
1.  Open a command prompt
Packit Service b38f0b
Packit Service b38f0b
2.  When building with OpenSSL, set the environment variables INCLUDE and LIB
Packit Service b38f0b
    such that these point at the proper OpenSSL directories. An example:
Packit Service b38f0b
Packit Service b38f0b
    set INCLUDE=C:\OpenSSL-Win32\include
Packit Service b38f0b
    set LIB=C:\OpenSSL-Win32\lib\VC\static
Packit Service b38f0b
Packit Service b38f0b
3.  Initialize the Visual Studio build environment by running vcvarsall.bat
Packit Service b38f0b
    which can be found in the bin folder of your Visual Studio install folder.
Packit Service b38f0b
    If you want to generate 64-bit binaries instead of 32-bit binaries, run
Packit Service b38f0b
    vcvarsall.bat with the amd64 argument. See also "How to: Enable a 64-Bit
Packit Service b38f0b
    Visual C++ Toolset at the Command Line" for more information
Packit Service b38f0b
    (http://msdn.microsoft.com/en-us/library/x4d2c09s%28v=vs.80%29.aspx).
Packit Service b38f0b
Packit Service b38f0b
4.  Run win32\build.bat
Packit Service b38f0b
Packit Service b38f0b
5.  The following screen will appear:
Packit Service b38f0b
Packit Service b38f0b
    Net-SNMP build and install options
Packit Service b38f0b
    ==================================
Packit Service b38f0b
Packit Service b38f0b
    1.  OpenSSL support:                disabled
Packit Service b38f0b
    2.  Platform SDK support:           disabled
Packit Service b38f0b
Packit Service b38f0b
    3.  Install path:                   c:/usr
Packit Service b38f0b
    4.  Install after build:            enabled
Packit Service b38f0b
Packit Service b38f0b
    5.  Perl modules:                   disabled
Packit Service b38f0b
    6.  Install perl modules:           disabled
Packit Service b38f0b
Packit Service b38f0b
    7.  Quiet build (logged):           enabled
Packit Service b38f0b
    8.  Debug mode:                     disabled
Packit Service b38f0b
Packit Service b38f0b
    9.  IPv6 transports (requires SDK): disabled
Packit Service b38f0b
    10. winExtDLL agent (requires SDK): disabled
Packit Service b38f0b
Packit Service b38f0b
    11. Link type:                      static
Packit Service b38f0b
Packit Service b38f0b
    12. Install development files       disabled
Packit Service b38f0b
Packit Service b38f0b
    F.  Finished - start build
Packit Service b38f0b
    Q.  Quit - abort build
Packit Service b38f0b
Packit Service b38f0b
    Select option to set / toggle:  
Packit Service b38f0b
Packit Service b38f0b
6.  Toggle the options on and off as desired by typing the line number 
Packit Service b38f0b
    followed by <enter>.  
Packit Service b38f0b
Packit Service b38f0b
    To compile with OpenSSL, the OpenSSL library and header files must 
Packit Service b38f0b
    already be installed.  See the section 'Microsoft Visual C++ - Building 
Packit Service b38f0b
    with OpenSSL' for details.
Packit Service b38f0b
Packit Service b38f0b
    To compile with the Platform SDK, the Platform SDK must already be 
Packit Service b38f0b
    installed.  See the section 'Installing Platform SDK' for details.
Packit Service b38f0b
Packit Service b38f0b
    To use the IPv6 transports, Windows 98 or later is required.
Packit Service b38f0b
Packit Service b38f0b
    See the section 'Running Net-SNMP as a replacement for the Microsoft 
Packit Service b38f0b
    SNMP service' for important information on using the winExtDLL agent.
Packit Service b38f0b
Packit Service b38f0b
    If Quiet mode is enabled, all build activity is stored in various *.out 
Packit Service b38f0b
    files inside of the win32 folder.
Packit Service b38f0b
Packit Service b38f0b
    When you are ready to build, type f <enter>
Packit Service b38f0b
Packit Service b38f0b
7.  Building will begin.  Following is a sample screen shot of a quiet build:
Packit Service b38f0b
Packit Service b38f0b
    Building...
Packit Service b38f0b
    
Packit Service b38f0b
    Deleting old log files...
Packit Service b38f0b
    Running Configure...
Packit Service b38f0b
    Cleaning...
Packit Service b38f0b
    Building main package...
Packit Service b38f0b
    Installing main package...
Packit Service b38f0b
    Running Configure for DLL...
Packit Service b38f0b
    Cleaning libraries...
Packit Service b38f0b
    Building DLL libraries...
Packit Service b38f0b
    Installing DLL libraries...
Packit Service b38f0b
    Cleaning Perl....
Packit Service b38f0b
    Building Perl modules...
Packit Service b38f0b
    Testing Perl modules...
Packit Service b38f0b
    Installing Perl modules...
Packit Service b38f0b
    
Packit Service b38f0b
    See perlmake.out for Perl test results
Packit Service b38f0b
    
Packit Service b38f0b
    Done!
Packit Service b38f0b
Packit Service b38f0b
8.  If the folder that Net-SNMP was installed to is ever changed, modify the 
Packit Service b38f0b
    system environment variables or registry keys as explained in the 
Packit Service b38f0b
    'Configuration_Overview.html' file located in win32/dist/htmlhelp.
Packit Service b38f0b
Packit Service b38f0b
Packit Service b38f0b
Manual build using Configure / nmake
Packit Service b38f0b
====================================
Packit Service b38f0b
Packit Service b38f0b
To build using nmake on the command line, the make files need to be generated
Packit Service b38f0b
first by the Configure script.  Following are sample steps to:
Packit Service b38f0b
Packit Service b38f0b
  -enable Platform SDK support
Packit Service b38f0b
  -enable OpenSSL support
Packit Service b38f0b
  -enable debug mode
Packit Service b38f0b
  -build Net-SNMP
Packit Service b38f0b
  -install to 'c:\usr'
Packit Service b38f0b
  -compile the Perl modules
Packit Service b38f0b
  -test the Perl modules
Packit Service b38f0b
  -install the Perl modules
Packit Service b38f0b
Packit Service b38f0b
1.  Open a command prompt
Packit Service b38f0b
Packit Service b38f0b
2.  Initialize the Visual Studio build environment by running VCVARS32.bat
Packit Service b38f0b
    which can be found in the bin folder of your Visual Studio install folder.
Packit Service b38f0b
Packit Service b38f0b
3.  Type (all on one line):
Packit Service b38f0b
Packit Service b38f0b
      perl Configure --with-sdk --with-ssl --config=debug
Packit Service b38f0b
           --prefix="c:/usr"
Packit Service b38f0b
Packit Service b38f0b
4.  The make files will be generated, and a configuration summary will appear:
Packit Service b38f0b
Packit Service b38f0b
    ---------------------------------------------------------
Packit Service b38f0b
                Net-SNMP configuration summary:
Packit Service b38f0b
    ---------------------------------------------------------
Packit Service b38f0b
    
Packit Service b38f0b
      Config type:                debug
Packit Service b38f0b
      SDK:                        enabled
Packit Service b38f0b
      Link type:                  static
Packit Service b38f0b
      Prefix / Destdir:           c:/usr
Packit Service b38f0b
      OpenSSL:                    enabled
Packit Service b38f0b
Packit Service b38f0b
5.  Type:
Packit Service b38f0b
Packit Service b38f0b
      nmake clean
Packit Service b38f0b
      nmake
Packit Service b38f0b
      nmake install
Packit Service b38f0b
Packit Service b38f0b
      perl Configure --with-sdk --with-ssl --config=debug --linktype=dynamic
Packit Service b38f0b
           --prefix="c:/usr"
Packit Service b38f0b
Packit Service b38f0b
      nmake libs_clean
Packit Service b38f0b
      nmake libs
Packit Service b38f0b
      nmake install
Packit Service b38f0b
Packit Service b38f0b
      nmake perl_clean
Packit Service b38f0b
      nmake perl
Packit Service b38f0b
      nmake perl_test
Packit Service b38f0b
      nmake perl_install
Packit Service b38f0b
Packit Service b38f0b
For a complete list of Configure options, run:
Packit Service b38f0b
Packit Service b38f0b
  perl Configure --help
Packit Service b38f0b
Packit Service b38f0b
For a complete list of possible build targets, after generating the make files
Packit Service b38f0b
using Configure, run:
Packit Service b38f0b
Packit Service b38f0b
  nmake help
Packit Service b38f0b
      
Packit Service b38f0b
Note:  The Configure option --linktype=static (or not specifying a linktype)
Packit Service b38f0b
       will result in libsnmp being compiled and all other components being 
Packit Service b38f0b
       statically linked to it.
Packit Service b38f0b
Packit Service b38f0b
       The Configure option --linktype=dynamic will result in libsnmp_dll 
Packit Service b38f0b
       (netsnmp.dll) being compiled and all other components being dynamically 
Packit Service b38f0b
       linked to it.
Packit Service b38f0b
Packit Service b38f0b
Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
*
Packit Service b38f0b
* Microsoft Visual C++ - Workspace - Building
Packit Service b38f0b
*
Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
Packit Service b38f0b
The win32.dsw and win32dll.dsw workspaces allow to build the agent and the
Packit Service b38f0b
applications. Proceed as follows:
Packit Service b38f0b
Packit Service b38f0b
1. Update the version stamp in win32\net-snmp\net-snmp-config.h.  The current
Packit Service b38f0b
   version can be found in the Unix configure script (top level folder) by 
Packit Service b38f0b
   looking for the PACKAGE_VERSION variable.
Packit Service b38f0b
Packit Service b38f0b
2. If SNMPv3 encryption capabilities or SHA authentication is required,
Packit Service b38f0b
   install the OpenSSL DLL and library file as described in the section 
Packit Service b38f0b
   'Microsoft Visual C++ - Building with OpenSSL" and then continue with 
Packit Service b38f0b
   step 2.
Packit Service b38f0b
Packit Service b38f0b
3. The default installation path is c:\usr.  This folder will contain all
Packit Service b38f0b
   the binaries, MIB files, configuration files etc.  To change the location,
Packit Service b38f0b
   the win32\net-snmp\net-snmp-config.h file needs to be modified by changing
Packit Service b38f0b
   the INSTALL_BASE variable. 
Packit Service b38f0b
Packit Service b38f0b
   Note:
Packit Service b38f0b
  
Packit Service b38f0b
     All paths in net-snmp-config.h use the "/" UNIX pathname delimiter.
Packit Service b38f0b
     If a drive letter is not specified, the current drive letter is assumed.
Packit Service b38f0b
Packit Service b38f0b
     For example: #define INSTALL_BASE "c:/usr".  
Packit Service b38f0b
Packit Service b38f0b
4.  When building DLLs instead of static libraries, *change* the following
Packit Service b38f0b
    line which is located near the top of the file:
Packit Service b38f0b
Packit Service b38f0b
        /* #undef NETSNMP_USE_DLL */
Packit Service b38f0b
Packit Service b38f0b
    *to*
Packit Service b38f0b
Packit Service b38f0b
        #define NETSNMP_USE_DLL 1
Packit Service b38f0b
Packit Service b38f0b
5. Build the agent and the applications
Packit Service b38f0b
Packit Service b38f0b
   a. Open win32.dsw (static build) or win32dll.dsw (dynamic build).
Packit Service b38f0b
   b. If you want to generate 64-bit binaries instead of 32-bit binaries,
Packit Service b38f0b
      select "Build/Configuration Manager" and add the "x64" platform.
Packit Service b38f0b
   c. Select "Build/Batch Build..."  
Packit Service b38f0b
   d. Select the projects and configurations you want to build.
Packit Service b38f0b
   e. Click "ReBuild All".
Packit Service b38f0b
   f. When building is done, View the Output window, clip and
Packit Service b38f0b
      save to a text file if there is some information to share.
Packit Service b38f0b
Packit Service b38f0b
6.  If the Perl modules are required, continue with the next section:
Packit Service b38f0b
    'Microsoft Visual C++ - Building the Perl SNMP modules'.
Packit Service b38f0b
Packit Service b38f0b
    Otherwise, continue with the section: 
Packit Service b38f0b
    'Microsoft Visual C++ - Installing'
Packit Service b38f0b
Packit Service b38f0b
Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
*
Packit Service b38f0b
* Microsoft Visual C++ - Workspace - Building the Perl SNMP modules
Packit Service b38f0b
*
Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
Packit Service b38f0b
The Perl modules should be compiled against the DLL version of snmplib.
Packit Service b38f0b
Compiling against a static version is possible, but each module will
Packit Service b38f0b
load it's own copy of the MIB, and sharing data between modules will
Packit Service b38f0b
not be possible.  For example, the conf module tests will fail.
Packit Service b38f0b
Packit Service b38f0b
1.  Complete the section 'Microsoft Visual C++ - Building' and choose for
Packit Service b38f0b
    the dynamic build.  This will build the libraries, agent and applications.
Packit Service b38f0b
Packit Service b38f0b
    Note:  SNMPD.EXE and SNMPTRAPD.EXE are required for running the tests 
Packit Service b38f0b
           against the SNMP Perl module.
Packit Service b38f0b
Packit Service b38f0b
2.  Install Net-SNMP as described in the 'Microsoft Visual C++ - Installing'
Packit Service b38f0b
    section to install the applications, the DLL and the .lib files.
Packit Service b38f0b
Packit Service b38f0b
3.  Continue with the Win32 section of the Perl README file located in 
Packit Service b38f0b
    perl\SNMP\README.
Packit Service b38f0b
Packit Service b38f0b
Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
*
Packit Service b38f0b
* Microsoft Visual C++ - Workspace - Installing
Packit Service b38f0b
*
Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
Packit Service b38f0b
The install script "win32\install-net-snmp.bat" should be run after a
Packit Service b38f0b
build is successful.  It copies the programs, MIB files, and development
Packit Service b38f0b
components to an install directory named in the INSTALL_BASE variable.
Packit Service b38f0b
Packit Service b38f0b
1.  Complete the section 'Microsoft Visual C++ - Building'. 
Packit Service b38f0b
Packit Service b38f0b
2.  Open win32\install-net-snmp.bat using a text editor.
Packit Service b38f0b
Packit Service b38f0b
    The INSTALL_BASE variable must match the INSTALL_BASE compile constant
Packit Service b38f0b
    defined in "win32\net-snmp\net-snmp-config.h", using these rules:
Packit Service b38f0b
Packit Service b38f0b
    a.  All paths in install-net-snmp.bat use the "\" DOS pathname delimiter.
Packit Service b38f0b
Packit Service b38f0b
        Example: set INSTALL_BASE="c:\usr".  
Packit Service b38f0b
Packit Service b38f0b
    b.  All paths in net-snmp-config.h use the "/" UNIX pathname delimiter.
Packit Service b38f0b
        If a drive letter is not specified, the current drive letter is 
Packit Service b38f0b
        assumed.
Packit Service b38f0b
Packit Service b38f0b
        Example: #define INSTALL_BASE "c:/usr".  
Packit Service b38f0b
Packit Service b38f0b
    Note: You may also modify "install-net-snmp.bat" in order to not install 
Packit Service b38f0b
          the linking libraries, or the header files.
Packit Service b38f0b
Packit Service b38f0b
3.  Open a command prompt window.
Packit Service b38f0b
Packit Service b38f0b
4.  Cd to the base directory where this file README.win32 is located.
Packit Service b38f0b
Packit Service b38f0b
5.  Run win32\install-net-snmp.bat to install the programs.
Packit Service b38f0b
Packit Service b38f0b
    ## sample output from install-net-snmp.bat
Packit Service b38f0b
    
Packit Service b38f0b
    NOTE: Directory already exist messages are normal. If you are
Packit Service b38f0b
          not building with OpenSSL, then DLL not found messages
Packit Service b38f0b
          are normal.
Packit Service b38f0b
    
Packit Service b38f0b
    C:\net-snmp-5.1.1>    win32\install-net-snmp
Packit Service b38f0b
    Remember to run this script from the base of the source directory.
Packit Service b38f0b
    Creating "c:\usr" sub-directories
Packit Service b38f0b
    A subdirectory or file c:\usr already exists.
Packit Service b38f0b
    A subdirectory or file c:\usr\bin already exists.
Packit Service b38f0b
    A subdirectory or file c:\usr\etc\snmp already exists.
Packit Service b38f0b
    A subdirectory or file c:\usr\share\snmp\snmpconf-data
Packit Service b38f0b
         already exists
Packit Service b38f0b
    A subdirectory or file c:\usr\share\snmp\snmpconf-data\
Packit Service b38f0b
         snmp-data already exists.
Packit Service b38f0b
    A subdirectory or file c:\usr\share\snmp\snmpconf-data\
Packit Service b38f0b
         snmpd-data already exists.
Packit Service b38f0b
    A subdirectory or file c:\usr\share\snmp\snmpconf-data\
Packit Service b38f0b
         snmptrapd-data already exists.
Packit Service b38f0b
    A subdirectory or file c:\usr\lib already exists.
Packit Service b38f0b
    A subdirectory or file c:\usr\mibs already exists.
Packit Service b38f0b
    A subdirectory or file c:\usr\include already exists.
Packit Service b38f0b
    A subdirectory or file c:\usr\include\net-snmp already 
Packit Service b38f0b
         exists
Packit Service b38f0b
    .
Packit Service b38f0b
    A subdirectory or file c:\usr\include\ucd-snmp already 
Packit Service b38f0b
         exists
Packit Service b38f0b
    .
Packit Service b38f0b
    Copying MIB files to "c:\usr"\mibs
Packit Service b38f0b
    Copying compiled programs to "c:\usr"\bin
Packit Service b38f0b
    Copying snmpconf files to "c:\usr"\share\snmp\snmpconf-
Packit Service b38f0b
         data\snmp-data
Packit Service b38f0b
    Copying link libraries to "c:\usr"\lib
Packit Service b38f0b
    Copying header files to "c:\usr"\include
Packit Service b38f0b
    Deleting debugging files from "c:\usr"
Packit Service b38f0b
    Copying DLL files to "c:\usr"
Packit Service b38f0b
    The system cannot find the file specified.
Packit Service b38f0b
    Done copying files to "c:\usr"
Packit Service b38f0b
    C:\net-snmp-5.1.1>
Packit Service b38f0b
    
Packit Service b38f0b
    ## END sample output from install-net-snmp.bat
Packit Service b38f0b
Packit Service b38f0b
6.  Add the bin folder (c:\usr\bin in the above example) to
Packit Service b38f0b
    your system path.
Packit Service b38f0b
Packit Service b38f0b
7.  Test the installation.  For a simple test to see if Net-SNMP is working, 
Packit Service b38f0b
    open a _new_ command prompt window, and type:
Packit Service b38f0b
Packit Service b38f0b
    snmptranslate -IR -Td linkDown
Packit Service b38f0b
Packit Service b38f0b
8.  If the folder that Net-SNMP was installed to is ever changed, modify the 
Packit Service b38f0b
    system environment variables or registry keys as explained in the 
Packit Service b38f0b
    'Configuration_Overview.html' file located in win32/dist/htmlhelp.
Packit Service b38f0b
Packit Service b38f0b
Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
*
Packit Service b38f0b
* Microsoft Visual C++ - Building with OpenSSL
Packit Service b38f0b
*
Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
Packit Service b38f0b
OpenSSL is required to support the encryption capabilities in SNMPv3
Packit Service b38f0b
(or SHA authentication).  The win32 version of OpenSSL can be built
Packit Service b38f0b
from the sources or you can download a pre-compiled version.
Packit Service b38f0b
Packit Service b38f0b
Building from source:
Packit Service b38f0b
=====================
Packit Service b38f0b
Packit Service b38f0b
 1. Install an assembler.  If you do not have the M$ assembler installed (MASM)
Packit Service b38f0b
    you can get a free one(NASM) from:
Packit Service b38f0b
Packit Service b38f0b
	http://www.kernel.org/pub/software/devel/nasm
Packit Service b38f0b
Packit Service b38f0b
Packit Service b38f0b
 2. Obtain the OpenSSL source from the link below. Follow instructions in 
Packit Service b38f0b
    INSTALL.W32
Packit Service b38f0b
Packit Service b38f0b
	ftp://ftp.openssl.org/source/
Packit Service b38f0b
Packit Service b38f0b
Packit Service b38f0b
 3. Once the OpenSSL libraries are built, copy the folder inc32\openssl to
Packit Service b38f0b
    C:\OpenSSL\Include\openssl and the folder out32dll to C:\OpenSSL\Lib\VC.
Packit Service b38f0b
Packit Service b38f0b
Packit Service b38f0b
Using a pre-compiled version
Packit Service b38f0b
============================
Packit Service b38f0b
Packit Service b38f0b
 1. Obtain the latest OpenSSL binary from the link below. 
Packit Service b38f0b
Packit Service b38f0b
	http://www.slproweb.com/products/Win32OpenSSL.html
Packit Service b38f0b
Packit Service b38f0b
 2. Install the package to c:\OpenSSL.
Packit Service b38f0b
Packit Service b38f0b
Packit Service b38f0b
Project changes
Packit Service b38f0b
===============
Packit Service b38f0b
Packit Service b38f0b
 1. Edit the win32\net-snmp\net-snmp-config.h header file.  Add:
Packit Service b38f0b
Packit Service b38f0b
	#define NETSNMP_USE_OPENSSL 1
Packit Service b38f0b
Packit Service b38f0b
 2. Open Visual Studio, open the Tools menu and select Options. Go to
Packit Service b38f0b
    Projects and Solutions and select VC++ Directories. Add
Packit Service b38f0b
    C:\OpenSSL\Include to the list of include directories and
Packit Service b38f0b
    C:\OpenSSL\Lib\VC to the list of library directories.
Packit Service b38f0b
Packit Service b38f0b
 3. Continue with the section 'Microsoft Visual C++ - Building"
Packit Service b38f0b
Packit Service b38f0b
Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
*
Packit Service b38f0b
* Microsoft Visual C++ - Building with IPv6
Packit Service b38f0b
*
Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
Packit Service b38f0b
The default build configuration supports SNMP over IPv4-based transports.
Packit Service b38f0b
However Windows 2000 and later include an IPv6-capable stack which
Packit Service b38f0b
can be used to provide SNMP over IPv6.  To enable IPv6, the Microsoft PSDK 
Packit Service b38f0b
is required and NETSNMP_ENABLE_IPV6 has to be enabled in
Packit Service b38f0b
win32\net-snmp\net-snmp-config.h. Change the following single line from:
Packit Service b38f0b
Packit Service b38f0b
        /* #undef NETSNMP_ENABLE_IPV6 */
Packit Service b38f0b
Packit Service b38f0b
    to:
Packit Service b38f0b
Packit Service b38f0b
       	#define NETSNMP_ENABLE_IPV6 1
Packit Service b38f0b
Packit Service b38f0b
Next, continue with the section 'Microsoft Visual C++ - Building"
Packit Service b38f0b
Packit Service b38f0b
Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
*
Packit Service b38f0b
* Microsoft Visual C++ - Building your own applications with snmplib
Packit Service b38f0b
*
Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
Packit Service b38f0b
Linking in an snmplib built to use the Multithreaded DLL runtime library to 
Packit Service b38f0b
an application configured for the Debug Multithreaded DLL runtime library 
Packit Service b38f0b
results in a link error along the lines of 'defaultlib "MSVCRT" conflicts 
Packit Service b38f0b
with use of other libs'.   If you receive a similar message, check that the
Packit Service b38f0b
projects settings between library and application match up.
Packit Service b38f0b
Packit Service b38f0b
To successfully build your existing project with Net-SNMP libraries,
Packit Service b38f0b
change the project settings FOR YOUR APPLICATION ONLY as follows:
Packit Service b38f0b
Packit Service b38f0b
   1. In the Link section, Select "Additional Libraries".
Packit Service b38f0b
      Add netsnmp.lib for Release version.
Packit Service b38f0b
      Add netsnmp_d.lib for Debug version.
Packit Service b38f0b
Packit Service b38f0b
   2. Remove all references to these libraries:
Packit Service b38f0b
      libsnmp*.lib msvcrt*.lib libc*.lib oldnames.lib
Packit Service b38f0b
Packit Service b38f0b
   3. In the C++ section, Select "Code Generation".
Packit Service b38f0b
      For Release, select /MD or "MultiThreaded DLL".
Packit Service b38f0b
      For Debug, select /MDd or "Debug MultiThreaded DLL".
Packit Service b38f0b
Packit Service b38f0b
   4. Make sure "Ignore all default libraries" is NOT SET.
Packit Service b38f0b
Packit Service b38f0b
   5. Make sure "_MBCS" is included in your pre-processor defines.
Packit Service b38f0b
Packit Service b38f0b
Note: Some users may have better results compiling other packages that use
Packit Service b38f0b
      the installed header files by removing the "mode_t" definition from
Packit Service b38f0b
      net-snmp-config.h file in the installed directories.
Packit Service b38f0b
Packit Service b38f0b
Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
*
Packit Service b38f0b
* Microsoft Visual C++ - Extending the Agent
Packit Service b38f0b
*
Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
Packit Service b38f0b
Assuming that the MIB compiler generated the my.h and my.c files for the
Packit Service b38f0b
custom MIB "my", the following changes are required to extend the agent
Packit Service b38f0b
using VC++:
Packit Service b38f0b
Packit Service b38f0b
   - Add the my.h and my.c files to your 'netsnmpmibs' project in VC++.
Packit Service b38f0b
   - Next edit the '<sourcedir>\win32\mib_module_includes.h' file to
Packit Service b38f0b
     add an include to your .h file.
Packit Service b38f0b
Packit Service b38f0b
        #include "mibgroup/my.h"
Packit Service b38f0b
Packit Service b38f0b
   - Next edit the '<sourcedir>\win32\mib_module_inits.h' file to add
Packit Service b38f0b
     code to call your initialize function.
Packit Service b38f0b
Packit Service b38f0b
        if (should_init("my")) init_my();
Packit Service b38f0b
Packit Service b38f0b
That's all that is needed. Now go ahead and compile the 'netsnmpmibs'
Packit Service b38f0b
and 'snmpd' project. And things should work just fine.
Packit Service b38f0b
Packit Service b38f0b
Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
*
Packit Service b38f0b
* GCC on Windows
Packit Service b38f0b
*
Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
Packit Service b38f0b
There are two versions of GCC (the GNU Compiler Collection) in common use on
Packit Service b38f0b
Microsoft Windows operating systems. This section will attempt to point the 
Packit Service b38f0b
user to the information required to choose the one to best suit their needs.
Packit Service b38f0b
Packit Service b38f0b
Cygwin
Packit Service b38f0b
Packit Service b38f0b
The Cygwin compiler and toolkit provides a Unix style shell and environment
Packit Service b38f0b
for Windows based systems. The cygwin1.dll provides a POSIX emulation layer 
Packit Service b38f0b
that simplifies porting Unix / Linux applications to Windows. The Cygwin dlls
Packit Service b38f0b
are required if an application is to be distributed. The dependency on the 
Packit Service b38f0b
The Cygwin tool chain and documentation can be found at:
Packit Service b38f0b
Packit Service b38f0b
http://sources.redhat.com/cygwin/
Packit Service b38f0b
Packit Service b38f0b
Packit Service b38f0b
MinGW
Packit Service b38f0b
Packit Service b38f0b
The MinGW compiler is a Windows native version of gcc. The tool chain links 
Packit Service b38f0b
against existing Windows dlls found on most systems. Binaries compiled with MinGW
Packit Service b38f0b
do not require additional libraries to be distributed. The MSyS environment 
Packit Service b38f0b
provides a shell (Bash) and tools to emulate a Unix style build environment on 
Packit Service b38f0b
Windows. The MinGW and MSyS tools and documentation can be found at:
Packit Service b38f0b
Packit Service b38f0b
http://www.mingw.org
Packit Service b38f0b
Packit Service b38f0b
Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
*
Packit Service b38f0b
* Cygwin - Building
Packit Service b38f0b
*
Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
Packit Service b38f0b
An alternate way to build and run Net-SNMP on Win32 is to use the Cygwin
Packit Service b38f0b
environment.  Detailed information about the Cygwin environment is available
Packit Service b38f0b
on the web at: http://sources.redhat.com/cygwin/.
Packit Service b38f0b
Packit Service b38f0b
Cygwin allows you to compile almost the complete agent and applications.
Packit Service b38f0b
As an example, the following configure options create a working set of
Packit Service b38f0b
programs:
Packit Service b38f0b
Packit Service b38f0b
ENV_SEPARATOR=":" \
Packit Service b38f0b
./configure \
Packit Service b38f0b
	--with-mib-modules="host agentx disman/event-mib examples/example" \
Packit Service b38f0b
	--with-out-mib-modules=host/hr_network \
Packit Service b38f0b
Packit Service b38f0b
If you want to disable SNMPv3 auth and privacy features, add:
Packit Service b38f0b
	--without-openssl \
Packit Service b38f0b
Packit Service b38f0b
If you want to use IPv6 transports, add:
Packit Service b38f0b
	--enable-ipv6
Packit Service b38f0b
Packit Service b38f0b
Note: the source code should *not* be in a folder that contains a space.
Packit Service b38f0b
For example, compiling in your 'My Documents' folder or your Desktop folder
Packit Service b38f0b
(usually c:\Documents and Settings\xxxx\Desktop) is not supported.
Packit Service b38f0b
Packit Service b38f0b
A note for Windows NT users: in order for the process part of the host
Packit Service b38f0b
resources MIB (hr_swrun) to work under Windows NT you will need to get hold
Packit Service b38f0b
of PSAPI.DLL. This DLL is available under the download section of
Packit Service b38f0b
www.microsoft.com, and is also included in the VC++ distribution.
Packit Service b38f0b
Packit Service b38f0b
If the folder that Net-SNMP was installed to is ever changed, modify the 
Packit Service b38f0b
system environment variables or registry keys as explained in the 
Packit Service b38f0b
'Configuration_Overview.html' file located in win32/dist/htmlhelp.
Packit Service b38f0b
Packit Service b38f0b
Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
*
Packit Service b38f0b
* MinGW - Building
Packit Service b38f0b
*
Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
Packit Service b38f0b
Currently the tools and agent will compile on win32 platforms using the
Packit Service b38f0b
MinGW tools with the MSyS environment. MinGW, MSyS and the associated
Packit Service b38f0b
documentation can be downloaded from: http://www.mingw.org.
Packit Service b38f0b
Packit Service b38f0b
Compiling net-snmp with MinGW requires GNU regex and libintl. Binaries and
Packit Service b38f0b
developer header files for these libraries are available at: 
Packit Service b38f0b
Packit Service b38f0b
        http://gnuwin32.sourceforge.net/packages/regex.htm
Packit Service b38f0b
        http://gnuwin32.sourceforge.net/packages/libintl.htm
Packit Service b38f0b
Packit Service b38f0b
Proceed as follows to build Net-SNMP:
Packit Service b38f0b
Packit Service b38f0b
1.  Install GNU regex and GNU libintl binaries and developer files in the
Packit Service b38f0b
    MinGW tree.
Packit Service b38f0b
Packit Service b38f0b
2.  If SNMPv3 encryption capabilities or SHA authentication is required,
Packit Service b38f0b
    install the OpenSSL DLL and library file as described in the section 
Packit Service b38f0b
    'MinGW - Building with OpenSSL" and then continue with step 3.
Packit Service b38f0b
Packit Service b38f0b
3.  Determine where you want the programs to be installed.  Currently
Packit Service b38f0b
    you must use path segments no longer than 8 characters, and no
Packit Service b38f0b
    embedded spaces are allowed. Due to limitations with Makefiles,
Packit Service b38f0b
    you must also specify the MIBDIRS default that corresponds to
Packit Service b38f0b
    a particular subtree from the base directory.
Packit Service b38f0b
Packit Service b38f0b
    Note: All paths use the "/" UNIX pathname delimiter.
Packit Service b38f0b
          Also note that embedded spaces will NOT currently work
Packit Service b38f0b
          with MinGW configure. Use the DOS 8.3 form of the path,
Packit Service b38f0b
Packit Service b38f0b
    For example:  Say that you want to install the programs in
Packit Service b38f0b
    the directory "C:\usr".  
Packit Service b38f0b
Packit Service b38f0b
    Use BASEDIR=c:/usr
Packit Service b38f0b
Packit Service b38f0b
4.  Configure net-snmp using the configure flags as shown:
Packit Service b38f0b
Packit Service b38f0b
	BASEDIR=c:/usr
Packit Service b38f0b
Packit Service b38f0b
	./configure --prefix="$BASEDIR" \
Packit Service b38f0b
		--with-mibdirs="$BASEDIR/share/snmp/mibs" \
Packit Service b38f0b
	--with-mib-modules="agentx disman/event-mib winExtDLL examples/example"\
Packit Service b38f0b
        --disable-embedded-perl --without-perl-modules \
Packit Service b38f0b
Packit Service b38f0b
    Note: while the Net-SNMP implementation of the host resources MIB is not
Packit Service b38f0b
    supported when using MinGW, winExtDLL is supported. Via winExtDLL you can
Packit Service b38f0b
    use Microsoft's implementation of the host resources MIB.
Packit Service b38f0b
Packit Service b38f0b
4.1. If you want to use IPv6 transports, add:
Packit Service b38f0b
	--enable-ipv6 --with-transports="TCPIPv6 UDPIPv6" \
Packit Service b38f0b
Packit Service b38f0b
Packit Service b38f0b
5.  Type "make" to compile the package. 
Packit Service b38f0b
Packit Service b38f0b
6.  Type "make install" to install the package.
Packit Service b38f0b
Packit Service b38f0b
7.  If the folder that Net-SNMP was installed to is ever changed, modify the 
Packit Service b38f0b
    system environment variables or registry keys as explained in the 
Packit Service b38f0b
    'Configuration_Overview.html' file located in win32/dist/htmlhelp.
Packit Service b38f0b
Packit Service b38f0b
       
Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
*
Packit Service b38f0b
* MinGW - Building with OpenSSL
Packit Service b38f0b
*
Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
Packit Service b38f0b
OpenSSL is required to support the encryption capabilities in SNMPv3
Packit Service b38f0b
(or SHA authentication).  A pre-compiled MinGW compatible version of
Packit Service b38f0b
OpenSSL is available on the Internet.
Packit Service b38f0b
Packit Service b38f0b
Follow these steps to install OpenSSL:
Packit Service b38f0b
Packit Service b38f0b
 1. Obtain the latest OpenSSL binary from the link below. 
Packit Service b38f0b
Packit Service b38f0b
	http://www.slproweb.com/products/Win32OpenSSL.html
Packit Service b38f0b
Packit Service b38f0b
 2. Install the package to c:\OpenSSL
Packit Service b38f0b
Packit Service b38f0b
 3. Copy the header and library files to the the MinGW directory:
Packit Service b38f0b
Packit Service b38f0b
    a.  Copy the c:\OpenSSL\include\openssl folder to the include folder in 
Packit Service b38f0b
        MinGW.
Packit Service b38f0b
Packit Service b38f0b
        Example: "C:\MinGW\include\openssl\*.h"
Packit Service b38f0b
Packit Service b38f0b
    b.  Copy c:\OpenSSL\lib\MinGW\libeay32.* to the lib folder in Mingw.
Packit Service b38f0b
Packit Service b38f0b
        Example: "C:\MinGW\lib\libeay32.a"
Packit Service b38f0b
        Example: "C:\MinGW\lib\libeay32.def"
Packit Service b38f0b
Packit Service b38f0b
 4. Continue with the section 'MinGW - Building"
Packit Service b38f0b
Packit Service b38f0b
Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
*
Packit Service b38f0b
* Building the Windows Net-SNMP Installer
Packit Service b38f0b
*
Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
Packit Service b38f0b
Proceed as follows:
Packit Service b38f0b
 1. Uninstall Net-SNMP.
Packit Service b38f0b
 2. Remove the C:\usr directory completely.
Packit Service b38f0b
 3. Open a command prompt
Packit Service b38f0b
 4. Run the MSVC vcvarsall.bat script.
Packit Service b38f0b
 5. Change the current working directory to the Net-SNMP win32\dist directory.
Packit Service b38f0b
 6. Run the .\build-binary.bat script.
Packit Service b38f0b
 7. Copy the net-snmp-${version}.x86.exe installer to the desired location.
Packit Service b38f0b
Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
*
Packit Service b38f0b
* Configuring Net-SNMP
Packit Service b38f0b
*
Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
Packit Service b38f0b
Online documentation is available from the Net-SNMP home page at:
Packit Service b38f0b
Packit Service b38f0b
http://www.net-snmp.org/docs/
Packit Service b38f0b
Packit Service b38f0b
All configuration files should be placed in the INSTALL_BASE\etc\snmp folder.
Packit Service b38f0b
The INSTALL_BASE folder is defined in the win32\net-snmp\net-snmp-config.h
Packit Service b38f0b
file.  For example, c:\usr\etc\snmp.
Packit Service b38f0b
Packit Service b38f0b
Included is a Perl script called snmpconf which can be used to create 
Packit Service b38f0b
configuration files.  Full documentation on using snmpconf is available from the
Packit Service b38f0b
Net-SNMP web site at the above link.
Packit Service b38f0b
Packit Service b38f0b
To run snmpconf, first modify snmpconf.bat located in the bin folder where 
Packit Service b38f0b
Net-SNMP is installed.  Modify the set MYPERLPROGRAM= line to contain the full 
Packit Service b38f0b
path to the snmpconf Perl script.  For example:
Packit Service b38f0b
Packit Service b38f0b
  set MYPERLPROGRAM=c:\usr\bin\snmpconf
Packit Service b38f0b
Packit Service b38f0b
You can now run snmpconf using the standard command line such as:
Packit Service b38f0b
Packit Service b38f0b
  snmpconf -i
Packit Service b38f0b
Packit Service b38f0b
For detailed information on using environment variables and the registry to 
Packit Service b38f0b
configure Net-SNMP, see the 'Configuration_Overview.html' file in 
Packit Service b38f0b
win32/dist/htmlhelp.
Packit Service b38f0b
Packit Service b38f0b
Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
*
Packit Service b38f0b
* How to Register the Net-SNMP Agent and Trap Daemon as Windows services
Packit Service b38f0b
*
Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
Packit Service b38f0b
The Agent (snmpd.exe) and trap daemon (snmptrapd.exe) can be run as a service
Packit Service b38f0b
under Windows operating systems that have the Service Control Manager (SCM)
Packit Service b38f0b
(Services Control Panel).  This includes Windows NT, 2000, XP and 2003.  
Packit Service b38f0b
Windows 9x/Me do not have the SCM.
Packit Service b38f0b
Packit Service b38f0b
To allow snmpd.exe or snmptrapd.exe to run as a service, the programs need
Packit Service b38f0b
to be registered with the SCM.  This is done by running the program once with
Packit Service b38f0b
the -register command line switch from a command prompt.
Packit Service b38f0b
Packit Service b38f0b
If Net-SNMP was installed using the binary available from the Net-SNMP web site,
Packit Service b38f0b
there will be shortcuts in the Start menu for registering and unregistering the 
Packit Service b38f0b
agent and snmptrapd.
Packit Service b38f0b
Packit Service b38f0b
The synopsis for registering snmpd as a Windows service is:
Packit Service b38f0b
Packit Service b38f0b
  snmpd -register [OPTIONS] [LISTENING ADDRESSES]
Packit Service b38f0b
Packit Service b38f0b
The synopsis for registering snmptrapd as a Windows service is:
Packit Service b38f0b
Packit Service b38f0b
  snmptrapd -register [OPTIONS] [LISTENING ADDRESSES]
Packit Service b38f0b
Packit Service b38f0b
After registration, the services 'Net-SNMP Agent' and 'Net-SNMP Trap Handler'
Packit Service b38f0b
will be available in the SCM.  The services can be started and stopped using 
Packit Service b38f0b
the SCM (Services Control Panel) or from the command prompt using:
Packit Service b38f0b
Packit Service b38f0b
 net start "Net-SNMP Agent"
Packit Service b38f0b
 net start "Net-SNMP Trap Handler"
Packit Service b38f0b
Packit Service b38f0b
and
Packit Service b38f0b
Packit Service b38f0b
 net stop "Net-SNMP Agent"
Packit Service b38f0b
 net stop "Net-SNMP Trap Handler"
Packit Service b38f0b
Packit Service b38f0b
If any command line options are specified after the -register option, they 
Packit Service b38f0b
will be included when the service starts.  For example, to register the
Packit Service b38f0b
snmptrapd daemon and enable logging of traps to c:\usr\log\snmptrapd.log, 
Packit Service b38f0b
enter the following command line:
Packit Service b38f0b
Packit Service b38f0b
 snmptrapd -register -Lf c:/usr/log/snmptrapd.log
Packit Service b38f0b
Packit Service b38f0b
Note:  Use Unix style slashes (/) for all paths.
Packit Service b38f0b
Packit Service b38f0b
For a complete list of command line options, consult the man pages, or use 
Packit Service b38f0b
the -h switch:
Packit Service b38f0b
Packit Service b38f0b
 snmpd -h
Packit Service b38f0b
 snmptrapd -h
Packit Service b38f0b
Packit Service b38f0b
Notes: -H will display all available snmpd.conf, snmptrapd.conf and snmp.conf
Packit Service b38f0b
       configuration file options, not the command line options.
Packit Service b38f0b
Packit Service b38f0b
       Like all Net-SNMP applications, snmpd and snmptrapd will use the 
Packit Service b38f0b
       SNMPCONFPATH and SNMPSHAREPATH environment variables when run as a 
Packit Service b38f0b
       service.  The registry is the recommended method for defining these 
Packit Service b38f0b
       variables due to a limitation in the Windows Service Control Manager 
Packit Service b38f0b
       (SCM).  When running as a service, if any system environment variables
Packit Service b38f0b
       are changed, the system will need to be rebooted to allow the services 
Packit Service b38f0b
       to access the changed environment variables (see Microsoft knowledge 
Packit Service b38f0b
       base article  821761).  Therefore, when running snmpd or snmptrapd as 
Packit Service b38f0b
       a service, if SNMPCONFPATH or SNMPSHAREPATH is changed, a reboot will 
Packit Service b38f0b
       be required after setting the environment variables, otherwise the 
Packit Service b38f0b
       services may fail to start.  Using the registry to store the environment 
Packit Service b38f0b
       variables eliminates this problem.  See the 'Configuration_Overview.html'
Packit Service b38f0b
       file in win32/dist/htmlhelp for more information on using the registry.
Packit Service b38f0b
    
Packit Service b38f0b
Packit Service b38f0b
Unregistering the services
Packit Service b38f0b
--------------------------
Packit Service b38f0b
Packit Service b38f0b
To un-register the services, use the command line switch -unregister.  For
Packit Service b38f0b
example:
Packit Service b38f0b
Packit Service b38f0b
 snmpd -unregister
Packit Service b38f0b
Packit Service b38f0b
 snmptrapd -unregister
Packit Service b38f0b
Packit Service b38f0b
Note:  Be sure to have all Service Control Panel windows closed when 
Packit Service b38f0b
       unregistering, otherwise a reboot may be required to complete
Packit Service b38f0b
       the removal.
Packit Service b38f0b
Packit Service b38f0b
Packit Service b38f0b
Modifying the services
Packit Service b38f0b
----------------------
Packit Service b38f0b
Packit Service b38f0b
To change the parameters that the SCM passes to snmpd or snmptrapd, the 
Packit Service b38f0b
service must be unregistered, and then re-registered with the new options.
Packit Service b38f0b
Packit Service b38f0b
For example, to change the parameters that SCM passes to snmpd, open a 
Packit Service b38f0b
command prompt window, CD to the directory where the snmpd program is located
Packit Service b38f0b
(unless it is already in your PATH), identify the full set of parameters you 
Packit Service b38f0b
desire, then type these two commands:
Packit Service b38f0b
Packit Service b38f0b
 snmpd -unregister
Packit Service b38f0b
 snmpd -register [OPTIONS] [LISTENING ADDRESSES]
Packit Service b38f0b
Packit Service b38f0b
Note:  Be sure to have all Service Control Panel windows closed when 
Packit Service b38f0b
       unregistering, otherwise a reboot may be required to complete
Packit Service b38f0b
       the removal.
Packit Service b38f0b
Packit Service b38f0b
Packit Service b38f0b
Registry Information
Packit Service b38f0b
--------------------
Packit Service b38f0b
Packit Service b38f0b
Warning:  Improper use of the registry editor can damage to your operating
Packit Service b38f0b
          system and should only be used by experienced users.
Packit Service b38f0b
Packit Service b38f0b
The following registry keys are used by snmpd and snmptrapd:
Packit Service b38f0b
Packit Service b38f0b
HKLM\SYSTEM\CurrentControlSet\Services\Net-SNMP Agent
Packit Service b38f0b
HKLM\SYSTEM\CurrentControlSet\Services\Net-SNMP Trap Handler
Packit Service b38f0b
       
Packit Service b38f0b
Each command line option specified when regsitering the service will be added 
Packit Service b38f0b
to the Parameters registry subkey for the service as a ParamX REG_SZ value 
Packit Service b38f0b
where X starts at 1 and increments for each additional command line option.  
Packit Service b38f0b
For example, '-Lf c:/usr/log/snmptrapd.log' would be:
Packit Service b38f0b
Packit Service b38f0b
 HKLM\SYSTEM\CurrentControlSet\Services\
Packit Service b38f0b
   Net-SNMP Trap Handler\Parameters\Param1 -Lf
Packit Service b38f0b
Packit Service b38f0b
 HKLM\SYSTEM\CurrentControlSet\Services\
Packit Service b38f0b
   Net-SNMP Trap Handler\Parameters\Param2 c:/usr/log/snmptrapd.log
Packit Service b38f0b
Packit Service b38f0b
To add additional command line switches or modify the existing ones, it is
Packit Service b38f0b
recommended to unregister and re-register the services with the new command 
Packit Service b38f0b
line options.  It is also possible to directly add or modify the ParamX values
Packit Service b38f0b
in the registry.
Packit Service b38f0b
Packit Service b38f0b
Note:  The Parameters key is only created when there is at least one command
Packit Service b38f0b
       line option specified when registering the service so it may need to be
Packit Service b38f0b
       manually added if modifying using the registry editor.
Packit Service b38f0b
Packit Service b38f0b
Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
*
Packit Service b38f0b
* Notes on SET support for WIN32 ports
Packit Service b38f0b
*
Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
Packit Service b38f0b
Requirements:
Packit Service b38f0b
Packit Service b38f0b
  Windows NT/2000/XP or later: Requires Windows NT 4.0 SP4 or later. 
Packit Service b38f0b
  Windows 95/98/Me: Requires Windows 98 or later. 
Packit Service b38f0b
Packit Service b38f0b
Windows support for SET on following groups:
Packit Service b38f0b
Packit Service b38f0b
interfaces:
Packit Service b38f0b
----------
Packit Service b38f0b
ifAdminStatus is read-write. Status can be set with either 'up' or
Packit Service b38f0b
'down'. (IE, 'testing' status is not supported.)
Packit Service b38f0b
Packit Service b38f0b
Packit Service b38f0b
ip group:
Packit Service b38f0b
--------
Packit Service b38f0b
Scalar objects: 
Packit Service b38f0b
ipForwarding:Currently windows supports only ON->OFF (IE,
Packit Service b38f0b
enable->disable). For any other value, it returns with failure.
Packit Service b38f0b
Packit Service b38f0b
ipDefaultTTL: Supports value greater than or equal to 0. 
Packit Service b38f0b
Packit Service b38f0b
Table objects:
Packit Service b38f0b
-------------
Packit Service b38f0b
1. ipRouteTable:
Packit Service b38f0b
   ------------
Packit Service b38f0b
route_write.c implements this.
Packit Service b38f0b
Packit Service b38f0b
ipRouteDest: Setting this value, updates row with new ipRouteDest and all other
Packit Service b38f0b
             entries will be same as old row. 
Packit Service b38f0b
    EX:
Packit Service b38f0b
    Consider there is an entry with ipRouteDest = 10.0.0.20
Packit Service b38f0b
    Request, snmpset localhost private ip.ipRouteTable.ipRouteEntry.ipRouteDest.10.0.0.20 -a 10.0.0.16
Packit Service b38f0b
    Updates that row with ipRouteDest = 10.0.0.16
Packit Service b38f0b
Packit Service b38f0b
ipRouteIfIndex:Write supported.
Packit Service b38f0b
Packit Service b38f0b
ipRouteMetric1: Supports value greater than or equal to -1
Packit Service b38f0b
Packit Service b38f0b
ipRouteMetric2, ipRouteMetric3, ipRouteMetric4, ipRouteMetric5: Even though
Packit Service b38f0b
		call returns with success, Windows doesn't change these (as
Packit Service b38f0b
		these are not used in Windows)
Packit Service b38f0b
Packit Service b38f0b
ipRouteNextHop: Write supported.
Packit Service b38f0b
Packit Service b38f0b
ipRouteType: Write Supported. If value is 2, IE 'invalid', it deletes the entry.
Packit Service b38f0b
Packit Service b38f0b
ipRouteAge: Whenever any row is updated this will be automatically reset.
Packit Service b38f0b
Packit Service b38f0b
ipRouteMask: Write Supported.
Packit Service b38f0b
Packit Service b38f0b
Creation of ipRouteTable row:
Packit Service b38f0b
-----------------------------
Packit Service b38f0b
snmpset request for non existent OID with ipRouteIfIndex, ipRouteMetric1, 
Packit Service b38f0b
ipRouteNextHop and ipRouteMask varbinds, creates a row.
Packit Service b38f0b
Packit Service b38f0b
snmpset with create option is not supported, as row creation requires 
Packit Service b38f0b
ipRouteIfIndex, ipRouteMetric1, ipRouteNextHop and ipRouteMask  in a single 
Packit Service b38f0b
request.
Packit Service b38f0b
Packit Service b38f0b
Example to create a row:
Packit Service b38f0b
-----------------------
Packit Service b38f0b
Consider there is no entry for 10.0.0.18
Packit Service b38f0b
Packit Service b38f0b
snmpset localhost private ip.ipRouteTable.ipRouteEntry.ipRouteIfIndex.10.0.0.18 i 2 4.21.1.ipRouteMask.10.0.0.18 a 255.255.255.255 4.21.1.ipRouteNextHop.10.0.0.0 a 10.0.0.0 4.21.1.ipRouteMetric1.10.0.0.18 i 1
Packit Service b38f0b
Packit Service b38f0b
If ipRouteIfIndex is valid then creates row with:
Packit Service b38f0b
ipRouteIfIndex = 2
Packit Service b38f0b
ipRouteMask = 255.255.255.255
Packit Service b38f0b
ipRouteNextHop = 10.0.0.0
Packit Service b38f0b
ipRouteMetric1 = 1
Packit Service b38f0b
Packit Service b38f0b
2. ipNetToMediaTable:
Packit Service b38f0b
--------------------
Packit Service b38f0b
ipNetToMediaIfIndex: write supported
Packit Service b38f0b
ipNetToMediaPhysAddress: write supported
Packit Service b38f0b
ipNetToMediaNetAddress: write supported
Packit Service b38f0b
ipNetToMediaType: write supported, setting with value 2, deletes the row.
Packit Service b38f0b
Packit Service b38f0b
Creation of row:
Packit Service b38f0b
--------------------
Packit Service b38f0b
snmpset request for non existent OID with ipNetToMediaPhysAddress varbind
Packit Service b38f0b
creates a row.
Packit Service b38f0b
Packit Service b38f0b
snmpset with create option is not supported, as row creation requires 
Packit Service b38f0b
ipNetToMediaPhysAddress in a request 
Packit Service b38f0b
request.
Packit Service b38f0b
Packit Service b38f0b
Example to create a row:
Packit Service b38f0b
-----------------------
Packit Service b38f0b
Consider there is no entry for 10.0.0.32
Packit Service b38f0b
Packit Service b38f0b
snmpset localhost private ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaPhysAddress.2.10.0.0.32 x efcd12130103
Packit Service b38f0b
Packit Service b38f0b
If ipNetToMediaIfIndex is valid then creates row with:
Packit Service b38f0b
ipNetToMediaIfIndex = 2
Packit Service b38f0b
ipNetToMediaPhysAddress = ef:cd:12:12:01:03
Packit Service b38f0b
ipNetToMediaNetAddress = 10.0.0.32
Packit Service b38f0b
ipNetToMediaType = 4
Packit Service b38f0b
Packit Service b38f0b
TCP:
Packit Service b38f0b
---
Packit Service b38f0b
tcpConnState of tcpConnTable is writable and the only value which may
Packit Service b38f0b
be set by a management station is deleteTCB(12)
Packit Service b38f0b
Packit Service b38f0b
Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
*
Packit Service b38f0b
* Notes on preprocessor defines for MSVC, MinGW and Cygwin
Packit Service b38f0b
*
Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
Packit Service b38f0b
When adding Windows specific code, one or more of the following defines should
Packit Service b38f0b
be used:
Packit Service b38f0b
Packit Service b38f0b
Define:                  Description:
Packit Service b38f0b
-------                  ------------
Packit Service b38f0b
WIN32                    Defined by MSVC & MinGW
Packit Service b38f0b
Packit Service b38f0b
_MSC_VER                 Defined by MSVC only (standard MSVC macro)
Packit Service b38f0b
Packit Service b38f0b
mingw32                  Defined by MinGW only
Packit Service b38f0b
Packit Service b38f0b
cygwin                   Defined by Cygwin only
Packit Service b38f0b
Packit Service b38f0b
HAVE_WIN32_PLATFORM_SDK  Should be defined if the Microsoft Platform SDK is
Packit Service b38f0b
                         installed and registered with MSVC or enabled for
Packit Service b38f0b
                         MinGW or Cygwin
Packit Service b38f0b
Packit Service b38f0b
MinGW and Cygwin do not require the Microsoft Platform SDK as they both should
Packit Service b38f0b
contain most if not all of the functionality provided by the SDK.  When adding
Packit Service b38f0b
code that requires the PSDK under MSVC, the following can usually be used:
Packit Service b38f0b
Packit Service b38f0b
 #if defined (HAVE_WIN32_PLATFORM_SDK) || defined (mingw32) || defined (cygwin)
Packit Service b38f0b
                         
Packit Service b38f0b
As listed above, Cygwin does NOT define WIN32.  When adding generic Windows 
Packit Service b38f0b
code that will work with MSVC, MinGW and Cygwin, the following should be used:
Packit Service b38f0b
Packit Service b38f0b
 #if defined (WIN32) || defined (cygwin)
Packit Service b38f0b
Packit Service b38f0b
  
Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
*
Packit Service b38f0b
* Acknowledgements
Packit Service b38f0b
*
Packit Service b38f0b
***************************************************************************
Packit Service b38f0b
Packit Service b38f0b
These people are known to have contributed to one or more of
Packit Service b38f0b
the Win32 platform ports.  If you have, and your name is not here,
Packit Service b38f0b
please accept our apologies, and tell us so we can add your name.
Packit Service b38f0b
Packit Service b38f0b
David Perkins, Joe Marzot, Wes Hardaker, Niels Baggesen, Dave Shield,
Packit Service b38f0b
Robert Story, Suvrit Sra, Mike Slifcak, Latha Prabhu, Nikolai Devereaux,
Packit Service b38f0b
Alex Burger, Bernhard Penz, Andy Smith and Bart Van Assche.
Packit Service b38f0b