All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sun.jaw.snmp.common.SnmpPduFactory

java.lang.Object
   |
   +----com.sun.jaw.snmp.common.SnmpPduFactory

public class SnmpPduFactory
extends Object
implements SnmpPduFactoryIf
The SnmpPduFactory is the default implementation of the SnmpPduFactoryIf interface.

You normally don't need to use this class except if you decide to implement your own SnmpPduFactoryIf object.

This implementation of SnmpPduFactoryIf is very basic: it simply calls encoding and decoding methods from SnmpMessage.

 public SnmpPduPacket decodePdu(SnmpMessage msg) 
 throws SnmpStatusException {
   return msg.decodePdu() ;
 }
 public SnmpMessage encodePdu(SnmpPduPacket pdu, int maxPktSize)
 throws SnmpStatusException, SnmpTooBigException {
   SnmpMessage result = new SnmpMessage() ;
   result.encodePdu(pdu, maxPktSize) ;
   return result ;
 }
 
To implement your own object, you can implement SnmpPduFactoryIf or extend SnmpPduFactory.


Constructor Index

 o SnmpPduFactory()

Method Index

 o decodePdu(SnmpMessage)
Calls SnmpMessage.decodePdu on the specified message and returns the resulting SnmpPduPacket.
 o encodePdu(SnmpPduPacket, int)
Calls SnmpMessage.encode on the specified SnmpPduPacket and returns the resulting SnmpMessage.

Constructors

 o SnmpPduFactory
 public SnmpPduFactory()

Methods

 o decodePdu
 public SnmpPduPacket decodePdu(SnmpMessage msg) throws SnmpStatusException
Calls SnmpMessage.decodePdu on the specified message and returns the resulting SnmpPduPacket.

Parameters:
msg - the SnmpMessage to be decoded
Returns:
the resulting SnmpPduPacket
Throws: SnmpStatusException
if the encoding is invalid
 o encodePdu
 public SnmpMessage encodePdu(SnmpPduPacket pdu,
                              int maxPktSize) throws SnmpStatusException, SnmpTooBigException
Calls SnmpMessage.encode on the specified SnmpPduPacket and returns the resulting SnmpMessage.

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

All Packages  Class Hierarchy  This Package  Previous  Next  Index