MB-100: copy couch_api_wrap* to ns_server

Because we'll need to change it possibly heavily in order to support
xdcr-over-ssl. And it's not really used in couchdb.

I plan to remove and all it's unused users from couchdb in one of
subsequent commits

Change-Id: I46d487ed0b212d6534ebefa66a5b9b193eb18ee7
Reviewed-on: http://review.couchbase.org/30346
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Artem Stemkovski <artem@couchbase.com>