2 * ga-entry-group.h - Header for GaEntryGroup
3 * Copyright (C) 2006-2007 Collabora Ltd.
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.
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.
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
20 #ifndef __GA_ENTRY_GROUP_H__
21 #define __GA_ENTRY_GROUP_H__
23 #include <glib-object.h>
24 #include <avahi-client/publish.h>
25 #include <avahi-client/client.h>
27 #include "ga-client.h"
32 GA_ENTRY_GROUP_STATE_UNCOMMITED = AVAHI_ENTRY_GROUP_UNCOMMITED,
33 GA_ENTRY_GROUP_STATE_REGISTERING = AVAHI_ENTRY_GROUP_REGISTERING,
34 GA_ENTRY_GROUP_STATE_ESTABLISHED = AVAHI_ENTRY_GROUP_ESTABLISHED,
35 GA_ENTRY_GROUP_STATE_COLLISTION = AVAHI_ENTRY_GROUP_COLLISION,
36 GA_ENTRY_GROUP_STATE_FAILURE = AVAHI_ENTRY_GROUP_FAILURE
39 typedef struct _GaEntryGroupService GaEntryGroupService;
40 typedef struct _GaEntryGroup GaEntryGroup;
41 typedef struct _GaEntryGroupClass GaEntryGroupClass;
43 struct _GaEntryGroupService {
44 AvahiIfIndex interface;
45 AvahiProtocol protocol;
46 AvahiPublishFlags flags;
54 struct _GaEntryGroupClass {
55 GObjectClass parent_class;
58 struct _GaEntryGroup {
62 GType ga_entry_group_get_type(void);
65 #define GA_TYPE_ENTRY_GROUP \
66 (ga_entry_group_get_type())
67 #define GA_ENTRY_GROUP(obj) \
68 (G_TYPE_CHECK_INSTANCE_CAST((obj), GA_TYPE_ENTRY_GROUP, GaEntryGroup))
69 #define GA_ENTRY_GROUP_CLASS(klass) \
70 (G_TYPE_CHECK_CLASS_CAST((klass), GA_TYPE_ENTRY_GROUP, GaEntryGroupClass))
71 #define IS_GA_ENTRY_GROUP(obj) \
72 (G_TYPE_CHECK_INSTANCE_TYPE((obj), GA_TYPE_ENTRY_GROUP))
73 #define IS_GA_ENTRY_GROUP_CLASS(klass) \
74 (G_TYPE_CHECK_CLASS_TYPE((klass), GA_TYPE_ENTRY_GROUP))
75 #define GA_ENTRY_GROUP_GET_CLASS(obj) \
76 (G_TYPE_INSTANCE_GET_CLASS ((obj), GA_TYPE_ENTRY_GROUP, GaEntryGroupClass))
78 GaEntryGroup *ga_entry_group_new(void);
80 gboolean ga_entry_group_attach(GaEntryGroup * group,
81 GaClient * client, GError ** error);
83 GaEntryGroupService *ga_entry_group_add_service_strlist(GaEntryGroup * group,
91 GaEntryGroupService *ga_entry_group_add_service_full_strlist(GaEntryGroup *
111 GaEntryGroupService *ga_entry_group_add_service(GaEntryGroup * group,
114 guint16 port, GError ** error,
117 GaEntryGroupService *ga_entry_group_add_service_full(GaEntryGroup * group,
118 AvahiIfIndex interface,
119 AvahiProtocol protocol,
120 AvahiPublishFlags flags,
123 const gchar * domain,
126 GError ** error, ...);
129 gboolean ga_entry_group_add_record(GaEntryGroup * group,
130 AvahiPublishFlags flags,
134 const void *rdata, gsize size, GError ** error);
135 gboolean ga_entry_group_add_record_full(GaEntryGroup * group,
136 AvahiIfIndex interface,
137 AvahiProtocol protocol,
138 AvahiPublishFlags flags,
144 gsize size, GError ** error);
148 void ga_entry_group_service_freeze(GaEntryGroupService * service);
150 /* Set a key in the service record. If the service isn't frozen it's committed
152 gboolean ga_entry_group_service_set(GaEntryGroupService * service,
153 const gchar * key, const gchar * value,
156 gboolean ga_entry_group_service_set_arbitrary(GaEntryGroupService * service,
157 const gchar * key, const guint8 * value,
158 gsize size, GError ** error);
160 /* Remove one key from the service record */
161 gboolean ga_entry_group_service_remove_key(GaEntryGroupService * service,
162 const gchar * key, GError ** error);
164 /* Update the txt record of the frozen service */
165 gboolean ga_entry_group_service_thaw(GaEntryGroupService * service, GError ** error);
167 /* Commit all newly added services */
168 gboolean ga_entry_group_commit(GaEntryGroup * group, GError ** error);
170 /* Invalidated all GaEntryGroupServices */
171 gboolean ga_entry_group_reset(GaEntryGroup * group, GError ** error);
174 #endif /* #ifndef __GA_ENTRY_GROUP_H__ */