1 // NAME
2 // $RCSfile: GetPdu_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 /*
30 * Copyright (C) 1996 - 2006 by Westhawk Ltd
31 * <a href="www.westhawk.co.uk">www.westhawk.co.uk</a>
32 *
33 * Permission to use, copy, modify, and distribute this software
34 * for any purpose and without fee is hereby granted, provided
35 * that the above copyright notices appear in all copies and that
36 * both the copyright notice and this permission notice appear in
37 * supporting documentation.
38 * This software is provided "as is" without express or implied
39 * warranty.
40 * author <a href="mailto:snmp@westhawk.co.uk">Tim Panton</a>
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 GetPdu_vec class will ask for a number of objects (OIDs), based
72 * on the Get 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 varbind
95 * @see OneIntPdu
96 */
97 public class GetPdu_vec extends GetPdu {
98 private static final String version_id = "@(#)$Id: GetPdu_vec.java,v 3.13 2006/11/29 16:12:50 birgit Exp $ Copyright Westhawk Ltd";
99
100 varbind[] value;
101
102 /**
103 * Constructor.
104 *
105 * @param con The context of the request
106 * @param count The number of OIDs to be get
107 */
108 public GetPdu_vec(SnmpContextBasisFace con, int count) {
109 super(con);
110 value = new varbind[count];
111 }
112
113 /**
114 * The value of the request is set. This will be called by
115 * Pdu.fillin().
116 *
117 * @param n the index of the value
118 * @param var the value
119 * @see Pdu#new_value
120 */
121 protected void new_value(int n, varbind var) {
122 if (n < value.length) {
123 value[n] = var;
124 }
125 }
126
127 /**
128 * This method notifies all observers.
129 * This will be called by Pdu.fillin().
130 *
131 * <p>
132 * If no exception occurred whilst receiving the response, the Object to the
133 * update() method of the Observer will be an array of
134 * varbinds, so they may contains any AsnObject type.
135 * If an exception occurred, that exception will be passed as the Object
136 * to the update() method.
137 * </p>
138 */
139 protected void tell_them() {
140 notifyObservers(value);
141 }
142 }