Revision b9e7dd7b src/CloudSupport/cloud_helper.c

View differences:

src/CloudSupport/cloud_helper.c
19 19
};
20 20

  
21 21
static int ctx_counter = 0;
22
static struct nodeID* node_ids[CLOUD_HELPER_MAX_INSTANCES];
22
static const struct nodeID* node_ids[CLOUD_HELPER_MAX_INSTANCES];
23 23
static struct cloud_helper_context* cloud_ctxs[CLOUD_HELPER_MAX_INSTANCES];
24 24

  
25
static int add_context(struct nodeID *local, struct cloud_helper_context *ctx)
25
static int add_context(const struct nodeID *local,
26
                       struct cloud_helper_context *ctx)
26 27
{
27 28
  int i;
28 29
  if (ctx_counter >= CLOUD_HELPER_MAX_INSTANCES) return 1;
......
37 38
  return 1;
38 39
}
39 40

  
40
struct cloud_helper_context* cloud_helper_init(struct nodeID *local, const char *config)
41
struct cloud_helper_context* cloud_helper_init(struct nodeID *local,
42
                                               const char *config)
41 43
{
42 44
  struct cloud_helper_context *ctx;
43 45
  struct tag *cfg_tags;
......
70 72
 return ctx;
71 73
}
72 74

  
73
struct cloud_helper_context* get_cloud_helper_for(struct nodeID *local){
75
struct cloud_helper_context* get_cloud_helper_for(const struct nodeID *local){
74 76
  int i;
75 77
  for (i=0; i<ctx_counter; i++)
76 78
    if (node_ids[i] == local) return cloud_ctxs[i];
......
78 80
  return NULL;
79 81
}
80 82

  
81
int get_from_cloud(struct cloud_helper_context *context, char *key, uint8_t *header_ptr, int header_size)
83
int get_from_cloud(struct cloud_helper_context *context, const char *key,
84
                   uint8_t *header_ptr, int header_size, int free_header)
82 85
{
83
  return context->ch->get_from_cloud(context->ch_context, key, header_ptr, header_size);
86
  return context->ch->get_from_cloud(context->ch_context, key, header_ptr,
87
                                     header_size, free_header);
84 88
}
85 89

  
86
int put_on_cloud(struct cloud_helper_context *context, char *key, uint8_t *buffer_ptr, int buffer_size)
90
int put_on_cloud(struct cloud_helper_context *context, const char *key,
91
                 uint8_t *buffer_ptr, int buffer_size, int free_buffer)
87 92
{
88
  return context->ch->put_on_cloud(context->ch_context, key, buffer_ptr, buffer_size);
93
  return context->ch->put_on_cloud(context->ch_context, key, buffer_ptr,
94
                                   buffer_size, free_buffer);
89 95
}
90 96

  
91
struct nodeID* get_cloud_node(struct cloud_helper_context *context, uint8_t variant)
97
struct nodeID* get_cloud_node(struct cloud_helper_context *context,
98
                              uint8_t variant)
92 99
{
93 100
  return context->ch->get_cloud_node(context->ch_context, variant);
94 101
}
......
108 115
  return context->ch->wait4cloud(context->ch_context, tout);
109 116
}
110 117

  
111
int recv_from_cloud(struct cloud_helper_context *context, uint8_t *buffer_ptr, int buffer_size)
118
int recv_from_cloud(struct cloud_helper_context *context, uint8_t *buffer_ptr,
119
                    int buffer_size)
112 120
{
113
  return context->ch->recv_from_cloud(context->ch_context, buffer_ptr, buffer_size);
121
  return context->ch->recv_from_cloud(context->ch_context, buffer_ptr,
122
                                      buffer_size);
114 123
}

Also available in: Unified diff