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