1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326
|
--- a/common/list.c
+++ b/common/list.c
@@ -32,7 +32,7 @@
* @retval list on success
**/
-t_simple_list *list_create_simple_cell()
+t_simple_list *list_create_simple_cell(void)
{
t_simple_list *list;
@@ -50,7 +50,7 @@ t_simple_list *list_create_simple_cell()
**/
-t_list *list_create_cell()
+t_list *list_create_cell(void)
{
t_list *list;
--- a/common/myrand.c
+++ b/common/myrand.c
@@ -33,8 +33,9 @@
#include "mywin32.h"
#endif
+#include "myrand.h"
-uint16_t myrand()
+uint16_t myrand(void)
{
int res;
--- a/server/auth.c
+++ b/server/auth.c
@@ -33,6 +33,7 @@
#include "myrand.h"
#include "socket.h"
#include "queue.h"
+#include "auth.h"
#include "debug.h"
#include "log.h"
#include "queue.h"
@@ -132,7 +133,7 @@ int bind_user(t_conf *conf, t_request
* @retval -1 on error
**/
-int login_user(t_conf *conf, t_request *req, t_packet *packet)
+int login_user(t_conf *conf, t_request *req, t_packet *packet, t_simple_list *unused)
{
char *data;
t_simple_list *client;
--- a/common/includes/base64.h
+++ b/common/includes/base64.h
@@ -38,9 +38,5 @@ took from Apache 1.3.27
extern int base64_encode(char *string, char *encoded, int len);
extern int base64_decode(unsigned char *bufplain, const char *bufcoded);
-#ifndef HAVE_STRCASESTR
-extern char *strcasestr(const char *, const char *);
-#endif
-
#endif
--- a/common/includes/list.h
+++ b/common/includes/list.h
@@ -71,8 +71,8 @@ typedef struct s_simple_list {
#define FREE_CELL(cell) {cell->status = FREE;}
#define LOCK_CELL(cell) {cell->status = USED;}
-t_list *list_create_cell();
-t_simple_list *list_create_simple_cell();
+t_list *list_create_cell(void);
+t_simple_list *list_create_simple_cell(void);
int list_destroy_cell(t_list *);
int list_destroy_simple_cell(t_simple_list *);
int list_add_cell(t_list *, t_list *);
--- a/server/includes/queue.h
+++ b/server/includes/queue.h
@@ -22,7 +22,7 @@
#define __QUEUE_H__
int queue_put_data(t_conf *conf, t_request *req, t_data *data);
-t_list *init_queue();
+t_list *init_queue(void);
int queue_read_tcp(t_conf *conf, t_simple_list *client);
int queue_delete_zombie(t_conf * conf);
void client_update_timer(struct s_simple_list *client);
--- a/server/queue.c
+++ b/server/queue.c
@@ -32,6 +32,7 @@
#include "dns_decode.h"
#include "packet.h"
#include "myerror.h"
+#include "queue.h"
#include "requests.h"
#include "rr.h"
#include "control.h"
@@ -43,7 +44,8 @@
-void queue_dump(t_simple_list *client);
+static int queue_flush_outgoing_data(t_conf *, t_simple_list *, int);
+static void queue_update_timer(t_list *);
/**
@@ -78,7 +80,7 @@ int delete_queue(t_list *queue)
/**
* @brief update the client's queue timer
*/
-void queue_update_timer(t_list *queue)
+static void queue_update_timer(t_list *queue)
{
struct timeval tv;
struct timezone tz;
@@ -293,7 +295,7 @@ static int queue_change_root(t_simple_li
* @retval 0
**/
-int queue_flush_outgoing_data(t_conf *conf,t_simple_list *client, int index)
+static int queue_flush_outgoing_data(t_conf *conf,t_simple_list *client, int index)
{
t_list *queue;
--- a/client/includes/rr.h
+++ b/client/includes/rr.h
@@ -29,7 +29,7 @@ typedef struct s_rr_functions {
uint16_t type;
void *(*rr_add_reply)(struct dns_hdr *, void *, uint16_t , char *);
int (*rr_decode_next_reply)(t_request *, char *, int, int);
- int (*rr_available_len)();
+ int (*rr_available_len)(void);
} t_rr_functions;
#define TYPE_A 1
--- a/common/includes/myrand.h
+++ b/common/includes/myrand.h
@@ -21,6 +21,6 @@
#ifndef __MY_RAND_H__
#define __MY_RAND_H__
-uint16_t myrand();
+uint16_t myrand(void);
#endif
--- a/client/includes/queue.h
+++ b/client/includes/queue.h
@@ -21,7 +21,7 @@
#ifndef __QUEUE_H__
#define __QUEUE_H__
-t_list *init_queue();
+t_list *init_queue(void);
int delete_queue(t_list *queue);
int queue_get_udp_data(t_conf *conf, char *buffer, int len);
int queue_get_tcp_data(t_conf *conf, struct s_simple_list *client);
--- a/client/queue.c
+++ b/client/queue.c
@@ -32,6 +32,7 @@
#include "list.h"
#include "client.h"
#include "myerror.h"
+#include "queue.h"
#include "requests.h"
#include "myrand.h"
#include "debug.h"
@@ -39,6 +40,15 @@
#include "crc16.h"
#include "socket.h"
+static int extract_data(t_conf *, t_simple_list *, t_list *);
+static int queue_change_root(t_simple_list *, t_list *);
+static t_list *queue_find_empty_data_cell(t_simple_list *);
+static int queue_flush(t_conf *, t_simple_list *);
+static int queue_prepare_ack(t_list *, uint16_t);
+static int queue_resend(t_conf *, t_simple_list *, t_list *);
+static int queue_send(t_conf *, t_simple_list *, t_list *);
+static int write_to_client(t_conf *, t_simple_list *, const char *, int);
+
#ifdef _WIN32
static int gettimeofday(struct timeval *tv, void *bla)
{
@@ -91,7 +101,7 @@ int delete_queue(t_list *que
* @note update the timeout timer
**/
-int queue_send(t_conf *conf, t_simple_list *client, t_list *queue)
+static int queue_send(t_conf *conf, t_simple_list *client, t_list *queue)
{
int out_len;
struct timeval tv;
@@ -130,7 +140,7 @@ int queue_send(t_conf *conf, t_simple_
* @note update the request ID but keep the previous one for delayed reply
**/
-int queue_resend(t_conf *conf, t_simple_list *client, t_list *queue)
+static int queue_resend(t_conf *conf, t_simple_list *client, t_list *queue)
{
struct dns_hdr *hdr;
@@ -222,7 +232,7 @@ void queue_dump(t_simple_list *client)
* @retval -1 on error
**/
-int queue_change_root(t_simple_list *client, t_list *new_root)
+static int queue_change_root(t_simple_list *client, t_list *new_root)
{
t_list *end;
t_list *prev;
@@ -251,7 +261,7 @@ int queue_change_root(t_simp
return (0);
}
-int write_to_client(t_conf *conf, t_simple_list *client, const char *buffer, int total_len)
+static int write_to_client(t_conf *conf, t_simple_list *client, const char *buffer, int total_len)
{
ssize_t ret;
#ifdef _WIN32
@@ -299,7 +309,7 @@ int write_to_client(t_conf *conf, t_sim
* @retval -1 on error
**/
-int extract_data(t_conf *conf, t_simple_list *client, t_list *queue)
+static int extract_data(t_conf *conf, t_simple_list *client, t_list *queue)
{
char buffer[MAX_DNS_LEN + 1 - DNS_HDR_SIZE - RR_HDR_SIZE];
t_packet *packet;
@@ -358,7 +368,7 @@ int extract_data(t_conf *conf, t_simpl
* @retval -1 on error
**/
-t_list *queue_find_empty_data_cell(t_simple_list *client)
+static t_list *queue_find_empty_data_cell(t_simple_list *client)
{
t_list *queue;
@@ -383,7 +393,7 @@ t_list *queue_find_empty_data_cell(t_si
* @retval -1 on error
**/
-int queue_prepare_ack(t_list *queue, uint16_t seq)
+static int queue_prepare_ack(t_list *queue, uint16_t seq)
{
while (queue)
{
@@ -404,7 +414,7 @@ int queue_prepare_ack(t_list *queue, ui
* @note rotate the circular buffer when done
**/
-int queue_flush(t_conf *conf, t_simple_list *client)
+static int queue_flush(t_conf *conf, t_simple_list *client)
{
t_list *queue;
t_list *free_cell;
--- a/client/options.c
+++ b/client/options.c
@@ -41,6 +41,7 @@ int getopt(int, char * const *, const c
#include "client.h"
+#include "options.h"
#include "my_config.h"
#include "debug.h"
#include "rr.h"
--- a/client/session.c
+++ b/client/session.c
@@ -27,7 +27,7 @@
#include "debug.h"
#include "rr.h"
#include "myrand.h"
-
+#include "session.h"
/**
--- a/client/socket.c
+++ b/client/socket.c
@@ -36,6 +36,8 @@
#include "socket.h"
#include "select.h"
+static uint16_t unix_get_simple_reply(t_conf *, char *, uint16_t);
+
int socket_is_valid(socket_t socket)
{
#ifndef _WIN32
@@ -48,7 +50,7 @@ int socket_is_valid(socket_t socket)
#ifndef _WIN32
-uint16_t unix_get_simple_reply(t_conf *conf, char *buffer, uint16_t id)
+static uint16_t unix_get_simple_reply(t_conf *conf, char *buffer, uint16_t id)
{
fd_set rfds;
int retval;
--- a/common/crc16.c
+++ b/common/crc16.c
@@ -33,6 +33,7 @@
#include "mywin32.h"
#endif
+#include "crc16.h"
/*
--- a/server/rr.c
+++ b/server/rr.c
@@ -37,6 +37,7 @@ static const t_rr_functions rr_function[
{0,0,0,0}
};
+static void *rr_add_data(struct dns_hdr *, void *, uint16_t, char *, uint16_t);
/**
* @brief get functions pointer for decoding data
@@ -64,7 +65,7 @@ const t_rr_functions *get_rr_function_b
* @retval rr header
**/
-void *rr_add_data(struct dns_hdr *hdr, void *where, uint16_t type, char *encoded_data, uint16_t what)
+static void *rr_add_data(struct dns_hdr *hdr, void *where, uint16_t type, char *encoded_data, uint16_t what)
{
struct rr_hdr *rr;
|