diff options
-rw-r--r-- | Makefile.am | 1 | ||||
-rw-r--r-- | local/Makefile.am | 29 | ||||
-rw-r--r-- | local/list-local-interfaces.c | 66 | ||||
-rw-r--r-- | local/local.c | 94 | ||||
-rw-r--r-- | local/local.h | 67 |
5 files changed, 0 insertions, 257 deletions
diff --git a/Makefile.am b/Makefile.am index 3186ca1..d837069 100644 --- a/Makefile.am +++ b/Makefile.am @@ -10,7 +10,6 @@ include common.mk ALWAYS_SUBDIRS = \ address \ - local \ stun \ tests \ socket \ diff --git a/local/Makefile.am b/local/Makefile.am deleted file mode 100644 index 1cf5600..0000000 --- a/local/Makefile.am +++ /dev/null @@ -1,29 +0,0 @@ -# -# Makefile.am for the Nice Glib ICE library -# -# (C) 2006, 2007 Collabora Ltd. -# (C) 2006, 2007 Nokia Corporation. All rights reserved. -# -# Licensed under MPL 1.1/LGPL 2.1. See file COPYING. - -include $(top_srcdir)/common.mk - -AM_CFLAGS = \ - $(ERROR_CFLAGS) \ - $(GLIB_CFLAGS) \ - -I $(top_srcdir)/address - -noinst_LTLIBRARIES = liblocal.la - -liblocal_la_SOURCES = local.h local.c - -pkginclude_HEADERS = local.h - -noinst_PROGRAMS = list-local-interfaces -TESTS = list-local-interfaces - -list_local_interfaces_LDADD = \ - $(GLIB_LIBS) \ - liblocal.la \ - $(top_builddir)/address/libaddress.la - diff --git a/local/list-local-interfaces.c b/local/list-local-interfaces.c deleted file mode 100644 index b73d135..0000000 --- a/local/list-local-interfaces.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * This file is part of the Nice GLib ICE library. - * - * (C) 2006, 2007 Collabora Ltd. - * Contact: Dafydd Harries - * (C) 2006, 2007 Nokia Corporation. All rights reserved. - * Contact: Kai Vehmanen - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is the Nice GLib ICE library. - * - * The Initial Developers of the Original Code are Collabora Ltd and Nokia - * Corporation. All Rights Reserved. - * - * Contributors: - * Dafydd Harries, Collabora Ltd. - * - * Alternatively, the contents of this file may be used under the terms of the - * the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which - * case the provisions of LGPL are applicable instead of those above. If you - * wish to allow use of your version of this file only under the terms of the - * LGPL and not to allow others to use your version of this file under the - * MPL, indicate your decision by deleting the provisions above and replace - * them with the notice and other provisions required by the LGPL. If you do - * not delete the provisions above, a recipient may use your version of this - * file under either the MPL or the LGPL. - */ -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include "local.h" - -int -main (void) -{ - GSList *i; - GSList *interfaces; - - interfaces = nice_list_local_interfaces (); - - g_assert (interfaces); - - for (i = interfaces; i; i = i->next) - { - NiceInterface *iface = i->data; - gchar addr[NICE_ADDRESS_STRING_LEN]; - - nice_address_to_string (&iface->addr, addr); - g_print ("%s: %s\n", iface->name, addr); - nice_interface_free (iface); - } - - g_slist_free (interfaces); - return 0; -} - diff --git a/local/local.c b/local/local.c deleted file mode 100644 index e8a6e99..0000000 --- a/local/local.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - * This file is part of the Nice GLib ICE library. - * - * (C) 2006, 2007 Collabora Ltd. - * Contact: Dafydd Harries - * (C) 2006, 2007 Nokia Corporation. All rights reserved. - * Contact: Kai Vehmanen - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is the Nice GLib ICE library. - * - * The Initial Developers of the Original Code are Collabora Ltd and Nokia - * Corporation. All Rights Reserved. - * - * Contributors: - * Dafydd Harries, Collabora Ltd. - * - * Alternatively, the contents of this file may be used under the terms of the - * the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which - * case the provisions of LGPL are applicable instead of those above. If you - * wish to allow use of your version of this file only under the terms of the - * LGPL and not to allow others to use your version of this file under the - * MPL, indicate your decision by deleting the provisions above and replace - * them with the notice and other provisions required by the LGPL. If you do - * not delete the provisions above, a recipient may use your version of this - * file under either the MPL or the LGPL. - */ -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include <string.h> - -#include <glib.h> - -#include <arpa/inet.h> -#include <ifaddrs.h> - -#include "local.h" - -NICEAPI_EXPORT NiceInterface * -nice_interface_new () -{ - return g_slice_new0 (NiceInterface); -} - -NICEAPI_EXPORT void -nice_interface_free (NiceInterface *iface) -{ - g_slice_free (NiceInterface, iface); -} - -NICEAPI_EXPORT GSList * -nice_list_local_interfaces () -{ - GSList *ret = NULL; - struct ifaddrs *ifs; - struct ifaddrs *i; - - getifaddrs (&ifs); - - for (i = ifs; i; i = i->ifa_next) - { - const struct sockaddr *addr; - - addr = (struct sockaddr *) i->ifa_addr; - if (addr == NULL) - continue; /* interface with no address */ - - if (addr->sa_family == AF_INET || addr->sa_family == AF_INET6) - { - NiceInterface *iface; - - iface = nice_interface_new (); - strncpy (iface->name, i->ifa_name, sizeof (iface->name)); - iface->name[sizeof (iface->name) - 1] = '\0'; - nice_address_set_from_sockaddr (&(iface->addr), addr); - ret = g_slist_append (ret, iface); - } - } - - freeifaddrs (ifs); - return ret; -} - diff --git a/local/local.h b/local/local.h deleted file mode 100644 index 8becd05..0000000 --- a/local/local.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * This file is part of the Nice GLib ICE library. - * - * (C) 2006, 2007 Collabora Ltd. - * Contact: Dafydd Harries - * (C) 2006, 2007 Nokia Corporation. All rights reserved. - * Contact: Kai Vehmanen - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is the Nice GLib ICE library. - * - * The Initial Developers of the Original Code are Collabora Ltd and Nokia - * Corporation. All Rights Reserved. - * - * Contributors: - * Dafydd Harries, Collabora Ltd. - * - * Alternatively, the contents of this file may be used under the terms of the - * the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which - * case the provisions of LGPL are applicable instead of those above. If you - * wish to allow use of your version of this file only under the terms of the - * LGPL and not to allow others to use your version of this file under the - * MPL, indicate your decision by deleting the provisions above and replace - * them with the notice and other provisions required by the LGPL. If you do - * not delete the provisions above, a recipient may use your version of this - * file under either the MPL or the LGPL. - */ - -#ifndef _LOCAL_H -#define _LOCAL_H - -#include <glib.h> - -#include "address.h" - -G_BEGIN_DECLS - -typedef struct _NiceInterface NiceInterface; - -struct _NiceInterface -{ - gchar name[16]; - NiceAddress addr; -}; - -NiceInterface * -nice_interface_new (void); - -void -nice_interface_free (NiceInterface *iface); - -GSList * -nice_list_local_interfaces (void); - -G_END_DECLS - -#endif /* _LOCAL_H */ - |