chiark / gitweb /
sd-netlink: make NLTypeSystem internal
[elogind.git] / src / libsystemd / sd-netlink / netlink-types.c
index fe9e5f9826dc5e99688ed4cf37c673666014edc0..70dbd4f8dcc8aaf043a87b50be71d234f2669d1c 100644 (file)
 #include "netlink-types.h"
 #include "missing.h"
 
+struct NLType {
+        uint16_t type;
+        size_t size;
+        const NLTypeSystem *type_system;
+        const NLTypeSystemUnion *type_system_union;
+};
+
+struct NLTypeSystem {
+        uint16_t max;
+        const NLType *types;
+};
+
 static const NLTypeSystem rtnl_link_type_system;
 
 static const NLType rtnl_link_info_data_veth_types[VETH_INFO_MAX + 1] = {
@@ -460,6 +472,16 @@ const NLTypeSystem rtnl_type_system = {
         .types = rtnl_types,
 };
 
+uint16_t type_get_type(const NLType *type) {
+        assert(type);
+        return type->type;
+}
+
+size_t type_get_size(const NLType *type) {
+        assert(type);
+        return type->size;
+}
+
 void type_get_type_system(const NLType *nl_type, const NLTypeSystem **ret) {
         assert(nl_type);
         assert(ret);
@@ -478,6 +500,11 @@ void type_get_type_system_union(const NLType *nl_type, const NLTypeSystemUnion *
         *ret = nl_type->type_system_union;
 }
 
+uint16_t type_system_get_max(const NLTypeSystem *type_system) {
+        assert(type_system);
+        return type_system->max;
+}
+
 int type_system_get_type(const NLTypeSystem *type_system, const NLType **ret, uint16_t type) {
         const NLType *nl_type;