Changeset 518 for branches/i2prep/src/ocatv6conv.c
- Timestamp:
- 11/12/09 15:44:48 (3 years ago)
- File:
-
- 1 edited
-
branches/i2prep/src/ocatv6conv.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/i2prep/src/ocatv6conv.c
r500 r518 41 41 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 }; 42 42 static const struct in6_addr tor_prefix_ = TOR_PREFIX; 43 static const struct in6_addr i2p_prefix_ = I2P_PREFIX; 43 44 44 45 … … 52 53 { 53 54 memcpy(addr, &tor_prefix_, 6); 55 } 56 57 58 void set_i2p_prefix(struct in6_addr *addr) 59 { 60 memcpy(addr, &i2p_prefix_, 6); 54 61 } 55 62 … … 72 79 73 80 74 int oniontipv6(const char *onion, struct in6_addr *ip6)81 int b32_decode(const char *onion, struct in6_addr *ip6) 75 82 { 76 83 int i, j; … … 88 95 *(((char*) ip6) + 15) |= j; 89 96 } 97 return 0; 98 } 99 100 101 int oniontipv6(const char *onion, struct in6_addr *ip6) 102 { 103 b32_decode(onion, ip6); 90 104 set_tor_prefix(ip6); 91 return 0; 105 } 106 107 108 int i2ptipv6(const char *onion, struct in6_addr *ip6) 109 { 110 b32_decode(onion, ip6); 111 set_i2p_prefix(ip6); 92 112 } 93 113 … … 148 168 149 169 170 peer_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 150 184 /*! Convert struct sockaddr to stuct sockaddr_str which holds the address 151 185 * in string representation.
Note: See TracChangeset
for help on using the changeset viewer.
