xorp

IoLinkComm Class Reference

A class that handles raw link I/O communication for a specific protocol. More...

#include <io_link_manager.hh>

Inheritance diagram for IoLinkComm:
NONCOPYABLE IoLinkReceiver

List of all members.

Classes

class  InputFilter
 Filter class. More...
class  JoinedMulticastGroup
 Joined multicast group class. More...

Public Member Functions

 IoLinkComm (IoLinkManager &io_link_manager, const IfTree &iftree, const string &if_name, const string &vif_name, uint16_t ether_type, const string &filter_program)
 Constructor for IoLinkComm.
virtual ~IoLinkComm ()
 Virtual destructor.
void allocate_io_link_plugins ()
 Allocate the I/O Link plugins (one per data plane manager).
void deallocate_io_link_plugins ()
 Deallocate the I/O Link plugins (one per data plane manager).
void allocate_io_link_plugin (FeaDataPlaneManager *fea_data_plane_manager)
 Allocate an I/O Link plugin for a given data plane manager.
void deallocate_io_link_plugin (FeaDataPlaneManager *fea_data_plane_manager)
 Deallocate the I/O Link plugin for a given data plane manager.
void start_io_link_plugins ()
 Start all I/O Link plugins.
void stop_io_link_plugins ()
 Stop all I/O Link plugins.
int add_filter (InputFilter *filter)
 Add a filter to list of input filters.
int remove_filter (InputFilter *filter)
 Remove filter from list of input filters.
bool no_input_filters () const
int send_packet (const Mac &src_address, const Mac &dst_address, uint16_t ether_type, const vector< uint8_t > &payload, string &error_msg)
 Send a raw link-level packet.
virtual void recv_packet (const Mac &src_address, const Mac &dst_address, uint16_t ether_type, const vector< uint8_t > &payload)
 Received a raw link-level packet.
int join_multicast_group (const Mac &group_address, const string &receiver_name, string &error_msg)
 Join a MAC multicast group.
int leave_multicast_group (const Mac &group_address, const string &receiver_name, string &error_msg)
 Leave a MAC multicast group.
const string & if_name () const
 Get the interface name.
const string & vif_name () const
 Get the vif name.
uint16_t ether_type () const
 Get the EtherType protocol number.
const string & filter_program () const
 Get the filter program.

Private Types

typedef list< pair
< FeaDataPlaneManager
*, IoLink * > > 
IoLinkPlugins
typedef map
< JoinedMulticastGroup,
JoinedMulticastGroup
JoinedGroupsTable

Private Member Functions

 IoLinkComm (const IoLinkComm &)
IoLinkCommoperator= (const IoLinkComm &)

Private Attributes

IoLinkManager_io_link_manager
const IfTree_iftree
const string _if_name
const string _vif_name
const uint16_t _ether_type
const string _filter_program
IoLinkPlugins _io_link_plugins
list< InputFilter * > _input_filters
JoinedGroupsTable _joined_groups_table

Detailed Description

A class that handles raw link I/O communication for a specific protocol.

It also allows arbitrary filters to receive the raw link-level data for that protocol.


Constructor & Destructor Documentation

IoLinkComm::IoLinkComm ( IoLinkManager io_link_manager,
const IfTree iftree,
const string &  if_name,
const string &  vif_name,
uint16_t  ether_type,
const string &  filter_program 
)

Constructor for IoLinkComm.

Parameters:
io_link_managerthe corresponding I/O Link manager (IoLinkManager).
iftreethe interface tree to use.
if_namethe interface name.
vif_namethe vif name.
ether_typethe EtherType protocol number.
filter_programthe optional filter program to be applied on the received packets.

Member Function Documentation

int IoLinkComm::add_filter ( InputFilter filter)

Add a filter to list of input filters.

The IoLinkComm class assumes that the callee will be responsible for managing the memory associated with the filter and will call remove_filter() if the filter is deleted or goes out of scope.

Parameters:
filterthe filter to add.
Returns:
XORP_OK on success, otherwise XORP_ERROR.
void IoLinkComm::allocate_io_link_plugin ( FeaDataPlaneManager fea_data_plane_manager)

Allocate an I/O Link plugin for a given data plane manager.

Parameters:
fea_data_plane_managerthe data plane manager.
void IoLinkComm::deallocate_io_link_plugin ( FeaDataPlaneManager fea_data_plane_manager)

Deallocate the I/O Link plugin for a given data plane manager.

Parameters:
fea_data_plane_managerthe data plane manager.
uint16_t IoLinkComm::ether_type ( ) const [inline]

Get the EtherType protocol number.

Returns:
the EtherType protocol number.
const string& IoLinkComm::filter_program ( ) const [inline]

Get the filter program.

Returns:
the filter program.
const string& IoLinkComm::if_name ( ) const [inline]

Get the interface name.

Returns:
the interface name.
int IoLinkComm::join_multicast_group ( const Mac group_address,
const string &  receiver_name,
string &  error_msg 
)

Join a MAC multicast group.

Parameters:
group_addressthe multicast group address to join.
receiver_namethe name of the receiver.
error_msgthe error message (if error).
Returns:
XORP_OK on success, otherwise XORP_ERROR.
int IoLinkComm::leave_multicast_group ( const Mac group_address,
const string &  receiver_name,
string &  error_msg 
)

Leave a MAC multicast group.

Parameters:
group_addressthe multicast group address to leave.
receiver_namethe name of the receiver.
error_msgthe error message (if error).
Returns:
XORP_OK on success, otherwise XORP_ERROR.
bool IoLinkComm::no_input_filters ( ) const [inline]
Returns:
true if there are no filters associated with this instance.
void IoLinkComm::recv_packet ( const Mac src_address,
const Mac dst_address,
uint16_t  ether_type,
const vector< uint8_t > &  payload 
) [virtual]

Received a raw link-level packet.

Parameters:
src_addressthe MAC source address.
dst_addressthe MAC destination address.
ether_typethe EtherType protocol number.
packetthe payload, everything after the MAC header.

Implements IoLinkReceiver.

int IoLinkComm::remove_filter ( InputFilter filter)

Remove filter from list of input filters.

Parameters:
filterthe filter to remove.
Returns:
XORP_OK on success, otherwise XORP_ERROR.
int IoLinkComm::send_packet ( const Mac src_address,
const Mac dst_address,
uint16_t  ether_type,
const vector< uint8_t > &  payload,
string &  error_msg 
)

Send a raw link-level packet.

Parameters:
src_addressthe MAC source address.
dst_addressthe MAC destination address.
ether_typethe EtherType protocol number.
payloadthe payload, everything after the MAC header.
error_msgthe error message (if error).
Returns:
XORP_OK on success, otherwise XORP_ERROR.
const string& IoLinkComm::vif_name ( ) const [inline]

Get the vif name.

Returns:
the vif name.

The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations