Changeset 3310

Show
Ignore:
Timestamp:
11/20/05 13:55:21 (3 years ago)
Author:
morris
Message:

Sync with libwired

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trackerd/trunk/Makefile.in

    r3256 r3310  
    1111WT_GROUP        = @WT_GROUP@ 
    1212 
    13 SUBDIRS         = libzanka trackerd 
     13SUBDIRS         = libwired trackerd 
    1414DISTFILES       = INSTALL LICENSE NEWS README Makefile Makefile.in config.guess \ 
    1515                          config.h.in config.sub configure configure.in install-sh \ 
    16                           libzanka man run trackerd 
     16                          libwired man run trackerd 
    1717 
    1818INSTALL         = @INSTALL@ 
  • trackerd/trunk/configure

    r3239 r3310  
    312312#endif" 
    313313 
    314 ac_subdirs_all="$ac_subdirs_all libzanka
     314ac_subdirs_all="$ac_subdirs_all libwired
    315315ac_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' 
    316316ac_subst_files='' 
     
    31953195# Checks for libraries 
    31963196 
    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 
     3198if ! test -f libwired/configure; then 
     3199        WT_MSG_LIBWIRED_ERROR 
    32083200fi 
    32093201 
     
    68046796 
    68056797 
    6806 # Configure libzanka 
     6798# Configure libwired 
    68076799ac_configure_args="$ac_configure_args --enable-ssl --enable-pthreads" 
    68086800 
    68096801 
    6810 subdirs="$subdirs libzanka
     6802subdirs="$subdirs libwired
    68116803 
    68126804 
  • trackerd/trunk/configure.in

    r3239 r3310  
    2626]) 
    2727 
    28 AC_DEFUN([WT_MSG_LIBZANKA_ERROR], [ 
    29     AC_MSG_ERROR([could not locate libzanka 
    30  
    31 You need to download a version of libzanka and place it in the same directory as this configure script]) 
     28AC_DEFUN([WT_MSG_LIBWIRED], [ 
     29    AC_MSG_ERROR([could not locate libwired 
     30 
     31You need to download a version of libwired and place it in the same directory as this configure script]) 
    3232]) 
    3333 
     
    205205# Checks for libraries 
    206206 
    207 # Check that we have a libzanka in this directory 
    208 if ! test -f libzanka/configure; then 
    209         WT_MSG_LIBZANKA_ERROR 
     207# Check that we have a libwired in this directory 
     208if ! test -f libwired/configure; then 
     209        WT_MSG_LIBWIRED_ERROR 
    210210fi 
    211211 
     
    428428AC_CONFIG_FILES([trackerd/Makefile]) 
    429429 
    430 # Configure libzanka 
     430# Configure libwired 
    431431ac_configure_args="$ac_configure_args --enable-ssl --enable-pthreads" 
    432 AC_CONFIG_SUBDIRS([libzanka]) 
     432AC_CONFIG_SUBDIRS([libwired]) 
    433433 
    434434AC_OUTPUT 
  • trackerd/trunk/trackerd/Makefile.in

    r3147 r3310  
    2020CFLAGS          = @CFLAGS@ 
    2121CPPFLAGS        = @CPPFLAGS@ 
    22 LDFLAGS         = -L$(top_srcdir)/libzanka/lib @LDFLAGS@ 
    23 LIBS            = -lzanka @LIBS@ 
    24 INCLUDES        = -I$(top_srcdir)/libzanka/include -I$(top_srcdir) -I$(srcdir) 
     22LDFLAGS         = -L$(top_srcdir)/libwired/lib @LDFLAGS@ 
     23LIBS            = -lwired @LIBS@ 
     24INCLUDES        = -I$(top_srcdir)/libwired/include -I$(top_srcdir) -I$(srcdir) 
    2525 
    2626COMPILE         = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) 
     
    3232all: trackerd trackerdctl trackerd.conf 
    3333 
    34 trackerd: $(OBJECTS) $(top_srcdir)/libzanka/lib/libzanka.a 
     34trackerd: $(OBJECTS) $(top_srcdir)/libwired/lib/libwired.a 
    3535        $(LINK) $(OBJECTS) $(LIBS) 
    3636        mkdir -p $(top_srcdir)/run/ 
  • trackerd/trunk/trackerd/banlist.c

    r3276 r3310  
    2929#include "config.h" 
    3030 
    31 #include <zanka/zanka.h> 
     31#include <wired/wired.h> 
    3232 
    3333#include "banlist.h" 
    3434#include "settings.h" 
    3535 
    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; 
     36wi_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; 
    4040 
    4141        if(wt_settings.banlist) { 
    42                 file = ZA_FILE_FOR_READING(wt_settings.banlist); 
     42                file = WI_FILE_FOR_READING(wt_settings.banlist); 
    4343                 
    4444                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)) 
    4747                                        banned = true; 
    4848                                 
    49                                 za_release(string); 
     49                                wi_release(string); 
    5050                                 
    5151                                if(banned) 
     
    5353                        } 
    5454                         
    55                         za_release(file); 
     55                        wi_release(file); 
    5656                } 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); 
    5858                } 
    5959        } 
  • trackerd/trunk/trackerd/banlist.h

    r3276 r3310  
    3030#define WT_BANLIST_H 1 
    3131 
    32 #include <zanka/zanka.h> 
     32#include <wired/wired.h> 
    3333 
    34 za_boolean_t                           wt_ip_is_banned(za_string_t *); 
     34wi_boolean_t                           wt_ip_is_banned(wi_string_t *); 
    3535 
    3636#endif /* WT_BANLIST_H */ 
  • trackerd/trunk/trackerd/clients.c

    r3266 r3310  
    2929#include "config.h" 
    3030 
    31 #include <zanka/zanka.h> 
     31#include <wired/wired.h> 
    3232 
    3333#include "clients.h" 
     
    3636 
    3737 
    38 static void                                                             wt_client_dealloc(za_runtime_instance_t *); 
     38static void                                                             wt_client_dealloc(wi_runtime_instance_t *); 
    3939 
    4040 
    41 static za_runtime_id_t                                 wt_client_runtime_id = ZA_RUNTIME_ID_NULL; 
    42 static za_runtime_class_t                             wt_client_runtime_class = { 
     41static wi_runtime_id_t                                 wt_client_runtime_id = WI_RUNTIME_ID_NULL; 
     42static wi_runtime_class_t                             wt_client_runtime_class = { 
    4343        "wt_client_t", 
    4444        wt_client_dealloc, 
     
    5151 
    5252void 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); 
    5454} 
    5555 
     
    6161        wt_client_t             *client; 
    6262 
    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)); 
    6464 
    6565        client->buffer_size = WT_CLIENT_BUFFER_INITIAL_SIZE; 
    66         client->buffer = za_malloc(client->buffer_size); 
     66        client->buffer = wi_malloc(client->buffer_size); 
    6767         
    6868        return client; 
     
    7171 
    7272 
    73 wt_client_t * wt_client_init_with_socket(wt_client_t *client, za_socket_t *socket) { 
    74         client->socket                  = za_retain(socket); 
     73wt_client_t * wt_client_init_with_socket(wt_client_t *client, wi_socket_t *socket) { 
     74        client->socket                  = wi_retain(socket); 
    7575        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(); 
    7878         
    7979        return client; 
     
    8282 
    8383 
    84 static void wt_client_dealloc(za_runtime_instance_t *instance) { 
     84static void wt_client_dealloc(wi_runtime_instance_t *instance) { 
    8585        wt_client_t             *client = (wt_client_t *) instance; 
    8686         
    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); 
    9090         
    91         za_free(client->buffer); 
     91        wi_free(client->buffer); 
    9292} 
    9393 
     
    9797 
    9898void 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)); 
    100100} 
    101101 
     
    103103 
    104104wt_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)); 
    106106} 
  • trackerd/trunk/trackerd/clients.h

    r3266 r3310  
    3030#define WT_CLIENTS 1 
    3131 
    32 #include <zanka/zanka.h> 
     32#include <wired/wired.h> 
    3333 
    3434#define WT_CLIENT_BUFFER_INITIAL_SIZE   BUFSIZ 
     
    4545 
    4646struct _wt_client { 
    47         za_runtime_base_t                                     base; 
     47        wi_runtime_base_t                                     base; 
    4848         
    49         za_thread_t                                                   *thread; 
     49        wi_thread_t                                                   *thread; 
    5050         
    51         za_socket_t                                                   *socket; 
     51        wi_socket_t                                                   *socket; 
    5252 
    5353        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; 
    5656 
    5757        char                                                            *buffer; 
     
    6767 
    6868wt_client_t *                                                   wt_client_alloc(void); 
    69 wt_client_t *                                                   wt_client_init_with_socket(wt_client_t *, za_socket_t *); 
     69wt_client_t *                                                   wt_client_init_with_socket(wt_client_t *, wi_socket_t *); 
    7070 
    7171void                                                                    wt_client_set(wt_client_t *); 
  • trackerd/trunk/trackerd/commands.c

    r3292 r3310  
    3030 
    3131#include <string.h> 
    32 #include <zanka/zanka.h> 
     32#include <wired/wired.h> 
    3333 
    3434#include "banlist.h" 
     
    5050        unsigned int                            args; 
    5151 
    52         void                                            (*action)(za_array_t *); 
     52        void                                            (*action)(wi_array_t *); 
    5353}; 
    5454typedef struct _wt_commands             wt_commands_t; 
    5555 
    5656 
    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 *); 
     57static void                                             wt_parse_command(wi_string_t *); 
     58static unsigned int                             wt_command_index(wi_string_t *); 
     59 
     60static void                                             wt_cmd_categories(wi_array_t *); 
     61static void                                             wt_cmd_client(wi_array_t *); 
     62static void                                             wt_cmd_hello(wi_array_t *); 
     63static void                                             wt_cmd_register(wi_array_t *); 
     64static void                                             wt_cmd_servers(wi_array_t *); 
    6565 
    6666 
     
    7979 
    8080 
    81 void wt_ctl_thread(za_runtime_instance_t *argument) { 
     81void wt_ctl_thread(wi_runtime_instance_t *argument) { 
    8282        wt_client_t             *client = (wt_client_t *) argument; 
    83         za_string_t           *string; 
     83        wi_string_t           *string; 
    8484        int                             state; 
    8585 
     
    8989                if(client->buffer_offset == 0) { 
    9090                        do { 
    91                                 state = za_socket_wait(client->socket, 0.1); 
     91                                state = wi_socket_wait(client->socket, 0.1); 
    9292                        } while(state == 0 && client->state <= WT_CLIENT_STATE_SAID_HELLO); 
    9393 
     
    9898 
    9999                        if(state < 0) { 
    100                                 if(za_error_code() == EINTR) { 
     100                                if(wi_error_code() == EINTR) { 
    101101                                        /* got a signal */ 
    102102                                        continue; 
    103103                                } else { 
    104104                                        /* 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); 
    106106 
    107107                                        break; 
     
    110110                } 
    111111 
    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) { 
    115115                        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); 
    119119                         
    120120                        break; 
     
    123123                wt_parse_command(string); 
    124124                         
    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"), 
    129129                client->ip, 
    130                 za_time_interval() - client->connect_time); 
     130                wi_time_interval() - client->connect_time); 
    131131} 
    132132 
     
    135135#pragma mark - 
    136136 
    137 static void wt_parse_command(za_string_t *buffer) { 
     137static void wt_parse_command(wi_string_t *buffer) { 
    138138        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; 
    141141        unsigned int    index; 
    142142         
    143         za_parse_wired_command(buffer, &command, &arguments); 
     143        wi_parse_wired_command(buffer, &command, &arguments); 
    144144         
    145145        index = wt_command_index(command); 
    146146 
    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")); 
    149149 
    150150                goto end; 
     
    154154                goto end; 
    155155         
    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")); 
    158158 
    159159                goto end; 
     
    163163 
    164164end: 
    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 
     171static unsigned int wt_command_index(wi_string_t *command) { 
    172172        const char              *cstring; 
    173173        unsigned int    i, min, max; 
    174174        int                             cmp; 
    175175 
    176         cstring = za_string_cstring(command); 
     176        cstring = wi_string_cstring(command); 
    177177        min = 0; 
    178         max = ZA_ARRAY_SIZE(wt_commands) - 1; 
     178        max = WI_ARRAY_SIZE(wt_commands) - 1; 
    179179 
    180180        do { 
     
    190190        } while(min <= max); 
    191191 
    192         return ZA_NOT_FOUND; 
     192        return WI_NOT_FOUND; 
    193193} 
    194194 
     
    201201*/ 
    202202 
    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); 
     203static 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); 
    208208         
    209209        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); 
    212212 
    213213                return; 
    214214        } 
    215215 
    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); 
    218218                 
    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); 
    225225} 
    226226 
     
    231231*/ 
    232232 
    233 static void wt_cmd_client(za_array_t *arguments) { 
     233static void wt_cmd_client(wi_array_t *arguments) { 
    234234        wt_client_t             *client = wt_client(); 
    235235 
    236         client->version = za_retain(ZA_ARRAY(arguments, 0)); 
     236        client->version = wi_retain(WI_ARRAY(arguments, 0)); 
    237237} 
    238238 
     
    243243*/ 
    244244 
    245 void wt_cmd_hello(za_array_t *arguments) { 
     245void wt_cmd_hello(wi_array_t *arguments) { 
    246246        wt_client_t             *client = wt_client(); 
    247         za_string_t           *string; 
     247        wi_string_t           *string; 
    248248 
    249249        if(client->state != WT_CLIENT_STATE_CONNECTED) 
     
    251251 
    252252        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"), 
    255255                        client->ip); 
    256256 
     
    260260        } 
    261261 
    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%#@"), 
    265265                         wt_server_version_string,              WT_FIELD_SEPARATOR, 
    266266                         wt_protocol_version_string,    WT_FIELD_SEPARATOR, 
     
    269269                         string); 
    270270         
    271         za_release(string); 
     271        wi_release(string); 
    272272 
    273273        client->state = WT_CLIENT_STATE_SAID_HELLO; 
     
    280280*/ 
    281281 
    282 static void wt_cmd_register(za_array_t *arguments) { 
     282static void wt_cmd_register(wi_array_t *arguments) { 
    283283        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; 
    289289        wt_server_t                                     *server; 
    290290        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)) { 
    298298                /* invalid URL */ 
    299299                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), 
    303303                                "Invalid URL"); 
    304304                         
     
    310310        } 
    311311 
    312         if(za_ip_version(host) > 0) { 
     312        if(wi_ip_version(host) > 0) { 
    313313                /* host is numeric, compare with source address */ 
    314                 if(!za_is_equal(host, client->ip)) { 
     314                if(!wi_is_equal(host, client->ip)) { 
    315315                        /* IP mismatch */ 
    316316                        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), 
    320320                                        "IP mismatch"); 
    321321 
     
    331331                        /* look up and compare with source address */ 
    332332                        passed = false; 
    333                         list = za_address_all_addresses_for_hostname(host); 
     333                        list = wi_address_all_addresses_for_hostname(host); 
    334334                         
    335335                        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)) { 
    338338                                                passed = true; 
    339339                                                 
     
    342342                                } 
    343343                                 
    344                                 za_release(list); 
     344                                wi_release(list); 
    345345                        } 
    346346                         
     
    348348                                /* lookup failed */ 
    349349                                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), 
    353353                                                "Lookup failed"); 
    354354                                         
     
    363363                if(wt_settings.reverselookup) { 
    364364                        /* 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); 
    368368                         
    369369                        if(!passed) { 
    370370                                /* reverse lookup failed */ 
    371371                                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), 
    375375                                                "Reverse lookup failed"); 
    376376 
     
    386386failed: 
    387387        /* get bandwidth */ 
    388         bandwidth = za_string_unsigned_int_value(ZA_ARRAY(arguments, 3)); 
     388        bandwidth = wi_string_unsigned_int_value(WI_ARRAY(arguments, 3)); 
    389389 
    390390        /* bandwidth too low? */ 
    391391        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); 
    395395 
    396396                goto end; 
     
    399399        /* bandwidth too high? */ 
    400400        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); 
    404404 
    405405                goto end; 
     
    410410 
    411411        if(server) { 
    412                 if(server->port == za_url_port(url)) { 
     412                if(server->port == wi_url_port(url)) { 
    413413                        /* re-register existing server with same port */ 
    414414                        wt_server_clear(server); 
    415                         za_retain(server); 
     415                        wi_retain(server); 
    416416                } else { 
    417417                        /* multiple servers from the same IP allowed? */ 
     
    419419                                server = NULL; 
    420420                        } 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), 
    424424                                        "A server from the same address is already registered"); 
    425425                                 
     
    435435        /* rewrite URL if host verification failed */ 
    436436        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)); 
    442442                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)); 
    444444        } 
    445445 
    446446        /* 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); 
    452452        server->bandwidth               = bandwidth; 
    453         server->register_time   = za_time_interval(); 
     453        server->register_time   = wi_time_interval(); 
    454454        server->update_time             = 0.0; 
    455         server->ip                              = za_retain(client->ip); 
    456         server->category                = wt_category_is_valid