blob: 7409d551213e5fcfc1af7dbf53a43005c9126756 [file] [log] [blame]
Ivan Kluchnikov962f97b2012-04-30 17:51:23 +04001/* bitvector.h
2 *
3 * Copyright (C) 2012 Ivan Klyuchnikov
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 */
19
20#ifndef BITVECTOR_H
21#define BITVECTOR_H
22
23/*! \defgroup bitvector Bit vectors
24 * @{
25 */
26
27/*! \file bitvector.h
28 * \brief Additional functions for Osmocom bit vector abstraction.
29 */
30
31extern "C" {
32#include <osmocom/core/bitvec.h>
33}
34
35struct bitvec *bitvec_alloc(unsigned size);
36void bitvec_free(struct bitvec *bv);
37int bitvec_unhex(struct bitvec *bv, const char* src);
38int bitvec_pack(struct bitvec *bv, uint8_t *buffer);
39int bitvec_unpack(struct bitvec *bv, uint8_t *buffer);
40uint64_t bitvec_read_field(struct bitvec *bv, unsigned& read_index, unsigned len);
41int bitvec_write_field(struct bitvec *bv, unsigned& write_index, uint64_t val, unsigned len);
42
43/*! }@ */
44
45#endif // BITVECTOR_H