libosmocore  0.6.3
Osmocom core library
strrb.h
Go to the documentation of this file.
1 #ifndef _STRRB_H
2 #define _STRRB_H
3 
4 /* (C) 2012-2013 by Katerina Barone-Adesi <kat.obsc@gmail.com>
5  * All Rights Reserved
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program; if not, write to the Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  *
21  */
22 
31 #include <unistd.h>
32 #include <stdbool.h>
33 #include <stdint.h>
34 
35 #include <osmocom/core/talloc.h>
36 
39 #define RB_MAX_MESSAGE_SIZE 240
40 struct osmo_strrb {
41  uint16_t start;
42  uint16_t end;
43  uint16_t size;
44  char **buffer;
45 };
46 
47 struct osmo_strrb *osmo_strrb_create(TALLOC_CTX * ctx, size_t rb_size);
48 bool osmo_strrb_is_empty(const struct osmo_strrb *rb);
49 const char *osmo_strrb_get_nth(const struct osmo_strrb *rb,
50  unsigned int string_index);
51 bool _osmo_strrb_is_bufindex_valid(const struct osmo_strrb *rb,
52  unsigned int offset);
53 size_t osmo_strrb_elements(const struct osmo_strrb *rb);
54 int osmo_strrb_add(struct osmo_strrb *rb, const char *data);
55 
58 #endif /* _STRRB_H */