123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- #ifndef TOR_ONION_H
- #define TOR_ONION_H
- struct create_cell_t;
- struct curve25519_keypair_t;
- struct curve25519_public_key_t;
- #include "lib/crypt_ops/crypto_ed25519.h"
- #define MAX_ONIONSKIN_CHALLENGE_LEN 255
- #define MAX_ONIONSKIN_REPLY_LEN 255
- typedef struct create_cell_t {
-
- uint8_t cell_type;
-
- uint16_t handshake_type;
-
- uint16_t handshake_len;
-
- uint8_t onionskin[CELL_PAYLOAD_SIZE - 4];
- } create_cell_t;
- typedef struct created_cell_t {
-
- uint8_t cell_type;
-
- uint16_t handshake_len;
-
- uint8_t reply[CELL_PAYLOAD_SIZE - 2];
- } created_cell_t;
- typedef struct extend_cell_t {
-
- uint8_t cell_type;
-
- tor_addr_port_t orport_ipv4;
-
- tor_addr_port_t orport_ipv6;
-
- uint8_t node_id[DIGEST_LEN];
-
- struct ed25519_public_key_t ed_pubkey;
-
- create_cell_t create_cell;
- } extend_cell_t;
- typedef struct extended_cell_t {
-
- uint8_t cell_type;
-
- created_cell_t created_cell;
- } extended_cell_t;
- 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);
- int create_cell_parse(create_cell_t *cell_out, const cell_t *cell_in);
- int created_cell_parse(created_cell_t *cell_out, const cell_t *cell_in);
- int extend_cell_parse(extend_cell_t *cell_out, const uint8_t command,
- const uint8_t *payload_in, size_t payload_len);
- int extended_cell_parse(extended_cell_t *cell_out, const uint8_t command,
- const uint8_t *payload_in, size_t payload_len);
- int create_cell_format(cell_t *cell_out, const create_cell_t *cell_in);
- int create_cell_format_relayed(cell_t *cell_out, const create_cell_t *cell_in);
- int created_cell_format(cell_t *cell_out, const created_cell_t *cell_in);
- int extend_cell_format(uint8_t *command_out, uint16_t *len_out,
- uint8_t *payload_out, const extend_cell_t *cell_in);
- int extended_cell_format(uint8_t *command_out, uint16_t *len_out,
- uint8_t *payload_out, const extended_cell_t *cell_in);
- #endif
|