Permalink
Browse files

MB-24322: Clean up protocol_binary.h

Put the new class definitions into its own namespace and
provide #defines for backward source compatibility.

Change-Id: I7e0f17c2ed494ca220965585a8e15637e76595b7
Reviewed-on: http://review.couchbase.org/78116
Tested-by: Build Bot <build@couchbase.com>
Reviewed-by: Dave Rigby <daver@couchbase.com>
  • Loading branch information...
1 parent 1248b75 commit 2716340fad31302a12cf96a0aad54879a316a0ac @trondn trondn committed May 15, 2017
@@ -16,9 +16,19 @@
*/
#pragma once
+#include <mcbp/protocol/datatype.h>
+#include <mcbp/protocol/magic.h>
+#include <mcbp/protocol/opcode.h>
+#include <mcbp/protocol/response.h>
+#include <mcbp/protocol/request.h>
+#include <mcbp/protocol/status.h>
+
+
// This file contains various methods for the Memcached Binary Protocol
+// used for backwards source compatibility
#include <memcached/protocol_binary.h>
+
#include <ostream>
#include <vector>
@@ -0,0 +1,31 @@
+/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
+/*
+ * Copyright 2017 Couchbase, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#pragma once
+
+#include <cstdint>
+
+namespace cb {
+namespace mcbp {
+
+/**
+ * Definition of the data types in the packet
+ * See section 3.4 Data Types
+ */
+
+enum class Datatype : uint8_t { Raw = 0, JSON = 1, Snappy = 2, Xattr = 4 };
+} // namespace mcbp
+} // namespace cb
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
+/*
+ * Copyright 2017 Couchbase, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#pragma once
+
+#include <cstdint>
+
+namespace cb {
+namespace mcbp {
+/**
+ * Definition of the legal "magic" values used in a packet.
+ * See section 3.1 Magic byte
+ */
+enum class Magic : uint8_t {
+ /// Request packet from client to server
+ ClientRequest = 0x80,
+ /// Response packet from server to client
+ ClientResponse = 0x81,
+ /// Request packet from server to client
+ ServerRequest = 0x82,
+ /// Response packet from client to server
+ ServerResponse = 0x83
+};
+} // namespace mcbp
+} // namespace cb
Oops, something went wrong.

0 comments on commit 2716340

Please sign in to comment.