diff options
author | Susant Sahani <susant@redhat.com> | 2014-03-05 20:43:25 +0530 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2014-03-06 19:30:09 +0100 |
commit | 44caa5e7dfa2160f7d644d003de2718fd3ca2ee6 (patch) | |
tree | ab15cf6cb67b356b2871cccae7b5b5fbcb27737d /src/libsystemd/sd-rtnl/rtnl-internal.h | |
parent | 6d26dfe11c853d612b84abe858520bbcb62c2e96 (diff) |
sd-rtnl:introduce table-based lookup and typesafe read() functions
This patch introduces new netlink attribute parsing logic
which is table based lookup and sd_rtnl_message_read_*
methods for reading attributes. By doing this user does not
have to loop for the attribute values . Only providing the
attribute type it gets the attribute values which is optimized
and sd_rtnl_message_read_* methods are simplified.
Diffstat (limited to 'src/libsystemd/sd-rtnl/rtnl-internal.h')
-rw-r--r-- | src/libsystemd/sd-rtnl/rtnl-internal.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/libsystemd/sd-rtnl/rtnl-internal.h b/src/libsystemd/sd-rtnl/rtnl-internal.h index 0667be5838..0c17d94c59 100644 --- a/src/libsystemd/sd-rtnl/rtnl-internal.h +++ b/src/libsystemd/sd-rtnl/rtnl-internal.h @@ -94,7 +94,8 @@ struct sd_rtnl_message { size_t container_offsets[RTNL_CONTAINER_DEPTH]; /* offset from hdr to each container's start */ unsigned n_containers; /* number of containers */ size_t next_rta_offset; /* offset from hdr to next rta */ - + size_t *rta_offset_tb; + unsigned short rta_tb_size; bool sealed:1; }; @@ -103,6 +104,14 @@ int message_new(sd_rtnl *rtnl, sd_rtnl_message **ret, size_t initial_size); int socket_write_message(sd_rtnl *nl, sd_rtnl_message *m); int socket_read_message(sd_rtnl *nl, sd_rtnl_message **ret); +int rtnl_message_read_internal(sd_rtnl_message *m, unsigned short type, void **data); +int rtnl_message_parse(sd_rtnl_message *m, + size_t **rta_offset_tb, + unsigned short *rta_tb_size, + int max, + struct rtattr *rta, + unsigned int rt_len); + /* Make sure callbacks don't destroy the rtnl connection */ #define RTNL_DONT_DESTROY(rtnl) \ _cleanup_rtnl_unref_ _unused_ sd_rtnl *_dont_destroy_##rtnl = sd_rtnl_ref(rtnl) |