Iodine: Cleaned up

This commit is contained in:
Julian Kranz 2012-01-06 18:39:28 +01:00 committed by Barak A. Pearlmutter
parent ee33069f6d
commit 1f756d0f12
6 changed files with 95 additions and 0 deletions

View file

@ -1,5 +1,6 @@
/* /*
* Copyright (c) 2006-2009 Bjorn Andersson <flex@kryo.se>, Erik Ekman <yarrick@kryo.se> * Copyright (c) 2006-2009 Bjorn Andersson <flex@kryo.se>, Erik Ekman <yarrick@kryo.se>
* Copyright (c) 2011-2012 Julian Kranz <julian@juliankranz.de>
* *
* Permission to use, copy, modify, and distribute this software for any * Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -60,9 +61,15 @@ static void
usage() { usage() {
extern char *__progname; extern char *__progname;
#ifdef LINUX
fprintf(stderr, "Usage: %s [-v] [-h] [-f] [-r] [-u user] [-t chrootdir] [-d device] " fprintf(stderr, "Usage: %s [-v] [-h] [-f] [-r] [-u user] [-t chrootdir] [-d device] "
"[-P password] [-6] [-m maxfragsize] [-M maxlen] [-T type] [-O enc] [-L 0|1] [-I sec] " "[-P password] [-6] [-m maxfragsize] [-M maxlen] [-T type] [-O enc] [-L 0|1] [-I sec] "
"[-z context] [-F pidfile] [nameserver] topdomain\n", __progname); "[-z context] [-F pidfile] [nameserver] topdomain\n", __progname);
#elif
fprintf(stderr, "Usage: %s [-v] [-h] [-f] [-r] [-u user] [-t chrootdir] [-d device] "
"[-P password] [-m maxfragsize] [-M maxlen] [-T type] [-O enc] [-L 0|1] [-I sec] "
"[-z context] [-F pidfile] [nameserver] topdomain\n", __progname);
#endif
exit(2); exit(2);
} }
@ -71,9 +78,15 @@ help() {
extern char *__progname; extern char *__progname;
fprintf(stderr, "iodine IP over DNS tunneling client\n"); fprintf(stderr, "iodine IP over DNS tunneling client\n");
#ifdef LINUX
fprintf(stderr, "Usage: %s [-v] [-h] [-f] [-r] [-u user] [-t chrootdir] [-d device] " fprintf(stderr, "Usage: %s [-v] [-h] [-f] [-r] [-u user] [-t chrootdir] [-d device] "
"[-P password] [-6] [-m maxfragsize] [-M maxlen] [-T type] [-O enc] [-L 0|1] [-I sec] " "[-P password] [-6] [-m maxfragsize] [-M maxlen] [-T type] [-O enc] [-L 0|1] [-I sec] "
"[-z context] [-F pidfile] [nameserver] topdomain\n", __progname); "[-z context] [-F pidfile] [nameserver] topdomain\n", __progname);
#elif
fprintf(stderr, "Usage: %s [-v] [-h] [-f] [-r] [-u user] [-t chrootdir] [-d device] "
"[-P password] [-m maxfragsize] [-M maxlen] [-T type] [-O enc] [-L 0|1] [-I sec] "
"[-z context] [-F pidfile] [nameserver] topdomain\n", __progname);
#endif
fprintf(stderr, "Options to try if connection doesn't work:\n"); fprintf(stderr, "Options to try if connection doesn't work:\n");
fprintf(stderr, " -T force dns type: NULL, TXT, SRV, MX, CNAME, A (default: autodetect)\n"); fprintf(stderr, " -T force dns type: NULL, TXT, SRV, MX, CNAME, A (default: autodetect)\n");
fprintf(stderr, " -O force downstream encoding for -T other than NULL: Base32, Base64, Base64u,\n"); fprintf(stderr, " -O force downstream encoding for -T other than NULL: Base32, Base64, Base64u,\n");
@ -84,7 +97,9 @@ help() {
fprintf(stderr, " -M max size of upstream hostnames (~100-255, default: 255)\n"); fprintf(stderr, " -M max size of upstream hostnames (~100-255, default: 255)\n");
fprintf(stderr, " -r to skip raw UDP mode attempt\n"); fprintf(stderr, " -r to skip raw UDP mode attempt\n");
fprintf(stderr, " -P password used for authentication (max 32 chars will be used)\n"); fprintf(stderr, " -P password used for authentication (max 32 chars will be used)\n");
#ifdef LINUX
fprintf(stderr, " -6 use IPv6 (make sure to use this option consistently on client and server)\n"); fprintf(stderr, " -6 use IPv6 (make sure to use this option consistently on client and server)\n");
#endif
fprintf(stderr, "Other options:\n"); fprintf(stderr, "Other options:\n");
fprintf(stderr, " -v to print version info and exit\n"); fprintf(stderr, " -v to print version info and exit\n");
fprintf(stderr, " -h to print this help and exit\n"); fprintf(stderr, " -h to print this help and exit\n");
@ -137,7 +152,9 @@ main(int argc, char **argv)
int lazymode; int lazymode;
int selecttimeout; int selecttimeout;
int hostname_maxlen; int hostname_maxlen;
#ifdef LINUX
char v6; char v6;
#endif
int rtable = 0; int rtable = 0;
nameserv_addr = NULL; nameserv_addr = NULL;
@ -162,7 +179,9 @@ main(int argc, char **argv)
selecttimeout = 4; selecttimeout = 4;
hostname_maxlen = 0xFF; hostname_maxlen = 0xFF;
#ifdef LINUX
v6 = 0; v6 = 0;
#endif
#ifdef WINDOWS32 #ifdef WINDOWS32
WSAStartup(req_version, &wsa_data); WSAStartup(req_version, &wsa_data);
@ -179,7 +198,11 @@ main(int argc, char **argv)
__progname++; __progname++;
#endif #endif
#ifdef LINUX
while ((choice = getopt(argc, argv, "6vfhru:t:d:R:P:m:M:F:T:O:L:I:")) != -1) { while ((choice = getopt(argc, argv, "6vfhru:t:d:R:P:m:M:F:T:O:L:I:")) != -1) {
#elif
while ((choice = getopt(argc, argv, "vfhru:t:d:R:P:m:M:F:T:O:L:I:")) != -1) {
#endif
switch(choice) { switch(choice) {
case 'v': case 'v':
version(); version();
@ -250,9 +273,11 @@ main(int argc, char **argv)
if (selecttimeout < 1) if (selecttimeout < 1)
selecttimeout = 1; selecttimeout = 1;
break; break;
#ifdef LINUX
case '6': case '6':
v6 = 1; v6 = 1;
break; break;
#endif
default: default:
usage(); usage();
/* NOTREACHED */ /* NOTREACHED */
@ -308,7 +333,9 @@ main(int argc, char **argv)
client_set_lazymode(lazymode); client_set_lazymode(lazymode);
client_set_topdomain(topdomain); client_set_topdomain(topdomain);
client_set_hostname_maxlen(hostname_maxlen); client_set_hostname_maxlen(hostname_maxlen);
#ifdef LINUX
client_set_v6(v6); client_set_v6(v6);
#endif
if (username != NULL) { if (username != NULL) {
#ifndef WINDOWS32 #ifndef WINDOWS32

View file

@ -1,5 +1,6 @@
/* /*
* Copyright (c) 2006-2009 Bjorn Andersson <flex@kryo.se>, Erik Ekman <yarrick@kryo.se> * Copyright (c) 2006-2009 Bjorn Andersson <flex@kryo.se>, Erik Ekman <yarrick@kryo.se>
* Copyright (c) 2011-2012 Julian Kranz <julian@juliankranz.de>
* *
* Permission to use, copy, modify, and distribute this software for any * Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -40,7 +41,9 @@
#define _XPG4_2 #define _XPG4_2
#include <netinet/in_systm.h> #include <netinet/in_systm.h>
#include <netinet/ip.h> #include <netinet/ip.h>
#ifdef LINUX
#include <netinet/ip6.h> #include <netinet/ip6.h>
#endif
#include <grp.h> #include <grp.h>
#include <sys/uio.h> #include <sys/uio.h>
#include <pwd.h> #include <pwd.h>
@ -79,7 +82,9 @@ static int created_users;
static int check_ip; static int check_ip;
static int my_mtu; static int my_mtu;
static in_addr_t my_ip; static in_addr_t my_ip;
#ifdef LINUX
static struct in6_addr my_net6; static struct in6_addr my_net6;
#endif
static int netmask; static int netmask;
static char netmask6; static char netmask6;
@ -88,7 +93,9 @@ static in_addr_t ns_ip;
static int bind_port; static int bind_port;
static int debug; static int debug;
#ifdef LINUX
static char v6; static char v6;
#endif
#if !defined(BSD) && !defined(__GLIBC__) #if !defined(BSD) && !defined(__GLIBC__)
static char *__progname; static char *__progname;
@ -553,7 +560,9 @@ tunnel_tun(int tun_fd, int dns_fd)
{ {
unsigned long outlen; unsigned long outlen;
struct ip *header; struct ip *header;
#ifdef LINUX
struct ip6_hdr *header6; struct ip6_hdr *header6;
#endif
char out[64*1024]; char out[64*1024];
char in[64*1024]; char in[64*1024];
int userid; int userid;
@ -563,16 +572,20 @@ tunnel_tun(int tun_fd, int dns_fd)
if ((read = read_tun(tun_fd, in, sizeof(in))) <= 0) if ((read = read_tun(tun_fd, in, sizeof(in))) <= 0)
return 0; return 0;
#ifdef LINUX
header_info = (uint16_t*)in; header_info = (uint16_t*)in;
if(header_info[1] == 0x0008) { if(header_info[1] == 0x0008) {
#endif
/* find target ip in packet, in is padded with 4 bytes TUN header */ /* find target ip in packet, in is padded with 4 bytes TUN header */
header = (struct ip*) (in + 4); header = (struct ip*) (in + 4);
userid = find_user_by_ip(header->ip_dst.s_addr); userid = find_user_by_ip(header->ip_dst.s_addr);
#ifdef LINUX
} }
else { else {
header6 = (struct ip6_hdr*) (in + 4); header6 = (struct ip6_hdr*) (in + 4);
userid = find_user_by_ip6(header6->ip6_dst); userid = find_user_by_ip6(header6->ip6_dst);
} }
#endif
/* printf("tunnel_tun() - userid = %d, header_info[1] = %d\n", userid, header_info[1]); */ /* printf("tunnel_tun() - userid = %d, header_info[1] = %d\n", userid, header_info[1]); */
@ -806,6 +819,7 @@ handle_null_request(int tun_fd, int dns_fd, struct query *q, int domain_len)
tempip.s_addr = users[userid].tun_ip; tempip.s_addr = users[userid].tun_ip;
tmp[1] = strdup(inet_ntoa(tempip)); tmp[1] = strdup(inet_ntoa(tempip));
#ifdef LINUX
if (v6) { if (v6) {
struct in6_addr ip6; struct in6_addr ip6;
@ -820,6 +834,7 @@ handle_null_request(int tun_fd, int dns_fd, struct query *q, int domain_len)
tmp[0], tmp[1], my_mtu, netmask, server6, client6, tmp[0], tmp[1], my_mtu, netmask, server6, client6,
netmask6); netmask6);
} else } else
#endif
read = snprintf(out, sizeof(out), "%s-%s-%d-%d", tmp[0], read = snprintf(out, sizeof(out), "%s-%s-%d-%d", tmp[0],
tmp[1], my_mtu, netmask); tmp[1], my_mtu, netmask);
@ -1768,15 +1783,19 @@ handle_full_packet(int tun_fd, int dns_fd, int userid)
if (ret == Z_OK) { if (ret == Z_OK) {
#ifdef LINUX
struct ip *hdr; struct ip *hdr;
hdr = (struct ip*) (out + 4); hdr = (struct ip*) (out + 4);
if(hdr->ip_v == 0x04) if(hdr->ip_v == 0x04)
#endif
touser = find_user_by_ip(hdr->ip_dst.s_addr); touser = find_user_by_ip(hdr->ip_dst.s_addr);
#ifdef LINUX
else { else {
struct ip6_hdr *hdr; struct ip6_hdr *hdr;
hdr = (struct ip6_hdr*) (out + 4); hdr = (struct ip6_hdr*) (out + 4);
touser = find_user_by_ip6(hdr->ip6_dst); touser = find_user_by_ip6(hdr->ip6_dst);
} }
#endif
/* /*
struct ip6_hdr *h6; struct ip6_hdr *h6;
@ -2172,11 +2191,19 @@ static void
usage() { usage() {
extern char *__progname; extern char *__progname;
#ifdef LINUX
fprintf(stderr, "Usage: %s [-v] [-h] [-c] [-s] [-f] [-D] [-6] [-u user] " fprintf(stderr, "Usage: %s [-v] [-h] [-c] [-s] [-f] [-D] [-6] [-u user] "
"[-t chrootdir] [-d device] [-m mtu] [-z context] " "[-t chrootdir] [-d device] [-m mtu] [-z context] "
"[-l ip address to listen on] [-p port] [-n external ip] " "[-l ip address to listen on] [-p port] [-n external ip] "
"[-b dnsport] [-P password] [-F pidfile] " "[-b dnsport] [-P password] [-F pidfile] "
"tunnel_ip[/netmask] [tunnel_net6/netmask6] topdomain\n", __progname); "tunnel_ip[/netmask] [tunnel_net6/netmask6] topdomain\n", __progname);
#elif
fprintf(stderr, "Usage: %s [-v] [-h] [-c] [-s] [-f] [-D] [-u user] "
"[-t chrootdir] [-d device] [-m mtu] [-z context] "
"[-l ip address to listen on] [-p port] [-n external ip] "
"[-b dnsport] [-P password] [-F pidfile] "
"tunnel_ip[/netmask] topdomain\n", __progname);
#endif
exit(2); exit(2);
} }
@ -2185,10 +2212,17 @@ help() {
extern char *__progname; extern char *__progname;
fprintf(stderr, "iodine IP over DNS tunneling server\n"); fprintf(stderr, "iodine IP over DNS tunneling server\n");
#ifdef LINUX
fprintf(stderr, "Usage: %s [-v] [-h] [-c] [-s] [-f] [-D] [-6] [-u user] " fprintf(stderr, "Usage: %s [-v] [-h] [-c] [-s] [-f] [-D] [-6] [-u user] "
"[-t chrootdir] [-d device] [-m mtu] [-z context] " "[-t chrootdir] [-d device] [-m mtu] [-z context] "
"[-l ip address to listen on] [-p port] [-n external ip] [-b dnsport] [-P password] " "[-l ip address to listen on] [-p port] [-n external ip] [-b dnsport] [-P password] "
"[-F pidfile] tunnel_ip[/netmask] [tunnel_net6/netmask6] topdomain\n", __progname); "[-F pidfile] tunnel_ip[/netmask] [tunnel_net6/netmask6] topdomain\n", __progname);
#elif
fprintf(stderr, "Usage: %s [-v] [-h] [-c] [-s] [-f] [-D] [-u user] "
"[-t chrootdir] [-d device] [-m mtu] [-z context] "
"[-l ip address to listen on] [-p port] [-n external ip] [-b dnsport] [-P password] "
"[-F pidfile] tunnel_ip[/netmask] topdomain\n", __progname);
#endif
fprintf(stderr, " -v to print version info and exit\n"); fprintf(stderr, " -v to print version info and exit\n");
fprintf(stderr, " -h to print this help and exit\n"); fprintf(stderr, " -h to print this help and exit\n");
fprintf(stderr, " -c to disable check of client IP/port on each request\n"); fprintf(stderr, " -c to disable check of client IP/port on each request\n");
@ -2197,7 +2231,9 @@ help() {
fprintf(stderr, " -f to keep running in foreground\n"); fprintf(stderr, " -f to keep running in foreground\n");
fprintf(stderr, " -D to increase debug level\n"); fprintf(stderr, " -D to increase debug level\n");
fprintf(stderr, " (using -DD in UTF-8 terminal: \"LC_ALL=C luit iodined -DD ...\")\n"); fprintf(stderr, " (using -DD in UTF-8 terminal: \"LC_ALL=C luit iodined -DD ...\")\n");
#ifdef LINUX
fprintf(stderr, " -6 use IPv6 (make sure to use this option consistently on client and server)\n"); fprintf(stderr, " -6 use IPv6 (make sure to use this option consistently on client and server)\n");
#endif
fprintf(stderr, " -u name to drop privileges and run as user 'name'\n"); fprintf(stderr, " -u name to drop privileges and run as user 'name'\n");
fprintf(stderr, " -t dir to chroot to directory dir\n"); fprintf(stderr, " -t dir to chroot to directory dir\n");
fprintf(stderr, " -d device to set tunnel device name\n"); fprintf(stderr, " -d device to set tunnel device name\n");
@ -2277,7 +2313,9 @@ main(int argc, char **argv)
debug = 0; debug = 0;
netmask = 27; netmask = 27;
pidfile = NULL; pidfile = NULL;
#ifdef LINUX
v6 = 0; v6 = 0;
#endif
b32 = get_base32_encoder(); b32 = get_base32_encoder();
b64 = get_base64_encoder(); b64 = get_base64_encoder();
@ -2302,7 +2340,11 @@ main(int argc, char **argv)
srand(time(NULL)); srand(time(NULL));
fw_query_init(); fw_query_init();
#ifdef LINUX
while ((choice = getopt(argc, argv, "6vcsfhDu:t:d:m:l:p:n:b:P:z:F:")) != -1) { while ((choice = getopt(argc, argv, "6vcsfhDu:t:d:m:l:p:n:b:P:z:F:")) != -1) {
#elif
while ((choice = getopt(argc, argv, "vcsfhDu:t:d:m:l:p:n:b:P:z:F:")) != -1) {
#endif
switch(choice) { switch(choice) {
case 'v': case 'v':
version(); version();
@ -2360,9 +2402,11 @@ main(int argc, char **argv)
case 'z': case 'z':
context = optarg; context = optarg;
break; break;
#ifdef LINUX
case '6': case '6':
v6 = 1; v6 = 1;
break; break;
#endif
default: default:
usage(); usage();
break; break;
@ -2374,7 +2418,11 @@ main(int argc, char **argv)
check_superuser(usage); check_superuser(usage);
#ifdef LINUX
if (argc != 2 + v6) if (argc != 2 + v6)
#elif
if (argc != 2)
#endif
usage(); usage();
netsize = strchr(argv[0], '/'); netsize = strchr(argv[0], '/');
@ -2391,6 +2439,7 @@ main(int argc, char **argv)
usage(); usage();
} }
#ifdef LINUX
if (v6) { if (v6) {
netsize = strchr(argv[1], '/'); netsize = strchr(argv[1], '/');
if (netsize) { if (netsize) {
@ -2418,8 +2467,13 @@ main(int argc, char **argv)
fprintf(stderr, "IPv6 network: "); fprintf(stderr, "IPv6 network: ");
ipv6_print(&my_net6, netmask6); ipv6_print(&my_net6, netmask6);
} }
#endif
#ifdef LINUX
topdomain = strdup(argv[1 + v6]); topdomain = strdup(argv[1 + v6]);
#elif
topdomain = strdup(argv[1]);
#endif
if (strlen(topdomain) <= 128) { if (strlen(topdomain) <= 128) {
if(check_topdomain(topdomain)) { if(check_topdomain(topdomain)) {
warnx("Topdomain contains invalid characters."); warnx("Topdomain contains invalid characters.");
@ -2511,6 +2565,7 @@ main(int argc, char **argv)
free((void*) other_ip); free((void*) other_ip);
goto cleanup1; goto cleanup1;
} }
#ifdef LINUX
if (v6) { if (v6) {
struct in6_addr my_ip6; struct in6_addr my_ip6;
memcpy(&my_ip6, &my_net6, sizeof(my_net6)); memcpy(&my_ip6, &my_net6, sizeof(my_net6));
@ -2525,6 +2580,7 @@ main(int argc, char **argv)
goto cleanup1; goto cleanup1;
} }
} }
#endif
free((void*) other_ip); free((void*) other_ip);
} }
if ((dnsd_fd = open_dns(port, listen_ip)) == -1) { if ((dnsd_fd = open_dns(port, listen_ip)) == -1) {

View file

@ -1,5 +1,6 @@
/* /*
* Copyright (c) 2006-2009 Bjorn Andersson <flex@kryo.se>, Erik Ekman <yarrick@kryo.se> * Copyright (c) 2006-2009 Bjorn Andersson <flex@kryo.se>, Erik Ekman <yarrick@kryo.se>
* Copyright (c) 2011-2012 Julian Kranz <julian@juliankranz.de>
* *
* Permission to use, copy, modify, and distribute this software for any * Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -441,6 +442,7 @@ read_tun(int tun_fd, char *buf, size_t len)
#endif /* !FREEBSD */ #endif /* !FREEBSD */
} }
#ifdef LINUX
int tun_setip6(char const *ip6, char netmask6) { int tun_setip6(char const *ip6, char netmask6) {
char cmdline[512]; char cmdline[512];
@ -454,6 +456,7 @@ int tun_setip6(char const *ip6, char netmask6) {
return system(cmdline); return system(cmdline);
} }
#endif
int int
tun_setip(const char *ip, const char *other_ip, int netbits) tun_setip(const char *ip, const char *other_ip, int netbits)

View file

@ -1,5 +1,6 @@
/* /*
* Copyright (c) 2006-2009 Bjorn Andersson <flex@kryo.se>, Erik Ekman <yarrick@kryo.se> * Copyright (c) 2006-2009 Bjorn Andersson <flex@kryo.se>, Erik Ekman <yarrick@kryo.se>
* Copyright (c) 2011-2012 Julian Kranz <julian@juliankranz.de>
* *
* Permission to use, copy, modify, and distribute this software for any * Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -22,7 +23,9 @@ void close_tun(int);
int write_tun(int, unsigned char *, size_t, char version); int write_tun(int, unsigned char *, size_t, char version);
ssize_t read_tun(int, char *, size_t); ssize_t read_tun(int, char *, size_t);
int tun_setip(const char *, const char *, int); int tun_setip(const char *, const char *, int);
#ifdef LINUX
int tun_setip6(char const *ip6, char netmask6); int tun_setip6(char const *ip6, char netmask6);
#endif
int tun_setmtu(unsigned); int tun_setmtu(unsigned);
#endif /* _TUN_H_ */ #endif /* _TUN_H_ */

View file

@ -1,5 +1,6 @@
/* /*
* Copyright (c) 2006-2009 Bjorn Andersson <flex@kryo.se>, Erik Ekman <yarrick@kryo.se> * Copyright (c) 2006-2009 Bjorn Andersson <flex@kryo.se>, Erik Ekman <yarrick@kryo.se>
* Copyright (c) 2011-2012 Julian Kranz <julian@juliankranz.de>
* *
* Permission to use, copy, modify, and distribute this software for any * Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -133,6 +134,7 @@ find_user_by_ip(uint32_t ip)
return ret; return ret;
} }
#ifdef LINUX
int int
find_user_by_ip6(struct in6_addr ip) find_user_by_ip6(struct in6_addr ip)
{ {
@ -150,6 +152,7 @@ find_user_by_ip6(struct in6_addr ip)
} }
return ret; return ret;
} }
#endif
int int
all_users_waiting_to_send() all_users_waiting_to_send()

View file

@ -1,5 +1,6 @@
/* /*
* Copyright (c) 2006-2009 Bjorn Andersson <flex@kryo.se>, Erik Ekman <yarrick@kryo.se> * Copyright (c) 2006-2009 Bjorn Andersson <flex@kryo.se>, Erik Ekman <yarrick@kryo.se>
* Copyright (c) 2011-2012 Julian Kranz <julian@juliankranz.de>
* *
* Permission to use, copy, modify, and distribute this software for any * Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -80,7 +81,9 @@ int init_users(in_addr_t my_ip, int netbits, struct in6_addr my_net6);
const char* users_get_first_ip(); const char* users_get_first_ip();
int users_waiting_on_reply(); int users_waiting_on_reply();
int find_user_by_ip(uint32_t); int find_user_by_ip(uint32_t);
#ifdef LINUX
int find_user_by_ip6(struct in6_addr ip); int find_user_by_ip6(struct in6_addr ip);
#endif
int all_users_waiting_to_send(); int all_users_waiting_to_send();
int find_available_user(); int find_available_user();
void user_switch_codec(int userid, struct encoder *enc); void user_switch_codec(int userid, struct encoder *enc);