OpenSDN source code
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_MODULESproto_list_
 
Protobfd_keepalive_proto_
 
PktStats stats_
 
boost::array< PktTrace, MAX_MODULESpkt_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

◆ PktHandlerQueue

Definition at line 276 of file pkt_handler.h.

◆ PktTraceCallback

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

Definition at line 227 of file pkt_handler.h.

◆ RcvQueueFunc

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

Definition at line 226 of file pkt_handler.h.

Member Enumeration Documentation

◆ PktModuleName

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::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::~PktHandler ( )
virtual

Definition at line 78 of file pkt_handler.cc.

Here is the call graph for this function:

Member Function Documentation

◆ AddPktTrace()

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

Definition at line 1506 of file pkt_handler.cc.

◆ agent()

Agent* PktHandler::agent ( ) const
inline

Definition at line 317 of file pkt_handler.h.

◆ CalculatePortIP()

void PktHandler::CalculatePortIP ( PktInfo pkt_info)

Definition at line 104 of file pkt_handler.cc.

Here is the call graph for this function:

◆ ClearStats()

void PktHandler::ClearStats ( )
inline

Definition at line 301 of file pkt_handler.h.

Here is the call graph for this function:

◆ ComputeForwardingMode()

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:

◆ DISALLOW_COPY_AND_ASSIGN()

PktHandler::DISALLOW_COPY_AND_ASSIGN ( PktHandler  )
private

◆ EncapHeaderLen()

uint32_t PktHandler::EncapHeaderLen ( ) const

Definition at line 89 of file pkt_handler.cc.

Here is the call graph for this function:

◆ Enqueue()

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:

◆ GetBfdKaEnqueueCount()

uint64_t PktHandler::GetBfdKaEnqueueCount ( )
inline

Definition at line 329 of file pkt_handler.h.

Here is the call graph for this function:

◆ GetPktEnqueueCount()

uint64_t PktHandler::GetPktEnqueueCount ( )
inline

Definition at line 330 of file pkt_handler.h.

Here is the call graph for this function:

◆ GetStats()

const PktStats& PktHandler::GetStats ( ) const
inline

Definition at line 300 of file pkt_handler.h.

◆ HandleRcvPkt()

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:

◆ IgnoreFragmentedPacket()

bool PktHandler::IgnoreFragmentedPacket ( PktInfo pkt_info)
private

Definition at line 1064 of file pkt_handler.cc.

Here is the call graph for this function:

◆ IsBFDHealthCheckPacket()

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:

◆ IsDHCPPacket()

bool PktHandler::IsDHCPPacket ( PktInfo pkt_info)
private

Definition at line 1085 of file pkt_handler.cc.

◆ IsDiagPacket()

bool PktHandler::IsDiagPacket ( PktInfo pkt_info)
private

Definition at line 1253 of file pkt_handler.cc.

◆ IsFlowPacket() [1/2]

bool PktHandler::IsFlowPacket ( const AgentHdr agent_hdr)
private

Definition at line 1245 of file pkt_handler.cc.

◆ IsFlowPacket() [2/2]

bool PktHandler::IsFlowPacket ( PktInfo pkt_info)

Definition at line 1237 of file pkt_handler.cc.

◆ IsGwPacket()

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:

◆ IsManagedTORPacket()

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:

◆ IsSegmentHealthCheckPacket()

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:

◆ IsToRDevice()

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:

◆ IsValidInterface()

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:

◆ ParseBfdDataPacket()

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:

◆ ParseControlWord()

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:

◆ ParseEthernetHeader()

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

Definition at line 528 of file pkt_handler.cc.

◆ ParseIpPacket()

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:

◆ ParseMplsHdr()

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:

◆ ParseMPLSoGRE()

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:

◆ ParseMPLSoUDP()

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:

◆ ParsePacket()

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:

◆ ParseUdp()

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

◆ ParseUDPTunnels()

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:

◆ ParseUserPkt()

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:

◆ ParseVxlan()

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:

◆ pkt_module()

PktModule* PktHandler::pkt_module ( ) const
inline

Definition at line 318 of file pkt_handler.h.

◆ PktModuleEnqueue()

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:

◆ PktTraceBuffers() [1/2]

uint32_t PktHandler::PktTraceBuffers ( PktModuleName  mod) const
inline

Definition at line 307 of file pkt_handler.h.

◆ PktTraceBuffers() [2/2]

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

Definition at line 304 of file pkt_handler.h.

◆ PktTraceClear()

void PktHandler::PktTraceClear ( PktModuleName  mod)
inline

Definition at line 303 of file pkt_handler.h.

◆ PktTraceIterate()

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

Definition at line 1314 of file pkt_handler.cc.

Here is the call graph for this function:

◆ PktTraceSize()

uint32_t PktHandler::PktTraceSize ( PktModuleName  mod) const
inline

Definition at line 310 of file pkt_handler.h.

◆ ProcessBfdDataPacket()

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:

◆ ProcessPacket()

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:

◆ Register() [1/2]

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

Definition at line 82 of file pkt_handler.cc.

◆ Register() [2/2]

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

◆ Send()

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:

◆ SendMessage()

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

Definition at line 1054 of file pkt_handler.cc.

◆ SetOuterIp()

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

Definition at line 513 of file pkt_handler.cc.

◆ SetOuterMac()

void PktHandler::SetOuterMac ( PktInfo pkt_info)
private

Definition at line 523 of file pkt_handler.cc.

◆ ValidateIpPacket()

bool PktHandler::ValidateIpPacket ( PktInfo pkt_info)
private

Definition at line 903 of file pkt_handler.cc.

◆ work_queue()

const PktHandlerQueue* PktHandler::work_queue ( ) const
inline

Definition at line 322 of file pkt_handler.h.

Member Data Documentation

◆ agent_

Agent* PktHandler::agent_
private

Definition at line 369 of file pkt_handler.h.

◆ bfd_keepalive_proto_

Proto* PktHandler::bfd_keepalive_proto_
private

Definition at line 363 of file pkt_handler.h.

◆ iid_

DBTableBase::ListenerId PktHandler::iid_
private

Definition at line 367 of file pkt_handler.h.

◆ kMulticastControlWord

const uint32_t PktHandler::kMulticastControlWord = 0
static

Definition at line 229 of file pkt_handler.h.

◆ kMulticastControlWordSize

const uint32_t PktHandler::kMulticastControlWordSize = 4
static

Definition at line 230 of file pkt_handler.h.

◆ pkt_module_

PktModule* PktHandler::pkt_module_
private

Definition at line 370 of file pkt_handler.h.

◆ pkt_trace_

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

Definition at line 366 of file pkt_handler.h.

◆ proto_list_

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

Definition at line 362 of file pkt_handler.h.

◆ stats_

PktStats PktHandler::stats_
private

Definition at line 365 of file pkt_handler.h.

◆ work_queue_

PktHandlerQueue PktHandler::work_queue_
private

Definition at line 371 of file pkt_handler.h.

◆ work_queue_bfd_ka_

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: