GRPC Core  9.0.0
slice_buffer.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2015 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_SLICE_BUFFER_H
20 #define GRPC_SLICE_BUFFER_H
21 
23 
24 #include <grpc/slice.h>
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
46  grpc_slice slice);
48  size_t n);
51 GPRAPI uint8_t* grpc_slice_buffer_tiny_add(grpc_slice_buffer* sb, size_t len);
60  grpc_slice_buffer* dst);
63  grpc_slice_buffer* garbage);
66  grpc_slice_buffer* dst);
69  size_t n,
70  grpc_slice_buffer* dst);
73  size_t n, void* dst);
78  grpc_slice slice);
79 
80 #ifdef __cplusplus
81 }
82 #endif
83 
84 #endif /* GRPC_SLICE_BUFFER_H */
GPRAPI void grpc_slice_buffer_destroy(grpc_slice_buffer *sb)
destroy a slice buffer - unrefs any held elements
Definition: slice_buffer.cc:91
GPRAPI void grpc_slice_buffer_undo_take_first(grpc_slice_buffer *src, grpc_slice slice)
undo the above with (a possibly different) slice
Definition: slice_buffer.cc:407
GPRAPI void grpc_slice_buffer_move_first_no_ref(grpc_slice_buffer *src, size_t n, grpc_slice_buffer *dst)
move the first n bytes of src into dst without adding references
Definition: slice_buffer.cc:311
GPRAPI uint8_t * grpc_slice_buffer_tiny_add(grpc_slice_buffer *sb, size_t len)
add a very small (less than 8 bytes) amount of data to the end of a slice buffer: returns a pointer i...
Definition: slice_buffer.cc:100
GPRAPI grpc_slice grpc_slice_buffer_take_first(grpc_slice_buffer *src)
take the first slice in the slice buffer
Definition: slice_buffer.cc:378
GPRAPI size_t grpc_slice_buffer_add_indexed(grpc_slice_buffer *sb, grpc_slice slice)
add an element to a slice buffer - takes ownership of the slice and returns the index of the slice...
Definition: slice_buffer.cc:126
A grpc_slice s, if initialized, represents the byte range s.bytes[0..s.length-1]. ...
Definition: slice.h:60
#define GPRAPI
Definition: port_platform.h:604
Represents an expandable array of slices, to be interpreted as a single item.
Definition: slice.h:78
GPRAPI void grpc_slice_buffer_addn(grpc_slice_buffer *sb, grpc_slice *slices, size_t n)
Definition: slice_buffer.cc:173
GPRAPI void grpc_slice_buffer_reset_and_unref(grpc_slice_buffer *sb)
clear a slice buffer, unref all elements
Definition: slice_buffer.cc:198
GPRAPI void grpc_slice_buffer_init(grpc_slice_buffer *sb)
initialize a slice buffer
Definition: slice_buffer.cc:77
GPRAPI void grpc_slice_buffer_move_first(grpc_slice_buffer *src, size_t n, grpc_slice_buffer *dst)
move the first n bytes of src into dst
Definition: slice_buffer.cc:306
GPRAPI void grpc_slice_buffer_pop(grpc_slice_buffer *sb)
pop the last buffer, but don&#39;t unref it
Definition: slice_buffer.cc:180
GPRAPI void grpc_slice_buffer_add(grpc_slice_buffer *sb, grpc_slice slice)
Add an element to a slice buffer - takes ownership of the slice.
Definition: slice_buffer.cc:135
GPRAPI void grpc_slice_buffer_trim_end(grpc_slice_buffer *src, size_t n, grpc_slice_buffer *garbage)
remove n bytes from the end of a slice buffer
Definition: slice_buffer.cc:342
GPRAPI void grpc_slice_buffer_move_first_into_buffer(grpc_slice_buffer *src, size_t n, void *dst)
move the first n bytes of src into dst (copying them)
Definition: slice_buffer.cc:316
GPRAPI void grpc_slice_buffer_swap(grpc_slice_buffer *a, grpc_slice_buffer *b)
swap the contents of two slice buffers
Definition: slice_buffer.cc:207
GPRAPI void grpc_slice_buffer_move_into(grpc_slice_buffer *src, grpc_slice_buffer *dst)
move all of the elements of src into dst
Definition: slice_buffer.cc:249