# FAQ on Westhawk's SNMP stack

This file is part of the stack's distribution and is available online as well. The links in this document should work in the former case, but not necessarily in the later case.

### Basic questions:

Where can I download the stack from?
Where can I get more information on how to use your stack?
Where can I find examples on how to use the stack?
How do I compile the stack?
Which version of the JDK should I use?

### Usage questions:

What functionality does the stack offer?
Can I write an agent with your stack?
Does the stack have any MIB browser functionality?
How do I create an ASN.1 IP Address object?
How can I set the timeout and the number of retries of a request?

### Problem solving:

Why doesn't the number of threads reduce?
I get errors like `AsnObject.AsnMakeMe(): Bad Type 0xA6`. What do they mean?
My user interface seems to hang. Any idea?

### General information:

How did you test your stack?
Is the stack vulnerable to malformed requests?
Where can I find more information on SNMP?
What about copyright, license and costs?
Which companies are using this stack?

### Basic questions:

Where can I download the stack from?

The latest version is available from our website.

Where can I get more information on how to use your stack?

Please read this FAQ, the Stack Usage document, the javadoc and have a look at the examples that are distributed with the stack.

We do not have a mailing list, a buglist, nor do we have a todo list. We are thinking about realising all of these, but have not done so yet.

If your question is not answered by any of our documentation, you can contact us at snmp@westhawk.co.uk. We will answer when our resources permit us to do so. When emailing us, please consider the following:

- Useful Subject. Please give your email a useful subject. Help or Question do not tell us the nature of your problem or request.
- Be Precise. Please tell us precisely what you are doing, and precisely what is happening. Please mention:

- any error messages or exception trace
- JDK version, Platform, Stack version

- Be Polite. The stack is free, so please realise we have no obligation to answer your questions. Aggressive language, excessive use of capitals, and multiple exclamation points or question marks are all considered rude and are not appreciated.
- Tell Us Your Name. It feels good to know who we are talking to.

Where can I find examples on how to use the stack?

The packages uk.co.westhawk.examplev1, uk.co.westhawk.examplev2c and uk.co.westhawk.examplev3 contain examples. The Stack Usage document explains how to configure and run them.

How do I compile the stack?

Unless you want to change our code, there is no need to compile the whole stack. All the `uk.westhawk.snmp.XX` packages are bundled in the `snmp<version>.jar` file. You will have to compile the examples, if you want to run them.

The stack comes with Makefiles. We use `make` on Linux to compile the stack. `make` will work on Linux, (hopefully) on other UNIX flavours and maybe under cygwin as well.

However, the best thing to do is to import the package(s) and/or example(s) into your favourite IDE, like JBuilder or Forte, and take it from there. You should be able to add the `snmp<version>.jar` file to the library of your IDE.

Which version of the JDK should I use?

You will be fine with every version of the JavaTM 2 Platform. The stack is compiled with JDK 1.3.0, except for the packages uk.co.westhawk.nothread.oscar and uk.co.westhawk.nothread.trap. These two packages use JDK 1.2.2.

### Usage questions:

What functionality does the stack offer?

The stack provides manager functionality for SNMPv1, SNMPv2c and SNMPv3 (both authentication and privacy). It is capable of sending and receiving traps, but has no other agent functionality.

PDU type | Sending | Receiving
Get Request | Yes | No
GetNext Request | Yes | No
Set Request | Yes | No
GetBulk Request | Yes | No
Inform Request | Yes | No
Response | No | Yes
Trap v1 | Yes | Yes
Trap v2 | Yes | Yes
Report | No | No

Can I write an agent with your stack?

There are two bits to doing an agent framework:

1. The protocol stuff
2. The MIB stuff

1. is relatively easy - we are about half way there, in that we already have most of the bits (TrapListener, PDU, decoder, encoder etc.). They would just need to be put together.
2. is much more tricky - for a 'generic' agent framework you want a tool that takes a MIB and creates a heap of java that will return the right types for a given OID. It also needs to generate stub methods which are then implemented (i.e. go off and get the real value from the correct hardware register or whatever).

Does the stack have any MIB browser functionality?

No. The idea is to write dedicated PDUs or beans that gather specific MIB information, i.e. the OID (Object Identifier) is hard coded.

We use Scotty, that is based on Tk/Tcl. We have experimented with auto generating a Java source file of a PDU or bean out off a MIB file, using smidump (libsmi), the Xalan XSLT and Xerces. You can find this in the `stubs` directory.

How do I create an ASN.1 IP Address object?

You can use one of the following two AsnOctets constructors:

1. AsnOctets(byte[] s, byte t), where t = SnmpConstants.IPADDRESS
2. AsnOctets(java.net.InetAddress iad)

How can I set the timeout and the number of retries of a request?

You can set both with the method Pdu.setRetryIntervals(int[]).

### Problem solving:

Why doesn't the number of threads reduce?

Make sure you call `AbstractSnmpContext.destroy()` when you are finished with a context. The method `AbstractSnmpContext.getDebugString()` returns the thread usage of the context.

I get errors like `AsnObject.AsnMakeMe(): Bad Type 0xA6`. What do they mean?

This means that the PDU packet is malformed. Either the engine sent a malformed packet or the stack did not read in the whole message. The later can be tuned with the method `AbstractSnmpContext.setMaxRecvSize(int no)`.

My user interface seems to hang. Any idea?

If you are using Swing and you are changing your user interface in the `update()` or `propertyChange()` method, you should do this via `Swing.InvokeLater()` to make sure the update is done on the Swing thread. See AnnexModemStatusBean.java for an example.

### General information:

How did you test your stack?

We have tested the v3 implementation against MG-SOFT's agent and NET-SNMP (formerly known as UCD-SNMP). Our users have used it against many other agents. As far as we know there is no standards body that tests SNMPv3 compliance.

The test matrices on our last version is included in the distribution file, see test.html and trap.html. More information on how the test works can be found in the javadoc.

Is the stack vulnerable to malformed requests?

Since the stack is written in Java and Java is immune to most types of buffer overrun, we are far better off than the C-based stacks.

We did run the PROTOS test suite against our stack. This caused some problems whilst decoding the packets. The worse one caused the stack to throw ClassCastExceptions, killing the receive thread. We amended the stack (version 4_12) so it catches all exceptions. Other packets only produced error messages.

The bulk of the vulnerabilities are against agents, our stack is only a manager. If we ever extend the stack to become an agent, we will run the test suite again.

Where can I find more information on SNMP?

Please read the section in the Stack Usage document.

What about copyright, license and costs?

Please read the section in the Stack Usage document.

Which companies are using this stack?

That is a little hard to say, since many use it for internal purposes (or indeed in products) without informing us. Here are some links to companies we know have used it:

- Adherent, now part of Tektronix Cambridge
- Advent Communications
- Arsin
- Aspect
- Avitech
- BBN Technologies
- Bell Labs
- Cisco Systems
- Cygsoft
- ERG Group
- Greenpacket
- Imagine Broadband
- Intel
- Iskratel
- memIQ
- NET2S
- Netopia
- New Break
- Phonologies
- ProvisionSoft
- RegulusSoft
- Reuters
- Riftware Development
- Siemens
- Spawar
- Sterling Commerce
- TCOM
- Travelocity
- Tripwire
- Virtual Technology
- Visionael
- VoIP
- Westpoint
- Zuma Networks

11 Nov 2002