Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F121343772
forwarder.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
Thu, Jul 10, 04:24
Size
2 KB
Mime Type
text/x-c++
Expires
Sat, Jul 12, 04:24 (2 d)
Engine
blob
Format
Raw Data
Handle
27245322
Attached To
R6591 HyMAB
forwarder.hh
View Options
#ifndef CLICK_FORWARDER_HH
#define CLICK_FORWARDER_HH
#include <click/element.hh>
#include <click/notifier.hh>
#include <click/router.hh>
#include <click/confparse.hh>
#include <click/error.hh>
#include <click/config.h>
#include <click/args.hh>
#include "neighbors.hh"
#include "util.hh"
//For debug_output:
#ifdef CLICK_USERLEVEL
# include <stdarg.h>
#endif
CLICK_DECLS
/*
* Simple elements that checks the first hop on the source route.
* Emits packets for wifi on output 0
* Emits packets for PLC on output 1
*/
class
Forwarder
:
public
Element
{
public
:
Forwarder
();
~
Forwarder
();
//This is to return _notifier
void
*
cast
(
const
char
*
);
const
char
*
class_name
()
const
{
return
"Forwarder"
;
}
const
char
*
port_count
()
const
{
return
"1/1-2"
;
}
//push input 0 : packets to forward to the network
// if WIFI and PLC
//push output 0 : packets to PLC interface
//push output 1 : packets to WIFI interface
// if only 1 interface
//push output 0 : packets to interface
const
char
*
processing
()
const
{
return
"h/hh"
;
}
int
configure
(
Vector
<
String
>
&
,
ErrorHandler
*
);
int
initialize
(
ErrorHandler
*
);
void
push
(
int
,
Packet
*
);
void
set_debug
(
bool
debug
)
{
_debug
=
debug
;}
void
set_freq
(
int
freq
)
{
_print_freq
=
freq
;}
static
int
debug_handler
(
const
String
&
,
Element
*
,
void
*
,
ErrorHandler
*
);
static
int
print_freq_handler
(
const
String
&
,
Element
*
,
void
*
,
ErrorHandler
*
);
void
add_handlers
();
private
:
//////////// variables : ///////////////////
ActiveNotifier
_notifier
;
bool
_debug
;
bool
_verb_debug
;
int
_node_index
;
String
_priority_encap
;
uint8_t
_nr_interfaces
;
Timestamp
_last_print
;
Vector
<
uint32_t
>
_bytes_sent
;
int
_print_freq
;
bool
_print_info
;
Neighbors
*
_neighbors
;
String
_neighbors_name
;
EtherAddress
_empty_eth
,
_addr_int1
,
_addr_int2
;
/////////// methods : //////////////////////
//Packet* update_routing_header(Packet *p_in, EtherAddress& next_hop);
//EtherAddress get_eth_address_source_routing(unsigned char *route, uint8_t hop) const;
//Packet* add_header(Packet *p_in, EtherAddress next_hop, int interface_out) const;
};
CLICK_ENDDECLS
#endif
Event Timeline
Log In to Comment