e7a4d837edfe4c85ce7ce43817bbafdbb5511f63
[platform/upstream/buxton.git] / docs / buxton_open.3
1 '\" t
2 .TH "BUXTON_OPEN" "3" "buxton 1" "buxton_open"
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 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10 .ie \n(.g .ds Aq \(aq
11 .el       .ds Aq '
12 .\" -----------------------------------------------------------------
13 .\" * set default formatting
14 .\" -----------------------------------------------------------------
15 .\" disable hyphenation
16 .nh
17 .\" disable justification (adjust text to left margin only)
18 .ad l
19 .\" -----------------------------------------------------------------
20 .\" * MAIN CONTENT STARTS HERE *
21 .\" -----------------------------------------------------------------
22 .SH "NAME"
23 buxton_open, buxton_close \- Manage buxton client connections
24
25 .SH "SYNOPSIS"
26 .nf
27 \fB
28 #include <buxton.h>
29 \fR
30 .sp
31 \fB
32 int buxton_open(BuxtonClient *\fIclient\fB)
33 .sp
34 .br
35 void buxton_close(BuxtonClient \fIclient\fB)
36 \fR
37 .fi
38
39 .SH "DESCRIPTION"
40 .PP
41 These functions are used to manage connections from a buxton client to the
42 buxton daemon, \fBbuxtond\fR(8)\&. Clients must call \fBbuxton_open\fR(3), to
43 create a new connection to the daemon\&. Effectively, creating this connection
44 registers the client with the daemon, allowing the client to make configuration
45 changes, queries, etc\&. This function requires one argument, \fIclient\fR, a
46 pointer to a BuxtonClient owned by the client\&. It returns 0 on success,
47 and a non-zero status code on failure\&.
48
49 To terminate this connection, the client must call \fBbuxton_close\fR(3)\&. The
50 required argument is a reference to the same BuxtonClient passed to
51 \fBbuxton_open\fR(3)\&.
52
53 .SH "CODE EXAMPLE"
54 .nf
55 .sp
56 #define _GNU_SOURCE
57 #include <buxton.h>
58
59 int main(void)
60 {
61         BuxtonClient client;
62         int fd;
63
64         if ((fd = buxton_open(&client)) < 0) {
65                 printf("couldn't connect\\n");
66                 return -1;
67         }
68
69         /* Manipulate data, register for notifications, ... */
70
71         buxton_close(client);
72         return 0;
73 }
74 .fi
75
76 .SH "COPYRIGHT"
77 .PP
78 Copyright 2014 Intel Corporation\&. License: Creative Commons
79 Attribution\-ShareAlike 3.0 Unported\s-2\u[1]\d\s+2, with exception
80 for code examples found in the \fBCODE EXAMPLE\fR section, which are
81 licensed under the MIT license provided in the \fIdocs/LICENSE.MIT\fR
82 file from this buxton distribution\&.
83
84 .SH "SEE ALSO"
85 .PP
86 \fBbuxton\fR(7),
87 \fBbuxtond\fR(8),
88 \fBbuxton\-api\fR(7)
89
90 .SH "NOTES"
91 .IP " 1." 4
92 Creative Commons Attribution\-ShareAlike 3.0 Unported
93 .RS 4
94 \%http://creativecommons.org/licenses/by-sa/3.0/
95 .RE