slice_internal.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 GRPC_CORE_LIB_SLICE_SLICE_INTERNAL_H
  19. #define GRPC_CORE_LIB_SLICE_SLICE_INTERNAL_H
  20. #include <grpc/support/port_platform.h>
  21. #include <grpc/slice.h>
  22. #include <grpc/slice_buffer.h>
  23. grpc_slice grpc_slice_ref_internal(grpc_slice slice);
  24. void grpc_slice_unref_internal(grpc_slice slice);
  25. void grpc_slice_buffer_reset_and_unref_internal(grpc_slice_buffer* sb);
  26. void grpc_slice_buffer_partial_unref_internal(grpc_slice_buffer* sb,
  27. size_t idx);
  28. void grpc_slice_buffer_destroy_internal(grpc_slice_buffer* sb);
  29. /* Check if a slice is interned */
  30. bool grpc_slice_is_interned(grpc_slice slice);
  31. void grpc_slice_intern_init(void);
  32. void grpc_slice_intern_shutdown(void);
  33. void grpc_test_only_set_slice_hash_seed(uint32_t key);
  34. // if slice matches a static slice, returns the static slice
  35. // otherwise returns the passed in slice (without reffing it)
  36. // used for surface boundaries where we might receive an un-interned static
  37. // string
  38. grpc_slice grpc_slice_maybe_static_intern(grpc_slice slice,
  39. bool* returned_slice_is_different);
  40. uint32_t grpc_static_slice_hash(grpc_slice s);
  41. int grpc_static_slice_eq(grpc_slice a, grpc_slice b);
  42. #endif /* GRPC_CORE_LIB_SLICE_SLICE_INTERNAL_H */