MapRoute
Object Hierarchy:
Description:
public class MapRoute :
Map<
RouteNode>,
IMapRoute
Map of routes, all of a same Rem type.
MapRoute.node[lvl][id] is a RouteNode class, i.e. a list of routes having as destination the node (lvl, id)
Namespace: Ntk.Core
Package: Netsukuku - vala port
Content:
Properties:
Creation methods:
Methods:
- public override void stop_operations ()
- public
string
report_status ()
- public
uint32
report_status_hash ()
- public GNodeID[] get_gid_list ()
My GNode ID list
- public GNodeID[] get_gid_uppermost_list (
int
level_of_gnode)
- public GNodeID get_gid_at_level (
int
lvl)
- public
int
get_my_id ()
My node ID
- public NetworkID get_main_netid ()
This method returns a Networkid. The aim is to be able to testify to
a neighbour that we already hooked in its same network. Since the network could split, and we could detect the change moments before
our neighbour does, then we must compare not just the GID of level 'levels' -- which is the min of GIDs of level 'levels-1' but we
must compare all the GIDs of level levels-1. Add to this, that at the very beginning of our hook when we did not receive an etp yet,
we do not have in the maproute the necessary gids, we just received the main one in self.id_myself[-1] Furthermore we have to
consider self.id_myself[-2] for our GID at level 'levels-1'. TODO We still have a weakness here. 2 neighbours that belong to the
same network but in different gnodes at the uppermost level (eg 1.1.1 and 2.2.2 in a network of 3 levels) have in common only the
gnodes of level 2, so they can compare the GIDs at level 2 and the one GID at level 3 (that is the min of GIDs at level 2). If the
gsize is quite small (say gsize=4) we have very few IDs (4) that we can compare. They exist for the lifespan of few single nodes. If
all these nodes die quite at the same time, then we'll experience a massive rehook.
- public
bool
is_in_my_network (NetworkID netid)
Is this netid in my network
- public
bool
is_preferred_network (NetworkID netid)
Is this netid preferred over mine
- public void evaluate_changed_netid ()
Verify the validity of the GNode ID. This has to be called just once
after a ROUTES_UPDATED event, to keep updated the GNodeid at various levels.
- public void handle_check_gid (
int
level)
A node which wants to rest assured that its GID at level lvl is
valid will launch handle_check_gid. This will start operations (if not already in progress) and make sure that for a certain time
from now the check will be periodically sent in broadcast until a response (ok or rehook) is received or the time expires. Note that
handle_check_gid is not a microfunc and when it returns we can immediately add an id to its answer_queue. When a node receives such
a request and it is in the same gnode, it will launch handle_check_gid. Then it adds the received request_id to the answer_queue for
the level. To formulate the request to be sent, a node generates a request_id. It will use this request_id in all messages sent
until response/expiration. When a response is received that is for us and is ok, the same answer is sent again in broadcast to all
the id that we have in answer_queue. When a response is received that is for us and is rehook, the maproute emits a signal that will
cause the ntkd_node to start a rehook. The signal contains all data needed to reply the same answer after the rehook has been
completed. The reply will occurr only after the node has is_mature, because, until then, the node will not be able to serve a hook
request. The exact sequence of operations when ntkd_node detects the signal is: | . (assert the splitted was a primary_address) | .
start rehook from primary_address to [answering_nip] | . tc=TimeCapsule(xx) | . while True: | . if tc.expired(): break | . if rehook
failed: break | . if addresses.primary_address.is_mature: | . for queued_id in queue: | . broadcast_client.maproute.answer_gid( \ |
. addresses.primary_address.maproute.me, \ | . queued_id, \ | . actual_gid) | . break | . swait a bit | So, the data needed with the
signal 'GNODE_SPLITTED' are: (neighbours=[answering_nip], queue, actual_gid) |Note_1: An address_manager nom-autonomous will ignore
messages request_gid. |Note_2: An address_manager nom-autonomous that detects a possible gnode split will start handle_check_gid,
but if | it receives a rehook then it just dies. (this check is in ntkd_node) |Note_3: An address_manager that has not is_mature
will ignore messages request_gid.
- public void periodically_check_gid (
int
level)
- public void send_request_gid (
int
level) throws RPCError
- public void request_gid (
int
request_id, NetworkID gnetid, PartialNIP gprefix) throws RPCError
- public void send_answer_gid (
List
<int
> queue, GNodeID actual_gid) throws RPCError
- public void answer_gid (NIP answering_nip,
int
request_id, GNodeID actual_gid) throws RPCError
- public REM worst_internal_bestrem (
int
level_of_gnode)
Returns the REM of the best path that we have to reach a destination
which is inside our gnode of level level_of_gnode and which has the worst REM among such destinations.
- public
int
? get_distance (int
lvl, int
pos)
Returns minimum distance in number of hops
- public void update_route_by_gw (HCoord dest, AggregatedNeighbour nr, REM rem_at_gw,
List
<HCoord> hops, GNodeID? gid)
Methods that modify routes
- public void route_del_by_gw (
int
lvl, int
dst, AggregatedNeighbour gw)
- public void route_signal_rem_changed (
int
lvl, int
dst)
- public void _emit_routes_updated (
int
lvl, int
dst)
- public void delete_routes_via_neighbour (AggregatedNeighbour aggregated_neighbour)
Delete from the MapRoute all the routes passing from the gateway
`neighbour' and delete the node `neighbour' itself (if present)
- public PartialNIP choose_between (
List
<PartialNIP> choose_from)
Helpers
- public PartialNIP choose_fast (
List
<PartialNIP> choose_from)
Signals: