SNMP++  3.3.4
oid.h
Go to the documentation of this file.
1 /*_############################################################################
2  _##
3  _## oid.h
4  _##
5  _## SNMP++ v3.3
6  _## -----------------------------------------------
7  _## Copyright (c) 2001-2013 Jochen Katz, Frank Fock
8  _##
9  _## This software is based on SNMP++2.6 from Hewlett Packard:
10  _##
11  _## Copyright (c) 1996
12  _## Hewlett-Packard Company
13  _##
14  _## ATTENTION: USE OF THIS SOFTWARE IS SUBJECT TO THE FOLLOWING TERMS.
15  _## Permission to use, copy, modify, distribute and/or sell this software
16  _## and/or its documentation is hereby granted without fee. User agrees
17  _## to display the above copyright notice and this license notice in all
18  _## copies of the software and any documentation of the software. User
19  _## agrees to assume all liability for the use of the software;
20  _## Hewlett-Packard and Jochen Katz make no representations about the
21  _## suitability of this software for any purpose. It is provided
22  _## "AS-IS" without warranty of any kind, either express or implied. User
23  _## hereby grants a royalty-free license to any and all derivatives based
24  _## upon this software code base.
25  _##
26  _##########################################################################*/
27 /*===================================================================
28 
29  Copyright (c) 1999
30  Hewlett-Packard Company
31 
32  ATTENTION: USE OF THIS SOFTWARE IS SUBJECT TO THE FOLLOWING TERMS.
33  Permission to use, copy, modify, distribute and/or sell this software
34  and/or its documentation is hereby granted without fee. User agrees
35  to display the above copyright notice and this license notice in all
36  copies of the software and any documentation of the software. User
37  agrees to assume all liability for the use of the software; Hewlett-Packard
38  makes no representations about the suitability of this software for any
39  purpose. It is provided "AS-IS without warranty of any kind,either express
40  or implied. User hereby grants a royalty-free license to any and all
41  derivatives based upon this software code base.
42 
43 
44  SNMP++ O I D. H
45 
46  OID CLASS DEFINITION
47 
48  DESIGN + AUTHOR: Peter E Mellquist
49 
50  DESCRIPTION:
51  This class is fully contained and does not rely on or any other
52  SNMP libraries. This class is portable across any platform
53  which supports C++.
54 
55 =====================================================================*/
56 // $Id: oid.h 2359 2013-05-09 20:07:01Z fock $
57 
58 #ifndef _OID_H_
59 #define _OID_H_
60 
61 #include <libsnmp.h>
62 
63 //------------------------------------------------------------------------
64 
65 #include "snmp_pp/smival.h" // derived class for all values
66 #include "snmp_pp/collect.h"
67 
68 #ifdef SNMP_PP_NAMESPACE
69 namespace Snmp_pp {
70 #endif
71 
72 
73 /**
74  * The Object Identifier Class.
75  *
76  * The Object Identification (Oid) class is the encapsulation of an
77  * SMI object identifier. The SMI object is a data identifier for a
78  * data element found in a Management Information Base (MIB), as
79  * defined by a MIB definition. The SMI Oid, its related structures
80  * and functions, are a natural fit for object orientation. In fact,
81  * the Oid class shares many common features to the C++ String
82  * class. For those of you familiar with the C++ String class or
83  * Microsoft's Foundation Classes (MFC) CString class, the Oid class
84  * will be familiar and easy to use. The Oid class is designed to be
85  * efficient and fast. The Oid class allows definition and
86  * manipulation of object identifiers.
87  *
88  * @note Oid holds two internal buffers for get_printable() functions.
89  * The buffer returned by get_printable() is valid until the
90  * Oid object is modified. The functions get_printable(len) and
91  * get_printable(start, len) share the same buffer which is
92  * freed and newly allocated for each call.
93  */
94 class DLLOPT Oid : public SnmpSyntax
95 {
96  public:
97 
98  /**
99  * Construct an invalid Oid.
100  */
101  Oid()
102  : iv_str(0)
103  , iv_part_str(0)
104  , m_changed(true)
105  {
106  smival.syntax = sNMP_SYNTAX_OID;
107  smival.value.oid.len = 0;
108  smival.value.oid.ptr = 0;
109  }
110 
111  /**
112  * Construct an Oid from a string.
113  *
114  * Depending on the second param, the oid_string can either be
115  * - a dotted oid string (like "1.3.6.1.6"). An arbitrary part
116  * of the oid can be given as a string value enclosed in
117  * '$' characters. For example the oid string
118  * "1.3.6.1.6.1.12.1.3.$public_0$" will result to the oid
119  * 1.3.6.1.6.1.12.1.3.112.117.98.108.105.99.95.48
120  * - a normal string (like "public"). The Oid will have the
121  * ASCII values of the string characters. So "public" will
122  * result to the oid 112.117.98.108.105.99
123  *
124  * @param oid_string - for example "1.3.1.6.1.10"
125  * @param is_dotted_oid_string - Select format within oid_string
126  */
127  Oid(const char *oid_string, const bool is_dotted_oid_string = true);
128 
129  /**
130  * Constructor using another oid object (copy constructor).
131  *
132  * @param oid - Source Oid
133  */
134  Oid(const Oid &oid)
135  : iv_str(0)
136  , iv_part_str(0)
137  , m_changed(true)
138  {
139  smival.syntax = sNMP_SYNTAX_OID;
140  smival.value.oid.len = 0;
141  smival.value.oid.ptr = 0;
142 
143  // allocate some memory for the oid
144  // in this case the size to allocate is the same size as the source oid
145  if (oid.smival.value.oid.len)
146  {
147  smival.value.oid.ptr = (SmiLPUINT32) new unsigned long[oid.smival.value.oid.len];
148  if (smival.value.oid.ptr)
149  OidCopy((SmiLPOID)&(oid.smival.value.oid), (SmiLPOID)&smival.value.oid);
150  }
151  }
152 
153  /**
154  * Constructor from array.
155  *
156  * @param raw_oid - array of oid values
157  * @param oid_len - length of array
158  */
159  Oid(const unsigned long *raw_oid, int oid_len)
160  : iv_str(0)
161  , iv_part_str(0)
162  , m_changed(true)
163  {
164  smival.syntax = sNMP_SYNTAX_OID;
165  smival.value.oid.len = 0;
166  smival.value.oid.ptr = 0;
167 
168  if (raw_oid && (oid_len > 0))
169  {
170  smival.value.oid.ptr = (SmiLPUINT32) new unsigned long[oid_len];
171  if (smival.value.oid.ptr)
172  {
173  smival.value.oid.len = oid_len;
174  for (int i=0; i < oid_len; i++)
175  smival.value.oid.ptr[i] = raw_oid[i];
176  }
177  }
178  }
179 
180  /**
181  * Destructor.
182  */
183  virtual ~Oid()
184  {
185  delete_oid_ptr();
186  if (iv_str) delete [] iv_str; // free up the output string
187  if (iv_part_str) delete [] iv_part_str; // free up the output string
188  }
189 
190  /**
191  * Return the current syntax.
192  *
193  * @return always sNMP_SYNTAX_OID
194  */
196 
197  /**
198  * Assignment from a string.
199  *
200  * @param dotted_oid_string - New value (for example "1.3.6.1.6.0");
201  */
202  virtual Oid& operator=(const char *dotted_oid_string);
203 
204  /**
205  * Assign one Oid to another.
206  */
207  virtual Oid& operator=(const Oid &oid)
208  {
209  if (this == &oid) return *this; // protect against assignment from self
210 
211  delete_oid_ptr();
212 
213  // check for zero len on source
214  if (oid.smival.value.oid.len == 0)
215  return *this;
216 
217  // allocate some memory for the oid
218  smival.value.oid.ptr = (SmiLPUINT32) new unsigned long[oid.smival.value.oid.len];
219  if (smival.value.oid.ptr)
220  OidCopy((SmiLPOID)&(oid.smival.value.oid), (SmiLPOID)&smival.value.oid);
221  return *this;
222  }
223 
224  /**
225  * Return the space needed for serialization.
226  */
227  int get_asn1_length() const;
228 
229  /**
230  * Overloaded equal operator.
231  */
232  bool operator == (const Oid &rhs) const
233  {
234  // ensure same len, then use nCompare
235  if (len() != rhs.len())
236  return 0;
237  return (nCompare(rhs) == 0);
238  }
239 
240  /**
241  * Overloaded not equal operator.
242  */
243  bool operator != (const Oid &rhs) const
244  { return (!(*this == rhs)); } // just invert ==
245 
246  /**
247  * Overloaded less than < operator.
248  */
249  bool operator < (const Oid &rhs) const
250  {
251  int result;
252  // call nCompare with the current
253  // Oidx, Oidy and len of Oidx
254  if((result = nCompare(rhs))<0) return 1;
255  if (result > 0) return 0;
256 
257  // if here, equivalent substrings, call the shorter one <
258  return (len() < rhs.len());
259  }
260 
261  /**
262  * Overloaded less than <= operator.
263  */
264  bool operator <= (const Oid &rhs) const
265  { return ((*this < rhs) || (*this == rhs)); }
266 
267  /**
268  * Overloaded greater than > operator.
269  */
270  bool operator > (const Oid &rhs) const
271  { return (!(*this <= rhs)); } // just invert existing <=
272 
273  /**
274  * Overloaded greater than >= operator.
275  */
276  bool operator >= (const Oid &rhs) const
277  { return (!(*this < rhs)); } // just invert existing <
278 
279 #if 0
280  /**
281  * Overloaded equal operator.
282  */
283  DLLOPT friend bool operator==(const Oid &lhs, const Oid &rhs);
284 
285  /**
286  * Overloaded not equal operator.
287  */
288  DLLOPT friend bool operator!=(const Oid &lhs, const Oid &rhs)
289  { return (!(lhs == rhs)); } // just invert ==
290 
291  /**
292  * Overloaded less than < operator.
293  */
294  DLLOPT friend bool operator<(const Oid &lhs, const Oid &rhs);
295 
296  /**
297  * Overloaded less than <= operator.
298  */
299  DLLOPT friend bool operator<=(const Oid &lhs, const Oid &rhs)
300  { return ((lhs < rhs) || (lhs == rhs)); };
301 
302  /**
303  * Overloaded greater than > operator.
304  */
305  DLLOPT friend bool operator>(const Oid &lhs, const Oid &rhs)
306  { return (!(lhs <= rhs)); }; // just invert existing <=
307 
308  /**
309  * Overloaded greater than >= operator.
310  */
311  DLLOPT friend bool operator>=(const Oid &lhs, const Oid &rhs)
312  { return (!(lhs < rhs)); }; // just invert existing <
313 
314  /**
315  * Overloaded equal operator operator.
316  */
317  DLLOPT friend bool operator==(const Oid &lhs, const char *rhs);
318 
319  /**
320  * Overloaded not equal operator.
321  */
322  DLLOPT friend bool operator!=(const Oid &lhs, const char *rhs);
323 
324  /**
325  * Overloaded less than < operator.
326  */
327  DLLOPT friend bool operator<(const Oid &lhs, const char *rhs);
328 
329  /**
330  * Overloaded less than <= operator.
331  */
332  DLLOPT friend bool operator<=(const Oid &lhs, char *rhs);
333 
334  /**
335  * Overloaded greater than > operator.
336  */
337  DLLOPT friend bool operator>(const Oid &lhs, const char *rhs);
338 
339  /**
340  * Overloaded greater than >= operator.
341  */
342  DLLOPT friend bool operator>=(const Oid &lhs, const char *rhs);
343 #endif
344 
345  /**
346  * Overloaded operator +, Concatenate two Oids.
347  */
348  DLLOPT friend Oid operator +(const Oid &lhs, const Oid &rhs)
349  { Oid tmp(lhs); tmp += rhs; return tmp;}
350 
351  /**
352  * Append operator, appends the dotted oid string.
353  *
354  * @param a - dotted oid string, for example "5.192.14.6"
355  */
356  Oid& operator+=(const char *a);
357 
358  /**
359  * Appends an int.
360  *
361  * @param i - Value to add at the end of the Oid
362  */
363  Oid& operator+=(const unsigned long i)
364  {
365  Oid other(&i, 1);
366  (*this) += other;
367  return *this;
368  }
369 
370  /**
371  * Appends an Oid.
372  *
373  * @param o - Oid to add at the end
374  */
375  Oid& operator+=(const Oid &o)
376  {
377  SmiLPUINT32 new_oid;
378 
379  if (o.smival.value.oid.len == 0)
380  return *this;
381 
382  new_oid = (SmiLPUINT32) new unsigned long[smival.value.oid.len + o.smival.value.oid.len];
383  if (new_oid == 0)
384  {
385  delete_oid_ptr();
386  return *this;
387  }
388 
389  if (smival.value.oid.ptr)
390  {
391  MEMCPY((SmiLPBYTE) new_oid,
392  (SmiLPBYTE) smival.value.oid.ptr,
393  (size_t) (smival.value.oid.len*sizeof(SmiUINT32)));
394 
395  delete [] smival.value.oid.ptr;
396  }
397 
398  // out with the old, in with the new...
399  smival.value.oid.ptr = new_oid;
400 
401  MEMCPY((SmiLPBYTE) &new_oid[smival.value.oid.len],
403  (size_t) (o.smival.value.oid.len*sizeof(SmiUINT32)));
404 
405  smival.value.oid.len += o.smival.value.oid.len;
406 
407  m_changed = true;
408  return *this;
409  }
410 
411  /**
412  * Allows element access as an array.
413  * This method behaves like real array: if your index
414  * is out of bounds, you're lost!
415  *
416  * @param index - valid index -- 0 to (len() - 1)
417  *
418  * @return Value on the given index
419  */
420  unsigned long &operator[](const unsigned int index)
421  { m_changed = true; return smival.value.oid.ptr[index]; }
422 
423  /**
424  * Allows element access as an array for const objects.
425  * This method behaves like real array: if your index
426  * is out of bounds, you're lost!
427  *
428  * @param index - valid index -- 0 to (len() - 1)
429  *
430  * @return Value on the given position
431  */
432  unsigned long operator[](const unsigned int index) const
433  { return (index >= len()) ? 0 : smival.value.oid.ptr[index]; }
434 
435  /**
436  * Get the WinSnmp oid part.
437  * @note This method returns a pointer to internal data.
438  * If it is modified, the Oid changes too.
439  *
440  * @return pointer to the internal oid structure.
441  */
442  SmiLPOID oidval() { return (SmiLPOID) &smival.value.oid; }
443 
444  /**
445  * Set the data from raw form.
446  *
447  * @param raw_oid - Array of new values
448  * @param oid_len - Length of the array raw_oid
449  */
450  void set_data(const unsigned long *raw_oid, const unsigned int oid_len);
451 
452  /**
453  * Set the data from raw form.
454  *
455  * @param str - Array of new values (a string)
456  * @param str_len - Length of the array raw_oid
457  */
458  void set_data(const char *str, const unsigned int str_len);
459 
460  /**
461  * Get the length of the oid.
462  */
463  unsigned long len() const { return smival.value.oid.len; }
464 
465  /**
466  * Trim off the rightmost values of an oid.
467  *
468  * @param n - Trim off n values from the right (default is one)
469  */
470  void trim(const unsigned long n = 1)
471  {
472  // verify that n is legal
473  if ((n <= smival.value.oid.len) && (n > 0))
474  {
475  smival.value.oid.len -= n;
476  if (smival.value.oid.len == 0)
477  delete_oid_ptr();
478  m_changed = true;
479  }
480  }
481 
482  /**
483  * Compare two Oids from the left in direction left-to-right.
484  *
485  * @param n - Subvalues to compare
486  * @param o - The Oid to compare with
487  *
488  * @return 0 if equal / -1 if less / 1 if greater
489  */
490  int nCompare(const unsigned long n, const Oid &o) const
491  {
492  unsigned long length = n;
493  bool reduced_len = false;
494 
495  // If both oids are too short, decrease len
496  if ((smival.value.oid.len < length) && (o.smival.value.oid.len < length))
497  length = smival.value.oid.len < o.smival.value.oid.len ? o.smival.value.oid.len : smival.value.oid.len;
498 
499  if (length == 0) return 0; // equal
500 
501  // only compare for the minimal length
502  if (length > smival.value.oid.len)
503  {
504  length = smival.value.oid.len;
505  reduced_len = true;
506  }
507  if (length > o.smival.value.oid.len)
508  {
509  length = o.smival.value.oid.len;
510  reduced_len = true;
511  }
512 
513  unsigned long z = 0;
514  while (z < length)
515  {
516  if (smival.value.oid.ptr[z] < o.smival.value.oid.ptr[z])
517  return -1; // less than
518  if (smival.value.oid.ptr[z] > o.smival.value.oid.ptr[z])
519  return 1; // greater than
520  ++z;
521  }
522 
523  // if we truncated the len then these may not be equal
524  if (reduced_len)
525  {
526  if (smival.value.oid.len < o.smival.value.oid.len) return -1;
527  if (smival.value.oid.len > o.smival.value.oid.len) return 1;
528  }
529  return 0; // equal
530  }
531 
532  /**
533  * Compare two Oids from the left in direction left-to-right.
534  *
535  * @param n - Subvalues to compare
536  * @param o - The Oid to compare with
537  *
538  * @return 0 if equal / -1 if less / 1 if greater
539  */
540  int nCompare(const Oid &o) const
541  {
542  unsigned long length;
543  bool reduced_len = false;
544 
545  length = smival.value.oid.len < o.smival.value.oid.len ? o.smival.value.oid.len : smival.value.oid.len;
546 
547  if (length == 0) return 0; // equal
548 
549  // only compare for the minimal length
550  if (length > smival.value.oid.len)
551  {
552  length = smival.value.oid.len;
553  reduced_len = true;
554  }
555  if (length > o.smival.value.oid.len)
556  {
557  length = o.smival.value.oid.len;
558  reduced_len = true;
559  }
560 
561  unsigned long z = 0;
562  while (z < length)
563  {
564  if (smival.value.oid.ptr[z] < o.smival.value.oid.ptr[z])
565  return -1; // less than
566  if (smival.value.oid.ptr[z] > o.smival.value.oid.ptr[z])
567  return 1; // greater than
568  ++z;
569  }
570 
571  // if we truncated the len then these may not be equal
572  if (reduced_len)
573  {
574  if (smival.value.oid.len < o.smival.value.oid.len) return -1;
575  if (smival.value.oid.len > o.smival.value.oid.len) return 1;
576  }
577  return 0; // equal
578  }
579 
580  /**
581  * Return validity of the object.
582  */
583  bool valid() const { return (smival.value.oid.ptr ? true : false); }
584 
585  /**
586  * Get a printable ASCII string of the whole value.
587  *
588  * @return Dotted oid string (for example "1.3.6.1.6.0")
589  */
590  const char *get_printable() const
591  { return get_printable(1, smival.value.oid.len, (char*&)iv_str); };
592 
593  /**
594  * Get a printable ASCII string of the right part of the value.
595  *
596  * @param n - positions to print, counted from right.
597  *
598  * @return Dotted oid string (for example "6.0")
599  */
600  const char *get_printable(const unsigned long n) const
601  { return get_printable(smival.value.oid.len - n + 1, n, (char*&)iv_part_str); };
602 
603  /**
604  * Get a printable ASCII string of a part of the value.
605  *
606  * @param start - First position to print, starting with 1 (not zero!)
607  * @param n - positions to print.
608  * @param buffer - pointer to the returned buffer
609  *
610  * @note If buffer is not NULL, this function calls "delete [] buffer",
611  * a new buffer is allocated using "new" and the caller has
612  * to delete it.
613  *
614  * @return Dotted oid string (for example "3.6.1.6")
615  */
616  const char *get_printable(const unsigned long start,
617  const unsigned long n,
618  char *&buffer) const;
619 
620  /**
621  * Get a printable ASCII string of a part of the value.
622  *
623  * @param start - First position to print, starting with 1 (not zero!)
624  * @param n - positions to print.
625  *
626  * @return Dotted oid string (for example "3.6.1.6")
627  */
628  const char *get_printable(const unsigned long start,
629  const unsigned long n) const
630  { return get_printable(start, n, (char*&)iv_part_str); };
631 
632  /**
633  * Clone this object.
634  *
635  * @return Pointer to the newly created object (allocated through new).
636  */
637  SnmpSyntax *clone() const { return (SnmpSyntax *) new Oid(*this); }
638 
639  /**
640  * Map other SnmpSyntax objects to Oid.
641  */
642  SnmpSyntax& operator=(const SnmpSyntax &val);
643 
644  /**
645  * Clear the Oid.
646  */
647  void clear() { delete_oid_ptr(); }
648 
649  protected:
650  /**
651  * Convert a string to an smi oid.
652  *
653  * @param string - input string
654  * @param dstOid - destination oid
655  */
656  virtual int StrToOid(const char *string, SmiLPOID dstOid) const;
657 
658  /**
659  * Clone an smi oid.
660  *
661  * @param srcOid - source oid
662  * @param dstOid - destination oid
663  */
664  virtual int OidCopy(SmiLPOID srcOid, SmiLPOID dstOid) const
665  {
666  // check source len ! zero
667  if (srcOid->len == 0) return -1;
668 
669  // copy source to destination
670  MEMCPY((SmiLPBYTE) dstOid->ptr,
671  (SmiLPBYTE) srcOid->ptr,
672  (size_t) (srcOid->len*sizeof(SmiUINT32)));
673 
674  //set the new len
675  dstOid->len = srcOid->len;
676  return (int) srcOid->len;
677  }
678 
679  /**
680  * Convert an smi oid to its string representation.
681  *
682  * @param srcOid - source oid
683  * @param size - size of string
684  * @param string - pointer to string
685  */
686  virtual int OidToStr(const SmiOID *srcOid,
687  SmiUINT32 size,
688  char *string) const;
689 
690  /**
691  * Free the internal oid pointer and set the pointer and the length to zero.
692  */
693  inline void delete_oid_ptr();
694 
695  //----[ instance variables ]
696 
697  SNMP_PP_MUTABLE char *iv_str; // used for returning complete oid string
698  SNMP_PP_MUTABLE char *iv_part_str; // used for returning part oid string
700 };
701 
702 //-----------[ End Oid Class ]-------------------------------------
703 
704 // create OidCollection type
706 
707 inline void Oid::delete_oid_ptr()
708 {
709  // delete the old value
710  if (smival.value.oid.ptr)
711  {
712  delete [] smival.value.oid.ptr;
713  smival.value.oid.ptr = 0;
714  }
715  smival.value.oid.len = 0;
716  m_changed = true;
717 }
718 
719 #ifdef SNMP_PP_NAMESPACE
720 } // end of namespace Snmp_pp
721 #endif
722 
723 #endif //_OID_H_
void delete_oid_ptr()
Free the internal oid pointer and set the pointer and the length to zero.
Definition: oid.h:707
unsigned long SmiUINT32
Definition: smi.h:157
SmiVALUE smival
Definition: smival.h:179
SmiUINT32 len
Definition: smi.h:169
Oid(const unsigned long *raw_oid, int oid_len)
Constructor from array.
Definition: oid.h:159
#define SNMP_PP_MUTABLE
void clear()
Clear the Oid.
Definition: oid.h:647
#define sNMP_SYNTAX_OID
Definition: smi.h:104
int nCompare(const Oid &o) const
Compare two Oids from the left in direction left-to-right.
Definition: oid.h:540
SmiUINT32 get_syntax() const
Return the current syntax.
Definition: oid.h:195
const char * get_printable(const unsigned long start, const unsigned long n) const
Get a printable ASCII string of a part of the value.
Definition: oid.h:628
SmiOID oid
Definition: smival.h:99
const char * get_printable() const
Get a printable ASCII string of the whole value.
Definition: oid.h:590
SmiLPUINT32 ptr
Definition: smi.h:170
bool valid() const
Return validity of the object.
Definition: oid.h:583
unsigned long operator[](const unsigned int index) const
Allows element access as an array for const objects.
Definition: oid.h:432
void trim(const unsigned long n=1)
Trim off the rightmost values of an oid.
Definition: oid.h:470
SNMP_PP_MUTABLE char * iv_part_str
Definition: oid.h:698
virtual int OidCopy(SmiLPOID srcOid, SmiLPOID dstOid) const
Clone an smi oid.
Definition: oid.h:664
#define DLLOPT
The Object Identifier Class.
Definition: oid.h:94
SnmpCollection< Oid > OidCollection
Definition: oid.h:705
SNMP_PP_MUTABLE char * iv_str
Definition: oid.h:697
Oid(const Oid &oid)
Constructor using another oid object (copy constructor).
Definition: oid.h:134
unsigned long WINFAR * SmiLPUINT32
Definition: smi.h:157
int nCompare(const unsigned long n, const Oid &o) const
Compare two Oids from the left in direction left-to-right.
Definition: oid.h:490
Oid & operator+=(const Oid &o)
Appends an Oid.
Definition: oid.h:375
union SmiVALUE::@1 value
unsigned long len() const
Get the length of the oid.
Definition: oid.h:463
Oid()
Construct an invalid Oid.
Definition: oid.h:101
SNMP_PP_MUTABLE bool m_changed
Definition: oid.h:699
unsigned char WINFAR * SmiLPBYTE
Definition: smi.h:148
SmiLPOID oidval()
Get the WinSnmp oid part.
Definition: oid.h:442
virtual ~Oid()
Destructor.
Definition: oid.h:183
unsigned long & operator[](const unsigned int index)
Allows element access as an array.
Definition: oid.h:420
virtual Oid & operator=(const Oid &oid)
Assign one Oid to another.
Definition: oid.h:207
#define MEMCPY
Definition: smi.h:65
An "abstract" (pure virtual) class that serves as the base class for all specific SNMP syntax types...
Definition: smival.h:116
const char * get_printable(const unsigned long n) const
Get a printable ASCII string of the right part of the value.
Definition: oid.h:600
Oid & operator+=(const unsigned long i)
Appends an int.
Definition: oid.h:363
Definition: smi.h:168
SnmpSyntax * clone() const
Clone this object.
Definition: oid.h:637
unsigned long oid
Definition: asn1.h:40