Statistics
| Branch: | Revision:

grapes / src / TopologyManager / topman.c @ 5033613a

History | View | Annotate | Download (1.39 KB)

1 6fd9945c Marco Biazzini
#include <sys/time.h>
2
#include <stdint.h>
3
#include <stdlib.h>
4
5
#include "net_helper.h"
6
#include "tman.h"
7
#include "topman_iface.h"
8
9
extern struct topman_iface tman;
10 31f83364 Marco Biazzini
extern struct topman_iface dumb;
11
12 6fd9945c Marco Biazzini
static struct topman_iface *tm;
13
14
15
int tmanInit(struct nodeID *myID, void *metadata, int metadata_size, tmanRankingFunction rfun, const char *config)
16
{
17 31f83364 Marco Biazzini
        tm = &dumb;
18 6fd9945c Marco Biazzini
        return tm->init(myID, metadata, metadata_size, rfun, config);
19
}
20
21
22
int tmanAddNeighbour(struct nodeID *neighbour, void *metadata, int metadata_size)
23
{
24
        return tm->addNeighbour(neighbour, metadata, metadata_size);
25
}
26
27
28
int tmanParseData(const uint8_t *buff, int len, struct nodeID **peers, int size, const void *metadata, int metadata_size)
29
{
30
        return tm->parseData(buff, len, peers, size, metadata, metadata_size);
31
}
32
33
34
int tmanChangeMetadata(void *metadata, int metadata_size)
35
{
36
        return tm->changeMetadata(metadata, metadata_size);
37
}
38
39
40
const void *tmanGetMetadata(int *metadata_size)
41
{
42
        return tm->getMetadata(metadata_size);
43
}
44
45
46
int tmanGetNeighbourhoodSize(void)
47
{
48
        return tm->getNeighbourhoodSize();
49
}
50
51
52
int tmanGivePeers (int n, struct nodeID **peers, void *metadata)
53
{
54
        return tm->givePeers (n, peers, metadata);
55
}
56
57
58
int tmanGrowNeighbourhood(int n)
59
{
60
        return tm->growNeighbourhood(n);
61
}
62
63
64
int tmanShrinkNeighbourhood(int n)
65
{
66
        return tm->shrinkNeighbourhood(n);
67
}
68
69
70
int tmanRemoveNeighbour(struct nodeID *neighbour)
71
{
72
        return tm->removeNeighbour(neighbour);
73
}