OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
dhcpv6_proto.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
3  */
4 
5 #ifndef vnsw_agent_dhcpv6_proto_hpp
6 #define vnsw_agent_dhcpv6_proto_hpp
7 
8 #include "pkt/proto.h"
10 
11 #define DHCPV6_TRACE(obj, arg) \
12 do { \
13  std::ostringstream _str; \
14  _str << arg; \
15  Dhcpv6##obj::TraceMsg(Dhcpv6TraceBuf, __FILE__, __LINE__, _str.str()); \
16 } while (false) \
17 
18 // DHCPv6 DUID types
19 #define DHCPV6_DUID_TYPE_LLT 1
20 #define DHCPV6_DUID_TYPE_EN 2
21 #define DHCPV6_DUID_TYPE_LL 3
22 
23 class Dhcpv6Proto : public Proto {
24 public:
25  static const uint32_t kDhcpMaxPacketSize = 1024;
26  struct Duid {
27  uint16_t type;
28  uint16_t hw_type;
29  uint8_t mac[ETHER_ADDR_LEN];
30  };
31 
32  struct DhcpStats {
33  DhcpStats() { Reset(); }
34  void Reset() {
38  }
39 
40  uint32_t solicit;
41  uint32_t advertise;
42  uint32_t request;
43  uint32_t confirm;
44  uint32_t renew;
45  uint32_t rebind;
46  uint32_t reply;
47  uint32_t release;
48  uint32_t decline;
49  uint32_t reconfigure;
51  uint32_t error;
52  };
53 
54  Dhcpv6Proto(Agent *agent, boost::asio::io_context &io,
55  bool run_with_vrouter);
56  virtual ~Dhcpv6Proto();
57  ProtoHandler *AllocProtoHandler(boost::shared_ptr<PktInfo> info,
58  boost::asio::io_context &io);
59  void Shutdown();
60 
61  const Duid *server_duid() const { return &server_duid_; }
62 
67  void IncrStatsRenew() { stats_.renew++; }
69  void IncrStatsReply() { stats_.reply++; }
74  void IncrStatsError() { stats_.error++; }
75  const DhcpStats &GetStats() const { return stats_; }
76  void ClearStats() { stats_.Reset(); }
77 
78 private:
82 
84 };
85 
86 #endif // vnsw_agent_dhcpv6_proto_hpp
void IncrStatsAdvertise()
Definition: dhcpv6_proto.h:64
uint8_t mac[ETHER_ADDR_LEN]
Definition: dhcpv6_proto.h:29
void IncrStatsReply()
Definition: dhcpv6_proto.h:69
DISALLOW_COPY_AND_ASSIGN(Dhcpv6Proto)
void IncrStatsConfirm()
Definition: dhcpv6_proto.h:66
void IncrStatsDecline()
Definition: dhcpv6_proto.h:71
uint32_t information_request
Definition: dhcpv6_proto.h:50
const DhcpStats & GetStats() const
Definition: dhcpv6_proto.h:75
static const uint32_t kDhcpMaxPacketSize
Definition: dhcpv6_proto.h:25
void ClearStats()
Definition: dhcpv6_proto.h:76
void IncrStatsRebind()
Definition: dhcpv6_proto.h:68
const Duid * server_duid() const
Definition: dhcpv6_proto.h:61
Definition: agent.h:358
DhcpStats stats_
Definition: dhcpv6_proto.h:80
void IncrStatsSolicit()
Definition: dhcpv6_proto.h:63
void IncrStatsError()
Definition: dhcpv6_proto.h:74
void Shutdown()
Definition: dhcpv6_proto.cc:37
void IncrStatsRenew()
Definition: dhcpv6_proto.h:67
void IncrStatsRequest()
Definition: dhcpv6_proto.h:65
Duid server_duid_
Definition: dhcpv6_proto.h:81
void IncrStatsInformationRequest()
Definition: dhcpv6_proto.h:73
void IncrStatsReconfigure()
Definition: dhcpv6_proto.h:72
bool run_with_vrouter_
Definition: dhcpv6_proto.h:79
void IncrStatsRelease()
Definition: dhcpv6_proto.h:70
Dhcpv6Proto(Agent *agent, boost::asio::io_context &io, bool run_with_vrouter)
Definition: dhcpv6_proto.cc:15
ProtoHandler * AllocProtoHandler(boost::shared_ptr< PktInfo > info, boost::asio::io_context &io)
Definition: dhcpv6_proto.cc:32
virtual ~Dhcpv6Proto()
Definition: dhcpv6_proto.cc:29