3 * Copyright (C) 2009 Michael 'Mickey' Lauer <mlauer@vanille-media.de>
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.1 of the License, or (at your option) any later version.
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.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 [CCode (lower_case_cprefix = "nl_", cheader_filename = "netlink/netlink.h")]
24 public delegate void Callback (Object obj, void* data);
27 [CCode (cprefix = "nl_addr_", cname = "struct nl_addr", free_function = "", cheader_filename = "netlink/addr.h")]
28 public class Address : Object {
29 [CCode (cname = "nl_addr_alloc")]
33 public int build_add_request (int a, out Message m);
34 public int build_delete_request (int a, out Message m);
36 public int set_label (string label);
37 public string get_label ();
39 public void set_family (int family);
40 public int get_family ();
42 public void set_prefixlen (int len);
43 public int get_prefixlen ();
45 public void set_scope (int scope);
46 public int get_scope ();
48 public void set_flags (uint flags);
49 public void unset_flags (uint flags);
50 public uint get_flags ();
52 public void* get_binary_addr();
54 [CCode (cname = "nl_addr2str")]
55 public string to_string (char[] buf);
60 [CCode (cprefix = "rtnl_addr_", cname = "struct rtnl_addr", free_function = "", cheader_filename = "netlink/route/addr.h")]
61 public class RouteAddress : Address {
62 [CCode (cname = "rtnl_addr_alloc")]
63 public RouteAddress();
65 public void set_ifindex (int index );
66 public int get_ifindex ();
68 public weak RouteAddress get_local();
72 [CCode (cprefix = "nl_cache_", cname = "struct nl_cache", free_function = "nl_cache_free", cheader_filename = "netlink/cache.h")]
74 public static int alloc_name (string name, out Cache c);
76 public void @foreach (Callback cb);
77 public void foreach_filter (Object obj, Callback cb);
81 [CCode (cprefix = "nl_link_cache_", cname = "struct nl_cache", free_function = "nl_cache_free", cheader_filename = "netlink/cache.h")]
82 public class LinkCache : Cache {
83 [CCode (cname = "rtnl_link_name2i")]
84 public int name2i (string name);
88 [CCode (cprefix = "nl_addr_cache", cname = "struct nl_cache", free_function = "nl_cache_free", cheader_filename = "netlink/cache.h")]
89 public class AddrCache : Cache {
93 [CCode (cname = "struct nl_msg", free_function = "nl_msg_free", cheader_filename = "netlink/msg.h")]
94 public class Message {
98 [CCode (cprefix = "nl_socket_", cname = "struct nl_socket", free_function = "nl_socket_free")]
100 [CCode (cname = "nl_socket_alloc")]
103 [CCode (cname = "rtnl_link_alloc_cache")]
104 public int link_alloc_cache (out LinkCache c);
105 [CCode (cname = "rtnl_addr_alloc_cache")]
106 public int addr_alloc_cache (out AddrCache c);
108 [CCode (cname = "nl_connect")]
109 public int connect (int family);
113 [CCode (cname = "struct nl_object", free_function = "nl_object_free", cheader_filename = "netlink/object.h")]
114 public class Object {