Tor  0.4.5.0-alpha-dev
Macros | Enumerations | Functions
protover.h File Reference

Headers and type declarations for protover.c. More...

#include <stdbool.h>
#include "lib/cc/torint.h"
#include "lib/testsupport/testsupport.h"

Go to the source code of this file.

Macros

#define FIRST_TOR_VERSION_TO_ADVERTISE_PROTOCOLS   "0.2.9.3-alpha"
 
#define PROTOVER_LINKAUTH_ED25519_HANDSHAKE   3
 
#define PROTOVER_RELAY_EXTEND2   2
 
#define PROTOVER_RELAY_ACCEPT_IPV6   2
 
#define PROTOVER_RELAY_EXTEND_IPV6   3
 
#define PROTOVER_RELAY_CANONICAL_IPV6   3
 
#define PROTOVER_HS_INTRO_V3   4
 
#define PROTOVER_HS_INTRO_DOS   5
 
#define PROTOVER_HS_RENDEZVOUS_POINT_V3   2
 
#define PROTOVER_HSDIR_V3   2
 
#define PROTOVER_HS_SETUP_PADDING   2
 

Enumerations

enum  protocol_type_t {
  PRT_LINK = 0, PRT_LINKAUTH = 1, PRT_RELAY = 2, PRT_DIRCACHE = 3,
  PRT_HSDIR = 4, PRT_HSINTRO = 5, PRT_HSREND = 6, PRT_DESC = 7,
  PRT_MICRODESC = 8, PRT_CONS = 9, PRT_PADDING = 10, PRT_FLOWCTRL = 11
}
 

Functions

bool protover_list_is_invalid (const char *s)
 
int protover_all_supported (const char *s, char **missing)
 
int protover_is_supported_here (protocol_type_t pr, uint32_t ver)
 
const char * protover_get_supported_protocols (void)
 C_RUST_COUPLED: src/rust/protover/protover.rs SUPPORTED_PROTOCOLS More...
 
char * protover_compute_vote (const struct smartlist_t *list_of_proto_strings, int threshold)
 
const char * protover_compute_for_old_tor (const char *version)
 C_RUST_COUPLED: src/rust/protover/protover.rs compute_for_old_tor More...
 
int protocol_list_supports_protocol (const char *list, protocol_type_t tp, uint32_t version)
 
int protocol_list_supports_protocol_or_later (const char *list, protocol_type_t tp, uint32_t version)
 
void protover_free_all (void)
 

Detailed Description

Headers and type declarations for protover.c.

Definition in file protover.h.

Macro Definition Documentation

◆ FIRST_TOR_VERSION_TO_ADVERTISE_PROTOCOLS

#define FIRST_TOR_VERSION_TO_ADVERTISE_PROTOCOLS   "0.2.9.3-alpha"

The first version of Tor that included "proto" entries in its descriptors. Authorities should use this to decide whether to guess proto lines. C_RUST_COUPLED: src/rust/protover/protover.rs FIRST_TOR_VERSION_TO_ADVERTISE_PROTOCOLS

Definition at line 23 of file protover.h.

◆ PROTOVER_HS_INTRO_DOS

#define PROTOVER_HS_INTRO_DOS   5

The protover version number where intro points support denial of service resistance

Definition at line 43 of file protover.h.

◆ PROTOVER_HS_INTRO_V3

#define PROTOVER_HS_INTRO_V3   4

The protover version number that signifies HSv3 intro point support

Definition at line 40 of file protover.h.

◆ PROTOVER_HS_RENDEZVOUS_POINT_V3

#define PROTOVER_HS_RENDEZVOUS_POINT_V3   2

The protover version number that signifies HSv3 rendezvous point support

Definition at line 46 of file protover.h.

◆ PROTOVER_HS_SETUP_PADDING

#define PROTOVER_HS_SETUP_PADDING   2

The protover that signals support for HS circuit setup padding machines

Definition at line 52 of file protover.h.

◆ PROTOVER_HSDIR_V3

#define PROTOVER_HSDIR_V3   2

The protover version number that signifies HSDir support for HSv3

