Add connection ID to ORCONN event.

Jointly authored with Rob Jansen <jansen@cs.umn.edu>.
Add new CONN_BW event.

Jointly authored with Rob Jansen <jansen@cs.umn.edu>.
Add new CELL_STATS event.

Jointly authored with Rob Jansen <jansen@cs.umn.edu>.
Add new TB_EMPTY event.

Jointly authored with Rob Jansen <jansen@cs.umn.edu>.
Add new CIRC_BW event.
Tweak ORCONN event based on comments by nickm.

- Move new ID= parameter in ORCONN event to end.  Avoids possible trouble
  from controllers that parse parameters by position, even though they
  shouldn't.
Tweak CONN_BW event based on comments by nickm.

- Rename read/write counters in connection_t to make it clear that these
  are only used for CONN_BW events.
- Add TestingEnableConnBwEvent option.
Tweak CELL_STATS event based on comments by nickm.

- Move cell_command_to_string from control.c to command.c.
- Use accessor for global_circuitlist instead of extern.
- Add a struct for cell statistics by command instead of six arrays.
- Split up control_event_circuit_cell_stats by using two helper functions.
- Add TestingEnableCellStatsEvent option.
- Prepare functions for testing.
- Rename a few variables and document a few things better.
Tweak TB_EMPTY event based on comments by nickm.

- Avoid control_event_refill_global function with 13 arguments and
  increase code reuse factor by moving more code from control.c to
  connection.c.
- Avoid an unsafe uint32_t -> int cast.
- Add TestingEnableTbEmptyEvent option.
- Prepare functions for testing.
- Rename a few functions and improve documentation.
Tweak CIRC_BW event based on comments by nickm.

- Rename n_read and n_written in origin_circuit_t to make it clear that
  these are only used for CIRC_BW events.
- Extract new code in control_update_global_event_mask to new
  clear_circ_bw_fields function.
Test functions used for TB_EMPTY and CELL_STATS events.
Add a signal-safe decimal formatting function
Refactor the assertion-failure code into a function
Don't format cell stats for unattached circuits.
Pass around const struct timeval * instead of struct timeval.

Suggested by nickm.
Pass const uint64_t pointers, document array length.

Suggested by nickm.
Don't apply read/write buckets to non-limited connections

Fixes bug 9731
Don't apply read/write buckets to cpuworker connections

Fixes bug 9731
Switch ECDHE group default logic for bridge/relay TLS

According to the manpage, bridges use P256 for conformity and relays
use P224 for speed. But skruffy points out that we've gotten it
backwards in the code.

In this patch, we make the default P256 for everybody.

Fixes bug 9780; bugfix on 0.2.4.8-alpha.
A Bridge Authority should compute flag thresholds

As a bridge authority, before we create our networkstatus document, we
should compute the thresholds needed for the various status flags
assigned to each bridge based on the status of all other bridges. We
then add these thresholds to the networkstatus document for easy access.
Fixes for #1117 and #9859.