Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F122922251
dstmab.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
Tue, Jul 22, 23:03
Size
3 KB
Mime Type
text/x-c++
Expires
Thu, Jul 24, 23:03 (2 d)
Engine
blob
Format
Raw Data
Handle
27590917
Attached To
R6591 HyMAB
dstmab.hh
View Options
#ifndef CLICK_DSTMAB_HH
#define CLICK_DSTMAB_HH
#include <clicknet/wifi.h>
#include <clicknet/ether.h>
#include <click/packet_anno.hh>
#include "hybridMAC.h"
#include <click/element.hh>
#include <click/notifier.hh>
#include <click/router.hh>
#include <click/confparse.hh>
#include <click/timer.hh>
#include <click/error.hh>
#include <click/etheraddress.hh>
#include <click/hashtable.hh>
#include <click/vector.hh>
#include <click/config.h>
#include <click/args.hh>
#include <click/string.hh>
#include <click/straccum.hh>
#include "util.hh"
#include "routinglinks.hh"
CLICK_DECLS
class
RoutingLinks
;
/*
* class DstMab:
* Checks if node is dst of a Mab packet, and reacts accordingly (measure rate, send ack back)
*/
struct
AckInfo
{
FormatedRoute
froute
;
uint16_t
id
;
uint8_t
max_nb_flows
;
uint32_t
flow_hash
;
IPAddress
flow_src
;
IPAddress
flow_dst
;
Timestamp
ts
;
Timestamp
created
;
AckInfo
(
FormatedRoute
_froute
,
uint16_t
_id
,
uint8_t
_max_nb_flows
,
uint32_t
_flow_hash
,
IPAddress
_flow_src
,
IPAddress
_flow_dst
,
Timestamp
_ts
)
{
froute
=
_froute
;
id
=
_id
;
max_nb_flows
=
_max_nb_flows
;
flow_hash
=
_flow_hash
;
flow_src
=
_flow_src
;
flow_dst
=
_flow_dst
;
ts
=
_ts
;
created
=
Timestamp
::
now
();
}
};
class
DstMab
:
public
Element
{
public
:
DstMab
();
~
DstMab
();
const
char
*
class_name
()
const
{
return
"DstMab"
;
}
const
char
*
port_count
()
const
{
return
"1/4"
;
}
// push input 0: messages from all interfaces
// push output 0: messages to forward (regular traffic)
// push output 1: messages for local node (to host)
// push output 2: acks sent by me
// push output 3: acks (or other high priority messages) to forward
const
char
*
processing
()
const
{
return
PUSH
;
}
int
configure
(
Vector
<
String
>
&
,
ErrorHandler
*
);
int
initialize
(
ErrorHandler
*
);
void
push
(
int
,
Packet
*
);
void
run_timer
(
Timer
*
timer
);
// Handlers
void
add_handlers
();
static
int
bool_handler
(
const
String
&
,
Element
*
,
void
*
,
ErrorHandler
*
);
void
set_debug
(
bool
b
)
{
_debug
=
b
;}
void
clear
();
private
:
RoutingLinks
*
_routing_links
;
Timer
_timer
;
Timer
_ack_timer
;
EtherAddress
_addr_wifi
;
EtherAddress
_addr_plc
;
IPAddress
_ip_address
;
int
_ack_waiting_time_msec
;
Vector
<
AckInfo
>
_scheduled_acks
;
Timestamp
_now
;
Timestamp
_last_active
;
LastAddrBytes
_lb_wifi
;
LastAddrBytes
_lb_plc
;
HashTable
<
uint16_t
,
HashTable
<
FormatedRoute
,
int
>
>
_control_message_received
;
HashTable
<
FormatedRoute
,
HashTable
<
uint16_t
,
uint32_t
>
>
_route_to_rate
;
HashTable
<
FormatedRoute
,
HashTable
<
uint16_t
,
uint32_t
>
>
_traffic_after
;
HashTable
<
FormatedRoute
,
HashTable
<
uint16_t
,
Timestamp
>
>
_route_to_diff_ts
;
HashTable
<
FormatedRoute
,
HashTable
<
uint16_t
,
int
>
>
_is_diff_ts_ok
;
bool
_debug
;
bool
_verb_debug
;
bool
_timeout_bool
;
bool
_exploring
;
uint32_t
_exploit_traffic_during_explore
;
uint16_t
_current_id
;
void
send_ack
(
AckInfo
);
};
CLICK_ENDDECLS
#endif
Event Timeline
Log In to Comment