interfaces.h 2.44 KB
Newer Older
Youness Alaoui's avatar
Youness Alaoui committed
1 2 3 4 5
/*
 * interfaces.h - Source for interface discovery code
 *
 * Farsight Helper functions
 * Copyright (C) 2006 Youness Alaoui <kakaroto@kakaroto.homelinux.net>
6 7 8
 * Copyright (C) 2008-2009 Collabora, Nokia
 *  Contact: Youness Alaoui
 * Copyright (C) 2008-2009 Nokia Corporation. All rights reserved.
Youness Alaoui's avatar
Youness Alaoui committed
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
 */

Olivier Crête's avatar
Olivier Crête committed
25 26
#ifndef __LIBNICE_INTERFACES_H__
#define __LIBNICE_INTERFACES_H__
Youness Alaoui's avatar
Youness Alaoui committed
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44

/**
 * SECTION:interfaces
 * @short_description: Utility functions to discover local network interfaces
 * @include: interfaces.h
 * @stability: Stable
 *
 * These utility functions allow the discovery of local network interfaces
 * in a portable manner, they also allow finding the local ip addresses or
 * the address allocated to a network interface.
 */

#include <glib.h>

G_BEGIN_DECLS


/**
45
 * nice_interfaces_get_ip_for_interface:
Youness Alaoui's avatar
Youness Alaoui committed
46 47
 * @interface_name: name of local interface
 *
48 49
 * Retrieves the IP address of an interface by its name. If this fails, %NULL
 * is returned.
Youness Alaoui's avatar
Youness Alaoui committed
50
 *
51 52
 * Returns: (nullable) (transfer full): a newly-allocated string with the IP
 * address
Youness Alaoui's avatar
Youness Alaoui committed
53 54 55 56 57
 */
gchar * nice_interfaces_get_ip_for_interface (gchar *interface_name);


/**
58
 * nice_interfaces_get_local_ips:
Youness Alaoui's avatar
Youness Alaoui committed
59 60 61 62
 * @include_loopback: Include any loopback devices
 *
 * Get a list of local ipv4 interface addresses
 *
63 64
 * Returns: (element-type utf8) (transfer full): a newly-allocated #GList of
 * strings. The caller must free it.
Youness Alaoui's avatar
Youness Alaoui committed
65 66 67 68 69 70
 */

GList * nice_interfaces_get_local_ips (gboolean include_loopback);


/**
71
 * nice_interfaces_get_local_interfaces:
Youness Alaoui's avatar
Youness Alaoui committed
72 73 74
 *
 * Get the list of local interfaces
 *
75 76
 * Returns: (element-type utf8) (transfer full): a newly-allocated #GList of
 * strings. The caller must free it.
Youness Alaoui's avatar
Youness Alaoui committed
77 78 79 80 81
 */
GList * nice_interfaces_get_local_interfaces (void);

G_END_DECLS

Olivier Crête's avatar
Olivier Crête committed
82
#endif /* __LIBNICE_INTERFACES_H__ */