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

#include <dhcp_proto.h>

Inheritance diagram for DhcpProto:
Collaboration diagram for DhcpProto:

Classes

struct  DhcpStats
 
struct  DhcpVhostMsg
 

Public Types

enum  DhcpMsgType { DHCP_VHOST_MSG }
 
typedef std::map< Interface
*, DhcpLeaseDb * > 
LeaseManagerMap
 
typedef std::pair< Interface
*, DhcpLeaseDb * > 
LeaseManagerPair
 
- Public Types inherited from Proto
typedef WorkQueue
< boost::shared_ptr< PktInfo > > 
ProtoWorkQueue
 

Public Member Functions

void Shutdown ()
 
 DhcpProto (Agent *agent, boost::asio::io_context &io, bool run_with_vrouter)
 
virtual ~DhcpProto ()
 
ProtoHandlerAllocProtoHandler (boost::shared_ptr< PktInfo > info, boost::asio::io_context &io)
 
void SendDhcpIpc (uint8_t *dhcp, std::size_t len)
 
bool dhcp_relay_mode () const
 
void set_dhcp_relay_mode (bool mode)
 
Interfaceip_fabric_interface () const
 
void set_ip_fabric_interface (Interface *itf)
 
uint32_t ip_fabric_interface_index () const
 
void set_ip_fabric_interface_index (uint32_t ind)
 
uint32_t pkt_interface_index () const
 
void set_pkt_interface_index (uint32_t ind)
 
const MacAddressip_fabric_interface_mac () const
 
void set_ip_fabric_interface_mac (const MacAddress &mac)
 
bool IsRunningWithVrouter () const
 
void IncrStatsDiscover ()
 
void IncrStatsRequest ()
 
void IncrStatsInform ()
 
void IncrStatsDecline ()
 
void IncrStatsRelease ()
 
void IncrStatsOther ()
 
void IncrStatsOffers ()
 
void IncrStatsAcks ()
 
void IncrStatsNacks ()
 
void IncrStatsRelayReqs ()
 
void IncrStatsRelayResps ()
 
void IncrStatsErrors ()
 
void IncrUnknownMsgDrops ()
 
void IncrDhcpDisabledDrops ()
 
void IncrIncorrectMac ()
 
const DhcpStatsGetStats () const
 
void ClearStats ()
 
void CreateLeaseDb (VmInterface *vmi)
 
void DeleteLeaseDb (VmInterface *vmi)
 
DhcpLeaseDbGetLeaseDb (Interface *intrface)
 
const LeaseManagerMaplease_manager () const
 
- Public Member Functions inherited from Proto
 Proto (Agent *agent, const char *task_name, PktHandler::PktModuleName mod, boost::asio::io_context &io)
 
virtual ~Proto ()
 
virtual bool Validate (PktInfo *msg)
 
virtual bool Enqueue (boost::shared_ptr< PktInfo > msg)
 
virtual void ProcessStats (PktStatsType::Type type)
 
void FreeBuffer (PktInfo *msg)
 
bool ProcessProto (boost::shared_ptr< PktInfo > msg_info)
 
bool RunProtoHandler (ProtoHandler *handler)
 
void set_trace (bool val)
 
void set_free_buffer (bool val)
 
boost::asio::io_context & get_io_service () const
 
Agentagent () const
 
const ProtoWorkQueuework_queue () const
 
virtual void TokenAvailable (TokenPool *pool)
 

Static Public Attributes

static const uint32_t kDhcpMaxPacketSize = 1024
 
static const uint32_t kDhcpLeaseFileDeleteTimeout = 60 * 60 * 1000
 

Private Member Functions

void ItfNotify (DBEntryBase *entry)
 
void VnNotify (DBEntryBase *entry)
 
void AsyncRead ()
 
void ReadHandler (const boost::system::error_code &error, std::size_t len)
 
std::string GetLeaseFileName (const VmInterface *vmi)
 
void StartLeaseFileCleanupTimer ()
 
bool LeaseFileCleanupExpiry (uint32_t seqno)
 
 DISALLOW_COPY_AND_ASSIGN (DhcpProto)
 

Private Attributes

bool run_with_vrouter_
 
bool dhcp_relay_mode_
 
Interfaceip_fabric_interface_
 
uint32_t ip_fabric_interface_index_
 
uint32_t pkt_interface_index_
 
MacAddress ip_fabric_interface_mac_
 
DBTableBase::ListenerId iid_
 
DBTableBase::ListenerId vnid_
 
DhcpStats stats_
 
boost::asio::ip::udp::socket dhcp_server_socket_
 
boost::asio::ip::udp::endpoint remote_endpoint_
 
uint8_t * dhcp_server_read_buf_
 
