Changeset 3310
- Timestamp:
- 11/20/05 13:55:21 (3 years ago)
- Files:
-
- trackerd/trunk/Makefile.in (modified) (1 diff)
- trackerd/trunk/configure (modified) (3 diffs)
- trackerd/trunk/configure.in (modified) (3 diffs)
- trackerd/trunk/trackerd/Makefile.in (modified) (2 diffs)
- trackerd/trunk/trackerd/banlist.c (modified) (2 diffs)
- trackerd/trunk/trackerd/banlist.h (modified) (1 diff)
- trackerd/trunk/trackerd/clients.c (modified) (8 diffs)
- trackerd/trunk/trackerd/clients.h (modified) (3 diffs)
- trackerd/trunk/trackerd/commands.c (modified) (30 diffs)
- trackerd/trunk/trackerd/commands.h (modified) (1 diff)
- trackerd/trunk/trackerd/main.c (modified) (18 diffs)
- trackerd/trunk/trackerd/main.h (modified) (1 diff)
- trackerd/trunk/trackerd/servers.c (modified) (28 diffs)
- trackerd/trunk/trackerd/servers.h (modified) (2 diffs)
- trackerd/trunk/trackerd/settings.c (modified) (2 diffs)
- trackerd/trunk/trackerd/settings.h (modified) (4 diffs)
- trackerd/trunk/trackerd/tracker.c (modified) (16 diffs)
- trackerd/trunk/trackerd/tracker.h (modified) (1 diff)
- trackerd/trunk/trackerd/version.c (modified) (2 diffs)
- trackerd/trunk/trackerd/version.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trackerd/trunk/Makefile.in
r3256 r3310 11 11 WT_GROUP = @WT_GROUP@ 12 12 13 SUBDIRS = lib zankatrackerd13 SUBDIRS = libwired trackerd 14 14 DISTFILES = INSTALL LICENSE NEWS README Makefile Makefile.in config.guess \ 15 15 config.h.in config.sub configure configure.in install-sh \ 16 lib zankaman run trackerd16 libwired man run trackerd 17 17 18 18 INSTALL = @INSTALL@ trackerd/trunk/configure
r3239 r3310 312 312 #endif" 313 313 314 ac_subdirs_all="$ac_subdirs_all lib zanka"314 ac_subdirs_all="$ac_subdirs_all libwired" 315 315 ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os WT_VERSION CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA SET_MAKE WT_USER WT_GROUP fake_prefix trackerddir CPP EGREP subdirs LIBOBJS LTLIBOBJS' 316 316 ac_subst_files='' … … 3195 3195 # Checks for libraries 3196 3196 3197 # Check that we have a libzanka in this directory 3198 if ! test -f libzanka/configure; then 3199 3200 { { echo "$as_me:$LINENO: error: could not locate libzanka 3201 3202 You need to download a version of libzanka and place it in the same directory as this configure script" >&5 3203 echo "$as_me: error: could not locate libzanka 3204 3205 You need to download a version of libzanka and place it in the same directory as this configure script" >&2;} 3206 { (exit 1); exit 1; }; } 3207 3197 # Check that we have a libwired in this directory 3198 if ! test -f libwired/configure; then 3199 WT_MSG_LIBWIRED_ERROR 3208 3200 fi 3209 3201 … … 6804 6796 6805 6797 6806 # Configure lib zanka6798 # Configure libwired 6807 6799 ac_configure_args="$ac_configure_args --enable-ssl --enable-pthreads" 6808 6800 6809 6801 6810 subdirs="$subdirs lib zanka"6802 subdirs="$subdirs libwired" 6811 6803 6812 6804 trackerd/trunk/configure.in
r3239 r3310 26 26 ]) 27 27 28 AC_DEFUN([WT_MSG_LIB ZANKA_ERROR], [29 AC_MSG_ERROR([could not locate lib zanka30 31 You need to download a version of lib zankaand place it in the same directory as this configure script])28 AC_DEFUN([WT_MSG_LIBWIRED], [ 29 AC_MSG_ERROR([could not locate libwired 30 31 You need to download a version of libwired and place it in the same directory as this configure script]) 32 32 ]) 33 33 … … 205 205 # Checks for libraries 206 206 207 # Check that we have a lib zankain this directory208 if ! test -f lib zanka/configure; then209 WT_MSG_LIB ZANKA_ERROR207 # Check that we have a libwired in this directory 208 if ! test -f libwired/configure; then 209 WT_MSG_LIBWIRED_ERROR 210 210 fi 211 211 … … 428 428 AC_CONFIG_FILES([trackerd/Makefile]) 429 429 430 # Configure lib zanka430 # Configure libwired 431 431 ac_configure_args="$ac_configure_args --enable-ssl --enable-pthreads" 432 AC_CONFIG_SUBDIRS([lib zanka])432 AC_CONFIG_SUBDIRS([libwired]) 433 433 434 434 AC_OUTPUT trackerd/trunk/trackerd/Makefile.in
r3147 r3310 20 20 CFLAGS = @CFLAGS@ 21 21 CPPFLAGS = @CPPFLAGS@ 22 LDFLAGS = -L$(top_srcdir)/lib zanka/lib @LDFLAGS@23 LIBS = -l zanka@LIBS@24 INCLUDES = -I$(top_srcdir)/lib zanka/include -I$(top_srcdir) -I$(srcdir)22 LDFLAGS = -L$(top_srcdir)/libwired/lib @LDFLAGS@ 23 LIBS = -lwired @LIBS@ 24 INCLUDES = -I$(top_srcdir)/libwired/include -I$(top_srcdir) -I$(srcdir) 25 25 26 26 COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) … … 32 32 all: trackerd trackerdctl trackerd.conf 33 33 34 trackerd: $(OBJECTS) $(top_srcdir)/lib zanka/lib/libzanka.a34 trackerd: $(OBJECTS) $(top_srcdir)/libwired/lib/libwired.a 35 35 $(LINK) $(OBJECTS) $(LIBS) 36 36 mkdir -p $(top_srcdir)/run/ trackerd/trunk/trackerd/banlist.c
r3276 r3310 29 29 #include "config.h" 30 30 31 #include < zanka/zanka.h>31 #include <wired/wired.h> 32 32 33 33 #include "banlist.h" 34 34 #include "settings.h" 35 35 36 za_boolean_t wt_ip_is_banned(za_string_t *ip) {37 za_file_t *file;38 za_string_t *string;39 za_boolean_t banned = false;36 wi_boolean_t wt_ip_is_banned(wi_string_t *ip) { 37 wi_file_t *file; 38 wi_string_t *string; 39 wi_boolean_t banned = false; 40 40 41 41 if(wt_settings.banlist) { 42 file = ZA_FILE_FOR_READING(wt_settings.banlist);42 file = WI_FILE_FOR_READING(wt_settings.banlist); 43 43 44 44 if(file) { 45 while((string = za_file_read_config_line(file))) {46 if( za_ip_match(ip, string))45 while((string = wi_file_read_config_line(file))) { 46 if(wi_ip_match(ip, string)) 47 47 banned = true; 48 48 49 za_release(string);49 wi_release(string); 50 50 51 51 if(banned) … … 53 53 } 54 54 55 za_release(file);55 wi_release(file); 56 56 } else { 57 za_log_err(ZA_STR("Could not open %@: %m"), wt_settings.banlist);57 wi_log_err(WI_STR("Could not open %@: %m"), wt_settings.banlist); 58 58 } 59 59 } trackerd/trunk/trackerd/banlist.h
r3276 r3310 30 30 #define WT_BANLIST_H 1 31 31 32 #include < zanka/zanka.h>32 #include <wired/wired.h> 33 33 34 za_boolean_t wt_ip_is_banned(za_string_t *);34 wi_boolean_t wt_ip_is_banned(wi_string_t *); 35 35 36 36 #endif /* WT_BANLIST_H */ trackerd/trunk/trackerd/clients.c
r3266 r3310 29 29 #include "config.h" 30 30 31 #include < zanka/zanka.h>31 #include <wired/wired.h> 32 32 33 33 #include "clients.h" … … 36 36 37 37 38 static void wt_client_dealloc( za_runtime_instance_t *);38 static void wt_client_dealloc(wi_runtime_instance_t *); 39 39 40 40 41 static za_runtime_id_t wt_client_runtime_id = ZA_RUNTIME_ID_NULL;42 static za_runtime_class_t wt_client_runtime_class = {41 static wi_runtime_id_t wt_client_runtime_id = WI_RUNTIME_ID_NULL; 42 static wi_runtime_class_t wt_client_runtime_class = { 43 43 "wt_client_t", 44 44 wt_client_dealloc, … … 51 51 52 52 void wt_init_clients(void) { 53 wt_client_runtime_id = za_runtime_register_class(&wt_client_runtime_class);53 wt_client_runtime_id = wi_runtime_register_class(&wt_client_runtime_class); 54 54 } 55 55 … … 61 61 wt_client_t *client; 62 62 63 client = za_runtime_create_instance(wt_client_runtime_id, sizeof(wt_client_t));63 client = wi_runtime_create_instance(wt_client_runtime_id, sizeof(wt_client_t)); 64 64 65 65 client->buffer_size = WT_CLIENT_BUFFER_INITIAL_SIZE; 66 client->buffer = za_malloc(client->buffer_size);66 client->buffer = wi_malloc(client->buffer_size); 67 67 68 68 return client; … … 71 71 72 72 73 wt_client_t * wt_client_init_with_socket(wt_client_t *client, za_socket_t *socket) {74 client->socket = za_retain(socket);73 wt_client_t * wt_client_init_with_socket(wt_client_t *client, wi_socket_t *socket) { 74 client->socket = wi_retain(socket); 75 75 client->state = WT_CLIENT_STATE_CONNECTED; 76 client->ip = za_address_string(za_socket_address(socket));77 client->connect_time = za_time_interval();76 client->ip = wi_address_string(wi_socket_address(socket)); 77 client->connect_time = wi_time_interval(); 78 78 79 79 return client; … … 82 82 83 83 84 static void wt_client_dealloc( za_runtime_instance_t *instance) {84 static void wt_client_dealloc(wi_runtime_instance_t *instance) { 85 85 wt_client_t *client = (wt_client_t *) instance; 86 86 87 za_release(client->socket);88 za_release(client->ip);89 za_release(client->version);87 wi_release(client->socket); 88 wi_release(client->ip); 89 wi_release(client->version); 90 90 91 za_free(client->buffer);91 wi_free(client->buffer); 92 92 } 93 93 … … 97 97 98 98 void wt_client_set(wt_client_t *client) { 99 za_hash_set_data_for_key(za_thread_hash(), client, ZA_STR(WT_CLIENTS_THREAD_KEY));99 wi_hash_set_data_for_key(wi_thread_hash(), client, WI_STR(WT_CLIENTS_THREAD_KEY)); 100 100 } 101 101 … … 103 103 104 104 wt_client_t * wt_client(void) { 105 return za_hash_data_for_key(za_thread_hash(), ZA_STR(WT_CLIENTS_THREAD_KEY));105 return wi_hash_data_for_key(wi_thread_hash(), WI_STR(WT_CLIENTS_THREAD_KEY)); 106 106 } trackerd/trunk/trackerd/clients.h
r3266 r3310 30 30 #define WT_CLIENTS 1 31 31 32 #include < zanka/zanka.h>32 #include <wired/wired.h> 33 33 34 34 #define WT_CLIENT_BUFFER_INITIAL_SIZE BUFSIZ … … 45 45 46 46 struct _wt_client { 47 za_runtime_base_t base;47 wi_runtime_base_t base; 48 48 49 za_thread_t *thread;49 wi_thread_t *thread; 50 50 51 za_socket_t *socket;51 wi_socket_t *socket; 52 52 53 53 wt_client_state_t state; 54 za_string_t *ip;55 za_string_t *version;54 wi_string_t *ip; 55 wi_string_t *version; 56 56 57 57 char *buffer; … … 67 67 68 68 wt_client_t * wt_client_alloc(void); 69 wt_client_t * wt_client_init_with_socket(wt_client_t *, za_socket_t *);69 wt_client_t * wt_client_init_with_socket(wt_client_t *, wi_socket_t *); 70 70 71 71 void wt_client_set(wt_client_t *); trackerd/trunk/trackerd/commands.c
r3292 r3310 30 30 31 31 #include <string.h> 32 #include < zanka/zanka.h>32 #include <wired/wired.h> 33 33 34 34 #include "banlist.h" … … 50 50 unsigned int args; 51 51 52 void (*action)( za_array_t *);52 void (*action)(wi_array_t *); 53 53 }; 54 54 typedef struct _wt_commands wt_commands_t; 55 55 56 56 57 static void wt_parse_command( za_string_t *);58 static unsigned int wt_command_index( za_string_t *);59 60 static void wt_cmd_categories( za_array_t *);61 static void wt_cmd_client( za_array_t *);62 static void wt_cmd_hello( za_array_t *);63 static void wt_cmd_register( za_array_t *);64 static void wt_cmd_servers( za_array_t *);57 static void wt_parse_command(wi_string_t *); 58 static unsigned int wt_command_index(wi_string_t *); 59 60 static void wt_cmd_categories(wi_array_t *); 61 static void wt_cmd_client(wi_array_t *); 62 static void wt_cmd_hello(wi_array_t *); 63 static void wt_cmd_register(wi_array_t *); 64 static void wt_cmd_servers(wi_array_t *); 65 65 66 66 … … 79 79 80 80 81 void wt_ctl_thread( za_runtime_instance_t *argument) {81 void wt_ctl_thread(wi_runtime_instance_t *argument) { 82 82 wt_client_t *client = (wt_client_t *) argument; 83 za_string_t *string;83 wi_string_t *string; 84 84 int state; 85 85 … … 89 89 if(client->buffer_offset == 0) { 90 90 do { 91 state = za_socket_wait(client->socket, 0.1);91 state = wi_socket_wait(client->socket, 0.1); 92 92 } while(state == 0 && client->state <= WT_CLIENT_STATE_SAID_HELLO); 93 93 … … 98 98 99 99 if(state < 0) { 100 if( za_error_code() == EINTR) {100 if(wi_error_code() == EINTR) { 101 101 /* got a signal */ 102 102 continue; 103 103 } else { 104 104 /* error in TCP communication */ 105 za_log_err(ZA_STR("Could not read from %@: %m"), client->ip);105 wi_log_err(WI_STR("Could not read from %@: %m"), client->ip); 106 106 107 107 break; … … 110 110 } 111 111 112 string = za_socket_read_to_string(client->socket, 0.0, ZA_STR(WT_MESSAGE_SEPARATOR_STR));113 114 if(!string || za_string_length(string) == 0) {112 string = wi_socket_read_to_string(client->socket, 0.0, WI_STR(WT_MESSAGE_SEPARATOR_STR)); 113 114 if(!string || wi_string_length(string) == 0) { 115 115 if(!string) 116 za_log_info(ZA_STR("Could not read from %@: %m"), client->ip);117 118 za_release(string);116 wi_log_info(WI_STR("Could not read from %@: %m"), client->ip); 117 118 wi_release(string); 119 119 120 120 break; … … 123 123 wt_parse_command(string); 124 124 125 za_release(string);126 } 127 128 za_log_info(ZA_STR("Disconnect from %@ after %.2fs"),125 wi_release(string); 126 } 127 128 wi_log_info(WI_STR("Disconnect from %@ after %.2fs"), 129 129 client->ip, 130 za_time_interval() - client->connect_time);130 wi_time_interval() - client->connect_time); 131 131 } 132 132 … … 135 135 #pragma mark - 136 136 137 static void wt_parse_command( za_string_t *buffer) {137 static void wt_parse_command(wi_string_t *buffer) { 138 138 wt_client_t *client = wt_client(); 139 za_string_t *command;140 za_array_t *arguments;139 wi_string_t *command; 140 wi_array_t *arguments; 141 141 unsigned int index; 142 142 143 za_parse_wired_command(buffer, &command, &arguments);143 wi_parse_wired_command(buffer, &command, &arguments); 144 144 145 145 index = wt_command_index(command); 146 146 147 if(index == ZA_NOT_FOUND) {148 wt_reply(501, ZA_STR("Command Not Recognized"));147 if(index == WI_NOT_FOUND) { 148 wt_reply(501, WI_STR("Command Not Recognized")); 149 149 150 150 goto end; … … 154 154 goto end; 155 155 156 if( za_array_count(arguments) < wt_commands[index].args) {157 wt_reply(503, ZA_STR("Syntax Error"));156 if(wi_array_count(arguments) < wt_commands[index].args) { 157 wt_reply(503, WI_STR("Syntax Error")); 158 158 159 159 goto end; … … 163 163 164 164 end: 165 za_release(command);166 za_release(arguments);167 } 168 169 170 171 static unsigned int wt_command_index( za_string_t *command) {165 wi_release(command); 166 wi_release(arguments); 167 } 168 169 170 171 static unsigned int wt_command_index(wi_string_t *command) { 172 172 const char *cstring; 173 173 unsigned int i, min, max; 174 174 int cmp; 175 175 176 cstring = za_string_cstring(command);176 cstring = wi_string_cstring(command); 177 177 min = 0; 178 max = ZA_ARRAY_SIZE(wt_commands) - 1;178 max = WI_ARRAY_SIZE(wt_commands) - 1; 179 179 180 180 do { … … 190 190 } while(min <= max); 191 191 192 return ZA_NOT_FOUND;192 return WI_NOT_FOUND; 193 193 } 194 194 … … 201 201 */ 202 202 203 static void wt_cmd_categories( za_array_t *arguments) {204 za_file_t *file;205 za_string_t *string;206 207 file = ZA_FILE_FOR_READING(wt_settings.categories);203 static void wt_cmd_categories(wi_array_t *arguments) { 204 wi_file_t *file; 205 wi_string_t *string; 206 207 file = WI_FILE_FOR_READING(wt_settings.categories); 208 208 209 209 if(!file) { 210 wt_reply(500, ZA_STR("Command Failed"));211 za_log_err(ZA_STR("Could not open %@: %m"), wt_settings.categories);210 wt_reply(500, WI_STR("Command Failed")); 211 wi_log_err(WI_STR("Could not open %@: %m"), wt_settings.categories); 212 212 213 213 return; 214 214 } 215 215 216 while((string = za_file_read_config_line(file))) {217 wt_reply(710, ZA_STR("%@"), string);216 while((string = wi_file_read_config_line(file))) { 217 wt_reply(710, WI_STR("%@"), string); 218 218 219 za_release(string);220 } 221 222 wt_reply(711, ZA_STR("Done"));223 224 za_release(file);219 wi_release(string); 220 } 221 222 wt_reply(711, WI_STR("Done")); 223 224 wi_release(file); 225 225 } 226 226 … … 231 231 */ 232 232 233 static void wt_cmd_client( za_array_t *arguments) {233 static void wt_cmd_client(wi_array_t *arguments) { 234 234 wt_client_t *client = wt_client(); 235 235 236 client->version = za_retain(ZA_ARRAY(arguments, 0));236 client->version = wi_retain(WI_ARRAY(arguments, 0)); 237 237 } 238 238 … … 243 243 */ 244 244 245 void wt_cmd_hello( za_array_t *arguments) {245 void wt_cmd_hello(wi_array_t *arguments) { 246 246 wt_client_t *client = wt_client(); 247 za_string_t *string;247 wi_string_t *string; 248 248 249 249 if(client->state != WT_CLIENT_STATE_CONNECTED) … … 251 251 252 252 if(wt_ip_is_banned(client->ip)) { 253 wt_reply(511, ZA_STR("Banned"));254 za_log_err(ZA_STR("Connection from %@ denied, host is banned"),253 wt_reply(511, WI_STR("Banned")); 254 wi_log_err(WI_STR("Connection from %@ denied, host is banned"), 255 255 client->ip); 256 256 … … 260 260 } 261 261 262 string = za_date_string_with_iso8601_format(wt_start_date);263 264 wt_reply(200, ZA_STR("%#@%c%#@%c%#@%c%#@%c%#@"),262 string = wi_date_string_with_iso8601_format(wt_start_date); 263 264 wt_reply(200, WI_STR("%#@%c%#@%c%#@%c%#@%c%#@"), 265 265 wt_server_version_string, WT_FIELD_SEPARATOR, 266 266 wt_protocol_version_string, WT_FIELD_SEPARATOR, … … 269 269 string); 270 270 271 za_release(string);271 wi_release(string); 272 272 273 273 client->state = WT_CLIENT_STATE_SAID_HELLO; … … 280 280 */ 281 281 282 static void wt_cmd_register( za_array_t *arguments) {282 static void wt_cmd_register(wi_array_t *arguments) { 283 283 wt_client_t *client = wt_client(); 284 za_list_t *list;285 za_list_node_t *node;286 za_address_t *address, *hostaddress;287 za_url_t *url;288 za_string_t *string, *host;284 wi_list_t *list; 285 wi_list_node_t *node; 286 wi_address_t *address, *hostaddress; 287 wi_url_t *url; 288 wi_string_t *string, *host; 289 289 wt_server_t *server; 290 290 unsigned int bandwidth; 291 za_boolean_t failed = false, passed;292 293 url = za_url_init_with_string(za_url_alloc(), ZA_ARRAY(arguments, 1));294 host = za_url_host(url);295 address = za_socket_address(client->socket);296 297 if(! za_url_is_valid(url)) {291 wi_boolean_t failed = false, passed; 292 293 url = wi_url_init_with_string(wi_url_alloc(), WI_ARRAY(arguments, 1)); 294 host = wi_url_host(url); 295 address = wi_socket_address(client->socket); 296 297 if(!wi_url_is_valid(url)) { 298 298 /* invalid URL */ 299 299 if(wt_settings.strictlookup) { 300 wt_reply(503, ZA_STR("Syntax Error"));301 za_log_warn(ZA_STR("Register from %@ as \"%@\" URL %@ aborted: %s"),302 client->ip, ZA_ARRAY(arguments, 2), ZA_ARRAY(arguments, 1),300 wt_reply(503, WI_STR("Syntax Error")); 301 wi_log_warn(WI_STR("Register from %@ as \"%@\" URL %@ aborted: %s"), 302 client->ip, WI_ARRAY(arguments, 2), WI_ARRAY(arguments, 1), 303 303 "Invalid URL"); 304 304 … … 310 310 } 311 311 312 if( za_ip_version(host) > 0) {312 if(wi_ip_version(host) > 0) { 313 313 /* host is numeric, compare with source address */ 314 if(! za_is_equal(host, client->ip)) {314 if(!wi_is_equal(host, client->ip)) { 315 315 /* IP mismatch */ 316 316 if(wt_settings.strictlookup) { 317 wt_reply(530, ZA_STR("Address Mismatch"));318 za_log_warn(ZA_STR("Register from %@ as \"%@\" URL %@ denied: %s"),319 client->ip, ZA_ARRAY(arguments, 2), ZA_ARRAY(arguments, 1),317 wt_reply(530, WI_STR("Address Mismatch")); 318 wi_log_warn(WI_STR("Register from %@ as \"%@\" URL %@ denied: %s"), 319 client->ip, WI_ARRAY(arguments, 2), WI_ARRAY(arguments, 1), 320 320 "IP mismatch"); 321 321 … … 331 331 /* look up and compare with source address */ 332 332 passed = false; 333 list = za_address_all_addresses_for_hostname(host);333 list = wi_address_all_addresses_for_hostname(host); 334 334 335 335 if(list) { 336 ZA_LIST_FOREACH(list, node, hostaddress) {337 if( za_is_equal(hostaddress, address)) {336 WI_LIST_FOREACH(list, node, hostaddress) { 337 if(wi_is_equal(hostaddress, address)) { 338 338 passed = true; 339 339 … … 342 342 } 343 343 344 za_release(list);344 wi_release(list); 345 345 } 346 346 … … 348 348 /* lookup failed */ 349 349 if(wt_settings.strictlookup) { 350 wt_reply(531, ZA_STR("Address Mismatch"));351 za_log_warn(ZA_STR("Register from %@ as \"%@\" URL %@ denied: %s"),352 client->ip, ZA_ARRAY(arguments, 2), ZA_ARRAY(arguments, 1),350 wt_reply(531, WI_STR("Address Mismatch")); 351 wi_log_warn(WI_STR("Register from %@ as \"%@\" URL %@ denied: %s"), 352 client->ip, WI_ARRAY(arguments, 2), WI_ARRAY(arguments, 1), 353 353 "Lookup failed"); 354 354 … … 363 363 if(wt_settings.reverselookup) { 364 364 /* reverse look up and compare to host name */ 365 string = za_address_hostname(address);366 passed = za_is_equal(string, host);367 za_release(string);365 string = wi_address_hostname(address); 366 passed = wi_is_equal(string, host); 367 wi_release(string); 368 368 369 369 if(!passed) { 370 370 /* reverse lookup failed */ 371 371 if(wt_settings.strictlookup) { 372 wt_reply(531, ZA_STR("Address Mismatch"));373 za_log_warn(ZA_STR("Register from %@ as \"%@\" URL % denied: %@"),374 client->ip, ZA_ARRAY(arguments, 2), ZA_ARRAY(arguments, 1),372 wt_reply(531, WI_STR("Address Mismatch")); 373 wi_log_warn(WI_STR("Register from %@ as \"%@\" URL % denied: %@"), 374 client->ip, WI_ARRAY(arguments, 2), WI_ARRAY(arguments, 1), 375 375 "Reverse lookup failed"); 376 376 … … 386 386 failed: 387 387 /* get bandwidth */ 388 bandwidth = za_string_unsigned_int_value(ZA_ARRAY(arguments, 3));388 bandwidth = wi_string_unsigned_int_value(WI_ARRAY(arguments, 3)); 389 389 390 390 /* bandwidth too low? */ 391 391 if(wt_settings.minbandwidth > 0 && bandwidth < wt_settings.minbandwidth) { 392 wt_reply(516, ZA_STR("Permission Denied"));393 za_log_warn(ZA_STR("Register from %@ as \"%@\" URL %@ denied: Bandwidth %.0f Kbps considered too low"),394 client->ip, ZA_ARRAY(arguments, 2), ZA_ARRAY(arguments, 1), bandwidth / 128.0);392 wt_reply(516, WI_STR("Permission Denied")); 393 wi_log_warn(WI_STR("Register from %@ as \"%@\" URL %@ denied: Bandwidth %.0f Kbps considered too low"), 394 client->ip, WI_ARRAY(arguments, 2), WI_ARRAY(arguments, 1), bandwidth / 128.0); 395 395 396 396 goto end; … … 399 399 /* bandwidth too high? */ 400 400 if(wt_settings.maxbandwidth > 0 && bandwidth > wt_settings.maxbandwidth) { 401 wt_reply(516, ZA_STR("Permission Denied"));402 za_log_warn(ZA_STR("Register from %@ as \"%@\" URL %@ denied: Bandwidth %.0f Kbps considered too high"),403 client->ip, ZA_ARRAY(arguments, 2), ZA_ARRAY(arguments, 1), bandwidth / 128.0);401 wt_reply(516, WI_STR("Permission Denied")); 402 wi_log_warn(WI_STR("Register from %@ as \"%@\" URL %@ denied: Bandwidth %.0f Kbps considered too high"), 403 client->ip, WI_ARRAY(arguments, 2), WI_ARRAY(arguments, 1), bandwidth / 128.0); 404 404 405 405 goto end; … … 410 410 411 411 if(server) { 412 if(server->port == za_url_port(url)) {412 if(server->port == wi_url_port(url)) { 413 413 /* re-register existing server with same port */ 414 414 wt_server_clear(server); 415 za_retain(server);415 wi_retain(server); 416 416 } else { 417 417 /* multiple servers from the same IP allowed? */ … … 419 419 server = NULL; 420 420 } else { 421 wt_reply(530, ZA_STR("Address Registered"));422 za_log_warn(ZA_STR("Register from %@ as \"%@\" URL %@ denied: %s"),423 client->ip, ZA_ARRAY(arguments, 2), ZA_ARRAY(arguments, 1),421 wt_reply(530, WI_STR("Address Registered")); 422 wi_log_warn(WI_STR("Register from %@ as \"%@\" URL %@ denied: %s"), 423 client->ip, WI_ARRAY(arguments, 2), WI_ARRAY(arguments, 1), 424 424 "A server from the same address is already registered"); 425 425 … … 435 435 /* rewrite URL if host verification failed */ 436 436 if(failed) { 437 za_url_set_scheme(url, ZA_STR("wired"));438 za_url_set_host(url, client->ip);439 440 if( za_string_length(ZA_ARRAY(arguments, 1)) == 0)441 za_log_info(ZA_STR("Rewriting URL to %@"), za_url_string(url));437 wi_url_set_scheme(url, WI_STR("wired")); 438 wi_url_set_host(url, client->ip); 439 440 if(wi_string_length(WI_ARRAY(arguments, 1)) == 0) 441 wi_log_info(WI_STR("Rewriting URL to %@"), wi_url_string(url)); 442 442 else 443 za_log_info(ZA_STR("Rewriting URL from %@ to %@"), ZA_ARRAY(arguments, 1), za_url_string(url));443 wi_log_info(WI_STR("Rewriting URL from %@ to %@"), WI_ARRAY(arguments, 1), wi_url_string(url)); 444 444 } 445 445 446 446 /* set values */ 447 string = za_string_init_random_string_with_length(za_string_alloc(), 1024);448 server->key = za_string_sha1(string);449 za_release(string);450 451 server->port = za_url_port(url);447 string = wi_string_init_random_string_with_length(wi_string_alloc(), 1024); 448 server->key = wi_string_sha1(string); 449 wi_release(string); 450 451 server->port = wi_url_port(url); 452 452 server->bandwidth = bandwidth; 453 server->register_time = za_time_interval();453 server->register_time = wi_time_interval(); 454 454 server->update_time = 0.0; 455 server->ip = za_retain(client->ip);456 server->category = wt_category_is_valid
