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<A>). The Port contains a list of Peers (Peer<A>) that it has received communication on and is responsible for updating information sent by peers in the RIP route database (RouteDB<A>).
typedef A Addr | Addr |
typedef list<Peer<A>*> PeerList | PeerList |
Port (PortManagerBase<A>& manager)
| Port |
~Port ()
| ~Port |
void set_enabled (bool en)
| set_enabled |
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.
bool enabled ()
| enabled |
[const]
inline PortTimerConstants& constants ()
| constants |
Get timer constants in use for routes received on this port.
inline const PortTimerConstants& constants ()
| constants |
[const]
Get timer constants in use for routes received on this port.
inline PortAFSpecState<A>& af_state ()
| af_state |
Get Address Family specific state associated with port. This is state that only has meaning within the IP address family.
inline const PortAFSpecState<A>& af_state ()
| af_state |
[const]
Get Address Family specific state associated with port. This is state that only has meaning within the IP address family.
inline uint32_t cost ()
| cost |
[const]
Get cost metric associated with Port.
inline void set_cost (uint32_t cost)
| set_cost |
Set cost metric associated with Port.
inline const RipHorizon& horizon ()
| horizon |
[const]
Get horizon type associated with Port.
inline void set_horizon (const RipHorizon& h)
| set_horizon |
Set horizon type associated with Port.
Parameters:
h | horizon type. |
bool advertise ()
| advertise |
[const]
Determine whether Port address should be advertised.
Returns: true if port should be advertised to other hosts, false otherwise.
inline void set_advertise (bool en)
| set_advertise |
Set Port advertisement status.
Parameters:
en | true if port should be advertised, false otherwise. |
inline bool advertise_default_route ()
| advertise_default_route |
[const]
Include default route in RIP response messages.
Returns: true if default route is advertised.
void set_advertise_default_route (bool en)
| set_advertise_default_route |
Configure whether default route is advertised in RIP response messages.
Parameters:
en | true if default route should be advertised. |
inline bool accept_default_route ()
| accept_default_route |
[const]
Accept default route if found in RIP response messages.
Returns: true if default route should be accepted.
void set_accept_default_route (bool en)
| set_accept_default_route |
Accept default route if found in RIP response messages.
Parameters:
en | true if default route should be accepted. |
inline bool passive ()
| passive |
[const]
Accept routes, but do not advertise them.
Returns: true if this port is passive.
void set_passive (bool passive)
| set_passive |
Accept routes, but do not advertise them.
Parameters:
passive | true if port should receive and not send packets. |
inline bool accept_non_rip_requests ()
| accept_non_rip_requests |
[const]
Accept and respond to non-RIP requests. Testing and Debugging tools typically send requests from non-RIP IP ports.
void set_accept_non_rip_requests (bool en)
| set_accept_non_rip_requests |
Accept and respond to non-RIP requests. Testing and Debugging tools typically send requests from non-RIP IP ports.
inline const PeerList& peers ()
| peers |
[const]
Get Peers associated with this Port.
inline PeerList& peers ()
| peers |
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.
inline const PortCounters& counters ()
| counters |
[const]
Get counters associated with Port.
inline PortCounters& counters ()
| counters |
Get counters associated with Port.
const Peer<A>* peer (const Addr& addr)
| peer |
[const]
Get Peer identified by address.
Returns: pointer to Peer on success, 0 otherwise.
void set_max_packet_buffer_bytes (uint32_t max_bytes)
| set_max_packet_buffer_bytes |
Set the maximum packet buffer size.
uint32_t set_max_packet_buffer_bytes ()
| set_max_packet_buffer_bytes |
[const]
Get the maximum packet buffer size.
uint32_t packet_buffer_bytes ()
| packet_buffer_bytes |
[const]
Get the current number of bytes buffered in RIP packets.
void start_request_table_timer ()
| start_request_table_timer |
[protected]
Start request table timer. When there are no peers, this schedules the periodic transmission of request table packets.
void stop_request_table_timer ()
| stop_request_table_timer |
[protected]
bool request_table_timeout ()
| request_table_timeout |
[protected]
Send request packet if there are no peers.
Returns: true if packet sent, false if no packet sent.
void start_peer_gc_timer ()
| start_peer_gc_timer |
[protected]
Start periodic timer to garbage collect peers. Timer deschedules itself when no peers exist.
bool peer_gc_timeout ()
| peer_gc_timeout |
[protected]
Poll peers and remove those with no routes. return true if peers still exist, false otherwise.
void kill_peer_routes ()
| 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.
Peer<A>* peer (const Addr& addr)
| peer |
[protected]
Get Peer identified by address.
Returns: pointer to Peer on success, 0 otherwise.
Peer<A>* create_peer (const Addr& addr)
| create_peer |
[protected]
Create Peer.
Returns: pointer to Peer if created, 0 on failure or peer already exists.
void record_packet (Peer<A>* p)
| record_packet |
[protected]
Record packet arrival. Updates port and peer counters.
void record_response_packet (Peer<A>* p)
| record_response_packet |
[protected]
Record response packet arrival.
void record_request_packet (Peer<A>* p)
| record_request_packet |
[protected]
Record request packet arrival.
void record_bad_packet (const string& why,
const Addr& addr,
uint16_t port,
Peer<A>* p)
| record_bad_packet |
[protected]
Record bad packet.
Parameters:
why | reason packet marked |
void record_bad_auth_packet (const string& why,
const Addr& addr,
uint16_t port,
Peer<A>* p)
| record_bad_auth_packet |
[protected]
Record bad authentication packet.
void record_bad_route (const string& why,
const Addr& src,
uint16_t port,
Peer<A>* p)
| record_bad_route |
[protected]
Record bad route.
Parameters:
why | reason packet marked |
void parse_request (const Addr& src_addr,
uint16_t src_port,
const PacketRouteEntry<A>* entries,
uint32_t n_entries)
| parse_request |
[protected]
void parse_response (const Addr& src_addr,
uint16_t src_port,
const PacketRouteEntry<A>* entries,
uint32_t n_entries)
| parse_response |
[protected]
void block_queries ()
| block_queries |
[protected]
Block route queries for amount of time determined by PortTimerConstants::interquery_delay_ms().
bool queries_blocked ()
| queries_blocked |
[protected const]
Determine whether queries are currently blocked and should be discarded.
void unsolicited_response_timeout ()
| unsolicited_response_timeout |
[protected]
Unsolicited update output timer timeout.
void triggered_update_timeout ()
| triggered_update_timeout |
[protected]
bool output_allowed ()
| output_allowed |
[protected const]
Query output process policy.
Check whether instance is enabled, whether it is active or passive, and whether the associated I/O object is enabled.
void start_stop_output_processing ()
| start_stop_output_processing |
[protected]
Check whether output is allowed and start or stop output processing accordingly.
void start_output_processing ()
| start_output_processing |
[protected]
Start output processing.
Starts timers for unsolicited updates and triggered updates.
void stop_output_processing ()
| stop_output_processing |
[protected]
Stop output processing.
Stops timers for unsolicited updates and triggered updates.
void push_packets ()
| 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)
| route_policy |
[const]
Check policy on route.
Returns: tuple (nexthop,cost). If route should not be advertised the cost value will be greater than RIP_INFINITY.
void port_io_send_completion (bool success)
| port_io_send_completion |
Send completion notification. Called by PortIO instance when a send request is completed.
Parameters:
success | indication of whether send completed successfully. |
Reimplemented from PortIOUserBase.
void port_io_receive (const Addr& src_addr,
uint16_t src_port,
const uint8_t* rip_packet,
const size_t rip_packet_bytes)
| port_io_receive |
Receive RIP packet. Called by PortIO instance when a RIP packet arrives.
Parameters:
addr | source address of packet. |
port | source port of packet. |
rip_packet | pointer to RIP packet data. |
rip_packet_bytes | size of RIP packet data. |
Reimplemented from PortIOUserBase.
void port_io_enabled_change (bool en)
| port_io_enabled_change |
Notification that PortIO enabled state has changed. Called by PortIO when it's enabled status changes.
Parameters:
en | the enabled status of the I/O system. |
Reimplemented from PortIOUserBase.
PortManagerBase<A>& _pm | _pm |
[protected]
PortAFSpecState<A> _af_state | _af_state |
[protected]
PeerList _peers | _peers |
[protected]
XorpTimer _rt_timer | _rt_timer |
[protected]
XorpTimer _gc_timer | _gc_timer |
[protected]
XorpTimer _ur_timer | _ur_timer |
[protected]
XorpTimer _tu_timer | _tu_timer |
[protected]
XorpTimer _query_blocked_timer | _query_blocked_timer |
[protected]
bool _en | _en |
[protected]
uint32_t _cost | _cost |
[protected]
RipHorizon _horizon | _horizon |
[protected]
bool _advertise | _advertise |
[protected]
bool _adv_def_rt | _adv_def_rt |
[protected]
bool _acc_def_rt | _acc_def_rt |
[protected]
bool _passive | _passive |
[protected]
bool _acc_non_rip_reqs | _acc_non_rip_reqs |
[protected]
PacketQueue<A>* _packet_queue | _packet_queue |
[protected]
PortTimerConstants _constants | _constants |
[protected]
PortCounters _counters | _counters |
[protected]
OutputTable<A>* _ur_out | _ur_out |
[protected]
OutputUpdates<A>* _tu_out | _tu_out |
[protected]
OutputTable<A>* _su_out | _su_out |
[protected]