interfaces.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * interfaces.h - Source for interface discovery code
  3. *
  4. * Farsight Helper functions
  5. * Copyright (C) 2006 Youness Alaoui <kakaroto@kakaroto.homelinux.net>
  6. * Copyright (C) 2008-2009 Collabora, Nokia
  7. * Contact: Youness Alaoui
  8. * Copyright (C) 2008-2009 Nokia Corporation. All rights reserved.
  9. *
  10. * This library is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU Lesser General Public
  12. * License as published by the Free Software Foundation; either
  13. * version 2.1 of the License, or (at your option) any later version.
  14. *
  15. * This library is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  18. * Lesser General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Lesser General Public
  21. * License along with this library; if not, write to the Free Software
  22. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  23. */
  24. #ifndef __LIBNICE_INTERFACES_H__
  25. #define __LIBNICE_INTERFACES_H__
  26. /**
  27. * SECTION:interfaces
  28. * @short_description: Utility functions to discover local network interfaces
  29. * @include: interfaces.h
  30. * @stability: Stable
  31. *
  32. * These utility functions allow the discovery of local network interfaces
  33. * in a portable manner, they also allow finding the local ip addresses or
  34. * the address allocated to a network interface.
  35. */
  36. #include <glib.h>
  37. G_BEGIN_DECLS
  38. /**
  39. * nice_interfaces_get_ip_for_interface:
  40. * @interface_name: name of local interface
  41. *
  42. * Retrieves the IP address of an interface by its name. If this fails, %NULL
  43. * is returned.
  44. *
  45. * Returns: (nullable) (transfer full): a newly-allocated string with the IP
  46. * address
  47. */
  48. gchar * nice_interfaces_get_ip_for_interface (gchar *interface_name);
  49. /**
  50. * nice_interfaces_get_local_ips:
  51. * @include_loopback: Include any loopback devices
  52. *
  53. * Get a list of local ipv4 interface addresses
  54. *
  55. * Returns: (element-type utf8) (transfer full): a newly-allocated #GList of
  56. * strings. The caller must free it.
  57. */
  58. GList * nice_interfaces_get_local_ips (gboolean include_loopback);
  59. /**
  60. * nice_interfaces_get_local_interfaces:
  61. *
  62. * Get the list of local interfaces
  63. *
  64. * Returns: (element-type utf8) (transfer full): a newly-allocated #GList of
  65. * strings. The caller must free it.
  66. */
  67. GList * nice_interfaces_get_local_interfaces (void);
  68. G_END_DECLS
  69. #endif /* __LIBNICE_INTERFACES_H__ */