Lines Matching refs:ofd
856 static void prefix_line(FILE *ofd, int prefix) in prefix_line() argument
861 fprintf(ofd, " "); in prefix_line()
864 static inline void dump_hex(FILE *ofd, char *start, int len, int prefix) in dump_hex() argument
870 prefix_line(ofd, prefix); in dump_hex()
871 fprintf(ofd, " "); in dump_hex()
876 fprintf(ofd, "%02x ", v); in dump_hex()
880 fprintf(ofd, "%s\n", ascii); in dump_hex()
882 prefix_line(ofd, prefix); in dump_hex()
883 fprintf(ofd, " "); in dump_hex()
893 fprintf(ofd, " "); in dump_hex()
894 fprintf(ofd, "%s\n", ascii); in dump_hex()
898 static void print_hdr(FILE *ofd, struct nl_msg *msg) in print_hdr() argument
905 fprintf(ofd, " .nlmsg_len = %d\n", nlh->nlmsg_len); in print_hdr()
917 fprintf(ofd, " .nlmsg_type = %d <%s>\n", nlh->nlmsg_type, buf); in print_hdr()
918 fprintf(ofd, " .nlmsg_flags = %d <%s>\n", nlh->nlmsg_flags, in print_hdr()
920 fprintf(ofd, " .nlmsg_seq = %d\n", nlh->nlmsg_seq); in print_hdr()
921 fprintf(ofd, " .nlmsg_pid = %d\n", nlh->nlmsg_pid); in print_hdr()
925 static void dump_attrs(FILE *ofd, struct nlattr *attrs, int attrlen, in dump_attrs() argument
934 prefix_line(ofd, prefix); in dump_attrs()
935 fprintf(ofd, " [ATTR %02d%s] %d octets\n", nla_type(nla), in dump_attrs()
940 dump_attrs(ofd, nla_data(nla), alen, prefix+1); in dump_attrs()
942 dump_hex(ofd, nla_data(nla), alen, prefix); in dump_attrs()
946 prefix_line(ofd, prefix); in dump_attrs()
947 fprintf(ofd, " [PADDING] %d octets\n", in dump_attrs()
949 dump_hex(ofd, nla_data(nla) + alen, in dump_attrs()
955 prefix_line(ofd, prefix); in dump_attrs()
956 fprintf(ofd, " [LEFTOVER] %d octets\n", rem); in dump_attrs()
965 void nl_msg_dump(struct nl_msg *msg, FILE *ofd) in nl_msg_dump() argument
969 fprintf(ofd, in nl_msg_dump()
973 fprintf(ofd, " [HEADER] %Zu octets\n", sizeof(struct nlmsghdr)); in nl_msg_dump()
974 print_hdr(ofd, msg); in nl_msg_dump()
981 fprintf(ofd, " [ERRORMSG] %Zu octets\n", sizeof(*err)); in nl_msg_dump()
982 fprintf(ofd, " .error = %d \"%s\"\n", err->error, in nl_msg_dump()
984 fprintf(ofd, " [ORIGINAL MESSAGE] %Zu octets\n", sizeof(*hdr)); in nl_msg_dump()
987 print_hdr(ofd, errmsg); in nl_msg_dump()
1001 fprintf(ofd, " [PAYLOAD] %d octets\n", payloadlen); in nl_msg_dump()
1002 dump_hex(ofd, nlmsg_data(hdr), payloadlen, 0); in nl_msg_dump()
1010 dump_attrs(ofd, attrs, attrlen, 0); in nl_msg_dump()
1014 fprintf(ofd, in nl_msg_dump()