Statistics
| Branch: | Revision:

grapes / src / TopologyManager / topman.c @ 6fd9945c

History | View | Annotate | Download (1.36 KB)

1
#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
static struct topman_iface *tm;
11

    
12

    
13
int tmanInit(struct nodeID *myID, void *metadata, int metadata_size, tmanRankingFunction rfun, const char *config)
14
{
15
        tm = &tman;
16
        return tm->init(myID, metadata, metadata_size, rfun, config);
17
}
18

    
19

    
20
int tmanAddNeighbour(struct nodeID *neighbour, void *metadata, int metadata_size)
21
{
22
        return tm->addNeighbour(neighbour, metadata, metadata_size);
23
}
24

    
25

    
26
int tmanParseData(const uint8_t *buff, int len, struct nodeID **peers, int size, const void *metadata, int metadata_size)
27
{
28
        return tm->parseData(buff, len, peers, size, metadata, metadata_size);
29
}
30

    
31

    
32
int tmanChangeMetadata(void *metadata, int metadata_size)
33
{
34
        return tm->changeMetadata(metadata, metadata_size);
35
}
36

    
37

    
38
const void *tmanGetMetadata(int *metadata_size)
39
{
40
        return tm->getMetadata(metadata_size);
41
}
42

    
43

    
44
int tmanGetNeighbourhoodSize(void)
45
{
46
        return tm->getNeighbourhoodSize();
47
}
48

    
49

    
50
int tmanGivePeers (int n, struct nodeID **peers, void *metadata)
51
{
52
        return tm->givePeers (n, peers, metadata);
53
}
54

    
55

    
56
int tmanGrowNeighbourhood(int n)
57
{
58
        return tm->growNeighbourhood(n);
59
}
60

    
61

    
62
int tmanShrinkNeighbourhood(int n)
63
{
64
        return tm->shrinkNeighbourhood(n);
65
}
66

    
67

    
68
int tmanRemoveNeighbour(struct nodeID *neighbour)
69
{
70
        return tm->removeNeighbour(neighbour);
71
}