Craig Tiller | a59c16c | 2016-10-31 07:25:01 -0700 | [diff] [blame] | 1 | /* |
| 2 | * |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 3 | * Copyright 2016 gRPC authors. |
Craig Tiller | a59c16c | 2016-10-31 07:25:01 -0700 | [diff] [blame] | 4 | * |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 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 |
Craig Tiller | a59c16c | 2016-10-31 07:25:01 -0700 | [diff] [blame] | 8 | * |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
Craig Tiller | a59c16c | 2016-10-31 07:25:01 -0700 | [diff] [blame] | 10 | * |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 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. |
Craig Tiller | a59c16c | 2016-10-31 07:25:01 -0700 | [diff] [blame] | 16 | * |
| 17 | */ |
| 18 | |
Craig Tiller | e1e9283 | 2016-11-16 15:43:43 -0800 | [diff] [blame] | 19 | #ifndef GRPC_CORE_LIB_SLICE_SLICE_INTERNAL_H |
| 20 | #define GRPC_CORE_LIB_SLICE_SLICE_INTERNAL_H |
Craig Tiller | a59c16c | 2016-10-31 07:25:01 -0700 | [diff] [blame] | 21 | |
| 22 | #include <grpc/slice.h> |
| 23 | #include <grpc/slice_buffer.h> |
| 24 | |
| 25 | #include "src/core/lib/iomgr/exec_ctx.h" |
| 26 | |
Yash Tibrewal | a7e6d65 | 2017-09-20 18:56:37 -0700 | [diff] [blame] | 27 | #ifdef __cplusplus |
| 28 | extern "C" { |
| 29 | #endif |
| 30 | |
Craig Tiller | a59c16c | 2016-10-31 07:25:01 -0700 | [diff] [blame] | 31 | grpc_slice grpc_slice_ref_internal(grpc_slice slice); |
| 32 | void grpc_slice_unref_internal(grpc_exec_ctx *exec_ctx, grpc_slice slice); |
| 33 | void grpc_slice_buffer_reset_and_unref_internal(grpc_exec_ctx *exec_ctx, |
| 34 | grpc_slice_buffer *sb); |
| 35 | void grpc_slice_buffer_destroy_internal(grpc_exec_ctx *exec_ctx, |
| 36 | grpc_slice_buffer *sb); |
| 37 | |
Craig Tiller | 7c70b6c | 2017-01-23 07:48:42 -0800 | [diff] [blame] | 38 | /* Check if a slice is interned */ |
| 39 | bool grpc_slice_is_interned(grpc_slice slice); |
| 40 | |
| 41 | void grpc_slice_intern_init(void); |
| 42 | void grpc_slice_intern_shutdown(void); |
| 43 | void grpc_test_only_set_slice_hash_seed(uint32_t key); |
| 44 | // if slice matches a static slice, returns the static slice |
| 45 | // otherwise returns the passed in slice (without reffing it) |
| 46 | // used for surface boundaries where we might receive an un-interned static |
| 47 | // string |
| 48 | grpc_slice grpc_slice_maybe_static_intern(grpc_slice slice, |
| 49 | bool *returned_slice_is_different); |
| 50 | uint32_t grpc_static_slice_hash(grpc_slice s); |
| 51 | int grpc_static_slice_eq(grpc_slice a, grpc_slice b); |
| 52 | |
Yash Tibrewal | a7e6d65 | 2017-09-20 18:56:37 -0700 | [diff] [blame] | 53 | #ifdef __cplusplus |
| 54 | } |
| 55 | #endif |
| 56 | |
| 57 | #endif /* GRPC_CORE_LIB_SLICE_SLICE_INTERNAL_H */ |