-
Notifications
You must be signed in to change notification settings - Fork 82
/
simplelocquerier.hh
55 lines (43 loc) · 1.38 KB
/
simplelocquerier.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef SIMPLELOCQUERIER_HH
#define SIMPLELOCQUERIER_HH
/*
* =c
* SimpleLocQuerier(DEST-IP LAT LON [, ...])
* =s Grid
* Sets Grid destination location by looking in a static table
* =d
*
* Each argument is a 3-tuple of the destination IP, latitude, and
* longitude (lat, lon as real numbers).
*
* Expects GRID_NBR_ENCAP packet with MAC headers as input, which will
* be output with the destination location filled in to match the
* header's destination address.
*
* =a FloodingLocQuerier
*/
#include <click/element.hh>
#include <click/ipaddress.hh>
#include <click/bighashmap.hh>
#include "grid.hh"
CLICK_DECLS
class SimpleLocQuerier : public Element {
public:
SimpleLocQuerier() CLICK_COLD;
~SimpleLocQuerier() CLICK_COLD;
const char *class_name() const override { return "SimpleLocQuerier"; }
const char *port_count() const override { return PORTS_1_1; }
const char *processing() const override { return PUSH; }
void add_handlers() CLICK_COLD;
int configure(Vector<String> &, ErrorHandler *) CLICK_COLD;
int initialize(ErrorHandler *) CLICK_COLD;
void push(int port, Packet *);
private:
typedef HashMap<IPAddress, grid_location> locmap;
locmap _locs;
void send_query_for(const IPAddress &);
static String read_table(Element *, void *);
static int add_entry(const String &arg, Element *element, void *, ErrorHandler *errh);
};
CLICK_ENDDECLS
#endif