tor  0.4.2.0-alpha-dev
Macros | Typedefs | Enumerations | Functions
protover.h File Reference
#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_HSDIR_V3   2
 
#define PROTOVER_HS_INTRO_V3   4
 
#define PROTOVER_HS_RENDEZVOUS_POINT_V3   2
 
#define PROTOVER_HS_SETUP_PADDING   2
 

Typedefs

typedef enum protocol_type_t protocol_type_t
 

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_contains_long_protocol_names (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)
 
char * protover_compute_vote (const struct smartlist_t *list_of_proto_strings, int threshold)
 
const char * protover_compute_for_old_tor (const char *version)
 
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_V3

#define PROTOVER_HS_INTRO_V3   4

The protover version number that signifies HSv3 intro point support

Definition at line 28 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 30 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 32 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 26 of file protover.h.

Typedef 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

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 37 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.

Definition at line 331 of file protover.c.

References parse_protocol_list(), protocol_list_contains(), and SMARTLIST_FOREACH.

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.

Definition at line 353 of file protover.c.

References parse_protocol_list(), protocol_type_to_str(), and SMARTLIST_FOREACH_BEGIN.

◆ 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.

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 748 of file protover.c.

References parse_protocol_list().

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 902 of file protover.c.

References FIRST_TOR_VERSION_TO_ADVERTISE_PROTOCOLS, and tor_version_as_new_as().

◆ protover_contains_long_protocol_names()

bool protover_contains_long_protocol_names ( const char *  s)

Return true if the unparsed protover in s would contain a protocol name longer than MAX_PROTOCOL_NAME_LENGTH, and false otherwise.

Definition at line 305 of file protover.c.

References parse_protocol_list(), and SMARTLIST_FOREACH.

◆ protover_free_all()

void protover_free_all ( void  )

Release all storage held by static fields in protover.c

Definition at line 940 of file protover.c.

References SMARTLIST_FOREACH, and supported_protocol_list.

◆ 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 388 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 320 of file protover.c.

References get_supported_protocol_list(), and protocol_list_contains().