xorp

ProtoState Class Reference

Base class for keeping state for each protocol unit (node, vif, etc). More...

#include <proto_state.hh>

Inheritance diagram for ProtoState:
ServiceBase BugCatcher ProtoUnit RibManager VifManager MfeaMrouter MfeaVif Mld6igmpVif Mld6igmpVif PimBsr PimVif ProtoNode< V > ProtoNode< MfeaVif > ProtoNode< Mld6igmpVif > ProtoNode< PimVif > ProtoNode< Vif > ProtoNodeCli RpTable

List of all members.

Public Member Functions

 ProtoState ()
 Default Constructor.
virtual ~ProtoState ()
 Destructor.
int start ()
 Start the unit.
int stop ()
 Stop the unit.
int pending_start ()
 Pending-start the unit.
int pending_stop ()
 Pending-stop the unit.
void enable ()
 Enable the unit.
void disable ()
 Disable the unit.
bool is_up () const
 Test if the unit state is UP.
bool is_down () const
 Test if the unit state is DOWN.
bool is_pending_up () const
 Test if the unit state is PENDING-UP.
bool is_pending_down () const
 Test if the unit state is PENDING-DOWN.
bool is_enabled () const
 Test if the unit is enabled.
bool is_disabled () const
 Test if the unit is disabled.
bool is_debug () const
 Test if debug mode is enabled.
void set_debug (bool v)
 Set/reset debug mode.
string state_str () const
 Get a string with the state of the unit.

Private Types

enum  { XORP_ENABLED = 1 << 0 }

Private Member Functions

int startup ()
 Startup operation.
int shutdown ()
 Shutdown operation.
int reset ()
 Reset service to SERVICE_READY from whichever state it is in.

Private Attributes

uint32_t _flags
bool _debug_flag

Detailed Description

Base class for keeping state for each protocol unit (node, vif, etc).


Constructor & Destructor Documentation

ProtoState::ProtoState ( )

Default Constructor.

ProtoState::ProtoState:

Proto state default constructor.


Member Function Documentation

void ProtoState::disable ( )

Disable the unit.

If an unit is disabled, it cannot be start or pending-start. If the unit was runnning, it will be stop first.

Reimplemented in CliNode, Mld6igmpNode, Mld6igmpNodeCli, Mld6igmpVif, MfeaNode, MfeaNodeCli, MfeaVif, Mld6igmpNode, Mld6igmpNodeCli, Mld6igmpVif, PimBsr, PimNode, PimNodeCli, and PimVif.

void ProtoState::enable ( ) [inline]

Enable the unit.

If an unit is not enabled, it cannot be start, or pending-start.

Reimplemented in CliNode, Mld6igmpNode, Mld6igmpNodeCli, Mld6igmpVif, MfeaNode, MfeaNodeCli, MfeaVif, Mld6igmpNode, Mld6igmpNodeCli, Mld6igmpVif, PimBsr, PimNode, PimNodeCli, and PimVif.

bool ProtoState::is_debug ( ) const [inline]

Test if debug mode is enabled.

Returns:
true if debug mode is enabled.
bool ProtoState::is_disabled ( ) const [inline]

Test if the unit is disabled.

Returns:
true if the unit is disabled.
bool ProtoState::is_down ( ) const

Test if the unit state is DOWN.

Returns:
true if the unit state is DOWN.
bool ProtoState::is_enabled ( ) const [inline]

Test if the unit is enabled.

Returns:
true if the unit is enabled.
bool ProtoState::is_pending_down ( ) const

Test if the unit state is PENDING-DOWN.

Returns:
true if the unit state is PENDING-DOWN.
bool ProtoState::is_pending_up ( ) const

Test if the unit state is PENDING-UP.

Returns:
true if the unit state is PENDING-UP.
bool ProtoState::is_up ( ) const

Test if the unit state is UP.

Returns:
true if the unit state is UP.
int ProtoState::pending_start ( )

Pending-start the unit.

The pending-start state is an intermediate state between down and up. In this state only some operations are allowed (the allowed operations are unit-specific). This operation will fail if the unit is disabled, is up, or is pending-up already.

Returns:
XORP_OK on success, otherwise XORP_ERROR.
int ProtoState::pending_stop ( )

Pending-stop the unit.

The pending-stop state is an intermediate state between up and down. In this state only some operations are allowed (the allowed operations are unit-specific). This operation will fail if the unit is not up.

Returns:
XORP_OK on success, otherwise XORP_ERROR.
int ProtoState::reset ( ) [private, virtual]

Reset service to SERVICE_READY from whichever state it is in.

Returns:
XORP_OK on success, otherwise XORP_ERROR.

Reimplemented from ServiceBase.

void ProtoState::set_debug ( bool  v) [inline]

Set/reset debug mode.

Parameters:
vif true, set debug mode, otherwise reset it.
int ProtoState::shutdown ( ) [private, virtual]

Shutdown operation.

Returns:
XORP_OK on success, otherwise XORP_ERROR.

Implements ServiceBase.

Reimplemented in XrlMld6igmpNode, XrlMfeaNode, XrlMld6igmpNode, and XrlPimNode.

int ProtoState::start ( )

Start the unit.

This operation will fail if the unit is disabled, or is already up.

Returns:
XORP_OK on success, otherwise XORP_ERROR.

Reimplemented in CliNode, Mld6igmpNode, Mld6igmpNodeCli, MfeaMrouter, MfeaNode, MfeaNodeCli, Mld6igmpNode, Mld6igmpNodeCli, PimBsr, PimNode, PimNodeCli, RpTable, RibManager, and VifManager.

int ProtoState::startup ( ) [private, virtual]

Startup operation.

Returns:
XORP_OK on success, otherwise XORP_ERROR.

Implements ServiceBase.

Reimplemented in XrlMld6igmpNode, XrlMfeaNode, XrlMld6igmpNode, and XrlPimNode.

string ProtoState::state_str ( ) const

Get a string with the state of the unit.

The state string is one of the following: "DISABLED", "DOWN", "UP", "PENDING_UP", "PENDING_DOWN", "UNKNOWN"

Returns:
string with the state of the unit.
int ProtoState::stop ( )

Stop the unit.

This operation will fail if the unit was down already.

Returns:
XORP_OK on success, otherwise XORP_ERROR.

Reimplemented in CliNode, Mld6igmpNode, Mld6igmpNodeCli, MfeaMrouter, MfeaNode, MfeaNodeCli, Mld6igmpNode, Mld6igmpNodeCli, PimBsr, PimNode, PimNodeCli, RpTable, RibManager, and VifManager.


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