View Javadoc
1   // NAME
2   //      $RCSfile: PassiveSnmpContextv2c.java,v $
3   // DESCRIPTION
4   //      [given below in javadoc format]
5   // DELTA
6   //      $Revision: 3.10 $
7   // CREATED
8   //      $Date: 2009/03/05 13:12:50 $
9   // COPYRIGHT
10  //      ERG Group Ltd
11  // TO DO
12  //
13  
14  /*
15   * Copyright (C) 2001 by ERG Group Ltd
16   * <a href="www.erggroup.com">www.erggroup.com</a>
17   *
18   * Permission to use, copy, modify, and distribute this software
19   * for any purpose and without fee is hereby granted, provided
20   * that the above copyright notices appear in all copies and that
21   * both the copyright notice and this permission notice appear in
22   * supporting documentation.
23   * This software is provided "as is" without express or implied
24   * warranty.
25   * author <a href="mailto:mwaters@erggroup.com">Mike Waters</a>
26   */
27  
28  
29  package uk.co.westhawk.snmp.stack;
30  
31  /*-
32   * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲
33   * SNMP Java Client
34   * ჻჻჻჻჻჻
35   * Copyright 2023 MetricsHub, Westhawk
36   * ჻჻჻჻჻჻
37   * This program is free software: you can redistribute it and/or modify
38   * it under the terms of the GNU Lesser General Public License as
39   * published by the Free Software Foundation, either version 3 of the
40   * License, or (at your option) any later version.
41   *
42   * This program is distributed in the hope that it will be useful,
43   * but WITHOUT ANY WARRANTY; without even the implied warranty of
44   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
45   * GNU General Lesser Public License for more details.
46   *
47   * You should have received a copy of the GNU General Lesser Public
48   * License along with this program.  If not, see
49   * <http://www.gnu.org/licenses/lgpl-3.0.html>.
50   * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱
51   */
52  
53  /**
54   * This class contains the SNMP v2c context that is needed by every Pdu to
55   * send a SNMP v2c request in environments where thread creation is
56   * unwanted.
57   *
58   * <p>
59   * This extends SnmpContextv2c so that it does not create any
60   * threads to send PDUs. It must be used with the
61   * PDU class PassiveTrapPduv2. The original purpose of the
62   * Passive classes is to allow the stack to be used in environments where
63   * thread creation is unwanted, eg database JVMs such as Oracle JServer.
64   * See <a href="http://www.ietf.org/rfc/rfc3416.txt">SNMPv2-PDU</a>.
65   * </p>
66   *
67   * <p>
68   * See 
69   * <a
70   * href="../../../../../uk/co/westhawk/nothread/trap/package-summary.html">notes</a>
71   * on how to send traps in an Oracle JServer environment.
72   * </p>
73   *
74   * @see uk.co.westhawk.snmp.pdu.PassiveTrapPduv2
75   * @since 4_12
76   *
77   * @author Mike Waters, <a href="www.erggroup.com">ERG Group</a>
78   * @version $Revision: 3.10 $ $Date: 2009/03/05 13:12:50 $
79   */
80  public class PassiveSnmpContextv2c extends SnmpContextv2c {
81      private static final String version_id = "@(#)$Id: PassiveSnmpContextv2c.java,v 3.10 2009/03/05 13:12:50 birgita Exp $ Copyright Westhawk Ltd";
82  
83      /**
84       * Constructor.
85       *
86       * @param host The host to which the Pdu will be sent
87       * @param port The port where the SNMP server will be
88       * @see SnmpContextv2c#SnmpContextv2c(String, int)
89       */
90      public PassiveSnmpContextv2c(String host, int port)
91              throws java.io.IOException {
92          super(host, port);
93      }
94  
95      /**
96       * Constructor.
97       * Parameter typeSocketA should be either STANDARD_SOCKET, TCP_SOCKET or a
98       * fully qualified classname.
99       *
100      * @param host        The host to which the Pdu will be sent
101      * @param port        The port where the SNMP server will be
102      * @param typeSocketA The type of socket to use.
103      *
104      * @see SnmpContextv2c#SnmpContextv2c(String, int, String)
105      * @see SnmpContextBasisFace#STANDARD_SOCKET
106      * @see SnmpContextBasisFace#TCP_SOCKET
107      */
108     public PassiveSnmpContextv2c(String host, int port, String typeSocketA)
109             throws java.io.IOException {
110         super(host, port, typeSocketA);
111     }
112 
113     /**
114      * Constructor.
115      *
116      * If bindAddress is null, then the system will pick up a valid local
117      * address to bind the socket.
118      *
119      * The typeSocketA will indicate which type of socket to use. This way
120      * different handlers can be provided.
121      * It should be either STANDARD_SOCKET, TCP_SOCKET or a
122      * fully qualified classname.
123      *
124      * @param host        The host to which the Pdu will be sent
125      * @param port        The port where the SNMP server will be
126      * @param bindAddress The local address the server will bind to
127      * @param typeSocketA The type of socket to use.
128      *
129      * @exception java.io.IOException Thrown when the socket cannot be
130      *                                created.
131      *
132      * @see SnmpContextBasisFace#STANDARD_SOCKET
133      * @see SnmpContextBasisFace#TCP_SOCKET
134      */
135     protected PassiveSnmpContextv2c(String host, int port, String bindAddress, String typeSocketA)
136             throws java.io.IOException {
137         super(host, port, bindAddress, typeSocketA);
138     }
139 
140     /**
141      * Overrides the AbstractSnmpContext.activate() to do nothing.
142      * This prevents the creation of threads in the base class.
143      *
144      * @see AbstractSnmpContext#activate()
145      */
146     protected void activate() {
147         // do nothing
148     }
149 
150 }