diff options
author | Anders Broman <anders.broman@ericsson.com> | 2012-04-25 14:01:15 +0000 |
---|---|---|
committer | Anders Broman <anders.broman@ericsson.com> | 2012-04-25 14:01:15 +0000 |
commit | f696fb7bde8606f7f8fd0cb945ce32343d09e5c2 (patch) | |
tree | 47c90a0d1767d36a17fc0099e66c5843ad28cc89 /mergecap.c | |
parent | 71780ae95231f21524e339c053210f7ef405b71d (diff) |
Add some info in SHB if writing a pcap-ng file.
svn path=/trunk/; revision=42232
Diffstat (limited to 'mergecap.c')
-rw-r--r-- | mergecap.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/mergecap.c b/mergecap.c index db3873ef86..72b22f32d5 100644 --- a/mergecap.c +++ b/mergecap.c @@ -387,7 +387,30 @@ main(int argc, char *argv[]) } /* prepare the outfile */ - pdh = wtap_dump_fdopen(out_fd, file_type, frame_type, snaplen, FALSE /* compressed */, &open_err); + if(file_type == WTAP_FILE_PCAPNG ){ + wtapng_section_t *shb_hdr; + GString *comment_gstr; + int i; + + shb_hdr = g_new(wtapng_section_t,1); + comment_gstr = g_string_new("File created my merging: \n"); + + for (i = 0; i < in_file_count; i++) { + g_string_append_printf(comment_gstr, "File%u: %s \n",i+1,in_files[i]); + } + shb_hdr->section_length = -1; + /* options */ + shb_hdr->opt_comment = comment_gstr->str; /* NULL if not available */ + shb_hdr->shb_hardware = NULL; /* NULL if not available, UTF-8 string containing the description of the hardware used to create this section. */ + shb_hdr->shb_os = NULL; /* NULL if not available, UTF-8 string containing the name of the operating system used to create this section. */ + shb_hdr->shb_user_appl = "mergecap"; /* NULL if not available, UTF-8 string containing the name of the application used to create this section. */ + + pdh = wtap_dump_fdopen_ng(out_fd, file_type, frame_type, snaplen, + FALSE /* compressed */, shb_hdr, NULL /* wtapng_iface_descriptions_t *idb_inf */, &open_err); + g_string_free(comment_gstr, TRUE); + }else{ + pdh = wtap_dump_fdopen(out_fd, file_type, frame_type, snaplen, FALSE /* compressed */, &open_err); + } if (pdh == NULL) { merge_close_in_files(in_file_count, in_files); g_free(in_files); |