View Javadoc
1   // NAME
2   //      $RCSfile: PassiveTrapPduv1.java,v $
3   // DESCRIPTION
4   //      [given below in javadoc format]
5   // DELTA
6   //      $Revision: 3.7 $
7   // CREATED
8   //      $Date: 2006/03/23 14:54:09 $
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.pdu;
29  
30  /*-
31   * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲
32   * SNMP Java Client
33   * ჻჻჻჻჻჻
34   * Copyright 2023 MetricsHub, 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  import uk.co.westhawk.snmp.stack.*;
52  
53  /**
54   * This class represents the ASN SNMP v1 Trap PDU object
55   * that does not create a thread to send itself. It must be used with the
56   * context class PassiveSnmpContext. The original purpose of the
57   * Passive classes is to allow the stack to be used in environments where
58   * thread creation is unwanted, eg database JVMs such as Oracle JServer.
59   * See <a href="http://www.ietf.org/rfc/rfc3416.txt">SNMPv2-PDU</a>.
60   *
61   * <p>
62   * See 
63   * <a
64   * href="../../../../../uk/co/westhawk/nothread/trap/package-summary.html">notes</a>
65   * on how to send traps in an Oracle JServer environment.
66   * </p>
67   *
68   * @see PassiveTrapPduv2
69   * @since 4_12
70   *
71   * @author <a href="mailto:snmp@westhawk.co.uk">Birgit Arkesteijn</a>
72   * @version $Revision: 3.7 $ $Date: 2006/03/23 14:54:09 $
73   */
74  public class PassiveTrapPduv1 extends TrapPduv1 {
75      private static final String version_id = "@(#)$Id: PassiveTrapPduv1.java,v 3.7 2006/03/23 14:54:09 birgit Exp $ Copyright ERG Group Ltd";
76  
77      /**
78       * Constructor.
79       *
80       * @param con The context (v1) of the PDU.
81       *            This is of type PassiveSnmpContext to ensure that the correct
82       *            threading
83       *            behaviour occurs.
84       */
85      public PassiveTrapPduv1(PassiveSnmpContext con) {
86          super(con);
87  
88          // this makes the base class PDU believe that the trap is already
89          // awaiting transmission therefore it does not create a transmitter
90          // for this pdu
91          added = true;
92      }
93  
94      /**
95       * Override of the operation in PDU. Send the trap in the
96       * callers thread. That is, don't create a sending thread
97       * or add it to a queue or anything, just go straight to the socket.
98       */
99      public void addToTrans() {
100         sendme();
101     }
102 
103 }