Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:59:59

0001 /* GIO - GLib Input, Output and Streaming Library
0002  *
0003  * Copyright (C) 2008 Red Hat, Inc.
0004  * Copyright (C) 2018 Igalia S.L.
0005  *
0006  * SPDX-License-Identifier: LGPL-2.1-or-later
0007  *
0008  * This library is free software; you can redistribute it and/or
0009  * modify it under the terms of the GNU Lesser General Public
0010  * License as published by the Free Software Foundation; either
0011  * version 2.1 of the License, or (at your option) any later version.
0012  *
0013  * This library is distributed in the hope that it will be useful,
0014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0016  * Lesser General Public License for more details.
0017  *
0018  * You should have received a copy of the GNU Lesser General
0019  * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
0020  */
0021 
0022 #ifndef __G_RESOLVER_H__
0023 #define __G_RESOLVER_H__
0024 
0025 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
0026 #error "Only <gio/gio.h> can be included directly."
0027 #endif
0028 
0029 #include <gio/giotypes.h>
0030 
0031 G_BEGIN_DECLS
0032 
0033 #define G_TYPE_RESOLVER         (g_resolver_get_type ())
0034 #define G_RESOLVER(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_RESOLVER, GResolver))
0035 #define G_RESOLVER_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_RESOLVER, GResolverClass))
0036 #define G_IS_RESOLVER(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_RESOLVER))
0037 #define G_IS_RESOLVER_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_RESOLVER))
0038 #define G_RESOLVER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_RESOLVER, GResolverClass))
0039 
0040 typedef struct _GResolverPrivate GResolverPrivate;
0041 typedef struct _GResolverClass   GResolverClass;
0042 
0043 struct _GResolver {
0044   GObject parent_instance;
0045 
0046   GResolverPrivate *priv;
0047 };
0048 
0049 /**
0050  * GResolverNameLookupFlags:
0051  * @G_RESOLVER_NAME_LOOKUP_FLAGS_DEFAULT: default behavior (same as g_resolver_lookup_by_name())
0052  * @G_RESOLVER_NAME_LOOKUP_FLAGS_IPV4_ONLY: only resolve ipv4 addresses
0053  * @G_RESOLVER_NAME_LOOKUP_FLAGS_IPV6_ONLY: only resolve ipv6 addresses
0054  *
0055  * Flags to modify lookup behavior.
0056  *
0057  * Since: 2.60
0058  */
0059 typedef enum {
0060   G_RESOLVER_NAME_LOOKUP_FLAGS_DEFAULT = 0,
0061   G_RESOLVER_NAME_LOOKUP_FLAGS_IPV4_ONLY = 1 << 0,
0062   G_RESOLVER_NAME_LOOKUP_FLAGS_IPV6_ONLY = 1 << 1,
0063 } GResolverNameLookupFlags;
0064 
0065 struct _GResolverClass {
0066   GObjectClass parent_class;
0067 
0068   /* Signals */
0069   void    ( *reload)                           (GResolver               *resolver);
0070 
0071   /* Virtual methods */
0072   GList * ( *lookup_by_name)                   (GResolver               *resolver,
0073                                                 const gchar             *hostname,
0074                                                 GCancellable            *cancellable,
0075                                                 GError                 **error);
0076   void    ( *lookup_by_name_async)             (GResolver               *resolver,
0077                                                 const gchar             *hostname,
0078                                                 GCancellable            *cancellable,
0079                                                 GAsyncReadyCallback      callback,
0080                                                 gpointer                 user_data);
0081   GList * ( *lookup_by_name_finish)            (GResolver               *resolver,
0082                                                 GAsyncResult            *result,
0083                                                 GError                 **error);
0084 
0085   gchar * ( *lookup_by_address)                (GResolver               *resolver,
0086                                                 GInetAddress            *address,
0087                                                 GCancellable            *cancellable,
0088                                                 GError                 **error);
0089   void    ( *lookup_by_address_async)          (GResolver               *resolver,
0090                                                 GInetAddress            *address,
0091                                                 GCancellable            *cancellable,
0092                                                 GAsyncReadyCallback      callback,
0093                                                 gpointer                 user_data);
0094   gchar * ( *lookup_by_address_finish)         (GResolver               *resolver,
0095                                                 GAsyncResult            *result,
0096                                                 GError                 **error);
0097 
0098   GList * ( *lookup_service)                   (GResolver               *resolver,
0099                                                 const gchar              *rrname,
0100                                                 GCancellable             *cancellable,
0101                                                 GError                  **error);
0102   void    ( *lookup_service_async)             (GResolver                *resolver,
0103                                                 const gchar              *rrname,
0104                                                 GCancellable             *cancellable,
0105                                                 GAsyncReadyCallback       callback,
0106                                                 gpointer                  user_data);
0107   GList * ( *lookup_service_finish)            (GResolver                *resolver,
0108                                                 GAsyncResult             *result,
0109                                                 GError                  **error);
0110 
0111   GList * ( *lookup_records)                   (GResolver                *resolver,
0112                                                 const gchar              *rrname,
0113                                                 GResolverRecordType       record_type,
0114                                                 GCancellable             *cancellable,
0115                                                 GError                  **error);
0116 
0117   void    ( *lookup_records_async)             (GResolver                *resolver,
0118                                                 const gchar              *rrname,
0119                                                 GResolverRecordType       record_type,
0120                                                 GCancellable             *cancellable,
0121                                                 GAsyncReadyCallback       callback,
0122                                                 gpointer                  user_data);
0123 
0124   GList * ( *lookup_records_finish)            (GResolver                *resolver,
0125                                                 GAsyncResult             *result,
0126                                                 GError                   **error);
0127   /**
0128    * GResolverClass::lookup_by_name_with_flags_async:
0129    * @resolver: a #GResolver
0130    * @hostname: the hostname to resolve
0131    * @flags: extra #GResolverNameLookupFlags to modify the lookup
0132    * @cancellable: (nullable): a #GCancellable
0133    * @callback: (scope async): a #GAsyncReadyCallback to call when completed
0134    * @user_data: data to pass to @callback
0135    *
0136    * Asynchronous version of GResolverClass::lookup_by_name_with_flags
0137    *
0138    * GResolverClass::lookup_by_name_with_flags_finish will be called to get
0139    * the result.
0140    *
0141    * Since: 2.60
0142    */
0143   void    ( *lookup_by_name_with_flags_async)  (GResolver                 *resolver,
0144                                                 const gchar               *hostname,
0145                                                 GResolverNameLookupFlags   flags,
0146                                                 GCancellable              *cancellable,
0147                                                 GAsyncReadyCallback        callback,
0148                                                 gpointer                   user_data);
0149   /**
0150    * GResolverClass::lookup_by_name_with_flags_finish:
0151    * @resolver: a #GResolver
0152    * @result: a #GAsyncResult
0153    * @error: (nullable): a pointer to a %NULL #GError
0154    *
0155    * Gets the result from GResolverClass::lookup_by_name_with_flags_async
0156    *
0157    * Returns: (element-type GInetAddress) (transfer full): List of #GInetAddress.
0158    * Since: 2.60
0159    */
0160   GList * ( *lookup_by_name_with_flags_finish) (GResolver                 *resolver,
0161                                                 GAsyncResult              *result,
0162                                                 GError                   **error);
0163   /**
0164    * GResolverClass::lookup_by_name_with_flags:
0165    * @resolver: a #GResolver
0166    * @hostname: the hostname to resolve
0167    * @flags: extra #GResolverNameLookupFlags to modify the lookup
0168    * @cancellable: (nullable): a #GCancellable
0169    * @error: (nullable): a pointer to a %NULL #GError
0170    *
0171    * This is identical to GResolverClass::lookup_by_name except it takes
0172    * @flags which modifies the behavior of the lookup. See #GResolverNameLookupFlags
0173    * for more details.
0174    *
0175    * Returns: (element-type GInetAddress) (transfer full): List of #GInetAddress.
0176    * Since: 2.60
0177    */
0178   GList * ( *lookup_by_name_with_flags)        (GResolver                 *resolver,
0179                                                 const gchar               *hostname,
0180                                                 GResolverNameLookupFlags   flags,
0181                                                 GCancellable              *cancellable,
0182                                                 GError                   **error);
0183 
0184 };
0185 
0186 GIO_AVAILABLE_IN_ALL
0187 GType      g_resolver_get_type                         (void) G_GNUC_CONST;
0188 GIO_AVAILABLE_IN_ALL
0189 GResolver *g_resolver_get_default                      (void);
0190 GIO_AVAILABLE_IN_ALL
0191 void       g_resolver_set_default                      (GResolver                 *resolver);
0192 GIO_AVAILABLE_IN_ALL
0193 GList     *g_resolver_lookup_by_name                   (GResolver                 *resolver,
0194                                                         const gchar               *hostname,
0195                                                         GCancellable              *cancellable,
0196                                                         GError                   **error);
0197 GIO_AVAILABLE_IN_ALL
0198 void       g_resolver_lookup_by_name_async             (GResolver                 *resolver,
0199                                                         const gchar               *hostname,
0200                                                         GCancellable              *cancellable,
0201                                                         GAsyncReadyCallback        callback,
0202                                                         gpointer                   user_data);
0203 GIO_AVAILABLE_IN_ALL
0204 GList     *g_resolver_lookup_by_name_finish            (GResolver                 *resolver,
0205                                                         GAsyncResult              *result,
0206                                                         GError                   **error);
0207 GIO_AVAILABLE_IN_2_60
0208 void       g_resolver_lookup_by_name_with_flags_async  (GResolver                 *resolver,
0209                                                         const gchar               *hostname,
0210                                                         GResolverNameLookupFlags   flags,
0211                                                         GCancellable              *cancellable,
0212                                                         GAsyncReadyCallback        callback,
0213                                                         gpointer                   user_data);
0214 GIO_AVAILABLE_IN_2_60
0215 GList     *g_resolver_lookup_by_name_with_flags_finish (GResolver                 *resolver,
0216                                                         GAsyncResult              *result,
0217                                                         GError                   **error);
0218 GIO_AVAILABLE_IN_2_60
0219 GList     *g_resolver_lookup_by_name_with_flags        (GResolver                 *resolver,
0220                                                         const gchar               *hostname,
0221                                                         GResolverNameLookupFlags   flags,
0222                                                         GCancellable              *cancellable,
0223                                                         GError                   **error);
0224 GIO_AVAILABLE_IN_ALL
0225 void       g_resolver_free_addresses                   (GList                     *addresses);
0226 GIO_AVAILABLE_IN_ALL
0227 gchar     *g_resolver_lookup_by_address                (GResolver                 *resolver,
0228                                                         GInetAddress              *address,
0229                                                         GCancellable              *cancellable,
0230                                                         GError                   **error);
0231 GIO_AVAILABLE_IN_ALL
0232 void       g_resolver_lookup_by_address_async          (GResolver                 *resolver,
0233                                                         GInetAddress              *address,
0234                                                         GCancellable              *cancellable,
0235                                                         GAsyncReadyCallback        callback,
0236                                                         gpointer                   user_data);
0237 GIO_AVAILABLE_IN_ALL
0238 gchar     *g_resolver_lookup_by_address_finish         (GResolver                 *resolver,
0239                                                         GAsyncResult              *result,
0240                                                         GError                   **error);
0241 GIO_AVAILABLE_IN_ALL
0242 GList     *g_resolver_lookup_service                   (GResolver                 *resolver,
0243                                                         const gchar               *service,
0244                                                         const gchar               *protocol,
0245                                                         const gchar               *domain,
0246                                                         GCancellable              *cancellable,
0247                                                         GError                   **error);
0248 GIO_AVAILABLE_IN_ALL
0249 void       g_resolver_lookup_service_async             (GResolver                 *resolver,
0250                                                         const gchar               *service,
0251                                                         const gchar               *protocol,
0252                                                         const gchar               *domain,
0253                                                         GCancellable              *cancellable,
0254                                                         GAsyncReadyCallback        callback,
0255                                                         gpointer                   user_data);
0256 GIO_AVAILABLE_IN_ALL
0257 GList     *g_resolver_lookup_service_finish            (GResolver                 *resolver,
0258                                                         GAsyncResult              *result,
0259                                                         GError                   **error);
0260 GIO_AVAILABLE_IN_2_34
0261 GList     *g_resolver_lookup_records                   (GResolver                 *resolver,
0262                                                         const gchar               *rrname,
0263                                                         GResolverRecordType        record_type,
0264                                                         GCancellable              *cancellable,
0265                                                         GError                   **error);
0266 GIO_AVAILABLE_IN_2_34
0267 void       g_resolver_lookup_records_async             (GResolver                 *resolver,
0268                                                         const gchar               *rrname,
0269                                                         GResolverRecordType        record_type,
0270                                                         GCancellable              *cancellable,
0271                                                         GAsyncReadyCallback        callback,
0272                                                         gpointer                   user_data);
0273 GIO_AVAILABLE_IN_2_34
0274 GList     *g_resolver_lookup_records_finish            (GResolver                 *resolver,
0275                                                         GAsyncResult              *result,
0276                                                         GError                   **error);
0277 GIO_AVAILABLE_IN_ALL
0278 void       g_resolver_free_targets                     (GList                     *targets);
0279 
0280 GIO_AVAILABLE_IN_2_78
0281 unsigned   g_resolver_get_timeout                      (GResolver                 *resolver);
0282 GIO_AVAILABLE_IN_2_78
0283 void       g_resolver_set_timeout                      (GResolver                 *resolver,
0284                                                         unsigned                   timeout_ms);
0285 
0286 /**
0287  * G_RESOLVER_ERROR:
0288  *
0289  * Error domain for #GResolver. Errors in this domain will be from the
0290  * #GResolverError enumeration. See #GError for more information on
0291  * error domains.
0292  */
0293 #define G_RESOLVER_ERROR (g_resolver_error_quark ())
0294 GIO_AVAILABLE_IN_ALL
0295 GQuark g_resolver_error_quark (void);
0296 
0297 G_END_DECLS
0298 
0299 #endif /* __G_RESOLVER_H__ */