summaryrefslogtreecommitdiff
path: root/lib/frrlua.c
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2019-05-11 01:51:19 +0000
committerQuentin Young <qlyoung@nvidia.com>2020-12-01 18:37:14 -0500
commitcd6ca660c5e96f14f50b6a2f4f6f5cd83cb70d13 (patch)
treec837d370f0ff2b019c22e430f8f37ac3ca7d7496 /lib/frrlua.c
parent3174525d03d0ba74455a683851ac6487cc811c6a (diff)
lib: add interface -> table encoder
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/frrlua.c')
-rw-r--r--lib/frrlua.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/frrlua.c b/lib/frrlua.c
index 0c6d607b7a..8107102eed 100644
--- a/lib/frrlua.c
+++ b/lib/frrlua.c
@@ -97,6 +97,36 @@ void frrlua_newtable_prefix(lua_State *L, const struct prefix *prefix)
lua_setglobal(L, "prefix");
}
+void frrlua_newtable_interface(lua_State *L, const struct interface *ifp)
+{
+ zlog_debug("frrlua: pushing interface table");
+
+ lua_newtable(L);
+ lua_pushstring(L, ifp->name);
+ lua_setfield(L, -2, "name");
+ lua_pushinteger(L, ifp->ifindex);
+ lua_setfield(L, -2, "ifindex");
+ lua_pushinteger(L, ifp->status);
+ lua_setfield(L, -2, "status");
+ lua_pushinteger(L, ifp->flags);
+ lua_setfield(L, -2, "flags");
+ lua_pushinteger(L, ifp->metric);
+ lua_setfield(L, -2, "metric");
+ lua_pushinteger(L, ifp->speed);
+ lua_setfield(L, -2, "speed");
+ lua_pushinteger(L, ifp->mtu);
+ lua_setfield(L, -2, "mtu");
+ lua_pushinteger(L, ifp->mtu6);
+ lua_setfield(L, -2, "mtu6");
+ lua_pushinteger(L, ifp->bandwidth);
+ lua_setfield(L, -2, "bandwidth");
+ lua_pushinteger(L, ifp->link_ifindex);
+ lua_setfield(L, -2, "link_ifindex");
+ lua_pushinteger(L, ifp->ll_type);
+ lua_setfield(L, -2, "linklayer_type");
+}
+
+
/*
* Experimental.
*