Var.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2023 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_SRC_SNMP_VAR_H
12 #define SQUID_SRC_SNMP_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_SRC_SNMP_VAR_H */
74 
void init()
initialize members
Definition: Var.cc:45
Definition: Var.h:23
void setValue(const void *value, int length, int aType)
set new variable value
Definition: Var.cc:303
void clearValue()
clear .val member
Definition: Var.cc:182
void pack(Ipc::TypedMsgHdr &msg) const
prepare for sendmsg()
Definition: Var.cc:324
Var()
Definition: Var.cc:20
bool isNull() const
Definition: Var.cc:191
int asCounter() const
returns variable value as Counter32
Definition: Var.cc:213
void setString(const Range< const u_char * > &string)
assign string to variable
Definition: Var.cc:273
Definition: forward.h:14
void clear()
clear all internal members
Definition: Var.cc:316
void unpack(const Ipc::TypedMsgHdr &msg)
restore struct from the message
Definition: Var.cc:340
unsigned int asTimeTicks() const
returns variable value as time ticks
Definition: Var.cc:229
Definition: Range.h:18
void setGauge(unsigned int value)
assign unsigned int value to variable
Definition: Var.cc:267
unsigned int asGauge() const
returns variable value as unsigned int
Definition: Var.cc:205
Var & operator+=(const Var &var)
Definition: Var.cc:51
void setTimeTicks(unsigned int ticks)
assign unsigned int (time) value to variable
Definition: Var.cc:291
Var & operator/=(int num)
Definition: Var.cc:78
void setInt(int value)
assign int value to variable
Definition: Var.cc:255
void setObject(const Range< const oid * > &object)
assign object oid to variable
Definition: Var.cc:279
void setName(const Range< const oid * > &aName)
set new variable name
Definition: Var.cc:171
bool operator>(const Var &var) const
Definition: Var.cc:128
long long int asCounter64() const
returns variable value as Counter64
Definition: Var.cc:221
void clearName()
clear variable name
Definition: Var.cc:157
int asInt() const
returns variable value as integer
Definition: Var.cc:197
void assign(const Var &var)
perform full assignment
Definition: Var.cc:150
Range< const oid * > getName() const
returns variable name
Definition: Var.cc:165
struct msghdr with a known type, fixed-size I/O and control buffers
Definition: TypedMsgHdr.h:34
Var & operator=(const Var &var)
Definition: Var.cc:37
~Var()
Definition: Var.cc:31
Range< const oid * > asObject() const
returns variable value as object oid
Definition: Var.cc:237
bool operator<(const Var &var) const
Definition: Var.cc:106
void copyValue(const Var &var)
copy variable from another one
Definition: Var.cc:297
Range< const u_char * > asString() const
returns variable value as chars string
Definition: Var.cc:247
void setCounter64(long long int counter)
assign Counter64 value to variable
Definition: Var.cc:285
void setCounter(int value)
assign Counter32 value to variable
Definition: Var.cc:261

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors