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

#include <pkt_handler.h>

Collaboration diagram for PktHandler:

Classes

struct  PacketBufferEnqueueItem
 
struct  PktStats
 

Public Types

enum  PktModuleName {
  INVALID, FLOW, ARP, DHCP,
  DHCPV6, DNS, ICMP, ICMPV6,
  DIAG, ICMP_ERROR, ICMPV6_ERROR, RX_PACKET,
  MAC_LEARNING, BFD, IGMP, MAC_IP_LEARNING,
  MAX_MODULES
}
 
typedef boost::function< bool(boost::shared_ptr
< PktInfo >)> 
RcvQueueFunc
 
typedef boost::function< void(PktTrace::Pkt &)> PktTraceCallback
 
typedef WorkQueue
< boost::shared_ptr
< PacketBufferEnqueueItem > > 
PktHandlerQueue
 

Public Member Functions

 PktHandler (Agent *, PktModule *pkt_module)
 
virtual ~PktHandler ()
 
void Register (PktModuleName type, RcvQueueFunc cb)
 
void Register (PktModuleName type, Proto *proto)
 
void Send (const AgentHdr &hdr, const PacketBufferPtr &buff)
 
PktModuleName ParsePacket (const AgentHdr &hdr, PktInfo *pkt_info, uint8_t *pkt)
 
PktModuleName ParseBfdDataPacket (const AgentHdr &hdr, PktInfo *pkt_info, uint8_t *pkt)
 
int ParseUserPkt (PktInfo *pkt_info, Interface *intf, PktType::Type &pkt_type, uint8_t *pkt)
 
bool ProcessPacket (boost::shared_ptr< PacketBufferEnqueueItem > item)
 
bool ProcessBfdDataPacket (boost::shared_ptr< PacketBufferEnqueueItem > item)
 
void HandleRcvPkt (const AgentHdr &hdr, const PacketBufferPtr &buff)
 
void SendMessage (PktModuleName mod, InterTaskMsg *msg)
 
bool IsGwPacket (const Interface *intf, const IpAddress &dst_ip)
 
const PktStatsGetStats () const
 
void ClearStats ()
 
void PktTraceIterate (PktModuleName mod, PktTraceCallback cb)
 
void PktTraceClear (PktModuleName mod)
 
void PktTraceBuffers (PktModuleName mod, uint32_t buffers)
 
uint32_t PktTraceBuffers (PktModuleName mod) const
 
uint32_t PktTraceSize (PktModuleName mod) const
 
void AddPktTrace (PktModuleName module, PktTrace::Direction dir, const PktInfo *pkt)
 
uint32_t EncapHeaderLen () const
 
Agentagent () const
 
PktModulepkt_module () const
 
void Enqueue (PktModuleName module, boost::shared_ptr< PktInfo > pkt_info)
 
bool IsFlowPacket (PktInfo *pkt_info)
 
void CalculatePortIP (PktInfo *pkt_info)
 
const PktHandlerQueuework_queue () const
 
bool IsBFDHealthCheckPacket (const PktInfo *pkt_info, const Interface *interface)
 
bool IsSegmentHealthCheckPacket (const PktInfo *pkt_info, const Interface *interface)
 
uint64_t GetBfdKaEnqueueCount ()
 
uint64_t GetPktEnqueueCount ()
 

Static Public Attributes

static const uint32_t kMulticastControlWord = 0
 
static const uint32_t kMulticastControlWordSize = 4
 

Private Member Functions

void PktModuleEnqueue (PktModuleName mod, const AgentHdr &hdr, boost::shared_ptr< PktInfo > pkt_info, uint8_t *pkt)
 
int ParseEthernetHeader (PktInfo *pkt_info, uint8_t *pkt)
 
int ParseMplsHdr (PktInfo *pkt_info, uint8_t *pkt)
 
int ParseIpPacket (PktInfo *pkt_info, PktType::Type &pkt_type, uint8_t *ptr)
 
int ParseMPLSoGRE (PktInfo *pkt_info, uint8_t *pkt)
 
int ParseMPLSoUDP (PktInfo *pkt_info, uint8_t *pkt)
 
int ParseControlWord (PktInfo *pkt_info, uint8_t *pkt, const MplsLabel *mpls)
 
int ParseUDPTunnels (PktInfo *pkt_info, uint8_t *pkt)
 
int ParseVxlan (PktInfo *pkt_info, uint8_t *pkt)
 
int ParseUdp (PktInfo *pkt_info, uint8_t *pkt)
 
bool ComputeForwardingMode (PktInfo *pkt_info, const Interface *intf) const
 
void SetOuterIp (PktInfo *pkt_info, uint8_t *pkt)
 
void SetOuterMac (PktInfo *pkt_info)
 
bool IgnoreFragmentedPacket (PktInfo *pkt_info)
 
bool IsDHCPPacket (PktInfo *pkt_info)
 
bool IsValidInterface (uint32_t ifindex, Interface **interface)
 
bool IsToRDevice (uint32_t vrf_id, const IpAddress &ip)
 
bool IsManagedTORPacket (Interface *intf, PktInfo *pkt_info, PktType::Type &pkt_type, uint8_t *pkt, bool *pkt_ok)
 
bool IsFlowPacket (const AgentHdr &agent_hdr)
 
bool IsDiagPacket (PktInfo *pkt_info)
 
bool ValidateIpPacket (PktInfo *pkt_info)
 
 DISALLOW_COPY_AND_ASSIGN (PktHandler)
 

Private Attributes

boost::array< Proto
*, MAX_MODULES
proto_list_
 
Protobfd_keepalive_proto_
 
PktStats stats_
 
boost::array< PktTrace,
MAX_MODULES
pkt_trace_
 
DBTableBase::ListenerId iid_
 
Agentagent_
 
PktModulepkt_module_
 
PktHandlerQueue work_queue_
 
PktHandlerQueue work_queue_bfd_ka_
 

Detailed Description

Definition at line 224 of file pkt_handler.h.

Member Typedef Documentation

Definition at line 276 of file pkt_handler.h.

typedef boost::function<void(PktTrace::Pkt &)> PktHandler::PktTraceCallback

Definition at line 227 of file pkt_handler.h.

typedef boost::function<bool(boost::shared_ptr<PktInfo>)> PktHandler::RcvQueueFunc

Definition at line 226 of file pkt_handler.h.

Member Enumeration Documentation

Enumerator
INVALID 
FLOW 
ARP 
DHCP 
DHCPV6 
DNS 
ICMP 
ICMPV6 
DIAG 
ICMP_ERROR 
ICMPV6_ERROR 
RX_PACKET 
MAC_LEARNING 
BFD 
IGMP 
MAC_IP_LEARNING 
MAX_MODULES 

Definition at line 231 of file pkt_handler.h.

Constructor & Destructor Documentation

PktHandler::PktHandler ( Agent agent,
PktModule pkt_module 
)

Definition at line 57 of file pkt_handler.cc.

Here is the call graph for this function:

PktHandler::~PktHandler ( )
virtual

Definition at line 78 of file pkt_handler.cc.

Here is the call graph for this function:

Member Function Documentation

void PktHandler::AddPktTrace ( PktModuleName  module,
PktTrace::Direction  dir,
const PktInfo pkt 
)

Definition at line 1506 of file pkt_handler.cc.

Agent* PktHandler::agent ( ) const
inline

Definition at line 317 of file pkt_handler.h.

void PktHandler::CalculatePortIP ( PktInfo pkt_info)

Definition at line 104 of file pkt_handler.cc.

Here is the call graph for this function:

void PktHandler::ClearStats ( )
inline

Definition at line 301 of file pkt_handler.h.

Here is the call graph for this function:

bool PktHandler::ComputeForwardingMode ( PktInfo pkt_info,
const Interface intf 
) const
private

Definition at line 490 of file pkt_handler.cc.

Here is the call graph for this function:

PktHandler::DISALLOW_COPY_AND_ASSIGN ( PktHandler  )
private
uint32_t PktHandler::EncapHeaderLen ( ) const

Definition at line 89 of file pkt_handler.cc.

Here is the call graph for this function:

void PktHandler::Enqueue ( PktModuleName  module,
boost::shared_ptr< PktInfo pkt_info 
)

Definition at line 1512 of file pkt_handler.cc.

Here is the call graph for this function:

uint64_t PktHandler::GetBfdKaEnqueueCount ( )
inline

Definition at line 329 of file pkt_handler.h.

Here is the call graph for this function:

uint64_t PktHandler::GetPktEnqueueCount ( )
inline

Definition at line 330 of file pkt_handler.h.

Here is the call graph for this function:

const PktStats& PktHandler::GetStats ( ) const
inline

Definition at line 300 of file pkt_handler.h.

void PktHandler::HandleRcvPkt ( const AgentHdr hdr,
const PacketBufferPtr buff 
)

Definition at line 411 of file pkt_handler.cc.

Here is the call graph for this function:

bool PktHandler::IgnoreFragmentedPacket ( PktInfo pkt_info)
private

Definition at line 1064 of file pkt_handler.cc.

Here is the call graph for this function:

bool PktHandler::IsBFDHealthCheckPacket ( const PktInfo pkt_info,
const Interface interface 
)

Definition at line 219 of file pkt_handler.cc.

Here is the call graph for this function:

bool PktHandler::IsDHCPPacket ( PktInfo pkt_info)
private

Definition at line 1085 of file pkt_handler.cc.

bool PktHandler::IsDiagPacket ( PktInfo pkt_info)
private

Definition at line 1253 of file pkt_handler.cc.

bool PktHandler::IsFlowPacket ( PktInfo pkt_info)

Definition at line 1237 of file pkt_handler.cc.

bool PktHandler::IsFlowPacket ( const AgentHdr agent_hdr)
private

Definition at line 1245 of file pkt_handler.cc.

bool PktHandler::IsGwPacket ( const Interface intf,
const IpAddress dst_ip 
)

Definition at line 1262 of file pkt_handler.cc.

Here is the call graph for this function:

bool PktHandler::IsManagedTORPacket ( Interface intf,
PktInfo pkt_info,
PktType::Type pkt_type,
uint8_t *  pkt,
bool *  pkt_ok 
)
private

Definition at line 1165 of file pkt_handler.cc.

Here is the call graph for this function:

bool PktHandler::IsSegmentHealthCheckPacket ( const PktInfo pkt_info,
const Interface interface 
)

Definition at line 232 of file pkt_handler.cc.

Here is the call graph for this function:

bool PktHandler::IsToRDevice ( uint32_t  vrf_id,
const IpAddress ip 
)
private

Definition at line 1101 of file pkt_handler.cc.

Here is the call graph for this function:

bool PktHandler::IsValidInterface ( uint32_t  ifindex,
Interface **  interface 
)
private

Definition at line 1302 of file pkt_handler.cc.

Here is the call graph for this function:

PktHandler::PktModuleName PktHandler::ParseBfdDataPacket ( const AgentHdr hdr,
PktInfo pkt_info,
uint8_t *  pkt 
)

Definition at line 245 of file pkt_handler.cc.

Here is the call graph for this function:

int PktHandler::ParseControlWord ( PktInfo pkt_info,
uint8_t *  pkt,
const MplsLabel mpls 
)
private

Definition at line 736 of file pkt_handler.cc.

Here is the call graph for this function:

int PktHandler::ParseEthernetHeader ( PktInfo pkt_info,
uint8_t *  pkt 
)
private

Definition at line 528 of file pkt_handler.cc.

int PktHandler::ParseIpPacket ( PktInfo pkt_info,
PktType::Type pkt_type,
uint8_t *  ptr 
)
private

Definition at line 555 of file pkt_handler.cc.

Here is the call graph for this function:

int PktHandler::ParseMplsHdr ( PktInfo pkt_info,
uint8_t *  pkt 
)
private

Definition at line 777 of file pkt_handler.cc.

Here is the call graph for this function:

int PktHandler::ParseMPLSoGRE ( PktInfo pkt_info,
uint8_t *  pkt 
)
private

Definition at line 838 of file pkt_handler.cc.

Here is the call graph for this function:

int PktHandler::ParseMPLSoUDP ( PktInfo pkt_info,
uint8_t *  pkt 
)
private

Definition at line 866 of file pkt_handler.cc.

Here is the call graph for this function:

PktHandler::PktModuleName PktHandler::ParsePacket ( const AgentHdr hdr,
PktInfo pkt_info,
uint8_t *  pkt 
)

Definition at line 280 of file pkt_handler.cc.

Here is the call graph for this function:

int PktHandler::ParseUdp ( PktInfo pkt_info,
uint8_t *  pkt 
)
private
int PktHandler::ParseUDPTunnels ( PktInfo pkt_info,
uint8_t *  pkt 
)
private

Definition at line 892 of file pkt_handler.cc.

Here is the call graph for this function:

