Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F121641714
routinglinks.hh
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Jul 12, 18:10
Size
6 KB
Mime Type
text/x-c++
Expires
Mon, Jul 14, 18:10 (2 d)
Engine
blob
Format
Raw Data
Handle
27365214
Attached To
R1252 EMPoWER
routinglinks.hh
View Options
#ifndef ROUTINGLINKS_H
#define ROUTINGLINKS_H
#include <click/element.hh>
#include <click/etheraddress.hh>
#include <click/ipaddress.hh>
#include <click/hashtable.hh>
//#include <assert.h>
#include <click/string.hh>
#include <click/vector.hh>
#include <click/timer.hh>
#include <click/package.hh>
#include <clicknet/ether.h>
#include <click/args.hh>
#include <click/error.hh>
#include <clicknet/ip.h>
#include <click/confparse.hh>
#include <click/packet.hh>
#include <click/straccum.hh>
#include <click/glue.hh>
#include <click/integers.hh>
//#include <ctime>
#include "utilrouting.hh"
#include "neighbors.hh"
#include "order.hh"
#ifdef CLICK_USERLEVEL
#include <click/fromfile.hh>
#endif
CLICK_DECLS
class
Neighbors
;
class
Order
;
class
RoutingLinks
:
public
Element
,
public
NeighborsListener
{
public
:
RoutingLinks
();
~
RoutingLinks
();
const
char
*
class_name
()
const
{
return
"RoutingLinks"
;
}
const
char
*
port_count
()
const
{
return
"0-/="
;
}
// when _static is false
// push input 0: ROUTING_CTRL messages from PLC
// push input 1: ROUTING_CTRL messages from Wifi
// push output 0: ROUTING_CTRL messages to PLC
// push output 1: ROUTING_CTRL messages to Wifi
const
char
*
processing
()
const
{
return
PUSH
;
}
int
configure
(
Vector
<
String
>
&
,
ErrorHandler
*
);
int
initialize
(
ErrorHandler
*
);
void
push
(
int
,
Packet
*
);
void
neighborsChanged
();
void
run_timer
(
Timer
*
t
);
bool
set_routing_links
(
NodeRouting
);
bool
get_has_order
()
{
return
_has_order
;}
void
set_invalid_paths
(
Vector
<
Route
>
);
int
get_interface
(
EtherAddress
);
EtherAddress
get_ether_address
(
unsigned
char
*
)
const
;
EtherAddress
get_ether_address
(
LastAddrBytes
)
const
;
bool
get_and_reset_has_changed
()
{
bool
b
=
_has_changed
;
_has_changed
=
false
;
return
b
;}
bool
get_and_reset_different_network
()
{
bool
b
=
_has_different_network
;
_has_different_network
=
false
;
return
b
;}
Links
get_neighbor_links
()
const
{
return
_neighbor_links
;}
Vector
<
NodeRouting
>
get_nodes_in_network
()
const
{
return
_nodes_in_network
;}
Packet
*
add_headers
(
Packet
*
,
EtherAddress
,
int
,
uint8_t
);
String
interface
(
uint8_t
);
NodeRouting
get_node_from_eth
(
EtherAddress
);
String
print_network
()
const
;
void
set_debug
(
bool
debug
)
{
_debug
=
debug
;}
void
set_active
(
bool
active
)
{
_active
=
active
;}
static
int
stop_node_handler
(
const
String
&
,
Element
*
,
void
*
,
ErrorHandler
*
);
static
int
debug_handler
(
const
String
&
,
Element
*
,
void
*
,
ErrorHandler
*
);
static
int
contending_links_handler
(
const
String
&
,
Element
*
,
void
*
,
ErrorHandler
*
);
static
int
forbidden_link_handler
(
const
String
&
,
Element
*
,
void
*
,
ErrorHandler
*
);
static
int
active_handler
(
const
String
&
,
Element
*
,
void
*
,
ErrorHandler
*
);
void
add_handlers
();
IPAddress
get_ip
(
unsigned
char
*
);
IPAddress
get_ip
(
EtherAddress
);
IPAddress
my_ip
()
{
return
me
.
ip
;}
Vector
<
UndirectedLinkRouting
>
get_contending_links
(
LinkRouting
);
void
get_contending_links
(
int
);
bool
are_contending
(
UndirectedLinkRouting
,
UndirectedLinkRouting
);
Route
get_route_from_froute
(
FormatedRoute
);
void
add_contending_links
(
UndirectedLinkRouting
,
UndirectedLinkRouting
);
void
add_forbidden_link
(
EtherAddress
eth
);
void
rm_forbidden_link
(
EtherAddress
eth
);
void
add_forbidden_link
(
IPAddress
ip
);
void
rm_forbidden_link
(
IPAddress
ip
);
void
clear_forbidden_links
()
{
_forbidden_link
.
clear
();}
Vector
<
UndirectedLinkRouting
>
get_current_contending_links
()
{
return
_current_cont_links
;}
private
:
Neighbors
*
_neighbors_elmt
;
Order
*
_order_elmt
;
Timer
timer
;
bool
_static
;
bool
_has_changed
;
bool
_debug
;
bool
_verb_debug
;
bool
_print_network
;
bool
_print_parsable_network
;
bool
_neighbors_changed
;
bool
_use_MPR
;
bool
_has_order
;
bool
_trigger_ls_packets
;
bool
_stop_processing
;
bool
_delete_ls_packet
;
bool
_must_warn_new_neighbors
;
bool
_has_different_network
;
bool
_active
;
int
_print_network_freq
;
Timestamp
_begin
;
Timestamp
_now
;
Timestamp
_last_time_sent_ls
;
Timestamp
_last_weight_update
;
Timestamp
_last_discovered_neighbor
;
Timestamp
_last_time_neighbors_checked
;
Timestamp
_last_print_network
;
HashTable
<
FormatedRoute
,
Route
>
_froute_to_route
;
HashTable
<
LastAddrBytes
,
EtherAddress
>
_lastbytes2eth
;
HashTable
<
EtherAddress
,
int
>
_forbidden_link
;
LinkRouting
_current_link
;
Vector
<
UndirectedLinkRouting
>
_current_cont_links
;
#ifdef CLICK_USERLEVEL
FromFile
_ff
;
#endif
Links
_neighbor_links
;
Vector
<
NodeRouting
>
_nodes_in_network
;
NodeRouting
me
;
HashTable
<
EtherAddress
,
int
>
_interface_out
;
Vector
<
uint8_t
>
_seq_number_ls
;
HashTable
<
EtherAddress
,
uint8_t
>
_last_seq_numbers_ls_neighbors
;
HashTable
<
int
,
Vector
<
RealNeighbor
>
>
_neighbors
;
HashTable
<
EtherAddress
,
Vector
<
RealNeighbor
>
>
_one_hop_neighbors
;
HashTable
<
EtherAddress
,
Vector
<
RealNeighbor
>
>
_two_hop_neighbors
;
struct
in_addr
mask_bcast
;
EtherAddress
_empty_eth
;
Vector
<
EtherAddress
>
_MPRs
;
Vector
<
Route
>
_invalid_paths
;
HashTable
<
String
,
IPAddress
>
_str_to_ip
;
HashTable
<
EtherAddress
,
IPAddress
>
_eth_to_ip
;
HashTable
<
IPAddress
,
Vector
<
EtherAddress
>
>
_ip_to_eth_interfaces
;
Vector
<
EtherAddress
>
_removed_neighbors
;
ContLinksMatrix
_contending_links_matrix
;
int
_computed_cont_links
;
Timestamp
_last_compute_my_neighbors
;
void
change_neighbors
(
bool
);
void
push_linkstate_packets
(
bool
);
void
process_in_ls_packet
(
const
Packet
*
);
bool
is_valid_seq_number_ls
(
const
EtherAddress
,
const
uint8_t
)
const
;
bool
is_valid_seq_number
(
const
uint8_t
,
const
uint8_t
)
const
;
void
print_network_parsable
()
const
;
void
print_statistics
();
bool
time_to_update_weight
();
Vector
<
EtherAddress
>
select_MPRs
(
bool
&
);
Vector
<
EtherAddress
>
select_MPRs
();
//bool is_neighbor(EtherAddress);
bool
is_good_neighbor
(
EtherAddress
);
void
delete_one_hop_neighbor
(
EtherAddress
);
int
get_ind_node_routing
(
EtherAddress
);
EtherAddress
representant_one_hop
(
int
);
void
notify_end
();
Packet
*
add_headers
(
Packet
*
,
EtherAddress
,
int
,
uint8_t
,
uint8_t
);
void
compute_my_cont_links
();
};
CLICK_ENDDECLS
#endif
// ROUTINGLINKS_H
Event Timeline
Log In to Comment