[vala] libnl fixes
- From: Michael Lauer <mlauer src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [vala] libnl fixes
- Date: Mon, 9 Nov 2009 21:02:40 +0000 (UTC)
commit 676a75be7156ee748832d6421198c4579e406d72
Author: Michael 'Mickey' Lauer <mickey vanille-media de>
Date: Mon Nov 9 21:50:57 2009 +0100
libnl fixes
bind libnl-2.0 and fix libnl-1 to compile with the old version of libnl,
libnl-1 was actually developed against libnl-2.0, which is fixed with this commit.
vapi/Makefile.am | 1 +
vapi/libnl-1.vapi | 11 +++--
vapi/libnl-2.0.vapi | 124 +++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 131 insertions(+), 5 deletions(-)
---
diff --git a/vapi/Makefile.am b/vapi/Makefile.am
index e9587b6..b962465 100644
--- a/vapi/Makefile.am
+++ b/vapi/Makefile.am
@@ -113,6 +113,7 @@ dist_vapi_DATA = \
libgsf-1.vapi \
libmagic.vapi \
libnl-1.vapi \
+ libnl-2.0.vapi \
libnotify.deps \
libnotify.vapi \
liboobs-1.vapi \
diff --git a/vapi/libnl-1.vapi b/vapi/libnl-1.vapi
index 5e39f62..45c970a 100644
--- a/vapi/libnl-1.vapi
+++ b/vapi/libnl-1.vapi
@@ -21,7 +21,8 @@
[CCode (lower_case_cprefix = "nl_", cheader_filename = "netlink/netlink.h")]
namespace Netlink {
- public delegate void Callback (Object obj, void* data);
+ [CCode (cname = "callback_func_t", instance_pos = 1)]
+ public delegate void Callback (Object obj);
[Compact]
[CCode (cprefix = "nl_addr_", cname = "struct nl_addr", free_function = "", cheader_filename = "netlink/addr.h")]
@@ -95,15 +96,15 @@ namespace Netlink {
}
[Compact]
- [CCode (cprefix = "nl_socket_", cname = "struct nl_socket", free_function = "nl_socket_free")]
+ [CCode (cname = "struct nl_handle", free_function = "nl_handle_destroy")]
public class Socket {
- [CCode (cname = "nl_socket_alloc")]
+ [CCode (cname = "nl_handle_alloc")]
public Socket();
[CCode (cname = "rtnl_link_alloc_cache")]
- public int link_alloc_cache (out LinkCache c);
+ public LinkCache link_alloc_cache ();
[CCode (cname = "rtnl_addr_alloc_cache")]
- public int addr_alloc_cache (out AddrCache c);
+ public AddrCache addr_alloc_cache ();
[CCode (cname = "nl_connect")]
public int connect (int family);
diff --git a/vapi/libnl-2.0.vapi b/vapi/libnl-2.0.vapi
new file mode 100644
index 0000000..0537240
--- /dev/null
+++ b/vapi/libnl-2.0.vapi
@@ -0,0 +1,124 @@
+/* libnl-2.0.vapi
+ *
+ * Copyright (C) 2009 Michael 'Mickey' Lauer <mlauer vanille-media de>
+ *
+ * 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
+ *
+ */
+
+[CCode (lower_case_cprefix = "nl_", cheader_filename = "netlink/netlink.h")]
+namespace Netlink {
+
+ [CCode (instance_pos = -1)]
+ public delegate void Callback (Object obj);
+
+ [Compact]
+ [CCode (cprefix = "nl_addr_", cname = "struct nl_addr", free_function = "", cheader_filename = "netlink/addr.h")]
+ public class Address : Object {
+ [CCode (cname = "nl_addr_alloc")]
+ public Address();
+
+ public void put();
+ public int build_add_request (int a, out Message m);
+ public int build_delete_request (int a, out Message m);
+
+ public int set_label (string label);
+ public string get_label ();
+
+ public void set_family (int family);
+ public int get_family ();
+
+ public int get_len ();
+
+ public void set_prefixlen (int len);
+ public int get_prefixlen ();
+
+ public void set_flags (uint flags);
+ public void unset_flags (uint flags);
+ public uint get_flags ();
+
+ public void* get_binary_addr();
+
+ [CCode (cname = "nl_addr2str")]
+ public weak string to_stringbuf(char[] buf);
+
+ public string to_string() {
+ char[] buf = new char[256];
+ return to_stringbuf( buf );
+ }
+ }
+
+ [Compact]
+ [CCode (cprefix = "rtnl_addr_", cname = "struct rtnl_addr", free_function = "", cheader_filename = "netlink/route/addr.h")]
+ public class RouteAddress : Address {
+ [CCode (cname = "rtnl_addr_alloc")]
+ public RouteAddress();
+
+ public void set_ifindex (int index );
+ public int get_ifindex ();
+
+ public void set_scope (int scope);
+ public int get_scope ();
+
+ public weak Address get_local();
+ }
+
+ [Compact]
+ [CCode (cprefix = "nl_cache_", cname = "struct nl_cache", free_function = "nl_cache_free", cheader_filename = "netlink/cache.h")]
+ public class Cache {
+ public static int alloc_name (string name, out Cache c);
+
+ public void @foreach (Callback cb);
+ public void foreach_filter (Object obj, Callback cb);
+ }
+
+ [Compact]
+ [CCode (cprefix = "nl_link_cache_", cname = "struct nl_cache", free_function = "nl_cache_free", cheader_filename = "netlink/cache.h")]
+ public class LinkCache : Cache {
+ [CCode (cname = "rtnl_link_name2i")]
+ public int name2i (string name);
+ }
+
+ [Compact]
+ [CCode (cprefix = "nl_addr_cache", cname = "struct nl_cache", free_function = "nl_cache_free", cheader_filename = "netlink/cache.h")]
+ public class AddrCache : Cache {
+ }
+
+ [Compact]
+ [CCode (cname = "struct nl_msg", free_function = "nl_msg_free", cheader_filename = "netlink/msg.h")]
+ public class Message {
+ }
+
+ [Compact]
+ [CCode (cprefix = "nl_socket_", cname = "struct nl_sock", free_function = "nl_socket_free")]
+ public class Socket {
+ [CCode (cname = "nl_socket_alloc")]
+ public Socket();
+
+ [CCode (cname = "rtnl_link_alloc_cache")]
+ public int link_alloc_cache (out LinkCache c);
+ [CCode (cname = "rtnl_addr_alloc_cache")]
+ public int addr_alloc_cache (out AddrCache c);
+
+ [CCode (cname = "nl_connect")]
+ public int connect (int family);
+ }
+
+ [Compact]
+ [CCode (cname = "struct nl_object", free_function = "nl_object_free", cheader_filename = "netlink/object.h")]
+ public class Object {
+ }
+
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]