summaryrefslogtreecommitdiff
path: root/vapi/libnl-3.0.vapi
diff options
context:
space:
mode:
authorMaciej Borzecki <maciej.borzecki@open-rnd.pl>2016-03-08 11:58:08 +0100
committerLuca Bruno <lucabru@src.gnome.org>2016-04-07 20:50:04 +0200
commit7e69f5120650233bf3e44a15ce7685c654c12f0f (patch)
tree0583970fb2953d8b86b2fdaf1a093ab60410135d /vapi/libnl-3.0.vapi
parente44d0eed484cdc197bed3b84c185655a13c03e43 (diff)
downloadvala-7e69f5120650233bf3e44a15ce7685c654c12f0f.tar.gz
libnl-3.0.vapi: extend VAPI
The patch extends VAPI of libnl-3.0 with cache manager (nl_cache_mngr_*), additional methods of LinkCache and a helper CachedLink type. The CachedLink type is a wrapper for the Link object, however since the object is obtained from cache, rtnl_link_put() must be used a free function. Signed-off-by: Maciej Borzecki <maciek.borzecki@gmail.com> Signed-off-by: Maciej Borzecki <maciej.borzecki@open-rnd.pl> Fixes bug 763303
Diffstat (limited to 'vapi/libnl-3.0.vapi')
-rw-r--r--vapi/libnl-3.0.vapi39
1 files changed, 39 insertions, 0 deletions
diff --git a/vapi/libnl-3.0.vapi b/vapi/libnl-3.0.vapi
index 6998b2d48..b82df3912 100644
--- a/vapi/libnl-3.0.vapi
+++ b/vapi/libnl-3.0.vapi
@@ -153,6 +153,34 @@ namespace Netlink {
public void mngt_unprovide();
}
+ [CCode (cname = "int", cprefix = "NL_ACT_", has_type_id = false, cheader_filename = "netlink/cache.h")]
+ public enum CacheAction {
+ NEW,
+ DEL,
+ GET,
+ SET,
+ CHANGE,
+ }
+
+ [CCode (cname = "change_func_t", cheader_filename = "netlink/cache.h", instance_pos = -1)]
+ public delegate void ChangeCallbackFunc (Cache cache, Object obj, CacheAction act);
+
+ [Compact]
+ [CCode (cprefix = "nl_cache_mngr_", cname = "struct nl_cache_mngr", free_function = "nl_cache_mngr_free", cheader_filename = "netlink/cache.h")]
+ public class CacheManager {
+ public static int alloc (Socket? sk, int protocol, int flags, out CacheManager c);
+
+ public int add_cache(Cache cache, ChangeCallbackFunc cb);
+ public int add(string name, ChangeCallbackFunc cb, out unowned Cache cache);
+
+ public int get_fd();
+ public int poll(int timeout);
+
+ public int data_ready();
+ public void info(DumpParams params);
+ }
+
+
[Compact]
[CCode (cprefix = "nl_cb_", cname = "struct nl_cb", free_function = "", cheader_filename = "netlink/netlink.h")]
public class Callback {
@@ -201,6 +229,10 @@ namespace Netlink {
public int name2i (string name);
[CCode (cname = "rtnl_link_i2name")]
public unowned string i2name( int idx, char[] buffer );
+ [CCode (cname = "rtnl_link_get")]
+ public CachedLink? get(int idx);
+ [CCode (cname = "rtnl_link_get_by_name")]
+ public CachedLink? get_by_name(string idx);
}
[Compact]
@@ -360,6 +392,13 @@ namespace Netlink {
}
[Compact]
+ [CCode (cprefix = "rtnl_link_", cname = "struct rtnl_link", free_function = "rtnl_link_put", cheader_filename = "netlink/route/link.h")]
+ public class CachedLink : Link
+ {
+ }
+
+
+ [Compact]
[CCode (cprefix = "rtnl_route_", cname = "struct rtnl_route", cheader_filename = "netlink/route/route.h")]
public class Route
{