OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
services_sandesh.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_services_sandesh_h_
6 #define _vnsw_agent_services_sandesh_h_
7 
8 #include <services/services_types.h>
9 
10 struct Dhcpv4Options;
11 struct dhcphdr;
12 struct Dhcpv6Hdr;
13 struct dnshdr;
14 struct ArpKey;
15 class ArpEntry;
16 
18 public:
20  virtual ~ServicesSandesh() {}
21 
22  void HandleRequest(PktHandler::PktModuleName mod, std::string ctxt, bool more);
23  void MetadataHandleRequest(std::string ctxt, bool more);
24  void PktStatsSandesh(std::string ctxt, bool more);
25 
26  static void MacToString(const unsigned char *mac, std::string &mac_str);
27  static std::string & DhcpMsgType(uint32_t msg_type);
28  static std::string & Dhcpv6MsgType(uint32_t msg_type);
29 
30 private:
31  std::string IntToString(uint32_t val);
32  std::string IntToHexString(uint32_t val);
33  void PktToHexString(uint8_t *pkt, int32_t len, std::string &msg);
34  std::string IpProtocol(uint16_t prot);
35 
36  void DhcpStatsSandesh(std::string ctxt, bool more);
37  void Dhcpv6StatsSandesh(std::string ctxt, bool more);
38  void ArpStatsSandesh(std::string ctxt, bool more);
39  void BfdStatsSandesh(std::string ctxt, bool more);
40  void DnsStatsSandesh(std::string ctxt, bool more);
41  void IcmpStatsSandesh(std::string ctxt, bool more);
42  void IgmpStatsSandesh(std::string ctxt, bool more);
43  void Icmpv6StatsSandesh(std::string ctxt, bool more);
44 
45  void ArpPktTrace(PktTrace::Pkt &pkt, ArpPktSandesh *resp);
46  void DhcpPktTrace(PktTrace::Pkt &pkt, DhcpPktSandesh *resp);
47  void Dhcpv6PktTrace(PktTrace::Pkt &pkt, Dhcpv6PktSandesh *resp);
48  void DnsPktTrace(PktTrace::Pkt &pkt, DnsPktSandesh *resp);
49  void IcmpPktTrace(PktTrace::Pkt &pkt, IcmpPktSandesh *resp);
50  void Icmpv6PktTrace(PktTrace::Pkt &pkt, Icmpv6PktSandesh *resp);
51  void OtherPktTrace(PktTrace::Pkt &pkt, PktSandesh *resp);
52 
53  void FillPktData(PktTrace::Pkt &pkt, PktData &resp);
54  uint16_t FillVrouterHdr(PktTrace::Pkt &pkt, VrouterHdr &resp);
55  int FillMacHdr(struct ether_header *eth, MacHdr &resp);
56  void FillArpHdr(ether_arp *arp, ArpHdr &resp);
57  void FillIpv4Hdr(struct ip *ip, Ipv4Hdr &resp);
58  void FillIpv6Hdr(ip6_hdr *ip, Ipv6Hdr &resp);
59  void FillIcmpv4Hdr(struct icmp *icmp, Icmpv4Hdr &resp);
60  void FillIcmpv6Hdr(icmp6_hdr *icmp, Icmpv6Hdr &resp, int32_t len);
61  void FillUdpHdr(udphdr *udp, UdpHdr &resp);
62  void FillDhcpv4Options(Dhcpv4Options *opt, std::string &resp,
63  std::string &other, int32_t len);
64  void FillDhcpv4Hdr(dhcphdr *dhcp, Dhcpv4Hdr &resp, int32_t len);
65  void FillDhcpv6Hdr(Dhcpv6Hdr *dhcp, Dhcpv6Header &resp, int32_t len);
66  void FillDnsHdr(dnshdr *dns, DnsHdr &resp, int32_t dnslen);
67  std::string FillOptionString(char *data, int32_t len, std::string msg);
68  std::string FillOptionInteger(uint32_t data, std::string msg);
69  std::string FillOptionIp(uint32_t data, std::string msg);
70  void FillHostRoutes(uint8_t *data, int len, std::string &resp);
71 
73 };
74 
75 class ArpSandesh {
76 public:
77  static const uint8_t entries_per_sandesh = 100;
78  ArpSandesh(SandeshResponse *resp) : iter_(0), resp_(resp) {};
79  bool SetArpEntry(const ArpKey &key, const ArpEntry *entry);
80  void Response() { resp_->Response(); }
82  ArpProto::InterfaceArpMap::const_iterator &it,
83  std::vector<InterfaceArpStats> &list);
84 
85 private:
86  int iter_;
89 };
90 
91 #endif // _vnsw_agent_services_sandesh_h_
void HandleRequest(PktHandler::PktModuleName mod, std::string ctxt, bool more)
void Dhcpv6StatsSandesh(std::string ctxt, bool more)
void IcmpStatsSandesh(std::string ctxt, bool more)
void FillArpHdr(ether_arp *arp, ArpHdr &resp)
DISALLOW_COPY_AND_ASSIGN(ArpSandesh)
void FillPktData(PktTrace::Pkt &pkt, PktData &resp)
void FillIpv6Hdr(ip6_hdr *ip, Ipv6Hdr &resp)
std::string IpProtocol(uint16_t prot)
void PktToHexString(uint8_t *pkt, int32_t len, std::string &msg)
std::string IntToString(uint32_t val)
static std::string & Dhcpv6MsgType(uint32_t msg_type)
void FillIcmpv4Hdr(struct icmp *icmp, Icmpv4Hdr &resp)
void DhcpStatsSandesh(std::string ctxt, bool more)
void FillIcmpv6Hdr(icmp6_hdr *icmp, Icmpv6Hdr &resp, int32_t len)
void DhcpPktTrace(PktTrace::Pkt &pkt, DhcpPktSandesh *resp)
void FillDhcpv4Options(Dhcpv4Options *opt, std::string &resp, std::string &other, int32_t len)
void OtherPktTrace(PktTrace::Pkt &pkt, PktSandesh *resp)
virtual void Response()
Definition: p/sandesh.h:502
static std::string & DhcpMsgType(uint32_t msg_type)
void FillDnsHdr(dnshdr *dns, DnsHdr &resp, int32_t dnslen)
std::string FillOptionInteger(uint32_t data, std::string msg)
ArpSandesh(SandeshResponse *resp)
SandeshResponse * resp_
bool SetArpEntry(const ArpKey &key, const ArpEntry *entry)
std::string FillOptionIp(uint32_t data, std::string msg)
void FillUdpHdr(udphdr *udp, UdpHdr &resp)
uint16_t FillVrouterHdr(PktTrace::Pkt &pkt, VrouterHdr &resp)
void PktStatsSandesh(std::string ctxt, bool more)
DISALLOW_COPY_AND_ASSIGN(ServicesSandesh)
void Icmpv6StatsSandesh(std::string ctxt, bool more)
std::string FillOptionString(char *data, int32_t len, std::string msg)
std::string IntToHexString(uint32_t val)
void MetadataHandleRequest(std::string ctxt, bool more)
void Dhcpv6PktTrace(PktTrace::Pkt &pkt, Dhcpv6PktSandesh *resp)
int FillMacHdr(struct ether_header *eth, MacHdr &resp)
static const uint8_t entries_per_sandesh
void IcmpPktTrace(PktTrace::Pkt &pkt, IcmpPktSandesh *resp)
virtual ~ServicesSandesh()
void IgmpStatsSandesh(std::string ctxt, bool more)
void DnsStatsSandesh(std::string ctxt, bool more)
void FillHostRoutes(uint8_t *data, int len, std::string &resp)
void SetInterfaceArpStatsEntry(ArpProto::InterfaceArpMap::const_iterator &it, std::vector< InterfaceArpStats > &list)
void BfdStatsSandesh(std::string ctxt, bool more)
void Icmpv6PktTrace(PktTrace::Pkt &pkt, Icmpv6PktSandesh *resp)
void FillIpv4Hdr(struct ip *ip, Ipv4Hdr &resp)
static void MacToString(const unsigned char *mac, std::string &mac_str)
void ArpStatsSandesh(std::string ctxt, bool more)
void ArpPktTrace(PktTrace::Pkt &pkt, ArpPktSandesh *resp)
void FillDhcpv4Hdr(dhcphdr *dhcp, Dhcpv4Hdr &resp, int32_t len)
void DnsPktTrace(PktTrace::Pkt &pkt, DnsPktSandesh *resp)
void FillDhcpv6Hdr(Dhcpv6Hdr *dhcp, Dhcpv6Header &resp, int32_t len)