OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DnsHandler Class Reference

#include <dns_handler.h>

Inheritance diagram for DnsHandler:
Collaboration diagram for DnsHandler:

Classes

struct  DnsResolverInfo
 
struct  QueryKey
 

Public Types

enum  Action { NONE, DNS_QUERY, DNS_UPDATE }
 
typedef boost::function< void(const
boost::system::error_code
&, boost_udp::resolver::iterator)> 
ResolveHandler
 
typedef std::vector
< boost_udp::resolver * > 
ResolvList
 

Public Member Functions

 DnsHandler (Agent *agent, boost::shared_ptr< PktInfo > info, boost::asio::io_context &io)
 
virtual ~DnsHandler ()
 
bool Run ()
 
bool TimerExpiry (uint16_t xid)
 
void DefaultDnsResolveHandler (const boost::system::error_code &error, boost_udp::resolver::iterator it, DnsItems::iterator item)
 
- Public Member Functions inherited from ProtoHandler
 ProtoHandler (Agent *agent, boost::shared_ptr< PktInfo > info, boost::asio::io_context &io)
 
virtual ~ProtoHandler ()
 
void Send (uint32_t itf, uint32_t vrf, uint16_t, PktHandler::PktModuleName)
 
void Send (uint32_t itf, uint32_t vrf, uint16_t cmd, uint32_t param1, uint32_t param2, PktHandler::PktModuleName mod)
 
int EthHdr (const MacAddress &src, const MacAddress &dest, const uint16_t proto)
 
int EthHdr (char *buff, uint16_t len, const MacAddress &src, const MacAddress &dest, const uint16_t proto, uint16_t vlan_id)
 
int EthHdr (char *buff, uint16_t len, const Interface *interface, const MacAddress &src, const MacAddress &dest, const uint16_t proto)
 
int EthHdr (char *buff, uint16_t len, uint32_t ifindex, const MacAddress &src, const MacAddress &dest, const uint16_t proto)
 
void VlanHdr (uint8_t *ptr, uint16_t tci)
 
void IpHdr (uint16_t len, in_addr_t src, in_addr_t dest, uint8_t protocol, uint16_t id, uint8_t ttl)
 
uint16_t IpHdr (char *buff, uint16_t buf_len, uint16_t len, in_addr_t src, in_addr_t dest, uint8_t protocol, uint16_t id, uint8_t ttl)
 
void Ip6Hdr (ip6_hdr *ip, uint16_t plen, uint8_t next_header, uint8_t hlim, uint8_t *src, uint8_t *dest)
 
void UdpHdr (uint16_t len, in_addr_t src, uint16_t src_port, in_addr_t dest, uint16_t dest_port)
 
void UdpHdr (udphdr *hdr, uint16_t len, const uint8_t *src, uint16_t src_port, const uint8_t *dest, uint16_t dest_port, uint8_t next_hdr)
 
void UdpHdr (uint16_t len, const uint8_t *src, uint16_t src_port, const uint8_t *dest, uint16_t dest_port, uint8_t next_hdr)
 
uint16_t UdpHdr (udphdr *udp, uint16_t buf_len, uint16_t len, in_addr_t src, uint16_t src_port, in_addr_t dest, uint16_t dest_port)
 
uint16_t IcmpHdr (char *buff, uint16_t buf_len, uint8_t type, uint8_t code, uint16_t word1, uint16_t word2)
 
void IcmpChecksum (char *buff, uint16_t buf_len)
 
void IgmpChecksum (char *buff, uint16_t buf_len)
 
uint32_t Sum (uint16_t *, std::size_t, uint32_t) const
 
uint16_t Csum (uint16_t *, std::size_t, uint32_t) const
 
uint16_t UdpCsum (in_addr_t, in_addr_t, std::size_t, udphdr *) const
 
uint16_t Ipv6Csum (const uint8_t *src, const uint8_t *dest, uint16_t plen, uint8_t next_hdr, uint16_t *hdr) const
 
uint16_t Icmpv6Csum (const uint8_t *src, const uint8_t *dest, icmp6_hdr *icmp, uint16_t plen) const
 
Agentagent () const
 
uint32_t GetVrfIndex () const
 
uint32_t GetInterfaceIndex () const
 
uint16_t GetLength () const
 
uint32_t GetCmdParam () const
 
PktInfopkt_info () const
 
uint32_t EncapHeaderLen () const
 

Static Public Attributes

static const uint32_t max_items_per_xmpp_msg = 20
 

