gnetworkaddress.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /* GIO - GLib Input, Output and Streaming Library
  2. *
  3. * Copyright (C) 2008 Red Hat, Inc.
  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 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
  16. * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #ifndef __G_NETWORK_ADDRESS_H__
  19. #define __G_NETWORK_ADDRESS_H__
  20. #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
  21. #error "Only <gio/gio.h> can be included directly."
  22. #endif
  23. #include <gio/giotypes.h>
  24. G_BEGIN_DECLS
  25. #define G_TYPE_NETWORK_ADDRESS (g_network_address_get_type ())
  26. #define G_NETWORK_ADDRESS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_NETWORK_ADDRESS, GNetworkAddress))
  27. #define G_NETWORK_ADDRESS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_NETWORK_ADDRESS, GNetworkAddressClass))
  28. #define G_IS_NETWORK_ADDRESS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_NETWORK_ADDRESS))
  29. #define G_IS_NETWORK_ADDRESS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_NETWORK_ADDRESS))
  30. #define G_NETWORK_ADDRESS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_NETWORK_ADDRESS, GNetworkAddressClass))
  31. typedef struct _GNetworkAddressClass GNetworkAddressClass;
  32. typedef struct _GNetworkAddressPrivate GNetworkAddressPrivate;
  33. struct _GNetworkAddress
  34. {
  35. GObject parent_instance;
  36. /*< private >*/
  37. GNetworkAddressPrivate *priv;
  38. };
  39. struct _GNetworkAddressClass
  40. {
  41. GObjectClass parent_class;
  42. };
  43. GLIB_AVAILABLE_IN_ALL
  44. GType g_network_address_get_type (void) G_GNUC_CONST;
  45. GLIB_AVAILABLE_IN_ALL
  46. GSocketConnectable *g_network_address_new (const gchar *hostname,
  47. guint16 port);
  48. GLIB_AVAILABLE_IN_ALL
  49. GSocketConnectable *g_network_address_parse (const gchar *host_and_port,
  50. guint16 default_port,
  51. GError **error);
  52. GLIB_AVAILABLE_IN_ALL
  53. GSocketConnectable *g_network_address_parse_uri (const gchar *uri,
  54. guint16 default_port,
  55. GError **error);
  56. GLIB_AVAILABLE_IN_ALL
  57. const gchar *g_network_address_get_hostname (GNetworkAddress *addr);
  58. GLIB_AVAILABLE_IN_ALL
  59. guint16 g_network_address_get_port (GNetworkAddress *addr);
  60. GLIB_AVAILABLE_IN_ALL
  61. const gchar *g_network_address_get_scheme (GNetworkAddress *addr);
  62. G_END_DECLS
  63. #endif /* __G_NETWORK_ADDRESS_H__ */