GRPC Core  9.0.0
Macros | Functions
slice_buffer.cc File Reference
#include <grpc/support/port_platform.h>
#include <grpc/slice_buffer.h>
#include <string.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/slice/slice_internal.h"

Macros

#define GROW(x)   (3 * (x) / 2)
 

Functions

void grpc_slice_buffer_init (grpc_slice_buffer *sb)
 initialize a slice buffer More...
 
void grpc_slice_buffer_destroy_internal (grpc_slice_buffer *sb)
 
void grpc_slice_buffer_destroy (grpc_slice_buffer *sb)
 destroy a slice buffer - unrefs any held elements More...
 
uint8_t * grpc_slice_buffer_tiny_add (grpc_slice_buffer *sb, size_t n)
 add a very small (less than 8 bytes) amount of data to the end of a slice buffer: returns a pointer into which to add the data More...
 
size_t grpc_slice_buffer_add_indexed (grpc_slice_buffer *sb, grpc_slice s)
 add an element to a slice buffer - takes ownership of the slice and returns the index of the slice. More...
 
void grpc_slice_buffer_add (grpc_slice_buffer *sb, grpc_slice s)
 Add an element to a slice buffer - takes ownership of the slice. More...
 
void grpc_slice_buffer_addn (grpc_slice_buffer *sb, grpc_slice *s, size_t n)
 
void grpc_slice_buffer_pop (grpc_slice_buffer *sb)
 pop the last buffer, but don't unref it More...
 
void grpc_slice_buffer_reset_and_unref_internal (grpc_slice_buffer *sb)
 
void grpc_slice_buffer_reset_and_unref (grpc_slice_buffer *sb)
 clear a slice buffer, unref all elements More...
 
void grpc_slice_buffer_swap (grpc_slice_buffer *a, grpc_slice_buffer *b)
 swap the contents of two slice buffers More...
 
void grpc_slice_buffer_move_into (grpc_slice_buffer *src, grpc_slice_buffer *dst)
 move all of the elements of src into dst More...
 
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 More...
 
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 More...
 
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) More...
 
void grpc_slice_buffer_trim_end (grpc_slice_buffer *sb, size_t n, grpc_slice_buffer *garbage)
 remove n bytes from the end of a slice buffer More...
 
grpc_slice grpc_slice_buffer_take_first (grpc_slice_buffer *sb)
 take the first slice in the slice buffer More...
 
void grpc_slice_buffer_remove_first (grpc_slice_buffer *sb)
 
void grpc_slice_buffer_sub_first (grpc_slice_buffer *sb, size_t begin, size_t end)
 
void grpc_slice_buffer_undo_take_first (grpc_slice_buffer *sb, grpc_slice slice)
 undo the above with (a possibly different) slice More...
 

Macro Definition Documentation

◆ GROW

#define GROW (   x)    (3 * (x) / 2)

Function Documentation

◆ grpc_slice_buffer_add()

void grpc_slice_buffer_add ( grpc_slice_buffer sb,
grpc_slice  slice 
)

Add an element to a slice buffer - takes ownership of the slice.

This function is allowed to concatenate the passed in slice to the end of some other slice if desired by the slice buffer.

◆ grpc_slice_buffer_add_indexed()

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.

Guarantees that the slice will not be concatenated at the end of another slice (i.e. the data for this slice will begin at the first byte of the slice at the returned index in sb->slices) The implementation MAY decide to concatenate data at the end of a small slice added in this fashion.

◆ grpc_slice_buffer_addn()

void grpc_slice_buffer_addn ( grpc_slice_buffer sb,
grpc_slice s,
size_t  n 
)

◆ grpc_slice_buffer_destroy()

void grpc_slice_buffer_destroy ( grpc_slice_buffer sb)

destroy a slice buffer - unrefs any held elements

◆ grpc_slice_buffer_destroy_internal()

void grpc_slice_buffer_destroy_internal ( grpc_slice_buffer sb)

◆ grpc_slice_buffer_init()

void grpc_slice_buffer_init ( grpc_slice_buffer sb)

initialize a slice buffer

◆ grpc_slice_buffer_move_first()

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

◆ grpc_slice_buffer_move_first_into_buffer()

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)

◆ grpc_slice_buffer_move_first_no_ref()

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

◆ grpc_slice_buffer_move_into()

void grpc_slice_buffer_move_into ( grpc_slice_buffer src,
grpc_slice_buffer dst 
)

move all of the elements of src into dst

◆ grpc_slice_buffer_pop()

void grpc_slice_buffer_pop ( grpc_slice_buffer sb)

pop the last buffer, but don't unref it

◆ grpc_slice_buffer_remove_first()

void grpc_slice_buffer_remove_first ( grpc_slice_buffer sb)

◆ grpc_slice_buffer_reset_and_unref()

void grpc_slice_buffer_reset_and_unref ( grpc_slice_buffer sb)

clear a slice buffer, unref all elements

◆ grpc_slice_buffer_reset_and_unref_internal()

void grpc_slice_buffer_reset_and_unref_internal ( grpc_slice_buffer sb)

◆ grpc_slice_buffer_sub_first()

void grpc_slice_buffer_sub_first ( grpc_slice_buffer sb,
size_t  begin,
size_t  end 
)

◆ grpc_slice_buffer_swap()

void grpc_slice_buffer_swap ( grpc_slice_buffer a,
grpc_slice_buffer b 
)

swap the contents of two slice buffers

◆ grpc_slice_buffer_take_first()

grpc_slice grpc_slice_buffer_take_first ( grpc_slice_buffer sb)

take the first slice in the slice buffer

◆ grpc_slice_buffer_tiny_add()

uint8_t* grpc_slice_buffer_tiny_add ( grpc_slice_buffer sb,
size_t  n 
)

add a very small (less than 8 bytes) amount of data to the end of a slice buffer: returns a pointer into which to add the data

◆ grpc_slice_buffer_trim_end()

void grpc_slice_buffer_trim_end ( grpc_slice_buffer sb,
size_t  n,
grpc_slice_buffer garbage 
)

remove n bytes from the end of a slice buffer

◆ grpc_slice_buffer_undo_take_first()

void grpc_slice_buffer_undo_take_first ( grpc_slice_buffer sb,
grpc_slice  slice 
)

undo the above with (a possibly different) slice