Statistics
| Branch: | Revision:

grapes / src / TopologyManager / ncast_proto.c @ c3d9eba1

History | View | Annotate | Download (842 Bytes)

1
/*
2
 *  Copyright (c) 2010 Luca Abeni
3
 *
4
 *  This is free software; see lgpl-2.1.txt
5
 */
6

    
7
#include <stdint.h>
8
#include <stdlib.h>
9
#include <stdio.h>
10

    
11
#include "net_helper.h"
12
#include "topocache.h"
13
#include "proto.h"
14
#include "topo_proto.h"
15
#include "ncast_proto.h"
16
#include "grapes_msg_types.h"
17

    
18
int ncast_reply(const struct peer_cache *c, struct peer_cache *local_cache)
19
{
20
  return topo_reply(c, local_cache, MSG_TYPE_TOPOLOGY, NCAST_REPLY, 0, 1);
21
}
22

    
23
int ncast_query_peer(struct peer_cache *local_cache, struct nodeID *dst)
24
{
25
  return topo_query_peer(local_cache, dst, MSG_TYPE_TOPOLOGY, NCAST_QUERY, 0);
26
}
27

    
28
int ncast_query(struct peer_cache *local_cache)
29
{
30
  struct nodeID *dst;
31

    
32
  dst = rand_peer(local_cache, NULL, 0);
33
  if (dst == NULL) {
34
    return 0;
35
  }
36
  return topo_query_peer(local_cache, dst, MSG_TYPE_TOPOLOGY, NCAST_QUERY, 0);
37
}