tizen 2.3 release
[external/buxton.git] / src / shared / direct.h
1 /*
2  * This file is part of buxton.
3  *
4  * Copyright (C) 2013 Intel Corporation
5  *
6  * buxton is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as
8  * published by the Free Software Foundation; either version 2.1
9  * of the License, or (at your option) any later version.
10  */
11
12 /**
13  * \file direct.h Internal header
14  * This file is used internally by buxton to provide functionality
15  * used by the daemon and buxtonctl for talking to the backend
16  */
17 #pragma once
18
19 #ifdef HAVE_CONFIG_H
20         #include "config.h"
21 #endif
22
23 #include <backend.h>
24 #include "buxton.h"
25 #include "hashmap.h"
26
27 /**
28  * Open a direct connection to Buxton
29  *
30  * @param control Valid BuxtonControl instance
31  * @return a boolean value, indicating success of the operation
32  */
33 bool buxton_direct_open(BuxtonControl *control)
34         __attribute__((warn_unused_result));
35
36 /**
37  * Create a DB for a given layer in Buxton
38  *
39  * @param control Valid BuxtonControl instance
40  * @param layer_name BuxtonString of the layer name to create
41  * @return a boolean value, indicating success of the operation
42  */
43 bool buxton_direct_init_db(BuxtonControl *control, BuxtonString *layer_name)
44         __attribute__((warn_unused_result));
45
46 /**
47  * Close direct Buxton management connection
48  * @param control Valid BuxtonControl instance
49  */
50 void buxton_direct_close(BuxtonControl *control);
51
52 /**
53  * Set a value within Buxton
54  * @param control An initialized control structure
55  * @param key The key struct
56  * @param label A BuxtonString containing the label to set
57  * @return A boolean value, indicating success of the operation
58  */
59 bool buxton_direct_set_label(BuxtonControl *control,
60                              _BuxtonKey *key,
61                              BuxtonString *label)
62         __attribute__((warn_unused_result));
63
64 /**
65  * Create a group within Buxton
66  * @param control An initialized control structure
67  * @param key The key struct with group and layer members initialized
68  * @param label The Smack label of the client
69  * @return A boolean value, indicating success of the operation
70  */
71 bool buxton_direct_create_group(BuxtonControl *control,
72                                 _BuxtonKey *key,
73                                 BuxtonString *label)
74         __attribute__((warn_unused_result));
75
76 /**
77  * Remove a group within Buxton
78  * @param control An initialized control structure
79  * @param key The key struct with group and layer members initialized
80  * @param client_label The Smack label of the client
81  * @return A boolean value, indicating success of the operation
82  */
83 bool buxton_direct_remove_group(BuxtonControl *control,
84                                 _BuxtonKey *key,
85                                 BuxtonString *client_label)
86         __attribute__((warn_unused_result));
87
88 /**
89  * Set a value within Buxton
90  * @param control An initialized control structure
91  * @param key The key struct
92  * @param data A struct containing the data to set
93  * @param label The Smack label for the client
94  * @return A boolean value, indicating success of the operation
95  */
96 bool buxton_direct_set_value(BuxtonControl *control,
97                              _BuxtonKey *key,
98                              BuxtonData *data,
99                              BuxtonString *label)
100         __attribute__((warn_unused_result));
101
102 /**
103  * Retrieve a value from Buxton
104  * @param control An initialized control structure
105  * @param key The key to retrieve
106  * @param data An empty BuxtonData, where data is stored
107  * @param data_label The Smack label of the data
108  * @param client_label The Smack label of the client
109  * @return A int32_t value, indicating success of the operation
110  */
111 int32_t buxton_direct_get_value(BuxtonControl *control,
112                              _BuxtonKey *key,
113                              BuxtonData *data,
114                              BuxtonString *data_label,
115                              BuxtonString *client_label)
116         __attribute__((warn_unused_result));
117
118 /**
119  * Retrieve a value from Buxton by layer
120  * @param control An initialized control structure
121  * @param key The key to retrieve
122  * @param data An empty BuxtonData, where data is stored
123  * @param data_label The Smack label of the data
124  * @param client_label The Smack label of the client
125  * @return An int value, indicating success of the operation
126  */
127 int buxton_direct_get_value_for_layer(BuxtonControl *control,
128                                        _BuxtonKey *key,
129                                        BuxtonData *data,
130                                        BuxtonString *data_label,
131                                        BuxtonString *client_label)
132         __attribute__((warn_unused_result));
133
134 /**
135  * Retrieve a list of keys from Buxton
136  * @param control An initialized control structure
137  * @param layer_name The layer to pquery
138  * @param data An empty BuxtonArray, where results are stored
139  * @return A boolean value, indicating success of the operation
140  */
141 bool buxton_direct_list_keys(BuxtonControl *control,
142                              BuxtonString *layer,
143                              BuxtonArray **list)
144         __attribute__((warn_unused_result));
145
146 /**
147  * Unset a value by key in the given BuxtonLayer
148  * @param control An initialized control structure
149  * @param key The key to remove
150  * @param label The Smack label of the client
151  * @return a boolean value, indicating success of the operation
152  */
153 bool buxton_direct_unset_value(BuxtonControl *control,
154                                _BuxtonKey *key,
155                                BuxtonString *label)
156         __attribute__((warn_unused_result));
157
158 /*
159  * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
160  *
161  * Local variables:
162  * c-basic-offset: 8
163  * tab-width: 8
164  * indent-tabs-mode: t
165  * End:
166  *
167  * vi: set shiftwidth=8 tabstop=8 noexpandtab:
168  * :indentSize=8:tabSize=8:noTabs=false:
169  */