Home | History | Annotate | Download | only in lib

Lines Matching refs:ofd

755 ofd, int prefix)
760 fprintf(ofd, " ");
763 static inline void dump_hex(FILE *ofd, char *start, int len, int prefix)
769 prefix_line(ofd, prefix);
770 fprintf(ofd, " ");
775 fprintf(ofd, "%02x ", v);
779 fprintf(ofd, "%s\n", ascii);
781 prefix_line(ofd, prefix);
782 fprintf(ofd, " ");
791 fprintf(ofd, " ");
792 fprintf(ofd, "%s\n", ascii);
796 static void print_hdr(FILE *ofd, struct nl_msg *msg)
803 fprintf(ofd, " .nlmsg_len = %d\n", nlh->nlmsg_len);
816 fprintf(ofd, " .type = %d <%s>\n", nlh->nlmsg_type, buf);
817 fprintf(ofd, " .flags = %d <%s>\n", nlh->nlmsg_flags,
819 fprintf(ofd, " .seq = %d\n", nlh->nlmsg_seq);
820 fprintf(ofd, " .port = %d\n", nlh->nlmsg_pid);
824 static void print_genl_hdr(FILE *ofd, void *start)
828 fprintf(ofd, " [GENERIC NETLINK HEADER] %zu octets\n", GENL_HDRLEN);
829 fprintf(ofd, " .cmd = %u\n", ghdr->cmd);
830 fprintf(ofd, " .version = %u\n", ghdr->version);
831 fprintf(ofd, " .unused = %#x\n", ghdr->reserved);
834 static void *print_genl_msg(struct nl_msg *msg, FILE *ofd, struct nlmsghdr *hdr,
842 print_genl_hdr(ofd, data);
854 fprintf(ofd, " [HEADER] %d octets\n", hdrsize);
855 dump_hex(ofd, data, hdrsize, 0);
865 static void dump_attr(FILE *ofd, struct nlattr *attr, int prefix)
869 dump_hex(ofd, nla_data(attr), len, prefix);
872 static void dump_attrs(FILE *ofd, struct nlattr *attrs, int attrlen,
881 prefix_line(ofd, prefix);
884 fprintf(ofd, " [ATTR PADDING] %d octets\n", alen);
886 fprintf(ofd, " [ATTR %02d%s] %d octets\n", nla_type(nla),
891 dump_attrs(ofd, nla_data(nla), alen, prefix+1);
893 dump_attr(ofd, nla, prefix);
897 prefix_line(ofd, prefix);
898 fprintf(ofd, " [PADDING] %d octets\n",
900 dump_hex(ofd, nla_data(nla) + alen,
906 prefix_line(ofd, prefix);
907 fprintf(ofd, " [LEFTOVER] %d octets\n", rem);
911 static void dump_error_msg(struct nl_msg *msg, FILE *ofd)
916 fprintf(ofd, " [ERRORMSG] %zu octets\n", sizeof(*err));
922 fprintf(ofd, " .error = %d \"%s\"\n", err->error,
924 fprintf(ofd, " [ORIGINAL MESSAGE] %zu octets\n", sizeof(*hdr));
927 print_hdr(ofd, errmsg);
932 static void print_msg(struct nl_msg *msg, FILE *ofd, struct nlmsghdr *hdr)
948 data = print_genl_msg(msg, ofd, hdr, ops, &payloadlen);
951 fprintf(ofd, " [PAYLOAD] %d octets\n", payloadlen);
952 dump_hex(ofd, data, payloadlen, 0);
961 dump_attrs(ofd, attrs, attrlen, 0);
971 * @arg ofd File descriptor.
973 void nl_msg_dump(struct nl_msg *msg, FILE *ofd)
977 fprintf(ofd,
980 fprintf(ofd, " [NETLINK HEADER] %zu octets\n", sizeof(struct nlmsghdr));
981 print_hdr(ofd, msg);
984 dump_error_msg(msg, ofd);
986 print_msg(msg, ofd, hdr);
988 fprintf(ofd,