GNU Radio's FOSPHOR Package

resource_internal.h
Go to the documentation of this file.
1/*
2 * resource_internal.h
3 *
4 * Internal structures for the resource management
5 *
6 * Copyright (C) 2013-2014 Sylvain Munaut
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#ifndef __RESOURCE_INTERNAL_H__
23#define __RESOURCE_INTERNAL_H__
24
25/*! \addtogroup resource
26 * @{
27 */
28
29/*! \file resource_internal.h
30 * \brief Internal header for the resource management
31 */
32
33#include "llist.h"
34
35/*! \brief Internal structure describing a packed resource */
36 struct resource_pack
37{
38 const char *name; /*!< \brief Name of the resource */
39 const void *data; /*!< \brief Data (with added final \0) */
40 unsigned int len; /*!< \brief Original length (in bytes) of data */
41};
42
43 struct resource_cache
44{
45 struct llist_head head; /*< \brief Linked list head for cache */
46
47 const char *name; /*< \brief Name of the resource */
48 const void *data; /*< \brief Data pointer given to user */
49 unsigned int len; /*< \brief riginal length (in bytes) of data */
50
51 int refcnt; /*< \brief Reference counter */
52 int flags; /*< \brief Flags */
53
54#define RES_FLAG_MALLOCED (1 << 0)
55
56 char extra[0]; /*< \brief Extra data for whatever ... */
57};
58
59/*! @} */
60
61#endif /* __RESOURCE_INTERNAL_H__ */
llist.h
Simple double-linked list.
llist_head
Definition: llist.h:38
resource_cache
Definition: resource_internal.h:44
resource_cache::len
unsigned int len
Definition: resource_internal.h:49
resource_cache::data
const void * data
Definition: resource_internal.h:48
resource_cache::refcnt
int refcnt
Definition: resource_internal.h:51
resource_cache::head
struct llist_head head
Definition: resource_internal.h:45
resource_cache::flags
int flags
Definition: resource_internal.h:52
resource_cache::name
const char * name
Definition: resource_internal.h:47
resource_cache::extra
char extra[0]
Definition: resource_internal.h:56
resource_pack
Internal structure describing a packed resource.
Definition: resource_internal.h:37
resource_pack::data
const void * data
Data (with added final \0)
Definition: resource_internal.h:39
resource_pack::name
const char * name
Name of the resource.
Definition: resource_internal.h:38
resource_pack::len
unsigned int len
Original length (in bytes) of data.
Definition: resource_internal.h:40