Private Member Functions

bool HandleRequest ()
 
bool HandleDefaultDnsRequest (const VmInterface *vmitf)
 
void DefaultDnsSendResponse ()
 
bool HandleVirtualDnsRequest (const VmInterface *vmitf)
 
bool ResolveLinkLocalRequest (DnsItems::iterator &item, DnsItems *linklocal_items) const
 
bool ResolveAllLinkLocalRequests ()
 
void BuildDnsResolvers ()
 
void BuildDefaultDnsResolvers ()
 
bool HandleMessage ()
 
bool HandleDefaultDnsResponse ()
 
bool HandleBindResponse ()
 
bool HandleUpdateResponse ()
 
bool HandleRetryExpiry ()
 
bool HandleUpdate ()
 
bool HandleModifyVdns ()
 
bool UpdateAll ()
 
void SendXmppUpdate (AgentDnsXmppChannel *channel, DnsUpdateData *xmpp_data)
 
void ParseQuery ()
 
void Resolve (dns_flags flags, const DnsItems &ques, DnsItems &ans, DnsItems &auth, DnsItems &add)
 
void SendDnsResponse ()
 
void UpdateQueryNames ()
 
void UpdateOffsets (DnsItem &item, bool name_update_required)
 
void UpdateGWAddress (DnsItem &item)
 
void Update (InterTaskMsg *msg)
 
void DelUpdate (InterTaskMsg *msg)
 
void UpdateStats ()
 
void GetDomainName (const VmInterface *vm_itf, std::string *domain_name) const
 
bool GetDomainNameFromDhcp (std::vector< autogen::DhcpOptionType > &options, std::string *domain_name) const
 
void GetBaseName (const std::string &name, std::string *base) const
 
std::string DnsItemsToString (DnsItems &items) const
 
void HandleInvalidBindResponse (DnsHandler *handler, dns_flags flags, const DnsItems &ques, DnsItems &ans, DnsItems &auth, DnsItems &add, uint16_t xid)
 
bool NeedRetryForNextServer (uint16_t code)
 
bool SendToDefaultServer ()
 
bool DefaultMethodInUse ()
 
uint8_t curr_index ()
 
uint8_t last_index ()
 
void IncrCurrIndex ()
 
bool SendDnsQuery (DnsResolverInfo *resolver, uint16_t xid)
 
 DISALLOW_COPY_AND_ASSIGN (DnsHandler)
 

Private Attributes

dnshdrdns_
 
uint8_t * resp_ptr_
 
uint16_t dns_resp_size_
 
uint16_t xid_
 
Action action_
 
QueryKeyrkey_
 
std::vector< DnsResolverInfo * > dns_resolvers_
 
std::vector< DnsResolverInfo * > def_dns_resolvers_
 
std::string ipam_name_
 
std::string domain_name_
 
autogen::IpamType ipam_type_
 
autogen::VirtualDnsType vdns_type_
 
DnsItems items_
 
DnsItems linklocal_items_
 
DnsNameEncoder name_encoder_
 
bool query_name_update_
 
uint16_t query_name_update_len_
 
uint16_t pend_req_
 
ResolvList resolv_list_
 
tbb::mutex mutex_
 
bool default_method_
 
uint8_t curr_index_
 

Friends

class DnsTest
 

Additional Inherited Members

- Protected Attributes inherited from ProtoHandler
Agentagent_
 
boost::shared_ptr< PktInfopkt_info_
 
boost::asio::io_context & io_
 

Detailed Description

Definition at line 21 of file dns_handler.h.

Member Typedef Documentation

typedef boost::function<void(const boost::system::error_code&, boost_udp::resolver::iterator)> DnsHandler::ResolveHandler

Definition at line 24 of file dns_handler.h.

typedef std::vector<boost_udp::resolver *> DnsHandler::ResolvList

Definition at line 25 of file dns_handler.h.

Member Enumeration Documentation

Enumerator
NONE 
DNS_QUERY 
DNS_UPDATE 

Definition at line 40 of file dns_handler.h.

Constructor & Destructor Documentation

DnsHandler::DnsHandler ( Agent agent,
boost::shared_ptr< PktInfo info,
boost::asio::io_context &  io 
)

Definition at line 20 of file dns_handler.cc.

DnsHandler::~DnsHandler ( )
virtual

Definition at line 29 of file dns_handler.cc.

Here is the call graph for this function:

Member Function Documentation

void DnsHandler::BuildDefaultDnsResolvers ( )
private