Definition at line 49 of file protover.h.

◆ PROTOVER_LINKAUTH_ED25519_HANDSHAKE

#define PROTOVER_LINKAUTH_ED25519_HANDSHAKE   3

The protover version number that signifies ed25519 link handshake support

Definition at line 27 of file protover.h.

◆ PROTOVER_RELAY_ACCEPT_IPV6

#define PROTOVER_RELAY_ACCEPT_IPV6   2

The protover version number where relays can accept IPv6 connections

Definition at line 32 of file protover.h.

◆ PROTOVER_RELAY_CANONICAL_IPV6

#define PROTOVER_RELAY_CANONICAL_IPV6   3

The protover version number where relays can consider IPv6 connections canonical

Definition at line 37 of file protover.h.

◆ PROTOVER_RELAY_EXTEND2

#define PROTOVER_RELAY_EXTEND2   2

The protover version number that signifies extend2 cell support

Definition at line 30 of file protover.h.

◆ PROTOVER_RELAY_EXTEND_IPV6

#define PROTOVER_RELAY_EXTEND_IPV6   3

The protover version number where relays can initiate IPv6 extends

Definition at line 34 of file protover.h.

Enumeration Type Documentation

◆ protocol_type_t

List of recognized subprotocols. C_RUST_COUPLED: src/rust/protover/ffi.rs translate_to_rust C_RUST_COUPLED: src/rust/protover/protover.rs Proto

Definition at line 57 of file protover.h.

Function Documentation

◆ protocol_list_supports_protocol()

int protocol_list_supports_protocol ( const char *  list,
protocol_type_t  tp,
uint32_t  version 
)

Return true iff "list" encodes a protocol list that includes support for the indicated protocol and version.

If the protocol list is unparseable, treat it as if it defines no protocols, and return 0.

Definition at line 336 of file protover.c.

Referenced by memoize_protover_summary().

◆ protocol_list_supports_protocol_or_later()

int protocol_list_supports_protocol_or_later ( const char *  list,
protocol_type_t  tp,
uint32_t  version 
)

Return true iff "list" encodes a protocol list that includes support for the indicated protocol and version, or some later version.

If the protocol list is unparseable, treat it as if it defines no protocols, and return 0.

Definition at line 361 of file protover.c.

◆ protover_all_supported()

int protover_all_supported ( const char *  s,
char **  missing_out 
)

Return true if every protocol version described in the string s is one that we support, and false otherwise. If missing_out is provided, set it to the list of protocols we do not support.

If the protocol version string is unparseable, treat it as if it defines no protocols, and return 1.

NOTE: This is quadratic, but we don't do it much: only a few times per consensus. Checking signatures should be way more expensive than this ever would be.

Definition at line 764 of file protover.c.

Referenced by networkstatus_check_required_protocols().

◆ protover_compute_for_old_tor()

const char* protover_compute_for_old_tor ( const char *  version)

C_RUST_COUPLED: src/rust/protover/protover.rs compute_for_old_tor

Return a string describing the protocols supported by tor version version, or an empty string if we cannot tell.

Note that this is only used to infer protocols for Tor versions that can't declare their own.

Definition at line 918 of file protover.c.

◆ protover_free_all()

void protover_free_all ( void  )

Release all storage held by static fields in protover.c

Definition at line 956 of file protover.c.

◆ protover_get_supported_protocols()

const char* protover_get_supported_protocols ( void  )

C_RUST_COUPLED: src/rust/protover/protover.rs SUPPORTED_PROTOCOLS

Return the canonical string containing the list of protocols that we support.

Definition at line 396 of file protover.c.

◆ protover_is_supported_here()

int protover_is_supported_here ( protocol_type_t  pr,
uint32_t  ver 
)

Given a protocol type and version number, return true iff we know how to speak that protocol.

Definition at line 322 of file protover.c.

◆ protover_list_is_invalid()

bool protover_list_is_invalid ( const char *  s)

Return true if the unparsed protover list in s contains a parsing error, such as extra commas, a bad number, or an over-long name.

Definition at line 307 of file protover.c.