AGENT++  4.0.3
mib_complex_entry.h
Go to the documentation of this file.
1 /*_############################################################################
2  _##
3  _## AGENT++ 4.0 - mib_complex_entry.h
4  _##
5  _## Copyright (C) 2000-2013 Frank Fock and Jochen Katz (agentpp.com)
6  _##
7  _## Licensed under the Apache License, Version 2.0 (the "License");
8  _## you may not use this file except in compliance with the License.
9  _## You may obtain a copy of the License at
10  _##
11  _## http://www.apache.org/licenses/LICENSE-2.0
12  _##
13  _## Unless required by applicable law or agreed to in writing, software
14  _## distributed under the License is distributed on an "AS IS" BASIS,
15  _## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  _## See the License for the specific language governing permissions and
17  _## limitations under the License.
18  _##
19  _##########################################################################*/
20 
21 
22 #ifndef _mib_complex_entry_h_
23 #define _mib_complex_entry_h_
24 
25 #include <agent_pp/mib_entry.h>
26 #include <agent_pp/mib.h>
27 
28 #ifdef AGENTPP_NAMESPACE
29 namespace Agentpp {
30 #endif
31 
32 /*------------------------ class MibComplexEntry ------------------------*/
33 
45 friend class Mib;
46 public:
57 
65 
69  virtual ~MibComplexEntry();
70 
71 
80  virtual mib_type type() const { return AGENTPP_COMPLEX; }
81 
88  virtual MibEntry* clone() = 0;
89 
103  virtual Oidx find_succ(const Oidx&, Request* req = 0) = 0;
104 
105  // interfaces dispatch table <-> management instrumentation
106 
113  virtual void get_request(Request*, int) = 0;
114 
121  virtual void get_next_request(Request*, int) = 0;
122 
131  virtual int commit_set_request(Request*, int)
132  { return SNMP_ERROR_COMITFAIL; }
133 
143  virtual int prepare_set_request(Request*, int&)
144  { return SNMP_ERROR_NOT_WRITEABLE; }
145 
154  virtual int undo_set_request(Request*, int&)
155  { return SNMP_ERROR_SUCCESS; }
156 
163  virtual void cleanup_set_request(Request*, int&) { }
164 
172  virtual bool serialize(char*&, int&) { return FALSE; }
173 
185  virtual bool deserialize(char*, int&) { return FALSE; }
186 
193  virtual bool is_empty() { return FALSE; }
194 
195 
196  // communication between mib objects
197 
206  virtual OidxPtr max_key() { return &upperBound; }
207 
208 protected:
210 };
211 
212 
213 /*------------------------ class MibStaticEntry ------------------------*/
214 
224  public:
225  MibStaticEntry(const Vbx& v): Vbx(v) { }
226  MibStaticEntry(const Oidx& o, const NS_SNMP SnmpSyntax& v): Vbx(o)
227  { set_value(v); }
228  MibStaticEntry(const MibStaticEntry& other): Vbx(other) { }
229 
230  OidxPtr key() { return (Oidx*)&iv_vb_oid; }
231 };
232 
233 /*------------------------ class MibStaticTable ------------------------*/
234 
260 #if !defined (AGENTPP_DECL_TEMPL_OIDLIST_MIBSTATICENTRY)
261 #define AGENTPP_DECL_TEMPL_OIDLIST_MIBSTATICENTRY
263 #endif
264 
266  public:
274  MibStaticTable(const Oidx&);
275 
283 
287  virtual ~MibStaticTable();
288 
295  virtual MibEntry* clone() { return new MibStaticTable(*this); }
296 
304  virtual void add(const MibStaticEntry&);
305 
312  virtual void remove(const Oidx&);
313 
330  virtual MibStaticEntry* get(const Oidx&, bool suffixOnly=FALSE);
331 
345  virtual Oidx find_succ(const Oidx&, Request* req = 0);
346 
353  virtual void get_request(Request*, int);
354 
361  virtual void get_next_request(Request*, int);
362 
363  protected:
364 
366 };
367 #ifdef AGENTPP_NAMESPACE
368 }
369 #endif
370 
371 #endif