Var.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
3  *
4  * Squid software is distributed under GPLv2+ license and includes
5  * contributions from numerous individuals and organizations.
6  * Please see the COPYING and CONTRIBUTORS files for details.
7  */
8 
9 /* DEBUG: section 49 SNMP Interface */
10 
11 #ifndef SQUID_SNMPX_VAR_H
12 #define SQUID_SNMPX_VAR_H
13 
14 #include "base/Range.h"
15 #include "ipc/forward.h"
16 #include "snmp_vars.h"
17 
18 namespace Snmp
19 {
20 
23 class Var: public variable_list
24 {
25 public:
26  Var();
27  Var(const Var& var);
28  Var& operator = (const Var& var);
29  ~Var();
30 
31  Var& operator += (const Var& var);
32  Var& operator /= (int num);
33  bool operator < (const Var& var) const;
34  bool operator > (const Var& var) const;
35 
36  void pack(Ipc::TypedMsgHdr& msg) const;
37  void unpack(const Ipc::TypedMsgHdr& msg);
38 
39  Range<const oid*> getName() const;
40  void setName(const Range<const oid*>& aName);
41  void clearName();
42 
43  bool isNull() const;
44 
45  int asInt() const;
46  unsigned int asGauge() const;
47  int asCounter() const;
48  long long int asCounter64() const;
49  unsigned int asTimeTicks() const;
50  Range<const oid*> asObject() const;
52 
53  void setInt(int value);
54  void setCounter(int value);
55  void setGauge(unsigned int value);
56  void setString(const Range<const u_char*>& string);
57  void setObject(const Range<const oid*>& object);
58  void setTimeTicks(unsigned int ticks);
59  void setCounter64(long long int counter);
60 
61  void copyValue(const Var& var);
62  void clearValue();
63  void clear();
64 
65 private:
66  void init();
67  void assign(const Var& var);
68  void setValue(const void* value, int length, int aType);
69 };
70 
71 } // namespace Snmp
72 
73 #endif /* SQUID_SNMPX_VAR_H */
74 
void clear()
clear all internal members
Definition: Var.cc:320
void init()
initialize members
Definition: Var.cc:45
~Var()
Definition: Var.cc:31
void assign(const Var &var)
perform full assignment
Definition: Var.cc:150
void unpack(const Ipc::TypedMsgHdr &msg)
restore struct from the message
Definition: Var.cc:344
bool operator>(const Var &var) const
Definition: Var.cc:128
unsigned int asTimeTicks() const
returns variable value as time ticks
Definition: Var.cc:233
int asCounter() const
returns variable value as Counter32
Definition: Var.cc:217
long long int asCounter64() const
returns variable value as Counter64
Definition: Var.cc:225
Range< const oid * > asObject() const
returns variable value as object oid
Definition: Var.cc:241
Range< const u_char * > asString() const
returns variable value as chars string
Definition: Var.cc:251
Definition: Range.h:18
void setString(const Range< const u_char * > &string)
assign string to variable
Definition: Var.cc:277
void setTimeTicks(unsigned int ticks)
assign unsigned int (time) value to variable
Definition: Var.cc:295
unsigned int asGauge() const
returns variable value as unsigned int
Definition: Var.cc:209
void setCounter(int value)
assign Counter32 value to variable
Definition: Var.cc:265
void setName(const Range< const oid * > &aName)
set new variable name
Definition: Var.cc:173
void setGauge(unsigned int value)
assign unsigned int value to variable
Definition: Var.cc:271
bool operator<(const Var &var) const
Definition: Var.cc:106
int asInt() const
returns variable value as integer
Definition: Var.cc:201
void clearValue()
clear .val member
Definition: Var.cc:184
void setInt(int value)
assign int value to variable
Definition: Var.cc:259
void setCounter64(long long int counter)
assign Counter64 value to variable
Definition: Var.cc:289
Var()
Definition: Var.cc:20
void setObject(const Range< const oid * > &object)
assign object oid to variable
Definition: Var.cc:283
Definition: Var.h:23
struct msghdr with a known type, fixed-size I/O and control buffers
Definition: TypedMsgHdr.h:31
Var & operator=(const Var &var)
Definition: Var.cc:37
Range< const oid * > getName() const
returns variable name
Definition: Var.cc:167
void pack(Ipc::TypedMsgHdr &msg) const
prepare for sendmsg()
Definition: Var.cc:328
Var & operator+=(const Var &var)
Definition: Var.cc:51
Var & operator/=(int num)
Definition: Var.cc:78
bool isNull() const
Definition: Var.cc:195
void setValue(const void *value, int length, int aType)
set new variable value
Definition: Var.cc:307
void clearName()
clear variable name
Definition: Var.cc:157
void copyValue(const Var &var)
copy variable from another one
Definition: Var.cc:301

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors