Introduction
Introduction


Acronyms first !

SMI
Structure of Management Information, describes how managed Objects contained in the MIB are defined.
SMIV1 is described in the following RFC: RFC1155, RFC1212, RFC1215.
BER
Basic Encoding Rules, describes a method for encoding values of each SMI types as a string of bytes.
SNMP
Simple Network Management Protocol, supports a few operations: SET, GET, GET-NEXT and TRAP to manage object.
SNMPV1 is defined in RFC1157.
MIB
Management Information Base, a collection of objects representing resources to manage.

SNMP framework

SNMP framework consists of 4 parts:

SNMP is still evolving. For a better understanding of the history of this framework, you should consider reading RFC 2570 (Introduction to SNMPV3).

SCK only deals with SMIV1 and SNMPV1.

What means SCK ?

SCK is the Snmp Construction Kit, a framework designed to allow anyone to build network management applications.
SCK is available under the GNU GPL.

Construction ?

Two ways to proceed : enjoy the beans ... or write your own apps using the core snmp classes. Your first app could be a trap receiver... See it! :
import java.net.*;
import java.io.*;
import sck.*;

public class TrapReceiver{
  private final static int trapPort = 162;

  public static void main(String[] argv){
    try {
      DatagramSocket sock = new DatagramSocket(trapPort);
      while (true){
                byte[] b = new byte[1024];
        DatagramPacket p = new DatagramPacket(b,b.length);

        sock.receive(p); // block 

        ByteArrayInputStream ber = new ByteArrayInputStream(b,1,p.getLength()-1); // without tag, like all smi object !
        Message m = new Message(ber);

        System.out.println("Trap received at : " + new java.util.Date());
        StringBuffer buf = new StringBuffer();
        m.println("",buf);
        System.out.println(buf);
      }
    } 
    catch (Exception e){
        System.err.println(e);
        System.exit(1);
    }
  }
}
To make tests, you can used an snmp agent on the Internet (ex: acscare.compu-shack.com) or install SNMP on your computer, so you will be able to send requests to your favorite snmp agent (host 127.0.0.1).

You can now go to the Repository to see more examples or browse documentation: look at the SCK api doc and don't forget the class diagram.

Standards.

For a better understanding you should read:
RFC 1155
Stucture and identification of Management Information for tcp/ip based networks.
RFC 1212
Concise Mib definitions.
RFC 1215
A convention for defining traps for use with SNMP
RFC 1157
Simple Network Management Protocol.

How to contact the author ?

You can send me comments or bug reports about sck : YSoun@bigfoot.com.