]> git.ipfire.org Git - thirdparty/squid.git/blob - src/snmp_core.h
Docs: Copyright updates for 2018 (#114)
[thirdparty/squid.git] / src / snmp_core.h
1 /*
2 * Copyright (C) 1996-2018 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_SNMP_CORE_H
12 #define SQUID_SNMP_CORE_H
13
14 #include "acl/Strategy.h"
15 #include "cache_snmp.h"
16 #include "comm/forward.h"
17 #include "ip/forward.h"
18
19 class MemBuf;
20
21 #define SNMP_REQUEST_SIZE 4096
22 #define MAX_PROTOSTAT 5
23
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;
28
29 struct _mib_tree_entry {
30 oid *name;
31 int len;
32 oid_ParseFn *parsefunction;
33 instance_Fn *instancefunction;
34 int children;
35
36 struct _mib_tree_entry **leaves;
37
38 struct _mib_tree_entry *parent;
39 AggrType aggrType;
40 };
41
42 struct snmp_pdu* snmpAgentResponse(struct snmp_pdu* PDU);
43 AggrType snmpAggrType(oid* Current, snint CurrentLen);
44
45 extern Comm::ConnectionPointer snmpOutgoingConn;
46
47 extern PF snmpHandleUdp;
48 void snmpInit(void);
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);
54
55 class ACLSNMPCommunityStrategy: public ACLStrategy<char const *>
56 {
57 public:
58 virtual int match (ACLData<MatchType> *&data, ACLFilledChecklist *checklist) override;
59 };
60
61 #endif /* SQUID_SNMP_CORE_H */
62