Blame README.win32

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