1 // NAME
2 // $RCSfile: DecodedPduEvent.java,v $
3 // DESCRIPTION
4 // [given below in javadoc format]
5 // DELTA
6 // $Revision: 1.5 $
7 // CREATED
8 // $Date: 2006/02/09 14:30:18 $
9 // COPYRIGHT
10 // Westhawk Ltd
11 // TO DO
12 //
13
14 /*
15 * Copyright (C) 2005 - 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 package uk.co.westhawk.snmp.event;
28
29 /*-
30 * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲
31 * SNMP Java Client
32 * ჻჻჻჻჻჻
33 * Copyright 2023 MetricsHub, Westhawk
34 * ჻჻჻჻჻჻
35 * This program is free software: you can redistribute it and/or modify
36 * it under the terms of the GNU Lesser General Public License as
37 * published by the Free Software Foundation, either version 3 of the
38 * License, or (at your option) any later version.
39 *
40 * This program is distributed in the hope that it will be useful,
41 * but WITHOUT ANY WARRANTY; without even the implied warranty of
42 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
43 * GNU General Lesser Public License for more details.
44 *
45 * You should have received a copy of the GNU General Lesser Public
46 * License along with this program. If not, see
47 * <http://www.gnu.org/licenses/lgpl-3.0.html>.
48 * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱
49 */
50
51 import uk.co.westhawk.snmp.stack.*;
52
53
54 /**
55 * The DecodedPduEvent class. This class is delivered when a pdu is received.
56 *
57 * @since 4_14
58 * @author <a href="mailto:snmp@westhawk.co.uk">Birgit Arkesteijn</a>
59 * @version $Revision: 1.5 $ $Date: 2006/02/09 14:30:18 $
60 */
61 public abstract class DecodedPduEvent extends java.util.EventObject {
62 private static final String version_id = "@(#)$Id: DecodedPduEvent.java,v 1.5 2006/02/09 14:30:18 birgit Exp $ Copyright Westhawk Ltd";
63
64 protected boolean consumed = false;
65
66 private int hostPort = -1;
67 private Pdu pdu;
68
69 /**
70 * The constructor for a decoded pdu event. The SnmpContext classes
71 * will fire decoded pdu events.
72 *
73 * @param source The source (SnmpContext) of the event
74 * @param p The pdu
75 * @param prt The remote port number of the host where the pdu came from
76 *
77 * @see #getHostPort()
78 * @see #getPdu()
79 */
80 public DecodedPduEvent(Object source, Pdu p, int prt) {
81 super(source);
82 pdu = p;
83 hostPort = prt;
84 }
85
86 /**
87 * The remote port number of the host where the pdu came from.
88 *
89 * @return The remote port number of the host or -1.
90 *
91 */
92 public int getHostPort() {
93 return hostPort;
94 }
95
96 /**
97 * The pdu. The pdu is part of a decoded pdu event.
98 *
99 * @return The decoded Pdu.
100 */
101 public Pdu getPdu() {
102 return pdu;
103 }
104
105 /**
106 * Consumes this event so that it will not be sent to any other
107 * listeners.
108 */
109 public void consume() {
110 consumed = true;
111 }
112
113 /**
114 * Returns whether or not this event has been consumed.
115 *
116 * @see #consume
117 */
118 public boolean isConsumed() {
119 return consumed;
120 }
121
122 }