int PktHandler::ParseUserPkt ( PktInfo pkt_info,
Interface intf,
PktType::Type pkt_type,
uint8_t *  pkt 
)

Definition at line 919 of file pkt_handler.cc.

Here is the call graph for this function:

int PktHandler::ParseVxlan ( PktInfo pkt_info,
uint8_t *  pkt 
)
private

Definition at line 880 of file pkt_handler.cc.

Here is the call graph for this function:

PktModule* PktHandler::pkt_module ( ) const
inline

Definition at line 318 of file pkt_handler.h.

void PktHandler::PktModuleEnqueue ( PktModuleName  mod,
const AgentHdr hdr,
boost::shared_ptr< PktInfo pkt_info,
uint8_t *  pkt 
)
private

Definition at line 472 of file pkt_handler.cc.

Here is the call graph for this function:

void PktHandler::PktTraceBuffers ( PktModuleName  mod,
uint32_t  buffers 
)
inline

Definition at line 304 of file pkt_handler.h.

uint32_t PktHandler::PktTraceBuffers ( PktModuleName  mod) const
inline

Definition at line 307 of file pkt_handler.h.

void PktHandler::PktTraceClear ( PktModuleName  mod)
inline

Definition at line 303 of file pkt_handler.h.

void PktHandler::PktTraceIterate ( PktModuleName  mod,
PktTraceCallback  cb 
)

Definition at line 1314 of file pkt_handler.cc.

Here is the call graph for this function:

uint32_t PktHandler::PktTraceSize ( PktModuleName  mod) const
inline

Definition at line 310 of file pkt_handler.h.

bool PktHandler::ProcessBfdDataPacket ( boost::shared_ptr< PacketBufferEnqueueItem item)

Definition at line 442 of file pkt_handler.cc.

Here is the call graph for this function:

bool PktHandler::ProcessPacket ( boost::shared_ptr< PacketBufferEnqueueItem item)

Definition at line 426 of file pkt_handler.cc.

Here is the call graph for this function:

void PktHandler::Register ( PktModuleName  type,
RcvQueueFunc  cb 
)
void PktHandler::Register ( PktModuleName  type,
Proto proto 
)

Definition at line 82 of file pkt_handler.cc.

void PktHandler::Send ( const AgentHdr hdr,
const PacketBufferPtr buff 
)

Definition at line 94 of file pkt_handler.cc.

Here is the call graph for this function:

void PktHandler::SendMessage ( PktModuleName  mod,
InterTaskMsg msg 
)

Definition at line 1054 of file pkt_handler.cc.

void PktHandler::SetOuterIp ( PktInfo pkt_info,
uint8_t *  pkt 
)
private

Definition at line 513 of file pkt_handler.cc.

void PktHandler::SetOuterMac ( PktInfo pkt_info)
private

Definition at line 523 of file pkt_handler.cc.

bool PktHandler::ValidateIpPacket ( PktInfo pkt_info)
private

Definition at line 903 of file pkt_handler.cc.

const PktHandlerQueue* PktHandler::work_queue ( ) const
inline

Definition at line 322 of file pkt_handler.h.

Member Data Documentation

Agent* PktHandler::agent_
private

Definition at line 369 of file pkt_handler.h.

Proto* PktHandler::bfd_keepalive_proto_
private

Definition at line 363 of file pkt_handler.h.

DBTableBase::ListenerId PktHandler::iid_
private

Definition at line 367 of file pkt_handler.h.

const uint32_t PktHandler::kMulticastControlWord = 0
static

Definition at line 229 of file pkt_handler.h.

const uint32_t PktHandler::kMulticastControlWordSize = 4
static

Definition at line 230 of file pkt_handler.h.

PktModule* PktHandler::pkt_module_
private

Definition at line 370 of file pkt_handler.h.

boost::array<PktTrace, MAX_MODULES> PktHandler::pkt_trace_
private

Definition at line 366 of file pkt_handler.h.

boost::array<Proto *, MAX_MODULES> PktHandler::proto_list_
private

Definition at line 362 of file pkt_handler.h.

PktStats PktHandler::stats_
private

Definition at line 365 of file pkt_handler.h.

PktHandlerQueue PktHandler::work_queue_
private

Definition at line 371 of file pkt_handler.h.

PktHandlerQueue PktHandler::work_queue_bfd_ka_
private

Definition at line 372 of file pkt_handler.h.


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