tor
master
|
Convert circuit, stream, and orconn error reasons to and/or from strings and errno values. More...
Macros | |
#define | E_CASE(s) case s |
#define | S_CASE(s) case s |
Functions | |
const char * | stream_end_reason_to_control_string (int reason) |
const char * | stream_end_reason_to_string (int reason) |
socks5_reply_status_t | stream_end_reason_to_socks5_response (int reason) |
uint8_t | errno_to_stream_end_reason (int e) |
const char * | orconn_end_reason_to_control_string (int r) |
int | tls_error_to_orconn_end_reason (int e) |
int | errno_to_orconn_end_reason (int e) |
const char * | circuit_end_reason_to_control_string (int reason) |
const char * | socks4_response_code_to_string (uint8_t code) |
const char * | socks5_response_code_to_string (uint8_t code) |
const char * | bandwidth_weight_rule_to_string (bandwidth_weight_rule_t rule) |
const char * | end_reason_to_http_connect_response_line (int endreason) |
Convert circuit, stream, and orconn error reasons to and/or from strings and errno values.
This module is just a bunch of functions full of case statements that convert from one representation of our error codes to another. These are mainly used in generating log messages, in sending messages to the controller in control.c, and in converting errors from one protocol layer to another.
const char* bandwidth_weight_rule_to_string | ( | bandwidth_weight_rule_t | rule | ) |
Return a string corresponding to a bandwidth_weight_rule_t
const char* circuit_end_reason_to_control_string | ( | int | reason | ) |
Convert a numeric reason for destroying a circuit into a string for a CIRCUIT event.
const char* end_reason_to_http_connect_response_line | ( | int | endreason | ) |
Given a RELAY_END reason value, convert it to an HTTP response to be send over an HTTP tunnel connection.
int errno_to_orconn_end_reason | ( | int | e | ) |
Given an errno from a failed ORConn connection, return a reason code appropriate for use in the controller orconn events.
uint8_t errno_to_stream_end_reason | ( | int | e | ) |
Given an errno from a failed exit connection, return a reason code appropriate for use in a RELAY END cell.
const char* orconn_end_reason_to_control_string | ( | int | r | ) |
Convert the reason for ending an OR connection r into the format used in ORCONN events. Return "UNKNOWN" if the reason is unrecognized.
const char* socks4_response_code_to_string | ( | uint8_t | code | ) |
Return a string corresponding to a SOCKS4 response code.
const char* socks5_response_code_to_string | ( | uint8_t | code | ) |
Return a string corresponding to a SOCKS5 response code.
const char* stream_end_reason_to_control_string | ( | int | reason | ) |
Convert the reason for ending a stream reason into the format used in STREAM events. Return NULL if the reason is unrecognized.
socks5_reply_status_t stream_end_reason_to_socks5_response | ( | int | reason | ) |
Translate reason (as from a relay 'end' cell) into an appropriate SOCKS5 reply code.
A reason of 0 means that we're not actually expecting to send this code back to the socks client; we just call it 'succeeded' to keep things simple.
const char* stream_end_reason_to_string | ( | int | reason | ) |
Translate reason, which came from a relay 'end' cell, into a static const string describing why the stream is closing. reason is -1 if no reason was provided.
int tls_error_to_orconn_end_reason | ( | int | e | ) |
Convert a TOR_TLS_* error code into an END_OR_CONN_* reason.