tor  0.4.2.0-alpha-dev
onion.h
Go to the documentation of this file.
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-2019, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
6 
12 #ifndef TOR_ONION_H
13 #define TOR_ONION_H
14 
15 struct create_cell_t;
19 
20 #define MAX_ONIONSKIN_CHALLENGE_LEN 255
21 #define MAX_ONIONSKIN_REPLY_LEN 255
22 
24 typedef struct create_cell_t {
26  uint8_t cell_type;
28  uint16_t handshake_type;
30  uint16_t handshake_len;
34 
36 typedef struct created_cell_t {
38  uint8_t cell_type;
40  uint16_t handshake_len;
42  uint8_t reply[CELL_PAYLOAD_SIZE - 2];
44 
46 typedef struct extend_cell_t {
48  uint8_t cell_type;
55  uint8_t node_id[DIGEST_LEN];
63 
65 typedef struct extended_cell_t {
67  uint8_t cell_type;
71 
72 void create_cell_init(create_cell_t *cell_out, uint8_t cell_type,
73  uint16_t handshake_type, uint16_t handshake_len,
74  const uint8_t *onionskin);
75 int create_cell_parse(create_cell_t *cell_out, const cell_t *cell_in);
76 int created_cell_parse(created_cell_t *cell_out, const cell_t *cell_in);
77 int extend_cell_parse(extend_cell_t *cell_out, const uint8_t command,
78  const uint8_t *payload_in, size_t payload_len);
79 int extended_cell_parse(extended_cell_t *cell_out, const uint8_t command,
80  const uint8_t *payload_in, size_t payload_len);
81 
82 int create_cell_format(cell_t *cell_out, const create_cell_t *cell_in);
83 int create_cell_format_relayed(cell_t *cell_out, const create_cell_t *cell_in);
84 int created_cell_format(cell_t *cell_out, const created_cell_t *cell_in);
85 int extend_cell_format(uint8_t *command_out, uint16_t *len_out,
86  uint8_t *payload_out, const extend_cell_t *cell_in);
87 int extended_cell_format(uint8_t *command_out, uint16_t *len_out,
88  uint8_t *payload_out, const extended_cell_t *cell_in);
89 
90 #endif /* !defined(TOR_ONION_H) */
void create_cell_init(create_cell_t *cell_out, uint8_t cell_type, uint16_t handshake_type, uint16_t handshake_len, const uint8_t *onionskin)
Definition: onion.c:103
struct extend_cell_t extend_cell_t
uint8_t onionskin[CELL_PAYLOAD_SIZE - 4]
Definition: onion.h:32
uint8_t cell_type
Definition: onion.h:38
uint16_t handshake_len
Definition: onion.h:30
Definition: cell_st.h:12
int extended_cell_format(uint8_t *command_out, uint16_t *len_out, uint8_t *payload_out, const extended_cell_t *cell_in)
Definition: onion.c:685
uint8_t cell_type
Definition: onion.h:67
struct created_cell_t created_cell_t
int extended_cell_parse(extended_cell_t *cell_out, const uint8_t command, const uint8_t *payload_in, size_t payload_len)
Definition: onion.c:448
created_cell_t created_cell
Definition: onion.h:69
struct ed25519_public_key_t ed_pubkey
Definition: onion.h:57
int extend_cell_format(uint8_t *command_out, uint16_t *len_out, uint8_t *payload_out, const extend_cell_t *cell_in)
Definition: onion.c:591
#define DIGEST_LEN
Definition: digest_sizes.h:20
struct create_cell_t create_cell_t
uint8_t reply[CELL_PAYLOAD_SIZE - 2]
Definition: onion.h:42
struct extended_cell_t extended_cell_t
uint8_t cell_type
Definition: onion.h:26
int extend_cell_parse(extend_cell_t *cell_out, const uint8_t command, const uint8_t *payload_in, size_t payload_len)
Definition: onion.c:378
Header for crypto_ed25519.c.
uint8_t cell_type
Definition: onion.h:48
int created_cell_parse(created_cell_t *cell_out, const cell_t *cell_in)
Definition: onion.c:209
int created_cell_format(cell_t *cell_out, const created_cell_t *cell_in)
Definition: onion.c:546
#define CELL_PAYLOAD_SIZE
Definition: or.h:576
uint16_t handshake_type
Definition: onion.h:28
int create_cell_parse(create_cell_t *cell_out, const cell_t *cell_in)
Definition: onion.c:155
uint8_t node_id[DIGEST_LEN]
Definition: onion.h:55
tor_addr_port_t orport_ipv4
Definition: onion.h:50
uint16_t handshake_len
Definition: onion.h:40
create_cell_t create_cell
Definition: onion.h:61
tor_addr_port_t orport_ipv6
Definition: onion.h:53