/usr/include/luasandbox/util/input_buffer.h is in libluasandbox-dev 1.2.1-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/** Data stream input buffer @file */
#ifndef luasandbox_util_input_buffer_h_
#define luasandbox_util_input_buffer_h_
#include <stdbool.h>
#include <stddef.h>
#include "util.h"
typedef struct lsb_input_buffer
{
char *buf;
size_t size;
size_t maxsize;
size_t readpos;
size_t scanpos;
size_t msglen;
} lsb_input_buffer;
#ifdef __cplusplus
extern "C" {
#endif
/**
* Initialize the provided input buffer
*
* @param b Input buffer
* @param max_message_size The maximum message size the buffer will handle
* before erroring (the internal buffer will contain extra space
* for the header)
*
* @return lsb_err_value NULL on success error message on failure
*/
LSB_UTIL_EXPORT lsb_err_value
lsb_init_input_buffer(lsb_input_buffer *b, size_t max_message_size);
/**
* Frees the memory internally allocated by the buffer and resets the state
*
* @param b Input buffer
*/
LSB_UTIL_EXPORT void lsb_free_input_buffer(lsb_input_buffer *b);
/**
* Expands the input buffer (if necessary) to accomadate the requested number of
* bytes. The expansion happens in power of two increments up to the maxsize.
* The buffer never shrinks in size.
*
* @param b Input buffer
* @param len The length of the data being added to the buffer
*
* @return lsb_err_value NULL on success error message on failure
*/
LSB_UTIL_EXPORT lsb_err_value
lsb_expand_input_buffer(lsb_input_buffer *b, size_t len);
#ifdef __cplusplus
}
#endif
#endif
|