How to cast a struct nl_object

Joerg Pommnitz pommnitz at yahoo.com
Thu Mar 17 07:37:54 EDT 2011


Hello all,
I'm somewhat at a loss regarding something that should be simple enough:
figuring out the actual type of a struct nl_object instance and casting
it to the actual type.
Unfortunately I could not figure out (so far) how to do this cleanly. There
seems to be no official way to access the NLHDR_COMMON fields.

So: If I have a freshly parsed struct nl_object instance, how do I actually
use it and get the information inside without resorting to hacks?

Just in case: Here is what I'm trying to do:
I'm subscribed to the RTNLGRP_IPV4_IFADDR group and receiving messages. I pass
the messages up to nl_msg_parse with my own callback function to actually handle
the parsed message. This is where I'm stuck: The callback function gets a 
struct nl_object instance. I'd like to access the information inside it.

 -- 
Regards 
Joerg 





More information about the libnl mailing list