xorp

Port< A > Class Template Reference

RIP Port. More...

#include <port.hh>

Inheritance diagram for Port< A >:
PortIOUserBase< A > SpoofPort< A > SpoofPort< A > SpoofPort< A > SpoofPort< A > SpoofPort< A >

List of all members.

Public Types

typedef A Addr
typedef list< Peer< A > * > PeerList

Public Member Functions

 Port (PortManagerBase< A > &manager)
PortManagerBase< A > & port_manager ()
void set_enabled (bool en)
 Set enabled state.
bool enabled () const
 Get enabled state.
PortTimerConstantsconstants ()
 Get timer constants in use for routes received on this port.
const PortTimerConstantsconstants () const
 Get timer constants in use for routes received on this port.
PortAFSpecState< A > & af_state ()
 Get Address Family specific state associated with port.
const PortAFSpecState< A > & af_state () const
 Get Address Family specific state associated with port.
uint32_t cost () const
 Get cost metric associated with Port.
void set_cost (uint32_t cost)
 Set cost metric associated with Port.
const RipHorizon & horizon () const
 Get horizon type associated with Port.
void set_horizon (const RipHorizon &h)
 Set horizon type associated with Port.
bool advertise () const
 Determine whether Port address should be advertised.
void set_advertise (bool en)
 Set Port advertisement status.
bool advertise_default_route () const
 Include default route in RIP response messages.
void set_advertise_default_route (bool en)
 Configure whether default route is advertised in RIP response messages.
bool accept_default_route () const
 Accept default route if found in RIP response messages.
void set_accept_default_route (bool en)
 Accept default route if found in RIP response messages.
bool passive () const
 Accept routes, but do not advertise them.
void set_passive (bool passive)
 Accept routes, but do not advertise them.
bool accept_non_rip_requests () const
 Accept and respond to non-RIP requests.
void set_accept_non_rip_requests (bool en)
 Accept and respond to non-RIP requests.
const PeerList & peers () const
 Get Peers associated with this Port.
PeerList & peers ()
 Get Peers associated with this Port.
const PortCounterscounters () const
 Get counters associated with Port.
PortCounterscounters ()
 Get counters associated with Port.
const Peer< A > * peer (const Addr &addr) const
 Get Peer identified by address.
void set_max_packet_buffer_bytes (uint32_t max_bytes)
 Set the maximum packet buffer size.
uint32_t set_max_packet_buffer_bytes () const
 Get the maximum packet buffer size.
uint32_t packet_buffer_bytes () const
 Get the current number of bytes buffered in RIP packets.
void reschedule_dummy_timer ()
 A dummy method to reschedule a non-existing timer.
void reschedule_request_table_timer ()
 Reschedule request table timer.
void push_packets ()
 If I/O handler is not already sending a packet, take a packet from packet queue and send it.
pair< A, uint16_t > route_policy (const RouteEntry< A > &re) const
 Check policy on route.
void port_io_send_completion (bool success)
 Send completion notification.
void port_io_receive (const Addr &src_addr, uint16_t src_port, const uint8_t *rip_packet, const size_t rip_packet_bytes)
 Receive RIP packet.
void port_io_enabled_change (bool en)
 Notification that PortIO enabled state has changed.

Protected Member Functions

void start_request_table_timer ()
 Start request table timer.
void stop_request_table_timer ()
 Stop request table timer.
bool request_table ()
 Send request packet.
bool request_table_timeout ()
 Send request packet if there are no peers.
void start_peer_gc_timer ()
 Start periodic timer to garbage collect peers.
bool peer_gc_timeout ()
 Poll peers and remove those with no routes.
void kill_peer_routes ()
 Kill peer routes.
Peer< A > * peer (const Addr &addr)
 Get Peer identified by address.
Peer< A > * create_peer (const Addr &addr)
 Create Peer.
void record_packet (Peer< A > *p)
 Record packet arrival.
void record_response_packet (Peer< A > *p)
 Record response packet arrival.
void record_request_packet (Peer< A > *p)
 Record request packet arrival.
void record_bad_packet (const string &why, const Addr &addr, uint16_t port, Peer< A > *p)
 Record bad packet.
void record_bad_auth_packet (const string &why, const Addr &addr, uint16_t port, Peer< A > *p)
 Record bad authentication packet.
void record_bad_route (const string &why, const Addr &src, uint16_t port, Peer< A > *p)
 Record bad route.
void parse_request (const Addr &src_addr, uint16_t rc_port, const uint8_t *entries_ptr, uint32_t n_entries)
 Parse request message.
void parse_response (const Addr &src_addr, uint16_t src_port, const uint8_t *entries_ptr, uint32_t n_entries)
 Parse response message.
void block_queries ()
 Block route queries for amount of time determined by PortTimerConstants::interquery_delay_ms().
bool queries_blocked () const
 Determine whether queries are currently blocked and should be discarded.
void unsolicited_response_timeout ()
 Unsolicited update output timer timeout.
void triggered_update_timeout ()
 Triggered update timeout.
bool output_allowed () const
 Query output process policy.
void start_stop_output_processing ()
 Check whether output is allowed and start or stop output processing accordingly.
void start_output_processing ()
 Start output processing.
void stop_output_processing ()
 Stop output processing.

Protected Attributes

PortManagerBase< A > & _pm
PortAFSpecState< A > _af_state
PeerList _peers
XorpTimer _rt_timer
XorpTimer _gc_timer
XorpTimer _ur_timer
XorpTimer _tu_timer
XorpTimer _query_blocked_timer
bool _en
uint32_t _cost
RipHorizon _horizon
bool _advertise
bool _adv_def_rt
bool _acc_def_rt
bool _passive
bool _acc_non_rip_reqs
PacketQueue< A > * _packet_queue
PortTimerConstants _constants
PortCounters _counters
OutputTable< A > * _ur_out
OutputUpdates< A > * _tu_out
OutputTable< A > * _su_out

Detailed Description

template<typename A>
class Port< A >

RIP Port.

A RIP Port is an origin and sink of RIP packets. It is uniquely identified by the tuplet of <interface, virtual interface, address>. The Port sends and receives RIP packets via an attached Port IO object (PortIOBase). The Port contains a list of Peers (Peer) that it has received communication on and is responsible for updating information sent by peers in the RIP route database (RouteDB).


Member Function Documentation

template<typename A>
bool Port< A >::accept_default_route ( ) const [inline]

Accept default route if found in RIP response messages.

Returns:
true if default route should be accepted.
template<typename A>
bool Port< A >::accept_non_rip_requests ( ) const [inline]

Accept and respond to non-RIP requests.

Testing and Debugging tools typically send requests from non-RIP IP ports.

template<typename A>
bool Port< A >::advertise ( ) const [inline]

Determine whether Port address should be advertised.

Returns:
true if port should be advertised to other hosts, false otherwise.
template<typename A>
bool Port< A >::advertise_default_route ( ) const [inline]

Include default route in RIP response messages.

Returns:
true if default route is advertised.
template<typename A>
const PortAFSpecState<A>& Port< A >::af_state ( ) const [inline]

Get Address Family specific state associated with port.

This is state that only has meaning within the IP address family.

template<typename A>
PortAFSpecState<A>& Port< A >::af_state ( ) [inline]

Get Address Family specific state associated with port.

This is state that only has meaning within the IP address family.

template<typename A >
Peer< A > * Port< A >::create_peer ( const Addr &  addr) [protected]

Create Peer.

Returns:
pointer to Peer if created, 0 on failure or peer already exists.
template<typename A >
void Port< A >::kill_peer_routes ( ) [protected]

Kill peer routes.

Change cost of routes learned from peers to infinity. Typically called when port instance is disabled or io system reports that it is not enabled.

template<typename A >
bool Port< A >::output_allowed ( ) const [protected]

Query output process policy.

Check whether instance is enabled, whether it is active or passive, and whether the associated I/O object is enabled.

template<typename A>
bool Port< A >::passive ( ) const [inline]

Accept routes, but do not advertise them.

Returns:
true if this port is passive.
template<typename A >
Peer< A > * Port< A >::peer ( const Addr &  addr) [protected]

Get Peer identified by address.

Returns:
pointer to Peer on success, 0 otherwise.
template<typename A >
const Peer< A > * Port< A >::peer ( const Addr &  addr) const

Get Peer identified by address.

Returns:
pointer to Peer on success, 0 otherwise.
template<typename A >
bool Port< A >::peer_gc_timeout ( ) [protected]

Poll peers and remove those with no routes.

return true if peers still exist, false otherwise.

template<typename A>
PeerList& Port< A >::peers ( ) [inline]

Get Peers associated with this Port.

NB This method is a backdoor for testing purposes and should not be relied upon to exist in future.

template<typename A >
void Port< A >::port_io_enabled_change ( bool  en) [virtual]

Notification that PortIO enabled state has changed.

Called by PortIO when it's enabled status changes.

Parameters:
enthe enabled status of the I/O system.

Implements PortIOUserBase< A >.

template<typename A >
void Port< A >::port_io_receive ( const Addr &  src_addr,
uint16_t  src_port,
const uint8_t *  rip_packet,
const size_t  rip_packet_bytes 
) [virtual]

Receive RIP packet.

Called by PortIO instance when a RIP packet arrives.

Parameters:
addrsource address of packet.
portsource port of packet.
rip_packetpointer to RIP packet data.
rip_packet_bytessize of RIP packet data.

Implements PortIOUserBase< A >.

template<typename A >
void Port< A >::port_io_send_completion ( bool  success) [virtual]

Send completion notification.

Called by PortIO instance when a send request is completed.

Parameters:
successindication of whether send completed successfully.

Implements PortIOUserBase< A >.

template<typename A >
void Port< A >::record_bad_packet ( const string &  why,
const Addr &  addr,
uint16_t  port,
Peer< A > *  p 
) [protected]

Record bad packet.

Parameters:
whyreason packet marked
template<typename A >
void Port< A >::record_bad_route ( const string &  why,
const Addr &  src,
uint16_t  port,
Peer< A > *  p 
) [protected]

Record bad route.

Parameters:
whyreason packet marked
template<typename A >
void Port< A >::record_packet ( Peer< A > *  p) [protected]

Record packet arrival.

Updates port and peer counters.

template<typename A >
bool Port< A >::request_table ( ) [protected]

Send request packet.

Returns:
true if packet sent, false if no packet sent.
template<typename A >
bool Port< A >::request_table_timeout ( ) [protected]

Send request packet if there are no peers.

Returns:
true if packet sent, false if no packet sent.
template<typename A >
void Port< A >::reschedule_request_table_timer ( )

Reschedule request table timer.

If the timer was not running, then don't schedule it.

template<typename A >
pair< A, uint16_t > Port< A >::route_policy ( const RouteEntry< A > &  re) const

Check policy on route.

Returns:
tuple (nexthop,cost). If route should not be advertised the cost value will be greater than RIP_INFINITY.
template<typename A >
void Port< A >::set_accept_default_route ( bool  en)

Accept default route if found in RIP response messages.

Parameters:
entrue if default route should be accepted.
template<typename A >
void Port< A >::set_accept_non_rip_requests ( bool  en)

Accept and respond to non-RIP requests.

Testing and Debugging tools typically send requests from non-RIP IP ports.

template<typename A>
void Port< A >::set_advertise ( bool  en) [inline]

Set Port advertisement status.

Parameters:
entrue if port should be advertised, false otherwise.
template<typename A >
void Port< A >::set_advertise_default_route ( bool  en)

Configure whether default route is advertised in RIP response messages.

Parameters:
entrue if default route should be advertised.
template<typename A >
void Port< A >::set_enabled ( bool  en)

Set enabled state.

When a port is enabled it can perform input and output processing. When not enabled, input data is discarded and output processing can not occur.

template<typename A>
void Port< A >::set_horizon ( const RipHorizon &  h) [inline]

Set horizon type associated with Port.

Parameters:
hhorizon type.
template<typename A >
void Port< A >::set_passive ( bool  passive)

Accept routes, but do not advertise them.

Parameters:
passivetrue if port should receive and not send packets.
template<typename A >
void Port< A >::start_output_processing ( ) [protected]

Start output processing.

Starts timers for unsolicited updates and triggered updates.

template<typename A >
void Port< A >::start_peer_gc_timer ( ) [protected]

Start periodic timer to garbage collect peers.

Timer deschedules itself when no peers exist.

template<typename A >
void Port< A >::start_request_table_timer ( ) [protected]

Start request table timer.

When there are no peers, this schedules the periodic transmission of request table packets.

template<typename A >
void Port< A >::stop_output_processing ( ) [protected]

Stop output processing.

Stops timers for unsolicited updates and triggered updates.


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