Node:Tree modules, Next:Misc modules, Previous:VLANs, Up:Top
The module nodesl.h
implements functions dealing with list of
nodes. These lists are used to help some tree-related functions.
They are typically used to store a list of host_id.
belong_to
permits to know if a node belongs or not
to a given list.
build_nodes_list
builds the list of nodes which belong
to the tree that you give as parameter.
erase_list
erases a list and releases the memory became
useless
give_same_node
returns the first node of a tree (met during
the traversing in depth) which belongs also to the list given as parameter
check_ancestor
researches the first ancestor of a node in a tree
which belongs to a list given as parameter.
The module tree_traversing.h
implements functions dealing with the
manipulation of trees. These functions are usefull to implement the module
fusion
.
root_of_tree
gives the root of the tree given as parameter.
make_node_root
center the tree given as parameter on the
node given. In fact, it change the tree by considering host as the new root
and move all host's ancestors (father, grandfather...)
by placing the father as a son to host,
the grandfather as a son to the father and so on.
traverse_tree
draws the tree given as parameter.
copy
makes a copy of the tree given as parameter.
copy_part_of_tree
permits us to copy the arborescence
under the node given as parameter in a tree given.
erase_tree
erases the tree given as parameter abd releases
the memory given as parameter.
erase_treevlanl
erases the arborescence given as parameter.
delete_son
erases the son of a tree and also all the arborescence
under this node.
look_for_father
researches the host_id
of the father
of the node given in a tree given.
add_part_of_tree
adds to a tree an arborescence given
under a node given.
has_brother
precises if a node given in a tree given has a brother.
give_brother
returns the closest right brother of a node
in a tree given.
has_son
precises if a node given in a tree given has a son.
give_son
returns the closest left son of a node in a tree.
stack_ancestor_host
returns a stack of all ancestors
of a node given in a tree.
First, there's the father in the stack, then the grandfather and so on.
give_vlan
researches the value of a VLAN of a branch of tree.
It makes the copy of the structure VLAN given and returns this copy.
give_vlan_no_copy
precises the structure VLAN of a branch of tree
without making a copy.
add_numvlan_at_end
adds a value of vlan at the end of vlan list.
add_list_vlan
adds a value of vlan at the end of a list given.
if this value given doesn't belong to the list, it's added.
Otherwise, the list given is not modified.
This module fusion.h
implements functions that builds the fusion
of two trees. The function fusion
doesn't modify the two trees
which you want to merge. It builds a new tree which results of
the fusion of thesetwo trees.
If there isn't any common node between both trees,
or if a buckle appears, the working of fusion has been given up.
At the begining, this function copies the first tre given as parameter.
By this way, we obtain a new tree.
It researches, during the traversing in depth of the first tree,
the first node which belongs also to the second tree.
It centers the second tree on this node.
Finally, it traverses in depth the second tree modified
and adds to the new tree the branches which has not yet in the first tree.
It 's this new tree the result of the fusion of two trees.
Warning The trees entered can not have yet information about VLANS. In this case, you have to precise the value of the VlAN of each trees thanks to the parameters num_vlan1 and num_vlan2. If the tree entried has information about VLANS, you give the value -1 to the parameter num_vlan.