tor  0.4.2.1-alpha-dev
Functions
statefile.h File Reference

Go to the source code of this file.

Functions

 MOCK_DECL (or_state_t *, get_or_state,(void))
 
int did_last_state_file_write_fail (void)
 
int or_state_save (time_t now)
 
void save_transport_to_state (const char *transport_name, const tor_addr_t *addr, uint16_t port)
 
char * get_stored_bindaddr_for_server_transport (const char *transport)
 
int or_state_load (void)
 
int or_state_loaded (void)
 
void or_state_free_all (void)
 
void or_state_mark_dirty (or_state_t *state, time_t when)
 

Detailed Description

Header for statefile.c.

Definition in file statefile.h.

Function Documentation

◆ did_last_state_file_write_fail()

int did_last_state_file_write_fail ( void  )

Return whether the state file failed to write last time we tried.

Definition at line 485 of file statefile.c.

References last_state_file_write_failed.

◆ get_stored_bindaddr_for_server_transport()

char* get_stored_bindaddr_for_server_transport ( const char *  transport)

Return a string containing the address:port that a proxy transport should bind on. The string is stored on the heap and must be freed by the caller of this function.

If we didn't find references for this pluggable transport in the state file, we should instruct the pluggable transport proxy to listen on INADDR_ANY on a random ephemeral port.

Definition at line 627 of file statefile.c.

References get_transport_bindaddr(), get_transport_bindaddr_from_config(), and get_transport_in_state_by_name().

Referenced by get_bindaddr_for_server_proxy().

◆ or_state_load()

int or_state_load ( void  )

Reload the persistent state from disk, generating a new state as needed. Return 0 on success, less than 0 on failure.

Definition at line 381 of file statefile.c.

◆ or_state_loaded()

int or_state_loaded ( void  )

Return true iff we have loaded the global state for this Tor

Definition at line 203 of file statefile.c.

References global_state.

◆ or_state_mark_dirty()

void or_state_mark_dirty ( or_state_t state,
time_t  when 
)

Change the next_write time of state to when, unless the state is already scheduled to be written to disk earlier than when.

Definition at line 722 of file statefile.c.

References or_state_t::next_write, and reschedule_or_state_save().

Referenced by entry_guards_changed_for_guard_selection(), entry_guards_update_state(), and tor_cleanup().

◆ or_state_save()

int or_state_save ( time_t  now)

Write the persistent state to disk. Return 0 for success, <0 on failure.

Definition at line 500 of file statefile.c.

Referenced by save_state_callback(), and tor_cleanup().

◆ save_transport_to_state()

void save_transport_to_state ( const char *  transport,
const tor_addr_t addr,
uint16_t  port 
)

Save transport listening on addr:port to state

find where to write on the state

Definition at line 660 of file statefile.c.

References get_transport_bindaddr(), and get_transport_in_state_by_name().

Referenced by register_server_proxy().