1 /*
2  * ga-client.h - Header for GaClient
3  * Copyright (C) 2006-2007 Collabora Ltd.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18  */
19 
20 #ifndef __GA_CLIENT_H__
21 #define __GA_CLIENT_H__
22 
23 #include <glib-object.h>
24 #include <avahi-client/client.h>
25 
26 G_BEGIN_DECLS
27 
28 typedef enum {
29     GA_CLIENT_STATE_NOT_STARTED = -1,
30     GA_CLIENT_STATE_S_REGISTERING = AVAHI_CLIENT_S_REGISTERING,
31     GA_CLIENT_STATE_S_RUNNING = AVAHI_CLIENT_S_RUNNING,
32     GA_CLIENT_STATE_S_COLLISION = AVAHI_CLIENT_S_COLLISION,
33     GA_CLIENT_STATE_FAILURE = AVAHI_CLIENT_FAILURE,
34     GA_CLIENT_STATE_CONNECTING = AVAHI_CLIENT_CONNECTING
35 } GaClientState;
36 
37 typedef enum {
38     GA_CLIENT_FLAG_NO_FLAGS = 0,
39     GA_CLIENT_FLAG_IGNORE_USER_CONFIG = AVAHI_CLIENT_IGNORE_USER_CONFIG,
40     GA_CLIENT_FLAG_NO_FAIL = AVAHI_CLIENT_NO_FAIL
41 } GaClientFlags;
42 
43 typedef struct _GaClient GaClient;
44 typedef struct _GaClientClass GaClientClass;
45 
46 struct _GaClientClass {
47     GObjectClass parent_class;
48 };
49 
50 struct _GaClient {
51     GObject parent;
52     /* Raw avahi_client handle, only reuse if you have reffed this instance */
53     AvahiClient *avahi_client;
54 };
55 
56 GType ga_client_get_type(void);
57 
58 /* TYPE MACROS */
59 #define GA_TYPE_CLIENT \
60     (ga_client_get_type())
61 #define GA_CLIENT(obj) \
62     (G_TYPE_CHECK_INSTANCE_CAST((obj), GA_TYPE_CLIENT, GaClient))
63 #define GA_CLIENT_CLASS(klass) \
64     (G_TYPE_CHECK_CLASS_CAST((klass), GA_TYPE_CLIENT, GaClientClass))
65 #define IS_GA_CLIENT(obj) \
66     (G_TYPE_CHECK_INSTANCE_TYPE((obj), GA_TYPE_CLIENT))
67 #define IS_GA_CLIENT_CLASS(klass) \
68     (G_TYPE_CHECK_CLASS_TYPE((klass), GA_TYPE_CLIENT))
69 #define GA_CLIENT_GET_CLASS(obj) \
70     (G_TYPE_INSTANCE_GET_CLASS ((obj), GA_TYPE_CLIENT, GaClientClass))
71 
72 GaClient *ga_client_new(GaClientFlags flags);
73 
74 gboolean ga_client_start(GaClient * client, GError ** error);
75 
76 G_END_DECLS
77 
78 #endif /* #ifndef __GA_CLIENT_H__ */
79