Tor  0.4.7.0-alpha-dev
Macros | Enumerations | Functions
fmt_routerstatus.h File Reference

Format routerstatus entries for controller, vote, or consensus. More...

Go to the source code of this file.

Macros

#define MAX_V_LINE_LEN   128
 

Enumerations

enum  routerstatus_format_type_t {
  NS_V2 , NS_V3_CONSENSUS , NS_V3_VOTE , NS_CONTROL_PORT ,
  NS_V3_CONSENSUS_MICRODESC
}
 

Functions

char * routerstatus_format_entry (const routerstatus_t *rs, const char *version, const char *protocols, routerstatus_format_type_t format, const vote_routerstatus_t *vrs)
 

Detailed Description

Format routerstatus entries for controller, vote, or consensus.

Header file for fmt_routerstatus.c.

(Because controllers consume this format, we can't make this code dirauth-only.)

Definition in file fmt_routerstatus.h.

Macro Definition Documentation

◆ MAX_V_LINE_LEN

#define MAX_V_LINE_LEN   128

Maximum allowable length of a version line in a networkstatus.

Definition at line 31 of file fmt_routerstatus.h.

Enumeration Type Documentation

◆ routerstatus_format_type_t

An enum to describe what format we're generating a routerstatus line in.

Enumerator
NS_V2 

For use in a v2 opinion

NS_V3_CONSENSUS 

For use in a consensus networkstatus document (ns flavor)

NS_V3_VOTE 

For use in a vote networkstatus document

NS_CONTROL_PORT 

For passing to the controlport in response to a GETINFO request

NS_V3_CONSENSUS_MICRODESC 

For use in a consensus networkstatus document (microdesc flavor)

Definition at line 17 of file fmt_routerstatus.h.

Function Documentation

◆ routerstatus_format_entry()

char* routerstatus_format_entry ( const routerstatus_t rs,
const char *  version,
const char *  protocols,
routerstatus_format_type_t  format,
const vote_routerstatus_t vrs 
)

Helper: write the router-status information in rs into a newly allocated character buffer. Use the same format as in network-status documents. If version is non-NULL, add a "v" line for the platform.

Return 0 on success, -1 on failure.

The format argument has one of the following values: NS_V2 - Output an entry suitable for a V2 NS opinion document NS_V3_CONSENSUS - Output the first portion of a V3 NS consensus entry for consensus_method. NS_V3_CONSENSUS_MICRODESC - Output the first portion of a V3 microdesc consensus entry for consensus_method. NS_V3_VOTE - Output a complete V3 NS vote. If vrs is present, it contains additional information for the vote. NS_CONTROL_PORT - Output a NS document for the control port.

Definition at line 43 of file fmt_routerstatus.c.

Referenced by networkstatus_getinfo_helper_single().