Revision c5922d21

View differences:

include/net_helper.h
98 98
* @param[in] buffer_size The length of the data buffer.
99 99
* @return The number of bytes sent or -1 if some error occurred.
100 100
*/
101
int send_to_peer(const struct nodeID *from,const  struct nodeID *to, const uint8_t *buffer_ptr, int buffer_size);
101
int send_to_peer(const struct nodeID *from, const struct nodeID *to, const uint8_t *buffer_ptr, int buffer_size);
102 102

  
103 103
/**
104 104
* @brief Receive data from a remote peer.
include/peerset.h
126 126
  */
127 127
void peerset_clear(struct peerset *h, int size);
128 128

  
129
int peerset_push_peer(struct peerset *h,const  struct peer *e);
129
int peerset_push_peer(struct peerset *h, struct peer *e);
130 130

  
131 131
struct peer * peerset_pop_peer(struct peerset *h, const struct nodeID *id);
132 132

  
src/ChunkTrading/chunk_signaling.c
111 111
  return 1;
112 112
}
113 113

  
114
static int sendSignaling(int type,const  struct nodeID *to_id,
114
static int sendSignaling(int type, const struct nodeID *to_id,
115 115
                         const struct nodeID *owner_id,
116 116
                         const struct chunkID_set *cset, int max_deliver,
117 117
                         uint16_t trans_id)
src/Chunkiser/input-stream-ts.c
15 15
#include <stdio.h>
16 16

  
17 17
#include "chunkiser_iface.h"
18
#include "config.h"
18
#include "grapes_config.h"
19 19

  
20 20
struct chunkiser_ctx {
21 21
  int loop;	//loop on input file infinitely
......
70 70
  res->fds[1] = -1;
71 71

  
72 72
  res->pkts_per_chunk = DEFAULT_PKTS;
73
  cfg_tags = config_parse(config);
73
  cfg_tags = grapes_config_parse(config);
74 74
  if (cfg_tags) {
75 75
    const char *access_mode;
76 76

  
77
    config_value_int(cfg_tags, "loop", &res->loop);
78
    config_value_int(cfg_tags, "pkts", &res->pkts_per_chunk);
79
    config_value_int(cfg_tags, "pcr_period", &res->pcr_period);
80
    access_mode = config_value_str(cfg_tags, "mode");
77
    grapes_config_value_int(cfg_tags, "loop", &res->loop);
78
    grapes_config_value_int(cfg_tags, "pkts", &res->pkts_per_chunk);
79
    grapes_config_value_int(cfg_tags, "pcr_period", &res->pcr_period);
80
    access_mode = grapes_config_value_str(cfg_tags, "mode");
81 81
    if (access_mode && !strcmp(access_mode, "nonblock")) {
82 82
      fcntl(res->fds[0], F_SETFL, O_NONBLOCK);
83 83
    }
src/PeerSet/peerset_ops.c
102 102
	*h = NULL;
103 103
}
104 104

  
105
int peerset_push_peer(struct peerset *h,const  struct peer *e)
105
int peerset_push_peer(struct peerset *h, struct peer *e)
106 106
{
107 107
  int pos;
108 108

  
src/Tests/config_test.c
6 6

  
7 7
#include <stdlib.h>
8 8
#include <stdio.h>
9
#include "../config.h"
9
#include "grapes_config.h"
10 10

  
11 11
int main(int argc, char *argv[])
12 12
{
src/Tests/inet_test.c
18 18

  
19 19
int checkIPv4Translation()
20 20
{
21
	int res = 0;
21
	int res;
22
	const char *res1;
22 23
	struct sockaddr_storage s;
23 24
	struct sockaddr_storage c;
24 25
	char *buf = malloc(INET_ADDRSTRLEN);
......
31 32
		perror ("inet");
32 33
		return res;
33 34
	}
34
	printf("to network %d\n", ((struct sockaddr_in *)&s)->sin_addr);
35
	printf("\tTranslating IPv4 address %d...",((struct sockaddr_in *)&s)->sin_addr);
36
	res = inet_ntop(AF_INET, &((struct sockaddr_in *)&s)->sin_addr, buf, INET_ADDRSTRLEN);
37
	if(!res)
35
	printf("to network %d\n", ((struct sockaddr_in *)&s)->sin_addr.s_addr);
36
	printf("\tTranslating IPv4 address %d...", ((struct sockaddr_in *)&s)->sin_addr.s_addr);
37
	res1 = inet_ntop(AF_INET, &((struct sockaddr_in *)&s)->sin_addr, buf, INET_ADDRSTRLEN);
38
	if(!res1)
38 39
	{
39 40
		perror ("inet");
40 41
		return res;
......
46 47

  
47 48
int checkIPv6Translation()
48 49
{
49
	int res = 0, i;
50
	int res, i;
51
	const char *res1;
50 52
	struct sockaddr_storage s;
51 53
	struct sockaddr_storage c;
52 54
	char *buf = malloc(INET6_ADDRSTRLEN);
53
	char *ipv6 = malloc(INET6_ADDRSTRLEN);
54
	ipv6 = "fe80:0000:0000:0000:0223:aeff:fe54:ea0c";
55
	const char *ipv6 = "fe80:0000:0000:0000:0223:aeff:fe54:ea0c";
55 56
	printf("\tIPv6 Address string %s ", ipv6);
56 57
	res = inet_pton(AF_INET6, ipv6, &((struct sockaddr_in6 *)&s)->sin6_addr);
57 58
	if(!res)
......
74 75
		#else
75 76
		    printf("%02x%02x:", (uint8_t) (((struct sockaddr_in6 *)&s)->sin6_addr.__in6_u.__u6_addr8[i]),(uint8_t) (((struct sockaddr_in6 *)&s)->sin6_addr.__in6_u.__u6_addr8[i+1]));
76 77
		#endif
77
	res = inet_ntop(AF_INET6, &((struct sockaddr_in6 *)&s)->sin6_addr, buf, INET6_ADDRSTRLEN);
78
	if(!res)
78
	res1 = inet_ntop(AF_INET6, &((struct sockaddr_in6 *)&s)->sin6_addr, buf, INET6_ADDRSTRLEN);
79
	if(!res1)
79 80
	{
80 81
		perror ("inet");
81 82
		return res;
src/net_helper-udp.c
299 299
  uint8_t frags;
300 300
} __attribute__((packed));
301 301

  
302
int send_to_peer(const struct nodeID *from,const  struct nodeID *to, const uint8_t *buffer_ptr, int buffer_size)
302
int send_to_peer(const struct nodeID *from, const struct nodeID *to, const uint8_t *buffer_ptr, int buffer_size)
303 303
{
304 304
  struct msghdr msg = {0};
305 305
  static struct my_hdr_t my_hdr;
306 306
  struct iovec iov[2];
307 307
  int res;
308 308

  
309
  if (buffer_size <= 0) return;
309
  if (buffer_size <= 0) return -1;
310 310

  
311 311
  iov[0].iov_base = &my_hdr;
312 312
  iov[0].iov_len = sizeof(struct my_hdr_t);

Also available in: Unified diff