Tor 0.4.9.0-alpha-dev
Macros | Functions
tor_api.c File Reference
#include "feature/api/tor_api.h"
#include "orconfig.h"
#include "lib/cc/compat_compiler.h"
#include "lib/cc/torint.h"
#include "feature/api/tor_api_internal.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

Go to the source code of this file.

Macros

#define raw_malloc   malloc
 
#define raw_free   free
 
#define raw_realloc   realloc
 
#define raw_strdup   strdup
 
#define raw_socketpair   socketpair
 
#define raw_closesocket   close
 

Functions

static int cfg_add_owned_arg (tor_main_configuration_t *cfg, const char *arg)
 
tor_main_configuration_ttor_main_configuration_new (void)
 
int tor_main_configuration_set_command_line (tor_main_configuration_t *cfg, int argc, char *argv[])
 
tor_control_socket_t tor_main_configuration_setup_control_socket (tor_main_configuration_t *cfg)
 
void tor_main_configuration_free (tor_main_configuration_t *cfg)
 
const char * tor_api_get_provider_version (void)
 
int tor_main (int argc, char *argv[])
 

Macro Definition Documentation

◆ raw_closesocket

#define raw_closesocket   close

Definition at line 47 of file tor_api.c.

◆ raw_free

#define raw_free   free

Definition at line 34 of file tor_api.c.

◆ raw_malloc

#define raw_malloc   malloc

Definition at line 33 of file tor_api.c.

◆ raw_realloc

#define raw_realloc   realloc

Definition at line 35 of file tor_api.c.

◆ raw_socketpair

#define raw_socketpair   socketpair

Definition at line 46 of file tor_api.c.

◆ raw_strdup

#define raw_strdup   strdup

Definition at line 36 of file tor_api.c.

Function Documentation

◆ cfg_add_owned_arg()

static int cfg_add_owned_arg ( tor_main_configuration_t cfg,
const char *  arg 
)
static

Helper: Add a copy of arg to the owned arguments of cfg. Return 0 on success, -1 on failure.

Definition at line 59 of file tor_api.c.

◆ tor_api_get_provider_version()

const char * tor_api_get_provider_version ( void  )

Return the name and version of the software implementing the tor_api functionality. Current implementors are "tor" and "libtorrunner".

Note that if you're using libtorrunner, you'll see the version of libtorrunner, not the version of Tor that it's invoking for you.

Added in Tor 0.3.5.1-alpha.

Example return values include "tor 0.3.5.1-alpha" when linked directly against tor, and "libtorrunner 0.3.5.1-alpha" when linked against libtorrunner while it is invoking an arbitrary version of Tor. HOWEVER, the user MUST NOT depend on any particular format or contents of this string: there may be other things that implement Tor in the future.

Definition at line 141 of file tor_api.c.

◆ tor_main()

int tor_main ( int  argc,
char *  argv[] 
)

Definition at line 155 of file tor_api.c.

◆ tor_main_configuration_free()

void tor_main_configuration_free ( tor_main_configuration_t cfg)

Release all storage held in cfg.

Once you have passed a tor_main_configuration_t to tor_run_main(), you must not free it until tor_run_main() has finished.

Definition at line 124 of file tor_api.c.

◆ tor_main_configuration_new()

tor_main_configuration_t * tor_main_configuration_new ( void  )

Create and return a new tor_main_configuration().

Definition at line 75 of file tor_api.c.

◆ tor_main_configuration_set_command_line()

int tor_main_configuration_set_command_line ( tor_main_configuration_t cfg,
int  argc,
char *  argv[] 
)

Set the command-line arguments in cfg.

The argc and argv values here are as for main(). The contents of the argv pointer must remain unchanged until tor_run_main() has finished and you call tor_main_configuration_free().

Return 0 on success, -1 on failure.

Definition at line 93 of file tor_api.c.

◆ tor_main_configuration_setup_control_socket()

tor_control_socket_t tor_main_configuration_setup_control_socket ( tor_main_configuration_t cfg)

DOCDOC

Definition at line 104 of file tor_api.c.