00001 #include <netlink/handlers.h> 00002 00003 /* Allocate a callback set and initialize it to the verbose default set */ 00004 struct nl_cb *cb = nl_cb_alloc(NL_CB_VERBOSE); 00005 00006 /* Modify the set to call my_func() for all valid messages */ 00007 nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, my_func, NULL); 00008 00009 /* 00010 * Set the error message handler to the verbose default implementation 00011 * and direct it to print all errors to the given file descriptor. 00012 */ 00013 FILE *file = fopen(...); 00014 nl_cb_err(cb, NL_CB_VERBOSE, NULL, file);