Definition at line 95 of file dns_handler.cc.

Here is the call graph for this function:

void DnsHandler::BuildDnsResolvers ( )
private

Definition at line 62 of file dns_handler.cc.

Here is the call graph for this function:

uint8_t DnsHandler::curr_index ( )
inlineprivate

Definition at line 97 of file dns_handler.h.

void DnsHandler::DefaultDnsResolveHandler ( const boost::system::error_code &  error,
boost_udp::resolver::iterator  it,
DnsItems::iterator  item 
)
void DnsHandler::DefaultDnsSendResponse ( )
private

Definition at line 280 of file dns_handler.cc.

Here is the call graph for this function:

bool DnsHandler::DefaultMethodInUse ( )
inlineprivate

Definition at line 96 of file dns_handler.h.

void DnsHandler::DelUpdate ( InterTaskMsg msg)
private

Definition at line 1069 of file dns_handler.cc.

Here is the call graph for this function:

DnsHandler::DISALLOW_COPY_AND_ASSIGN ( DnsHandler  )
private
std::string DnsHandler::DnsItemsToString ( DnsItems items) const
private

Definition at line 1176 of file dns_handler.cc.

void DnsHandler::GetBaseName ( const std::string &  name,
std::string *  base 
) const
private

Definition at line 1160 of file dns_handler.cc.

void DnsHandler::GetDomainName ( const VmInterface vm_itf,
std::string *  domain_name 
) const
private

Definition at line 1119 of file dns_handler.cc.

Here is the call graph for this function:

bool DnsHandler::GetDomainNameFromDhcp ( std::vector< autogen::DhcpOptionType > &  options,
std::string *  domain_name 
) const
private

Definition at line 1144 of file dns_handler.cc.

bool DnsHandler::HandleBindResponse ( )
private

Definition at line 556 of file dns_handler.cc.

Here is the call graph for this function:

bool DnsHandler::HandleDefaultDnsRequest ( const VmInterface vmitf)
private

Definition at line 213 of file dns_handler.cc.

Here is the call graph for this function:

bool DnsHandler::HandleDefaultDnsResponse ( )
private

Definition at line 549 of file dns_handler.cc.

Here is the call graph for this function:

void DnsHandler::HandleInvalidBindResponse ( DnsHandler handler,
dns_flags  flags,
const DnsItems ques,
DnsItems ans,
DnsItems auth,
DnsItems add,
uint16_t  xid 
)
private

Definition at line 637 of file dns_handler.cc.

Here is the call graph for this function:

bool DnsHandler::HandleMessage ( )
private

Definition at line 519 of file dns_handler.cc.

Here is the call graph for this function:

bool DnsHandler::HandleModifyVdns ( )
private

Definition at line 737 of file dns_handler.cc.

Here is the call graph for this function:

bool DnsHandler::HandleRequest ( )
private

Definition at line 127 of file dns_handler.cc.

Here is the call graph for this function:

bool DnsHandler::HandleRetryExpiry ( )
private

Definition at line 687 of file dns_handler.cc.

Here is the call graph for this function:

bool DnsHandler::HandleUpdate ( )
private

Definition at line 726 of file dns_handler.cc.

Here is the call graph for this function:

bool DnsHandler::HandleUpdateResponse ( )
private

Definition at line 719 of file dns_handler.cc.

bool DnsHandler::HandleVirtualDnsRequest ( const VmInterface vmitf)
private

Definition at line 296 of file dns_handler.cc.

Here is the call graph for this function:

void DnsHandler::IncrCurrIndex ( )
inlineprivate

Definition at line 99 of file dns_handler.h.

uint8_t DnsHandler::last_index ( )
inlineprivate

Definition at line 98 of file dns_handler.h.

bool DnsHandler::NeedRetryForNextServer ( uint16_t  code)
private

Definition at line 656 of file dns_handler.cc.

void DnsHandler::ParseQuery ( )
private
void DnsHandler::Resolve ( dns_flags  flags,
const DnsItems ques,
DnsItems ans,
DnsItems auth,
DnsItems add 
)
private

Definition at line 844 of file dns_handler.cc.

Here is the call graph for this function:

bool DnsHandler::ResolveAllLinkLocalRequests ( )
private

Definition at line 497 of file dns_handler.cc.

Here is the call graph for this function:

bool DnsHandler::ResolveLinkLocalRequest ( DnsItems::iterator &  item,
DnsItems linklocal_items 
) const
private

Definition at line 444 of file dns_handler.cc.

