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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors