class ProtoComm

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

Definition#include <mfea_proto_comm.hh>
InheritsProtoUnit (libproto) [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

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.

int  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: the socket value 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 enable_bool)

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 post-RFC-2292, 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:
enable_boolif true, set the option, otherwise reset it.

Returns: XORP_OK on success, otherwise XORP_ERROR.

int  recv_pktinfo (bool enable_bool)

recv_pktinfo

Enable/disable receiving information about some of the fields in the IP header 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. Note: used only for IPv6. In IPv4 we don't have this; the whole IP packet is passed to the application listening on a raw socket.

Parameters:
enable_boolif true, set the option, otherwise reset it.

Returns: XORP_OK on success, otherwise XORP_ERROR.

int  set_mcast_ttl (int ttl)

set_mcast_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 enable_bool)

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:
enable_boolif true, set the loopback, otherwise reset it.

Returns: XORP_OK on success, otherwise XORP_ERROR.

int  set_default_multicast_vif (uint16_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 (uint16_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 (uint16_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 (int fd, SelectorMask m)

proto_socket_read

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

This is called as a SelectorList callback.

Parameters:
fdfile descriptor that with event caused this method to be called.
mmask representing event type.

int  proto_socket_write (uint16_t vif_index, const IPvX& src, const IPvX& dst, int ip_ttl, int ip_tos, bool router_alert_bool, const uint8_t *databuf, size_t datalen)

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.
router_alert_boolif 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.

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 Aug 28 12:52:10 2003, using kdoc 2.0a54+XORP.