or.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  1. /* Copyright 2001,2002 Roger Dingledine, Matej Pfajfar. */
  2. /* See LICENSE for licensing information */
  3. /* $Id$ */
  4. #ifndef __OR_H
  5. #define __OR_H
  6. #include "orconfig.h"
  7. #include <stdio.h>
  8. #include <stdlib.h>
  9. #include <limits.h>
  10. #include <unistd.h>
  11. #include <string.h>
  12. #include <signal.h>
  13. #include <netdb.h>
  14. #include <ctype.h>
  15. #ifdef HAVE_STDINT_H
  16. #include <stdint.h>
  17. #endif
  18. #ifdef HAVE_SYS_POLL_H
  19. #include <sys/poll.h>
  20. #elif HAVE_POLL_H
  21. #include <poll.h>
  22. #else
  23. #include "../common/fakepoll.h"
  24. #endif
  25. #include <sys/types.h>
  26. #include <sys/fcntl.h>
  27. #include <sys/ioctl.h>
  28. #include <sys/socket.h>
  29. #include <sys/time.h>
  30. #include <netinet/in.h>
  31. #include <arpa/inet.h>
  32. #include <errno.h>
  33. #include <assert.h>
  34. #include <time.h>
  35. #include "../common/config.h"
  36. #include "../common/crypto.h"
  37. #include "../common/log.h"
  38. #include "../common/ss.h"
  39. #include "../common/version.h"
  40. #define MAXCONNECTIONS 200 /* upper bound on max connections.
  41. can be overridden by config file */
  42. #define MAX_BUF_SIZE (640*1024)
  43. #define DEFAULT_BANDWIDTH_OP 1024
  44. #define ACI_TYPE_LOWER 0
  45. #define ACI_TYPE_HIGHER 1
  46. #define ACI_TYPE_BOTH 2
  47. /* bitvector of the roles that we might want to play. You can or (|) them together */
  48. #define ROLE_OR_LISTEN 1
  49. #define ROLE_OR_CONNECT_ALL 2
  50. #define ROLE_OP_LISTEN 4
  51. #define ROLE_AP_LISTEN 8
  52. #define ROLE_IS_OR(role) ((role & ROLE_OR_LISTEN) || (role & ROLE_OR_CONNECT_ALL) || (role & ROLE_OP_LISTEN))
  53. #define CONN_TYPE_OP_LISTENER 1
  54. #define CONN_TYPE_OP 2
  55. #define CONN_TYPE_OR_LISTENER 3
  56. #define CONN_TYPE_OR 4
  57. #define CONN_TYPE_EXIT 5
  58. #define CONN_TYPE_AP_LISTENER 6
  59. #define CONN_TYPE_AP 7
  60. #define LISTENER_STATE_READY 0
  61. #define OP_CONN_STATE_AWAITING_KEYS 0
  62. #define OP_CONN_STATE_OPEN 1
  63. #if 0
  64. #define OP_CONN_STATE_CLOSE 2 /* flushing the buffer, then will close */
  65. #define OP_CONN_STATE_CLOSE_WAIT 3 /* have sent a destroy, awaiting a confirmation */
  66. #endif
  67. /* how to read these states:
  68. * foo_CONN_STATE_bar_baz:
  69. * "I am acting as a bar, currently in stage baz of talking with a foo."
  70. */
  71. #define OR_CONN_STATE_OP_CONNECTING 0 /* an application proxy wants me to connect to this OR */
  72. #define OR_CONN_STATE_OP_SENDING_KEYS 1
  73. #define OR_CONN_STATE_CLIENT_CONNECTING 2 /* I'm connecting to this OR as an OR */
  74. #define OR_CONN_STATE_CLIENT_SENDING_AUTH 3 /* sending address and info */
  75. #define OR_CONN_STATE_CLIENT_AUTH_WAIT 4 /* have sent address and info, waiting */
  76. #define OR_CONN_STATE_CLIENT_SENDING_NONCE 5 /* sending nonce, last piece of handshake */
  77. #define OR_CONN_STATE_SERVER_AUTH_WAIT 6 /* waiting for address and info */
  78. #define OR_CONN_STATE_SERVER_SENDING_AUTH 7 /* writing auth and nonce */
  79. #define OR_CONN_STATE_SERVER_NONCE_WAIT 8 /* waiting for confirmation of nonce */
  80. #define OR_CONN_STATE_OPEN 9 /* ready to send/receive cells. */
  81. #define EXIT_CONN_STATE_CONNECTING_WAIT 0 /* waiting for standard structure or dest info */
  82. #define EXIT_CONN_STATE_CONNECTING 1
  83. #define EXIT_CONN_STATE_OPEN 2
  84. #if 0
  85. #define EXIT_CONN_STATE_CLOSE 3 /* flushing the buffer, then will close */
  86. #define EXIT_CONN_STATE_CLOSE_WAIT 4 /* have sent a destroy, awaiting a confirmation */
  87. #endif
  88. #define AP_CONN_STATE_SS_WAIT 0
  89. #define AP_CONN_STATE_OR_WAIT 1
  90. #define AP_CONN_STATE_OPEN 2
  91. #define CIRCUIT_STATE_OPEN_WAIT 0 /* receiving/processing the onion */
  92. #define CIRCUIT_STATE_OR_WAIT 1 /* I'm at the beginning of the path, my firsthop is still connecting */
  93. #define CIRCUIT_STATE_OPEN 2 /* onion processed, ready to send data along the connection */
  94. #define CIRCUIT_STATE_CLOSE_WAIT1 3 /* sent two "destroy" signals, waiting for acks */
  95. #define CIRCUIT_STATE_CLOSE_WAIT2 4 /* received one ack, waiting for one more
  96. (or if just one was sent, waiting for that one */
  97. //#define CIRCUIT_STATE_CLOSE 4 /* both acks received, connection is dead */ /* NOT USED */
  98. /* available cipher functions */
  99. #define ONION_CIPHER_IDENTITY 0
  100. #define ONION_CIPHER_DES 1
  101. #define ONION_CIPHER_RC4 2
  102. /* default cipher function */
  103. #define ONION_DEFAULT_CIPHER ONION_CIPHER_DES
  104. #define RECEIVE_WINDOW_START 100
  105. #define RECEIVE_WINDOW_INCREMENT 10
  106. /* cell commands */
  107. #define CELL_PADDING 0
  108. #define CELL_CREATE 1
  109. #define CELL_DATA 2
  110. #define CELL_DESTROY 3
  111. #define CELL_ACK 4
  112. #define CELL_NACK 5
  113. #define CELL_SENDME 6
  114. #define CELL_CONNECTED 7
  115. #define CELL_PAYLOAD_SIZE 120
  116. typedef uint16_t aci_t;
  117. /* cell definition */
  118. typedef struct
  119. {
  120. aci_t aci; /* Anonymous Connection Identifier */
  121. unsigned char command;
  122. unsigned char length; /* of payload if data cell, else value of sendme */
  123. uint32_t seq; /* sequence number */
  124. unsigned char payload[120];
  125. } cell_t;
  126. typedef struct
  127. {
  128. /* Used by all types: */
  129. unsigned char type;
  130. int state;
  131. int s; /* our socket */
  132. int poll_index;
  133. int marked_for_close;
  134. char *inbuf;
  135. int inbuflen;
  136. int inbuf_datalen;
  137. int inbuf_reached_eof;
  138. char *outbuf;
  139. int outbuflen; /* how many bytes are allocated for the outbuf? */
  140. int outbuf_flushlen; /* how much data should we try to flush from the outbuf? */
  141. int outbuf_datalen; /* how much data is there total on the outbuf? */
  142. // uint16_t aci; /* anonymous connection identifier */
  143. /* used by OR and OP: */
  144. uint32_t bandwidth; /* connection bandwidth */
  145. int receiver_bucket; /* when this hits 0, stop receiving. Every second we
  146. * add 'bandwidth' to this, capping it at 10*bandwidth.
  147. */
  148. struct timeval send_timeval; /* for determining when to send the next cell */
  149. /* link encryption */
  150. crypto_cipher_env_t *f_crypto;
  151. crypto_cipher_env_t *b_crypto;
  152. // struct timeval lastsend; /* time of last transmission to the client */
  153. // struct timeval interval; /* transmission interval */
  154. uint32_t addr; /* these two uniquely identify a router */
  155. uint16_t port;
  156. /* used by exit and ap: */
  157. ss_t ss; /* standard structure */
  158. int ss_received; /* size of ss, received so far */
  159. char *dest_addr, *dest_port;
  160. uint16_t dest_addr_len, dest_port_len;
  161. uint16_t dest_addr_received, dest_port_received;
  162. /* used by OR, to keep state while connect()ing: Kludge. */
  163. crypto_pk_env_t *prkey;
  164. struct sockaddr_in local;
  165. #if 0 /* obsolete, we now use conn->bandwidth */
  166. /* link info */
  167. uint32_t min;
  168. uint32_t max;
  169. #endif
  170. char *address; /* strdup into this, because free_connection frees it */
  171. crypto_pk_env_t *pkey; /* public RSA key for the other side */
  172. char nonce[8];
  173. } connection_t;
  174. /* config stuff we know about the other ORs in the network */
  175. typedef struct
  176. {
  177. char *address;
  178. uint32_t addr;
  179. uint16_t or_port;
  180. uint16_t op_port;
  181. uint16_t ap_port;
  182. crypto_pk_env_t *pkey; /* public RSA key */
  183. /* link info */
  184. uint32_t min;
  185. uint32_t max;
  186. // struct timeval min_interval;
  187. /* time when last data was sent to that router */
  188. // struct timeval lastsend;
  189. /* socket */
  190. // int s;
  191. void *next;
  192. } routerinfo_t;
  193. typedef struct
  194. {
  195. unsigned int forwf;
  196. unsigned int backf;
  197. char digest2[20]; /* second SHA output for onion_layer_t.keyseed */
  198. char digest3[20]; /* third SHA output for onion_layer_t.keyseed */
  199. /* crypto environments */
  200. crypto_cipher_env_t *f_crypto;
  201. crypto_cipher_env_t *b_crypto;
  202. } crypt_path_t;
  203. /* per-anonymous-connection struct */
  204. typedef struct
  205. {
  206. #if 0
  207. uint32_t p_addr; /* all in network order */
  208. uint16_t p_port;
  209. #endif
  210. uint32_t n_addr;
  211. uint16_t n_port;
  212. connection_t *p_conn;
  213. connection_t *n_conn;
  214. int n_receive_window;
  215. int p_receive_window;
  216. aci_t p_aci; /* connection identifiers */
  217. aci_t n_aci;
  218. unsigned char p_f; /* crypto functions */
  219. unsigned char n_f;
  220. crypto_cipher_env_t *p_crypto; /* crypto environments */
  221. crypto_cipher_env_t *n_crypto;
  222. crypt_path_t **cpath;
  223. int cpathlen;
  224. uint32_t expire; /* expiration time for the corresponding onion */
  225. int state;
  226. unsigned char *onion; /* stores the onion when state is CONN_STATE_OPEN_WAIT */
  227. uint32_t onionlen; /* total onion length */
  228. uint32_t recvlen; /* length of the onion so far */
  229. void *next;
  230. } circuit_t;
  231. typedef struct
  232. {
  233. int zero:1;
  234. int version:7;
  235. int backf:4;
  236. int forwf:4;
  237. uint16_t port;
  238. uint32_t addr;
  239. time_t expire;
  240. unsigned char keyseed[16];
  241. } onion_layer_t;
  242. typedef struct
  243. {
  244. time_t expire;
  245. char digest[20]; /* SHA digest of the onion */
  246. void *prev;
  247. void *next;
  248. } tracked_onion_t;
  249. typedef struct
  250. {
  251. char *LogLevel;
  252. char *RouterFile;
  253. char *PrivateKeyFile;
  254. float CoinWeight;
  255. int ORPort;
  256. int OPPort;
  257. int APPort;
  258. int MaxConn;
  259. int TrafficShaping;
  260. int LinkPadding;
  261. int Role;
  262. int loglevel;
  263. } or_options_t;
  264. /* all the function prototypes go here */
  265. /********************************* buffers.c ***************************/
  266. int buf_new(char **buf, int *buflen, int *buf_datalen);
  267. void buf_free(char *buf);
  268. int read_to_buf(int s, int at_most, char **buf, int *buflen, int *buf_datalen, int *reached_eof);
  269. /* grab from s, put onto buf, return how many bytes read */
  270. int flush_buf(int s, char **buf, int *buflen, int *buf_flushlen, int *buf_datalen);
  271. /* push from buf onto s
  272. * then memmove to front of buf
  273. * return -1 or how many bytes remain on the buf */
  274. int write_to_buf(char *string, int string_len,
  275. char **buf, int *buflen, int *buf_datalen);
  276. /* append string to buf (growing as needed, return -1 if "too big")
  277. * return total number of bytes on the buf
  278. */
  279. int fetch_from_buf(char *string, int string_len,
  280. char **buf, int *buflen, int *buf_datalen);
  281. /* if there is string_len bytes in buf, write them onto string,
  282. * * then memmove buf back (that is, remove them from buf) */
  283. /********************************* cell.c ***************************/
  284. int pack_create(uint16_t aci, unsigned char *onion, uint32_t onionlen, unsigned char **cellbuf, unsigned int *cellbuflen);
  285. /********************************* circuit.c ***************************/
  286. void circuit_add(circuit_t *circ);
  287. void circuit_remove(circuit_t *circ);
  288. circuit_t *circuit_new(aci_t p_aci, connection_t *p_conn);
  289. /* internal */
  290. aci_t get_unique_aci_by_addr_port(uint32_t addr, uint16_t port, int aci_type);
  291. circuit_t *circuit_get_by_aci_conn(aci_t aci, connection_t *conn);
  292. circuit_t *circuit_get_by_conn(connection_t *conn);
  293. circuit_t *circuit_get_by_naddr_nport(uint32_t naddr, uint16_t nport);
  294. int circuit_deliver_data_cell(cell_t *cell, circuit_t *circ, connection_t *conn, int crypt_type);
  295. int circuit_crypt(circuit_t *circ, char *in, int inlen, char crypt_type);
  296. int circuit_init(circuit_t *circ, int aci_type);
  297. void circuit_free(circuit_t *circ);
  298. void circuit_free_cpath(crypt_path_t **cpath, int cpathlen);
  299. void circuit_close(circuit_t *circ);
  300. void circuit_about_to_close_connection(connection_t *conn);
  301. /* flush and send destroys for all circuits using conn */
  302. /********************************* command.c ***************************/
  303. void command_process_cell(cell_t *cell, connection_t *conn);
  304. void command_process_create_cell(cell_t *cell, connection_t *conn);
  305. void command_process_sendme_cell(cell_t *cell, connection_t *conn);
  306. void command_process_data_cell(cell_t *cell, connection_t *conn);
  307. void command_process_destroy_cell(cell_t *cell, connection_t *conn);
  308. void command_process_connected_cell(cell_t *cell, connection_t *conn);
  309. /********************************* config.c ***************************/
  310. /* loads the configuration file */
  311. int getconfig(char *filename, config_opt_t *options);
  312. /* create or_options_t from command-line args and config files(s) */
  313. int getoptions(int argc, char **argv, or_options_t *options);
  314. /********************************* connection.c ***************************/
  315. int tv_cmp(struct timeval *a, struct timeval *b);
  316. connection_t *connection_new(int type);
  317. void connection_free(connection_t *conn);
  318. int connection_create_listener(crypto_pk_env_t *prkey, struct sockaddr_in *local, int type);
  319. int connection_handle_listener_read(connection_t *conn, int new_type, int new_state);
  320. /* start all connections that should be up but aren't */
  321. int retry_all_connections(int role, routerinfo_t **router_array, int rarray_len,
  322. crypto_pk_env_t *prkey, uint16_t or_port, uint16_t op_port, uint16_t ap_port);
  323. connection_t *connection_connect_to_router_as_op(routerinfo_t *router, uint16_t local_or_port);
  324. int connection_read_to_buf(connection_t *conn);
  325. int connection_fetch_from_buf(char *string, int len, connection_t *conn);
  326. int connection_outbuf_too_full(connection_t *conn);
  327. int connection_wants_to_flush(connection_t *conn);
  328. int connection_flush_buf(connection_t *conn);
  329. int connection_write_to_buf(char *string, int len, connection_t *conn);
  330. void connection_send_cell(connection_t *conn);
  331. int connection_receiver_bucket_should_increase(connection_t *conn);
  332. void connection_increment_receiver_bucket (connection_t *conn);
  333. void connection_increment_send_timeval(connection_t *conn);
  334. void connection_init_timeval(connection_t *conn);
  335. int connection_speaks_cells(connection_t *conn);
  336. int connection_state_is_open(connection_t *conn);
  337. int connection_send_destroy(aci_t aci, connection_t *conn);
  338. int connection_send_connected(aci_t aci, connection_t *conn);
  339. int connection_encrypt_cell(cell_t *cellp, connection_t *conn);
  340. int connection_write_cell_to_buf(cell_t *cellp, connection_t *conn);
  341. int connection_process_inbuf(connection_t *conn);
  342. int connection_package_raw_inbuf(connection_t *conn);
  343. int connection_process_cell_from_inbuf(connection_t *conn);
  344. int connection_consider_sending_sendme(connection_t *conn);
  345. int connection_finished_flushing(connection_t *conn);
  346. /********************************* connection_ap.c ****************************/
  347. int connection_ap_process_inbuf(connection_t *conn);
  348. int ap_handshake_process_ss(connection_t *conn);
  349. int ap_handshake_create_onion(connection_t *conn);
  350. int ap_handshake_establish_circuit(connection_t *conn, unsigned int *route, int routelen, char *onion,
  351. int onionlen, crypt_path_t **cpath);
  352. /* find the circ that's waiting on me, if any, and get it to send its onion */
  353. int ap_handshake_n_conn_open(connection_t *or_conn);
  354. int ap_handshake_send_onion(connection_t *ap_conn, connection_t *or_conn, circuit_t *circ);
  355. int connection_ap_send_connected(connection_t *conn);
  356. int connection_ap_process_data_cell(cell_t *cell, connection_t *conn);
  357. int connection_ap_finished_flushing(connection_t *conn);
  358. int connection_ap_create_listener(crypto_pk_env_t *prkey, struct sockaddr_in *local);
  359. int connection_ap_handle_listener_read(connection_t *conn);
  360. /********************************* connection_exit.c ***************************/
  361. int connection_exit_process_inbuf(connection_t *conn);
  362. int connection_exit_package_inbuf(connection_t *conn);
  363. int connection_exit_send_connected(connection_t *conn);
  364. int connection_exit_process_data_cell(cell_t *cell, connection_t *conn);
  365. int connection_exit_finished_flushing(connection_t *conn);
  366. /********************************* connection_op.c ***************************/
  367. int op_handshake_process_keys(connection_t *conn);
  368. int connection_op_process_inbuf(connection_t *conn);
  369. int connection_op_finished_flushing(connection_t *conn);
  370. int connection_op_create_listener(crypto_pk_env_t *prkey, struct sockaddr_in *local);
  371. int connection_op_handle_listener_read(connection_t *conn);
  372. /********************************* connection_or.c ***************************/
  373. int connection_or_process_inbuf(connection_t *conn);
  374. int connection_or_finished_flushing(connection_t *conn);
  375. void conn_or_init_crypto(connection_t *conn);
  376. int or_handshake_op_send_keys(connection_t *conn);
  377. int or_handshake_op_finished_sending_keys(connection_t *conn);
  378. int or_handshake_client_process_auth(connection_t *conn);
  379. int or_handshake_client_send_auth(connection_t *conn);
  380. int or_handshake_server_process_auth(connection_t *conn);
  381. int or_handshake_server_process_nonce(connection_t *conn);
  382. connection_t *connect_to_router_as_or(routerinfo_t *router, crypto_pk_env_t *prkey, struct sockaddr_in *local);
  383. connection_t *connection_or_connect_as_or(routerinfo_t *router, crypto_pk_env_t *prkey, struct sockaddr_in *local);
  384. connection_t *connection_or_connect_as_op(routerinfo_t *router, struct sockaddr_in *local);
  385. int connection_or_create_listener(crypto_pk_env_t *prkey, struct sockaddr_in *local);
  386. int connection_or_handle_listener_read(connection_t *conn);
  387. /********************************* main.c ***************************/
  388. int connection_add(connection_t *conn);
  389. int connection_remove(connection_t *conn);
  390. void connection_set_poll_socket(connection_t *conn);
  391. int pkey_cmp(crypto_pk_env_t *a, crypto_pk_env_t *b);
  392. connection_t *connection_twin_get_by_addr_port(uint32_t addr, uint16_t port);
  393. connection_t *connection_exact_get_by_addr_port(uint32_t addr, uint16_t port);
  394. connection_t *connection_get_by_type(int type);
  395. routerinfo_t *router_get_by_addr_port(uint32_t addr, uint16_t port);
  396. unsigned int *router_new_route(int *routelen);
  397. unsigned char *router_create_onion(unsigned int *route, int routelen, int *len, crypt_path_t **cpath);
  398. routerinfo_t *router_get_first_in_route(unsigned int *route, int routelen);
  399. connection_t *connect_to_router_as_op(routerinfo_t *router);
  400. void connection_watch_events(connection_t *conn, short events);
  401. void connection_stop_reading(connection_t *conn);
  402. void connection_start_reading(connection_t *conn);
  403. void connection_stop_writing(connection_t *conn);
  404. void connection_start_writing(connection_t *conn);
  405. void check_conn_read(int i);
  406. void check_conn_marked(int i);
  407. void check_conn_write(int i);
  408. int prepare_for_poll(int *timeout);
  409. int do_main_loop(void);
  410. int main(int argc, char *argv[]);
  411. /********************************* onion.c ***************************/
  412. int decide_aci_type(uint32_t local_addr, uint16_t local_port,
  413. uint32_t remote_addr, uint16_t remote_port);
  414. int process_onion(circuit_t *circ, connection_t *conn);
  415. /* uses a weighted coin with weight cw to choose a route length */
  416. int chooselen(double cw);
  417. /* returns an array of pointers to routent that define a new route through the OR network
  418. * int cw is the coin weight to use when choosing the route
  419. * order of routers is from last to first
  420. */
  421. unsigned int *new_route(double cw, routerinfo_t **rarray, int rarray_len, int *routelen);
  422. /* creates a new onion from route, stores it and its length into bufp and lenp respectively */
  423. unsigned char *create_onion(routerinfo_t **rarray, int rarray_len, unsigned int *route, int routelen, int *len, crypt_path_t **cpath);
  424. /* encrypts 128 bytes of the onion with the specified public key, the rest with
  425. * DES OFB with the key as defined in the outter layer */
  426. unsigned char *encrypt_onion(onion_layer_t *onion, uint32_t onionlen, crypto_pk_env_t *pkey);
  427. /* decrypts the first 128 bytes using RSA and prkey, decrypts the rest with DES OFB with key1 */
  428. unsigned char *decrypt_onion(onion_layer_t *onion, uint32_t onionlen, crypto_pk_env_t *prkey);
  429. /* delete first n bytes of the onion and pads the end with n bytes of random data */
  430. void pad_onion(unsigned char *onion, uint32_t onionlen, int n);
  431. /* create a new tracked_onion entry */
  432. tracked_onion_t *new_tracked_onion(unsigned char *onion, uint32_t onionlen, tracked_onion_t **tracked_onions, tracked_onion_t **last_tracked_onion);
  433. /* delete a tracked onion entry */
  434. void remove_tracked_onion(tracked_onion_t *to, tracked_onion_t **tracked_onions, tracked_onion_t **last_tracked_onion);
  435. /* find a tracked onion in the linked list of tracked onions */
  436. tracked_onion_t *id_tracked_onion(unsigned char *onion, uint32_t onionlen, tracked_onion_t *tracked_onions);
  437. /********************************* routers.c ***************************/
  438. routerinfo_t **getrouters(char *routerfile, int *listlenp, uint16_t or_listenport);
  439. void delete_routerlist(routerinfo_t *list);
  440. /* create an NULL-terminated array of pointers pointing to elements of a router list */
  441. routerinfo_t **make_rarray(routerinfo_t* list, int *len);
  442. #endif