#include struct nlmsghdr *hdr; nlmsg_for_each(hdr, stream, length) { /* do something with message */ }