Tor  0.4.7.0-alpha-dev
Data Structures | Macros | Functions
hs_cell.h File Reference

Header file containing cell data for the whole HS subsystem. More...

#include "core/or/or.h"
#include "feature/hs/hs_service.h"

Go to the source code of this file.

Data Structures

struct  hs_cell_introduce1_data_t
 
struct  hs_cell_introduce2_data_t
 

Macros

#define HS_CELL_INTRODUCE1_MIN_SIZE   246
 

Functions

ssize_t hs_cell_build_establish_intro (const char *circ_nonce, const hs_service_config_t *config, const hs_service_intro_point_t *ip, uint8_t *cell_out)
 
ssize_t hs_cell_build_rendezvous1 (const uint8_t *rendezvous_cookie, size_t rendezvous_cookie_len, const uint8_t *rendezvous_handshake_info, size_t rendezvous_handshake_info_len, uint8_t *cell_out)
 
ssize_t hs_cell_build_introduce1 (const hs_cell_introduce1_data_t *data, uint8_t *cell_out)
 
ssize_t hs_cell_build_establish_rendezvous (const uint8_t *rendezvous_cookie, uint8_t *cell_out)
 
ssize_t hs_cell_parse_intro_established (const uint8_t *payload, size_t payload_len)
 
ssize_t hs_cell_parse_introduce2 (hs_cell_introduce2_data_t *data, const origin_circuit_t *circ, const hs_service_t *service)
 
int hs_cell_parse_introduce_ack (const uint8_t *payload, size_t payload_len)
 
int hs_cell_parse_rendezvous2 (const uint8_t *payload, size_t payload_len, uint8_t *handshake_info, size_t handshake_info_len)
 
void hs_cell_introduce1_data_clear (hs_cell_introduce1_data_t *data)
 

Detailed Description

Header file containing cell data for the whole HS subsystem.

Definition in file hs_cell.h.

Macro Definition Documentation

◆ HS_CELL_INTRODUCE1_MIN_SIZE

#define HS_CELL_INTRODUCE1_MIN_SIZE   246

An INTRODUCE1 cell requires at least this amount of bytes (see section 3.2.2 of the specification). Below this value, the cell must be padded.

Definition at line 17 of file hs_cell.h.

Function Documentation

◆ hs_cell_build_establish_intro()

ssize_t hs_cell_build_establish_intro ( const char *  circ_nonce,
const hs_service_config_t service_config,
const hs_service_intro_point_t ip,
uint8_t *  cell_out 
)

Build an ESTABLISH_INTRO cell with the given circuit nonce and intro point object. The encoded cell is put in cell_out that MUST at least be of the size of RELAY_PAYLOAD_SIZE. Return the encoded cell length on success else a negative value and cell_out is untouched.

Definition at line 563 of file hs_cell.c.

Referenced by send_establish_intro().

◆ hs_cell_build_establish_rendezvous()

ssize_t hs_cell_build_establish_rendezvous ( const uint8_t *  rendezvous_cookie,
uint8_t *  cell_out 
)

Build an ESTABLISH_RENDEZVOUS cell from the given rendezvous_cookie. The encoded cell is put in cell_out which must be of at least RELAY_PAYLOAD_SIZE. On success, the encoded length is returned and the caller should clear up the content of the cell.

This function can't fail.

Definition at line 985 of file hs_cell.c.

◆ hs_cell_build_introduce1()

ssize_t hs_cell_build_introduce1 ( const hs_cell_introduce1_data_t data,
uint8_t *  cell_out 
)

Build an INTRODUCE1 cell from the given data. The encoded cell is put in cell_out which must be of at least size RELAY_PAYLOAD_SIZE. On success, the encoded length is returned else a negative value and the content of cell_out should be ignored.

Definition at line 945 of file hs_cell.c.

◆ hs_cell_build_rendezvous1()

ssize_t hs_cell_build_rendezvous1 ( const uint8_t *  rendezvous_cookie,
size_t  rendezvous_cookie_len,
const uint8_t *  rendezvous_handshake_info,
size_t  rendezvous_handshake_info_len,
uint8_t *  cell_out 
)

Build a RENDEZVOUS1 cell with the given rendezvous cookie and handshake info. The encoded cell is put in cell_out and the length of the data is returned. This can't fail.

Definition at line 910 of file hs_cell.c.

◆ hs_cell_introduce1_data_clear()

void hs_cell_introduce1_data_clear ( hs_cell_introduce1_data_t data)

Clear the given INTRODUCE1 data structure data.

Definition at line 1052 of file hs_cell.c.

◆ hs_cell_parse_intro_established()

ssize_t hs_cell_parse_intro_established ( const uint8_t *  payload,
size_t  payload_len 
)

Parse the INTRO_ESTABLISHED cell in the payload of size payload_len. If we are successful at parsing it, return the length of the parsed cell else a negative value on error.

Definition at line 677 of file hs_cell.c.

◆ hs_cell_parse_introduce2()

ssize_t hs_cell_parse_introduce2 ( hs_cell_introduce2_data_t data,
const origin_circuit_t circ,
const hs_service_t service 
)

Parse the INTRODUCE2 cell using data which contains everything we need to do so and contains the destination buffers of information we extract and compute from the cell. Return 0 on success else a negative value. The service and circ are only used for logging purposes.

Definition at line 768 of file hs_cell.c.

Referenced by hs_circ_handle_introduce2().

◆ hs_cell_parse_introduce_ack()

int hs_cell_parse_introduce_ack ( const uint8_t *  payload,
size_t  payload_len 
)

Handle an INTRODUCE_ACK cell encoded in payload of length payload_len. Return the status code on success else a negative value if the cell as not decodable.

Definition at line 999 of file hs_cell.c.

◆ hs_cell_parse_rendezvous2()

int hs_cell_parse_rendezvous2 ( const uint8_t *  payload,
size_t  payload_len,
uint8_t *  handshake_info,
size_t  handshake_info_len 
)

Handle a RENDEZVOUS2 cell encoded in payload of length payload_len. On success, handshake_info contains the data in the HANDSHAKE_INFO field, and 0 is returned. On error, a negative value is returned.

Definition at line 1022 of file hs_cell.c.

Referenced by handle_rendezvous2().