Node:Tree modules, Next:Misc modules, Previous:VLANs, Up:Top
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_topermits to know if a node belongs or not to a given list.
build_nodes_listbuilds the list of nodes which belong to the tree that you give as parameter.
erase_listerases a list and releases the memory became useless
give_same_nodereturns the first node of a tree (met during the traversing in depth) which belongs also to the list given as parameter
check_ancestorresearches the first ancestor of a node in a tree which belongs to a list given as parameter.
tree_traversing.h implements functions dealing with the
manipulation of trees. These functions are usefull to implement the module
root_of_treegives the root of the tree given as parameter.
make_node_rootcenter 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_treedraws the tree given as parameter.
copymakes a copy of the tree given as parameter.
copy_part_of_treepermits us to copy the arborescence under the node given as parameter in a tree given.
erase_treeerases the tree given as parameter abd releases the memory given as parameter.
erase_treevlanlerases the arborescence given as parameter.
delete_sonerases the son of a tree and also all the arborescence under this node.
host_idof the father of the node given in a tree given.
add_part_of_treeadds to a tree an arborescence given under a node given.
has_brotherprecises if a node given in a tree given has a brother.
give_brotherreturns the closest right brother of a node in a tree given.
has_sonprecises if a node given in a tree given has a son.
give_sonreturns the closest left son of a node in a tree.
stack_ancestor_hostreturns 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_vlanresearches 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_copyprecises the structure VLAN of a branch of tree without making a copy.
add_numvlan_at_endadds a value of vlan at the end of vlan list.
add_list_vlanadds 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.
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.