2 .TH "BUXTON_CREATE_GROUP" "3" "buxton 1" "buxton_create_group"
3 .\" -----------------------------------------------------------------
4 .\" * Define some portability stuff
5 .\" -----------------------------------------------------------------
6 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 .\" http://bugs.debian.org/507673
8 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
9 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
12 .\" -----------------------------------------------------------------
13 .\" * set default formatting
14 .\" -----------------------------------------------------------------
15 .\" disable hyphenation
17 .\" disable justification (adjust text to left margin only)
19 .\" -----------------------------------------------------------------
20 .\" * MAIN CONTENT STARTS HERE *
21 .\" -----------------------------------------------------------------
23 buxton_create_group, buxton_remove_group \- Manage groups within buxton
32 int buxton_create_group(BuxtonClient \fIclient\fB,
36 BuxtonCallback \fIcallback\fB,
43 int buxton_remove_group(BuxtonClient \fIclient\fB,
47 BuxtonCallback \fIcallback\fB,
57 These functions are used for managing groups within buxton\&.
59 Before a value can be set for a key-name, the group for the key-name
60 must be created\&. A group can be created by calling
61 \fBbuxton_create_group\fR(3). Creating a group is done on behalf of
62 \fIclient\fR, and the BuxtonKey, \fIkey\fR, is group to be created\&.
63 For more information about BuxtonKeys, see
64 \fBbuxton_key_create\fR(3)\&.
66 Groups can also be removed by calling \fBbuxton_remove_group\fR(3)\&.
67 Note that this operation is recursive, removing all key-names within
68 a group, and the group itself\&.
70 Both functions accept optional callback functions to register with
71 the daemon, referenced by the \fIcallback\fR argument; the callback
72 function is called upon completion of the operation\&. The \fIdata\fR
73 argument is a pointer to arbitrary userdata that is passed along to
74 the callback function\&. Additonally, the \fIsync\fR argument
75 controls whether the operation should be synchronous or not; if
76 \fIsync\fR is false, the operation is asynchronous\&.
80 An example for \fBbuxton_create_group\fR(3):
92 void create_cb(BuxtonResponse response, void *data)
94 if (buxton_response_status(response) != 0) {
95 printf("Failed to create group\\n");
97 printf("Created group\\n");
105 struct pollfd pfd[1];
109 if ((fd = buxton_open(&client)) < 0) {
110 printf("couldn't connect\\n");
114 key = buxton_key_create("hello", NULL, "user", STRING);
119 if (buxton_create_group(client, key, create_cb,
121 printf("create group call failed to run\\n");
126 pfd[0].events = POLLIN;
128 r = poll(pfd, 1, 5000);
131 printf("poll error\\n");
135 if (!buxton_client_handle_response(client)) {
136 printf("bad response from daemon\\n");
140 buxton_key_free(key);
141 buxton_close(client);
146 An example for \fBbuxton_remove_group\fR(3):
158 void remove_cb(BuxtonResponse response, void *data)
160 if (buxton_response_status(response) != 0) {
161 printf("Failed to remove group\\n");
163 printf("Removed group\\n");
171 struct pollfd pfd[1];
175 if ((fd = buxton_open(&client)) < 0) {
176 printf("couldn't connect\\n");
180 key = buxton_key_create("hello", NULL, "user", STRING);
185 if (buxton_remove_group(client, key, remove_cb,
187 printf("remove group call failed to run\\n");
192 pfd[0].events = POLLIN;
194 r = poll(pfd, 1, 5000);
197 printf("poll error\\n");
201 if (!buxton_client_handle_response(client)) {
202 printf("bad response from daemon\\n");
206 buxton_key_free(key);
207 buxton_close(client);
214 Returns 0 on success, and a non\-zero value on failure\&.
218 Copyright 2014 Intel Corporation\&. License: Creative Commons
219 Attribution\-ShareAlike 3.0 Unported\s-2\u[1]\d\s+2, with exception
220 for code examples found in the \fBCODE EXAMPLE\fR section, which are
221 licensed under the MIT license provided in the \fIdocs/LICENSE.MIT\fR
222 file from this buxton distribution\&.
232 Creative Commons Attribution\-ShareAlike 3.0 Unported
234 \%http://creativecommons.org/licenses/by-sa/3.0/