Tor 0.4.9.8
Loading...
Searching...
No Matches
onion.h File Reference

Header file for onion.c. More...

Go to the source code of this file.

Data Structures

struct  create_cell_t
 
struct  created_cell_t
 
struct  extend_cell_t
 
struct  extended_cell_t
 

Macros

#define MAX_ONIONSKIN_CHALLENGE_LEN   255
 
#define MAX_ONIONSKIN_REPLY_LEN   255
 
#define MAX_CREATE_LEN   (CELL_PAYLOAD_SIZE - 4)
 
#define MAX_CREATED_LEN   (CELL_PAYLOAD_SIZE - 2)
 

Functions

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)
 

Detailed Description

Header file for onion.c.

Definition in file onion.h.

Macro Definition Documentation

◆ MAX_CREATE_LEN

#define MAX_CREATE_LEN   (CELL_PAYLOAD_SIZE - 4)

Definition at line 23 of file onion.h.

◆ MAX_CREATED_LEN

#define MAX_CREATED_LEN   (CELL_PAYLOAD_SIZE - 2)

Definition at line 24 of file onion.h.

◆ MAX_ONIONSKIN_CHALLENGE_LEN

#define MAX_ONIONSKIN_CHALLENGE_LEN   255

Definition at line 20 of file onion.h.

◆ MAX_ONIONSKIN_REPLY_LEN

#define MAX_ONIONSKIN_REPLY_LEN   255

Definition at line 21 of file onion.h.

Function Documentation

◆ create_cell_format()

int create_cell_format ( cell_t * cell_out,
const create_cell_t * cell_in )

Definition at line 495 of file onion.c.

◆ create_cell_format_relayed()

int create_cell_format_relayed ( cell_t * cell_out,
const create_cell_t * cell_in )

Definition at line 501 of file onion.c.

◆ create_cell_init()

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 )

Write the various parameters into the create cell. Separate from create_cell_parse() to make unit testing easier.

Definition at line 101 of file onion.c.

Referenced by create_cell_parse(), and parse_create2_payload().

◆ create_cell_parse()

int create_cell_parse ( create_cell_t * cell_out,
const cell_t * cell_in )

Parse a CREATE, CREATE_FAST, or CREATE2 cell from cell_in into cell_out. Return 0 on success, -1 on failure. (We reject some syntactically valid CREATE2 cells that we can't generate or react to.)

Definition at line 153 of file onion.c.

Referenced by command_process_create_cell().

◆ created_cell_format()

int created_cell_format ( cell_t * cell_out,
const created_cell_t * cell_in )

Fill cell_out with a correctly formatted version of the CREATED{,_FAST,2} cell in cell_in. Return 0 on success, -1 on failure.

Definition at line 510 of file onion.c.

Referenced by onionskin_answer().

◆ created_cell_parse()

int created_cell_parse ( created_cell_t * cell_out,
const cell_t * cell_in )

Parse a CREATED, CREATED_FAST, or CREATED2 cell from cell_in into cell_out. Return 0 on success, -1 on failure.

Definition at line 199 of file onion.c.

Referenced by command_process_created_cell().

◆ extend_cell_format()

int extend_cell_format ( uint8_t * command_out,
uint16_t * len_out,
uint8_t * payload_out,
const extend_cell_t * cell_in )

Format the EXTEND{,2} cell in cell_in, storing its relay payload in payload_out, the number of bytes used in *len_out, and the relay command in *command_out. The payload_out must have RELAY_PAYLOAD_SIZE_MAX bytes available.

Return 0 on success, -1 on failure.

Definition at line 557 of file onion.c.

Referenced by circuit_send_intermediate_onion_skin().

◆ extend_cell_parse()

int extend_cell_parse ( extend_cell_t * cell_out,
const uint8_t command,
const uint8_t * payload,
size_t payload_length )

Parse an EXTEND or EXTEND2 cell (according to command) from the payload_length bytes of payload into cell_out. Return 0 on success, -1 on failure.

Definition at line 352 of file onion.c.

Referenced by circuit_extend().

◆ extended_cell_format()

int extended_cell_format ( uint8_t * command_out,
uint16_t * len_out,
uint8_t * payload_out,
const extended_cell_t * cell_in )

Format the EXTENDED{,2} cell in cell_in, storing its relay payload in payload_out, the number of bytes used in *len_out, and the relay command in *command_out. The payload_out must have RELAY_PAYLOAD_SIZE_MAX bytes available.

Return 0 on success, -1 on failure.

Definition at line 651 of file onion.c.

Referenced by command_process_created_cell().

◆ extended_cell_parse()

int extended_cell_parse ( extended_cell_t * cell_out,
const uint8_t command,
const uint8_t * payload,
size_t payload_len )

Parse an EXTENDED or EXTENDED2 cell (according to command) from the payload_len bytes of payload into cell_out. Return 0 on success, -1 on failure.

Definition at line 409 of file onion.c.

Referenced by handle_relay_msg().