1 // NAME
2 // $RCSfile: GetNextPdu_vec.java,v $
3 // DESCRIPTION
4 // [given below in javadoc format]
5 // DELTA
6 // $Revision: 3.13 $
7 // CREATED
8 // $Date: 2006/11/29 16:12:50 $
9 // COPYRIGHT
10 // Westhawk Ltd
11 // TO DO
12 //
13
14 /*
15 * Copyright (C) 1995, 1996 by West Consulting BV
16 *
17 * Permission to use, copy, modify, and distribute this software
18 * for any purpose and without fee is hereby granted, provided
19 * that the above copyright notices appear in all copies and that
20 * both the copyright notice and this permission notice appear in
21 * supporting documentation.
22 * This software is provided "as is" without express or implied
23 * warranty.
24 * author <a href="mailto:snmp@westhawk.co.uk">Tim Panton</a>
25 * original version by hargrave@dellgate.us.dell.com (Jordan Hargrave)
26 */
27
28 /*
29 * Copyright (C) 1996 - 2006 by Westhawk Ltd
30 * <a href="www.westhawk.co.uk">www.westhawk.co.uk</a>
31 *
32 * Permission to use, copy, modify, and distribute this software
33 * for any purpose and without fee is hereby granted, provided
34 * that the above copyright notices appear in all copies and that
35 * both the copyright notice and this permission notice appear in
36 * supporting documentation.
37 * This software is provided "as is" without express or implied
38 * warranty.
39 * author <a href="mailto:snmp@westhawk.co.uk">Tim Panton</a>
40 */
41
42
43 package uk.co.westhawk.snmp.pdu;
44
45 /*-
46 * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲
47 * SNMP Java Client
48 * ჻჻჻჻჻჻
49 * Copyright 2023 MetricsHub, Westhawk
50 * ჻჻჻჻჻჻
51 * This program is free software: you can redistribute it and/or modify
52 * it under the terms of the GNU Lesser General Public License as
53 * published by the Free Software Foundation, either version 3 of the
54 * License, or (at your option) any later version.
55 *
56 * This program is distributed in the hope that it will be useful,
57 * but WITHOUT ANY WARRANTY; without even the implied warranty of
58 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
59 * GNU General Lesser Public License for more details.
60 *
61 * You should have received a copy of the GNU General Lesser Public
62 * License along with this program. If not, see
63 * <http://www.gnu.org/licenses/lgpl-3.0.html>.
64 * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱
65 */
66 import uk.co.westhawk.snmp.stack.*;
67 import java.lang.*;
68
69 /**
70 * <p>
71 * The GetNextPdu_vec class will ask for a number of objects (OIDs), based
72 * on the GetNext request.
73 * </p>
74 *
75 * <p>
76 * Specify with <em>addOid()</em> the OIDs that should be requested with this
77 * PDU request. No more than <em>count</em> (see constructor) should be added.
78 * Add an Observer to the PDU with <em>addObserver()</em>, and send the PDU
79 * with <em>send()</em>.
80 * </p>
81 *
82 * <p>
83 * If no exception occurred whilst receiving the response, the Object to the
84 * update() method of the Observer will be an array of
85 * varbinds, so they may contains any AsnObject type.
86 * If an exception occurred, that exception will be passed as the Object
87 * to the update() method.
88 * </p>
89 *
90 * @author <a href="mailto:snmp@westhawk.co.uk">Birgit Arkesteijn</a>
91 * @version $Revision: 3.13 $ $Date: 2006/11/29 16:12:50 $
92 * @see Pdu#addOid
93 * @see Pdu#send
94 * @see InterfaceGetNextPdu
95 * @see OneGetNextPdu
96 * @see varbind
97 */
98 public class GetNextPdu_vec extends GetNextPdu {
99 private static final String version_id = "@(#)$Id: GetNextPdu_vec.java,v 3.13 2006/11/29 16:12:50 birgit Exp $ Copyright Westhawk Ltd";
100
101 varbind[] value;
102
103 /**
104 * Constructor.
105 *
106 * @param con The context of the request
107 * @param count The number of OIDs to be get
108 */
109 public GetNextPdu_vec(SnmpContextBasisFace con, int count) {
110 super(con);
111 value = new varbind[count];
112 }
113
114 /**
115 * The value of the request is set. This will be called by
116 * Pdu.fillin().
117 *
118 * @param n the index of the value
119 * @param var the value
120 * @see Pdu#new_value
121 */
122 protected void new_value(int n, varbind var) {
123 if (n < value.length) {
124 value[n] = var;
125 }
126 }
127
128 /**
129 * This method notifies all observers.
130 * This will be called by Pdu.fillin().
131 *
132 * <p>
133 * If no exception occurred whilst receiving the response, the Object to the
134 * update() method of the Observer will be an array of
135 * varbinds, so they may contains any AsnObject type.
136 * If an exception occurred, that exception will be passed as the Object
137 * to the update() method.
138 * </p>
139 */
140 protected void tell_them() {
141 notifyObservers(value);
142 }
143 }