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.
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.
squash! Pass const uint64_t pointers, document array length.

Don't cast uint64_t * to const uint64_t * explicitly.  The cast is always
safe, so C does it for us.  Doing the cast explitictly can hide bugs if
the input is secretly the wrong type.

Suggested by Nick.
Merge branch 'morestats4' into morestats5

Conflicts:
	doc/tor.1.txt
	src/or/config.c
	src/or/connection.h
	src/or/control.c
	src/or/control.h
	src/or/or.h
	src/or/relay.c
	src/or/relay.h
	src/test/test.c
Merge remote-tracking branch 'karsten/morestats5'
Add some clarity and checks to cell_queue_append_packed_copy

It's not cool to have "circ may be NULL if use_stats false, but
otherwise we crash" as an undocumented API constraint. :)