Tor  0.4.7.0-alpha-dev
Functions
statefile.h File Reference

Header for statefile.c. More...

Go to the source code of this file.

Functions

or_state_tget_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 547 of file statefile.c.

◆ get_or_state()

or_state_t* get_or_state ( void  )

◆ 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 689 of file statefile.c.

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 412 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 228 of file statefile.c.

◆ 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 784 of file statefile.c.

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 562 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 722 of file statefile.c.

Referenced by register_server_proxy().