Custom Transport Provider

 

How to plug in your protocol implementation in the SNMP transport provider framework

  1. Provide implementation of SnmpTransportProviderapi.jpg - This class provides the open, close, read, and write implementation required for TCP/IP communication. This can be used to set up the basic communication between the SNMP entities. Reference Implementation is provided for TCP.

  2. Provide implementation of ProtocolOptionsapi.jpg - This class provides the necessary parameters needed for the protocol communication, such as the host, port etc. for TCP/IP. In case of the SNMPv3 module, this class contains the implementation of getSessionId. This is used by the v3 module to uniquely identify each session connection between the SNMP entities. Therefore for TCP/IP, this can be a combination of the destination host and port. Reference implementation provided for TCP.

  3. Provide a configuration file snmpTransport.config that contains the name of the implemented SnmpTransportProvider class. Reference file for TCP is provided in the <conf> directory.

note.jpg

Note: In the application, the following points should be taken care of while using the transport provider framework.(For actual implementation details, see examples for SNMP GET, SET, etc. for TCP/IP.)

  • After creating the session object, set the protocol to SnmpSession.TRANSPORT_PROVIDER using setProtocol method. We provide UDP/IP as the default protocol.

  • Create a ProtocolOptions object with the necessary parameters. Set this on the session object using setProtocolOptions method.

  • In case of V3 module, getSessionId should be passed as parameter instead of remotehost and remoteport (which is done in UDP/IP) in the init_v3_params method. api.jpg

  • It is mandatory for all the protocol options to be set first on the SnmpSession object before opening the session.

 

How to plug-in your protocol implementation in the SAS transport provider framework

  1. Provide implementation of the SessionTransportProviderapi.jpg for the protocol (say SSL) - This class should provide the open(), close(), read(), and write() implementation required for SSL communication. This can be used by both the SAS server and the SAS client to set up the basic communication and transfer data.

  2. Provide server side and client side implementation of the TransportProviderapi.jpg for your protocol - These classes should provide the client and server side implementation required for creating TransportProvider and any other protocol initializations, if required. After the TransportProvider objects are created, all further communication between the client and the server is handled by the TransportProvider.

  3. Register your protocol with the client side Transport provider by including the class name of the client side implementation of the TransportProvider in the applet's HTML file. For example, if the client side implementation of the TransportProvider is com.adventnet.management.transport.TcpClientTransportImpl.java, then the HTML file would contain the following line.

<PARAM NAME = "TRANSPORT_PROVIDER" VALUE="com.adventnet.management.transport.TcpClientTransportImpl">

  1. Create an instance of the server side implementation of the TransportProvider (say, com.adventnet.management.transport.TcpServerTransportImpl that implements com.adventnet.snmp.management.transport.TransportProvider)

com.adventnet.management.transport.TransportProvider myProtocol = new com.adventnet.management.transport.TcpServerTransportImpl();

  1. Register the protocol with the server's transport provider.

SAServer mySasServer = new SAServer(serverClient, sessionClientClass);

mySasServer.setSASTransportProvider(myProtocol);

 

 



Copyright © 2012, ZOHO Corp. All Rights Reserved.