com.adventnet.snmp.snmp2
Interface SnmpClient

All Known Implementing Classes:
SnmpRequestServer, SnmpTrapReceiver

public interface SnmpClient

This is the interface implemented by client programs that wish to use callback, authentication, and debugging functions of the API. Without implemnting this interface, synchronous requests can be used. To use asynchronous requests this interface must be implemented by the class that handles the asynchronous response.

Register your callback class that implements the SnmpClient interface using the SnmpSession.addSnmpClient(SnmpClient) method.

See Also:
SnmpSession.addSnmpClient(com.adventnet.snmp.snmp2.SnmpClient)

Method Summary
 boolean authenticate(SnmpPDU pdu, java.lang.String community)
          This function needs to be supplied by the user of the API to add authentication.
 boolean callback(SnmpSession session, SnmpPDU pdu, int requestID)
          This function needs to be supplied by the user of the API to use callbacks.
 void debugPrint(java.lang.String debugOutput)
          This function needs to be supplied by the user of the API to obtain a means of manipulating debugging output.
 

Method Detail

authenticate

public boolean authenticate(SnmpPDU pdu,
                            java.lang.String community)
This function needs to be supplied by the user of the API to add authentication. If not, no authentication will be done. If this method returns false, a message will be printed to Standard Error Output and the PDU will be dropped at the receiver end.

callback

public boolean callback(SnmpSession session,
                        SnmpPDU pdu,
                        int requestID)
This function needs to be supplied by the user of the API to use callbacks. If not, a null callback in SnmpAPI class will be used. If it returns true, no further processing will be done at the receiver, e.g. won't be in response queue. In case of multiple calbacks, if any of them returns true no further processing on PDU will occur. Callback on a client gets invoked only if the client authenticate returns true.

debugPrint

public void debugPrint(java.lang.String debugOutput)
This function needs to be supplied by the user of the API to obtain a means of manipulating debugging output. If not, the debugging output will be printed to stdout in SnmpAPI class. System.err.println will still be used for errors in either case.


Copyright (c)AdventNet Inc., 1996-2004