Statistics
| Branch: | Revision:

grapes / src / PeerSampler / peersampler_iface.h @ 10ddaca7

History | View | Annotate | Download (1.04 KB)

1
#ifndef PEERSAMPLER_IFACE
2
#define PEERSAMPLER_IFACE
3

    
4
struct peersampler_context;
5

    
6
struct peersampler_iface {
7
  struct peersampler_context* (*init)(struct nodeID *myID, const void *metadata, int metadata_size, const char *config);
8
  int (*change_metadata)(struct peersampler_context *context, const void *metadata, int metadata_size);
9
  int (*add_neighbour)(struct peersampler_context *context, struct nodeID *neighbour, const void *metadata, int metadata_size);
10
  int (*parse_data)(struct peersampler_context *context, const uint8_t *buff, int len);
11
  const struct nodeID *const*(*get_neighbourhood)(struct peersampler_context *context, int *n);
12
  const void *(*get_metadata)(struct peersampler_context *context, int *metadata_size);
13
  int (*grow_neighbourhood)(struct peersampler_context *context, int n);
14
  int (*shrink_neighbourhood)(struct peersampler_context *context, int n);
15
  int (*remove_neighbour)(struct peersampler_context *context, const struct nodeID *neighbour);
16
  void (*destroy)(struct peersampler_context **context);
17
};
18

    
19
#endif        /* PEERSAMPLER_IFACE */