All Packages  Class Hierarchy  This Package  Previous  Next  Index

Interface com.sun.jaw.snmp.common.SnmpPduFactoryIf

public interface SnmpPduFactoryIf
The SnmpPduFactoryIf defines the interface of the object in charge of encoding and decoding SNMP packets.

You normally don't need to use this interface except if you decide to replace the default implementation SnmpPduFactory.

An SnmpPduFactoryIf object is attached to an AdaptorServerImpl or an SnmpPeer. It is used each time an SNMP packet needs to be encoded or decoded. SnmpPduFactory is the default implementation. It simply applies the standard ASN.1 encoding and decoding on the bytes of the SNMP packet.

It's possible to implement its own SnmpPduFactoryIf object and to add authentication and/or encryption to the default encoding/decoding process.

See Also:
SnmpPduFactory, SnmpPduPacket, SnmpMessage

Method Index

 o decodePdu(SnmpMessage)
Decodes the specified SnmpMessage and returns the resulting SnpmPduPacket.
 o encodePdu(SnmpPduPacket, int)
Encodes the specified SnmpPduPacket and returns the resulting SnmpMessage.

Methods

 o decodePdu
 public abstract SnmpPduPacket decodePdu(SnmpMessage msg) throws SnmpStatusException
Decodes the specified SnmpMessage and returns the resulting SnpmPduPacket. If this method returns null, the message will be considered unsafe and will be drop.

Parameters:
msg - the SnmpMessage to be decoded
Returns:
null or a fully initialized SnmpPduPacket
Throws: SnmpStatusException
if the encoding is invalid.
 o encodePdu
 public abstract SnmpMessage encodePdu(SnmpPduPacket pdu,
                                       int maxPktSize) throws SnmpStatusException, SnmpTooBigException
Encodes the specified SnmpPduPacket and returns the resulting SnmpMessage. If this method returns null, the specified SnmpPduPacket will be dropped and the current SNMP request will be aborted.

Parameters:
pdu - the SnmpPduPacket to be encoded
maxPktSize - the size limit of the resulting encoding
Returns:
null or a fully encoded SnmpMessage
Throws: SnmpStatusException
if pdu contains illegal values and cannot be encoded.
Throws: SnmpTooBigException
if the resulting encoding does fit in maxPktSize bytes.

All Packages  Class Hierarchy  This Package  Previous  Next  Index