]> git.ipfire.org Git - thirdparty/kmod.git/blob - libabc/libabc.h
Import skeleton from libabc
[thirdparty/kmod.git] / libabc / libabc.h
1 /*
2 libabc - something with abc
3
4 Copyright (C) 2011 Someone <someone@example.com>
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.ΒΆ
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with this library; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21 #ifndef _LIBABC_H_
22 #define _LIBABC_H_
23
24 #include <stdarg.h>
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29
30 /*
31 * abc_ctx
32 *
33 * library user context - reads the config and system
34 * environment, user variables, allows custom logging
35 */
36 struct abc_ctx;
37 struct abc_ctx *abc_ref(struct abc_ctx *ctx);
38 struct abc_ctx *abc_unref(struct abc_ctx *ctx);
39 int abc_new(struct abc_ctx **ctx);
40 void abc_set_log_fn(struct abc_ctx *ctx,
41 void (*log_fn)(struct abc_ctx *ctx,
42 int priority, const char *file, int line, const char *fn,
43 const char *format, va_list args));
44 int abc_get_log_priority(struct abc_ctx *ctx);
45 void abc_set_log_priority(struct abc_ctx *ctx, int priority);
46 void *abc_get_userdata(struct abc_ctx *ctx);
47 void abc_set_userdata(struct abc_ctx *ctx, void *userdata);
48
49 /*
50 * abc_list
51 *
52 * access to abc generated lists
53 */
54 struct abc_list_entry;
55 struct abc_list_entry *abc_list_entry_get_next(struct abc_list_entry *list_entry);
56 const char *abc_list_entry_get_name(struct abc_list_entry *list_entry);
57 const char *abc_list_entry_get_value(struct abc_list_entry *list_entry);
58 #define abc_list_entry_foreach(list_entry, first_entry) \
59 for (list_entry = first_entry; \
60 list_entry != NULL; \
61 list_entry = abc_list_entry_get_next(list_entry))
62
63 /*
64 * abc_thing
65 *
66 * access to things of abc
67 */
68 struct abc_thing;
69 struct abc_thing *abc_thing_ref(struct abc_thing *thing);
70 struct abc_thing *abc_thing_unref(struct abc_thing *thing);
71 struct abc_ctx *abc_thing_get_ctx(struct abc_thing *thing);
72 int abc_thing_new_from_string(struct abc_ctx *ctx, const char *string, struct abc_thing **thing);
73 struct abc_list_entry *abc_thing_get_some_list_entry(struct abc_thing *thing);
74
75 #ifdef __cplusplus
76 } /* extern "C" */
77 #endif
78
79 #endif