tor  0.4.0.0-alpha-dev
ext_orport.h
1 /* Copyright (c) 2001 Matej Pfajfar.
2  * Copyright (c) 2001-2004, Roger Dingledine.
3  * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
4  * Copyright (c) 2007-2018, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
6 
7 #ifndef EXT_ORPORT_H
8 #define EXT_ORPORT_H
9 
12 #define EXT_OR_CONN_STATE_MIN_ 1
13 
15 #define EXT_OR_CONN_STATE_AUTH_WAIT_AUTH_TYPE 1
16 
17 #define EXT_OR_CONN_STATE_AUTH_WAIT_CLIENT_NONCE 2
18 
19 #define EXT_OR_CONN_STATE_AUTH_WAIT_CLIENT_HASH 3
20 #define EXT_OR_CONN_STATE_AUTH_MAX 3
21 
23 #define EXT_OR_CONN_STATE_OPEN 4
24 
26 #define EXT_OR_CONN_STATE_FLUSHING 5
27 #define EXT_OR_CONN_STATE_MAX_ 5
28 
30 
31 ext_or_cmd_t *ext_or_cmd_new(uint16_t len);
32 
33 #define ext_or_cmd_free(cmd) \
34  FREE_AND_NULL(ext_or_cmd_t, ext_or_cmd_free_, (cmd))
35 
41 
44 
45 int init_ext_or_cookie_authentication(int is_enabled);
47 void ext_orport_free_all(void);
48 
49 #ifdef EXT_ORPORT_PRIVATE
51  uint16_t command,
52  const char *body,
53  size_t bodylen);
54 STATIC int handle_client_auth_nonce(const char *client_nonce,
55  size_t client_nonce_len,
56  char **client_hash_out,
57  char **reply_out, size_t *reply_len_out);
58 #ifdef TOR_UNIT_TESTS
59 extern uint8_t *ext_or_auth_cookie;
60 extern int ext_or_auth_cookie_is_set;
61 #endif
62 #endif /* defined(EXT_ORPORT_PRIVATE) */
63 
64 #endif /* !defined(EXT_ORPORT_H) */
int connection_ext_or_start_auth(or_connection_t *or_conn)
Definition: ext_orport.c:636
STATIC uint8_t * ext_or_auth_cookie
Definition: ext_orport.c:122
void connection_or_remove_from_ext_or_id_map(or_connection_t *conn)
int connection_ext_or_process_inbuf(or_connection_t *or_conn)
Definition: ext_orport.c:540
void ext_orport_free_all(void)
Definition: ext_orport.c:657
void connection_or_set_ext_or_identifier(or_connection_t *conn)
void connection_or_clear_ext_or_id_map(void)
ext_or_cmd_t * ext_or_cmd_new(uint16_t len)
Definition: ext_orport.c:36
char * get_ext_or_auth_cookie_file_name(void)
Definition: ext_orport.c:127
STATIC int connection_write_ext_or_command(connection_t *conn, uint16_t command, const char *body, size_t bodylen)
Definition: ext_orport.c:66
STATIC int ext_or_auth_cookie_is_set
Definition: ext_orport.c:118
void ext_or_cmd_free_(ext_or_cmd_t *cmd)
Definition: ext_orport.c:46
int connection_ext_or_finished_flushing(or_connection_t *conn)
Definition: ext_orport.c:624
or_connection_t * connection_or_get_by_ext_or_id(const char *id)