tor  0.4.2.0-alpha-dev
Macros | Functions
hs_config.c File Reference
#include "feature/hs/hs_common.h"
#include "feature/hs/hs_config.h"
#include "feature/hs/hs_client.h"
#include "feature/hs/hs_service.h"
#include "feature/rend/rendclient.h"
#include "feature/rend/rendservice.h"
#include "lib/encoding/confline.h"
#include "app/config/or_options_st.h"

Go to the source code of this file.

Functions

static void stage_services (smartlist_t *service_list)
 
static int service_is_duplicate_in_list (const smartlist_t *service_list, const hs_service_t *service)
 
static uint64_t helper_parse_uint64 (const char *opt, const char *value, uint64_t min, uint64_t max, int *ok)
 
static hs_circuit_id_protocol_t helper_parse_circuit_id_protocol (const char *key, const char *value, int *ok)
 
static int config_learn_service_version (hs_service_t *service)
 
static int config_has_invalid_options (const config_line_t *line_, const hs_service_t *service)
 
static int config_validate_service (const hs_service_config_t *config)
 
static int config_service_v3 (const config_line_t *line_, hs_service_config_t *config)
 
static int config_generic_service (const config_line_t *line_, const or_options_t *options, hs_service_t *service)
 
static int config_service (const config_line_t *line, const or_options_t *options, smartlist_t *service_list)
 
int hs_config_service_all (const or_options_t *options, int validate_only)
 
int hs_config_client_auth_all (const or_options_t *options, int validate_only)
 

Detailed Description

Implement hidden service configuration subsystem.

This file has basically one main entry point: hs_config_service_all(). It takes the torrc options and configure hidden service from it. In validate mode, nothing is added to the global service list or keys are not generated nor loaded.

A service is configured in two steps. It is first created using the tor options and then put in a staging list. It will stay there until hs_service_load_all_keys() is called. That function is responsible to load/generate the keys for the service in the staging list and if successful, transfert the service to the main global service list where at that point it is ready to be used.

Configuration functions are per-version and there is a main generic one for every option that is common to all version (config_generic_service).

Definition in file hs_config.c.

Function Documentation

◆ helper_parse_circuit_id_protocol()

static hs_circuit_id_protocol_t helper_parse_circuit_id_protocol ( const char *  key,
const char *  value,
int *  ok 
)
static

Helper function: Given a configuration option and its value, parse the value as a hs_circuit_id_protocol_t. On success, ok is set to 1 and ret is the parse value. On error, ok is set to 0 and the "none" hs_circuit_id_protocol_t is returned. This function logs on error.

Definition at line 153 of file hs_config.c.

References HS_CIRCUIT_ID_PROTOCOL_HAPROXY, HS_CIRCUIT_ID_PROTOCOL_NONE, and tor_assert().