You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

create_channel_posix.h 2.5 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. *
  3. * Copyright 2016 gRPC authors.
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. *
  17. */
  18. #ifndef GRPCPP_CREATE_CHANNEL_POSIX_H
  19. #define GRPCPP_CREATE_CHANNEL_POSIX_H
  20. #include <grpc/support/port_platform.h>
  21. #include <memory>
  22. #include <grpcpp/channel.h>
  23. #include <grpcpp/support/channel_arguments.h>
  24. namespace grpc
  25. {
  26. #ifdef GPR_SUPPORT_CHANNELS_FROM_FD
  27. /// Create a new \a Channel communicating over the given file descriptor.
  28. ///
  29. /// \param target The name of the target.
  30. /// \param fd The file descriptor representing a socket.
  31. std::shared_ptr<grpc::Channel> CreateInsecureChannelFromFd(
  32. const std::string& target, int fd
  33. );
  34. /// Create a new \a Channel communicating over given file descriptor with custom
  35. /// channel arguments.
  36. ///
  37. /// \param target The name of the target.
  38. /// \param fd The file descriptor representing a socket.
  39. /// \param args Options for channel creation.
  40. std::shared_ptr<grpc::Channel> CreateCustomInsecureChannelFromFd(
  41. const std::string& target, int fd, const grpc::ChannelArguments& args
  42. );
  43. namespace experimental
  44. {
  45. /// Create a new \a Channel communicating over given file descriptor with custom
  46. /// channel arguments.
  47. ///
  48. /// \param target The name of the target.
  49. /// \param fd The file descriptor representing a socket.
  50. /// \param args Options for channel creation.
  51. /// \param interceptor_creators Vector of interceptor factory objects.
  52. std::shared_ptr<grpc::Channel>
  53. CreateCustomInsecureChannelWithInterceptorsFromFd(
  54. const std::string& target, int fd, const grpc::ChannelArguments& args, std::vector<std::unique_ptr<grpc::experimental::ClientInterceptorFactoryInterface>> interceptor_creators
  55. );
  56. } // namespace experimental
  57. #endif // GPR_SUPPORT_CHANNELS_FROM_FD
  58. } // namespace grpc
  59. #endif // GRPCPP_CREATE_CHANNEL_POSIX_H