tor

The Tor anonymity network
git clone https://git.dasho.dev/tor.git
Log | Files | Refs | README | LICENSE

conflux_cell.h (1462B)


      1 /* Copyright (c) 2023, The Tor Project, Inc. */
      2 /* See LICENSE for licensing information */
      3 
      4 /**
      5 * \file conflux_cell.h
      6 * \brief Header file for conflux_cell.c.
      7 **/
      8 
      9 #ifndef TOR_CONFLUX_CELL_H
     10 #define TOR_CONFLUX_CELL_H
     11 
     12 #include "core/or/or.h"
     13 #include "core/or/relay_msg_st.h"
     14 
     15 typedef struct conflux_cell_link_t {
     16  uint8_t version;
     17  uint8_t desired_ux;
     18  uint8_t nonce[DIGEST256_LEN];
     19 
     20  uint64_t last_seqno_sent;
     21  uint64_t last_seqno_recv;
     22 } conflux_cell_link_t;
     23 
     24 conflux_cell_link_t *conflux_cell_new_link(const uint8_t *nonce,
     25                                           uint64_t last_sent,
     26                                           uint64_t last_recv,
     27                                           uint8_t ux);
     28 
     29 conflux_cell_link_t *conflux_cell_parse_link(const relay_msg_t *msg);
     30 conflux_cell_link_t *conflux_cell_parse_linked(const relay_msg_t *msg);
     31 uint32_t conflux_cell_parse_switch(const relay_msg_t *msg);
     32 
     33 bool conflux_cell_send_link(const conflux_cell_link_t *link,
     34                            origin_circuit_t *circ);
     35 bool conflux_cell_send_linked(const conflux_cell_link_t *link,
     36                              or_circuit_t *circ);
     37 bool conflux_cell_send_linked_ack(origin_circuit_t *circ);
     38 bool conflux_send_switch_command(circuit_t *send_circ, uint64_t relative_seq);
     39 
     40 #ifdef TOR_UNIT_TESTS
     41 
     42 STATIC ssize_t
     43 build_link_cell(const conflux_cell_link_t *link, uint8_t *cell_out);
     44 
     45 #endif /* TOR_UNIT_TESTS */
     46 
     47 #endif /* TOR_CONFLUX_CELL_H */