xorp

IfConfig Class Reference

Base class for pushing and pulling interface configurations down to the particular system. More...

#include <ifconfig.hh>

List of all members.

Public Member Functions

 IfConfig (FeaNode &fea_node)
 Constructor.
virtual ~IfConfig ()
 Virtual destructor (in case this class is used as a base class).
EventLoopeventloop ()
 Get a reference to the EventLoop instance.
ProcessStatus status (string &reason) const
 Get the status code.
int start_transaction (uint32_t &tid, string &error_msg)
 Start interface-related transaction.
int commit_transaction (uint32_t tid, string &error_msg)
 Commit interface-related transaction.
int abort_transaction (uint32_t tid, string &error_msg)
 Abort interface-related transaction.
int add_transaction_operation (uint32_t tid, const TransactionManager::Operation &op, string &error_msg)
 Add operation to interface-related transaction.
int add_interface (const char *ifname)
 These are used by the Transaction Operation callbacks to actually do work.
int add_interface (const string &ifname)
int remove_interface (const char *ifname)
int remove_interface (const string &ifname)
int update_interface (const IfTreeInterface &iface)
NexthopPortMappernexthop_port_mapper ()
 Get a reference to the NexthopPortMapper instance.
IfConfigUpdateReplicatorifconfig_update_replicator ()
 Get the IfConfigUpdateReplicator instance.
IfConfigErrorReporterBaseifconfig_error_reporter ()
 Get the error reporter associated with IfConfig.
IfTreesystem_config ()
 Get a reference to the system interface configuration.
void set_system_config (const IfTree &iftree)
 Set the system interface configuration.
IfTreeuser_config ()
 Get a reference to the user interface configuration.
void set_user_config (const IfTree &iftree)
 Set the user interface configuration.
IfTreemerged_config ()
 Get a reference to the merged system-user configuration.
void set_merged_config (const IfTree &iftree)
 Set the merged system-user configuration.
const IfTreeoriginal_config ()
 Get a reference to the original interface configuration on startup.
bool restore_original_config_on_shutdown () const
 Test whether the original configuration should be restored on shutdown.
void set_restore_original_config_on_shutdown (bool v)
 Set the flag whether the original configuration should be restored on shutdown.
int register_ifconfig_property (IfConfigProperty *ifconfig_property, bool is_exclusive)
 Register IfConfigProperty plugin.
int unregister_ifconfig_property (IfConfigProperty *ifconfig_property)
 Unregister IfConfigProperty plugin.
int register_ifconfig_get (IfConfigGet *ifconfig_get, bool is_exclusive)
 Register IfConfigGet plugin.
int unregister_ifconfig_get (IfConfigGet *ifconfig_get)
 Unregister IfConfigGet plugin.
int register_ifconfig_set (IfConfigSet *ifconfig_set, bool is_exclusive)
 Register IfConfigSet plugin.
int unregister_ifconfig_set (IfConfigSet *ifconfig_set)
 Unregister IfConfigSet plugin.
int register_ifconfig_observer (IfConfigObserver *ifconfig_observer, bool is_exclusive)
 Register IfConfigObserver plugin.
int unregister_ifconfig_observer (IfConfigObserver *ifconfig_observer)
 Unregister IfConfigObserver plugin.
int register_ifconfig_vlan_get (IfConfigVlanGet *ifconfig_vlan_get, bool is_exclusive)
 Register IfConfigVlanGet plugin.
int unregister_ifconfig_vlan_get (IfConfigVlanGet *ifconfig_vlan_get)
 Unregister IfConfigVlanGet plugin.
int register_ifconfig_vlan_set (IfConfigVlanSet *ifconfig_vlan_set, bool is_exclusive)
 Register IfConfigVlanSet plugin.
int unregister_ifconfig_vlan_set (IfConfigVlanSet *ifconfig_vlan_set)
 Unregister IfConfigVlanSet plugin.
int start (string &error_msg)
 Start operation.
int stop (string &error_msg)
 Stop operation.
int push_config (const IfTree &iftree)
 Push interface configuration down to the system.
const string & push_error () const
 Get the error message associated with a push operation.
const IfTreepull_config (const char *ifname, int if_index)
 Pull up current interface configuration from the system, but only for interfaces currently configured by the user.
