/usr/include/simplebuffer.h is in libbasicobjects-dev 0.5.0-1.
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 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | /*
Simple buffer
Basic buffer manipulation routines. Taken from ELAPI code.
Copyright (C) Dmitri Pal <dpal@redhat.com> 2009
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ELAPI_SIMPLEBUFFER_H
#define ELAPI_SIMPLEBUFFER_H
#include <stdint.h>
#ifndef EOK
#define EOK 0
#endif
/* Generic data structure for the buffer */
struct simplebuffer {
unsigned char *buffer;
uint32_t size;
uint32_t length;
};
/* Function to free data */
void simplebuffer_free(struct simplebuffer *data);
/* Allocate data structure */
int simplebuffer_alloc(struct simplebuffer **data);
/* Function to add memory to the buffer */
int simplebuffer_grow(struct simplebuffer *data,
uint32_t len,
uint32_t block);
/* Function to add raw data to the end of the buffer.
* Terminating 0 is not counted in length but appended
* automatically.
*/
int simplebuffer_add_raw(struct simplebuffer *data,
void *data_in,
uint32_t len,
uint32_t block);
/* Function to add string to the buffer.
* Same as above just uses string as an argument.
*/
int simplebuffer_add_str(struct simplebuffer *data,
const char *str,
uint32_t len,
uint32_t block);
/* Finction to add CR to the buffer */
int simplebuffer_add_cr(struct simplebuffer *data);
/* Function to write data synchroniusly */
int simplebuffer_write(int fd,
struct simplebuffer *data,
uint32_t *left);
/* Get buffer */
const unsigned char *simplebuffer_get_buf(struct simplebuffer *data);
/* Get buffer */
void *simplebuffer_get_vbuf(struct simplebuffer *data);
/* Get length */
uint32_t simplebuffer_get_len(struct simplebuffer *data);
#endif
|