Page MenuHomec4science

routingpaths.hh
No OneTemporary

File Metadata

Created
Fri, Jul 4, 15:34

routingpaths.hh

#ifndef ROUTINGPATHS_H
#define ROUTINGPATHS_H
#include <click/element.hh>
#include <click/etheraddress.hh>
#include <click/ipaddress.hh>
#include <click/timer.hh>
#include <click/hashtable.hh>
//#include <assert.h>
//#include <errno.h>
#include "routinglinks.hh"
CLICK_DECLS
class RoutingLinks;
class RoutingPaths : public Element
{
public:
RoutingPaths();
~RoutingPaths();
const char *class_name() const { return "RoutingPaths"; }
const char *port_count() const { return "0-2/0-"; }
// if _multi_path is false (acts as a router):
// push input 0: messages from host
// push input 1: messages from all the interfaces
// push output 0: messages to host
// push output >=1: one push output per interface (1: PLC, 2: Wifi)
const char *processing() const { return PUSH; }
int configure(Vector<String> &, ErrorHandler *);
int initialize(ErrorHandler *);
void push(int, Packet *);
void run_timer(Timer *t);
Vector<Route> get_multipath(IPAddress, int);
Vector<Route> get_multipath_wifi(IPAddress, int);
Vector<Route> get_multipath_plc(IPAddress, int);
Vector<Vector<Route> > get_multipaths(IPAddress, int, int);
Vector<Multipath> get_multipaths_mp(IPAddress, int, int);
Vector<Vector<Route> > get_multipaths_wifi(IPAddress, int, int);
Vector<Vector<Route> > get_multipaths_plc(IPAddress, int, int);
Route get_best_path_ack(unsigned char*);
Route get_best_path_ack(IPAddress);
String print_routes();
void set_debug(bool debug) {_debug=debug; if(_verb_debug)_debug=true;}
void set_verb_debug(bool debug) {_verb_debug=debug; if(_verb_debug)_debug=true;}
void set_2bp(bool);
void set_k(int k) {_k_value = k;}
void set_keep_routes(bool b) {_keep_routes=b;}
void add_forbidden_multipath(Multipath);
void rm_forbidden_multipath(Multipath);
void clear_forbidden_multipaths() {_forbidden_multipaths.clear();}
static int get_route_handler(const String &, Element *, void *, ErrorHandler *);
static int bool_handler(const String &, Element *, void *,ErrorHandler *);
static int k_handler(const String &, Element *, void *,ErrorHandler *);
static int multirouting_2best_paths_handler(const String &, Element *, void *,ErrorHandler *);
static int forbidden_multipath_handler(const String &, Element *, void *,ErrorHandler *);
void add_handlers();
void reset();
Vector<Route> get_and_reset_invalid_routes();
IPAddress get_ip(unsigned char *dst) {return _routing_links->get_ip(dst);}
IPAddress my_ip() {return me.ip;}
Route get_route_from_froute(FormatedRoute froute) {return _routing_links->get_route_from_froute(froute);}
private:
RoutingLinks *_routing_links;
Timer timer;
bool _multi_paths;
bool _forwarder;
bool _debug;
bool _verb_debug;
bool _test_capa_one_hop;
bool _test_capa_one_hop_wifi;
bool _warning_n_N;
bool _multirouting_2best_paths;
bool _notify_invalid_links;
int _print_routes_freq;
int _time;
String _csc_choice;
NodeRouting me;
AdjacencyMatrix adjacency_matrix;
AdjacencyMatrix adjacency_matrix_wifi_only;
AdjacencyMatrix adjacency_matrix_plc_only;
HashTable<VirtualNodeRouting,VirtualNodeRouting> dijkstra_result;
HashTable<MultiPathDemand, Vector<Vector<Route> > > _routes_table_mp;
HashTable<MultiPathDemand, Vector<Vector<Route> > > _routes_table_mp_wifi;
HashTable<MultiPathDemand, Vector<Vector<Route> > > _routes_table_mp_plc;
HashTable<IPAddress, Vector<Vector<Route> > > _last_seen_routes_mp;
HashTable<IPAddress, Vector<Vector<Route> > > _routes_to_print;
IPAddress _default_gw_ip;
EtherAddress _empty_eth;
int _last_updated_node;
Vector<Route> _invalid_routes;
int _k_value;
bool _reset;
bool _keep_routes;
Vector<Multipath> _forbidden_multipaths;
Vector<Vector<Route> > get_multipaths(IPAddress, int, int, bool, bool, bool, bool);
AdjacencyMatrix update_capacities_adjacency_matrix_multi_paths(const AdjacencyMatrix, Route&, uint32_t&, bool);
bool are_neighbors(EtherAddress, EtherAddress) const;
bool are_neighbors(LinkRouting, LinkRouting) const;
Route get_route(IPAddress);
Route get_route_no_gw(IPAddress);
Packet *update_routing_header(Packet *, EtherAddress& );
Packet *delete_routing_header(Packet *);
EtherAddress get_eth_address_source_routing(unsigned char *, uint8_t) const;
Route virtual_route_to_route(VirtualRoute);
void recompute_adjacency_matrix();
void dijkstra_compute_paths(VirtualNodeRouting, const AdjacencyMatrix,
HashTable<VirtualNodeRouting,uint32_t>&, HashTable<VirtualNodeRouting, VirtualNodeRouting>&);
void bellmanford_compute_paths(VirtualNodeRouting, const AdjacencyMatrix,
HashTable<VirtualNodeRouting,uint32_t>&, HashTable<VirtualNodeRouting, VirtualNodeRouting>&);
VirtualRoute compute_shortest_path_to(VirtualNodeRouting, const AdjacencyMatrix, const HashTable<VirtualNodeRouting, VirtualNodeRouting>);
VirtualRoute get_shortest_path_dij(const AdjacencyMatrix, const VirtualNodeRouting, const VirtualNodeRouting);
VirtualRoute get_shortest_path_bf(const AdjacencyMatrix, const VirtualNodeRouting, const VirtualNodeRouting);
Vector<Route> get_k_shortest_paths(const AdjacencyMatrix, const VirtualNodeRouting, const VirtualNodeRouting, int, VirtualRoute&);
Vector<Route> get_k_shortest_paths(const AdjacencyMatrix, const VirtualNodeRouting, const VirtualNodeRouting, int);
Packet *add_source_routing(Packet *, Route);
void check_paths_valid(IPAddress, Vector<Vector<Route> >, bool, bool);
bool are_contending(UndirectedLinkRouting, UndirectedLinkRouting);
};
CLICK_ENDDECLS
#endif // ROUTINGPATHS_H

Event Timeline