snmp_core.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2025 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_CORE_H
12 #define SQUID_SRC_SNMP_CORE_H
13 
14 #include "acl/Data.h"
15 #include "acl/ParameterizedNode.h"
16 #include "cache_snmp.h"
17 #include "comm/forward.h"
18 #include "ip/forward.h"
19 #include "snmp_vars.h"
20 
21 class MemBuf;
22 
23 #define SNMP_REQUEST_SIZE 4096
24 #define MAX_PROTOSTAT 5
25 
28 typedef oid *(instance_Fn) (oid * name, snint * len, mib_tree_entry * current, oid_ParseFn ** Fn);
29 typedef enum {atNone = 0, atSum, atAverage, atMax, atMin} AggrType;
30 
33  int len;
36  int children;
37 
39 
42 };
43 
44 struct snmp_pdu* snmpAgentResponse(struct snmp_pdu* PDU);
45 AggrType snmpAggrType(oid* Current, snint CurrentLen);
46 
48 
49 extern PF snmpHandleUdp;
50 const char * snmpDebugOid(oid * Name, snint Len, MemBuf &outbuf);
51 void addr2oid(Ip::Address &addr, oid *Dest);
52 void oid2addr(oid *Dest, Ip::Address &addr, u_int code);
53 
54 namespace Acl
55 {
56 
58 class SnmpCommunityCheck: public ParameterizedNode< ACLData<const char *> >
59 {
60 public:
61  /* Acl::Node API */
62  int match(ACLChecklist *) override;
63 };
64 
65 } // namespace Acl
66 
67 #endif /* SQUID_SRC_SNMP_CORE_H */
68 
AggrType
Definition: snmp_core.h:29
AggrType snmpAggrType(oid *Current, snint CurrentLen)
Definition: snmp_core.cc:583
Comm::ConnectionPointer snmpOutgoingConn
Definition: snmp_core.cc:40
PF snmpHandleUdp
oid * name
Definition: snmp_core.h:32
struct _mib_tree_entry * parent
Definition: snmp_core.h:40
int children
Definition: snmp_core.h:36
oid_ParseFn * parsefunction
Definition: snmp_core.h:34
int match(ACLChecklist *) override
Matches the actual data in checklist against this Acl::Node.
Definition: snmp_core.cc:1146
Definition: Acl.cc:33
@ atAverage
Definition: snmp_core.h:29
AggrType aggrType
Definition: snmp_core.h:41
@ atNone
Definition: snmp_core.h:29
void addr2oid(Ip::Address &addr, oid *Dest)
Definition: snmp_core.cc:1092
int64_t snint
Definition: cache_snmp.h:14
const char * snmpDebugOid(oid *Name, snint Len, MemBuf &outbuf)
Definition: snmp_core.cc:1066
Definition: MemBuf.h:23
an "snmp_community" ACL
Definition: snmp_core.h:58
@ atSum
Definition: snmp_core.h:29
instance_Fn * instancefunction
Definition: snmp_core.h:35
u_int oid
Definition: asn1.h:42
@ atMin
Definition: snmp_core.h:29
void oid2addr(oid *Dest, Ip::Address &addr, u_int code)
Definition: snmp_core.cc:1124
Definition: snmp_core.h:31
variable_list *() oid_ParseFn(variable_list *, snint *)
Definition: snmp_core.h:26
struct _mib_tree_entry ** leaves
Definition: snmp_core.h:38
int len
Definition: snmp_core.h:33
@ atMax
Definition: snmp_core.h:29
oid *() instance_Fn(oid *name, snint *len, mib_tree_entry *current, oid_ParseFn **Fn)
Definition: snmp_core.h:28
struct snmp_pdu * snmpAgentResponse(struct snmp_pdu *PDU)
Definition: snmp_core.cc:470
void PF(int, void *)
Definition: forward.h:18

 

Introduction

Documentation

Support

Miscellaneous