1 /**
2 * collectd - src/meta_data.h
3 * Copyright (C) 2008-2011 Florian octo Forster
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
22 *
23 * Authors:
24 * Florian octo Forster <octo at collectd.org>
25 **/
27 #ifndef META_DATA_H
28 #define META_DATA_H
30 #include "collectd.h"
32 /*
33 * Defines
34 */
35 #define MD_TYPE_STRING 1
36 #define MD_TYPE_SIGNED_INT 2
37 #define MD_TYPE_UNSIGNED_INT 3
38 #define MD_TYPE_DOUBLE 4
39 #define MD_TYPE_BOOLEAN 5
41 struct meta_data_s;
42 typedef struct meta_data_s meta_data_t;
44 meta_data_t *meta_data_create (void);
45 meta_data_t *meta_data_clone (meta_data_t *orig);
46 void meta_data_destroy (meta_data_t *md);
48 int meta_data_exists (meta_data_t *md, const char *key);
49 int meta_data_type (meta_data_t *md, const char *key);
50 int meta_data_toc (meta_data_t *md, char ***toc);
51 int meta_data_delete (meta_data_t *md, const char *key);
53 int meta_data_add_string (meta_data_t *md,
54 const char *key,
55 const char *value);
56 int meta_data_add_signed_int (meta_data_t *md,
57 const char *key,
58 int64_t value);
59 int meta_data_add_unsigned_int (meta_data_t *md,
60 const char *key,
61 uint64_t value);
62 int meta_data_add_double (meta_data_t *md,
63 const char *key,
64 double value);
65 int meta_data_add_boolean (meta_data_t *md,
66 const char *key,
67 _Bool value);
69 int meta_data_get_string (meta_data_t *md,
70 const char *key,
71 char **value);
72 int meta_data_get_signed_int (meta_data_t *md,
73 const char *key,
74 int64_t *value);
75 int meta_data_get_unsigned_int (meta_data_t *md,
76 const char *key,
77 uint64_t *value);
78 int meta_data_get_double (meta_data_t *md,
79 const char *key,
80 double *value);
81 int meta_data_get_boolean (meta_data_t *md,
82 const char *key,
83 _Bool *value);
85 #endif /* META_DATA_H */
86 /* vim: set sw=2 sts=2 et : */