• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

PowerDNS / pdns / 12595591960

03 Jan 2025 09:27AM UTC coverage: 62.774% (+2.5%) from 60.245%
12595591960

Pull #15008

github

web-flow
Merge c2a2749d3 into 788f396a7
Pull Request #15008: Do not follow CNAME records for ANY or CNAME queries

30393 of 78644 branches covered (38.65%)

Branch coverage included in aggregate %.

105822 of 138350 relevant lines covered (76.49%)

4613078.44 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

75.0
/pdns/snmp-agent.hh
1
#pragma once
2
#include "config.h"
3

4
#include <string>
5
#include <thread>
6
#include <unistd.h>
7

8
#include "mplexer.hh"
9
#include "channel.hh"
10

11
typedef struct netsnmp_request_info_s netsnmp_request_info;
12
typedef struct variable_list netsnmp_variable_list;
13

14
class SNMPAgent
15
{
16
public:
17
  SNMPAgent(const std::string& name, const std::string& daemonSocket);
18
  virtual ~SNMPAgent()
19
  {
×
20
  }
×
21

22
  void run()
23
  {
2✔
24
#ifdef HAVE_NET_SNMP
2✔
25
  d_thread = std::thread(&SNMPAgent::worker, this);
2✔
26
  d_thread.detach();
2✔
27
#endif /* HAVE_NET_SNMP */
2✔
28
  }
2✔
29

30
#ifdef HAVE_NET_SNMP
31
  static int setCounter64Value(netsnmp_request_info* request,
32
                               uint64_t value);
33
#endif /* HAVE_NET_SNMP */
34
protected:
35
#ifdef HAVE_NET_SNMP
36
  static void addSNMPTrapOID(netsnmp_variable_list** varList, const void* value, size_t len);
37

38
  static bool sendTrap(pdns::channel::Sender<netsnmp_variable_list, void(*)(netsnmp_variable_list*)>& sender,
39
                       netsnmp_variable_list* varList);
40

41
  pdns::channel::Sender<netsnmp_variable_list, void(*)(netsnmp_variable_list*)> d_sender;
42
  pdns::channel::Receiver<netsnmp_variable_list, void(*)(netsnmp_variable_list*)> d_receiver;
43
#endif /* HAVE_NET_SNMP */
44
private:
45
  void worker();
46
  static void handleTrapsCB(int fd, FDMultiplexer::funcparam_t& var);
47
  static void handleSNMPQueryCB(int fd, FDMultiplexer::funcparam_t& var);
48
  void handleTrapsEvent();
49
  void handleSNMPQueryEvent(int fd);
50

51
  std::thread d_thread;
52
};
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc