class Peer

A peer represents a single area and is bound to a PeerOut. More...

 
LOGO
 Annotated List  Files  Globals  Hierarchy  Index  Top

Public Types

Public Methods

Public Static Methods


Detailed Description

A peer represents a single area and is bound to a PeerOut.

enum InterfaceState { Down, Loopback, Waiting, Point2Point, DR_other, Backup, DR, }

InterfaceState

Interface as defined by OSPF not XORP.

 Peer (Ospf<A>& ospf, PeerOut<A>& peerout, OspfTypes::AreaID area_id, OspfTypes::AreaType area_type)

Peer

 ~Peer ()

~Peer

bool  init ()

init

Should be invoked just once.

bool  shutdown ()

shutdown

Will only execute if go() has been called. Can be called multiple times paired with go().

bool  go ()

go

Called once the peer is configured and enabled. Can be called multiple times paired with shutdown().

bool  initV3 ()

initV3

OSPFv3 specific initialisation.

bool  goV3 ()

goV3

OSPFv3 specific go

bool  shutdownV3 ()

shutdownV3

OSPFv3 specific shutdown

void  populate_link_lsa ()

populate_link_lsa

bool  match (IPv6 source)

match

[const]

If the source address matches a global address return true.

string  get_if_name ()

get_if_name

[const]

For debugging only printable rendition of this interface/vif.

OspfTypes::PeerID  get_peerid ()

get_peerid

[const]

Get Peer ID.

A  get_interface_address ()

get_interface_address

[const]

Address of this interface/vif.

Returns: interface/vif address.

uint16_t  get_interface_prefix_length ()

get_interface_prefix_length

[const]

Returns: prefix length of this interface.

A  get_p2p_neighbour_address ()

get_p2p_neighbour_address

[const]

Address of the p2p neighbour.

Returns: p2p neighbour address.

uint16_t  get_interface_mtu ()

get_interface_mtu

[const]

Returns: mtu of this interface.

uint16_t  get_frame_size ()

get_frame_size

[const]

The maximum size of an OSPF frame, the MTU minus the IP header. Also include any bytes that the authentication scheme may use.

Returns: maximum frame size.

uint16_t  get_inftransdelay ()

get_inftransdelay

[const]

Returns: InfTransDelay

bool  transmit (typename Transmit<A>::TransmitRef tr)

transmit

Used by external and internal entities to transmit packets.

bool  add_neighbour (A neighbour_address, OspfTypes::RouterID rid)

add_neighbour

Add neighbour

bool  remove_neighbour (A neighbour_address, OspfTypes::RouterID rid)

remove_neighbour

Remove neighbour

bool  belongs (A addr)

belongs

[const]

Address belongs to this router used for destination address validation.

bool  receive (A dst, A src, Packet *packet)

receive

Packets for this peer are received here.

bool  accept_lsa (Lsa::LsaRef lsar)

accept_lsa

[const]

Used to test if an lsa should be accepted for this peer/neighbour. Specifically to deal with the case that AS-External-LSAs should not be sent on virtual links.

bool  send_lsa (const OspfTypes::NeighbourID nid, Lsa::LsaRef lsar)

send_lsa

[const]

Send this LSA directly to the neighbour. Do not place on retransmission list.

Returns: true on success

bool  queue_lsa (OspfTypes::PeerID peerid, OspfTypes::NeighbourID nid, Lsa::LsaRef lsar, bool& multicast_on_peer)

queue_lsa

[const]

Queue an LSA for transmission.

Parameters:

peerthe LSA arrived on.
nidthe LSA arrived on.
lsarthe lsa
multicast_on_peerDid this LSA get multicast on this peer.

Returns: true on success.

bool  push_lsas ()

push_lsas

Send (push) any queued LSAs.

bool  do_dr_or_bdr ()

do_dr_or_bdr

[const]

bool  is_DR ()

is_DR

[const]

Returns: true if this router is the DR.

bool  is_BDR ()

is_BDR

[const]

Returns: true if this router is the BDR.

bool  is_DR_or_BDR ()

is_DR_or_BDR

[const]

Returns: true if this router is the DR or BDR.

bool  neighbours_exchange_or_loading ()

neighbours_exchange_or_loading

[const]

Are any of the neighbours of this peer in the state exchange or loading.

Returns: true if any of the neighbours are in state exchange or loading.

bool  neighbour_at_least_two_way (OspfTypes::RouterID rid, bool& twoway)

neighbour_at_least_two_way

Get the state of the neighbour with the specified router ID.

Parameters:

ridRouter ID
twowayif the neighbour is found true means the neighbour is at least twoway.

Returns: true if the neighbour is found.

bool  get_neighbour_address (OspfTypes::RouterID rid, uint32_t interface_id, A& neighbour_address)

get_neighbour_address

Neighbour's source address.

Parameters:

ridRouter ID
interface_idInterface ID.
neighbour_addressset if neighbour is found.

Returns: true if the neighbour is found.

bool  on_link_state_request_list (const OspfTypes::NeighbourID nid, Lsa::LsaRef lsar)

on_link_state_request_list

[const]

Is this LSA on this neighbours link state request list.

Returns: true if it is.

bool  event_bad_link_state_request (const OspfTypes::NeighbourID nid)

event_bad_link_state_request

[const]

Generate a BadLSReq event.

bool  virtual_link_endpoint ()

virtual_link_endpoint

[const]

Are any of neighbours of this peer a virtual link endpoint.

Returns: true if any are.

void  send_direct_acks (OspfTypes::NeighbourID nid, list<Lsa_header>& ack)

send_direct_acks

Send direct ACKs

Parameters:

nidthe neighbour that the LSAs that are being acked arrived on.
acklist of acks to send.
void  send_delayed_acks (OspfTypes::NeighbourID nid, list<Lsa_header>& ack)

send_delayed_acks

Send delayed ACKs

Parameters:

nidthe neighbour that the LSAs that are being acked arrived on.
acklist of acks to send.
Neighbour<A> * find_neighbour (A src, OspfTypes::RouterID rid)

find_neighbour

bool  is_neighbour_DR_or_BDR (OspfTypes::NeighbourID nid)

is_neighbour_DR_or_BDR

[const]

Returns: true if this routers neighbour is the DR or BDR.

bool  process_hello_packet (A dst, A src, HelloPacket *hello)

process_hello_packet

Process a hello packet.

bool  process_data_description_packet (A dst, A src, DataDescriptionPacket *dd)

process_data_description_packet

Process a data description packet.

bool  process_link_state_request_packet (A dst, A src, LinkStateRequestPacket *lsrp)

process_link_state_request_packet

Process a link state request packet.

bool  process_link_state_update_packet (A dst, A src, LinkStateUpdatePacket *lsup)

process_link_state_update_packet

Process a link state update packet.

bool  process_link_state_acknowledgement_packet (A dst, A src, LinkStateAcknowledgementPacket *lsap)

process_link_state_acknowledgement_packet

Process a link state acknowledgement packet.

void  start ()

start

Start the protocol machinery running

void  stop ()

stop

Stop the protocol machinery running

void  change_area_router_type (OspfTypes::AreaType area_type)

change_area_router_type

Change the type of this area.

void  event_interface_up ()

event_interface_up

Event: InterfaceUP

void  event_wait_timer ()

event_wait_timer

Event: WaitTimer

void  event_backup_seen ()

event_backup_seen

Event: BackupSeen

void  event_neighbour_change ()

event_neighbour_change

Event: NeighborChange

void  event_loop_ind ()

event_loop_ind

Event: LoopInd

void  event_unloop_ind ()

event_unloop_ind

Event: UnLoopInd

void  event_interface_down ()

event_interface_down

Event: InterfaceDown

void  schedule_event (const char *)

schedule_event

Schedule an event, used by the neighbours to schedule an interface event.

void  process_scheduled_events ()

process_scheduled_events

Run all the deferred events, callback method.

AreaRouter<A> * get_area_router ()

get_area_router

Get the area router.

OspfTypes::RouterID  get_candidate_id (A, OspfTypes::RouterID)

get_candidate_id

[static]

Returns: the value that should be used for DR or BDR. In OSPFv2 its the source address of the interface. In OSPFv3 its the router ID.

OspfTypes::RouterID  get_candidate_id (A = A::ZERO())

get_candidate_id

[const]

Returns: the value that should be used for DR or BDR for this router In OSPFv2 its the source address of the interface. In OSPFv3 its the router ID. A dummy argument is used to force an IPv4 and an IPv6 instance of this method to be generated. Isn't C++ cool?

InterfaceState  get_state ()

get_state

[const]

OspfTypes::LinkType  get_linktype ()

get_linktype

[const]

Returns: the link type.

Auth&  get_auth_handler ()

get_auth_handler

Return the authentication handler.

uint32_t  send_options ()

send_options

Returns: the options field that is placed in some of outgoing packets.

void  populate_common_header (Packet& packet)

populate_common_header

Fill in the common header parts of the packet.

string  pp_interface_state (InterfaceState is)

pp_interface_state

[static]

Pretty print the interface state.

OspfTypes::AreaID  get_area_id ()

get_area_id

[const]

Returns: the Area ID.

OspfTypes::AreaType  get_area_type ()

get_area_type

[const]

Returns: the Area Type.

void  set_area_type (OspfTypes::AreaType area_type)

set_area_type

Returns: the Area Type.

void  router_id_changing ()

router_id_changing

The router ID is about to change.

bool  set_network_mask (uint32_t network_mask)

set_network_mask

Set the network mask OSPFv2 only.

uint32_t  get_network_mask ()

get_network_mask

[const]

Set the network mask OSPFv2 only.

bool  set_interface_id (uint32_t interface_id)

set_interface_id

Set the interface ID OSPFv3 only.

uint32_t  get_interface_id ()

get_interface_id

[const]

Get the interface ID OSPFv3 only.

bool  add_advertise_net (A addr, uint32_t prefix)

add_advertise_net

Set a network to advertise OSPFv3 only.

bool  remove_all_nets ()

remove_all_nets

Remove all the networks that are being advertised OSPFv3 only.

bool  update_nets ()

update_nets

Calls to add_advertise_net() and remove_all_nets() must be followed by a call to update nets to force a new Link-LSA to be sent out OSPFv3 only.

bool  set_hello_interval (uint16_t hello_interval)

set_hello_interval

Set the hello interval in seconds.

bool  set_options (uint32_t options)

set_options

Set options.

uint32_t  get_options ()

get_options

[const]

Get options.

bool  set_router_priority (uint8_t priority)

set_router_priority

Set router priority.

bool  set_router_dead_interval (uint32_t router_dead_interval)

set_router_dead_interval

Set the router dead interval in seconds.

uint32_t  get_router_dead_interval ()

get_router_dead_interval

[const]

Get the router dead interval in seconds.

bool  set_simple_authentication_key (const string& password, string& error_msg)

set_simple_authentication_key

Set a simple password authentication key.

Note that the current authentication handler is replaced with a simple password authentication handler.

Parameters:

passwordthe password to set.
theerror message (if error).

Returns: true on success, otherwise false.

bool  delete_simple_authentication_key (string& error_msg)

delete_simple_authentication_key

Delete a simple password authentication key.

Note that after the deletion the simple password authentication handler is replaced with a Null authentication handler.

Parameters:

theerror message (if error).

Returns: true on success, otherwise false.

bool  set_md5_authentication_key (uint8_t key_id, const string& password, const TimeVal& start_timeval, const TimeVal& end_timeval, const TimeVal& max_time_drift, string& error_msg)

set_md5_authentication_key

Set an MD5 authentication key.

Note that the current authentication handler is replaced with an MD5 authentication handler.

Parameters:

key_idunique ID associated with key.
passwordphrase used for MD5 digest computation.
start_timevalstart time when key becomes valid.
end_timevalend time when key becomes invalid.
max_time_driftthe maximum time drift among all routers.
theerror message (if error).

Returns: true on success, otherwise false.

bool  delete_md5_authentication_key (uint8_t key_id, string& error_msg)

delete_md5_authentication_key

Delete an MD5 authentication key.

Note that after the deletion if there are no more valid MD5 keys, the MD5 authentication handler is replaced with a Null authentication handler.

Parameters:

key_idthe ID of the key to delete.
theerror message (if error).

Returns: true on success, otherwise false.

bool  set_passive (bool passive, bool host)

set_passive

Toggle the passive status of an interface.

bool  get_passive ()

get_passive

[const]

If all peers are in state passive then return passive.

bool  set_rxmt_interval (uint32_t rxmt_interval)

set_rxmt_interval

Set RxmtInterval.

uint32_t  get_rxmt_interval ()

get_rxmt_interval

Get RxmtInterval.

OspfTypes::RouterID  get_designated_router ()

get_designated_router

[const]

Get the designated router.

OspfTypes::RouterID  get_backup_designated_router ()

get_backup_designated_router

[const]

Get the backup designated router.

uint32_t  get_designated_router_interface_id (A = A::ZERO())

get_designated_router_interface_id

[const]

Get the interface ID of the designated router. OSPFv3 only.

void  update_router_links ()

update_router_links

Compute the current router link.

Typically called after a state transition.

void  adjacency_change (bool up)

adjacency_change

Used to notify the peer that a neighbour has become fully adjacent or a neighbour is no longer fully adjacent. Used to trigger the generation or withdrawal of a network-LSA. Should only be called if the interface is in state DR.

Parameters:

uptrue if the adjacency became full, false otherwise.
bool  get_neighbour_list (list<OspfTypes::NeighbourID>& neighbours)

get_neighbour_list

[const]

Get a list of all the neighbours.

bool  get_neighbour_info (OspfTypes::NeighbourID nid, NeighbourInfo& ninfo)

get_neighbour_info

[const]

Get state information about this neighbour.

Parameters:

nidneighbour information is being request about.
ninfoif neighbour is found its information.
set<AddressInfo<A> >&  get_address_info ()

get_address_info

Get this list of addresses that should be advertised OSPFv3 only.

bool  get_attached_routers (list<RouterInfo>& routers)

get_attached_routers

Return a list of the fully adjacent routers.


Generated by: pavlin on kobe.xorp.net on Wed Jan 7 19:11:07 2009, using kdoc 2.0a54+XORP.