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-2021, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
9 * @brief Header for ext_orport.c
15 /** States of the Extended ORPort protocol. Be careful before changing
16 * the numbers: they matter. */
17 #define EXT_OR_CONN_STATE_MIN_ 1
18 /** Extended ORPort authentication is waiting for the authentication
19 * type selected by the client. */
20 #define EXT_OR_CONN_STATE_AUTH_WAIT_AUTH_TYPE 1
21 /** Extended ORPort authentication is waiting for the client nonce. */
22 #define EXT_OR_CONN_STATE_AUTH_WAIT_CLIENT_NONCE 2
23 /** Extended ORPort authentication is waiting for the client hash. */
24 #define EXT_OR_CONN_STATE_AUTH_WAIT_CLIENT_HASH 3
25 #define EXT_OR_CONN_STATE_AUTH_MAX 3
26 /** Authentication finished and the Extended ORPort is now accepting
28 #define EXT_OR_CONN_STATE_OPEN 4
29 /** Extended ORPort is flushing its last messages and preparing to
30 * start accepting OR connections. */
31 #define EXT_OR_CONN_STATE_FLUSHING 5
32 #define EXT_OR_CONN_STATE_MAX_ 5
34 #ifdef HAVE_MODULE_RELAY
36 int connection_ext_or_start_auth(or_connection_t
*or_conn
);
38 int connection_ext_or_finished_flushing(or_connection_t
*conn
);
39 int connection_ext_or_process_inbuf(or_connection_t
*or_conn
);
40 char *get_ext_or_auth_cookie_file_name(void);
42 /* (No stub needed for these: they are only called within feature/relay.) */
43 int init_ext_or_cookie_authentication(int is_enabled
);
44 void ext_orport_free_all(void);
46 #else /* !defined(HAVE_MODULE_RELAY) */
49 connection_ext_or_start_auth(or_connection_t
*conn
)
52 tor_assert_nonfatal_unreached();
56 connection_ext_or_finished_flushing(or_connection_t
*conn
)
59 tor_assert_nonfatal_unreached();
63 connection_ext_or_process_inbuf(or_connection_t
*conn
)
66 tor_assert_nonfatal_unreached();
69 #define get_ext_or_auth_cookie_file_name() \
72 #endif /* defined(HAVE_MODULE_RELAY) */
74 #ifdef EXT_ORPORT_PRIVATE
75 STATIC
int connection_write_ext_or_command(connection_t
*conn
,
79 STATIC
int handle_client_auth_nonce(const char *client_nonce
,
80 size_t client_nonce_len
,
81 char **client_hash_out
,
82 char **reply_out
, size_t *reply_len_out
);
85 extern uint8_t *ext_or_auth_cookie
;
86 extern int ext_or_auth_cookie_is_set
;
88 #endif /* defined(EXT_ORPORT_PRIVATE) */
90 #endif /* !defined(EXT_ORPORT_H) */