aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/grpc++
diff options
context:
space:
mode:
Diffstat (limited to 'include/grpc++')
-rw-r--r--include/grpc++/client_context.h21
-rw-r--r--include/grpc++/impl/call.h10
-rw-r--r--include/grpc++/impl/codegen/security/auth_context.h110
-rw-r--r--include/grpc++/impl/codegen/server_interface.h1
-rw-r--r--include/grpc++/impl/codegen/string_ref.h123
-rw-r--r--include/grpc++/impl/codegen/sync.h45
-rw-r--r--include/grpc++/impl/codegen/sync_cxx11.h49
-rw-r--r--include/grpc++/impl/codegen/sync_no_cxx11.h105
-rw-r--r--include/grpc++/impl/sync.h8
-rw-r--r--include/grpc++/impl/sync_cxx11.h12
-rw-r--r--include/grpc++/impl/sync_no_cxx11.h68
-rw-r--r--include/grpc++/security/auth_context.h73
-rw-r--r--include/grpc++/support/async_stream.h7
-rw-r--r--include/grpc++/support/string_ref.h86
14 files changed, 457 insertions, 261 deletions
diff --git a/include/grpc++/client_context.h b/include/grpc++/client_context.h
index a926ed0505..02b2ebdff8 100644
--- a/include/grpc++/client_context.h
+++ b/include/grpc++/client_context.h
@@ -53,18 +53,19 @@
#include <memory>
#include <string>
-#include <grpc++/impl/sync.h>
-#include <grpc++/security/auth_context.h>
-#include <grpc++/support/config.h>
-#include <grpc++/support/status.h>
-#include <grpc++/support/string_ref.h>
-#include <grpc++/support/time.h>
-#include <grpc/compression.h>
-#include <grpc/grpc.h>
-#include <grpc/support/log.h>
-#include <grpc/support/time.h>
+#include <grpc++/impl/codegen/sync.h>
+#include <grpc++/impl/codegen/security/auth_context.h>
+#include <grpc++/impl/codegen/config.h>
+#include <grpc++/impl/codegen/status.h>
+#include <grpc++/impl/codegen/string_ref.h>
+#include <grpc++/impl/codegen/time.h>
+#include <grpc/impl/codegen/compression_types.h>
+#include <grpc/impl/codegen/propagation_bits.h>
+#include <grpc/impl/codegen/log.h>
+#include <grpc/impl/codegen/time.h>
struct census_context;
+struct grpc_call;
namespace grpc {
diff --git a/include/grpc++/impl/call.h b/include/grpc++/impl/call.h
index 0fc0698e54..ec64c9f884 100644
--- a/include/grpc++/impl/call.h
+++ b/include/grpc++/impl/call.h
@@ -40,22 +40,22 @@
#include <cstring>
#include <grpc/support/alloc.h>
+#include <grpc/impl/codegen/grpc_types.h>
#include <grpc++/client_context.h>
-#include <grpc++/completion_queue.h>
#include <grpc++/impl/codegen/call_hook.h>
#include <grpc++/impl/codegen/completion_queue_tag.h>
#include <grpc++/impl/serialization_traits.h>
-#include <grpc++/support/config.h>
-#include <grpc++/support/status.h>
+#include <grpc++/impl/codegen/config.h>
+#include <grpc++/impl/codegen/status.h>
-struct grpc_call;
-struct grpc_op;
+struct grpc_byte_buffer;
namespace grpc {
class ByteBuffer;
class Call;
class CallHook;
+class CompletionQueue;
void FillMetadataMap(
grpc_metadata_array* arr,
diff --git a/include/grpc++/impl/codegen/security/auth_context.h b/include/grpc++/impl/codegen/security/auth_context.h
new file mode 100644
index 0000000000..75f2482346
--- /dev/null
+++ b/include/grpc++/impl/codegen/security/auth_context.h
@@ -0,0 +1,110 @@
+/*
+ *
+ * Copyright 2015, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef GRPCXX_IMPL_CODEGEN_SECURITY_AUTH_CONTEXT_H
+#define GRPCXX_IMPL_CODEGEN_SECURITY_AUTH_CONTEXT_H
+
+#include <iterator>
+#include <vector>
+
+#include <grpc++/impl/codegen/config.h>
+#include <grpc++/impl/codegen/string_ref.h>
+
+struct grpc_auth_context;
+struct grpc_auth_property;
+struct grpc_auth_property_iterator;
+
+namespace grpc {
+class SecureAuthContext;
+
+typedef std::pair<grpc::string_ref, grpc::string_ref> AuthProperty;
+
+class AuthPropertyIterator
+ : public std::iterator<std::input_iterator_tag, const AuthProperty> {
+ public:
+ ~AuthPropertyIterator();
+ AuthPropertyIterator& operator++();
+ AuthPropertyIterator operator++(int);
+ bool operator==(const AuthPropertyIterator& rhs) const;
+ bool operator!=(const AuthPropertyIterator& rhs) const;
+ const AuthProperty operator*();
+
+ protected:
+ AuthPropertyIterator();
+ AuthPropertyIterator(const grpc_auth_property* property,
+ const grpc_auth_property_iterator* iter);
+
+ private:
+ friend class SecureAuthContext;
+ const grpc_auth_property* property_;
+ // The following items form a grpc_auth_property_iterator.
+ const grpc_auth_context* ctx_;
+ size_t index_;
+ const char* name_;
+};
+
+/// Class encapsulating the Authentication Information.
+///
+/// It includes the secure identity of the peer, the type of secure transport
+/// used as well as any other properties required by the authorization layer.
+class AuthContext {
+ public:
+ virtual ~AuthContext() {}
+
+ /// Returns true if the peer is authenticated.
+ virtual bool IsPeerAuthenticated() const = 0;
+
+ /// A peer identity.
+ ///
+ /// It is, in general, comprised of one or more properties (in which case they
+ /// have the same name).
+ virtual std::vector<grpc::string_ref> GetPeerIdentity() const = 0;
+ virtual grpc::string GetPeerIdentityPropertyName() const = 0;
+
+ /// Returns all the property values with the given name.
+ virtual std::vector<grpc::string_ref> FindPropertyValues(
+ const grpc::string& name) const = 0;
+
+ /// Iteration over all the properties.
+ virtual AuthPropertyIterator begin() const = 0;
+ virtual AuthPropertyIterator end() const = 0;
+
+ // Mutation functions: should only be used by an AuthMetadataProcessor.
+ virtual void AddProperty(const grpc::string& key,
+ const grpc::string_ref& value) = 0;
+ virtual bool SetPeerIdentityPropertyName(const grpc::string& name) = 0;
+};
+
+} // namespace grpc
+
+#endif // GRPCXX_IMPL_CODEGEN_SECURITY_AUTH_CONTEXT_H
diff --git a/include/grpc++/impl/codegen/server_interface.h b/include/grpc++/impl/codegen/server_interface.h
index 2eadcb3428..b0bc10dc6d 100644
--- a/include/grpc++/impl/codegen/server_interface.h
+++ b/include/grpc++/impl/codegen/server_interface.h
@@ -45,6 +45,7 @@ class GenericServerContext;
class RpcService;
class RpcServiceMethod;
class ServerAsyncStreamingInterface;
+class ServerCompletionQueue;
class ServerContext;
class ServerCredentials;
class Service;
diff --git a/include/grpc++/impl/codegen/string_ref.h b/include/grpc++/impl/codegen/string_ref.h
new file mode 100644
index 0000000000..bb5363fa3e
--- /dev/null
+++ b/include/grpc++/impl/codegen/string_ref.h
@@ -0,0 +1,123 @@
+/*
+ *
+ * Copyright 2015, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef GRPCXX_IMPL_CODEGEN_STRING_REF_H
+#define GRPCXX_IMPL_CODEGEN_STRING_REF_H
+
+#include <iterator>
+#include <iosfwd>
+
+#include <grpc++/impl/codegen/config.h>
+
+namespace grpc {
+
+/// This class is a non owning reference to a string.
+///
+/// It should be a strict subset of the upcoming std::string_ref.
+///
+/// \see http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3442.html
+///
+/// The constexpr is dropped or replaced with const for legacy compiler
+/// compatibility.
+class string_ref {
+ public:
+ // types
+ typedef const char* const_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+
+ // constants
+ const static size_t npos;
+
+ // construct/copy.
+ string_ref() : data_(nullptr), length_(0) {}
+ string_ref(const string_ref& other)
+ : data_(other.data_), length_(other.length_) {}
+ string_ref& operator=(const string_ref& rhs);
+ string_ref(const char* s);
+ string_ref(const char* s, size_t l) : data_(s), length_(l) {}
+ string_ref(const grpc::string& s) : data_(s.data()), length_(s.length()) {}
+
+ // iterators
+ const_iterator begin() const { return data_; }
+ const_iterator end() const { return data_ + length_; }
+ const_iterator cbegin() const { return data_; }
+ const_iterator cend() const { return data_ + length_; }
+ const_reverse_iterator rbegin() const {
+ return const_reverse_iterator(end());
+ }
+ const_reverse_iterator rend() const {
+ return const_reverse_iterator(begin());
+ }
+ const_reverse_iterator crbegin() const {
+ return const_reverse_iterator(end());
+ }
+ const_reverse_iterator crend() const {
+ return const_reverse_iterator(begin());
+ }
+
+ // capacity
+ size_t size() const { return length_; }
+ size_t length() const { return length_; }
+ size_t max_size() const { return length_; }
+ bool empty() const { return length_ == 0; }
+
+ // element access
+ const char* data() const { return data_; }
+
+ // string operations
+ int compare(string_ref x) const;
+ bool starts_with(string_ref x) const;
+ bool ends_with(string_ref x) const;
+ size_t find(string_ref s) const;
+ size_t find(char c) const;
+
+ string_ref substr(size_t pos, size_t n = npos) const;
+
+ private:
+ const char* data_;
+ size_t length_;
+};
+
+// Comparison operators
+bool operator==(string_ref x, string_ref y);
+bool operator!=(string_ref x, string_ref y);
+bool operator<(string_ref x, string_ref y);
+bool operator>(string_ref x, string_ref y);
+bool operator<=(string_ref x, string_ref y);
+bool operator>=(string_ref x, string_ref y);
+
+std::ostream& operator<<(std::ostream& stream, const string_ref& string);
+
+} // namespace grpc
+
+#endif // GRPCXX_IMPL_CODEGEN_STRING_REF_H
diff --git a/include/grpc++/impl/codegen/sync.h b/include/grpc++/impl/codegen/sync.h
new file mode 100644
index 0000000000..62194c7708
--- /dev/null
+++ b/include/grpc++/impl/codegen/sync.h
@@ -0,0 +1,45 @@
+/*
+ *
+ * Copyright 2015, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef GRPCXX_IMPL_CODEGEN_SYNC_H
+#define GRPCXX_IMPL_CODEGEN_SYNC_H
+
+#include <grpc++/impl/codegen/config.h>
+
+#ifdef GRPC_CXX0X_NO_THREAD
+#include <grpc++/impl/codegen/sync_no_cxx11.h>
+#else
+#include <grpc++/impl/codegen/sync_cxx11.h>
+#endif
+
+#endif // GRPCXX_IMPL_CODEGEN_SYNC_H
diff --git a/include/grpc++/impl/codegen/sync_cxx11.h b/include/grpc++/impl/codegen/sync_cxx11.h
new file mode 100644
index 0000000000..6626ca1f94
--- /dev/null
+++ b/include/grpc++/impl/codegen/sync_cxx11.h
@@ -0,0 +1,49 @@
+/*
+ *
+ * Copyright 2015, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef GRPCXX_IMPL_CODEGEN_SYNC_CXX11_H
+#define GRPCXX_IMPL_CODEGEN_SYNC_CXX11_H
+
+#include <condition_variable>
+#include <mutex>
+
+namespace grpc {
+
+using std::condition_variable;
+using std::mutex;
+using std::lock_guard;
+using std::unique_lock;
+
+} // namespace grpc
+
+#endif // GRPCXX_IMPL_CODEGEN_SYNC_CXX11_H
diff --git a/include/grpc++/impl/codegen/sync_no_cxx11.h b/include/grpc++/impl/codegen/sync_no_cxx11.h
new file mode 100644
index 0000000000..55c059ede7
--- /dev/null
+++ b/include/grpc++/impl/codegen/sync_no_cxx11.h
@@ -0,0 +1,105 @@
+/*
+ *
+ * Copyright 2015, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef GRPCXX_IMPL_CODEGEN_SYNC_NO_CXX11_H
+#define GRPCXX_IMPL_CODEGEN_SYNC_NO_CXX11_H
+
+#include <grpc/impl/codegen/sync.h>
+
+namespace grpc {
+
+template <class mutex>
+class lock_guard;
+class condition_variable;
+
+class mutex {
+ public:
+ mutex() { gpr_mu_init(&mu_); }
+ ~mutex() { gpr_mu_destroy(&mu_); }
+
+ private:
+ ::gpr_mu mu_;
+ template <class mutex>
+ friend class lock_guard;
+ friend class condition_variable;
+};
+
+template <class mutex>
+class lock_guard {
+ public:
+ lock_guard(mutex &mu) : mu_(mu), locked(true) { gpr_mu_lock(&mu.mu_); }
+ ~lock_guard() { unlock_internal(); }
+
+ protected:
+ void lock_internal() {
+ if (!locked) gpr_mu_lock(&mu_.mu_);
+ locked = true;
+ }
+ void unlock_internal() {
+ if (locked) gpr_mu_unlock(&mu_.mu_);
+ locked = false;
+ }
+
+ private:
+ mutex &mu_;
+ bool locked;
+ friend class condition_variable;
+};
+
+template <class mutex>
+class unique_lock : public lock_guard<mutex> {
+ public:
+ unique_lock(mutex &mu) : lock_guard<mutex>(mu) {}
+ void lock() { this->lock_internal(); }
+ void unlock() { this->unlock_internal(); }
+};
+
+class condition_variable {
+ public:
+ condition_variable() { gpr_cv_init(&cv_); }
+ ~condition_variable() { gpr_cv_destroy(&cv_); }
+ void wait(lock_guard<mutex> &mu) {
+ mu.locked = false;
+ gpr_cv_wait(&cv_, &mu.mu_.mu_, gpr_inf_future(GPR_CLOCK_REALTIME));
+ mu.locked = true;
+ }
+ void notify_one() { gpr_cv_signal(&cv_); }
+ void notify_all() { gpr_cv_broadcast(&cv_); }
+
+ private:
+ gpr_cv cv_;
+};
+
+} // namespace grpc
+
+#endif // GRPCXX_IMPL_CODEGEN_SYNC_NO_CXX11_H
diff --git a/include/grpc++/impl/sync.h b/include/grpc++/impl/sync.h
index 999c4303cb..3339cddba4 100644
--- a/include/grpc++/impl/sync.h
+++ b/include/grpc++/impl/sync.h
@@ -34,12 +34,6 @@
#ifndef GRPCXX_IMPL_SYNC_H
#define GRPCXX_IMPL_SYNC_H
-#include <grpc++/support/config.h>
-
-#ifdef GRPC_CXX0X_NO_THREAD
-#include <grpc++/impl/sync_no_cxx11.h>
-#else
-#include <grpc++/impl/sync_cxx11.h>
-#endif
+#include <grpc++/impl/codegen/sync.h>
#endif // GRPCXX_IMPL_SYNC_H
diff --git a/include/grpc++/impl/sync_cxx11.h b/include/grpc++/impl/sync_cxx11.h
index 4e6f1da3a6..78acec197e 100644
--- a/include/grpc++/impl/sync_cxx11.h
+++ b/include/grpc++/impl/sync_cxx11.h
@@ -34,16 +34,6 @@
#ifndef GRPCXX_IMPL_SYNC_CXX11_H
#define GRPCXX_IMPL_SYNC_CXX11_H
-#include <condition_variable>
-#include <mutex>
-
-namespace grpc {
-
-using std::condition_variable;
-using std::mutex;
-using std::lock_guard;
-using std::unique_lock;
-
-} // namespace grpc
+#include <grpc++/impl/codegen/sync_cxx11.h>
#endif // GRPCXX_IMPL_SYNC_CXX11_H
diff --git a/include/grpc++/impl/sync_no_cxx11.h b/include/grpc++/impl/sync_no_cxx11.h
index 120a031045..e40269d1e5 100644
--- a/include/grpc++/impl/sync_no_cxx11.h
+++ b/include/grpc++/impl/sync_no_cxx11.h
@@ -34,72 +34,6 @@
#ifndef GRPCXX_IMPL_SYNC_NO_CXX11_H
#define GRPCXX_IMPL_SYNC_NO_CXX11_H
-#include <grpc/support/sync.h>
-
-namespace grpc {
-
-template <class mutex>
-class lock_guard;
-class condition_variable;
-
-class mutex {
- public:
- mutex() { gpr_mu_init(&mu_); }
- ~mutex() { gpr_mu_destroy(&mu_); }
-
- private:
- ::gpr_mu mu_;
- template <class mutex>
- friend class lock_guard;
- friend class condition_variable;
-};
-
-template <class mutex>
-class lock_guard {
- public:
- lock_guard(mutex &mu) : mu_(mu), locked(true) { gpr_mu_lock(&mu.mu_); }
- ~lock_guard() { unlock_internal(); }
-
- protected:
- void lock_internal() {
- if (!locked) gpr_mu_lock(&mu_.mu_);
- locked = true;
- }
- void unlock_internal() {
- if (locked) gpr_mu_unlock(&mu_.mu_);
- locked = false;
- }
-
- private:
- mutex &mu_;
- bool locked;
- friend class condition_variable;
-};
-
-template <class mutex>
-class unique_lock : public lock_guard<mutex> {
- public:
- unique_lock(mutex &mu) : lock_guard<mutex>(mu) {}
- void lock() { this->lock_internal(); }
- void unlock() { this->unlock_internal(); }
-};
-
-class condition_variable {
- public:
- condition_variable() { gpr_cv_init(&cv_); }
- ~condition_variable() { gpr_cv_destroy(&cv_); }
- void wait(lock_guard<mutex> &mu) {
- mu.locked = false;
- gpr_cv_wait(&cv_, &mu.mu_.mu_, gpr_inf_future(GPR_CLOCK_REALTIME));
- mu.locked = true;
- }
- void notify_one() { gpr_cv_signal(&cv_); }
- void notify_all() { gpr_cv_broadcast(&cv_); }
-
- private:
- gpr_cv cv_;
-};
-
-} // namespace grpc
+#include <grpc++/impl/codegen/sync_no_cxx11.h>
#endif // GRPCXX_IMPL_SYNC_NO_CXX11_H
diff --git a/include/grpc++/security/auth_context.h b/include/grpc++/security/auth_context.h
index b924ec90c6..bc542dbf8a 100644
--- a/include/grpc++/security/auth_context.h
+++ b/include/grpc++/security/auth_context.h
@@ -34,77 +34,6 @@
#ifndef GRPCXX_SUPPORT_AUTH_CONTEXT_H
#define GRPCXX_SUPPORT_AUTH_CONTEXT_H
-#include <iterator>
-#include <vector>
-
-#include <grpc++/support/config.h>
-#include <grpc++/support/string_ref.h>
-
-struct grpc_auth_context;
-struct grpc_auth_property;
-struct grpc_auth_property_iterator;
-
-namespace grpc {
-class SecureAuthContext;
-
-typedef std::pair<grpc::string_ref, grpc::string_ref> AuthProperty;
-
-class AuthPropertyIterator
- : public std::iterator<std::input_iterator_tag, const AuthProperty> {
- public:
- ~AuthPropertyIterator();
- AuthPropertyIterator& operator++();
- AuthPropertyIterator operator++(int);
- bool operator==(const AuthPropertyIterator& rhs) const;
- bool operator!=(const AuthPropertyIterator& rhs) const;
- const AuthProperty operator*();
-
- protected:
- AuthPropertyIterator();
- AuthPropertyIterator(const grpc_auth_property* property,
- const grpc_auth_property_iterator* iter);
-
- private:
- friend class SecureAuthContext;
- const grpc_auth_property* property_;
- // The following items form a grpc_auth_property_iterator.
- const grpc_auth_context* ctx_;
- size_t index_;
- const char* name_;
-};
-
-/// Class encapsulating the Authentication Information.
-///
-/// It includes the secure identity of the peer, the type of secure transport
-/// used as well as any other properties required by the authorization layer.
-class AuthContext {
- public:
- virtual ~AuthContext() {}
-
- /// Returns true if the peer is authenticated.
- virtual bool IsPeerAuthenticated() const = 0;
-
- /// A peer identity.
- ///
- /// It is, in general, comprised of one or more properties (in which case they
- /// have the same name).
- virtual std::vector<grpc::string_ref> GetPeerIdentity() const = 0;
- virtual grpc::string GetPeerIdentityPropertyName() const = 0;
-
- /// Returns all the property values with the given name.
- virtual std::vector<grpc::string_ref> FindPropertyValues(
- const grpc::string& name) const = 0;
-
- /// Iteration over all the properties.
- virtual AuthPropertyIterator begin() const = 0;
- virtual AuthPropertyIterator end() const = 0;
-
- // Mutation functions: should only be used by an AuthMetadataProcessor.
- virtual void AddProperty(const grpc::string& key,
- const grpc::string_ref& value) = 0;
- virtual bool SetPeerIdentityPropertyName(const grpc::string& name) = 0;
-};
-
-} // namespace grpc
+#include <grpc++/impl/codegen/security/auth_context.h>
#endif // GRPCXX_SUPPORT_AUTH_CONTEXT_H
diff --git a/include/grpc++/support/async_stream.h b/include/grpc++/support/async_stream.h
index 87c38a7ec8..511ad17852 100644
--- a/include/grpc++/support/async_stream.h
+++ b/include/grpc++/support/async_stream.h
@@ -34,17 +34,16 @@
#ifndef GRPCXX_SUPPORT_ASYNC_STREAM_H
#define GRPCXX_SUPPORT_ASYNC_STREAM_H
-#include <grpc/support/log.h>
#include <grpc++/impl/codegen/channel_interface.h>
-#include <grpc++/client_context.h>
-#include <grpc++/completion_queue.h>
#include <grpc++/impl/call.h>
#include <grpc++/impl/service_type.h>
#include <grpc++/server_context.h>
-#include <grpc++/support/status.h>
+#include <grpc++/impl/codegen/status.h>
namespace grpc {
+class CompletionQueue;
+
/// Common interface for all client side asynchronous streaming.
class ClientAsyncStreamingInterface {
public:
diff --git a/include/grpc++/support/string_ref.h b/include/grpc++/support/string_ref.h
index 9d965260ca..1f95e47fd3 100644
--- a/include/grpc++/support/string_ref.h
+++ b/include/grpc++/support/string_ref.h
@@ -34,90 +34,6 @@
#ifndef GRPCXX_SUPPORT_STRING_REF_H
#define GRPCXX_SUPPORT_STRING_REF_H
-#include <iterator>
-#include <iosfwd>
-
-#include <grpc++/support/config.h>
-
-namespace grpc {
-
-/// This class is a non owning reference to a string.
-///
-/// It should be a strict subset of the upcoming std::string_ref.
-///
-/// \see http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3442.html
-///
-/// The constexpr is dropped or replaced with const for legacy compiler
-/// compatibility.
-class string_ref {
- public:
- // types
- typedef const char* const_iterator;
- typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
-
- // constants
- const static size_t npos;
-
- // construct/copy.
- string_ref() : data_(nullptr), length_(0) {}
- string_ref(const string_ref& other)
- : data_(other.data_), length_(other.length_) {}
- string_ref& operator=(const string_ref& rhs);
- string_ref(const char* s);
- string_ref(const char* s, size_t l) : data_(s), length_(l) {}
- string_ref(const grpc::string& s) : data_(s.data()), length_(s.length()) {}
-
- // iterators
- const_iterator begin() const { return data_; }
- const_iterator end() const { return data_ + length_; }
- const_iterator cbegin() const { return data_; }
- const_iterator cend() const { return data_ + length_; }
- const_reverse_iterator rbegin() const {
- return const_reverse_iterator(end());
- }
- const_reverse_iterator rend() const {
- return const_reverse_iterator(begin());
- }
- const_reverse_iterator crbegin() const {
- return const_reverse_iterator(end());
- }
- const_reverse_iterator crend() const {
- return const_reverse_iterator(begin());
- }
-
- // capacity
- size_t size() const { return length_; }
- size_t length() const { return length_; }
- size_t max_size() const { return length_; }
- bool empty() const { return length_ == 0; }
-
- // element access
- const char* data() const { return data_; }
-
- // string operations
- int compare(string_ref x) const;
- bool starts_with(string_ref x) const;
- bool ends_with(string_ref x) const;
- size_t find(string_ref s) const;
- size_t find(char c) const;
-
- string_ref substr(size_t pos, size_t n = npos) const;
-
- private:
- const char* data_;
- size_t length_;
-};
-
-// Comparison operators
-bool operator==(string_ref x, string_ref y);
-bool operator!=(string_ref x, string_ref y);
-bool operator<(string_ref x, string_ref y);
-bool operator>(string_ref x, string_ref y);
-bool operator<=(string_ref x, string_ref y);
-bool operator>=(string_ref x, string_ref y);
-
-std::ostream& operator<<(std::ostream& stream, const string_ref& string);
-
-} // namespace grpc
+#include <grpc++/impl/codegen/string_ref.h>
#endif // GRPCXX_SUPPORT_STRING_REF_H