2 * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
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.
9 /* DEBUG: section 49 SNMP Interface */
11 #ifndef SQUID_SNMP_CORE_H
12 #define SQUID_SNMP_CORE_H
14 #include "acl/Strategy.h"
15 #include "cache_snmp.h"
16 #include "comm/forward.h"
17 #include "ip/forward.h"
21 #define SNMP_REQUEST_SIZE 4096
22 #define MAX_PROTOSTAT 5
24 typedef variable_list
*(oid_ParseFn
) (variable_list
*, snint
*);
25 typedef struct _mib_tree_entry mib_tree_entry
;
26 typedef oid
*(instance_Fn
) (oid
* name
, snint
* len
, mib_tree_entry
* current
, oid_ParseFn
** Fn
);
27 typedef enum {atNone
= 0, atSum
, atAverage
, atMax
, atMin
} AggrType
;
29 struct _mib_tree_entry
{
32 oid_ParseFn
*parsefunction
;
33 instance_Fn
*instancefunction
;
36 struct _mib_tree_entry
**leaves
;
38 struct _mib_tree_entry
*parent
;
42 struct snmp_pdu
* snmpAgentResponse(struct snmp_pdu
* PDU
);
43 AggrType
snmpAggrType(oid
* Current
, snint CurrentLen
);
45 extern Comm::ConnectionPointer snmpOutgoingConn
;
47 extern PF snmpHandleUdp
;
49 void snmpOpenPorts(void);
50 void snmpClosePorts(void);
51 const char * snmpDebugOid(oid
* Name
, snint Len
, MemBuf
&outbuf
);
52 void addr2oid(Ip::Address
&addr
, oid
*Dest
);
53 void oid2addr(oid
*Dest
, Ip::Address
&addr
, u_int code
);
55 class ACLSNMPCommunityStrategy
: public ACLStrategy
<char const *>
58 virtual int match (ACLData
<MatchType
> *&data
, ACLFilledChecklist
*checklist
) override
;
61 #endif /* SQUID_SNMP_CORE_H */