Tor  0.4.6.0-alpha-dev
Macros | Functions
transport_config.c File Reference

Code to interpret the user's configuration of Tor's server pluggable transports. More...

#include "orconfig.h"
#include "feature/relay/transport_config.h"
#include "lib/encoding/confline.h"
#include "lib/encoding/keyval.h"
#include "lib/container/smartlist.h"
#include "core/or/or.h"
#include "app/config/config.h"
#include "feature/relay/ext_orport.h"
#include "feature/relay/routermode.h"

Go to the source code of this file.

Macros

#define RELAY_TRANSPORT_CONFIG_PRIVATE
 
#define REJECT(arg)    STMT_BEGIN *msg = tor_strdup(arg); return -1; STMT_END
 

Functions

static char * get_bindaddr_from_transport_listen_line (const char *line, const char *transport)
 
char * pt_get_bindaddr_from_config (const char *transport)
 
STATIC smartlist_tget_options_from_transport_options_line (const char *line, const char *transport)
 
smartlist_tpt_get_options_for_server_transport (const char *transport)
 
int options_validate_server_transport (const or_options_t *old_options, or_options_t *options, char **msg)
 
int options_act_server_transport (const or_options_t *old_options)
 

Detailed Description

Code to interpret the user's configuration of Tor's server pluggable transports.

Definition in file transport_config.c.

Function Documentation

◆ get_bindaddr_from_transport_listen_line()

static char* get_bindaddr_from_transport_listen_line ( const char *  line,
const char *  transport 
)
static

Given a ServerTransportListenAddr line, return its <address:port> string. Return NULL if the line was not well-formed.

If transport is set, return NULL if the line is not referring to transport.

The returned string is allocated on the heap and it's the responsibility of the caller to free it.

Definition at line 43 of file transport_config.c.

Referenced by pt_get_bindaddr_from_config().

◆ get_options_from_transport_options_line()

STATIC smartlist_t* get_options_from_transport_options_line ( const char *  line,
const char *  transport 
)

Given a ServerTransportOptions line, return a smartlist with the options. Return NULL if the line was not well-formed.

If transport is set, return NULL if the line is not referring to transport.

The returned smartlist and its strings are allocated on the heap and it's the responsibility of the caller to free it.

Definition at line 117 of file transport_config.c.

Referenced by pt_get_options_for_server_transport().

◆ options_act_server_transport()

int options_act_server_transport ( const or_options_t old_options)

Fetch the active option list, and take server pluggable transport actions based on it. All of the things we do should survive being done repeatedly. If present, old_options contains the previous value of the options.

Return 0 if all goes well, return -1 if it's time to die.

Note: We haven't moved all the "act on new configuration" logic into the options_act* functions yet. Some is still in do_hup() and other places.

Definition at line 263 of file transport_config.c.

◆ options_validate_server_transport()

int options_validate_server_transport ( const or_options_t old_options,
or_options_t options,
char **  msg 
)

Legacy validation/normalization function for the server transport options. Uses old_options as the previous options.

Returns 0 on success, returns -1 and sets *msg to a newly allocated string on error.

If get_bindaddr_from_transport_listen_line() fails with 'transport' being NULL, it means that something went wrong while parsing the ServerTransportListenAddr line.

If get_options_from_transport_options_line() fails with 'transport' being NULL, it means that something went wrong while parsing the ServerTransportOptions line.

Definition at line 194 of file transport_config.c.

◆ pt_get_bindaddr_from_config()

char* pt_get_bindaddr_from_config ( const char *  transport)

Given the name of a pluggable transport in transport, check the configuration file to see if the user has explicitly asked for it to listen on a specific port. Return a <address:port> string if so, otherwise NULL.

Definition at line 93 of file transport_config.c.

Referenced by get_stored_bindaddr_for_server_transport().

◆ pt_get_options_for_server_transport()

smartlist_t* pt_get_options_for_server_transport ( const char *  transport)

Given the name of a pluggable transport in transport, check the configuration file to see if the user has asked us to pass any parameters to the pluggable transport. Return a smartlist containing the parameters, otherwise NULL.

Definition at line 171 of file transport_config.c.

Referenced by get_transport_options_for_server_proxy().