xorp

NexthopPortMapper Class Reference

A class for to keep the mapping between next-hop information and a port number. More...

#include <nexthop_port_mapper.hh>

List of all members.

Public Member Functions

void clear ()
 Clear all mapping.
int add_observer (NexthopPortMapperObserver *observer)
 Add an observer for observing changes to the mapper.
int delete_observer (NexthopPortMapperObserver *observer)
 Delete an observer for observing changes to the mapper.
void notify_observers ()
 Notify observers about any port mapping changes.
int lookup_nexthop_interface (const string &ifname, const string &vifname) const
 Lookup a next-hop interface/vif name to obtain the corresponding port number.
int lookup_nexthop_ipv4 (const IPv4 &ipv4) const
 Lookup a next-hop IPv4 address to obtain the corresponding port number.
int lookup_nexthop_ipv6 (const IPv6 &ipv6) const
 Lookup a next-hop IPv6 address to obtain the corresponding port number.
int add_interface (const string &ifname, const string &vifname, int port)
 Add an entry for an interface/vif name to port mapping.
int delete_interface (const string &ifname, const string &vifname)
 Delete an entry for an interface/vif name to port mapping.
int add_ipv4 (const IPv4 &ipv4, int port)
 Add an entry for an IPv4 address to port mapping.
int delete_ipv4 (const IPv4 &ipv4)
 Delete an entry for an IPv4 address to port mapping.
int add_ipv6 (const IPv6 &ipv6, int port)
 Add an entry for an IPv6 address to port mapping.
int delete_ipv6 (const IPv6 &ipv6)
 Delete an entry for an IPv6 address to port mapping.
int add_ipv4net (const IPv4Net &ipv4net, int port)
 Add an entry for an IPv4 subnet to port mapping.
int delete_ipv4net (const IPv4Net &ipv4net)
 Delete an entry for an IPv4 subnet to port mapping.
int add_ipv6net (const IPv6Net &ipv6net, int port)
 Add an entry for an IPv6 subnet to port mapping.
int delete_ipv6net (const IPv6Net &ipv6net)
 Delete an entry for an IPv6 subnet to port mapping.

Private Member Functions

bool is_mapping_changed () const

Private Attributes

map< pair< string, string >, int > _interface_map
map< IPv4, int > _ipv4_map
map< IPv6, int > _ipv6_map
map< IPv4Net, int > _ipv4net_map
map< IPv6Net, int > _ipv6net_map
map< pair< string, string >, int > _old_interface_map
map< IPv4, int > _old_ipv4_map
map< IPv6, int > _old_ipv6_map
map< IPv4Net, int > _old_ipv4net_map
map< IPv6Net, int > _old_ipv6net_map
list< NexthopPortMapperObserver * > _observers

Detailed Description

A class for to keep the mapping between next-hop information and a port number.

The next-hop information can be one of the following: network interface, IP host address (local or peer address on point-to-point links), or IP subnet address (of the directly connected subnet for an interface).

Note that observers (NexthopPortMapperObserver) can be attached to monitor changes to the port mapping. The observers notification is triggered by an explicit call to NexthopPortMapper::notify_observers.


Member Function Documentation

int NexthopPortMapper::add_interface ( const string &  ifname,
const string &  vifname,
int  port 
)

Add an entry for an interface/vif name to port mapping.

If the entry already exists, then the port will be updated.

Parameters:
ifnamethe interface name to add.
vifnamethe vif name to add.
portthe port number to add.
Returns:
XORP_OK on success, otherwise XORP_ERROR.
int NexthopPortMapper::add_ipv4 ( const IPv4 ipv4,
int  port 
)

Add an entry for an IPv4 address to port mapping.

If the entry already exists, then the port will be updated.

Parameters:
ipv4the address to add.
portthe port number to add.
Returns:
XORP_OK on success, otherwise XORP_ERROR.
int NexthopPortMapper::add_ipv4net ( const IPv4Net ipv4net,
int  port 
)

Add an entry for an IPv4 subnet to port mapping.

If the entry already exists, then the port will be updated.

Parameters:
ipv4netthe subnet to add.
portthe port number to add.
Returns:
XORP_OK on success, otherwise XORP_ERROR.
int NexthopPortMapper::add_ipv6 ( const IPv6 ipv6,
int  port 
)

Add an entry for an IPv6 address to port mapping.

If the entry already exists, then the port will be updated.

Parameters:
ipv6the address to add.
portthe port number to add.
Returns:
XORP_OK on success, otherwise XORP_ERROR.
int NexthopPortMapper::add_ipv6net ( const IPv6Net ipv6net,
int  port 
)

Add an entry for an IPv6 subnet to port mapping.

If the entry already exists, then the port will be updated.

Parameters:
ipv6netthe subnet to add.
portthe port number to add.
Returns:
XORP_OK on success, otherwise XORP_ERROR.
int NexthopPortMapper::add_observer ( NexthopPortMapperObserver observer)

Add an observer for observing changes to the mapper.

Parameters:
observerthe observer to add.
Returns:
XORP_OK on success, otherwise XORP_ERROR.
int NexthopPortMapper::delete_interface ( const string &  ifname,
const string &  vifname 
)

Delete an entry for an interface/vif name to port mapping.

Parameters:
ifnamethe interface name to delete.
vifnamethe vif name to delete.
Returns:
XORP_OK on success, otherwise XORP_ERROR.
int NexthopPortMapper::delete_ipv4 ( const IPv4 ipv4)

Delete an entry for an IPv4 address to port mapping.

Parameters:
ipv4the address to delete.
Returns:
XORP_OK on success, otherwise XORP_ERROR.
int NexthopPortMapper::delete_ipv4net ( const IPv4Net ipv4net)

Delete an entry for an IPv4 subnet to port mapping.

Parameters:
ipv4netthe subnet to delete.
Returns:
XORP_OK on success, otherwise XORP_ERROR.
int NexthopPortMapper::delete_ipv6 ( const IPv6 ipv6)

Delete an entry for an IPv6 address to port mapping.

Parameters:
ipv6the address to delete.
Returns:
XORP_OK on success, otherwise XORP_ERROR.
int NexthopPortMapper::delete_ipv6net ( const IPv6Net ipv6net)

Delete an entry for an IPv6 subnet to port mapping.

Parameters:
ipv6netthe subnet to delete.
Returns:
XORP_OK on success, otherwise XORP_ERROR.
int NexthopPortMapper::delete_observer ( NexthopPortMapperObserver observer)

Delete an observer for observing changes to the mapper.

Parameters:
observerthe observer to delete.
Returns:
XORP_OK on success, otherwise XORP_ERROR.
int NexthopPortMapper::lookup_nexthop_interface ( const string &  ifname,
const string &  vifname 
) const

Lookup a next-hop interface/vif name to obtain the corresponding port number.

Parameters:
ifnamethe next-hop interface name to lookup.
vifnamethe next-hop vif name to lookup.
Returns:
the port number on success, otherwise -1.
int NexthopPortMapper::lookup_nexthop_ipv4 ( const IPv4 ipv4) const

Lookup a next-hop IPv4 address to obtain the corresponding port number.

Parameters:
ipv4the next-hop address to lookup.
Returns:
the port number on success, otherwise -1.
int NexthopPortMapper::lookup_nexthop_ipv6 ( const IPv6 ipv6) const

Lookup a next-hop IPv6 address to obtain the corresponding port number.

Parameters:
ipv6the next-hop address to lookup.
Returns:
the port number on success, otherwise -1.

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