blob: 8591185c53b148a26682e0eef4e275ec3c54f5c8 [file] [log] [blame]
Craig Tillera59c16c2016-10-31 07:25:01 -07001/*
2 *
Jan Tattermusch7897ae92017-06-07 22:57:36 +02003 * Copyright 2016 gRPC authors.
Craig Tillera59c16c2016-10-31 07:25:01 -07004 *
Jan Tattermusch7897ae92017-06-07 22:57:36 +02005 * 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 Tillera59c16c2016-10-31 07:25:01 -07008 *
Jan Tattermusch7897ae92017-06-07 22:57:36 +02009 * http://www.apache.org/licenses/LICENSE-2.0
Craig Tillera59c16c2016-10-31 07:25:01 -070010 *
Jan Tattermusch7897ae92017-06-07 22:57:36 +020011 * 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 Tillera59c16c2016-10-31 07:25:01 -070016 *
17 */
18
Craig Tillere1e92832016-11-16 15:43:43 -080019#ifndef GRPC_CORE_LIB_SLICE_SLICE_INTERNAL_H
20#define GRPC_CORE_LIB_SLICE_SLICE_INTERNAL_H
Craig Tillera59c16c2016-10-31 07:25:01 -070021
22#include <grpc/slice.h>
23#include <grpc/slice_buffer.h>
24
25#include "src/core/lib/iomgr/exec_ctx.h"
26
Yash Tibrewala7e6d652017-09-20 18:56:37 -070027#ifdef __cplusplus
28extern "C" {
29#endif
30
Craig Tillera59c16c2016-10-31 07:25:01 -070031grpc_slice grpc_slice_ref_internal(grpc_slice slice);
32void grpc_slice_unref_internal(grpc_exec_ctx *exec_ctx, grpc_slice slice);
33void grpc_slice_buffer_reset_and_unref_internal(grpc_exec_ctx *exec_ctx,
34 grpc_slice_buffer *sb);
35void grpc_slice_buffer_destroy_internal(grpc_exec_ctx *exec_ctx,
36 grpc_slice_buffer *sb);
37
Craig Tiller7c70b6c2017-01-23 07:48:42 -080038/* Check if a slice is interned */
39bool grpc_slice_is_interned(grpc_slice slice);
40
41void grpc_slice_intern_init(void);
42void grpc_slice_intern_shutdown(void);
43void 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
48grpc_slice grpc_slice_maybe_static_intern(grpc_slice slice,
49 bool *returned_slice_is_different);
50uint32_t grpc_static_slice_hash(grpc_slice s);
51int grpc_static_slice_eq(grpc_slice a, grpc_slice b);
52
Yash Tibrewala7e6d652017-09-20 18:56:37 -070053#ifdef __cplusplus
54}
55#endif
56
57#endif /* GRPC_CORE_LIB_SLICE_SLICE_INTERNAL_H */