predict_ports.h File Reference

Header file for predict_ports.c. More...

Go to the source code of this file.


void predicted_ports_init (void)
void rep_hist_note_used_port (time_t now, uint16_t port)
smartlist_trep_hist_get_predicted_ports (time_t now)
void rep_hist_remove_predicted_ports (const smartlist_t *rmv_ports)
void rep_hist_note_used_resolve (time_t now)
void rep_hist_note_used_internal (time_t now, int need_uptime, int need_capacity)
int rep_hist_get_predicted_internal (time_t now, int *need_uptime, int *need_capacity)
int any_predicted_circuits (time_t now)
int rep_hist_circbuilding_dormant (time_t now)
int predicted_ports_prediction_time_remaining (time_t now)
void predicted_ports_free_all (void)

Detailed Description

Header file for predict_ports.c.

Definition in file predict_ports.h.

Function Documentation

◆ any_predicted_circuits()

int any_predicted_circuits ( time_t  now)

Any ports used lately? These are pre-seeded if we just started up or if we're running a hidden service.

Definition at line 253 of file predict_ports.c.

Referenced by check_for_reachability_bw_callback(), directory_info_has_arrived(), rep_hist_circbuilding_dormant(), and rep_hist_note_used_internal().

◆ predicted_ports_free_all()

void predicted_ports_free_all ( void  )

Free whatever memory is needed for predicting which ports will be used.

Definition at line 302 of file predict_ports.c.

◆ predicted_ports_init()

void predicted_ports_init ( void  )

Definition at line 292 of file predict_ports.c.

◆ predicted_ports_prediction_time_remaining()

int predicted_ports_prediction_time_remaining ( time_t  now)

How much time left until we stop predicting circuits?

Definition at line 54 of file predict_ports.c.

◆ rep_hist_circbuilding_dormant()

int rep_hist_circbuilding_dormant ( time_t  now)

Return 1 if we have no need for circuits currently, else return 0.

Definition at line 264 of file predict_ports.c.

Referenced by dirclient_too_idle_to_fetch_descriptors().

◆ rep_hist_get_predicted_internal()

int rep_hist_get_predicted_internal ( time_t  now,
int *  need_uptime,
int *  need_capacity 

Return 1 if we've used an internal circ recently; else return 0.

Definition at line 229 of file predict_ports.c.

◆ rep_hist_get_predicted_ports()

smartlist_t * rep_hist_get_predicted_ports ( time_t  now)

Return a newly allocated pointer to a list of uint16_t * for ports that are likely to be asked for in the near future.

Definition at line 142 of file predict_ports.c.

Referenced by circuit_get_unhandled_ports().

◆ rep_hist_note_used_internal()

void rep_hist_note_used_internal ( time_t  now,
int  need_uptime,
int  need_capacity 

Remember that we used an internal circ at time now.

Definition at line 206 of file predict_ports.c.

◆ rep_hist_note_used_port()

void rep_hist_note_used_port ( time_t  now,
uint16_t  port 

Remember that port has been asked for as of time now. This is used for predicting what sorts of streams we'll make in the future and making exit circuits to anticipate that.

Definition at line 115 of file predict_ports.c.

Referenced by rep_hist_note_used_resolve().

◆ rep_hist_note_used_resolve()

void rep_hist_note_used_resolve ( time_t  now)

The user asked us to do a resolve. Rather than keeping track of timings and such of resolves, we fake it for now by treating it the same way as a connection to port 80. This way we will continue to have circuits lying around if the user only uses Tor for resolves.

Definition at line 192 of file predict_ports.c.

◆ rep_hist_remove_predicted_ports()

void rep_hist_remove_predicted_ports ( const smartlist_t rmv_ports)

Take a list of uint16_t *, and remove every port in the list from the current list of predicted ports.

Definition at line 170 of file predict_ports.c.