Revision b3878656

View differences:

src/Cache/cyclon_proto.c
19 19
  struct topo_context *context;
20 20
};
21 21

  
22
struct cyclon_proto_context* cyclon_proto_init(struct nodeID *s, void *meta, int meta_size)
22
struct cyclon_proto_context* cyclon_proto_init(struct nodeID *s, const void *meta, int meta_size)
23 23
{
24 24
  struct cyclon_proto_context *con;
25 25
  con = malloc(sizeof(struct cyclon_proto_context));
......
45 45
  return topo_query_peer(context->context, sent_cache, dst, MSG_TYPE_TOPOLOGY, CYCLON_QUERY, 0);
46 46
}
47 47

  
48
int cyclon_proto_change_metadata(struct cyclon_proto_context *context, void *metadata, int metadata_size)
48
int cyclon_proto_change_metadata(struct cyclon_proto_context *context, const void *metadata, int metadata_size)
49 49
{
50 50
  if (topo_proto_metadata_update(context->context, metadata, metadata_size) <= 0) {
51 51
    return -1;
src/Cache/cyclon_proto.h
3 3

  
4 4
struct cyclon_proto_context;
5 5

  
6
struct cyclon_proto_context* cyclon_proto_init(struct nodeID *s, void *meta, int meta_size);
6
struct cyclon_proto_context* cyclon_proto_init(struct nodeID *s, const void *meta, int meta_size);
7 7

  
8 8

  
9 9
int cyclon_reply(struct cyclon_proto_context *context, const struct peer_cache *c, struct peer_cache *local_cache);
10 10
int cyclon_query(struct cyclon_proto_context *context, struct peer_cache *local_cache, struct nodeID *dst);
11 11

  
12
int cyclon_proto_change_metadata(struct cyclon_proto_context *context, void *metadata, int metadata_size);
12
int cyclon_proto_change_metadata(struct cyclon_proto_context *context, const void *metadata, int metadata_size);
13 13
#endif	/* CYCLON_PROTO */
src/Cache/ncast_proto.c
19 19
  struct topo_context *context;
20 20
};
21 21

  
22
struct ncast_proto_context* ncast_proto_init(struct nodeID *s, void *meta, int meta_size)
22
struct ncast_proto_context* ncast_proto_init(struct nodeID *s, const void *meta, int meta_size)
23 23
{
24 24
  struct ncast_proto_context *con;
25 25
  con = malloc(sizeof(struct ncast_proto_context));
......
56 56
  return topo_query_peer(context->context, local_cache, dst, MSG_TYPE_TOPOLOGY, NCAST_QUERY, 0);
57 57
}
58 58

  
59
int ncast_proto_metadata_update(struct ncast_proto_context *context, void *meta, int meta_size){
59
int ncast_proto_metadata_update(struct ncast_proto_context *context, const void *meta, int meta_size){
60 60
  return topo_proto_metadata_update(context->context, meta, meta_size);
61 61
}
src/Cache/ncast_proto.h
3 3

  
4 4
struct ncast_proto_context;
5 5

  
6
struct ncast_proto_context* ncast_proto_init(struct nodeID *s, void *meta, int meta_size);
6
struct ncast_proto_context* ncast_proto_init(struct nodeID *s, const void *meta, int meta_size);
7 7

  
8 8
int ncast_reply(struct ncast_proto_context *context, const struct peer_cache *c, struct peer_cache *local_cache);
9 9
int ncast_query(struct ncast_proto_context *context, struct peer_cache *local_cache);
10 10
int ncast_query_peer(struct ncast_proto_context *context, struct peer_cache *local_cache, struct nodeID *dst);
11
int ncast_proto_metadata_update(struct ncast_proto_context *context, void *meta, int meta_size);
11
int ncast_proto_metadata_update(struct ncast_proto_context *context, const void *meta, int meta_size);
12 12

  
13 13
#endif	/* NCAST_PROTO */
src/Cache/topo_proto.c
19 19
 struct peer_cache *myEntry;
20 20
};
21 21

  
22
static int topo_payload_fill(struct topo_context *context, uint8_t *payload, int size, struct peer_cache *c, struct nodeID *snot, int max_peers, int include_me)
22
static int topo_payload_fill(struct topo_context *context, uint8_t *payload, int size, struct peer_cache *c, const struct nodeID *snot, int max_peers, int include_me)
23 23
{
24 24
  int i;
25 25
  uint8_t *p = payload;
......
82 82
  return len > 0  ? send_to_peer(nodeid(context->myEntry, 0), dst, pkt, sizeof(struct topo_header) + len) : len;
83 83
}
84 84

  
85
int topo_proto_metadata_update(struct topo_context *context, void *meta, int meta_size)
85
int topo_proto_metadata_update(struct topo_context *context, const void *meta, int meta_size)
86 86
{
87 87
  if (cache_metadata_update(context->myEntry, nodeid(context->myEntry, 0), meta, meta_size) > 0) {
88 88
    return 1;
......
91 91
  return -1;
92 92
}
93 93

  
94
struct topo_context* topo_proto_init(struct nodeID *s, void *meta, int meta_size)
94
struct topo_context* topo_proto_init(struct nodeID *s, const void *meta, int meta_size)
95 95
{
96 96
  struct topo_context* con;
97 97

  
src/Cache/topo_proto.h
6 6
int topo_reply(struct topo_context *context, const struct peer_cache *c, struct peer_cache *local_cache, int protocol, int type, int max_peers, int include_me);
7 7
int topo_query_peer(struct topo_context *context, struct peer_cache *local_cache, struct nodeID *dst, int protocol, int type, int max_peers);
8 8

  
9
int topo_proto_metadata_update(struct topo_context *context, void *meta, int meta_size);
10
struct topo_context* topo_proto_init(struct nodeID *s, void *meta, int meta_size);
9
int topo_proto_metadata_update(struct topo_context *context, const void *meta, int meta_size);
10
struct topo_context* topo_proto_init(struct nodeID *s, const void *meta, int meta_size);
11 11

  
12 12
#endif	/* TOPO_PROTO */
src/Cache/topocache.c
71 71
  return c->metadata;
72 72
}
73 73

  
74
int cache_metadata_update(struct peer_cache *c, struct nodeID *p, const void *meta, int meta_size)
74
int cache_metadata_update(struct peer_cache *c, const struct nodeID *p, const void *meta, int meta_size)
75 75
{
76 76
  int i;
77 77

  
......
135 135
  return cache_add_ranked(c, neighbour, meta, meta_size, NULL, NULL);
136 136
}
137 137

  
138
int cache_del(struct peer_cache *c, struct nodeID *neighbour)
138
int cache_del(struct peer_cache *c, const struct nodeID *neighbour)
139 139
{
140 140
  int i;
141 141
  int found = 0;
src/Cache/topocache.h
10 10
void cache_update(struct peer_cache *c);
11 11
struct nodeID *nodeid(const struct peer_cache *c, int i);
12 12
const void *get_metadata(const struct peer_cache *c, int *size);
13
int cache_metadata_update(struct peer_cache *c, struct nodeID *p, const void *meta, int meta_size);
13
int cache_metadata_update(struct peer_cache *c, const struct nodeID *p, const void *meta, int meta_size);
14 14
int cache_add_ranked(struct peer_cache *c, struct nodeID *neighbour, const void *meta, int meta_size, ranking_function f, const void *tmeta);
15 15
int cache_add(struct peer_cache *c, struct nodeID *neighbour, const void *meta, int meta_size);
16
int cache_del(struct peer_cache *c, struct nodeID *neighbour);
16
int cache_del(struct peer_cache *c, const struct nodeID *neighbour);
17 17

  
18 18
struct nodeID *rand_peer(struct peer_cache *c, void **meta, int max);
19 19
struct nodeID *last_peer(struct peer_cache *c);

Also available in: Unified diff