Add support for common flags

This commit adds support for the new so-called common flags for the
client library.

The idea behind common flags is to use the high 8 bits of the flags for
type information, and to ignore any other bits. Older clients will then
only inspect the lower 24 bits, while newer clients will only inspect
the higher 8 bits.

In order to maintain backwards compat, this commit also assigns the
lower 8 bits to allow older clients to retain values as before.

Change-Id: Icd9788fd0b10772c1efcd9d531c5a58c36e8c8d9
Reviewed-on: http://review.couchbase.org/42288
Tested-by: Mark Nunberg <mnunberg@haskalah.org>
Reviewed-by: Volker Mische <volker.mische@gmail.com>