3 * Copyright (C) 2009-2015 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 [CCode (cname = "callback_func_t", instance_pos = 1)]
25 public delegate void Callback (Object obj);
28 [CCode (cprefix = "nl_addr_", cname = "struct nl_addr", free_function = "", cheader_filename = "netlink/addr.h")]
29 public class Address : Object {
30 [CCode (cname = "nl_addr_alloc")]
34 public int build_add_request (int a, out Message m);
35 public int build_delete_request (int a, out Message m);
37 public int set_label (string label);
38 public unowned string get_label ();
40 public void set_family (int family);
41 public int get_family ();
43 public void set_prefixlen (int len);
44 public int get_prefixlen ();
46 public void set_scope (int scope);
47 public int get_scope ();
49 public void set_flags (uint flags);
50 public void unset_flags (uint flags);
51 public uint get_flags ();
53 public void* get_binary_addr();
55 [CCode (cname = "nl_addr2str")]
56 public string to_string (char[] buf);
61 [CCode (cprefix = "rtnl_addr_", cname = "struct rtnl_addr", free_function = "", cheader_filename = "netlink/route/addr.h")]
62 public class RouteAddress : Address {
63 [CCode (cname = "rtnl_addr_alloc")]
64 public RouteAddress();
66 public void set_ifindex (int index );
67 public int get_ifindex ();
69 public unowned RouteAddress get_local();
73 [CCode (cprefix = "nl_cache_", cname = "struct nl_cache", free_function = "nl_cache_free", cheader_filename = "netlink/cache.h")]
75 public static int alloc_name (string name, out Cache c);
77 public void @foreach (Callback cb);
78 public void foreach_filter (Object obj, Callback cb);
82 [CCode (cprefix = "nl_link_cache_", cname = "struct nl_cache", free_function = "nl_cache_free", cheader_filename = "netlink/cache.h")]
83 public class LinkCache : Cache {
84 [CCode (cname = "rtnl_link_name2i")]
85 public int name2i (string name);
89 [CCode (cprefix = "nl_addr_cache", cname = "struct nl_cache", free_function = "nl_cache_free", cheader_filename = "netlink/cache.h")]
90 public class AddrCache : Cache {
94 [CCode (cname = "struct nl_msg", free_function = "nl_msg_free", cheader_filename = "netlink/msg.h")]
95 public class Message {
99 [CCode (cname = "struct nl_handle", free_function = "nl_handle_destroy")]
100 public class Socket {
101 [CCode (cname = "nl_handle_alloc")]
104 [CCode (cname = "rtnl_link_alloc_cache")]
105 public LinkCache link_alloc_cache ();
106 [CCode (cname = "rtnl_addr_alloc_cache")]
107 public AddrCache addr_alloc_cache ();
109 [CCode (cname = "nl_connect")]
110 public int connect (int family);
114 [CCode (cname = "struct nl_object", free_function = "nl_object_free", cheader_filename = "netlink/object.h")]
115 public class Object {