// Copyright 2022 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. #ifndef GRPC_SRC_CORE_LIB_SLICE_SLICE_BUFFER_H #define GRPC_SRC_CORE_LIB_SLICE_SLICE_BUFFER_H #include <grpc/support/port_platform.h> #include <stdint.h> #include <string.h> #include <memory> #include <string> #include <grpc/slice.h> #include <grpc/slice_buffer.h> #include "src/core/lib/slice/slice.h" namespace grpc_core { /// A slice buffer holds the memory for a collection of slices. /// The SliceBuffer object itself is meant to only hide the C-style API, /// and won't hold the data itself. In terms of lifespan, the /// grpc_slice_buffer ought to be kept somewhere inside the caller's objects, /// like a transport or an endpoint. /// /// This lifespan rule is likely to change in the future, as we may /// collapse the grpc_slice_buffer structure straight into this class. /// /// The SliceBuffer API is basically a replica of the grpc_slice_buffer's, /// and its documentation will move here once we remove the C structure, /// which should happen before the EventEngine's API is no longer /// an experimental API. class SliceBuffer { … }; } // namespace grpc_core // Copy the first n bytes of src into memory pointed to by dst. void grpc_slice_buffer_copy_first_into_buffer(grpc_slice_buffer* src, size_t n, void* dst); #endif // GRPC_SRC_CORE_LIB_SLICE_SLICE_BUFFER_H