std::set< VmInterface * > gw_vmi_list_
 
LeaseManagerMap lease_manager_
 
uint32_t gateway_delete_seqno_
 
Timerlease_file_cleanup_timer_
 

Additional Inherited Members

- Protected Attributes inherited from Proto
Agentagent_
 
PktHandler::PktModuleName module_
 
bool trace_
 
bool free_buffer_
 
boost::asio::io_context & io_
 
ProtoWorkQueue work_queue_
 

Detailed Description

Definition at line 23 of file dhcp_proto.h.

Member Typedef Documentation

Definition at line 32 of file dhcp_proto.h.

Definition at line 33 of file dhcp_proto.h.

Member Enumeration Documentation

Enumerator
DHCP_VHOST_MSG 

Definition at line 28 of file dhcp_proto.h.

Constructor & Destructor Documentation

DhcpProto::DhcpProto ( Agent agent,
boost::asio::io_context &  io,
bool  run_with_vrouter 
)

Definition at line 19 of file dhcp_proto.cc.

Here is the call graph for this function:

DhcpProto::~DhcpProto ( )
virtual

Definition at line 60 of file dhcp_proto.cc.

Member Function Documentation

ProtoHandler * DhcpProto::AllocProtoHandler ( boost::shared_ptr< PktInfo info,
boost::asio::io_context &  io 
)
virtual

Implements Proto.

Definition at line 113 of file dhcp_proto.cc.

Here is the call graph for this function:

void DhcpProto::AsyncRead ( )
private

Definition at line 82 of file dhcp_proto.cc.

Here is the call graph for this function:

void DhcpProto::ClearStats ( )
inline

Definition at line 117 of file dhcp_proto.h.

Here is the call graph for this function:

void DhcpProto::CreateLeaseDb ( VmInterface vmi)

Definition at line 158 of file dhcp_proto.cc.

Here is the call graph for this function:

void DhcpProto::DeleteLeaseDb ( VmInterface vmi)

Definition at line 206 of file dhcp_proto.cc.

Here is the call graph for this function:

bool DhcpProto::dhcp_relay_mode ( ) const
inline

Definition at line 76 of file dhcp_proto.h.

DhcpProto::DISALLOW_COPY_AND_ASSIGN ( DhcpProto  )
private
DhcpLeaseDb * DhcpProto::GetLeaseDb ( Interface intrface)

Definition at line 226 of file dhcp_proto.cc.

std::string DhcpProto::GetLeaseFileName ( const VmInterface vmi)
private

Definition at line 234 of file dhcp_proto.cc.

Here is the call graph for this function:

const DhcpStats& DhcpProto::GetStats ( ) const
inline

Definition at line 116 of file dhcp_proto.h.

void DhcpProto::IncrDhcpDisabledDrops ( )
inline

Definition at line 114 of file dhcp_proto.h.

void DhcpProto::IncrIncorrectMac ( )
inline

Definition at line 115 of file dhcp_proto.h.

void DhcpProto::IncrStatsAcks ( )
inline

Definition at line 108 of file dhcp_proto.h.

void DhcpProto::IncrStatsDecline ( )
inline

Definition at line 104 of file dhcp_proto.h.

void DhcpProto::IncrStatsDiscover ( )
inline

Definition at line 101 of file dhcp_proto.h.

void DhcpProto::IncrStatsErrors ( )
inline

Definition at line 112 of file dhcp_proto.h.

void DhcpProto::IncrStatsInform ( )
inline

Definition at line 103 of file dhcp_proto.h.

void DhcpProto::IncrStatsNacks ( )
inline

Definition at line 109 of file dhcp_proto.h.

void DhcpProto::IncrStatsOffers ( )
inline

Definition at line 107 of file dhcp_proto.h.

void DhcpProto::IncrStatsOther ( )
inline

Definition at line 106 of file dhcp_proto.h.

void DhcpProto::IncrStatsRelayReqs ( )
inline

Definition at line 110 of file dhcp_proto.h.

void DhcpProto::IncrStatsRelayResps ( )
inline

Definition at line 111 of file dhcp_proto.h.

void DhcpProto::IncrStatsRelease ( )
inline

Definition at line 105 of file dhcp_proto.h.

void DhcpProto::IncrStatsRequest ( )
inline

Definition at line 102 of file dhcp_proto.h.

void DhcpProto::IncrUnknownMsgDrops ( )
inline

Definition at line 113 of file dhcp_proto.h.

Interface* DhcpProto::ip_fabric_interface ( ) const
inline

Definition at line 79 of file dhcp_proto.h.

uint32_t DhcpProto::ip_fabric_interface_index ( ) const
inline

Definition at line 81 of file dhcp_proto.h.

const MacAddress& DhcpProto::ip_fabric_interface_mac ( ) const
inline

Definition at line 93 of file dhcp_proto.h.

bool DhcpProto::IsRunningWithVrouter ( ) const
inline

Definition at line 99 of file dhcp_proto.h.

void DhcpProto::ItfNotify ( DBEntryBase entry)
private

Definition at line 118 of file dhcp_proto.cc.

Here is the call graph for this function:

const LeaseManagerMap& DhcpProto::lease_manager ( ) const
inline

Definition at line 122 of file dhcp_proto.h.

bool DhcpProto::LeaseFileCleanupExpiry ( uint32_t  seqno)
private

Definition at line 260 of file dhcp_proto.cc.

Here is the call graph for this function:

uint32_t DhcpProto::pkt_interface_index ( ) const
inline

Definition at line 87 of file dhcp_proto.h.

void DhcpProto::ReadHandler ( const boost::system::error_code &  error,
std::size_t  len 
)
private

Definition at line 92 of file dhcp_proto.cc.

Here is the call graph for this function:

void DhcpProto::SendDhcpIpc ( uint8_t *  dhcp,
std::size_t  len 
)

Definition at line 108 of file dhcp_proto.cc.

Here is the call graph for this function:

void DhcpProto::set_dhcp_relay_mode ( bool  mode)
inline

Definition at line 77 of file dhcp_proto.h.

void DhcpProto::set_ip_fabric_interface ( Interface itf)
inline

Definition at line 80 of file dhcp_proto.h.

void DhcpProto::set_ip_fabric_interface_index ( uint32_t  ind)
inline

Definition at line 84 of file dhcp_proto.h.

void DhcpProto::set_ip_fabric_interface_mac ( const MacAddress mac)
inline

Definition at line 96 of file dhcp_proto.h.

void DhcpProto::set_pkt_interface_index ( uint32_t  ind)
inline

Definition at line 90 of file dhcp_proto.h.

void DhcpProto::Shutdown ( )

Definition at line 63 of file dhcp_proto.cc.

Here is the call graph for this function:

void DhcpProto::StartLeaseFileCleanupTimer ( )
private

Definition at line 252 of file dhcp_proto.cc.

Here is the call graph for this function:

void DhcpProto::VnNotify ( DBEntryBase entry)
private

Definition at line 215 of file dhcp_proto.cc.

Here is the call graph for this function:

Member Data Documentation

bool DhcpProto::dhcp_relay_mode_
private

Definition at line 134 of file dhcp_proto.h.

uint8_t* DhcpProto::dhcp_server_read_buf_
private

Definition at line 145 of file dhcp_proto.h.

boost::asio::ip::udp::socket DhcpProto::dhcp_server_socket_
private

Definition at line 143 of file dhcp_proto.h.

uint32_t DhcpProto::gateway_delete_seqno_
private

Definition at line 149 of file dhcp_proto.h.

std::set<VmInterface *> DhcpProto::gw_vmi_list_
private

Definition at line 147 of file dhcp_proto.h.

DBTableBase::ListenerId DhcpProto::iid_
private

Definition at line 139 of file dhcp_proto.h.

Interface* DhcpProto::ip_fabric_interface_
private

Definition at line 135 of file dhcp_proto.h.

uint32_t DhcpProto::ip_fabric_interface_index_
private

Definition at line 136 of file dhcp_proto.h.

MacAddress DhcpProto::ip_fabric_interface_mac_
private

Definition at line 138 of file dhcp_proto.h.

const uint32_t DhcpProto::kDhcpLeaseFileDeleteTimeout = 60 * 60 * 1000
static

Definition at line 26 of file dhcp_proto.h.

const uint32_t DhcpProto::kDhcpMaxPacketSize = 1024
static

Definition at line 25 of file dhcp_proto.h.

Timer* DhcpProto::lease_file_cleanup_timer_
private

Definition at line 150 of file dhcp_proto.h.

LeaseManagerMap DhcpProto::lease_manager_
private

Definition at line 148 of file dhcp_proto.h.

uint32_t DhcpProto::pkt_interface_index_
private

Definition at line 137 of file dhcp_proto.h.

boost::asio::ip::udp::endpoint DhcpProto::remote_endpoint_
private

Definition at line 144 of file dhcp_proto.h.

bool DhcpProto::run_with_vrouter_
private

Definition at line 133 of file dhcp_proto.h.

DhcpStats DhcpProto::stats_
private

Definition at line 141 of file dhcp_proto.h.

DBTableBase::ListenerId DhcpProto::vnid_
private

Definition at line 140 of file dhcp_proto.h.


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