Changes in / [3e91c3e:8e419cb]


Ignore:
Files:
3 added
1 deleted
39 edited

Legend:

Unmodified
Added
Removed
  • Makefile

    r3e91c3e r8e419cb  
    1010
    1111# Program variables
    12 objects = account.o bitlbee.o commands.o crypting.o help.o ini.o irc.o nick.o query.o set.o url.o user.o storage_text.o storage.o
     12objects = account.o bitlbee.o commands.o crypting.o help.o ini.o irc.o nick.o query.o set.o storage.o storage_text.o url.o user.o util.o
    1313subdirs = protocols
    1414
  • bitlbee.c

    r3e91c3e r8e419cb  
    3737        size_t size = sizeof( struct sockaddr_in );
    3838        struct sockaddr_in conn_info;
    39         int new_socket = accept( global.listen_socket, (struct sockaddr *) &conn_info,
    40                                      &size );
    41        
    42         log_message( LOGLVL_INFO, "Creating new connection with fd %d.", new_socket );
    43         irc_new( new_socket );
    44 
     39        int new_socket = accept( global.listen_socket, (struct sockaddr *) &conn_info, &size );
     40        pid_t client_pid = 0;
     41       
     42        if( global.conf->runmode == RUNMODE_FORKDAEMON )
     43                client_pid = fork();
     44       
     45        if( client_pid == 0 )
     46        {
     47                log_message( LOGLVL_INFO, "Creating new connection with fd %d.", new_socket );
     48                irc_new( new_socket );
     49               
     50                if( global.conf->runmode == RUNMODE_FORKDAEMON )
     51                {
     52                        /* Close the listening socket, we're a client. */
     53                        close( global.listen_socket );
     54                        g_source_remove( global.listen_watch_source_id );
     55                }
     56        }
     57        else
     58        {
     59                /* We don't need this one, only the client does. */
     60                close( new_socket );
     61               
     62                /* Or maybe we didn't even get a child process... */
     63                if( client_pid == -1 )
     64                        log_message( LOGLVL_ERROR, "Failed to fork() subprocess for client: %s", strerror( errno ) );
     65        }
     66       
    4567        return TRUE;
    4668}
     
    5072int bitlbee_daemon_init()
    5173{
     74#ifdef IPV6
     75        struct sockaddr_in6 listen_addr;
     76#else
    5277        struct sockaddr_in listen_addr;
     78#endif
    5379        int i;
    5480        GIOChannel *ch;
    5581       
    56         global.listen_socket = socket( AF_INET, SOCK_STREAM, 0 );
     82        log_link( LOGLVL_ERROR, LOGOUTPUT_SYSLOG );
     83        log_link( LOGLVL_WARNING, LOGOUTPUT_SYSLOG );
     84       
     85        global.listen_socket = socket( AF_INETx, SOCK_STREAM, 0 );
    5786        if( global.listen_socket == -1 )
    5887        {
     
    6089                return( -1 );
    6190        }
    62         listen_addr.sin_family = AF_INET;
     91       
     92#ifdef IPV6
     93        listen_addr.sin6_family = AF_INETx;
     94        listen_addr.sin6_port = htons( global.conf->port );
     95        i = inet_pton( AF_INETx, ipv6_wrap( global.conf->iface ), &listen_addr.sin6_addr );
     96#else
     97        listen_addr.sin_family = AF_INETx;
    6398        listen_addr.sin_port = htons( global.conf->port );
    64         listen_addr.sin_addr.s_addr = inet_addr( global.conf->iface );
    65 
    66         i = bind( global.listen_socket, (struct sockaddr *) &listen_addr, sizeof( struct sockaddr ) );
     99        i = inet_pton( AF_INETx, global.conf->iface, &listen_addr.sin_addr );
     100#endif
     101       
     102        if( i != 1 )
     103        {
     104                log_message( LOGLVL_ERROR, "Couldn't parse address `%s'", global.conf->iface );
     105                return( -1 );
     106        }
     107       
     108        i = bind( global.listen_socket, (struct sockaddr *) &listen_addr, sizeof( listen_addr ) );
    67109        if( i == -1 )
    68110        {
     
    70112                return( -1 );
    71113        }
    72 
     114       
    73115        i = listen( global.listen_socket, 10 );
    74116        if( i == -1 )
     
    77119                return( -1 );
    78120        }
    79 
     121       
    80122        ch = g_io_channel_unix_new( global.listen_socket );
    81         g_io_add_watch( ch, G_IO_IN, bitlbee_io_new_client, NULL );
    82 
     123        global.listen_watch_source_id = g_io_add_watch( ch, G_IO_IN, bitlbee_io_new_client, NULL );
     124       
    83125#ifndef _WIN32
    84126        if( !global.conf->nofork )
     
    175217        int st, size;
    176218        char *temp;
    177 #ifdef FLOOD_SEND
    178         time_t newtime;
    179 #endif
    180 
    181 #ifdef FLOOD_SEND       
    182         newtime = time( NULL );
    183         if( ( newtime - irc->oldtime ) > FLOOD_SEND_INTERVAL )
    184         {
    185                 irc->sentbytes = 0;
    186                 irc->oldtime = newtime;
    187         }
    188 #endif
    189        
     219
    190220        if( irc->sendbuffer == NULL )
    191221                return( FALSE );
    192222       
    193223        size = strlen( irc->sendbuffer );
    194        
    195 #ifdef FLOOD_SEND
    196         if( ( FLOOD_SEND_BYTES - irc->sentbytes ) > size )
    197                 st = write( irc->fd, irc->sendbuffer, size );
    198         else
    199                 st = write( irc->fd, irc->sendbuffer, ( FLOOD_SEND_BYTES - irc->sentbytes ) );
    200 #else
    201224        st = write( irc->fd, irc->sendbuffer, size );
    202 #endif
    203225       
    204226        if( st <= 0 )
     
    214236                }
    215237        }
    216        
    217 #ifdef FLOOD_SEND
    218         irc->sentbytes += st;
    219 #endif         
    220238       
    221239        if( st == size )
     
    246264        g_main_quit( global.loop );
    247265}
    248 
    249 int root_command_string( irc_t *irc, user_t *u, char *command, int flags )
    250 {
    251         char *cmd[IRC_MAX_ARGS];
    252         char *s;
    253         int k;
    254         char q = 0;
    255        
    256         memset( cmd, 0, sizeof( cmd ) );
    257         cmd[0] = command;
    258         k = 1;
    259         for( s = command; *s && k < ( IRC_MAX_ARGS - 1 ); s ++ )
    260                 if( *s == ' ' && !q )
    261                 {
    262                         *s = 0;
    263                         while( *++s == ' ' );
    264                         if( *s == '"' || *s == '\'' )
    265                         {
    266                                 q = *s;
    267                                 s ++;
    268                         }
    269                         if( *s )
    270                         {
    271                                 cmd[k++] = s;
    272                                 s --;
    273                         }
    274                 }
    275                 else if( *s == q )
    276                 {
    277                         q = *s = 0;
    278                 }
    279         cmd[k] = NULL;
    280        
    281         return( root_command( irc, cmd ) );
    282 }
    283 
    284 int root_command( irc_t *irc, char *cmd[] )
    285 {       
    286         int i;
    287        
    288         if( !cmd[0] )
    289                 return( 0 );
    290        
    291         for( i = 0; commands[i].command; i++ )
    292                 if( g_strcasecmp( commands[i].command, cmd[0] ) == 0 )
    293                 {
    294                         if( !cmd[commands[i].required_parameters] )
    295                         {
    296                                 irc_usermsg( irc, "Not enough parameters given (need %d)", commands[i].required_parameters );
    297                                 return( 0 );
    298                         }
    299                         commands[i].execute( irc, cmd );
    300                         return( 1 );
    301                 }
    302        
    303         irc_usermsg( irc, "Unknown command: %s. Please use \x02help commands\x02 to get a list of available commands.", cmd[0] );
    304        
    305         return( 1 );
    306 }
    307 
    308 /* Decode%20a%20file%20name                                             */
    309 void http_decode( char *s )
    310 {
    311         char *t;
    312         int i, j, k;
    313        
    314         t = g_new( char, strlen( s ) + 1 );
    315        
    316         for( i = j = 0; s[i]; i ++, j ++ )
    317         {
    318                 if( s[i] == '%' )
    319                 {
    320                         if( sscanf( s + i + 1, "%2x", &k ) )
    321                         {
    322                                 t[j] = k;
    323                                 i += 2;
    324                         }
    325                         else
    326                         {
    327                                 *t = 0;
    328                                 break;
    329                         }
    330                 }
    331                 else
    332                 {
    333                         t[j] = s[i];
    334                 }
    335         }
    336         t[j] = 0;
    337        
    338         strcpy( s, t );
    339         g_free( t );
    340 }
    341 
    342 /* Warning: This one explodes the string. Worst-cases can make the string 3x its original size! */
    343 /* This fuction is safe, but make sure you call it safely as well! */
    344 void http_encode( char *s )
    345 {
    346         char *t;
    347         int i, j;
    348        
    349         t = g_strdup( s );
    350        
    351         for( i = j = 0; t[i]; i ++, j ++ )
    352         {
    353                 if( t[i] <= ' ' || ((unsigned char *)t)[i] >= 128 || t[i] == '%' )
    354                 {
    355                         sprintf( s + j, "%%%02X", ((unsigned char*)t)[i] );
    356                         j += 2;
    357                 }
    358                 else
    359                 {
    360                         s[j] = t[i];
    361                 }
    362         }
    363         s[j] = 0;
    364        
    365         g_free( t );
    366 }
    367 
    368 /* Strip newlines from a string. Modifies the string passed to it. */
    369 char *strip_newlines( char *source )
    370 {
    371         int i; 
    372 
    373         for( i = 0; source[i] != '\0'; i ++ )
    374                 if( source[i] == '\n' || source[i] == '\r' )
    375                         source[i] = 32;
    376        
    377         return source;
    378 }
  • bitlbee.conf

    r3e91c3e r8e419cb  
    1414##    and other reasons, the use of daemon-mode is *STRONGLY* discouraged,
    1515##    don't even *think* of reporting bugs when you use this.
     16##  ForkDaemon -- Run as a stand-alone daemon, but keep all clients in separate
     17##    child processes. This should be pretty safe and reliable to use instead
     18##    of inetd mode.
    1619##
    1720# RunMode = Inetd
     
    1922## DaemonPort/DaemonInterface:
    2023##
    21 ## For RunMode=Daemon, here you can specify on what interface and port the
    22 ## daemon should be listening for connections.
     24## For daemon mode, you can specify on what interface and port the daemon
     25## should be listening for connections.
    2326##
    2427# DaemonInterface = 0.0.0.0
     
    4245# AuthPassword = ItllBeBitlBee   ## Heh.. Our slogan. ;-)
    4346
     47## OperPassword
     48##
     49## Password that unlocks access to special operator commands.
     50##
     51# OperPassword = ChangeMe!
     52
    4453## HostName
    4554##
    4655## Normally, BitlBee gets a hostname using getsockname(). If you have a nicer
    4756## alias for your BitlBee daemon, you can set it here and BitlBee will identify
    48 ## itself with that name instead. Leave it commented out if you want BitlBee to
    49 ## use getsockname() to get a hostname.
     57## itself with that name instead.
    5058##
    5159# HostName = localhost
  • bitlbee.h

    r3e91c3e r8e419cb  
    111111typedef struct global_t {
    112112        int listen_socket;
     113        gint listen_watch_source_id;
    113114        help_t *help;
    114115        conf_t *conf;
  • commands.c

    r3e91c3e r8e419cb  
    3232#include <string.h>
    3333
    34 command_t commands[] = {
     34const command_t commands[] = {
    3535        { "help",           0, cmd_help },
    3636        { "identify",       1, cmd_identify },
     
    5555};
    5656
     57int root_command_string( irc_t *irc, user_t *u, char *command, int flags )
     58{
     59        char *cmd[IRC_MAX_ARGS];
     60        char *s;
     61        int k;
     62        char q = 0;
     63       
     64        memset( cmd, 0, sizeof( cmd ) );
     65        cmd[0] = command;
     66        k = 1;
     67        for( s = command; *s && k < ( IRC_MAX_ARGS - 1 ); s ++ )
     68                if( *s == ' ' && !q )
     69                {
     70                        *s = 0;
     71                        while( *++s == ' ' );
     72                        if( *s == '"' || *s == '\'' )
     73                        {
     74                                q = *s;
     75                                s ++;
     76                        }
     77                        if( *s )
     78                        {
     79                                cmd[k++] = s;
     80                                s --;
     81                        }
     82                }
     83                else if( *s == q )
     84                {
     85                        q = *s = 0;
     86                }
     87        cmd[k] = NULL;
     88       
     89        return( root_command( irc, cmd ) );
     90}
     91
     92int root_command( irc_t *irc, char *cmd[] )
     93{       
     94        int i;
     95       
     96        if( !cmd[0] )
     97                return( 0 );
     98       
     99        for( i = 0; commands[i].command; i++ )
     100                if( g_strcasecmp( commands[i].command, cmd[0] ) == 0 )
     101                {
     102                        if( !cmd[commands[i].required_parameters] )
     103                        {
     104                                irc_usermsg( irc, "Not enough parameters given (need %d)", commands[i].required_parameters );
     105                                return( 0 );
     106                        }
     107                        commands[i].execute( irc, cmd );
     108                        return( 1 );
     109                }
     110       
     111        irc_usermsg( irc, "Unknown command: %s. Please use \x02help commands\x02 to get a list of available commands.", cmd[0] );
     112       
     113        return( 1 );
     114}
     115
    57116int cmd_help( irc_t *irc, char **cmd )
    58117{
     
    97156        case STORAGE_OK:
    98157                irc_usermsg( irc, "Password accepted" );
     158                irc_umode_set( irc, "+R", 1 );
    99159                break;
    100160        default:
     
    122182                case STORAGE_OK:
    123183                        irc->status = USTATUS_IDENTIFIED;
     184                        irc_umode_set( irc, "+R", 1 );
    124185                        break;
    125186
     
    146207        case STORAGE_OK:
    147208                irc_setpass( irc, NULL );
     209                irc->status = USTATUS_LOGGED_IN;
     210                irc_umode_set( irc, "-R", 1 );
    148211                irc_usermsg( irc, "Account `%s' removed", irc->nick );
    149212                return( 0 );
  • commands.h

    r3e91c3e r8e419cb  
    2929#include "bitlbee.h"
    3030
    31 /* Hmm... Linked list? Plleeeeaaase?? ;-) */
    32 
    3331typedef struct command_t
    3432{
     
    5856int cmd_dump( irc_t *irc, char **cmd );
    5957
    60 
    61 
    62 extern command_t commands[];
     58extern const command_t commands[];
    6359
    6460#endif
  • conf.c

    r3e91c3e r8e419cb  
    4646        conf = g_new0( conf_t, 1 );
    4747       
     48#ifdef IPV6
     49        conf->iface = "::";
     50#else
    4851        conf->iface = "0.0.0.0";
     52#endif
    4953        conf->port = 6667;
    5054        conf->nofork = 0;
     
    5357        conf->runmode = RUNMODE_INETD;
    5458        conf->authmode = AUTHMODE_OPEN;
    55         conf->password = NULL;
     59        conf->auth_pass = NULL;
     60        conf->oper_pass = NULL;
    5661        conf->configdir = g_strdup( CONFIG );
    5762        conf->plugindir = g_strdup( PLUGINDIR );
     
    7176        }
    7277       
    73         while( ( opt = getopt( argc, argv, "i:p:nvIDc:d:h" ) ) >= 0 )
     78        while( ( opt = getopt( argc, argv, "i:p:nvIDFc:d:h" ) ) >= 0 )
    7479        {
    7580                if( opt == 'i' )
     
    9499                else if( opt == 'D' )
    95100                        conf->runmode=RUNMODE_DAEMON;
     101                else if( opt == 'F' )
     102                        conf->runmode=RUNMODE_FORKDAEMON;
    96103                else if( opt == 'c' )
    97104                {
     
    118125                                "  -I  Classic/InetD mode. (Default)\n"
    119126                                "  -D  Daemon mode. (Still EXPERIMENTAL!)\n"
     127                                "  -F  Forking daemon. (one process per client)\n"
    120128                                "  -i  Specify the interface (by IP address) to listen on.\n"
    121129                                "      (Default: 0.0.0.0 (any interface))\n"
     
    157165                                if( g_strcasecmp( ini->value, "daemon" ) == 0 )
    158166                                        conf->runmode = RUNMODE_DAEMON;
     167                                else if( g_strcasecmp( ini->value, "forkdaemon" ) == 0 )
     168                                        conf->runmode = RUNMODE_FORKDAEMON;
    159169                                else
    160170                                        conf->runmode = RUNMODE_INETD;
     
    184194                        else if( g_strcasecmp( ini->key, "authpassword" ) == 0 )
    185195                        {
    186                                 conf->password = g_strdup( ini->value );
     196                                conf->auth_pass = g_strdup( ini->value );
     197                        }
     198                        else if( g_strcasecmp( ini->key, "operpassword" ) == 0 )
     199                        {
     200                                conf->oper_pass = g_strdup( ini->value );
    187201                        }
    188202                        else if( g_strcasecmp( ini->key, "hostname" ) == 0 )
  • conf.h

    r3e91c3e r8e419cb  
    2727#define __CONF_H
    2828
    29 typedef enum runmode { RUNMODE_DAEMON, RUNMODE_INETD } runmode_t;
     29typedef enum runmode { RUNMODE_DAEMON, RUNMODE_FORKDAEMON, RUNMODE_INETD } runmode_t;
    3030typedef enum authmode { AUTHMODE_OPEN, AUTHMODE_CLOSED, AUTHMODE_REGISTERED } authmode_t;
    3131
     
    3838        runmode_t runmode;
    3939        authmode_t authmode;
    40         char *password;
     40        char *auth_pass;
     41        char *oper_pass;
    4142        char *hostname;
    4243        char *configdir;
  • configure

    r3e91c3e r8e419cb  
    2323debug=0
    2424strip=1
    25 flood=0
    2625ipv6=1
    2726ssl=auto
     
    258257        if [ "$ret" = "0" ]; then
    259258                echo
    260                 echo 'WARNING: Could not find a suitable SSL library (GnuTLS, libnss or OpenSSL).'
    261                 echo '         This is necessary for MSN and full Jabber support. To continue,'
    262                 echo '         install a suitable SSL library or disable MSN support (--msn=0).'
    263                 echo '         If you want Jabber without SSL support you can try --ssl=bogus.'
     259                echo 'ERROR: Could not find a suitable SSL library (GnuTLS, libnss or OpenSSL).'
     260                echo '       This is necessary for MSN and full Jabber support. To continue,'
     261                echo '       install a suitable SSL library or disable MSN support (--msn=0).'
     262                echo '       If you want Jabber without SSL support you can try --ssl=bogus.'
    264263               
    265264                exit 1;
     
    291290fi
    292291
    293 if [ "$flood" = 1 ]; then
    294         # echo '#define FLOOD_SEND' >> config.h
    295         echo 'Flood protection is disabled in this release because of too many bugs.' 2> /dev/stderr
    296         rm config.h
    297         rm Makefile.settings
    298         exit 1
     292echo
     293if [ -z "$BITLBEE_VERSION" -a -d .bzr -a -x "`which bzr`" ]; then
     294        rev=`bzr revno`
     295        echo 'Using bzr revision #'$rev' as version number'
     296        BITLBEE_VERSION=\"bzr-$rev\"
    299297fi
    300298
    301299if [ -n "$BITLBEE_VERSION" ]; then
    302         echo
    303300        echo 'Spoofing version number: '$BITLBEE_VERSION
    304301        echo '#undef BITLBEE_VERSION' >> config.h
    305         echo '#define BITLBEE_VERSION '$BITLBEE_VERSION >> config.h;
     302        echo '#define BITLBEE_VERSION '$BITLBEE_VERSION >> config.h
     303        echo
    306304fi
    307305
     
    314312        echo '#define WITH_MSN' >> config.h
    315313        protocols=$protocols'msn '
    316         protoobjs=$protoobjs'msnn.o '
     314        protoobjs=$protoobjs'msn_mod.o '
    317315fi
    318316
     
    322320        echo '#define WITH_JABBER' >> config.h
    323321        protocols=$protocols'jabber '
    324         protoobjs=$protoobjs'jabberr.o '
     322        protoobjs=$protoobjs'jabber_mod.o '
    325323fi
    326324
     
    330328        echo '#define WITH_OSCAR' >> config.h
    331329        protocols=$protocols'oscar '
    332         protoobjs=$protoobjs'oscarr.o '
     330        protoobjs=$protoobjs'oscar_mod.o '
    333331fi
    334332
     
    338336        echo '#define WITH_YAHOO' >> config.h
    339337        protocols=$protocols'yahoo '
    340         protoobjs=$protoobjs'yahooo.o '
     338        protoobjs=$protoobjs'yahoo_mod.o '
    341339fi
    342340
    343341if [ "$protocols" = "PROTOCOLS = " ]; then
    344         echo
    345342        echo "WARNING: You haven't selected any communication protocol to compile!"
    346343        echo "         Bitlbee will run, but you will be unable to connect to IM servers!"
     
    350347echo "PROTOOBJS = $protoobjs" >> Makefile.settings
    351348
    352 echo
    353349echo Architecture: $arch
    354350case "$arch" in
  • irc.c

    r3e91c3e r8e419cb  
    4040irc_t *irc_new( int fd )
    4141{
    42         irc_t *irc = g_new0( irc_t, 1 );
    43        
     42        irc_t *irc;
     43        struct hostent *peer;
     44        unsigned int i;
     45        char buf[128];
     46#ifdef IPV6
     47        struct sockaddr_in6 sock[1];
     48#else
    4449        struct sockaddr_in sock[1];
    45 #ifdef IPV6
    46         struct sockaddr_in6 sock6[1];
    4750#endif
    48         struct hostent *peer;
    49         unsigned int i, j;
     51       
     52        irc = g_new0( irc_t, 1 );
    5053       
    5154        irc->fd = fd;
     
    7174       
    7275        i = sizeof( *sock );
    73 #ifdef IPV6
    74         j = sizeof( *sock6 );
    75 #endif
     76       
    7677        if( global.conf->hostname )
    7778                irc->myhost = g_strdup( global.conf->hostname );
    78         else if( getsockname( irc->fd, (struct sockaddr*) sock, &i ) == 0 && sock->sin_family == AF_INET )
    79         {
    80                 if( ( peer = gethostbyaddr( (char*) &sock->sin_addr, sizeof( sock->sin_addr ), AF_INET ) ) )
     79#ifdef IPV6
     80        else if( getsockname( irc->fd, (struct sockaddr*) sock, &i ) == 0 && sock->sin6_family == AF_INETx )
     81        {
     82                if( ( peer = gethostbyaddr( (char*) &sock->sin6_addr, sizeof( sock->sin6_addr ), AF_INETx ) ) )
    8183                        irc->myhost = g_strdup( peer->h_name );
    82         }
    83 #ifdef IPV6
    84         else if( getsockname( irc->fd, (struct sockaddr*) sock6, &j ) == 0 && sock6->sin6_family == AF_INET6 )
    85         {
    86                 if( ( peer = gethostbyaddr( (char*) &sock6->sin6_addr, sizeof( sock6->sin6_addr ), AF_INET6 ) ) )
     84                else if( inet_ntop( AF_INETx, &sock->sin6_addr, buf, sizeof( buf ) - 1 ) != NULL )
     85                        irc->myhost = g_strdup( ipv6_unwrap( buf ) );
     86        }
     87#else
     88        else if( getsockname( irc->fd, (struct sockaddr*) sock, &i ) == 0 && sock->sin_family == AF_INETx )
     89        {
     90                if( ( peer = gethostbyaddr( (char*) &sock->sin_addr, sizeof( sock->sin_addr ), AF_INETx ) ) )
    8791                        irc->myhost = g_strdup( peer->h_name );
     92                else if( inet_ntop( AF_INETx, &sock->sin_addr, buf, sizeof( buf ) - 1 ) != NULL )
     93                        irc->myhost = g_strdup( buf );
    8894        }
    8995#endif
     
    9197        i = sizeof( *sock );
    9298#ifdef IPV6
    93         j = sizeof( *sock6 );
     99        if( getpeername( irc->fd, (struct sockaddr*) sock, &i ) == 0 && sock->sin6_family == AF_INETx )
     100        {
     101                if( ( peer = gethostbyaddr( (char*) &sock->sin6_addr, sizeof( sock->sin6_addr ), AF_INETx ) ) )
     102                        irc->host = g_strdup( peer->h_name );
     103                else if( inet_ntop( AF_INETx, &sock->sin6_addr, buf, sizeof( buf ) - 1 ) != NULL )
     104                        irc->host = g_strdup( ipv6_unwrap( buf ) );
     105        }
     106#else
     107        if( getpeername( irc->fd, (struct sockaddr*) sock, &i ) == 0 && sock->sin_family == AF_INETx )
     108        {
     109                if( ( peer = gethostbyaddr( (char*) &sock->sin_addr, sizeof( sock->sin_addr ), AF_INETx ) ) )
     110                        irc->host = g_strdup( peer->h_name );
     111                else if( inet_ntop( AF_INETx, &sock->sin_addr, buf, sizeof( buf ) - 1 ) != NULL )
     112                        irc->host = g_strdup( buf );
     113        }
    94114#endif
    95         if( getpeername( irc->fd, (struct sockaddr*) sock, &i ) == 0 && sock->sin_family == AF_INET )
    96         {
    97                 if( ( peer = gethostbyaddr( (char*) &sock->sin_addr, sizeof( sock->sin_addr ), AF_INET ) ) )
    98                         irc->host = g_strdup( peer->h_name );
    99         }
    100 #ifdef IPV6
    101         else if( getpeername( irc->fd, (struct sockaddr*) sock6, &j ) == 0 && sock6->sin6_family == AF_INET6 )
    102         {
    103                 if( ( peer = gethostbyaddr( (char*) &sock6->sin6_addr, sizeof( sock6->sin6_addr ), AF_INET6 ) ) )
    104                         irc->host = g_strdup( peer->h_name );
    105         }
    106 #endif
    107        
     115       
     116        /* Rare, but possible. */
    108117        if( !irc->host ) irc->host = g_strdup( "localhost." );
    109118        if( !irc->myhost ) irc->myhost = g_strdup( "localhost." );
     
    264273        g_free(irc);
    265274       
    266         if( global.conf->runmode == RUNMODE_INETD )
     275        if( global.conf->runmode == RUNMODE_INETD || global.conf->runmode == RUNMODE_FORKDAEMON )
    267276                g_main_quit( global.loop );
    268277}
     
    422431                                irc_reply( irc, 461, "%s :Need more parameters", cmd[0] );
    423432                        }
    424                         else if( strcmp( cmd[1], (global.conf)->password ) == 0 )
     433                        else if( strcmp( cmd[1], (global.conf)->auth_pass ) == 0 )
    425434                        {
    426435                                irc->status = USTATUS_AUTHORIZED;
     
    500509        {
    501510                irc_write( irc, ":%s PONG %s :%s", irc->myhost, irc->myhost, cmd[1]?cmd[1]:irc->myhost );
     511        }
     512        else if( g_strcasecmp( cmd[0], "OPER" ) == 0 )
     513        {
     514                if( !cmd[2] )
     515                        irc_reply( irc, 461, "%s :Need more parameters", cmd[0] );
     516                else if( strcmp( cmd[2], global.conf->oper_pass ) == 0 )
     517                        irc_umode_set( irc, "+o", 1 );
     518                // else
     519                        /* FIXME/TODO: Find out which reply to send now. */
    502520        }
    503521        else if( g_strcasecmp( cmd[0], "MODE" ) == 0 )
     
    524542                        {
    525543                                if( cmd[2] )
    526                                         irc_umode_set( irc, irc->nick, cmd[2] );
     544                                        irc_umode_set( irc, cmd[2], 0 );
    527545                        }
    528546                        else
     
    923941        if( irc->sendbuffer != NULL ) {
    924942                size = strlen( irc->sendbuffer ) + strlen( line );
    925 #ifdef FLOOD_SEND
    926                 if( size > FLOOD_SEND_MAXBUFFER ) {
    927                         /* Die flooder, die! >:) */
    928 
    929                         g_free(irc->sendbuffer);
    930                        
    931                         /* We need the \r\n at the start because else we might append our string to a half
    932                          * sent line. A bit hackish, but it works.
    933                          */
    934                         irc->sendbuffer = g_strdup( "\r\nERROR :Sendq Exceeded\r\n" );
    935                         irc->quit = 1;
    936                        
    937                         return;
    938                 }
    939 #endif
    940943                irc->sendbuffer = g_renew ( char, irc->sendbuffer, size + 1 );
    941944                strcpy( ( irc->sendbuffer + strlen( irc->sendbuffer ) ), line );
     
    10751078        irc_reply( irc,   2, ":Host %s is running BitlBee " BITLBEE_VERSION " " ARCH "/" CPU ".", irc->myhost );
    10761079        irc_reply( irc,   3, ":%s", IRCD_INFO );
    1077         irc_reply( irc,   4, "%s %s %s %s", irc->myhost, BITLBEE_VERSION, UMODES, CMODES );
     1080        irc_reply( irc,   4, "%s %s %s %s", irc->myhost, BITLBEE_VERSION, UMODES UMODES_PRIV, CMODES );
     1081        irc_reply( irc,   5, "PREFIX=(ov)@+ CHANTYPES=#& CHANMODES=,,,%s NICKLEN=%d NETWORK=BitlBee CASEMAPPING=rfc1459 MAXTARGETS=1 WATCH=128 :are supported by this server", CMODES, MAX_NICK_LENGTH - 1 );
    10781082        irc_motd( irc );
    1079         irc_umode_set( irc, irc->myhost, "+" UMODE );
     1083        irc_umode_set( irc, "+" UMODE, 1 );
    10801084
    10811085        u = user_add( irc, irc->mynick );
     
    12041208
    12051209
    1206 void irc_umode_set( irc_t *irc, char *who, char *s )
    1207 {
     1210void irc_umode_set( irc_t *irc, char *s, int allow_priv )
     1211{
     1212        /* allow_priv: Set to 0 if s contains user input, 1 if you want
     1213           to set a "privileged" mode (+o, +R, etc). */
    12081214        char m[256], st = 1, *t;
    12091215        int i;
     
    12181224                if( *t == '+' || *t == '-' )
    12191225                        st = *t == '+';
    1220                 else
     1226                else if( st == 0 || ( strchr( UMODES, *t ) || ( allow_priv && strchr( UMODES_PRIV, *t ) ) ) )
    12211227                        m[(int)*t] = st;
    12221228        }
     
    12251231       
    12261232        for( i = 0; i < 256 && strlen( irc->umode ) < ( sizeof( irc->umode ) - 1 ); i ++ )
    1227                 if( m[i] && strchr( UMODES, i ) )
     1233                if( m[i] )
    12281234                        irc->umode[strlen(irc->umode)] = i;
    12291235       
  • irc.h

    r3e91c3e r8e419cb  
    3333#define IRC_PING_STRING "PinglBee"
    3434
    35 /* #define FLOOD_SEND
    36  * Not yet enabled by default due to some problems.
    37  */
    38 #define FLOOD_SEND_INTERVAL 30
    39 #define FLOOD_SEND_BYTES (1024*10)
    40 #define FLOOD_SEND_MAXBUFFER (1024*20)
    41 
    42 #define UMODES "ais"
     35#define UMODES "ias"
     36#define UMODES_PRIV "Ro"
    4337#define CMODES "nt"
    4438#define CMODE "t"
     
    127121void irc_names( irc_t *irc, char *channel );
    128122void irc_topic( irc_t *irc, char *channel );
    129 void irc_umode_set( irc_t *irc, char *who, char *s );
     123void irc_umode_set( irc_t *irc, char *s, int allow_priv );
    130124void irc_who( irc_t *irc, char *channel );
    131125void irc_spawn( irc_t *irc, user_t *u );
  • protocols/Makefile

    r3e91c3e r8e419cb  
    1010
    1111# [SH] Program variables
    12 objects = md5.o nogaim.o proxy.o sha.o util.o $(SSL_CLIENT)
     12objects = http_client.o md5.o nogaim.o proxy.o sha.o $(SSL_CLIENT)
    1313
    1414# [SH] The next two lines should contain the directory name (in $(subdirs))
  • protocols/jabber/Makefile

    r3e91c3e r8e419cb  
    1616
    1717# [SH] Phony targets
    18 all: jabberr.o
     18all: jabber_mod.o
    1919
    2020.PHONY: all clean distclean
     
    3333        @$(CC) -c $(CFLAGS) $< -o $@
    3434
    35 jabberr.o: $(objects)
    36         @echo '*' Linking jabberr.o
    37         @$(LD) $(LFLAGS) $(objects) -o jabberr.o
     35jabber_mod.o: $(objects)
     36        @echo '*' Linking jabber_mod.o
     37        @$(LD) $(LFLAGS) $(objects) -o jabber_mod.o
  • protocols/jabber/jabber.c

    r3e91c3e r8e419cb  
    12491249                        gjab_auth(gjc);
    12501250                } else {
     1251                        gjab_reqroster(gjc);
    12511252                        account_online(GJ_GC(gjc));
    1252 
    1253                         if (bud_list_cache_exists(GJ_GC(gjc)))
    1254                                 do_import(GJ_GC(gjc), NULL);
    1255 
     1253                       
    12561254                        ((struct jabber_data *)GJ_GC(gjc)->proto_data)->did_import = TRUE;
    1257 
    1258                         gjab_reqroster(gjc);
    12591255                }
    12601256        } else {
     
    18601856                        xmlnode_insert_cdata(y, "away", -1);
    18611857                        y = xmlnode_insert_tag(x, "status");
    1862                         {
    1863                                 char *utf8 = str_to_utf8(message);
    1864                                 xmlnode_insert_cdata(y, utf8, -1);
    1865                                 g_free(utf8);
    1866                         }
     1858                        xmlnode_insert_cdata(y, message, -1);
    18671859                        gc->away = "";
    18681860                } else {
  • protocols/msn/Makefile

    r3e91c3e r8e419cb  
    1616
    1717# [SH] Phony targets
    18 all: msnn.o
     18all: msn_mod.o
    1919       
    2020.PHONY: all clean distclean
     
    3333        @$(CC) -c $(CFLAGS) $< -o $@
    3434
    35 msnn.o: $(objects)
    36         @echo '*' Linking msnn.o
    37         @$(LD) $(LFLAGS) $(objects) -o msnn.o
     35msn_mod.o: $(objects)
     36        @echo '*' Linking msn_mod.o
     37        @$(LD) $(LFLAGS) $(objects) -o msn_mod.o
    3838       
    3939
  • protocols/msn/msn.c

    r3e91c3e r8e419cb  
    170170       
    171171        for( i = 0; msn_away_state_list[i].number > -1; i ++ )
    172                 l = g_list_append( l, msn_away_state_list[i].name );
     172                l = g_list_append( l, (void*) msn_away_state_list[i].name );
    173173       
    174174        return( l );
     
    177177static char *msn_get_status_string( struct gaim_connection *gc, int number )
    178178{
    179         struct msn_away_state *st = msn_away_state_by_number( number );
     179        const struct msn_away_state *st = msn_away_state_by_number( number );
    180180       
    181181        if( st )
    182                 return( st->name );
     182                return( (char*) st->name );
    183183        else
    184184                return( "" );
     
    189189        char buf[1024];
    190190        struct msn_data *md = gc->proto_data;
    191         struct msn_away_state *st;
     191        const struct msn_away_state *st;
    192192       
    193193        if( strcmp( state, GAIM_AWAY_CUSTOM ) == 0 )
  • protocols/msn/msn.h

    r3e91c3e r8e419cb  
    6767        GSList *switchboards;
    6868        int buddycount;
    69         struct msn_away_state *away_state;
     69        const struct msn_away_state *away_state;
    7070};
    7171
     
    127127#define STATUS_FATAL            1
    128128#define STATUS_SB_FATAL         2
     129#define STATUS_SB_IM_SPARE      4       /* Make one-to-one conversation switchboard available again, invite failed. */
     130#define STATUS_SB_CHAT_SPARE    8       /* Same, but also for groupchats (not used yet). */
    129131
    130132int msn_chat_id;
    131 extern struct msn_away_state msn_away_state_list[];
    132 extern struct msn_status_code msn_status_code_list[];
     133extern const struct msn_away_state msn_away_state_list[];
     134extern const struct msn_status_code msn_status_code_list[];
    133135
    134136/* Keep a list of all the active connections. We need these lists because
     
    154156
    155157/* tables.c */
    156 struct msn_away_state *msn_away_state_by_number( int number );
    157 struct msn_away_state *msn_away_state_by_code( char *code );
    158 struct msn_away_state *msn_away_state_by_name( char *name );
    159 struct msn_status_code *msn_status_by_number( int number );
     158const struct msn_away_state *msn_away_state_by_number( int number );
     159const struct msn_away_state *msn_away_state_by_code( char *code );
     160const struct msn_away_state *msn_away_state_by_name( char *name );
     161const struct msn_status_code *msn_status_by_number( int number );
    160162
    161163/* sb.c */
  • protocols/msn/ns.c

    r3e91c3e r8e419cb  
    208208                {
    209209                        /* Time for some Passport black magic... */
    210                         if( !passport_get_id( gc, gc->username, gc->password, cmd[4], msn_auth_got_passport_id ) )
     210                        if( !passport_get_id( msn_auth_got_passport_id, gc, gc->username, gc->password, cmd[4] ) )
    211211                        {
    212212                                hide_login_progress_error( gc, "Error while contacting Passport server" );
     
    365365        else if( strcmp( cmd[0], "ILN" ) == 0 )
    366366        {
    367                 struct msn_away_state *st;
     367                const struct msn_away_state *st;
    368368               
    369369                if( num_parts != 6 )
     
    393393        else if( strcmp( cmd[0], "NLN" ) == 0 )
    394394        {
    395                 struct msn_away_state *st;
     395                const struct msn_away_state *st;
    396396               
    397397                if( num_parts != 5 )
     
    539539        {
    540540                int num = atoi( cmd[0] );
    541                 struct msn_status_code *err = msn_status_by_number( num );
     541                const struct msn_status_code *err = msn_status_by_number( num );
    542542               
    543543                g_snprintf( buf, sizeof( buf ), "Error reported by MSN server: %s", err->text );
  • protocols/msn/passport.c

    r3e91c3e r8e419cb  
    2020 */
    2121
    22 #include "ssl_client.h"
     22#include "http_client.h"
    2323#include "passport.h"
    2424#include "msn.h"
     
    3131static char *prd_cached = NULL;
    3232
    33 static char *passport_create_header( char *reply, char *email, char *pwd );
     33static int passport_get_id_real( gpointer func, gpointer data, char *header );
     34static void passport_get_id_ready( struct http_request *req );
     35
    3436static int passport_retrieve_dalogin( gpointer data, gpointer func, char *header );
    35 static void passport_retrieve_dalogin_connected( gpointer data, void *ssl, GaimInputCondition cond );
    36 static int passport_get_id_from( gpointer data, gpointer func, char *header_i, char *url );
    37 static void passport_get_id_connected( gpointer data, void *ssl, GaimInputCondition cond );
     37static void passport_retrieve_dalogin_ready( struct http_request *req );
     38
     39static char *passport_create_header( char *cookie, char *email, char *pwd );
    3840static void destroy_reply( struct passport_reply *rep );
    3941
    40 
    41 int passport_get_id( gpointer data, char *username, char *password, char *cookie, gpointer func )
     42int passport_get_id( gpointer func, gpointer data, char *username, char *password, char *cookie )
    4243{
    4344        char *header = passport_create_header( cookie, username, password );
    4445       
    45         if( prd_cached )
    46         {
    47                 int st;
    48                
    49                 st = passport_get_id_from( data, func, header, prd_cached );
    50                 g_free( header );
    51                 return( st );
    52         }
     46        if( prd_cached == NULL )
     47                return passport_retrieve_dalogin( func, data, header );
    5348        else
    54         {
    55                 return( passport_retrieve_dalogin( data, func, header ) );
    56         }
    57 }
    58 
    59 
    60 static char *passport_create_header( char *reply, char *email, char *pwd )
    61 {
    62         char *buffer = g_new0( char, 2048 );
    63         char *currenttoken;
    64         char *email_enc, *pwd_enc;
    65        
    66         email_enc = g_new0( char, strlen( email ) * 3 + 1 );
    67         strcpy( email_enc, email );
    68         http_encode( email_enc );
    69        
    70         pwd_enc = g_new0( char, strlen( pwd ) * 3 + 1 );
    71         strcpy( pwd_enc, pwd );
    72         http_encode( pwd_enc );
    73        
    74         currenttoken = strstr( reply, "lc=" );
    75         if( currenttoken == NULL )
    76                 return( NULL );
    77        
    78         g_snprintf( buffer, 2048,
    79                     "Authorization: Passport1.4 OrgVerb=GET,"
    80                     "OrgURL=http%%3A%%2F%%2Fmessenger%%2Emsn%%2Ecom,"
    81                     "sign-in=%s,pwd=%s,%s", email_enc, pwd_enc,
    82                     currenttoken );
    83        
    84         g_free( email_enc );
    85         g_free( pwd_enc );
    86        
    87         return( buffer );
    88 }
    89 
    90 
    91 static int passport_retrieve_dalogin( gpointer data, gpointer func, char *header )
    92 {
    93         struct passport_reply *rep = g_new0( struct passport_reply, 1 );
    94         void *ssl;
    95        
     49                return passport_get_id_real( func, data, header );
     50}
     51
     52static int passport_get_id_real( gpointer func, gpointer data, char *header )
     53{
     54        struct passport_reply *rep;
     55        char *server, *dummy, *reqs;
     56        struct http_request *req;
     57       
     58        rep = g_new0( struct passport_reply, 1 );
    9659        rep->data = data;
    9760        rep->func = func;
    98         rep->header = header;
    99        
    100         ssl = ssl_connect( "nexus.passport.com", 443, passport_retrieve_dalogin_connected, rep );
    101        
    102         if( !ssl )
    103                 destroy_reply( rep );
    104        
    105         return( ssl != NULL );
    106 }
    107 
    108 #define PPR_BUFFERSIZE 2048
    109 #define PPR_REQUEST "GET /rdr/pprdr.asp HTTP/1.0\r\n\r\n"
    110 static void passport_retrieve_dalogin_connected( gpointer data, void *ssl, GaimInputCondition cond )
    111 {
    112         int ret;
    113         char buffer[PPR_BUFFERSIZE+1];
    114         struct passport_reply *rep = data;
    115        
    116         if( !g_slist_find( msn_connections, rep->data ) )
    117         {
    118                 if( ssl ) ssl_disconnect( ssl );
     61       
     62        server = g_strdup( prd_cached );
     63        dummy = strchr( server, '/' );
     64       
     65        if( dummy == NULL )
     66        {
     67                destroy_reply( rep );
     68                return( 0 );
     69        }
     70       
     71        reqs = g_malloc( strlen( header ) + strlen( dummy ) + 128 );
     72        sprintf( reqs, "GET %s HTTP/1.0\r\n%s\r\n\r\n", dummy, header );
     73       
     74        *dummy = 0;
     75        req = http_dorequest( server, 443, 1, reqs, passport_get_id_ready, rep );
     76       
     77        g_free( server );
     78        g_free( reqs );
     79       
     80        if( req == NULL )
     81                destroy_reply( rep );
     82       
     83        return( req != NULL );
     84}
     85
     86static void passport_get_id_ready( struct http_request *req )
     87{
     88        struct passport_reply *rep = req->data;
     89       
     90        if( !g_slist_find( msn_connections, rep->data ) || !req->finished || !req->reply_headers )
     91        {
    11992                destroy_reply( rep );
    12093                return;
    12194        }
    12295       
    123         if( !ssl )
    124         {
    125                 rep->func( rep );
    126                 destroy_reply( rep );
    127                 return;
    128         }
    129        
    130         ssl_write( ssl, PPR_REQUEST, strlen( PPR_REQUEST ) );
    131        
    132         if( ( ret = ssl_read( ssl, buffer, PPR_BUFFERSIZE ) ) <= 0 )
    133         {
    134                 goto failure;
    135         }
    136 
    137         {
    138                 char *dalogin = strstr( buffer, "DALogin=" );
    139                 char *urlend;
     96        if( req->status_code == 200 )
     97        {
     98                char *dummy;
    14099               
    141                 if( !dalogin )
    142                         goto failure;
    143                
    144                 dalogin += strlen( "DALogin=" );
    145                 urlend = strchr( dalogin, ',' );
    146                 if( urlend )
    147                         *urlend = 0;
    148                
    149                 /* strip the http(s):// part from the url */
    150                 urlend = strstr( urlend, "://" );
    151                 if( urlend )
    152                         dalogin = urlend + strlen( "://" );
    153                
    154                 if( prd_cached == NULL )
    155                         prd_cached = g_strdup( dalogin );
    156         }
    157        
    158         if( passport_get_id_from( rep->data, rep->func, rep->header, prd_cached ) )
    159         {
    160                 ssl_disconnect( ssl );
    161                 destroy_reply( rep );
    162                 return;
    163         }
    164        
    165 failure:       
    166         ssl_disconnect( ssl );
    167         rep->func( rep );
    168         destroy_reply( rep );
    169 }
    170 
    171 
    172 static int passport_get_id_from( gpointer data, gpointer func, char *header_i, char *url )
    173 {
    174         struct passport_reply *rep = g_new0( struct passport_reply, 1 );
    175         char server[512], *dummy;
    176         void *ssl;
    177        
    178         rep->data = data;
    179         rep->func = func;
    180         rep->redirects = 4;
    181        
    182         strncpy( server, url, 512 );
    183         dummy = strchr( server, '/' );
    184         if( dummy )
    185                 *dummy = 0;
    186        
    187         ssl = ssl_connect( server, 443, passport_get_id_connected, rep );
    188        
    189         if( ssl )
    190         {
    191                 rep->header = g_strdup( header_i );
    192                 rep->url = g_strdup( url );
    193         }
    194         else
    195         {
    196                 destroy_reply( rep );
    197         }
    198        
    199         return( ssl != NULL );
    200 }
    201 
    202 #define PPG_BUFFERSIZE 4096
    203 static void passport_get_id_connected( gpointer data, void *ssl, GaimInputCondition cond )
    204 {
    205         struct passport_reply *rep = data;
    206         char server[512], buffer[PPG_BUFFERSIZE+1], *dummy;
    207         int ret;
    208        
    209         if( !g_slist_find( msn_connections, rep->data ) )
    210         {
    211                 if( ssl ) ssl_disconnect( ssl );
    212                 destroy_reply( rep );
    213                 return;
    214         }
    215        
    216         if( !ssl )
    217         {
    218                 rep->func( rep );
    219                 destroy_reply( rep );
    220                 return;
    221         }
    222        
    223         memset( buffer, 0, PPG_BUFFERSIZE + 1 );
    224        
    225         strncpy( server, rep->url, 512 );
    226         dummy = strchr( server, '/' );
    227         if( dummy == NULL )
    228                 goto end;
    229        
    230         g_snprintf( buffer, PPG_BUFFERSIZE - 1, "GET %s HTTP/1.0\r\n"
    231                     "%s\r\n\r\n", dummy, rep->header );
    232        
    233         ssl_write( ssl, buffer, strlen( buffer ) );
    234         memset( buffer, 0, PPG_BUFFERSIZE + 1 );
    235        
    236         {
    237                 char *buffer2 = buffer;
    238                
    239                 while( ( ( ret = ssl_read( ssl, buffer2, 512 ) ) > 0 ) &&
    240                        ( buffer + PPG_BUFFERSIZE - buffer2 - ret - 512 >= 0 ) )
    241                 {
    242                         buffer2 += ret;
    243                 }
    244         }
    245        
    246         if( *buffer == 0 )
    247                 goto end;
    248        
    249         if( ( dummy = strstr( buffer, "Location:" ) ) )
    250         {
    251                 char *urlend;
    252                
    253                 rep->redirects --;
    254                 if( rep->redirects == 0 )
    255                         goto end;
    256                
    257                 dummy += strlen( "Location:" );
    258                 while( isspace( *dummy ) ) dummy ++;
    259                 urlend = dummy;
    260                 while( !isspace( *urlend ) ) urlend ++;
    261                 *urlend = 0;
    262                 if( ( urlend = strstr( dummy, "://" ) ) )
    263                         dummy = urlend + strlen( "://" );
    264                
    265                 g_free( rep->url );
    266                 rep->url = g_strdup( dummy );
    267                
    268                 strncpy( server, dummy, sizeof( server ) - 1 );
    269                 dummy = strchr( server, '/' );
    270                 if( dummy ) *dummy = 0;
    271                
    272                 ssl_disconnect( ssl );
    273                
    274                 if( ssl_connect( server, 443, passport_get_id_connected, rep ) )
    275                 {
    276                         return;
    277                 }
    278                 else
    279                 {
    280                         rep->func( rep );
    281                         destroy_reply( rep );
    282                         return;
    283                 }
    284         }
    285         else if( strstr( buffer, "200 OK" ) )
    286         {
    287                 if( ( dummy = strstr( buffer, "from-PP='" ) ) )
     100                if( ( dummy = strstr( req->reply_headers, "from-PP='" ) ) )
    288101                {
    289102                        char *responseend;
     
    298111        }
    299112       
    300 end:
    301         ssl_disconnect( ssl );
    302113        rep->func( rep );
    303114        destroy_reply( rep );
    304115}
    305116
     117static char *passport_create_header( char *cookie, char *email, char *pwd )
     118{
     119        char *buffer = g_new0( char, 2048 );
     120        char *currenttoken;
     121        char *email_enc, *pwd_enc;
     122       
     123        email_enc = g_new0( char, strlen( email ) * 3 + 1 );
     124        strcpy( email_enc, email );
     125        http_encode( email_enc );
     126       
     127        pwd_enc = g_new0( char, strlen( pwd ) * 3 + 1 );
     128        strcpy( pwd_enc, pwd );
     129        http_encode( pwd_enc );
     130       
     131        currenttoken = strstr( cookie, "lc=" );
     132        if( currenttoken == NULL )
     133                return( NULL );
     134       
     135        g_snprintf( buffer, 2048,
     136                    "Authorization: Passport1.4 OrgVerb=GET,"
     137                    "OrgURL=http%%3A%%2F%%2Fmessenger%%2Emsn%%2Ecom,"
     138                    "sign-in=%s,pwd=%s,%s", email_enc, pwd_enc,
     139                    currenttoken );
     140       
     141        g_free( email_enc );
     142        g_free( pwd_enc );
     143       
     144        return( buffer );
     145}
     146
     147#define PPR_REQUEST "GET /rdr/pprdr.asp HTTP/1.0\r\n\r\n"
     148static int passport_retrieve_dalogin( gpointer func, gpointer data, char *header )
     149{
     150        struct passport_reply *rep = g_new0( struct passport_reply, 1 );
     151        struct http_request *req;
     152       
     153        rep->data = data;
     154        rep->func = func;
     155        rep->header = header;
     156       
     157        req = http_dorequest( "nexus.passport.com", 443, 1, PPR_REQUEST, passport_retrieve_dalogin_ready, rep );
     158       
     159        if( !req )
     160                destroy_reply( rep );
     161       
     162        return( req != NULL );
     163}
     164
     165static void passport_retrieve_dalogin_ready( struct http_request *req )
     166{
     167        struct passport_reply *rep = req->data;
     168        char *dalogin;
     169        char *urlend;
     170       
     171        if( !g_slist_find( msn_connections, rep->data ) || !req->finished || !req->reply_headers )
     172        {
     173                destroy_reply( rep );
     174                return;
     175        }
     176       
     177        dalogin = strstr( req->reply_headers, "DALogin=" );     
     178       
     179        if( !dalogin )
     180                goto failure;
     181       
     182        dalogin += strlen( "DALogin=" );
     183        urlend = strchr( dalogin, ',' );
     184        if( urlend )
     185                *urlend = 0;
     186       
     187        /* strip the http(s):// part from the url */
     188        urlend = strstr( urlend, "://" );
     189        if( urlend )
     190                dalogin = urlend + strlen( "://" );
     191       
     192        if( prd_cached == NULL )
     193                prd_cached = g_strdup( dalogin );
     194       
     195        if( passport_get_id_real( rep->func, rep->data, rep->header ) )
     196        {
     197                destroy_reply( rep );
     198                return;
     199        }
     200       
     201failure:       
     202        rep->func( rep );
     203        destroy_reply( rep );
     204}
    306205
    307206static void destroy_reply( struct passport_reply *rep )
    308207{
    309         if( rep->result ) g_free( rep->result );
    310         if( rep->url ) g_free( rep->url );
    311         if( rep->header ) g_free( rep->header );
    312         if( rep ) g_free( rep );
    313 }
     208        g_free( rep->result );
     209        g_free( rep->header );
     210        g_free( rep );
     211}
  • protocols/msn/passport.h

    r3e91c3e r8e419cb  
    3535struct passport_reply
    3636{
     37        void (*func)( struct passport_reply * );
    3738        void *data;
    3839        char *result;
    39         void (*func)( struct passport_reply * );
    40         char *url;
    4140        char *header;
    42         int redirects;
    4341};
    4442
    45 int passport_get_id( gpointer data, char *username, char *password, char *cookie, gpointer func );
     43int passport_get_id( gpointer func, gpointer data, char *username, char *password, char *cookie );
    4644
    4745#endif /* __PASSPORT_H__ */
  • protocols/msn/sb.c

    r3e91c3e r8e419cb  
    512512        {
    513513                int num = atoi( cmd[0] );
    514                 struct msn_status_code *err = msn_status_by_number( num );
     514                const struct msn_status_code *err = msn_status_by_number( num );
    515515               
    516516                g_snprintf( buf, sizeof( buf ), "Error reported by switchboard server: %s", err->text );
     
    522522                        return( 0 );
    523523                }
    524                 else if( err->flags & STATUS_FATAL )
     524                if( err->flags & STATUS_FATAL )
    525525                {
    526526                        signoff( gc );
    527527                        return( 0 );
     528                }
     529                if( err->flags & STATUS_SB_IM_SPARE )
     530                {
     531                        if( sb->who )
     532                        {
     533                                struct msn_message *m;
     534                                GSList *l;
     535                               
     536                                /* Apparently some invitation failed. We might want to use this
     537                                   board later, so keep it as a spare. */
     538                                g_free( sb->who );
     539                                sb->who = NULL;
     540                               
     541                                /* Also clear the msgq, otherwise someone else might get them. */
     542                                for( l = sb->msgq; l; l = l->next )
     543                                {
     544                                        m = l->data;
     545                                        g_free( m->who );
     546                                        g_free( m->text );
     547                                        g_free( m );
     548                                }
     549                                g_slist_free( sb->msgq );
     550                                sb->msgq = NULL;
     551                        }
    528552                }
    529553        }
  • protocols/msn/tables.c

    r3e91c3e r8e419cb  
    2727#include "msn.h"
    2828
    29 struct msn_away_state msn_away_state_list[] =
     29const struct msn_away_state msn_away_state_list[] =
    3030{
    3131        {  0, "NLN", "Available" },
     
    4040};
    4141
    42 struct msn_away_state *msn_away_state_by_number( int number )
     42const struct msn_away_state *msn_away_state_by_number( int number )
    4343{
    4444        int i;
     
    5151}
    5252
    53 struct msn_away_state *msn_away_state_by_code( char *code )
     53const struct msn_away_state *msn_away_state_by_code( char *code )
    5454{
    5555        int i;
     
    6262}
    6363
    64 struct msn_away_state *msn_away_state_by_name( char *name )
     64const struct msn_away_state *msn_away_state_by_name( char *name )
    6565{
    6666        int i;
     
    7373}
    7474
    75 struct msn_status_code msn_status_code_list[] =
     75const struct msn_status_code msn_status_code_list[] =
    7676{
    7777        { 200, "Invalid syntax",                                        0 },
     
    8080        { 206, "Domain name missing",                                   0 },
    8181        { 207, "Already logged in",                                     0 },
    82         { 208, "Invalid handle",                                        0 },
     82        { 208, "Invalid handle",                                        STATUS_SB_IM_SPARE },
    8383        { 209, "Forbidden nickname",                                    0 },
    8484        { 210, "Buddy list too long",                                   0 },
    8585        { 215, "Handle is already in list",                             0 },
    86         { 216, "Handle is not in list",                                 0 },
    87         { 217, "Person is off-line or non-existent",                    0 },
     86        { 216, "Handle is not in list",                                 STATUS_SB_IM_SPARE },
     87        { 217, "Person is off-line or non-existent",                    STATUS_SB_IM_SPARE },
    8888        { 218, "Already in that mode",                                  0 },
    8989        { 219, "Handle is already in opposite list",                    0 },
     
    118118        { 711, "Write is blocking",                                     STATUS_FATAL },
    119119        { 712, "Session is overloaded",                                 STATUS_FATAL },
    120         { 713, "Calling too rapidly",                                   0 },
     120        { 713, "Calling too rapidly",                                   STATUS_SB_IM_SPARE },
    121121        { 714, "Too many sessions",                                     STATUS_FATAL },
    122122        { 715, "Not expected/Invalid argument/action",                  0 },
     
    144144};
    145145
    146 struct msn_status_code *msn_status_by_number( int number )
     146const struct msn_status_code *msn_status_by_number( int number )
    147147{
    148148        static struct msn_status_code *unknown = NULL;
  • protocols/nogaim.h

    r3e91c3e r8e419cb  
    312312G_MODULE_EXPORT void serv_got_chat_in( struct gaim_connection *gc, int id, char *who, int whisper, char *msg, time_t mtime );
    313313G_MODULE_EXPORT void serv_got_chat_left( struct gaim_connection *gc, int id );
    314 /* void serv_finish_login( struct gaim_connection *gc ); */
    315314
    316315/* util.c */
    317 G_MODULE_EXPORT char *utf8_to_str( const char *in );
    318 G_MODULE_EXPORT char *str_to_utf8( const char *in );
    319316G_MODULE_EXPORT void strip_linefeed( gchar *text );
    320317G_MODULE_EXPORT char *add_cr( char *text );
     
    323320G_MODULE_EXPORT time_t get_time( int year, int month, int day, int hour, int min, int sec );
    324321G_MODULE_EXPORT void strip_html( char *msg );
    325 G_MODULE_EXPORT char * escape_html(const char *html);
     322G_MODULE_EXPORT char *escape_html( const char *html );
    326323G_MODULE_EXPORT void info_string_append(GString *str, char *newline, char *name, char *value);
     324G_MODULE_EXPORT char *ipv6_wrap( char *src );
     325G_MODULE_EXPORT char *ipv6_unwrap( char *src );
    327326
    328327/* prefs.c */
  • protocols/oscar/Makefile

    r3e91c3e r8e419cb  
    1616
    1717# [SH] Phony targets
    18 all: oscarr.o
     18all: oscar_mod.o
    1919
    2020.PHONY: all clean distclean
     
    3333        @$(CC) -c $(CFLAGS) $< -o $@
    3434
    35 oscarr.o: $(objects)
    36         @echo '*' Linking oscarr.o
    37         @$(LD) $(LFLAGS) $(objects) -o oscarr.o
     35oscar_mod.o: $(objects)
     36        @echo '*' Linking oscar_mod.o
     37        @$(LD) $(LFLAGS) $(objects) -o oscar_mod.o
  • protocols/oscar/oscar.c

    r3e91c3e r8e419cb  
    2121 */
    2222
    23 #include "sock.h"
    2423#include <errno.h>
    2524#include <ctype.h>
     
    3332#include "bitlbee.h"
    3433#include "proxy.h"
     34#include "sock.h"
    3535
    3636#include "aim.h"
  • protocols/proxy.c

    r3e91c3e r8e419cb  
    106106        if (condition & GAIM_WRITE_COND)
    107107                gaim_cond |= GAIM_INPUT_WRITE;
    108 //      if (condition & GAIM_ERR_COND)
    109 //              fprintf( stderr, "ERROR! fd=%d\n", g_io_channel_unix_get_fd( source ) );
    110108
    111109        closure->function(closure->data, g_io_channel_unix_get_fd(source), gaim_cond);
  • protocols/ssl_bogus.c

    r3e91c3e r8e419cb  
    2828int ssl_errno;
    2929
    30 void *ssl_connect( char *host, int port, SslInputFunction func, gpointer data )
     30void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data )
    3131{
    3232        return( NULL );
     
    5151        return( -1 );
    5252}
     53
     54GaimInputCondition ssl_getdirection( void *conn )
     55{
     56        return GAIM_INPUT_READ;
     57}
  • protocols/ssl_client.h

    r3e91c3e r8e419cb  
    3333extern int ssl_errno;
    3434
    35 typedef void (*SslInputFunction)(gpointer, void*, GaimInputCondition);
     35typedef void (*ssl_input_function)(gpointer, void*, GaimInputCondition);
    3636
    37 G_MODULE_EXPORT void *ssl_connect( char *host, int port, SslInputFunction func, gpointer data );
     37G_MODULE_EXPORT void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data );
    3838G_MODULE_EXPORT int ssl_read( void *conn, char *buf, int len );
    3939G_MODULE_EXPORT int ssl_write( void *conn, const char *buf, int len );
    4040G_MODULE_EXPORT void ssl_disconnect( void *conn_ );
    4141G_MODULE_EXPORT int ssl_getfd( void *conn );
     42G_MODULE_EXPORT GaimInputCondition ssl_getdirection( void *conn );
  • protocols/ssl_gnutls.c

    r3e91c3e r8e419cb  
    3838struct scd
    3939{
    40         SslInputFunction func;
     40        ssl_input_function func;
    4141        gpointer data;
    4242        int fd;
     
    5151
    5252
    53 void *ssl_connect( char *host, int port, SslInputFunction func, gpointer data )
     53void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data )
    5454{
    5555        struct scd *conn = g_new0( struct scd, 1 );
     
    111111       
    112112        if( conn->inpa != -1 )
     113        {
    113114                gaim_input_remove( conn->inpa );
     115                conn->inpa = -1;
     116        }
    114117       
    115118        if( ( st = gnutls_handshake( conn->session ) ) < 0 )
     
    117120                if( st == GNUTLS_E_AGAIN || st == GNUTLS_E_INTERRUPTED )
    118121                {
    119                         conn->inpa = gaim_input_add( conn->fd,
    120                                                      gnutls_record_get_direction( conn->session ) ?
    121                                                          GAIM_INPUT_WRITE : GAIM_INPUT_READ,
     122                        conn->inpa = gaim_input_add( conn->fd, ssl_getdirection( conn ),
    122123                                                     ssl_handshake, data );
    123124                }
     
    145146int ssl_read( void *conn, char *buf, int len )
    146147{
     148        int st;
     149       
    147150        if( !((struct scd*)conn)->established )
    148151        {
     
    151154        }
    152155       
    153         return( gnutls_record_recv( ((struct scd*)conn)->session, buf, len ) );
    154        
     156        st = gnutls_record_recv( ((struct scd*)conn)->session, buf, len );
     157       
     158        ssl_errno = SSL_OK;
     159        if( st == GNUTLS_E_AGAIN || st == GNUTLS_E_INTERRUPTED )
     160                ssl_errno = SSL_AGAIN;
     161       
     162        return st;
    155163}
    156164
    157165int ssl_write( void *conn, const char *buf, int len )
    158166{
     167        int st;
     168       
    159169        if( !((struct scd*)conn)->established )
    160170        {
     
    163173        }
    164174       
    165         return( gnutls_record_send( ((struct scd*)conn)->session, buf, len ) );
     175        st = gnutls_record_send( ((struct scd*)conn)->session, buf, len );
     176       
     177        ssl_errno = SSL_OK;
     178        if( st == GNUTLS_E_AGAIN || st == GNUTLS_E_INTERRUPTED )
     179                ssl_errno = SSL_AGAIN;
     180       
     181        return st;
    166182}
    167183
     
    169185{
    170186        struct scd *conn = conn_;
     187       
     188        if( conn->inpa != -1 )
     189                gaim_input_remove( conn->inpa );
    171190       
    172191        if( conn->established )
     
    184203        return( ((struct scd*)conn)->fd );
    185204}
     205
     206GaimInputCondition ssl_getdirection( void *conn )
     207{
     208        return( gnutls_record_get_direction( ((struct scd*)conn)->session ) ?
     209                GAIM_INPUT_WRITE : GAIM_INPUT_READ );
     210}
  • protocols/ssl_nss.c

    r3e91c3e r8e419cb  
    4545struct scd
    4646{
    47         SslInputFunction func;
     47        ssl_input_function func;
    4848        gpointer data;
    4949        int fd;
     
    9191
    9292
    93 void *ssl_connect( char *host, int port, SslInputFunction func, gpointer data )
     93void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data )
    9494{
    9595        struct scd *conn = g_new0( struct scd, 1 );
  • protocols/ssl_openssl.c

    r3e91c3e r8e419cb  
    4141struct scd
    4242{
    43         SslInputFunction func;
     43        ssl_input_function func;
    4444        gpointer data;
    4545        int fd;
    4646        gboolean established;
    4747       
     48        int inpa;
     49        int lasterr;            /* Necessary for SSL_get_error */
    4850        SSL *ssl;
    4951        SSL_CTX *ssl_ctx;
     
    5456
    5557
    56 void *ssl_connect( char *host, int port, SslInputFunction func, gpointer data )
     58void *ssl_connect( char *host, int port, ssl_input_function func, gpointer data )
    5759{
    5860        struct scd *conn = g_new0( struct scd, 1 );
     
    9395}
    9496
     97static void ssl_handshake( gpointer data, gint source, GaimInputCondition cond );
     98
    9599static void ssl_connected( gpointer data, gint source, GaimInputCondition cond )
    96100{
     
    98102       
    99103        if( source == -1 )
    100                 goto ssl_connected_failure;
    101        
     104                return ssl_handshake( data, -1, cond );
     105       
     106        /* Make it non-blocking at least during the handshake... */
     107        sock_make_nonblocking( conn->fd );
    102108        SSL_set_fd( conn->ssl, conn->fd );
    103109       
    104         if( SSL_connect( conn->ssl ) < 0 )
    105                 goto ssl_connected_failure;
     110        return ssl_handshake( data, source, cond );
     111}       
     112
     113static void ssl_handshake( gpointer data, gint source, GaimInputCondition cond )
     114{
     115        struct scd *conn = data;
     116        int st;
     117       
     118        if( conn->inpa != -1 )
     119        {
     120                gaim_input_remove( conn->inpa );
     121                conn->inpa = -1;
     122        }
     123       
     124        if( ( st = SSL_connect( conn->ssl ) ) < 0 )
     125        {
     126                conn->lasterr = SSL_get_error( conn->ssl, st );
     127                if( conn->lasterr != SSL_ERROR_WANT_READ && conn->lasterr != SSL_ERROR_WANT_WRITE )
     128                        goto ssl_connected_failure;
     129               
     130                conn->inpa = gaim_input_add( conn->fd, ssl_getdirection( conn ), ssl_handshake, data );
     131                return;
     132        }
    106133       
    107134        conn->established = TRUE;
     135        sock_make_blocking( conn->fd );         /* For now... */
    108136        conn->func( conn->data, conn, cond );
    109137        return;
     
    127155int ssl_read( void *conn, char *buf, int len )
    128156{
     157        int st;
     158       
    129159        if( !((struct scd*)conn)->established )
    130                 return( 0 );
    131        
    132         return( SSL_read( ((struct scd*)conn)->ssl, buf, len ) );
     160        {
     161                ssl_errno = SSL_NOHANDSHAKE;
     162                return -1;
     163        }
     164       
     165        st = SSL_read( ((struct scd*)conn)->ssl, buf, len );
     166       
     167        ssl_errno = SSL_OK;
     168        if( st <= 0 )
     169        {
     170                ((struct scd*)conn)->lasterr = SSL_get_error( ((struct scd*)conn)->ssl, st );
     171                if( ((struct scd*)conn)->lasterr == SSL_ERROR_WANT_READ || ((struct scd*)conn)->lasterr == SSL_ERROR_WANT_WRITE )
     172                        ssl_errno = SSL_AGAIN;
     173        }
     174       
     175        return st;
    133176}
    134177
    135178int ssl_write( void *conn, const char *buf, int len )
    136179{
     180        int st;
     181       
    137182        if( !((struct scd*)conn)->established )
    138                 return( 0 );
    139        
    140         return( SSL_write( ((struct scd*)conn)->ssl, buf, len ) );
     183        {
     184                ssl_errno = SSL_NOHANDSHAKE;
     185                return -1;
     186        }
     187       
     188        st = SSL_write( ((struct scd*)conn)->ssl, buf, len );
     189       
     190        ssl_errno = SSL_OK;
     191        if( st <= 0 )
     192        {
     193                ((struct scd*)conn)->lasterr = SSL_get_error( ((struct scd*)conn)->ssl, st );
     194                if( ((struct scd*)conn)->lasterr == SSL_ERROR_WANT_READ || ((struct scd*)conn)->lasterr == SSL_ERROR_WANT_WRITE )
     195                        ssl_errno = SSL_AGAIN;
     196        }
     197       
     198        return st;
    141199}
    142200
     
    144202{
    145203        struct scd *conn = conn_;
     204       
     205        if( conn->inpa != -1 )
     206                gaim_input_remove( conn->inpa );
    146207       
    147208        if( conn->established )
     
    159220        return( ((struct scd*)conn)->fd );
    160221}
     222
     223GaimInputCondition ssl_getdirection( void *conn )
     224{
     225        return( ((struct scd*)conn)->lasterr == SSL_ERROR_WANT_WRITE ? GAIM_INPUT_WRITE : GAIM_INPUT_READ );
     226}
  • protocols/yahoo/Makefile

    r3e91c3e r8e419cb  
    1616
    1717# [SH] Phony targets
    18 all: yahooo.o
     18all: yahoo_mod.o
    1919
    2020.PHONY: all clean distclean
     
    3333        @$(CC) -c $(CFLAGS) $< -o $@
    3434
    35 yahooo.o: $(objects)
    36         @echo '*' Linking yahooo.o
    37         @$(LD) $(LFLAGS) $(objects) -o yahooo.o
     35yahoo_mod.o: $(objects)
     36        @echo '*' Linking yahoo_mod.o
     37        @$(LD) $(LFLAGS) $(objects) -o yahoo_mod.o
  • protocols/yahoo/yahoo_fn.c

    r3e91c3e r8e419cb  
    2525#include "yahoo_fn.h"
    2626
    27 unsigned char table_0[256] = {
     27static const unsigned char table_0[256] = {
    2828   0x5A, 0x41, 0x11, 0x77, 0x29, 0x9C, 0x31, 0xAD,
    2929   0x4A, 0x32, 0x1A, 0x6D, 0x56, 0x9F, 0x39, 0xA6,
     
    5959   0x7B, 0xBE, 0xF9, 0xAF, 0x82, 0x63, 0x47, 0x23 };
    6060
    61 unsigned char table_1[256] = {
     61static const unsigned char table_1[256] = {
    6262   0x08, 0xCB, 0x54, 0xCF, 0x97, 0x53, 0x59, 0xF1,
    6363   0x66, 0xEC, 0xDB, 0x1B, 0xB1, 0xE2, 0x36, 0xEB,
     
    9393   0x05, 0x95, 0xBB, 0x79, 0x61, 0x3E, 0x81, 0xF7 };
    9494
    95 unsigned char table_2[32] = {
     95static const unsigned char table_2[32] = {
    9696   0x19, 0x05, 0x09, 0x1C, 0x0B, 0x1A, 0x12, 0x03,
    9797   0x06, 0x04, 0x0D, 0x1D, 0x15, 0x0E, 0x1B, 0x18,
     
    9999   0x16, 0x0A, 0x10, 0x0F, 0x01, 0x14, 0x11, 0x17 };
    100100
    101 unsigned char table_3[256] = {
     101static const unsigned char table_3[256] = {
    102102   0xBC, 0x1B, 0xCC, 0x1E, 0x5B, 0x59, 0x4F, 0xA8,
    103103   0x62, 0xC6, 0xC1, 0xBB, 0x83, 0x2D, 0xA3, 0xA6,
     
    133133   0x7C, 0xEF, 0xE0, 0x99, 0x09, 0xA0, 0x01, 0x7E };
    134134
    135 unsigned char table_4[32] = {
     135static const unsigned char table_4[32] = {
    136136   0x1F, 0x0B, 0x00, 0x1E, 0x03, 0x0E, 0x15, 0x01,
    137137   0x1A, 0x17, 0x1D, 0x1B, 0x11, 0x0F, 0x0A, 0x12,
     
    139139   0x08, 0x05, 0x10, 0x19, 0x0C, 0x14, 0x16, 0x1C };
    140140
    141 unsigned char table_5[256] = {
     141static const unsigned char table_5[256] = {
    142142   0x9A, 0xAB, 0x61, 0x28, 0x0A, 0x23, 0xFC, 0xBA,
    143143   0x90, 0x22, 0xB7, 0x62, 0xD9, 0x09, 0x91, 0xF4,
     
    173173   0x46, 0x73, 0x69, 0xD5, 0x10, 0xEE, 0x02, 0xEF };
    174174
    175 unsigned char table_6[32] = {
     175static const unsigned char table_6[32] = {
    176176   0x1A, 0x1C, 0x0F, 0x0C, 0x00, 0x02, 0x13, 0x09,
    177177   0x11, 0x05, 0x0D, 0x12, 0x18, 0x0B, 0x04, 0x10,
     
    179179   0x19, 0x1F, 0x01, 0x0E, 0x15, 0x06, 0x0A, 0x1D };
    180180
    181 unsigned char table_7[256] = {
     181static const unsigned char table_7[256] = {
    182182   0x52, 0x11, 0x72, 0xD0, 0x76, 0xD7, 0xAE, 0x03,
    183183   0x7F, 0x19, 0xF4, 0xB8, 0xB3, 0x5D, 0xCA, 0x2D,
     
    213213   0x88, 0x9E, 0x9C, 0x5B, 0x4D, 0x3A, 0x39, 0xEF };
    214214
    215 unsigned char table_8[32] = {
     215static const unsigned char table_8[32] = {
    216216   0x13, 0x08, 0x1E, 0x1D, 0x17, 0x16, 0x07, 0x1F,
    217217   0x0E, 0x03, 0x1A, 0x19, 0x01, 0x12, 0x11, 0x10,
     
    219219   0x1C, 0x18, 0x0A, 0x15, 0x02, 0x1B, 0x06, 0x0D };
    220220
    221 unsigned char table_9[256] = {
     221static const unsigned char table_9[256] = {
    222222   0x20, 0x2A, 0xDA, 0xFE, 0x76, 0x0D, 0xED, 0x39,
    223223   0x51, 0x4C, 0x46, 0x9A, 0xF1, 0xB0, 0x10, 0xC7,
     
    253253   0xF9, 0xF0, 0x2C, 0x74, 0xE9, 0x71, 0xC0, 0x2D };
    254254
    255 unsigned char table_10[32] = {
     255static const unsigned char table_10[32] = {
    256256   0x1D, 0x12, 0x11, 0x0D, 0x1E, 0x19, 0x16, 0x1B,
    257257   0x18, 0x13, 0x07, 0x17, 0x0C, 0x02, 0x00, 0x15,
     
    259259   0x1F, 0x1A, 0x0B, 0x09, 0x0A, 0x14, 0x1C, 0x03 };
    260260
    261 unsigned char table_11[256] = {
     261static const unsigned char table_11[256] = {
    262262   0x6B, 0x1D, 0xC6, 0x0A, 0xB7, 0xAC, 0xB2, 0x11,
    263263   0x29, 0xD3, 0xA2, 0x4D, 0xCB, 0x03, 0xEF, 0xA6,
     
    293293   0x64, 0x76, 0xFF, 0x9F, 0x2E, 0x02, 0xCC, 0x57 };
    294294
    295 unsigned char table_12[32] = {
     295static const unsigned char table_12[32] = {
    296296   0x14, 0x1B, 0x18, 0x00, 0x1F, 0x15, 0x17, 0x07,
    297297   0x11, 0x1A, 0x0E, 0x13, 0x12, 0x06, 0x01, 0x03,
     
    299299   0x0D, 0x1E, 0x04, 0x05, 0x08, 0x16, 0x0A, 0x02 };
    300300
    301 unsigned char table_13[256] = {
     301static const unsigned char table_13[256] = {
    302302   0x37, 0x8A, 0x1B, 0x91, 0xA5, 0x2B, 0x2D, 0x88,
    303303   0x8E, 0xFE, 0x0E, 0xD3, 0xF3, 0xE9, 0x7D, 0xD1,
     
    333333   0x97, 0x4A, 0xB8, 0x7A, 0xF4, 0xFB, 0x04, 0xA8 };
    334334
    335 unsigned char table_14[32] = {
     335static const unsigned char table_14[32] = {
    336336   0x04, 0x14, 0x13, 0x15, 0x1A, 0x1B, 0x0F, 0x16,
    337337   0x02, 0x0D, 0x0C, 0x06, 0x10, 0x17, 0x01, 0x0B,
     
    339339   0x11, 0x09, 0x1D, 0x07, 0x0E, 0x12, 0x03, 0x00 };
    340340
    341 unsigned char table_15[256] = {
     341static const unsigned char table_15[256] = {
    342342   0x61, 0x48, 0x58, 0x41, 0x7F, 0x88, 0x43, 0x42,
    343343   0xD9, 0x80, 0x81, 0xFE, 0xC6, 0x49, 0xD7, 0x2C,
     
    373373   0xAB, 0x8D, 0x02, 0x74, 0xBD, 0x3D, 0x8E, 0xDD };
    374374
    375 unsigned char table_16[256] = {
     375static const unsigned char table_16[256] = {
    376376   0x3F, 0x9C, 0x17, 0xC1, 0x59, 0xC6, 0x23, 0x93,
    377377   0x4B, 0xDF, 0xCB, 0x55, 0x2B, 0xDE, 0xCD, 0xAD,
     
    407407   0xF4, 0xBE, 0xEA, 0x19, 0x43, 0x01, 0xB1, 0x96 };
    408408
    409 unsigned char table_17[256] = {
     409static const unsigned char table_17[256] = {
    410410   0x7E, 0xF1, 0xD3, 0x75, 0x87, 0xA6, 0xED, 0x9E,
    411411   0xA9, 0xD5, 0xC6, 0xBF, 0xE6, 0x6A, 0xEE, 0x4B,
     
    441441   0x9F, 0x99, 0x62, 0xAA, 0xFA, 0x11, 0x0C, 0x52 };
    442442
    443 unsigned char table_18[256] = {
     443static const unsigned char table_18[256] = {
    444444   0x0F, 0x42, 0x3D, 0x86, 0x3E, 0x66, 0xFE, 0x5C,
    445445   0x52, 0xE2, 0xA3, 0xB3, 0xCE, 0x16, 0xCC, 0x95,
     
    475475   0xFA, 0x4E, 0xEF, 0x54, 0xE6, 0x7F, 0xC0, 0x67 };
    476476
    477 unsigned char table_19[256] = {
     477static const unsigned char table_19[256] = {
    478478   0xEA, 0xE7, 0x13, 0x14, 0xB9, 0xC0, 0xC4, 0x42,
    479479   0x49, 0x6E, 0x2A, 0xA6, 0x65, 0x3C, 0x6A, 0x40,
     
    509509   0x1E, 0x0D, 0xAE, 0x7B, 0x5E, 0x61, 0xE9, 0x63 };
    510510
    511 unsigned char table_20[32] = {
     511static const unsigned char table_20[32] = {
    512512   0x0D, 0x0B, 0x11, 0x02, 0x05, 0x1B, 0x08, 0x1D,
    513513   0x04, 0x14, 0x01, 0x09, 0x00, 0x19, 0x1E, 0x15,
     
    515515   0x13, 0x1A, 0x06, 0x17, 0x0E, 0x12, 0x18, 0x03 };
    516516
    517 unsigned char table_21[256] = {
     517static const unsigned char table_21[256] = {
    518518   0x4C, 0x94, 0xAD, 0x66, 0x9E, 0x69, 0x04, 0xA8,
    519519   0x61, 0xE0, 0xE1, 0x3D, 0xFD, 0x9C, 0xFB, 0x19,
     
    549549   0xFF, 0xD8, 0xE7, 0xDD, 0xBB, 0x78, 0xD5, 0x81 };
    550550
    551 unsigned char table_22[32] = {
     551static const unsigned char table_22[32] = {
    552552   0x0B, 0x15, 0x1C, 0x0C, 0x06, 0x0A, 0x1D, 0x16,
    553553   0x12, 0x0E, 0x04, 0x11, 0x1F, 0x0F, 0x07, 0x02,
     
    555555   0x03, 0x00, 0x01, 0x08, 0x09, 0x14, 0x1B, 0x1E };
    556556
    557 unsigned char table_23[256] = {
     557static const unsigned char table_23[256] = {
    558558   0x36, 0x53, 0x2D, 0xD0, 0x7A, 0xF0, 0xD5, 0x1C,
    559559   0x50, 0x61, 0x9A, 0x90, 0x0B, 0x29, 0x20, 0x77,
     
    589589   0x1D, 0x15, 0xC6, 0xBF, 0xA9, 0x43, 0xC0, 0x49 };
    590590
    591 unsigned char table_24[256] = {
     591static const unsigned char table_24[256] = {
    592592   0xDC, 0x5A, 0xE6, 0x59, 0x64, 0xDA, 0x58, 0x40,
    593593   0x95, 0xF8, 0x2A, 0xE0, 0x39, 0x7E, 0x32, 0x89,
     
    623623   0xEA, 0x8D, 0x2D, 0x5F, 0xF6, 0xA7, 0x80, 0x3A };
    624624
    625 unsigned char table_25[32] = {
     625static const unsigned char table_25[32] = {
    626626   0x0A, 0x11, 0x17, 0x03, 0x05, 0x0B, 0x18, 0x13,
    627627   0x09, 0x02, 0x00, 0x1C, 0x0C, 0x08, 0x1B, 0x14,
     
    629629   0x0F, 0x1A, 0x10, 0x04, 0x12, 0x15, 0x07, 0x1F };
    630630
    631 unsigned char table_26[32] = {
     631static const unsigned char table_26[32] = {
    632632   0x19, 0x13, 0x1B, 0x01, 0x1C, 0x0D, 0x0C, 0x15,
    633633   0x0B, 0x00, 0x1A, 0x0F, 0x12, 0x16, 0x08, 0x0A,
     
    635635   0x1F, 0x07, 0x17, 0x05, 0x02, 0x0E, 0x1E, 0x09 };
    636636
    637 unsigned char table_27[256] = {
     637static const unsigned char table_27[256] = {
    638638   0x72, 0xF0, 0x14, 0xCB, 0x61, 0xA5, 0xB2, 0x02,
    639639   0x75, 0x22, 0xC3, 0x9D, 0x5A, 0x63, 0xFA, 0x5F,
     
    669669   0x5E, 0x6F, 0x47, 0x64, 0xBC, 0x9A, 0x60, 0x7E };
    670670
    671 unsigned char table_28[32] = {
     671static const unsigned char table_28[32] = {
    672672   0x15, 0x05, 0x08, 0x19, 0x02, 0x18, 0x1E, 0x07,
    673673   0x0D, 0x0C, 0x1A, 0x06, 0x17, 0x03, 0x10, 0x09,
     
    675675   0x1B, 0x13, 0x0A, 0x16, 0x0E, 0x00, 0x1D, 0x14 };
    676676
    677 unsigned char table_29[256] = {
     677static const unsigned char table_29[256] = {
    678678   0x34, 0x59, 0x05, 0x13, 0x09, 0x1D, 0xDF, 0x77,
    679679   0x11, 0xA5, 0x92, 0x27, 0xCD, 0x7B, 0x5E, 0x80,
     
    709709   0x46, 0x62, 0xB6, 0xB0, 0x15, 0x04, 0x95, 0x4D };
    710710
    711 unsigned char table_30[32] = {
     711static const unsigned char table_30[32] = {
    712712   0x00, 0x1C, 0x0E, 0x0C, 0x06, 0x16, 0x09, 0x12,
    713713   0x01, 0x13, 0x0B, 0x14, 0x11, 0x08, 0x04, 0x18,
     
    715715   0x1E, 0x1F, 0x0F, 0x07, 0x0D, 0x05, 0x1D, 0x0A };
    716716
    717 unsigned char table_31[256] = {
     717static const unsigned char table_31[256] = {
    718718   0xDF, 0xD8, 0x3F, 0xBC, 0x5F, 0xC9, 0x8E, 0x4C,
    719719   0x0B, 0x3C, 0xE5, 0xBF, 0x39, 0xD5, 0x30, 0xDD,
     
    749749   0x92, 0x48, 0xF7, 0x0A, 0xF6, 0xE2, 0x4B, 0x56 };
    750750
    751 unsigned char table_32[256] = {
     751static const unsigned char table_32[256] = {
    752752   0x7B, 0x0F, 0x56, 0x2F, 0x1E, 0x2A, 0x7A, 0xD1,
    753753   0x02, 0x91, 0x4E, 0x37, 0x6C, 0x10, 0xA7, 0xF2,
     
    783783   0x47, 0x6B, 0x8A, 0xA2, 0x9A, 0xA3, 0x45, 0x41 };
    784784
    785 unsigned char table_33[256] = {
     785static const unsigned char table_33[256] = {
    786786   0xDE, 0xD3, 0x79, 0x67, 0x13, 0x5C, 0x04, 0xF2,
    787787   0xD9, 0x9F, 0x65, 0x56, 0xCC, 0x3B, 0xA4, 0x9A,
     
    817817   0x80, 0x3C, 0xEE, 0x47, 0xC6, 0x3A, 0x53, 0xF6 };
    818818
    819 unsigned char table_34[256] = {
     819static const unsigned char table_34[256] = {
    820820   0xF0, 0xE9, 0x3E, 0xD6, 0x89, 0xC8, 0xC7, 0x23,
    821821   0x75, 0x26, 0x5F, 0x9C, 0x57, 0xB8, 0x2A, 0x29,
     
    851851   0x03, 0x05, 0xBF, 0x06, 0x1B, 0xC0, 0x1A, 0x60 };
    852852
    853 unsigned char table_35[256] = {
     853static const unsigned char table_35[256] = {
    854854   0xCC, 0x40, 0xEF, 0x1F, 0xDB, 0xE5, 0x71, 0x51,
    855855   0x3B, 0x0F, 0x7D, 0x9C, 0x83, 0x17, 0x6F, 0x8F,
     
    885885   0x59, 0xC4, 0x9F, 0xD0, 0x66, 0x7B, 0x33, 0xB5 };
    886886
    887 unsigned char table_36[256] = {
     887static const unsigned char table_36[256] = {
    888888   0xDB, 0x6F, 0xFE, 0xB3, 0x5C, 0x1F, 0xB8, 0xBF,
    889889   0xA3, 0x71, 0x11, 0x56, 0x90, 0xE2, 0x63, 0x18,
     
    919919   0x4B, 0xB6, 0x7B, 0x4D, 0xCF, 0x7E, 0x48, 0xE3 };
    920920
    921 unsigned char table_37[256] = {
     921static const unsigned char table_37[256] = {
    922922   0x1F, 0xD6, 0xB1, 0xB3, 0x40, 0xAD, 0xDE, 0xB7,
    923923   0x19, 0xB4, 0xE7, 0x0B, 0x9C, 0x2D, 0xE0, 0xF5,
     
    953953   0x73, 0xC8, 0x86, 0x47, 0xDB, 0xAB, 0x6F, 0x8C };
    954954
    955 unsigned char table_38[256] = {
     955static const unsigned char table_38[256] = {
    956956   0xAA, 0x8D, 0x37, 0x94, 0x99, 0xDD, 0x70, 0x77,
    957957   0x78, 0xC9, 0x0F, 0xFA, 0xE2, 0x05, 0xC2, 0x16,
     
    987987   0x09, 0x76, 0x00, 0x46, 0x4E, 0x53, 0xCE, 0x4A };
    988988
    989 unsigned char table_39[32] = {
     989static const unsigned char table_39[32] = {
    990990   0x12, 0x18, 0x0E, 0x08, 0x16, 0x05, 0x06, 0x00,
    991991   0x11, 0x17, 0x15, 0x1B, 0x14, 0x01, 0x1F, 0x19,
     
    993993   0x0B, 0x13, 0x0C, 0x09, 0x1E, 0x02, 0x1A, 0x1C };
    994994
    995 unsigned char table_40[32] = {
     995static const unsigned char table_40[32] = {
    996996   0x16, 0x02, 0x06, 0x0E, 0x0D, 0x1C, 0x08, 0x0A,
    997997   0x0F, 0x13, 0x0B, 0x18, 0x07, 0x04, 0x14, 0x01,
     
    999999   0x12, 0x19, 0x1D, 0x03, 0x0C, 0x00, 0x09, 0x15 };
    10001000
    1001 unsigned char table_41[32] = {
     1001static const unsigned char table_41[32] = {
    10021002   0x13, 0x18, 0x04, 0x1F, 0x1D, 0x11, 0x03, 0x00,
    10031003   0x10, 0x12, 0x06, 0x0A, 0x1C, 0x07, 0x15, 0x0E,
     
    10051005   0x1A, 0x17, 0x14, 0x1E, 0x0D, 0x0F, 0x19, 0x1B };
    10061006
    1007 unsigned char table_42[32] = {
     1007static const unsigned char table_42[32] = {
    10081008   0x00, 0x08, 0x15, 0x1D, 0x05, 0x18, 0x06, 0x07,
    10091009   0x1F, 0x01, 0x0B, 0x03, 0x19, 0x13, 0x02, 0x1C,
     
    10111011   0x1B, 0x16, 0x10, 0x0D, 0x0A, 0x14, 0x12, 0x04 };
    10121012
    1013 unsigned char table_43[256] = {
     1013static const unsigned char table_43[256] = {
    10141014   0x34, 0xB7, 0x36, 0x85, 0x5F, 0x93, 0x98, 0x70,
    10151015   0x1E, 0x59, 0x83, 0x60, 0x6F, 0xBF, 0xF9, 0xD0,
     
    10451045   0x73, 0x76, 0x3A, 0x21, 0x53, 0xA4, 0x50, 0x6A };
    10461046
    1047 unsigned char table_44[32] = {
     1047static const unsigned char table_44[32] = {
    10481048   0x1A, 0x0E, 0x0A, 0x17, 0x1F, 0x08, 0x10, 0x14,
    10491049   0x0C, 0x0F, 0x09, 0x1C, 0x06, 0x18, 0x1E, 0x12,
     
    10511051   0x16, 0x19, 0x05, 0x1D, 0x02, 0x07, 0x04, 0x1B };
    10521052
    1053 unsigned char table_45[256] = {
     1053static const unsigned char table_45[256] = {
    10541054   0x5E, 0xD6, 0xE2, 0x54, 0x35, 0xC2, 0xAC, 0x9D,
    10551055   0x92, 0x64, 0x57, 0x65, 0xC8, 0xAE, 0x21, 0xA9,
     
    10851085   0xF9, 0x2B, 0x32, 0x8F, 0xFB, 0xC7, 0x07, 0x82 };
    10861086
    1087 unsigned char table_46[256] = {
     1087static const unsigned char table_46[256] = {
    10881088   0x85, 0x78, 0xFE, 0x6C, 0x61, 0xA0, 0x71, 0xCC,
    10891089   0x45, 0x54, 0x7A, 0xE6, 0x82, 0x1D, 0xA6, 0x02,
     
    11191119   0xC7, 0xE4, 0x37, 0xE5, 0xFC, 0xBD, 0x99, 0x41 };
    11201120
    1121 unsigned char table_47[32] = {
     1121static const unsigned char table_47[32] = {
    11221122   0x18, 0x1D, 0x16, 0x10, 0x11, 0x04, 0x1E, 0x08,
    11231123   0x19, 0x0E, 0x0F, 0x02, 0x14, 0x1C, 0x07, 0x17,
     
    11251125   0x13, 0x15, 0x0C, 0x00, 0x06, 0x1F, 0x03, 0x1B };
    11261126
    1127 unsigned char table_48[32] = {
     1127static const unsigned char table_48[32] = {
    11281128   0x13, 0x08, 0x15, 0x01, 0x17, 0x10, 0x0F, 0x1F,
    11291129   0x1D, 0x0D, 0x12, 0x03, 0x06, 0x0A, 0x1C, 0x19,
     
    11311131   0x14, 0x09, 0x0C, 0x18, 0x05, 0x07, 0x0E, 0x0B };
    11321132
    1133 unsigned char table_49[32] = {
     1133static const unsigned char table_49[32] = {
    11341134   0x1F, 0x0F, 0x19, 0x07, 0x18, 0x05, 0x1E, 0x1D,
    11351135   0x15, 0x08, 0x17, 0x10, 0x0A, 0x0E, 0x0C, 0x1B,
     
    11371137   0x12, 0x1C, 0x0B, 0x16, 0x14, 0x01, 0x11, 0x00 };
    11381138
    1139 unsigned char table_50[32] = {
     1139static const unsigned char table_50[32] = {
    11401140   0x16, 0x18, 0x1C, 0x0E, 0x12, 0x00, 0x04, 0x1B,
    11411141   0x1F, 0x13, 0x17, 0x0A, 0x1E, 0x03, 0x0C, 0x01,
     
    11431143   0x06, 0x0D, 0x0B, 0x1D, 0x05, 0x07, 0x11, 0x1A };
    11441144
    1145 unsigned char table_51[32] = {
     1145static const unsigned char table_51[32] = {
    11461146   0x1C, 0x0D, 0x1B, 0x07, 0x17, 0x0E, 0x06, 0x01,
    11471147   0x12, 0x19, 0x03, 0x0B, 0x10, 0x08, 0x00, 0x1E,
     
    11491149   0x0F, 0x11, 0x05, 0x09, 0x15, 0x16, 0x1F, 0x14 };
    11501150
    1151 unsigned char table_52[256] = {
     1151static const unsigned char table_52[256] = {
    11521152   0x34, 0x0B, 0x47, 0xA3, 0x56, 0x30, 0x73, 0xD4,
    11531153   0x4B, 0xF6, 0xA6, 0x80, 0x22, 0x95, 0xA5, 0xBB,
     
    11831183   0x01, 0x0C, 0x5D, 0x7D, 0xB8, 0xBE, 0x6A, 0x16 };
    11841184
    1185 unsigned char table_53[256] = {
     1185static const unsigned char table_53[256] = {
    11861186   0xE3, 0xF4, 0x8D, 0x72, 0x45, 0x32, 0x9D, 0xCE,
    11871187   0x1F, 0x6B, 0xBC, 0xDC, 0xF1, 0xEC, 0x5A, 0x3B,
     
    12171217   0xAB, 0x64, 0xE0, 0xBE, 0xDA, 0xBD, 0x96, 0x94 };
    12181218
    1219 unsigned char table_54[32] = {
     1219static const unsigned char table_54[32] = {
    12201220   0x01, 0x02, 0x1D, 0x10, 0x0E, 0x11, 0x08, 0x14,
    12211221   0x12, 0x09, 0x15, 0x17, 0x16, 0x04, 0x06, 0x1B,
     
    12231223   0x0C, 0x0B, 0x0D, 0x05, 0x0F, 0x00, 0x19, 0x03 };
    12241224
    1225 unsigned char table_55[32] = {
     1225static const unsigned char table_55[32] = {
    12261226   0x01, 0x12, 0x13, 0x09, 0x0B, 0x19, 0x03, 0x0E,
    12271227   0x02, 0x1F, 0x1D, 0x1B, 0x1E, 0x11, 0x06, 0x05,
     
    12291229   0x18, 0x10, 0x0F, 0x17, 0x1C, 0x0A, 0x04, 0x14 };
    12301230
    1231 unsigned char table_56[256] = {
     1231static const unsigned char table_56[256] = {
    12321232   0xEF, 0x06, 0x5F, 0x11, 0x4B, 0x60, 0x13, 0xBB,
    12331233   0x79, 0xD7, 0xE4, 0x6D, 0x22, 0xB4, 0x15, 0x50,
     
    12631263   0x96, 0xD5, 0xEB, 0x64, 0x8A, 0xC8, 0x7A, 0xBE };
    12641264
    1265 unsigned char table_57[256] = {
     1265static const unsigned char table_57[256] = {
    12661266   0xD1, 0x9B, 0x15, 0x06, 0xB4, 0xF6, 0x97, 0xF0,
    12671267   0xC6, 0x5B, 0x88, 0x12, 0x25, 0xFA, 0x7B, 0x79,
     
    12971297   0x4E, 0x3C, 0x84, 0x14, 0x28, 0x3A, 0xE9, 0xC0 };
    12981298
    1299 unsigned char table_58[256] = {
     1299static const unsigned char table_58[256] = {
    13001300   0xE9, 0x81, 0x60, 0xA7, 0x18, 0xA0, 0x0F, 0x55,
    13011301   0x2B, 0x52, 0xE0, 0x8B, 0x9D, 0x85, 0xD2, 0xA3,
     
    13311331   0x68, 0x1E, 0xF6, 0xA6, 0x6C, 0xB2, 0xD1, 0x58 };
    13321332
    1333 unsigned char table_59[256] = {
     1333static const unsigned char table_59[256] = {
    13341334   0x4C, 0x85, 0x2B, 0x14, 0xCC, 0x4D, 0x5F, 0xD7,
    13351335   0xCE, 0x28, 0xC5, 0x0B, 0xA1, 0x99, 0x08, 0xDE,
     
    13651365   0x5D, 0x1A, 0x8D, 0xC1, 0x58, 0x48, 0xAD, 0x0F };
    13661366
    1367 unsigned char table_60[32] = {
     1367static const unsigned char table_60[32] = {
    13681368   0x1C, 0x06, 0x1E, 0x10, 0x1D, 0x05, 0x00, 0x0E,
    13691369   0x0C, 0x02, 0x11, 0x19, 0x15, 0x18, 0x16, 0x07,
     
    13711371   0x03, 0x08, 0x12, 0x04, 0x1B, 0x0A, 0x17, 0x1A };
    13721372
    1373 unsigned char table_61[256] = {
     1373static const unsigned char table_61[256] = {
    13741374   0xC5, 0xA6, 0xF2, 0x6B, 0x4B, 0x58, 0xE0, 0x41,
    13751375   0xC6, 0x2F, 0x13, 0xFE, 0xC1, 0x34, 0x3F, 0x24,
     
    14051405   0xCF, 0x60, 0xAA, 0xA4, 0xEB, 0xC4, 0x4E, 0xC2 };
    14061406
    1407 unsigned char table_62[256] = {
     1407static const unsigned char table_62[256] = {
    14081408   0x01, 0x59, 0xEC, 0xFC, 0x51, 0xD2, 0xE4, 0x9D,
    14091409   0xAA, 0x61, 0xD5, 0xCA, 0x63, 0x5D, 0xCE, 0x36,
     
    14391439   0xCF, 0xE9, 0xDB, 0xD3, 0x02, 0x9A, 0x0E, 0x5F };
    14401440
    1441 unsigned char table_63[256] = {
     1441static const unsigned char table_63[256] = {
    14421442   0x0C, 0x02, 0xEE, 0x94, 0x2D, 0x76, 0x96, 0x75,
    14431443   0x21, 0xDC, 0x37, 0x03, 0xC0, 0xF7, 0xDF, 0xEF,
     
    14731473   0x8C, 0xE2, 0x83, 0xA7, 0xD6, 0x0E, 0xB3, 0xDD };
    14741474
    1475 unsigned char table_64[32] = {
     1475static const unsigned char table_64[32] = {
    14761476   0x03, 0x05, 0x0D, 0x09, 0x1A, 0x16, 0x08, 0x10,
    14771477   0x06, 0x1E, 0x1C, 0x15, 0x02, 0x04, 0x17, 0x0C,
     
    14791479   0x0E, 0x00, 0x1D, 0x1F, 0x01, 0x0F, 0x07, 0x12 };
    14801480
    1481 unsigned char table_65[32] = {
     1481static const unsigned char table_65[32] = {
    14821482   0x01, 0x0A, 0x1E, 0x14, 0x10, 0x1D, 0x0D, 0x17,
    14831483   0x0E, 0x0C, 0x0F, 0x12, 0x04, 0x1A, 0x05, 0x02,
     
    14851485   0x11, 0x00, 0x16, 0x06, 0x03, 0x18, 0x15, 0x07 };
    14861486
    1487 unsigned char table_66[32] = {
     1487static const unsigned char table_66[32] = {
    14881488   0x1C, 0x18, 0x0C, 0x09, 0x05, 0x03, 0x15, 0x12,
    14891489   0x0D, 0x02, 0x08, 0x0E, 0x19, 0x07, 0x13, 0x17,
     
    14911491   0x0F, 0x10, 0x01, 0x1B, 0x00, 0x04, 0x1A, 0x16 };
    14921492
    1493 unsigned char table_67[256] = {
     1493static const unsigned char table_67[256] = {
    14941494   0x6B, 0x49, 0xC8, 0x86, 0xFF, 0xC0, 0x5D, 0xEF,
    14951495   0xF7, 0x06, 0xE0, 0x98, 0xA9, 0x72, 0x71, 0xD5,
     
    15251525   0x24, 0x43, 0x21, 0x83, 0xFB, 0xFD, 0x8B, 0x96 };
    15261526
    1527 unsigned char table_68[256] = {
     1527static const unsigned char table_68[256] = {
    15281528   0x93, 0xFF, 0x83, 0x70, 0x12, 0x2D, 0x1C, 0xD6,
    15291529   0xF9, 0xEE, 0xCF, 0x94, 0x7B, 0xB5, 0xA4, 0x84,
     
    15591559   0x8C, 0x6D, 0x91, 0x63, 0x3A, 0x4D, 0xC1, 0x01 };
    15601560
    1561 unsigned char table_69[256] = {
     1561static const unsigned char table_69[256] = {
    15621562   0x21, 0x6B, 0x9B, 0xAE, 0x11, 0x5A, 0x91, 0xC2,
    15631563   0x47, 0x8E, 0x87, 0x86, 0x4F, 0xFC, 0x8F, 0x66,
     
    15931593   0x73, 0xDB, 0xB6, 0x83, 0xCE, 0x1E, 0xC1, 0x3C };
    15941594
    1595 unsigned char table_70[256] = {
     1595static const unsigned char table_70[256] = {
    15961596   0x54, 0x23, 0xF1, 0x09, 0x9D, 0xEB, 0x26, 0xD9,
    15971597   0x6C, 0xC1, 0xBC, 0x3D, 0x6E, 0xB0, 0x5F, 0xE2,
     
    16271627   0x49, 0x84, 0x38, 0xC7, 0xE3, 0xD4, 0x1A, 0xBF };
    16281628
    1629 unsigned char table_71[32] = {
     1629static const unsigned char table_71[32] = {
    16301630   0x17, 0x13, 0x0E, 0x1A, 0x0D, 0x18, 0x19, 0x10,
    16311631   0x14, 0x11, 0x16, 0x05, 0x04, 0x00, 0x12, 0x0A,
     
    16331633   0x0C, 0x06, 0x1B, 0x08, 0x1D, 0x01, 0x15, 0x1E };
    16341634
    1635 unsigned char table_72[256] = {
     1635static const unsigned char table_72[256] = {
    16361636   0xC9, 0xA7, 0x1B, 0xEC, 0x2B, 0x8B, 0xB0, 0xEB,
    16371637   0x7F, 0x39, 0x25, 0xD9, 0x1D, 0xD5, 0x67, 0xA0,
     
    16671667   0x08, 0x53, 0xF2, 0xB9, 0x5A, 0x3E, 0xE9, 0xD2 };
    16681668
    1669 unsigned char table_73[256] = {
     1669static const unsigned char table_73[256] = {
    16701670   0x36, 0x37, 0xED, 0xD8, 0xBF, 0xD7, 0x12, 0xB7,
    16711671   0x40, 0x32, 0x19, 0x4A, 0x44, 0x2A, 0xCE, 0xA5,
     
    17011701   0xFF, 0x90, 0x6B, 0xBC, 0x54, 0x95, 0xBD, 0x07 };
    17021702
    1703 unsigned char table_74[256] = {
     1703static const unsigned char table_74[256] = {
    17041704   0xA7, 0xCF, 0x99, 0x1A, 0x13, 0xC7, 0xE9, 0xC4,
    17051705   0xB6, 0x0E, 0x15, 0x09, 0xFF, 0xDF, 0xBE, 0x03,
     
    17351735   0x2F, 0xD8, 0xC3, 0x7C, 0x9C, 0x98, 0xEA, 0x71 };
    17361736
    1737 unsigned char table_75[256] = {
     1737static const unsigned char table_75[256] = {
    17381738   0xE7, 0xA5, 0x30, 0xE1, 0x9D, 0x81, 0xBE, 0x83,
    17391739   0xB2, 0x1E, 0xE4, 0x69, 0x2F, 0x2B, 0x0D, 0xEB,
     
    17691769   0x89, 0x46, 0x78, 0xDC, 0x32, 0x8B, 0x67, 0x36 };
    17701770
    1771 unsigned char table_76[256] = {
     1771static const unsigned char table_76[256] = {
    17721772   0x3D, 0x66, 0x40, 0xC5, 0x1D, 0xF5, 0xE7, 0xB7,
    17731773   0x2C, 0x23, 0x09, 0xC2, 0x68, 0xE6, 0xD3, 0x8D,
     
    18031803   0xD1, 0x95, 0xC3, 0xA0, 0x0F, 0xCA, 0xAC, 0xFC };
    18041804
    1805 unsigned char table_77[32] = {
     1805static const unsigned char table_77[32] = {
    18061806   0x1C, 0x0D, 0x1E, 0x01, 0x06, 0x16, 0x18, 0x17,
    18071807   0x0B, 0x1F, 0x04, 0x0F, 0x00, 0x19, 0x08, 0x0A,
     
    18091809   0x1A, 0x12, 0x13, 0x0E, 0x1D, 0x10, 0x02, 0x1B };
    18101810
    1811 unsigned char table_78[32] = {
     1811static const unsigned char table_78[32] = {
    18121812   0x0E, 0x02, 0x17, 0x12, 0x1E, 0x09, 0x15, 0x03,
    18131813   0x01, 0x0B, 0x0F, 0x11, 0x10, 0x0A, 0x16, 0x06,
     
    18151815   0x13, 0x0D, 0x1B, 0x08, 0x19, 0x14, 0x05, 0x1A };
    18161816
    1817 unsigned char table_79[32] = {
     1817static const unsigned char table_79[32] = {
    18181818   0x12, 0x0B, 0x11, 0x01, 0x07, 0x0E, 0x1A, 0x0D,
    18191819   0x1E, 0x18, 0x14, 0x1F, 0x0A, 0x17, 0x19, 0x1B,
     
    18211821   0x09, 0x06, 0x04, 0x16, 0x15, 0x1C, 0x05, 0x03 };
    18221822
    1823 unsigned char table_80[256] = {
     1823static const unsigned char table_80[256] = {
    18241824   0x14, 0xE7, 0x31, 0x0F, 0xD1, 0x5F, 0xED, 0x1E,
    18251825   0xA6, 0x77, 0x20, 0x57, 0x34, 0x64, 0x33, 0x0B,
     
    18551855   0x39, 0xB9, 0xC0, 0x22, 0xF1, 0x4D, 0x90, 0xFC };
    18561856
    1857 unsigned char table_81[32] = {
     1857static const unsigned char table_81[32] = {
    18581858   0x03, 0x02, 0x1D, 0x0E, 0x09, 0x1A, 0x0C, 0x11,
    18591859   0x1C, 0x0D, 0x08, 0x12, 0x19, 0x10, 0x04, 0x17,
     
    18611861   0x1E, 0x0B, 0x0F, 0x01, 0x07, 0x14, 0x1F, 0x06 };
    18621862
    1863 unsigned char table_82[256] = {
     1863static const unsigned char table_82[256] = {
    18641864   0x53, 0xD3, 0x64, 0x89, 0x7D, 0xA5, 0x66, 0xA4,
    18651865   0x09, 0x46, 0x17, 0x2C, 0xAF, 0x8C, 0x21, 0x5F,
     
    18951895   0x6A, 0x78, 0xB5, 0x71, 0x56, 0x87, 0x7F, 0x86 };
    18961896
    1897 unsigned char table_83[32] = {
     1897static const unsigned char table_83[32] = {
    18981898   0x1B, 0x0A, 0x1F, 0x01, 0x10, 0x08, 0x0E, 0x18,
    18991899   0x06, 0x04, 0x00, 0x1C, 0x0C, 0x19, 0x0D, 0x16,
     
    19011901   0x17, 0x1E, 0x1A, 0x1D, 0x0B, 0x11, 0x14, 0x15 };
    19021902
    1903 unsigned char table_84[32] = {
     1903static const unsigned char table_84[32] = {
    19041904   0x02, 0x1A, 0x0D, 0x15, 0x01, 0x16, 0x1E, 0x00,
    19051905   0x08, 0x1B, 0x04, 0x10, 0x1C, 0x18, 0x19, 0x14,
     
    19071907   0x1D, 0x17, 0x13, 0x06, 0x0F, 0x05, 0x09, 0x1F };
    19081908
    1909 unsigned char table_85[256] = {
     1909static const unsigned char table_85[256] = {
    19101910   0xC6, 0x7C, 0xCE, 0xBD, 0x84, 0x3E, 0x0B, 0xD8,
    19111911   0xFE, 0xCC, 0x46, 0x50, 0xD1, 0xFB, 0xA0, 0x6D,
     
    19411941   0x2D, 0x57, 0xE7, 0x82, 0x1E, 0x37, 0x63, 0x43 };
    19421942
    1943 unsigned char table_86[32] = {
     1943static const unsigned char table_86[32] = {
    19441944   0x11, 0x07, 0x0F, 0x0A, 0x19, 0x1D, 0x0B, 0x09,
    19451945   0x1C, 0x1E, 0x14, 0x06, 0x0C, 0x16, 0x13, 0x04,
     
    19471947   0x10, 0x1A, 0x1F, 0x01, 0x17, 0x0E, 0x03, 0x1B };
    19481948
    1949 unsigned char table_87[32] = {
     1949static const unsigned char table_87[32] = {
    19501950   0x17, 0x0E, 0x1D, 0x13, 0x0B, 0x19, 0x03, 0x06,
    19511951   0x09, 0x01, 0x0D, 0x15, 0x1C, 0x16, 0x18, 0x1B,
     
    19531953   0x02, 0x04, 0x07, 0x1A, 0x14, 0x0A, 0x0C, 0x05 };
    19541954
    1955 unsigned char table_88[32] = {
     1955static const unsigned char table_88[32] = {
    19561956   0x09, 0x08, 0x17, 0x10, 0x0A, 0x07, 0x1C, 0x1F,
    19571957   0x04, 0x0E, 0x01, 0x0C, 0x0D, 0x1B, 0x03, 0x15,
     
    19591959   0x05, 0x11, 0x14, 0x00, 0x16, 0x1D, 0x12, 0x13 };
    19601960
    1961 unsigned char table_89[32] = {
     1961static const unsigned char table_89[32] = {
    19621962   0x15, 0x1C, 0x1D, 0x14, 0x0F, 0x1A, 0x05, 0x02,
    19631963   0x07, 0x09, 0x06, 0x08, 0x1F, 0x00, 0x10, 0x13,
     
    19651965   0x12, 0x04, 0x11, 0x0A, 0x01, 0x0B, 0x17, 0x19 };
    19661966
    1967 unsigned char table_90[256] = {
     1967static const unsigned char table_90[256] = {
    19681968   0x62, 0x36, 0x64, 0x0E, 0x4C, 0x6C, 0xBE, 0xCF,
    19691969   0x25, 0x5A, 0x3D, 0x12, 0x54, 0x9F, 0xE7, 0xA5,
     
    19991999   0x20, 0x94, 0x45, 0xED, 0xDC, 0xBD, 0x7E, 0x50 };
    20002000
    2001 unsigned char table_91[32] = {
     2001static const unsigned char table_91[32] = {
    20022002   0x03, 0x04, 0x0C, 0x18, 0x10, 0x0D, 0x13, 0x1B,
    20032003   0x1F, 0x07, 0x11, 0x17, 0x1C, 0x1D, 0x05, 0x06,
     
    20052005   0x14, 0x16, 0x00, 0x15, 0x19, 0x09, 0x0F, 0x1E };
    20062006
    2007 unsigned char table_92[32] = {
     2007static const unsigned char table_92[32] = {
    20082008   0x1E, 0x10, 0x01, 0x07, 0x11, 0x16, 0x15, 0x17,
    20092009   0x1F, 0x14, 0x0C, 0x1C, 0x06, 0x03, 0x00, 0x18,
     
    20112011   0x0F, 0x12, 0x0B, 0x13, 0x0A, 0x04, 0x1D, 0x1A };
    20122012
    2013 unsigned char table_93[256] = {
     2013static const unsigned char table_93[256] = {
    20142014   0x76, 0x78, 0xA2, 0x94, 0x0E, 0x7F, 0xDF, 0xC1,
    20152015   0xB9, 0xE1, 0x3D, 0x59, 0x6F, 0x1E, 0x53, 0x99,
     
    20452045   0x24, 0x34, 0xE2, 0xEC, 0x85, 0x47, 0xF4, 0xB2 };
    20462046
    2047 unsigned char table_94[32] = {
     2047static const unsigned char table_94[32] = {
    20482048   0x1C, 0x07, 0x05, 0x1A, 0x10, 0x1D, 0x14, 0x12,
    20492049   0x08, 0x0F, 0x0C, 0x01, 0x04, 0x1B, 0x16, 0x0A,
     
    20512051   0x0E, 0x09, 0x15, 0x19, 0x03, 0x18, 0x00, 0x0B };
    20522052
    2053 unsigned char table_95[32] = {
     2053static const unsigned char table_95[32] = {
    20542054   0x12, 0x10, 0x11, 0x15, 0x03, 0x0A, 0x14, 0x05,
    20552055   0x1D, 0x07, 0x17, 0x0D, 0x09, 0x08, 0x1B, 0x1F,
     
    20572057   0x1E, 0x1C, 0x01, 0x0C, 0x1A, 0x0F, 0x13, 0x16 };
    20582058
    2059 unsigned char table_96[256] = {
     2059static const unsigned char table_96[256] = {
    20602060   0x1C, 0x6E, 0xCD, 0xB4, 0xB3, 0x93, 0xA8, 0x2E,
    20612061   0x4F, 0x09, 0xE3, 0x72, 0x64, 0x13, 0x21, 0xF5,
     
    20912091   0x59, 0xCE, 0xE1, 0x57, 0x20, 0x58, 0x51, 0xD8 };
    20922092
    2093 unsigned char table_97[256] = {
     2093static const unsigned char table_97[256] = {
    20942094   0x15, 0x2D, 0xAF, 0x36, 0xCF, 0xD3, 0xD0, 0xED,
    20952095   0xB2, 0x1B, 0xFE, 0x92, 0xBD, 0xAD, 0x58, 0x0F,
     
    21252125   0x83, 0x25, 0x9F, 0xD9, 0x99, 0xC1, 0xFD, 0xB3 };
    21262126
    2127 unsigned char table_98[256] = {
     2127static const unsigned char table_98[256] = {
    21282128   0xC8, 0xE6, 0x38, 0x93, 0xE5, 0x03, 0x18, 0x1F,
    21292129   0xE9, 0x5A, 0xB6, 0xAF, 0xC3, 0x95, 0x00, 0x51,
     
    21592159   0x54, 0x3A, 0x13, 0x09, 0x2C, 0xB5, 0xC7, 0x63 };
    21602160
    2161 unsigned char table_99[32] = {
     2161static const unsigned char table_99[32] = {
    21622162   0x19, 0x00, 0x10, 0x18, 0x09, 0x11, 0x13, 0x1D,
    21632163   0x08, 0x1A, 0x02, 0x05, 0x03, 0x17, 0x12, 0x01,
     
    21652165   0x0E, 0x16, 0x1E, 0x04, 0x1B, 0x0A, 0x0C, 0x1C };
    21662166
    2167 unsigned char table_100[256] = {
     2167static const unsigned char table_100[256] = {
    21682168   0x9B, 0x3A, 0xAE, 0x60, 0x27, 0x67, 0x1E, 0x4E,
    21692169   0x91, 0xDA, 0x85, 0x43, 0x5C, 0xCC, 0x89, 0x55,
     
    21992199   0x30, 0x0C, 0xB2, 0x7B, 0xBE, 0xFB, 0x23, 0x2C };
    22002200
    2201 unsigned char table_101[32] = {
     2201static const unsigned char table_101[32] = {
    22022202   0x18, 0x08, 0x14, 0x17, 0x03, 0x10, 0x19, 0x04,
    22032203   0x0D, 0x1C, 0x06, 0x1D, 0x1E, 0x12, 0x11, 0x0B,
     
    22052205   0x15, 0x0A, 0x0C, 0x1A, 0x00, 0x01, 0x1F, 0x09 };
    22062206
    2207 unsigned char table_102[32] = {
     2207static const unsigned char table_102[32] = {
    22082208   0x17, 0x1F, 0x0E, 0x05, 0x13, 0x0C, 0x14, 0x1A,
    22092209   0x0F, 0x01, 0x12, 0x1C, 0x00, 0x07, 0x0D, 0x02,
     
    22112211   0x06, 0x15, 0x0A, 0x19, 0x09, 0x08, 0x1B, 0x0B };
    22122212
    2213 unsigned char table_103[32] = {
     2213static const unsigned char table_103[32] = {
    22142214   0x0F, 0x09, 0x1E, 0x11, 0x0D, 0x08, 0x10, 0x00,
    22152215   0x01, 0x1F, 0x1D, 0x1C, 0x12, 0x04, 0x07, 0x05,
     
    22172217   0x18, 0x0B, 0x0A, 0x13, 0x0C, 0x0E, 0x03, 0x06 };
    22182218
    2219 unsigned char table_104[256] = {
     2219static const unsigned char table_104[256] = {
    22202220   0xA4, 0x9F, 0x78, 0x39, 0x3D, 0x81, 0x51, 0x24,
    22212221   0x46, 0x2A, 0x56, 0xE8, 0xDF, 0x73, 0xA8, 0xA2,
     
    22512251   0x97, 0xBB, 0x37, 0x8C, 0x54, 0x53, 0x9E, 0x8F };
    22522252
    2253 unsigned char table_105[256] = {
     2253static const unsigned char table_105[256] = {
    22542254   0x7B, 0x35, 0x11, 0x79, 0x07, 0x2F, 0xF6, 0x82,
    22552255   0x8E, 0xB4, 0x6E, 0xD2, 0x6D, 0xC5, 0x8C, 0x1C,
     
    22852285   0xBA, 0x1E, 0x44, 0x87, 0x45, 0x9F, 0xC9, 0x94 };
    22862286
    2287 unsigned char table_106[32] = {
     2287static const unsigned char table_106[32] = {
    22882288   0x03, 0x11, 0x07, 0x1B, 0x0F, 0x14, 0x0C, 0x01,
    22892289   0x04, 0x02, 0x09, 0x0A, 0x05, 0x12, 0x06, 0x1F,
     
    22912291   0x1E, 0x1D, 0x17, 0x19, 0x13, 0x16, 0x0B, 0x1A };
    22922292
    2293 unsigned char table_107[32] = {
     2293static const unsigned char table_107[32] = {
    22942294   0x13, 0x1B, 0x06, 0x11, 0x1C, 0x07, 0x08, 0x0E,
    22952295   0x10, 0x05, 0x09, 0x18, 0x04, 0x15, 0x1E, 0x0F,
     
    22972297   0x03, 0x0C, 0x0A, 0x1D, 0x14, 0x01, 0x16, 0x0B };
    22982298
    2299 unsigned char table_108[256] = {
     2299static const unsigned char table_108[256] = {
    23002300   0x99, 0xA3, 0x48, 0xE8, 0x5A, 0x7D, 0x97, 0xCA,
    23012301   0x7F, 0x06, 0x9B, 0x04, 0xE0, 0xF3, 0x18, 0xAE,
     
    23312331   0xCC, 0xE2, 0x44, 0x73, 0xBE, 0x26, 0x8C, 0x5B };
    23322332
    2333 unsigned char table_109[256] = {
     2333static const unsigned char table_109[256] = {
    23342334   0xE3, 0x95, 0xDB, 0x09, 0x82, 0x0A, 0x8F, 0x9E,
    23352335   0xC9, 0xDC, 0x28, 0x35, 0x0F, 0x8B, 0xA8, 0xA5,
     
    23652365   0x1E, 0xF4, 0xD5, 0xB1, 0x5C, 0x25, 0xE8, 0x1C };
    23662366
    2367 unsigned char table_110[256] = {
     2367static const unsigned char table_110[256] = {
    23682368   0xC3, 0x06, 0x3C, 0xCB, 0xD2, 0x44, 0x9D, 0x48,
    23692369   0x28, 0xAA, 0xA9, 0xD0, 0x64, 0x25, 0x56, 0xCA,
     
    23992399   0x4B, 0xCF, 0xB4, 0x2F, 0xBB, 0xEF, 0xDB, 0x33 };
    24002400
    2401 unsigned char table_111[32] = {
     2401static const unsigned char table_111[32] = {
    24022402   0x09, 0x0F, 0x00, 0x15, 0x12, 0x17, 0x1A, 0x0D,
    24032403   0x1C, 0x0B, 0x01, 0x0A, 0x05, 0x1E, 0x1D, 0x0C,
     
    24052405   0x10, 0x16, 0x11, 0x1F, 0x04, 0x06, 0x02, 0x13 };
    24062406
    2407 unsigned char table_112[256] = {
     2407static const unsigned char table_112[256] = {
    24082408   0xF9, 0x7D, 0xBE, 0xD5, 0x9F, 0xB8, 0x95, 0x43,
    24092409   0xDB, 0xAE, 0x7E, 0xEC, 0x5B, 0x58, 0x18, 0x49,
     
    24392439   0xA1, 0xCC, 0xDF, 0x60, 0xD8, 0x5A, 0xE6, 0xD4 };
    24402440
    2441 unsigned char table_113[256] = {
     2441static const unsigned char table_113[256] = {
    24422442   0x46, 0x9D, 0x39, 0xB2, 0x8D, 0x3B, 0x59, 0x5A,
    24432443   0xD0, 0x9C, 0xE4, 0x04, 0x01, 0xE2, 0xB3, 0xD2,
     
    24732473   0xFE, 0x7B, 0x67, 0xFF, 0x10, 0xEC, 0xC6, 0x86 };
    24742474
    2475 unsigned char table_114[32] = {
     2475static const unsigned char table_114[32] = {
    24762476   0x11, 0x10, 0x04, 0x1D, 0x08, 0x15, 0x1A, 0x1B,
    24772477   0x14, 0x18, 0x0F, 0x17, 0x16, 0x07, 0x1E, 0x0E,
     
    24792479   0x1F, 0x19, 0x09, 0x1C, 0x01, 0x0D, 0x03, 0x05 };
    24802480
    2481 unsigned char table_115[256] = {
     2481static const unsigned char table_115[256] = {
    24822482   0xB7, 0xBB, 0x63, 0x0D, 0xF0, 0x33, 0x5A, 0x05,
    24832483   0xF2, 0x7F, 0x64, 0xDB, 0x51, 0xC9, 0x2C, 0x85,
     
    25132513   0x8C, 0x17, 0xB5, 0xEB, 0xD5, 0xF3, 0x0B, 0x3C };
    25142514
    2515 unsigned char table_116[32] = {
     2515static const unsigned char table_116[32] = {
    25162516   0x00, 0x05, 0x10, 0x1C, 0x0C, 0x1A, 0x04, 0x1B,
    25172517   0x0A, 0x0D, 0x14, 0x0B, 0x07, 0x03, 0x12, 0x1E,
     
    25192519   0x19, 0x18, 0x16, 0x02, 0x13, 0x0E, 0x17, 0x1D };
    25202520
    2521 unsigned char table_117[256] = {
     2521static const unsigned char table_117[256] = {
    25222522   0xD0, 0x9A, 0xAB, 0xA8, 0xA7, 0xDF, 0x28, 0xCE,
    25232523   0x3E, 0x51, 0xBF, 0x76, 0x03, 0xA0, 0x53, 0x3F,
     
    25532553   0xC1, 0xFD, 0x92, 0xA1, 0xF7, 0xAE, 0xDC, 0x58 };
    25542554
    2555 unsigned char table_118[256] = {
     2555static const unsigned char table_118[256] = {
    25562556   0x38, 0xA0, 0xA6, 0xFC, 0x7C, 0x5A, 0x97, 0x1D,
    25572557   0xFD, 0x00, 0x20, 0xA2, 0x72, 0x10, 0x1F, 0x48,
     
    25872587   0xD9, 0x2F, 0x02, 0xAC, 0x30, 0x6A, 0xD6, 0x95 };
    25882588
    2589 unsigned char table_119[32] = {
     2589static const unsigned char table_119[32] = {
    25902590   0x14, 0x0A, 0x1C, 0x00, 0x0C, 0x1F, 0x1E, 0x0B,
    25912591   0x12, 0x1D, 0x17, 0x08, 0x07, 0x04, 0x09, 0x10,
     
    25932593   0x18, 0x02, 0x06, 0x01, 0x19, 0x16, 0x13, 0x0F };
    25942594
    2595 unsigned char table_120[256] = {
     2595static const unsigned char table_120[256] = {
    25962596   0xCE, 0x89, 0xB2, 0x72, 0x04, 0x77, 0x64, 0xAE,
    25972597   0x80, 0x99, 0xB5, 0x00, 0x7B, 0x50, 0x9D, 0xE3,
     
    26272627   0x5E, 0xCA, 0xFD, 0x11, 0xA3, 0xC7, 0xC0, 0x91 };
    26282628
    2629 unsigned char table_121[32] = {
     2629static const unsigned char table_121[32] = {
    26302630   0x1E, 0x12, 0x06, 0x1D, 0x15, 0x1F, 0x13, 0x0B,
    26312631   0x10, 0x0D, 0x1C, 0x01, 0x0A, 0x0E, 0x02, 0x19,
     
    26332633   0x14, 0x08, 0x18, 0x05, 0x09, 0x0F, 0x1B, 0x07 };
    26342634
    2635 unsigned char table_122[256] = {
     2635static const unsigned char table_122[256] = {
    26362636   0x85, 0xDF, 0x7F, 0x7C, 0x56, 0xF0, 0x0C, 0x7D,
    26372637   0x76, 0xA8, 0x58, 0x31, 0x25, 0x8A, 0x0D, 0x23,
     
    26672667   0xCE, 0x2D, 0x4E, 0x83, 0xC3, 0x69, 0xEE, 0xB2 };
    26682668
    2669 unsigned char table_123[256] = {
     2669static const unsigned char table_123[256] = {
    26702670   0x9D, 0xFB, 0x3C, 0x81, 0xAA, 0x05, 0xB2, 0xBE,
    26712671   0xD1, 0x5F, 0x4C, 0xE0, 0xA3, 0xF4, 0xDE, 0x35,
     
    27012701   0x48, 0x77, 0xD0, 0x0A, 0x8A, 0x3A, 0x43, 0x79 };
    27022702
    2703 unsigned char table_124[256] = {
     2703static const unsigned char table_124[256] = {
    27042704   0x6C, 0xC3, 0x28, 0x2F, 0x42, 0x4B, 0x7C, 0x3C,
    27052705   0xCE, 0x24, 0xC8, 0x51, 0x25, 0x3F, 0x49, 0x8D,
     
    27352735   0x62, 0x1B, 0xDE, 0x91, 0x87, 0x97, 0x05, 0x2E };
    27362736
    2737 unsigned char table_125[32] = {
     2737static const unsigned char table_125[32] = {
    27382738   0x1A, 0x18, 0x12, 0x15, 0x00, 0x1C, 0x01, 0x0B,
    27392739   0x19, 0x1B, 0x1F, 0x11, 0x07, 0x10, 0x1E, 0x06,
     
    27412741   0x02, 0x03, 0x13, 0x14, 0x09, 0x1D, 0x05, 0x0F };
    27422742
    2743 unsigned char table_126[32] = {
     2743static const unsigned char table_126[32] = {
    27442744   0x1C, 0x1D, 0x07, 0x12, 0x18, 0x1A, 0x19, 0x09,
    27452745   0x0F, 0x14, 0x1F, 0x0B, 0x13, 0x04, 0x0E, 0x1E,
     
    27472747   0x15, 0x10, 0x11, 0x08, 0x00, 0x03, 0x06, 0x02 };
    27482748
    2749 unsigned char table_127[256] = {
     2749static const unsigned char table_127[256] = {
    27502750   0xA0, 0x66, 0xD8, 0x08, 0xEA, 0x39, 0x78, 0xAB,
    27512751   0x61, 0x4E, 0xC7, 0xD1, 0xA3, 0x1C, 0x9F, 0xCB,
     
    27812781   0x70, 0xF8, 0x17, 0xCD, 0xB0, 0xCC, 0x82, 0x2D };
    27822782
    2783 unsigned char table_128[32] = {
     2783static const unsigned char table_128[32] = {
    27842784   0x1A, 0x1C, 0x09, 0x17, 0x1B, 0x0B, 0x16, 0x1E,
    27852785   0x14, 0x0C, 0x12, 0x0E, 0x05, 0x03, 0x1F, 0x15,
     
    27872787   0x02, 0x08, 0x0F, 0x18, 0x07, 0x04, 0x1D, 0x06 };
    27882788
    2789 unsigned char table_129[256] = {
     2789static const unsigned char table_129[256] = {
    27902790   0x9D, 0x5F, 0xE8, 0x99, 0x57, 0x07, 0x16, 0xA6,
    27912791   0x9F, 0xB6, 0xDE, 0xED, 0x2D, 0xB3, 0xC0, 0x8E,
     
    28212821   0x09, 0x45, 0x6B, 0xD7, 0x0B, 0x89, 0x4F, 0x2A };
    28222822
    2823 unsigned char table_130[32] = {
     2823static const unsigned char table_130[32] = {
    28242824   0x07, 0x03, 0x15, 0x0B, 0x02, 0x11, 0x17, 0x14,
    28252825   0x05, 0x10, 0x0A, 0x0F, 0x01, 0x1C, 0x1D, 0x0E,
     
    28272827   0x1B, 0x00, 0x08, 0x0D, 0x0C, 0x1E, 0x04, 0x1F };
    28282828
    2829 unsigned char table_131[32] = {
     2829static const unsigned char table_131[32] = {
    28302830   0x1D, 0x13, 0x1B, 0x10, 0x07, 0x03, 0x0A, 0x02,
    28312831   0x00, 0x0C, 0x0E, 0x0B, 0x0D, 0x18, 0x12, 0x1F,
     
    28332833   0x19, 0x05, 0x0F, 0x17, 0x06, 0x01, 0x09, 0x16 };
    28342834
    2835 unsigned char table_132[256] = {
     2835static const unsigned char table_132[256] = {
    28362836   0x33, 0x8D, 0x45, 0x6F, 0xFF, 0xF5, 0xB6, 0x53,
    28372837   0x3B, 0xF3, 0x07, 0xA4, 0x97, 0xEB, 0x6B, 0xA5,
     
    28672867   0xC4, 0x7F, 0xA0, 0xD8, 0xEF, 0x03, 0x70, 0xF6 };
    28682868
    2869 unsigned char table_133[256] = {
     2869static const unsigned char table_133[256] = {
    28702870   0x02, 0xF0, 0xED, 0xC4, 0xE4, 0x67, 0x60, 0x8B,
    28712871   0xF3, 0x77, 0x92, 0xE0, 0x85, 0x93, 0x1E, 0x8E,
     
    29012901   0x5A, 0x35, 0xB0, 0xAE, 0x82, 0x79, 0x1D, 0x52 };
    29022902
    2903 unsigned char table_134[32] = {
     2903static const unsigned char table_134[32] = {
    29042904   0x09, 0x0F, 0x10, 0x0C, 0x03, 0x15, 0x07, 0x17,
    29052905   0x0E, 0x0B, 0x1D, 0x08, 0x19, 0x11, 0x00, 0x0A,
     
    29072907   0x02, 0x1B, 0x1A, 0x04, 0x05, 0x1F, 0x1C, 0x1E };
    29082908
    2909 unsigned char table_135[256] = {
     2909static const unsigned char table_135[256] = {
    29102910   0x14, 0x34, 0xEA, 0x02, 0x2B, 0x5A, 0x10, 0x51,
    29112911   0xF3, 0x8F, 0x28, 0xB2, 0x50, 0x8B, 0x01, 0xCC,
     
    29412941   0x00, 0x63, 0xD9, 0xBE, 0xF2, 0x60, 0x25, 0x62 };
    29422942
    2943 unsigned char table_136[256] = {
     2943static const unsigned char table_136[256] = {
    29442944   0xD3, 0x1A, 0x00, 0xED, 0x59, 0x24, 0xA3, 0xF2,
    29452945   0xBA, 0x58, 0x4C, 0x5C, 0x75, 0x48, 0x98, 0xB0,
     
    29752975   0x93, 0x1D, 0x9B, 0x5B, 0x40, 0xEE, 0x42, 0x19 };
    29762976
    2977 unsigned char table_137[32] = {
     2977static const unsigned char table_137[32] = {
    29782978   0x0F, 0x09, 0x02, 0x06, 0x18, 0x0B, 0x1E, 0x05,
    29792979   0x11, 0x1D, 0x16, 0x01, 0x13, 0x10, 0x0E, 0x1A,
     
    29812981   0x03, 0x1F, 0x0A, 0x12, 0x0C, 0x07, 0x04, 0x1C };
    29822982
    2983 unsigned char table_138[32] = {
     2983static const unsigned char table_138[32] = {
    29842984   0x0D, 0x1C, 0x1F, 0x15, 0x0F, 0x14, 0x1B, 0x12,
    29852985   0x09, 0x0B, 0x19, 0x07, 0x11, 0x16, 0x0C, 0x04,
     
    29872987   0x01, 0x06, 0x18, 0x17, 0x10, 0x1A, 0x02, 0x00 };
    29882988
    2989 unsigned char table_139[32] = {
     2989static const unsigned char table_139[32] = {
    29902990   0x05, 0x15, 0x1D, 0x02, 0x0F, 0x03, 0x17, 0x1A,
    29912991   0x0A, 0x00, 0x1F, 0x12, 0x0E, 0x11, 0x1B, 0x13,
     
    29932993   0x0C, 0x04, 0x16, 0x19, 0x1C, 0x06, 0x10, 0x01 };
    29942994
    2995 unsigned char table_140[32] = {
     2995static const unsigned char table_140[32] = {
    29962996   0x06, 0x1E, 0x0C, 0x11, 0x13, 0x08, 0x15, 0x01,
    29972997   0x1D, 0x03, 0x0F, 0x19, 0x18, 0x04, 0x00, 0x14,
     
    29992999   0x1F, 0x17, 0x09, 0x0A, 0x0D, 0x16, 0x10, 0x1C };
    30003000
    3001 unsigned char table_141[256] = {
     3001static const unsigned char table_141[256] = {
    30023002   0xE1, 0x0A, 0x28, 0xCD, 0x8A, 0x1E, 0x26, 0x10,
    30033003   0xC0, 0x6F, 0x06, 0x2C, 0xF8, 0x51, 0x6C, 0x8F,
     
    30333033   0x98, 0x54, 0xB8, 0xDC, 0x46, 0xDF, 0x87, 0xE5 };
    30343034
    3035 unsigned char table_142[256] = {
     3035static const unsigned char table_142[256] = {
    30363036   0x90, 0x94, 0xBE, 0x14, 0x99, 0xEB, 0x45, 0x0F,
    30373037   0x34, 0x4A, 0xE3, 0x79, 0xD2, 0x64, 0x4D, 0x69,
     
    30673067   0xCC, 0x1E, 0x87, 0xD7, 0x01, 0x1F, 0x51, 0x95 };
    30683068
    3069 unsigned char table_143[32] = {
     3069static const unsigned char table_143[32] = {
    30703070   0x0E, 0x16, 0x18, 0x11, 0x0C, 0x01, 0x12, 0x1F,
    30713071   0x08, 0x15, 0x0A, 0x06, 0x1C, 0x1E, 0x02, 0x1A,
     
    30733073   0x0D, 0x14, 0x09, 0x0B, 0x1B, 0x00, 0x1D, 0x04 };
    30743074
    3075 unsigned char table_144[32] = {
     3075static const unsigned char table_144[32] = {
    30763076   0x00, 0x1B, 0x17, 0x19, 0x1D, 0x11, 0x0D, 0x1A,
    30773077   0x13, 0x03, 0x1E, 0x09, 0x10, 0x0E, 0x15, 0x05,
     
    30793079   0x16, 0x14, 0x02, 0x04, 0x07, 0x18, 0x12, 0x0C };
    30803080
    3081 unsigned char table_145[256] = {
     3081static const unsigned char table_145[256] = {
    30823082   0xF9, 0x2C, 0x38, 0x74, 0xDA, 0x65, 0x85, 0x0E,
    30833083   0xBA, 0x64, 0xDB, 0xE3, 0xB6, 0x8B, 0x0B, 0x5E,
     
    31133113   0x69, 0xF6, 0xEF, 0xC2, 0xAD, 0x03, 0xB3, 0x1E };
    31143114
    3115 unsigned char table_146[256] = {
     3115static const unsigned char table_146[256] = {
    31163116   0x1C, 0xF5, 0x16, 0xD2, 0xCC, 0xDC, 0x1E, 0x29,
    31173117   0xE3, 0x17, 0x3B, 0x66, 0x6A, 0xF7, 0x03, 0xB2,
     
    31473147   0x7D, 0x96, 0x76, 0x99, 0xB5, 0x48, 0x98, 0x10 };
    31483148
    3149 unsigned char table_147[32] = {
     3149static const unsigned char table_147[32] = {
    31503150   0x17, 0x07, 0x0D, 0x16, 0x00, 0x1B, 0x1F, 0x09,
    31513151   0x10, 0x11, 0x14, 0x0A, 0x02, 0x06, 0x13, 0x0C,
     
    31533153   0x1C, 0x1A, 0x03, 0x18, 0x04, 0x0B, 0x1D, 0x0E };
    31543154
    3155 unsigned char table_148[256] = {
     3155static const unsigned char table_148[256] = {
    31563156   0xFB, 0x23, 0xBC, 0x5A, 0x8C, 0x02, 0x42, 0x3B,
    31573157   0x95, 0x0C, 0x21, 0x0E, 0x14, 0xDF, 0x11, 0xC0,
     
    31873187   0x09, 0x43, 0xBF, 0xD0, 0x55, 0xDD, 0x3F, 0x24 };
    31883188
    3189 unsigned char table_149[32] = {
     3189static const unsigned char table_149[32] = {
    31903190   0x1B, 0x0B, 0x0C, 0x06, 0x1F, 0x17, 0x04, 0x1A,
    31913191   0x1E, 0x02, 0x0F, 0x16, 0x0E, 0x09, 0x10, 0x01,
     
    31933193   0x18, 0x1D, 0x14, 0x0D, 0x07, 0x08, 0x15, 0x12 };
    31943194
    3195 unsigned char table_150[256] = {
     3195static const unsigned char table_150[256] = {
    31963196   0x57, 0xBC, 0x9D, 0x46, 0x14, 0xD0, 0x94, 0x95,
    31973197   0x1B, 0x12, 0xB8, 0xD4, 0x53, 0x73, 0x83, 0xE6,
     
    32273227   0x97, 0xC9, 0xF3, 0x04, 0xD8, 0xF4, 0x80, 0x44 };
    32283228
    3229 unsigned char table_151[256] = {
     3229static const unsigned char table_151[256] = {
    32303230   0x78, 0x6C, 0xC5, 0x0C, 0x2D, 0xA7, 0x97, 0x9C,
    32313231   0x22, 0x76, 0x3E, 0x81, 0x51, 0x47, 0x59, 0x71,
     
    32613261   0x43, 0x3A, 0x53, 0x9E, 0x80, 0x88, 0x07, 0x9D };
    32623262
    3263 unsigned char table_152[32] = {
     3263static const unsigned char table_152[32] = {
    32643264   0x02, 0x1A, 0x17, 0x1D, 0x01, 0x03, 0x13, 0x1E,
    32653265   0x05, 0x18, 0x06, 0x0A, 0x0C, 0x04, 0x1B, 0x00,
     
    32673267   0x14, 0x12, 0x0D, 0x10, 0x19, 0x11, 0x08, 0x15 };
    32683268
    3269 unsigned char table_153[32] = {
     3269static const unsigned char table_153[32] = {
    32703270   0x0E, 0x14, 0x12, 0x1E, 0x1C, 0x02, 0x06, 0x16,
    32713271   0x18, 0x0D, 0x17, 0x0C, 0x1D, 0x11, 0x08, 0x19,
     
    32733273   0x1A, 0x0A, 0x05, 0x10, 0x00, 0x01, 0x15, 0x09 };
    32743274
    3275 unsigned char table_154[256] = {
     3275static const unsigned char table_154[256] = {
    32763276   0x27, 0x5A, 0x08, 0x5B, 0xF4, 0x39, 0x13, 0x6F,
    32773277   0x67, 0xEA, 0x22, 0xCA, 0x5C, 0xCF, 0x18, 0x7C,
     
    33073307   0x53, 0xE1, 0xDD, 0x72, 0x95, 0x52, 0x34, 0xB5 };
    33083308
    3309 unsigned char table_155[256] = {
     3309static const unsigned char table_155[256] = {
    33103310   0x75, 0x58, 0xC5, 0xA5, 0x83, 0x16, 0xF3, 0x7F,
    33113311   0x94, 0xDE, 0xA0, 0xF6, 0xFD, 0x89, 0xA8, 0x06,
     
    33413341   0x8B, 0x33, 0xFC, 0xBB, 0x00, 0xA2, 0xDF, 0xDA };
    33423342
    3343 unsigned char table_156[256] = {
     3343static const unsigned char table_156[256] = {
    33443344   0x31, 0x25, 0xB1, 0xD3, 0xAF, 0xAE, 0x84, 0x2C,
    33453345   0x71, 0x5E, 0xD8, 0x80, 0x6F, 0x3E, 0x48, 0x86,
     
    33753375   0xF1, 0x68, 0xBE, 0x35, 0x40, 0x8C, 0xD4, 0x47 };
    33763376
    3377 unsigned char table_157[32] = {
     3377static const unsigned char table_157[32] = {
    33783378   0x00, 0x0D, 0x03, 0x02, 0x11, 0x04, 0x18, 0x0B,
    33793379   0x14, 0x1D, 0x1C, 0x13, 0x1B, 0x17, 0x10, 0x15,
     
    33813381   0x08, 0x06, 0x0C, 0x0E, 0x1F, 0x0F, 0x0A, 0x05 };
    33823382
    3383 unsigned char table_158[256] = {
     3383static const unsigned char table_158[256] = {
    33843384   0x68, 0x26, 0x80, 0x0B, 0xB8, 0xD5, 0x8C, 0xB7,
    33853385   0x65, 0xEF, 0xBC, 0x94, 0x28, 0xB9, 0xB2, 0xD2,
     
    34153415   0x9A, 0x57, 0xA2, 0x74, 0xC6, 0xFE, 0x9B, 0x58 };
    34163416
    3417 unsigned char table_159[256] = {
     3417static const unsigned char table_159[256] = {
    34183418   0xE5, 0xBF, 0x84, 0x56, 0xD6, 0x43, 0x3E, 0xA5,
    34193419   0x64, 0x87, 0x44, 0x63, 0x4A, 0x4C, 0x8D, 0x24,
     
    34493449   0xCB, 0x9B, 0x13, 0x8F, 0xA4, 0x28, 0x23, 0x85 };
    34503450
    3451 unsigned char table_160[256] = {
     3451static const unsigned char table_160[256] = {
    34523452   0x35, 0x44, 0x0E, 0x92, 0x75, 0x83, 0x9D, 0x53,
    34533453   0xA5, 0x90, 0xF8, 0xF7, 0x54, 0x74, 0xDF, 0x3D,
     
    34833483   0xBB, 0x2C, 0xE5, 0xC3, 0x67, 0xA1, 0x10, 0xB9 };
    34843484
    3485 unsigned char table_161[256] = {
     3485static const unsigned char table_161[256] = {
    34863486   0x8F, 0x1A, 0x81, 0xA2, 0x2C, 0x56, 0x6D, 0xCD,
    34873487   0x4A, 0x33, 0x50, 0xE9, 0xE0, 0x12, 0x5A, 0x43,
     
    35173517   0xBE, 0x0A, 0x36, 0x41, 0xC0, 0x8C, 0xE4, 0xAA };
    35183518
    3519 unsigned char table_162[256] = {
     3519static const unsigned char table_162[256] = {
    35203520   0xF7, 0x1B, 0xC0, 0x31, 0x5A, 0x23, 0xEA, 0xE9,
    35213521   0xFB, 0x14, 0x6A, 0xE8, 0x04, 0x65, 0x5B, 0x2C,
     
    35513551   0x38, 0xCC, 0x58, 0x44, 0xBF, 0x93, 0x5D, 0xC7 };
    35523552
    3553 unsigned char table_163[32] = {
     3553static const unsigned char table_163[32] = {
    35543554   0x1B, 0x14, 0x12, 0x15, 0x11, 0x1D, 0x17, 0x19,
    35553555   0x10, 0x09, 0x08, 0x06, 0x1A, 0x16, 0x07, 0x13,
     
    35573557   0x04, 0x01, 0x03, 0x0C, 0x0D, 0x1E, 0x02, 0x0F };
    35583558
    3559 unsigned char table_164[32] = {
     3559static const unsigned char table_164[32] = {
    35603560   0x15, 0x00, 0x10, 0x0B, 0x1D, 0x0A, 0x06, 0x1C,
    35613561   0x0D, 0x1F, 0x17, 0x0F, 0x03, 0x14, 0x13, 0x12,
     
    35633563   0x02, 0x0C, 0x0E, 0x01, 0x07, 0x19, 0x11, 0x05 };
    35643564
    3565 unsigned char table_165[256] = {
     3565static const unsigned char table_165[256] = {
    35663566   0x98, 0xF5, 0x1D, 0xFB, 0x13, 0x20, 0x41, 0xA3,
    35673567   0xE3, 0x76, 0x49, 0x7E, 0x60, 0xD8, 0x68, 0x30,
     
    35973597   0x1A, 0x26, 0xCC, 0xB1, 0xF9, 0xFA, 0x97, 0xE9 };
    35983598
    3599 unsigned char table_166[256] = {
     3599static const unsigned char table_166[256] = {
    36003600   0xCB, 0xEA, 0x2A, 0x36, 0x6D, 0x93, 0x4E, 0xD5,
    36013601   0xBC, 0x6A, 0xD4, 0x68, 0xF7, 0x18, 0xAB, 0x8B,
     
    36313631   0x1C, 0xE0, 0x51, 0x16, 0x43, 0x07, 0x0A, 0x3F };
    36323632
    3633 unsigned char table_167[256] = {
     3633static const unsigned char table_167[256] = {
    36343634   0x91, 0xEA, 0x4F, 0x6A, 0x6E, 0x2D, 0x27, 0x22,
    36353635   0x44, 0xA5, 0x6D, 0xE3, 0x45, 0x06, 0xE2, 0x87,
     
    36653665   0x14, 0x15, 0x25, 0x32, 0x6C, 0x69, 0x1A, 0xCF };
    36663666
    3667 unsigned char table_168[256] = {
     3667static const unsigned char table_168[256] = {
    36683668   0x28, 0xEE, 0xB1, 0xFD, 0xB3, 0xEF, 0x36, 0x8E,
    36693669   0x85, 0x5D, 0x1C, 0x53, 0x1E, 0xDA, 0xBA, 0x3C,
     
    36993699   0x66, 0x2E, 0x08, 0x32, 0x4C, 0x33, 0x7E, 0xE1 };
    37003700
    3701 unsigned char table_169[256] = {
     3701static const unsigned char table_169[256] = {
    37023702   0xA4, 0x31, 0xA9, 0x3F, 0x13, 0x4D, 0x1B, 0x29,
    37033703   0x73, 0x43, 0xF1, 0xE7, 0x9C, 0xC2, 0xF6, 0xCD,
     
    37333733   0x6B, 0x0A, 0x59, 0x9E, 0x5E, 0x38, 0x45, 0x80 };
    37343734
    3735 unsigned char table_170[256] = {
     3735static const unsigned char table_170[256] = {
    37363736   0xE3, 0x00, 0x99, 0x03, 0xF6, 0xDD, 0xD1, 0x41,
    37373737   0x58, 0x7E, 0xD9, 0x46, 0x04, 0xAF, 0x5C, 0x43,
     
    37673767   0x48, 0x30, 0x87, 0x83, 0x12, 0x4D, 0x65, 0xDF };
    37683768
    3769 unsigned char table_171[32] = {
     3769static const unsigned char table_171[32] = {
    37703770   0x07, 0x06, 0x11, 0x08, 0x0C, 0x1F, 0x19, 0x02,
    37713771   0x14, 0x04, 0x0D, 0x18, 0x1A, 0x05, 0x17, 0x13,
     
    37733773   0x1D, 0x10, 0x00, 0x12, 0x0B, 0x0E, 0x09, 0x0A };
    37743774
    3775 unsigned char table_172[32] = {
     3775static const unsigned char table_172[32] = {
    37763776   0x11, 0x01, 0x1F, 0x06, 0x1A, 0x04, 0x02, 0x09,
    37773777   0x05, 0x0D, 0x0B, 0x18, 0x0E, 0x12, 0x1B, 0x17,
     
    37793779   0x03, 0x0C, 0x00, 0x10, 0x0A, 0x1C, 0x0F, 0x13 };
    37803780
    3781 unsigned char table_173[32] = {
     3781static const unsigned char table_173[32] = {
    37823782   0x1F, 0x0B, 0x13, 0x00, 0x16, 0x15, 0x14, 0x0A,
    37833783   0x1D, 0x05, 0x1E, 0x1A, 0x0F, 0x04, 0x0E, 0x01,
     
    37853785   0x03, 0x11, 0x18, 0x10, 0x1C, 0x1B, 0x06, 0x0D };
    37863786
    3787 unsigned char table_174[32] = {
     3787static const unsigned char table_174[32] = {
    37883788   0x02, 0x1B, 0x0C, 0x17, 0x1F, 0x05, 0x15, 0x1E,
    37893789   0x16, 0x09, 0x1A, 0x12, 0x0F, 0x1C, 0x18, 0x0A,
     
    37913791   0x1D, 0x0E, 0x06, 0x00, 0x01, 0x07, 0x0B, 0x03 };
    37923792
    3793 unsigned char table_175[32] = {
     3793static const unsigned char table_175[32] = {
    37943794   0x00, 0x06, 0x0B, 0x08, 0x0C, 0x04, 0x1A, 0x1C,
    37953795   0x05, 0x1E, 0x14, 0x03, 0x0A, 0x18, 0x12, 0x1D,
     
    37973797   0x11, 0x19, 0x10, 0x0D, 0x1B, 0x02, 0x01, 0x15 };
    37983798
    3799 unsigned char table_176[32] = {
     3799static const unsigned char table_176[32] = {
    38003800   0x12, 0x03, 0x1A, 0x15, 0x04, 0x19, 0x0B, 0x1B,
    38013801   0x17, 0x1E, 0x0D, 0x05, 0x11, 0x14, 0x1C, 0x00,
     
    38033803   0x13, 0x09, 0x16, 0x1D, 0x0F, 0x0C, 0x01, 0x1F };
    38043804
    3805 unsigned char table_177[256] = {
     3805static const unsigned char table_177[256] = {
    38063806   0x5E, 0x4D, 0x76, 0xFE, 0xB5, 0x50, 0x83, 0x23,
    38073807   0x72, 0xDD, 0x93, 0x08, 0x69, 0xAD, 0xEC, 0x3B,
     
    38373837   0x5A, 0xC5, 0xE0, 0x58, 0x41, 0x4E, 0x4A, 0xAF };
    38383838
    3839 unsigned char table_178[256] = {
     3839static const unsigned char table_178[256] = {
    38403840   0x33, 0xBA, 0x98, 0xDA, 0x07, 0x2C, 0x22, 0x9B,
    38413841   0xE0, 0xED, 0xB7, 0xA1, 0x93, 0xEB, 0xDC, 0x49,
     
    38713871   0x95, 0x9E, 0xBF, 0xEF, 0xF8, 0x45, 0x00, 0xB4 };
    38723872
    3873 unsigned char table_179[256] = {
     3873static const unsigned char table_179[256] = {
    38743874   0x50, 0x3D, 0x41, 0x42, 0x06, 0x5B, 0xD6, 0x34,
    38753875   0x9D, 0x3C, 0x7B, 0x14, 0xE2, 0x9B, 0x80, 0x15,
     
    39053905   0x2A, 0x04, 0x18, 0xA5, 0xA2, 0x6E, 0x07, 0xE3 };
    39063906
    3907 unsigned char table_180[256] = {
     3907static const unsigned char table_180[256] = {
    39083908   0xDA, 0xCC, 0x72, 0xA6, 0xE7, 0x07, 0xFD, 0x25,
    39093909   0x92, 0x39, 0x49, 0x02, 0xD6, 0x09, 0xA8, 0x65,
     
    39393939   0x62, 0x4F, 0xCF, 0xB2, 0xC2, 0x59, 0xDB, 0x67 };
    39403940
    3941 unsigned char table_181[256] = {
     3941static const unsigned char table_181[256] = {
    39423942   0x2B, 0xED, 0x14, 0x05, 0x80, 0xCC, 0x5A, 0xF8,
    39433943   0x43, 0xB7, 0x86, 0xC6, 0xEE, 0xA6, 0xD7, 0xD6,
     
    39733973   0x32, 0x24, 0x7D, 0x9B, 0xD2, 0x83, 0x35, 0xCD };
    39743974
    3975 unsigned char table_182[256] = {
     3975static const unsigned char table_182[256] = {
    39763976   0x06, 0x7F, 0x66, 0xB5, 0xBA, 0x1E, 0xFD, 0x51,
    39773977   0x81, 0x8D, 0x28, 0xA3, 0x15, 0x37, 0xDC, 0x58,
     
    40074007   0x7B, 0x17, 0x0B, 0x0A, 0x41, 0x03, 0xD4, 0x4B };
    40084008
    4009 unsigned char table_183[32] = {
     4009static const unsigned char table_183[32] = {
    40104010   0x1E, 0x1B, 0x11, 0x07, 0x08, 0x06, 0x18, 0x17,
    40114011   0x0D, 0x0F, 0x12, 0x03, 0x1D, 0x04, 0x0A, 0x1A,
     
    40134013   0x16, 0x05, 0x1C, 0x0E, 0x02, 0x00, 0x09, 0x15 };
    40144014
    4015 unsigned char table_184[32] = {
     4015static const unsigned char table_184[32] = {
    40164016   0x0F, 0x1D, 0x17, 0x16, 0x0D, 0x05, 0x13, 0x1F,
    40174017   0x1B, 0x09, 0x1C, 0x1E, 0x15, 0x01, 0x06, 0x08,
     
    40194019   0x18, 0x0E, 0x03, 0x11, 0x12, 0x14, 0x19, 0x00 };
    40204020
    4021 unsigned char table_185[256] = {
     4021static const unsigned char table_185[256] = {
    40224022   0xA5, 0xEE, 0x2E, 0x28, 0xA7, 0xAC, 0xD9, 0xB2,
    40234023   0x6E, 0x04, 0xB4, 0x03, 0xE8, 0x92, 0x5F, 0x4D,
     
    40534053   0x2B, 0xC5, 0x98, 0x18, 0x66, 0x15, 0x9C, 0xBC };
    40544054
    4055 unsigned char table_186[256] = {
     4055static const unsigned char table_186[256] = {
    40564056   0xB7, 0xFA, 0x03, 0x7C, 0x76, 0x43, 0xA7, 0x15,
    40574057   0x4B, 0x4F, 0x04, 0xAA, 0x4E, 0xD2, 0x52, 0xC8,
     
    40874087   0x11, 0x3B, 0x94, 0xE8, 0x7D, 0x7B, 0xD9, 0x5A };
    40884088
    4089 unsigned char table_187[32] = {
     4089static const unsigned char table_187[32] = {
    40904090   0x0F, 0x04, 0x1D, 0x1B, 0x15, 0x10, 0x01, 0x0B,
    40914091   0x00, 0x17, 0x13, 0x07, 0x1E, 0x1F, 0x08, 0x0A,
     
    40934093   0x0E, 0x18, 0x03, 0x1C, 0x12, 0x11, 0x0D, 0x02 };
    40944094
    4095 struct yahoo_fn yahoo_fntable[5][96] =
     4095static const struct yahoo_fn yahoo_fntable[5][96] =
    40964096   {{{ IDENT, 0, 0 },
    40974097     { IDENT, 0, 0 },
     
    45824582int yahoo_xfrm( int table, int depth, int seed )
    45834583{
    4584    struct yahoo_fn *xfrm;
     4584   const struct yahoo_fn *xfrm;
    45854585   int i, j, z;
    45864586   unsigned int n = seed;
  • protocols/yahoo/yahoo_util.c

    r3e91c3e r8e419cb  
    5050
    5151        return new_string;
    52 }
    53 
    54 char * y_str_to_utf8(const char *in)
    55 {
    56         unsigned int n, i = 0;
    57         char *result = NULL;
    58 
    59         if(in == NULL || *in == '\0')
    60                 return "";
    61        
    62         result = y_new(char, strlen(in) * 2 + 1);
    63 
    64         /* convert a string to UTF-8 Format */
    65         for (n = 0; n < strlen(in); n++) {
    66                 unsigned char c = (unsigned char)in[n];
    67 
    68                 if (c < 128) {
    69                         result[i++] = (char) c;
    70                 } else {
    71                         result[i++] = (char) ((c >> 6) | 192);
    72                         result[i++] = (char) ((c & 63) | 128);
    73                 }
    74         }
    75         result[i] = '\0';
    76         return result;
    77 }
    78 
    79 char * y_utf8_to_str(const char *in)
    80 {
    81         int i = 0;
    82         unsigned int n;
    83         char *result = NULL;
    84 
    85         if(in == NULL || *in == '\0')
    86                 return "";
    87        
    88         result = y_new(char, strlen(in) + 1);
    89 
    90         /* convert a string from UTF-8 Format */
    91         for (n = 0; n < strlen(in); n++) {
    92                 unsigned char c = in[n];
    93 
    94                 if (c < 128) {
    95                         result[i++] = (char) c;
    96                 } else {
    97                         result[i++] = (c << 6) | (in[++n] & 63);
    98                 }
    99         }
    100         result[i] = '\0';
    101         return result;
    10252}
    10353
  • sock.h

    r3e91c3e r8e419cb  
     1#include <errno.h>
     2#include <fcntl.h>
     3
     4/* To cut down on the ifdef stuff a little bit in other places */
     5#ifdef IPV6
     6#define AF_INETx AF_INET6
     7#else
     8#define AF_INETx AF_INET
     9#endif
     10
    111#ifndef _WIN32
    212#include <unistd.h>
  • storage_text.c

    r3e91c3e r8e419cb  
    7979        user_t *ru = user_find( irc, ROOT_NICK );
    8080       
    81         if( irc->status == USTATUS_IDENTIFIED )
     81        if( irc->status >= USTATUS_IDENTIFIED )
    8282                return( 1 );
    8383       
  • unix.c

    r3e91c3e r8e419cb  
    3232#include <unistd.h>
    3333#include <sys/time.h>
     34#include <sys/wait.h>
    3435
    3536global_t global;        /* Against global namespace pollution */
     
    4647        global.loop = g_main_new( FALSE );
    4748       
    48         log_init( );
     49        log_init();
    4950
    5051        nogaim_init();
     
    7677                log_message( LOGLVL_INFO, "Bitlbee %s starting in daemon mode.", BITLBEE_VERSION );
    7778        }
     79        else if( global.conf->runmode == RUNMODE_FORKDAEMON )
     80        {
     81                i = bitlbee_daemon_init();
     82                log_message( LOGLVL_INFO, "Bitlbee %s starting in forking daemon mode.", BITLBEE_VERSION );
     83        }
    7884        if( i != 0 )
    7985                return( i );
    8086
    81         global.storage = storage_init( global.conf->primary_storage,
    82                                                                    global.conf->migrate_storage );
     87        global.storage = storage_init( global.conf->primary_storage, global.conf->migrate_storage );
    8388        if ( global.storage == NULL) {
    8489                log_message( LOGLVL_ERROR, "Unable to load storage backend '%s'", global.conf->primary_storage );
     
    9095        memset( &sig, 0, sizeof( sig ) );
    9196        sig.sa_handler = sighandler;
     97        sigaction( SIGCHLD, &sig, &old );
    9298        sigaction( SIGPIPE, &sig, &old );
    9399        sig.sa_flags = SA_RESETHAND;
     
    113119static void sighandler( int signal )
    114120{
    115         /* FIXME: In fact, calling log_message() here can be dangerous. But well, let's take the risk for now. */
     121        /* FIXME: Calling log_message() here is not a very good idea! */
    116122       
    117123        if( signal == SIGTERM )
     
    139145                }
    140146        }
     147        else if( signal == SIGCHLD )
     148        {
     149                pid_t pid;
     150                int st;
     151               
     152                while( ( pid = waitpid( 0, &st, WNOHANG ) ) > 0 )
     153                {
     154                        if( WIFSIGNALED( st ) )
     155                                log_message( LOGLVL_INFO, "Client %d terminated normally. (status = %d)", pid, WEXITSTATUS( st ) );
     156                        else if( WIFEXITED( st ) )
     157                                log_message( LOGLVL_INFO, "Client %d killed by signal %d.", pid, WTERMSIG( st ) );
     158                }
     159        }
    141160        else if( signal != SIGPIPE )
    142161        {
  • url.c

    r3e91c3e r8e419cb  
    22  * BitlBee -- An IRC to other IM-networks gateway                     *
    33  *                                                                    *
    4   * Copyright 2001-2004 Wilmer van der Gaast and others                *
     4  * Copyright 2001-2005 Wilmer van der Gaast and others                *
    55  \********************************************************************/
    66
     
    3030{
    3131        char s[MAX_STRING];
    32         char *i, *j;
     32        char *i;
    3333       
    3434        /* protocol://                                                  */
     
    4040        else
    4141        {
    42                 if( g_strncasecmp( set_url, "http", i - set_url ) == 0 )
     42                if( g_strncasecmp( set_url, "https", i - set_url ) == 0 )
     43                        url->proto = PROTO_HTTPS;
     44                else if( g_strncasecmp( set_url, "http", i - set_url ) == 0 )
    4345                        url->proto = PROTO_HTTP;
    4446                else if( g_strncasecmp( set_url, "socks4", i - set_url ) == 0 )
     
    5658        if( ( i = strchr( s, '/' ) ) == NULL )
    5759        {
    58                 strcpy( url->dir, "/" );
     60                strcpy( url->file, "/" );
    5961        }
    6062        else
    6163        {
     64                strncpy( url->file, i, MAX_STRING );
    6265                *i = 0;
    63                 g_snprintf( url->dir, MAX_STRING, "/%s", i + 1 );
    64                 if( url->proto == PROTO_HTTP )
    65                         http_encode( url->dir );
    6666        }
    6767        strncpy( url->host, s, MAX_STRING );
    68         j = strchr( url->dir, '?' );
    69         if( j != NULL )
    70                 *j = 0;
    71         i = strrchr( url->dir, '/' );
    72         *i = 0;
    73         if( j != NULL )
    74                 *j = '?';
    75         if( i == NULL )
    76         {
    77                 strcpy( url->file, url->dir );
    78                 strcpy( url->dir, "/" );
    79         }
    80         else
    81         {
    82                 strcpy( url->file, i + 1 );
    83                 strcat( url->dir, "/" );
    84         }
    8568       
    8669        /* Check for username in host field                             */
     
    9679        else
    9780        {
    98                 if( url->proto == PROTO_FTP )
    99                 {
    100                         strcpy( url->user, "anonymous" );
    101                         strcpy( url->pass, "-p.artmaps@lintux.cx" );
    102                 }
    103                 else
    104                 {
    105                         *url->user = *url->pass = 0;
    106                 }
     81                *url->user = *url->pass = 0;
    10782        }
    10883       
     
    11792        {
    11893                *i = 0;
    119                 sscanf( i + 1, "%i", &url->port );
     94                sscanf( i + 1, "%d", &url->port );
    12095        }
    121         /* Take default port numbers from /etc/services                 */
    12296        else
    12397        {
    12498                if( url->proto == PROTO_HTTP )
    125                         url->port = 8080;
     99                        url->port = 80;
     100                else if( url->proto == PROTO_HTTPS )
     101                        url->port = 443;
    126102                else if( url->proto == PROTO_SOCKS4 || url->proto == PROTO_SOCKS4 )
    127103                        url->port = 1080;
  • url.h

    r3e91c3e r8e419cb  
    2626#include "bitlbee.h"
    2727
    28 #define PROTO_FTP               1
    2928#define PROTO_HTTP              2
     29#define PROTO_HTTPS             5
    3030#define PROTO_SOCKS4    3
    3131#define PROTO_SOCKS5    4
     
    3737        int port;
    3838        char host[MAX_STRING];
    39         char dir[MAX_STRING];
    4039        char file[MAX_STRING];
    4140        char user[MAX_STRING];
Note: See TracChangeset for help on using the changeset viewer.