Internal: Rearrange String documentation.

This style -- no function definitions in the class declaration --
follows the new GCC C++ coding conventions. It's nicer for experts,
who can see all of the methods at a glance.
Configury: Check for C++11 rvalue references and template alias.
arptable: limit arp query rate a bit more

I ran into a case where a syslog server was taken offline.  There was a steady
stream of ~50 UDP messages/second going to this server, and
ARPTable/ARPQuerier's default behavior was to send out 10 broadcast ARP queries
per second in this case.  This was resulting in more broadcast traffic than
really seems necessary.

We now will send out the first 5 arp queries at a rate of 10/sec, and then slow
down to one query per 2 seconds.

Signed-off-by: Cliff Frey <cliff@meraki.com>
Internal: Update Vector and Deque.

* Move documentation and inline function definitions out of the class.
* Add cbegin()/cend() for STL parity.
* Add useful Vector<T>::data() from C++11 STL.
Type traits: Add remove_reference<T> template and click_move().

click_move() is like std::move(); we need our own definition, as usual,
because the Linux kernel and C++ standard headers don't get along.

And add fast_argument<T>::enable_rvalue_reference typedef to void.
This will be used in Vector and Deque.
Configury: Detect C++11 features and -W -Wall compatibility better.

Clang takes -W -Wall, and needs -Werror to refuse rvalue references.
Quiet clang warning.
Add C++11 move constructors and move assigners.

I can't lie, this is mostly for fun/obsession, but it does make a
performance difference in some situations.
Fix a stupidity.
FromHost: add a BURST option similar to FromDevice

If traffic goes through a FromDevice, to a ToHost, and then back
through a FromHost, then when run_task is round robining between
FromDevice and FromHost, the FromDevice will get to send multiple
packets for every single packet that FromHost sends.  Adding a BURST
option to FromHost allows management of the load between the two
elements.
Json: Add new library.

This element-like library is enabled by --enable-json. If you don't
want to pay the code space cost, run --disable-json (the default).

Requires some additions to String and friends. We gain a new class,
StringRef, which is like a string that doesn't own its storage (e.g.,
trivial destructor). We also add StringAccum::append_utf8() and
String::skip_utf8_char(). And some uninitialized_type() helpers.
Json: Test and documentation nit.
Json: set(), get_insert(), and operator[]= convert their inputs.

That is, this code works:

  Json j = Json(2);
  j.set("a", Json(3));
  assert(j.unparse() == "{\"a\":3}");

This is nicer and more expected, given the liberal behavior of get().

At the same time, make get("0") work on arrays -- it returns the same
thing as get(0). And vice versa: get(0) on an object returns get("0").
Json::iterator can handle either objects or arrays.
Merge pull request #51 from clifffrey/arpquerier-slowdown

arptable: limit arp query rate a bit more
Some ARPQuerier cleanups.

- Send up to 10 polls at the 0.1s interval, rather than 6.
- Apply the changed poll interval uniformly.
String, StringAccum: Adjust out-of-memory rules.

* Out-of-memory strings are now nonempty. This makes more sense, and
  lets us simplify some code.

* An out-of-memory string will compare equal to a string with the same
  contents. This makes more sense in hash tables and such.

* Clean up out-of-memory append rules. String operations that involve
  character pointers NEVER treat those character pointers as
  potentially out-of-memory: only String operations, such as
  operator+(const String&) and append(const String&), can create
  out-of-memory strings.

* Furthermore, appending an out-of-memory String to a StringAccum
  appends the out-of-memory marker data ("<BOMB>ENOMEM<BOMB>"), rather
  than infecting the StringAccum. Why? I suffered a surprise with the
  Json library. It is a real shame to do something like this:

  Json j = ... parse a giant JSON object ...; // it works
  String big_file = file_string(f);
      // Assume this runs out of memory, so big_file.out_of_memory()
  j["file_contents"] = big_file;
  fprintf(f, "%s\n", j.unparse().c_str());

  and have `f` contain just an out-of-memory marker, obliterating all the
  previous state of the Json object!! After some thought and playing around
  I think these current semantics are better.

* As a side effect, make it that StringAccum().data() != 0.

Signed-off-by: Eddie Kohler <ekohler@gmail.com>
JsonTest: Add out-of-memory semantics tests.
String, StringAccum: Call strlen() early when the result's a constant.

Who knew that __builtin_constant_p(strlen("XXX")) would work! Well, it
does, which lets us build better libraries.

Signed-off-by: Eddie Kohler <ekohler@gmail.com>
Add and support ./configure --enable-smaller-code.

This configuration option tells Click's library to avoid inline
functions that can improve execution speed while making bigger
binaries.

An x86-64 Click binary, with --enable-json --enable-etherswitch
--enable-user-multithread, is 60K bytes smaller stripped with
--enable-smaller-code.

Initial --enable-smaller-code support is in String and StringAccum.

Signed-off-by: Eddie Kohler <ekohler@gmail.com>