avahi 0.6.30

avahi-gobject/ga-entry-group.h

Go to the documentation of this file.
00001 /*
00002  * ga-entry-group.h - Header for GaEntryGroup
00003  * Copyright (C) 2006-2007 Collabora Ltd.
00004  *
00005  * This library is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU Lesser General Public
00007  * License as published by the Free Software Foundation; either
00008  * version 2.1 of the License, or (at your option) any later version.
00009  *
00010  * This library is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Lesser General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Lesser General Public
00016  * License along with this library; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00018  */
00019 
00020 #ifndef __GA_ENTRY_GROUP_H__
00021 #define __GA_ENTRY_GROUP_H__
00022 
00023 #include <glib-object.h>
00024 #include <avahi-client/publish.h>
00025 #include <avahi-client/client.h>
00026 
00027 #include "ga-client.h"
00028 
00029 G_BEGIN_DECLS
00030 
00031 typedef enum {
00032     GA_ENTRY_GROUP_STATE_UNCOMMITED = AVAHI_ENTRY_GROUP_UNCOMMITED,
00033     GA_ENTRY_GROUP_STATE_REGISTERING = AVAHI_ENTRY_GROUP_REGISTERING,
00034     GA_ENTRY_GROUP_STATE_ESTABLISHED = AVAHI_ENTRY_GROUP_ESTABLISHED,
00035     GA_ENTRY_GROUP_STATE_COLLISTION = AVAHI_ENTRY_GROUP_COLLISION,
00036     GA_ENTRY_GROUP_STATE_FAILURE = AVAHI_ENTRY_GROUP_FAILURE
00037 } GaEntryGroupState;
00038 
00039 typedef struct _GaEntryGroupService GaEntryGroupService;
00040 typedef struct _GaEntryGroup GaEntryGroup;
00041 typedef struct _GaEntryGroupClass GaEntryGroupClass;
00042 
00043 struct _GaEntryGroupService {
00044     AvahiIfIndex interface;
00045     AvahiProtocol protocol;
00046     AvahiPublishFlags flags;
00047     gchar *name;
00048     gchar *type;
00049     gchar *domain;
00050     gchar *host;
00051     guint16 port;
00052 };
00053 
00054 struct _GaEntryGroupClass {
00055     GObjectClass parent_class;
00056 };
00057 
00058 struct _GaEntryGroup {
00059     GObject parent;
00060 };
00061 
00062 GType ga_entry_group_get_type(void);
00063 
00064 /* TYPE MACROS */
00065 #define GA_TYPE_ENTRY_GROUP \
00066   (ga_entry_group_get_type())
00067 #define GA_ENTRY_GROUP(obj) \
00068   (G_TYPE_CHECK_INSTANCE_CAST((obj), GA_TYPE_ENTRY_GROUP, GaEntryGroup))
00069 #define GA_ENTRY_GROUP_CLASS(klass) \
00070   (G_TYPE_CHECK_CLASS_CAST((klass), GA_TYPE_ENTRY_GROUP, GaEntryGroupClass))
00071 #define IS_GA_ENTRY_GROUP(obj) \
00072   (G_TYPE_CHECK_INSTANCE_TYPE((obj), GA_TYPE_ENTRY_GROUP))
00073 #define IS_GA_ENTRY_GROUP_CLASS(klass) \
00074   (G_TYPE_CHECK_CLASS_TYPE((klass), GA_TYPE_ENTRY_GROUP))
00075 #define GA_ENTRY_GROUP_GET_CLASS(obj) \
00076   (G_TYPE_INSTANCE_GET_CLASS ((obj), GA_TYPE_ENTRY_GROUP, GaEntryGroupClass))
00077 
00078 GaEntryGroup *ga_entry_group_new(void);
00079 
00080 gboolean ga_entry_group_attach(GaEntryGroup * group,
00081                       GaClient * client, GError ** error);
00082 
00083 GaEntryGroupService *ga_entry_group_add_service_strlist(GaEntryGroup * group,
00084                                                         const gchar * name,
00085                                                         const gchar * type,
00086                                                         guint16 port,
00087                                                         GError ** error,
00088                                                         AvahiStringList *
00089                                                         txt);
00090 
00091 GaEntryGroupService *ga_entry_group_add_service_full_strlist(GaEntryGroup *
00092                                                              group,
00093                                                              AvahiIfIndex
00094                                                              interface,
00095                                                              AvahiProtocol
00096                                                              protocol,
00097                                                              AvahiPublishFlags
00098                                                              flags,
00099                                                              const gchar *
00100                                                              name,
00101                                                              const gchar *
00102                                                              type,
00103                                                              const gchar *
00104                                                              domain,
00105                                                              const gchar *
00106                                                              host,
00107                                                              guint16 port,
00108                                                              GError ** error,
00109                                                              AvahiStringList *
00110                                                              txt);
00111 GaEntryGroupService *ga_entry_group_add_service(GaEntryGroup * group,
00112                                                 const gchar * name,
00113                                                 const gchar * type,
00114                                                 guint16 port, GError ** error,
00115                                                 ...);
00116 
00117 GaEntryGroupService *ga_entry_group_add_service_full(GaEntryGroup * group,
00118                                                      AvahiIfIndex interface,
00119                                                      AvahiProtocol protocol,
00120                                                      AvahiPublishFlags flags,
00121                                                      const gchar * name,
00122                                                      const gchar * type,
00123                                                      const gchar * domain,
00124                                                      const gchar * host,
00125                                                      guint16 port,
00126                                                      GError ** error, ...);
00127 
00128 /* Add raw record */
00129 gboolean ga_entry_group_add_record(GaEntryGroup * group,
00130                           AvahiPublishFlags flags,
00131                           const gchar * name,
00132                           guint16 type,
00133                           guint32 ttl,
00134                           const void *rdata, gsize size, GError ** error);
00135 gboolean ga_entry_group_add_record_full(GaEntryGroup * group,
00136                                AvahiIfIndex interface,
00137                                AvahiProtocol protocol,
00138                                AvahiPublishFlags flags,
00139                                const gchar * name,
00140                                guint16 clazz,
00141                                guint16 type,
00142                                guint32 ttl,
00143                                const void *rdata,
00144                                gsize size, GError ** error);
00145 
00146 
00147 
00148 void ga_entry_group_service_freeze(GaEntryGroupService * service);
00149 
00150 /* Set a key in the service record. If the service isn't frozen it's committed
00151  * immediately */
00152 gboolean ga_entry_group_service_set(GaEntryGroupService * service,
00153                            const gchar * key, const gchar * value,
00154                            GError ** error);
00155 
00156 gboolean ga_entry_group_service_set_arbitrary(GaEntryGroupService * service,
00157                                      const gchar * key, const guint8 * value,
00158                                      gsize size, GError ** error);
00159 
00160 /* Remove one key from the service record */
00161 gboolean ga_entry_group_service_remove_key(GaEntryGroupService * service,
00162                                   const gchar * key, GError ** error);
00163 
00164 /* Update the txt record of the frozen service */
00165 gboolean ga_entry_group_service_thaw(GaEntryGroupService * service, GError ** error);
00166 
00167 /* Commit all newly added services */
00168 gboolean ga_entry_group_commit(GaEntryGroup * group, GError ** error);
00169 
00170 /* Invalidated all GaEntryGroupServices */
00171 gboolean ga_entry_group_reset(GaEntryGroup * group, GError ** error);
00172 
00173 G_END_DECLS
00174 #endif /* #ifndef __GA_ENTRY_GROUP_H__ */