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