reasons.c File Reference

Convert circuit, stream, and orconn error reasons to and/or from strings and errno values. More...

#include "or.h"

Defines

#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)


Detailed Description

Convert circuit, stream, and orconn error reasons to and/or from strings and errno values.


Function Documentation

const char* bandwidth_weight_rule_to_string ( bandwidth_weight_rule_t  rule  ) 

Return a string corresponding to a bandwidht_weight_rule_t

Referenced by smartlist_choose_by_bandwidth(), and smartlist_choose_by_bandwidth_weights().

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.

References END_CIRC_AT_ORIGIN, END_CIRC_REASON_FLAG_REMOTE, END_CIRC_REASON_NOPATH, and LD_BUG.

Referenced by control_event_circuit_status().

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.

References LD_OR.

Referenced by connection_handle_read_impl(), connection_handle_write_impl(), and connection_or_connect().

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.

Referenced by connection_edge_end_errno().

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.

References LD_BUG.

Referenced by connection_about_to_close_connection(), control_event_bootstrap_problem(), and control_event_or_conn_status().

const char* socks4_response_code_to_string ( uint8_t  code  ) 

Return a string corresponding to a SOCKS4 reponse code.

Referenced by fetch_from_buf_socks_client().

const char* socks5_response_code_to_string ( uint8_t  code  ) 

Return a string corresponding to a SOCKS5 reponse code.

Referenced by fetch_from_buf_socks_client().

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.

References END_STREAM_REASON_CANT_ATTACH, END_STREAM_REASON_MASK, END_STREAM_REASON_NET_UNREACHABLE, and END_STREAM_REASON_SOCKSPROTOCOL.

Referenced by control_event_stream_status().

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.

References END_STREAM_REASON_CANT_ATTACH, END_STREAM_REASON_MASK, END_STREAM_REASON_NET_UNREACHABLE, END_STREAM_REASON_SOCKSPROTOCOL, and LD_PROTOCOL.

Referenced by connection_ap_handshake_socks_reply().

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.

References LD_PROTOCOL.

Referenced by connection_ap_process_end_not_open(), and connection_edge_process_relay_cell().

int tls_error_to_orconn_end_reason ( int  e  ) 

Convert a TOR_TLS_* error code into an END_OR_CONN_* reason.

Referenced by connection_about_to_close_connection().


Generated on Tue May 25 00:30:47 2010 for tor by  doxygen 1.5.6