class ProtoComm

A class for socket I/O communication. More...

 
LOGO
 Annotated List  Files  Globals  Hierarchy  Index  Top

Public Methods


Detailed Description

Each protocol 'registers' for socket I/O and gets assigned one object of this class.

 ProtoComm (MfeaNode& mfea_node, int ipproto, xorp_module_id module_id)

ProtoComm

Constructor for given MFEA node, IP protocol, and module ID (xorp_module_id).

Parameters:

mfea_nodethe MFEA node (MfeaNode) this entry belongs to.
ipprotothe IP protocol number (e.g., IPPROTO_PIM for PIM).
module_idthe module ID (xorp_module_id) for the protocol.
 ~ProtoComm ()

~ProtoComm

[virtual]

Destructor

int  start ()

start

Start the ProtoComm.

Returns: XORP_OK on success, otherwise XORP_ERROR.

int  stop ()

stop

Stop the ProtoComm.

Returns: XORP_OK on success, otherwise XORP_ERROR.

int  ipproto ()

ipproto

[const]

Get the IP protocol number.

Returns: the IP protocol number.

XorpFd  proto_socket ()

proto_socket

[const]

Get the protocol socket.

The protocol socket is specific to the particular protocol of this entry.

Returns: the socket value if valid, otherwise XORP_ERROR.

int  open_proto_socket ()

open_proto_socket

Open an protocol socket.

The protocol socket is specific to the particular protocol of this entry.

Returns: XORP_OK on success, otherwise XORP_ERROR.

int  add_proto_socket_callback ()

add_proto_socket_callback

Add the method to read from the protocol socket.

Returns: XORP_OK on success, otherwise XORP_ERROR.

int  close_proto_socket ()

close_proto_socket

Close the protocol socket.

Returns: XORP_OK on success, otherwise XORP_ERROR.

int  ip_hdr_include (bool is_enabled)

ip_hdr_include

Set/reset the "Header Included" option (for IPv4) on the protocol socket.

If set, the IP header of a raw packet should be created by the application itself, otherwise the kernel will build it. Note: used only for IPv4. In RFC-3542, IPV6_PKTINFO has similar functions, but because it requires the interface index and outgoing address, it is of little use for our purpose. Also, in RFC-2292 this option was a flag, so for compatibility reasons we better not set it here; instead, we will use sendmsg() to specify the header's field values.

Parameters:

is_enabledif true, set the option, otherwise reset it.

Returns: XORP_OK on success, otherwise XORP_ERROR.

int  recv_pktinfo (bool is_enabled)

recv_pktinfo

Enable/disable receiving information about a packet received on the protocol socket.

If enabled, values such as interface index, destination address and IP TTL (a.k.a. hop-limit in IPv6), and hop-by-hop options will be received as well.

Parameters:

is_enabledif true, set the option, otherwise reset it.

Returns: XORP_OK on success, otherwise XORP_ERROR.

int  set_multicast_ttl (int ttl)

set_multicast_ttl

Set the default TTL (or hop-limit in IPv6) for the outgoing multicast packets on the protocol socket.

Parameters:

ttlthe desired IP TTL (a.k.a. hop-limit in IPv6) value.

Returns: XORP_OK on success, otherwise XORP_ERROR.

int  set_multicast_loop (bool is_enabled)

set_multicast_loop

Set/reset the "Multicast Loop" flag on the protocol socket.

If the multicast loopback flag is set, a multicast datagram sent on that socket will be delivered back to this host (assuming the host is a member of the same multicast group).

Parameters:

is_enabledif true, set the loopback, otherwise reset it.

Returns: XORP_OK on success, otherwise XORP_ERROR.

int  set_default_multicast_vif (uint32_t vif_index)

set_default_multicast_vif

Set default interface for outgoing multicast on the protocol socket.

Parameters:

vif_indexthe vif index of the interface to become the default multicast interface.

Returns: XORP_OK on success, otherwise XORP_ERROR.

int  join_multicast_group (uint32_t vif_index, const IPvX& group)

join_multicast_group

Join a multicast group on an interface.

Parameters:

vif_indexthe vif index of the interface to join the multicast group.
groupthe multicast group to join.

Returns: XORP_OK on success, otherwise XORP_ERROR.

int  leave_multicast_group (uint32_t vif_index, const IPvX& group)

leave_multicast_group

Leave a multicast group on an interface.

Parameters:

vif_indexthe vif index of the interface to leave the multicast group.
groupthe multicast group to leave.

Returns: XORP_OK on success, otherwise XORP_ERROR.

void  proto_socket_read (XorpFd fd, IoEventType type)

proto_socket_read

Read data from a protocol socket, and then call the appropriate protocol module to process it.

This is called as a IoEventCb callback.

Parameters:

fdfile descriptor that with event caused this method to be called.
mmask representing event type.
int  proto_socket_write (uint32_t vif_index, const IPvX& src, const IPvX& dst, int ip_ttl, int ip_tos, bool is_router_alert, const uint8_t *databuf, size_t datalen, string& error_msg)

proto_socket_write

Send a packet on a protocol socket.

Parameters:

vif_indexthe vif index of the vif that will be used to send-out the packet.
srcthe source address of the packet.
dstthe destination address of the packet.
ip_ttlthe TTL (a.k.a. Hop-limit in IPv6) of the packet. If it has a negative value, the TTL will be set here or by the lower layers.
ip_tosthe TOS (a.k.a. Traffic Class in IPv6) of the packet. If it has a negative value, the TOS will be set here or by the lower layers.
is_router_alertif true, then the IP packet with the data should have the Router Alert option included.
databufthe data buffer.
datalenthe length of the data in databuf.
error_msgthe error message (if error).

Returns: XORP_OK on success, otherwise XORP_ERROR.

void  set_ignore_my_packets (bool v)

set_ignore_my_packets

Set/reset the flag whether to ignore the receiving my own packets.

Parameters:

vif true, ignore my own packets on receiving, otherwise don't ignore them.
xorp_module_id  module_id ()

module_id

[const]

Get the module ID (xorp_module_id) for the protocol that created this entry.

Returns: the module ID (xorp_module_id) of the protocol that created this entry.

Reimplemented from ProtoUnit.


Generated by: pavlin on possum.icir.org on Thu Mar 9 04:43:06 2006, using kdoc $.