Ignore:
Timestamp:
11/12/09 15:44:48 (3 years ago)
Author:
eagle
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/i2prep/src/ocatv6conv.c

    r500 r518  
    4141      15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 };   
    4242static const struct in6_addr tor_prefix_ = TOR_PREFIX; 
     43static const struct in6_addr i2p_prefix_ = I2P_PREFIX; 
    4344 
    4445 
     
    5253{ 
    5354   memcpy(addr, &tor_prefix_, 6); 
     55} 
     56 
     57 
     58void set_i2p_prefix(struct in6_addr *addr) 
     59{ 
     60   memcpy(addr, &i2p_prefix_, 6); 
    5461} 
    5562 
     
    7279 
    7380 
    74 int oniontipv6(const char *onion, struct in6_addr *ip6) 
     81int b32_decode(const char *onion, struct in6_addr *ip6) 
    7582{ 
    7683   int i, j; 
     
    8895      *(((char*) ip6) + 15) |= j; 
    8996   } 
     97   return 0; 
     98} 
     99 
     100 
     101int oniontipv6(const char *onion, struct in6_addr *ip6) 
     102{ 
     103   b32_decode(onion, ip6); 
    90104   set_tor_prefix(ip6); 
    91    return 0; 
     105} 
     106 
     107 
     108int i2ptipv6(const char *onion, struct in6_addr *ip6) 
     109{ 
     110   b32_decode(onion, ip6); 
     111   set_i2p_prefix(ip6); 
    92112} 
    93113 
     
    148168 
    149169 
     170peer_t check_net_id(char *id_str) 
     171{ 
     172   char *s; 
     173 
     174   if (!(s = strtok(id_str, "."))) 
     175      return PT_TOR; 
     176   if (!strcmp(s, ONION_TLD)) 
     177      return PT_TOR; 
     178   if (!strcmp(s, I2P_TLD)) 
     179      return PT_I2P; 
     180   return -1; 
     181} 
     182 
     183 
    150184/*! Convert struct sockaddr to stuct sockaddr_str which holds the address 
    151185 *  in string representation. 
Note: See TracChangeset for help on using the changeset viewer.