Here is the call graph for this function:

bool DnsHandler::Run ( void  )
virtual

Implements ProtoHandler.

Definition at line 117 of file dns_handler.cc.

Here is the call graph for this function:

bool DnsHandler::SendDnsQuery ( DnsResolverInfo resolver,
uint16_t  xid 
)
private

Definition at line 399 of file dns_handler.cc.

Here is the call graph for this function:

void DnsHandler::SendDnsResponse ( )
private

Definition at line 890 of file dns_handler.cc.

Here is the call graph for this function:

bool DnsHandler::SendToDefaultServer ( )
private

Definition at line 668 of file dns_handler.cc.

Here is the call graph for this function:

void DnsHandler::SendXmppUpdate ( AgentDnsXmppChannel channel,
DnsUpdateData xmpp_data 
)
private

Definition at line 806 of file dns_handler.cc.

Here is the call graph for this function:

bool DnsHandler::TimerExpiry ( uint16_t  xid)

Definition at line 1113 of file dns_handler.cc.

Here is the call graph for this function:

void DnsHandler::Update ( InterTaskMsg msg)
private

Definition at line 1027 of file dns_handler.cc.

Here is the call graph for this function:

bool DnsHandler::UpdateAll ( )
private

Definition at line 792 of file dns_handler.cc.

Here is the call graph for this function:

void DnsHandler::UpdateGWAddress ( DnsItem item)
private

Definition at line 1018 of file dns_handler.cc.

Here is the call graph for this function:

void DnsHandler::UpdateOffsets ( DnsItem item,
bool  name_update_required 
)
private

Definition at line 994 of file dns_handler.cc.

Here is the call graph for this function:

void DnsHandler::UpdateQueryNames ( )
private

Definition at line 971 of file dns_handler.cc.

void DnsHandler::UpdateStats ( )
private

Definition at line 1092 of file dns_handler.cc.

Here is the call graph for this function:

Friends And Related Function Documentation

friend class DnsTest
friend

Definition at line 56 of file dns_handler.h.

Member Data Documentation

Action DnsHandler::action_
private

Definition at line 105 of file dns_handler.h.

uint8_t DnsHandler::curr_index_
private

Definition at line 127 of file dns_handler.h.

std::vector<DnsResolverInfo *> DnsHandler::def_dns_resolvers_
private

Definition at line 113 of file dns_handler.h.

bool DnsHandler::default_method_
private

Definition at line 126 of file dns_handler.h.

dnshdr* DnsHandler::dns_
private

Definition at line 101 of file dns_handler.h.

std::vector<DnsResolverInfo *> DnsHandler::dns_resolvers_
private

Definition at line 112 of file dns_handler.h.

uint16_t DnsHandler::dns_resp_size_
private

Definition at line 103 of file dns_handler.h.

std::string DnsHandler::domain_name_
private

Definition at line 115 of file dns_handler.h.

std::string DnsHandler::ipam_name_
private

Definition at line 114 of file dns_handler.h.

autogen::IpamType DnsHandler::ipam_type_
private

Definition at line 116 of file dns_handler.h.

DnsItems DnsHandler::items_
private

Definition at line 118 of file dns_handler.h.

DnsItems DnsHandler::linklocal_items_
private

Definition at line 119 of file dns_handler.h.

const uint32_t DnsHandler::max_items_per_xmpp_msg = 20
static

Definition at line 26 of file dns_handler.h.

tbb::mutex DnsHandler::mutex_
private

Definition at line 125 of file dns_handler.h.

DnsNameEncoder DnsHandler::name_encoder_
private

Definition at line 120 of file dns_handler.h.

uint16_t DnsHandler::pend_req_
private

Definition at line 123 of file dns_handler.h.

bool DnsHandler::query_name_update_
private

Definition at line 121 of file dns_handler.h.

uint16_t DnsHandler::query_name_update_len_
private

Definition at line 122 of file dns_handler.h.

ResolvList DnsHandler::resolv_list_
private

Definition at line 124 of file dns_handler.h.

uint8_t* DnsHandler::resp_ptr_
private

Definition at line 102 of file dns_handler.h.

QueryKey* DnsHandler::rkey_
private

Definition at line 106 of file dns_handler.h.

autogen::VirtualDnsType DnsHandler::vdns_type_
private

Definition at line 117 of file dns_handler.h.

uint16_t DnsHandler::xid_
private

Definition at line 104 of file dns_handler.h.


The documentation for this class was generated from the following files: