Tor 0.4.9.0-alpha-dev
Enumerations | Functions
versions.h File Reference

Header file for versions.c. More...

Go to the source code of this file.

Enumerations

enum  version_status_t {
  VS_RECOMMENDED =0 , VS_OLD =1 , VS_NEW =2 , VS_NEW_IN_SERIES =3 ,
  VS_UNRECOMMENDED =4 , VS_EMPTY =5 , VS_UNKNOWN
}
 

Functions

time_t tor_get_approx_release_date (void)
 
version_status_t tor_version_is_obsolete (const char *myversion, const char *versionlist)
 
int tor_version_parse_platform (const char *platform, tor_version_t *version_out, int strict)
 
int tor_version_as_new_as (const char *platform, const char *cutoff)
 
int tor_version_parse (const char *s, tor_version_t *out)
 
int tor_version_compare (tor_version_t *a, tor_version_t *b)
 
int tor_version_same_series (tor_version_t *a, tor_version_t *b)
 
void sort_version_list (smartlist_t *lst, int remove_duplicates)
 
void summarize_protover_flags (protover_summary_flags_t *out, const char *protocols, const char *version)
 
void protover_summary_cache_free_all (void)
 

Detailed Description

Header file for versions.c.

Definition in file versions.h.

Enumeration Type Documentation

◆ version_status_t

Possible statuses of a version of Tor, given opinions from the directory servers.

Enumerator
VS_RECOMMENDED 

This version is listed as recommended.

VS_OLD 

This version is older than any recommended version.

VS_NEW 

This version is newer than any recommended version.

VS_NEW_IN_SERIES 

This version is newer than any recommended version in its series, but later recommended versions exist.

VS_UNRECOMMENDED 

This version is not recommended (general case).

VS_EMPTY 

The version list was empty; no agreed-on versions.

VS_UNKNOWN 

We have no idea.

Definition at line 17 of file versions.h.

Function Documentation

◆ protover_summary_cache_free_all()

void protover_summary_cache_free_all ( void  )

Free all space held in the protover_summary_map.

Definition at line 544 of file versions.c.

Referenced by memoize_protover_summary().

◆ sort_version_list()

void sort_version_list ( smartlist_t versions,
int  remove_duplicates 
)

Sort a list of string-representations of versions in ascending order.

Definition at line 391 of file versions.c.

◆ summarize_protover_flags()

void summarize_protover_flags ( protover_summary_flags_t out,
const char *  protocols,
const char *  version 
)

Summarize the protocols listed in protocols into out, falling back or correcting them based on version as appropriate.

If protocols and version are both NULL or "", returns a summary with no flags set.

If the protover string does not contain any recognised protocols, and the version is not recognised, sets protocols_known, but does not set any other flags. (Empty strings are also treated this way.)

Definition at line 514 of file versions.c.

◆ tor_get_approx_release_date()

time_t tor_get_approx_release_date ( void  )

Return the approximate date when this release came out, or was scheduled to come out, according to the APPROX_RELEASE_DATE set in configure.ac

Definition at line 25 of file versions.c.

Referenced by networkstatus_check_required_protocols().

◆ tor_version_as_new_as()

int tor_version_as_new_as ( const char *  platform,
const char *  cutoff 
)

Parse the Tor version of the platform string platform, and compare it to the version in cutoff. Return 1 if the router is at least as new as the cutoff, else return 0.

Definition at line 171 of file versions.c.

Referenced by dirserv_rejects_tor_version(), protover_compute_for_old_tor(), and summarize_protover_flags().

◆ tor_version_compare()

int tor_version_compare ( tor_version_t a,
tor_version_t b 
)

Compare two tor versions; Return <0 if a < b; 0 if a ==b, >0 if a > b.

Definition at line 315 of file versions.c.

Referenced by compare_tor_version_str_ptr_().

◆ tor_version_is_obsolete()

version_status_t tor_version_is_obsolete ( const char *  myversion,
const char *  versionlist 
)

Return VS_RECOMMENDED if myversion is contained in versionlist. Else, return VS_EMPTY if versionlist has no entries. Else, return VS_OLD if every member of versionlist is newer than myversion. Else, return VS_NEW_IN_SERIES if there is at least one member of versionlist in the same series (major.minor.micro) as myversion, but no such member is newer than myversion.. Else, return VS_NEW if every member of versionlist is older than myversion. Else, return VS_UNRECOMMENDED.

(versionlist is a comma-separated list of version strings, optionally prefixed with "Tor". Versions that can't be parsed are ignored.)

Definition at line 53 of file versions.c.

◆ tor_version_parse()

int tor_version_parse ( const char *  s,
tor_version_t out 
)

Parse a tor version from s, and store the result in out. Return 0 on success, -1 on failure.

Definition at line 206 of file versions.c.

Referenced by compare_tor_version_str_ptr_(), and tor_version_as_new_as().

◆ tor_version_parse_platform()

int tor_version_parse_platform ( const char *  platform,
tor_version_t router_version,
int  strict 
)

Extract a Tor version from a platform line from a router descriptor, and place the result in router_version.

Return 1 on success, -1 on parsing failure, and 0 if the platform line does not indicate some version of Tor.

If strict is non-zero, finding any weird version components (like negative numbers) counts as a parsing failure.

Definition at line 127 of file versions.c.

◆ tor_version_same_series()

int tor_version_same_series ( tor_version_t a,
tor_version_t b 
)

Return true iff versions a and b belong to the same series.

Definition at line 356 of file versions.c.