const IfTreefull_pulled_config ()
 NOTE: This will cause the system to read *all* interface information into the _pulled_config list.
bool report_update (const IfTreeInterface &fi)
 Check IfTreeInterface and report updates to IfConfigUpdateReporter.
bool report_update (const IfTreeInterface &fi, const IfTreeVif &fv)
 Check IfTreeVif and report updates to IfConfigUpdateReporter.
bool report_update (const IfTreeInterface &fi, const IfTreeVif &fv, const IfTreeAddr4 &fa)
 Check IfTreeAddr4 and report updates to IfConfigUpdateReporter.
void report_updates_completed ()
 Report that updates were completed to IfConfigUpdateReporter.
void report_updates (IfTree &iftree)
 Check every item within IfTree and report updates to IfConfigUpdateReporter.

Private Member Functions

int restore_config (const IfTree &old_user_config, const IfTree &old_system_config, string &error_msg)
 Restore the interface configuration.

Private Attributes

FeaNode_fea_node
EventLoop_eventloop
NexthopPortMapper_nexthop_port_mapper
IfConfigTransactionManager_itm
IfTree _user_config
IfTree _system_config
IfTree _merged_config
IfTree _original_config
bool _restore_original_config_on_shutdown
IfConfigUpdateReplicator _ifconfig_update_replicator
IfConfigErrorReporter _ifconfig_error_reporter
list< IfConfigProperty * > _ifconfig_property_plugins
list< IfConfigGet * > _ifconfig_gets
list< IfConfigSet * > _ifconfig_sets
list< IfConfigObserver * > _ifconfig_observers
list< IfConfigVlanGet * > _ifconfig_vlan_gets
list< IfConfigVlanSet * > _ifconfig_vlan_sets
bool _is_running

Detailed Description

Base class for pushing and pulling interface configurations down to the particular system.


Constructor & Destructor Documentation

IfConfig::IfConfig ( FeaNode fea_node)

Constructor.

Parameters:
fea_nodethe FEA node.

Member Function Documentation

int IfConfig::abort_transaction ( uint32_t  tid,
string &  error_msg 
)

Abort interface-related transaction.

Parameters:
tidthe transaction ID.
error_msgthe error message (if error).
Returns:
XORP_OK on success, otherwise XORP_ERROR.
int IfConfig::add_interface ( const char *  ifname)

These are used by the Transaction Operation callbacks to actually do work.

All of these apply to the user_config unless otherwise specified.

int IfConfig::add_transaction_operation ( uint32_t  tid,
const TransactionManager::Operation op,
string &  error_msg 
)

Add operation to interface-related transaction.

Parameters:
tidthe transaction ID.
opthe operation to add.
error_msgthe error message (if error).
Returns:
XORP_OK on success, otherwise XORP_ERROR.
int IfConfig::commit_transaction ( uint32_t  tid,
string &  error_msg 
)

Commit interface-related transaction.

Parameters:
tidthe transaction ID.
error_msgthe error message (if error).
Returns:
XORP_OK on success, otherwise XORP_ERROR.
EventLoop& IfConfig::eventloop ( ) [inline]

Get a reference to the EventLoop instance.

Returns:
a reference to the EventLoop instance.
const IfTree & IfConfig::full_pulled_config ( )

NOTE: This will cause the system to read *all* interface information into the _pulled_config list.

If you are trying to optimize by only pulling information for interfaces configured in the local_config, do not use this method.

Returns:
a reference to the pulled interface configuration from the system.
IfConfigErrorReporterBase& IfConfig::ifconfig_error_reporter ( ) [inline]

Get the error reporter associated with IfConfig.

Returns:
the error reporter associated with IfConfig.
IfConfigUpdateReplicator& IfConfig::ifconfig_update_replicator ( ) [inline]

Get the IfConfigUpdateReplicator instance.

Returns:
a reference to the IfConfigUpdateReplicator instance (IfConfigUpdateReplicator).
IfTree& IfConfig::merged_config ( ) [inline]

Get a reference to the merged system-user configuration.

Returns:
a reference to the merged system-user configuration.
NexthopPortMapper& IfConfig::nexthop_port_mapper ( ) [inline]

Get a reference to the NexthopPortMapper instance.

Returns:
a reference to the NexthopPortMapper instance.
const IfTree& IfConfig::original_config ( ) [inline]

Get a reference to the original interface configuration on startup.

Returns:
a reference to the original interface configuration on startup.
const IfTree & IfConfig::pull_config ( const char *  ifname,
int  if_index 
)

Pull up current interface configuration from the system, but only for interfaces currently configured by the user.

If ifname is specified, pull only this interface's information. Use NULL to ignore. if if_index is specified, pull only this interface's information. Use -1 to ignore.

Returns:
the current interface configuration from the system.
int IfConfig::push_config ( const IfTree iftree)

Push interface configuration down to the system.

Errors are reported via the ifconfig_error_reporter() instance. Note that on return some of the interface configuration state may be modified.

Parameters:
iftreethe interface configuration to be pushed down.
Returns:
XORP_OK on success, otherwise XORP_ERROR.
const string & IfConfig::push_error ( ) const

Get the error message associated with a push operation.

Returns:
the error message associated with a push operation.
int IfConfig::register_ifconfig_get ( IfConfigGet ifconfig_get,
bool  is_exclusive 
)

Register IfConfigGet plugin.

Parameters:
ifconfig_getthe plugin to register.
is_exclusiveif true, the plugin is registered as the exclusive plugin, otherwise is added to the list of plugins.
Returns:
XORP_OK on success, otherwise XORP_ERROR.
int IfConfig::register_ifconfig_observer ( IfConfigObserver ifconfig_observer,
bool  is_exclusive 
)

Register IfConfigObserver plugin.

Parameters:
ifconfig_observerthe plugin to register.
is_exclusiveif true, the plugin is registered as the exclusive plugin, otherwise is added to the list of plugins.
Returns:
XORP_OK on success, otherwise XORP_ERROR.
int IfConfig::register_ifconfig_property ( IfConfigProperty ifconfig_property,
bool  is_exclusive 
)

Register IfConfigProperty plugin.

Parameters:
ifconfig_propertythe plugin to register.
is_exclusiveif true, the plugin is registered as the exclusive plugin, otherwise is added to the list of plugins.
Returns:
XORP_OK on success, otherwise XORP_ERROR.
int IfConfig::register_ifconfig_set ( IfConfigSet ifconfig_set,
bool  is_exclusive 
)

Register IfConfigSet plugin.

Parameters:
ifconfig_setthe plugin to register.
is_exclusiveif true, the plugin is registered as the exclusive plugin, otherwise is added to the list of plugins.
Returns:
XORP_OK on success, otherwise XORP_ERROR.
int IfConfig::register_ifconfig_vlan_get ( IfConfigVlanGet ifconfig_vlan_get,
bool  is_exclusive 
)

Register IfConfigVlanGet plugin.

Parameters:
ifconfig_vlan_getthe plugin to register.
is_exclusiveif true, the plugin is registered as the exclusive plugin, otherwise is added to the list of plugins.
Returns:
XORP_OK on success, otherwise XORP_ERROR.
int IfConfig::register_ifconfig_vlan_set ( IfConfigVlanSet ifconfig_vlan_set,
bool  is_exclusive 
)

Register IfConfigVlanSet plugin.

Parameters:
ifconfig_vlan_setthe plugin to register.
is_exclusiveif true, the plugin is registered as the exclusive plugin, otherwise is added to the list of plugins.
Returns:
XORP_OK on success, otherwise XORP_ERROR.
bool IfConfig::report_update ( const IfTreeInterface fi,
const IfTreeVif fv 
)

Check IfTreeVif and report updates to IfConfigUpdateReporter.

Parameters:
fithe IfTreeInterface interface instance to check.
fvthe IfTreeVif vif instance to check.
Returns:
true if there were updates to report, otherwise false.
bool IfConfig::report_update ( const IfTreeInterface fi,
const IfTreeVif fv,
const IfTreeAddr4 fa 
)

Check IfTreeAddr4 and report updates to IfConfigUpdateReporter.

Parameters:
fithe IfTreeInterface interface instance to check.
fvthe IfTreeVif vif instance to check.
fathe IfTreeAddr4 address instance to check.
Returns:
true if there were updates to report, otherwise false.
bool IfConfig::report_update ( const IfTreeInterface fi)

Check IfTreeInterface and report updates to IfConfigUpdateReporter.

Parameters:
fithe IfTreeInterface interface instance to check.
Returns:
true if there were updates to report, otherwise false.
void IfConfig::report_updates ( IfTree iftree)

Check every item within IfTree and report updates to IfConfigUpdateReporter.

Parameters:
iftreethe interface tree instance to check.
int IfConfig::restore_config ( const IfTree old_user_config,
const IfTree old_system_config,
string &  error_msg 
) [private]

Restore the interface configuration.

Parameters:
old_user_configthe old user configuration to restore.
old_system_configthe old system configuration to restore.
error_msgthe error message (if error).
Returns:
XORP_OK on success, otherwise XORP_ERROR.
bool IfConfig::restore_original_config_on_shutdown ( ) const [inline]

Test whether the original configuration should be restored on shutdown.

Returns:
true of the original configuration should be restored on shutdown, otherwise false.
void IfConfig::set_merged_config ( const IfTree iftree) [inline]

Set the merged system-user configuration.

Parameters:
iftreethe merged system-user configuration.
void IfConfig::set_restore_original_config_on_shutdown ( bool  v) [inline]

Set the flag whether the original configuration should be restored on shutdown.

Parameters:
vif true the original configuration should be restored on shutdown.
void IfConfig::set_system_config ( const IfTree iftree) [inline]

Set the system interface configuration.

Parameters:
iftreethe system interface configuration.
void IfConfig::set_user_config ( const IfTree iftree) [inline]

Set the user interface configuration.

Parameters:
iftreethe user interface configuration.
int IfConfig::start ( string &  error_msg)

Start operation.

Parameters:
error_msgthe error message (if error).
Returns:
XORP_OK on success, otherwise XORP_ERROR.
int IfConfig::start_transaction ( uint32_t &  tid,
string &  error_msg 
)

Start interface-related transaction.

Parameters:
tidthe return-by-reference new transaction ID.
error_msgthe error message (if error).
Returns:
XORP_OK on success, otherwise XORP_ERROR.
ProcessStatus IfConfig::status ( string &  reason) const

Get the status code.

Parameters:
reasonthe human-readable reason for any failure.
Returns:
the status code.
int IfConfig::stop ( string &  error_msg)

Stop operation.

Parameters:
error_msgthe error message (if error).
Returns:
XORP_OK on success, otherwise XORP_ERROR.
IfTree& IfConfig::system_config ( ) [inline]

Get a reference to the system interface configuration.

Returns:
a reference to the system interface configuration.
int IfConfig::unregister_ifconfig_get ( IfConfigGet ifconfig_get)

Unregister IfConfigGet plugin.

Parameters:
ifconfig_getthe plugin to unregister.
Returns:
XORP_OK on success, otherwise XORP_ERROR.
int IfConfig::unregister_ifconfig_observer ( IfConfigObserver ifconfig_observer)

Unregister IfConfigObserver plugin.

Parameters:
ifconfig_observerthe plugin to unregister.
Returns:
XORP_OK on success, otherwise XORP_ERROR.
int IfConfig::unregister_ifconfig_property ( IfConfigProperty ifconfig_property)

Unregister IfConfigProperty plugin.

Parameters:
ifconfig_propertythe plugin to unregister.
Returns:
XORP_OK on success, otherwise XORP_ERROR.
int IfConfig::unregister_ifconfig_set ( IfConfigSet ifconfig_set)

Unregister IfConfigSet plugin.

Parameters:
ifconfig_setthe plugin to unregister.
Returns:
XORP_OK on success, otherwise XORP_ERROR.
int IfConfig::unregister_ifconfig_vlan_get ( IfConfigVlanGet ifconfig_vlan_get)

Unregister IfConfigVlanGet plugin.

Parameters:
ifconfig_vlan_getthe plugin to unregister.
Returns:
XORP_OK on success, otherwise XORP_ERROR.
int IfConfig::unregister_ifconfig_vlan_set ( IfConfigVlanSet ifconfig_vlan_set)

Unregister IfConfigVlanSet plugin.

Parameters:
ifconfig_vlan_setthe plugin to unregister.
Returns:
XORP_OK on success, otherwise XORP_ERROR.
IfTree& IfConfig::user_config ( ) [inline]

Get a reference to the user interface configuration.

Returns:
a reference to the user interface configuration.

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