The C based gRPC (C++, Python, Ruby, Objective-C, PHP, C#) https://grpc.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.8 KiB

//
//
// Copyright 2015 gRPC authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//
10 years ago
#ifndef GRPC_TEST_CORE_UTIL_SLICE_SPLITTER_H
#define GRPC_TEST_CORE_UTIL_SLICE_SPLITTER_H
10 years ago
// utility function to split/merge slices together to help create test
// cases
10 years ago
#include <stddef.h>
#include <grpc/slice.h>
10 years ago
typedef enum {
// merge all input slices into a single slice
10 years ago
GRPC_SLICE_SPLIT_MERGE_ALL,
// leave slices as is
10 years ago
GRPC_SLICE_SPLIT_IDENTITY,
// split slices into one byte chunks
10 years ago
GRPC_SLICE_SPLIT_ONE_BYTE
} grpc_slice_split_mode;
// allocates *dst_slices; caller must unref all slices in dst_slices then free
// it
void grpc_split_slices(grpc_slice_split_mode mode, grpc_slice* src_slices,
size_t src_slice_count, grpc_slice** dst_slices,
size_t* dst_slice_count);
10 years ago
void grpc_split_slices_to_buffer(grpc_slice_split_mode mode,
grpc_slice* src_slices, size_t src_slice_count,
grpc_slice_buffer* dst);
void grpc_split_slice_buffer(grpc_slice_split_mode mode, grpc_slice_buffer* src,
grpc_slice_buffer* dst);
10 years ago
grpc_slice grpc_slice_merge(grpc_slice* slices, size_t nslices);
10 years ago
const char* grpc_slice_split_mode_name(grpc_slice_split_mode mode);
10 years ago
#endif // GRPC_TEST_CORE_UTIL_SLICE_SPLITTER_H