diff --git a/editcap.c b/editcap.c index 175dca693f4..97d907d0269 100644 --- a/editcap.c +++ b/editcap.c @@ -1640,7 +1640,7 @@ main(int argc, char *argv[]) /* Warn for badly formatted files, but proceed anyway. */ validate_secrets_file(secrets_filename, secrets_type_id, data); - block = wtap_block_create(WTAP_BLOCK_DSB); + block = wtap_block_create(WTAP_BLOCK_DECRYPTION_SECRETS); dsb = (wtapng_dsb_mandatory_t *)wtap_block_get_mandatory_data(block); dsb->secrets_type = secrets_type_id; dsb->secrets_len = (guint)data_len; diff --git a/extcap/etl.c b/extcap/etl.c index 5e5fb39322d..1ebca96a3b1 100644 --- a/extcap/etl.c +++ b/extcap/etl.c @@ -171,13 +171,13 @@ wtap_dumper* etw_dump_open(const char* pcapng_filename, int* err, gchar** err_in wtap_dumper* pdh = NULL; shb_hdrs = g_array_new(FALSE, FALSE, sizeof(wtap_block_t)); - shb_hdr = wtap_block_create(WTAP_BLOCK_NG_SECTION); + shb_hdr = wtap_block_create(WTAP_BLOCK_SECTION); g_array_append_val(shb_hdrs, shb_hdr); - /* In the future, may create multiple WTAP_BLOCK_IF_DESCR separately for IP packet */ + /* In the future, may create multiple WTAP_BLOCK_IF_DESCRIPTION separately for IP packet */ idb_info = g_new(wtapng_iface_descriptions_t, 1); idb_datas = g_array_new(FALSE, FALSE, sizeof(wtap_block_t)); - idb_data = wtap_block_create(WTAP_BLOCK_IF_DESCR); + idb_data = wtap_block_create(WTAP_BLOCK_IF_DESCRIPTION); descr_mand = (wtapng_if_descr_mandatory_t*)wtap_block_get_mandatory_data(idb_data); descr_mand->tsprecision = WTAP_TSPREC_USEC; descr_mand->wtap_encap = WTAP_ENCAP_ETW; diff --git a/ui/tap_export_pdu.c b/ui/tap_export_pdu.c index 0b54cdff5c4..ea96342fc90 100644 --- a/ui/tap_export_pdu.c +++ b/ui/tap_export_pdu.c @@ -100,7 +100,7 @@ exp_pdu_open(exp_pdu_t *exp_pdu_tap_data, int fd, const char *comment, int *err, os_info_str = g_string_new(""); get_os_version_info(os_info_str); - shb_hdr = wtap_block_create(WTAP_BLOCK_NG_SECTION); + shb_hdr = wtap_block_create(WTAP_BLOCK_SECTION); /* options */ wtap_block_add_string_option(shb_hdr, OPT_COMMENT, comment, strlen(comment)); @@ -126,7 +126,7 @@ exp_pdu_open(exp_pdu_t *exp_pdu_tap_data, int fd, const char *comment, int *err, exp_pdu_tap_data->idb_inf->interface_data = g_array_new(FALSE, FALSE, sizeof(wtap_block_t)); /* create the fake interface data */ - int_data = wtap_block_create(WTAP_BLOCK_IF_DESCR); + int_data = wtap_block_create(WTAP_BLOCK_IF_DESCRIPTION); int_data_mand = (wtapng_if_descr_mandatory_t*)wtap_block_get_mandatory_data(int_data); int_data_mand->wtap_encap = WTAP_ENCAP_WIRESHARK_UPPER_PDU; int_data_mand->time_units_per_second = 1000000000; /* default nanosecond resolution */ diff --git a/wiretap/erf.c b/wiretap/erf.c index 512a1144559..0d7245fc3e4 100644 --- a/wiretap/erf.c +++ b/wiretap/erf.c @@ -2451,7 +2451,7 @@ static int erf_populate_interface(erf_t *erf_priv, wtap *wth, union wtap_pseudo_ return if_map->interfaces[if_num].if_index; } - int_data = wtap_block_create(WTAP_BLOCK_IF_DESCR); + int_data = wtap_block_create(WTAP_BLOCK_IF_DESCRIPTION); int_data_mand = (wtapng_if_descr_mandatory_t*)wtap_block_get_mandatory_data(int_data); int_data_mand->wtap_encap = WTAP_ENCAP_ERF; diff --git a/wiretap/file_access.c b/wiretap/file_access.c index b8ca248e00a..bd0ff41f00c 100644 --- a/wiretap/file_access.c +++ b/wiretap/file_access.c @@ -877,7 +877,7 @@ wtap_open_offline(const char *filename, unsigned int type, int *err, char **err_ wth->priv = NULL; wth->wslua_data = NULL; wth->shb_hdrs = g_array_new(FALSE, FALSE, sizeof(wtap_block_t)); - shb = wtap_block_create(WTAP_BLOCK_NG_SECTION); + shb = wtap_block_create(WTAP_BLOCK_SECTION); if (shb) g_array_append_val(wth->shb_hdrs, shb); @@ -2349,7 +2349,7 @@ wtap_dump_init_dumper(int file_type_subtype, wtap_compression_type compression_t int snaplen; // XXX IDBs should be optional. - descr = wtap_block_create(WTAP_BLOCK_IF_DESCR); + descr = wtap_block_create(WTAP_BLOCK_IF_DESCRIPTION); descr_mand = (wtapng_if_descr_mandatory_t*)wtap_block_get_mandatory_data(descr); descr_mand->wtap_encap = params->encap; descr_mand->tsprecision = params->tsprec; diff --git a/wiretap/iptrace.c b/wiretap/iptrace.c index f652cd26931..1b471bc9bc7 100644 --- a/wiretap/iptrace.c +++ b/wiretap/iptrace.c @@ -329,7 +329,7 @@ iptrace_read_rec_1_0(wtap *wth, FILE_T fh, wtap_rec *rec, Buffer *buf, /* * Now make a new IDB and add it. */ - int_data = wtap_block_create(WTAP_BLOCK_IF_DESCR); + int_data = wtap_block_create(WTAP_BLOCK_IF_DESCRIPTION); int_data_mand = (wtapng_if_descr_mandatory_t *)wtap_block_get_mandatory_data(int_data); int_data_mand->wtap_encap = rec->rec_header.packet_header.pkt_encap; @@ -600,7 +600,7 @@ iptrace_read_rec_2_0(wtap *wth, FILE_T fh, wtap_rec *rec, Buffer *buf, /* * Now make a new IDB and add it. */ - int_data = wtap_block_create(WTAP_BLOCK_IF_DESCR); + int_data = wtap_block_create(WTAP_BLOCK_IF_DESCRIPTION); int_data_mand = (wtapng_if_descr_mandatory_t *)wtap_block_get_mandatory_data(int_data); int_data_mand->wtap_encap = rec->rec_header.packet_header.pkt_encap; diff --git a/wiretap/merge.c b/wiretap/merge.c index 632453bf5ff..2c18d27aeca 100644 --- a/wiretap/merge.c +++ b/wiretap/merge.c @@ -713,7 +713,7 @@ static guint add_idb_to_merged_file(wtapng_iface_descriptions_t *merged_idb_list, const wtap_block_t input_file_idb) { - wtap_block_t idb = wtap_block_create(WTAP_BLOCK_IF_DESCR); + wtap_block_t idb = wtap_block_create(WTAP_BLOCK_IF_DESCRIPTION); wtapng_if_descr_mandatory_t* idb_mand; g_assert(merged_idb_list != NULL); diff --git a/wiretap/pcapng.c b/wiretap/pcapng.c index d86e5c08450..0ff98643cb3 100644 --- a/wiretap/pcapng.c +++ b/wiretap/pcapng.c @@ -784,7 +784,7 @@ pcapng_read_section_header_block(FILE_T fh, pcapng_block_header_t *bh, section_info->version_major = version_major; section_info->version_minor = version_minor; - wblock->block = wtap_block_create(WTAP_BLOCK_NG_SECTION); + wblock->block = wtap_block_create(WTAP_BLOCK_SECTION); section_data = (wtapng_mandatory_section_t*)wtap_block_get_mandatory_data(wblock->block); /* 64bit section_length (currently unused) */ if (section_info->byte_swapped) { @@ -891,7 +891,7 @@ pcapng_read_if_descr_block(wtap *wth, FILE_T fh, pcapng_block_header_t *bh, } /* mandatory values */ - wblock->block = wtap_block_create(WTAP_BLOCK_IF_DESCR); + wblock->block = wtap_block_create(WTAP_BLOCK_IF_DESCRIPTION); if_descr_mand = (wtapng_if_descr_mandatory_t*)wtap_block_get_mandatory_data(wblock->block); if (section_info->byte_swapped) { link_type = GUINT16_SWAP_LE_BE(idb.linktype); @@ -1195,7 +1195,7 @@ pcapng_read_decryption_secrets_block(FILE_T fh, pcapng_block_header_t *bh, } /* mandatory values */ - wblock->block = wtap_block_create(WTAP_BLOCK_DSB); + wblock->block = wtap_block_create(WTAP_BLOCK_DECRYPTION_SECRETS); dsb_mand = (wtapng_dsb_mandatory_t *)wtap_block_get_mandatory_data(wblock->block); if (section_info->byte_swapped) { dsb_mand->secrets_type = GUINT32_SWAP_LE_BE(dsb.secrets_type); @@ -1905,7 +1905,7 @@ pcapng_read_name_resolution_block(FILE_T fh, pcapng_block_header_t *bh, /* Ensure we have a name resolution block */ if (wblock->block == NULL) { - wblock->block = wtap_block_create(WTAP_BLOCK_NG_NRB); + wblock->block = wtap_block_create(WTAP_BLOCK_NAME_RESOLUTION); } /* @@ -2181,7 +2181,7 @@ pcapng_read_interface_statistics_block(FILE_T fh, pcapng_block_header_t *bh, return FALSE; } - wblock->block = wtap_block_create(WTAP_BLOCK_IF_STATS); + wblock->block = wtap_block_create(WTAP_BLOCK_IF_STATISTICS); if_stats_mand = (wtapng_if_stats_mandatory_t*)wtap_block_get_mandatory_data(wblock->block); if (section_info->byte_swapped) { if_stats_mand->interface_id = GUINT32_SWAP_LE_BE(isb.interface_id); @@ -2712,7 +2712,7 @@ static void pcapng_process_idb(wtap *wth, section_info_t *section_info, wtapng_block_t *wblock) { - wtap_block_t int_data = wtap_block_create(WTAP_BLOCK_IF_DESCR); + wtap_block_t int_data = wtap_block_create(WTAP_BLOCK_IF_DESCRIPTION); interface_info_t iface_info; wtapng_if_descr_mandatory_t *if_descr_mand = (wtapng_if_descr_mandatory_t*)wtap_block_get_mandatory_data(int_data), *wblock_if_descr_mand = (wtapng_if_descr_mandatory_t*)wtap_block_get_mandatory_data(wblock->block); @@ -3037,7 +3037,7 @@ pcapng_read(wtap *wth, wtap_rec *rec, Buffer *buf, int *err, wtapng_if_descr_mand->interface_statistics = g_array_new(FALSE, FALSE, sizeof(wtap_block_t)); } - if_stats = wtap_block_create(WTAP_BLOCK_IF_STATS); + if_stats = wtap_block_create(WTAP_BLOCK_IF_STATISTICS); if_stats_mand = (wtapng_if_stats_mandatory_t*)wtap_block_get_mandatory_data(if_stats); if_stats_mand->interface_id = if_stats_mand_block->interface_id; if_stats_mand->ts_high = if_stats_mand_block->ts_high; @@ -4768,7 +4768,7 @@ static gboolean pcapng_add_idb(wtap_dumper *wdh, wtap_block_t idb, /* * Add a copy of this IDB to our array of IDBs. */ - idb_copy = wtap_block_create(WTAP_BLOCK_IF_DESCR); + idb_copy = wtap_block_create(WTAP_BLOCK_IF_DESCRIPTION); wtap_block_copy(idb_copy, idb); g_array_append_val(wdh->interface_data, idb_copy); diff --git a/wiretap/wtap.c b/wiretap/wtap.c index 88ca8d8093b..cac93c29782 100644 --- a/wiretap/wtap.c +++ b/wiretap/wtap.c @@ -216,7 +216,7 @@ wtap_add_generated_idb(wtap *wth) g_assert(wth->file_tsprec != WTAP_TSPREC_UNKNOWN && wth->file_tsprec != WTAP_TSPREC_PER_PACKET); - idb = wtap_block_create(WTAP_BLOCK_IF_DESCR); + idb = wtap_block_create(WTAP_BLOCK_IF_DESCRIPTION); if_descr_mand = (wtapng_if_descr_mandatory_t*)wtap_block_get_mandatory_data(idb); if_descr_mand->wtap_encap = wth->file_encap; diff --git a/wiretap/wtap_opttypes.c b/wiretap/wtap_opttypes.c index 595cb4f5148..b1f8ff097c0 100644 --- a/wiretap/wtap_opttypes.c +++ b/wiretap/wtap_opttypes.c @@ -1047,7 +1047,7 @@ static void dsb_copy_mand(wtap_block_t dest_block, wtap_block_t src_block) void wtap_opttypes_initialize(void) { static wtap_blocktype_t shb_block = { - WTAP_BLOCK_NG_SECTION, /* block_type */ + WTAP_BLOCK_SECTION, /* block_type */ "SHB", /* name */ "Section Header Block", /* description */ shb_create, /* create */ @@ -1075,7 +1075,7 @@ void wtap_opttypes_initialize(void) }; static wtap_blocktype_t idb_block = { - WTAP_BLOCK_IF_DESCR, /* block_type */ + WTAP_BLOCK_IF_DESCRIPTION, /* block_type */ "IDB", /* name */ "Interface Description Block", /* description */ idb_create, /* create */ @@ -1133,7 +1133,7 @@ void wtap_opttypes_initialize(void) }; static wtap_blocktype_t dsb_block = { - WTAP_BLOCK_DSB, + WTAP_BLOCK_DECRYPTION_SECRETS, "DSB", "Decryption Secrets Block", dsb_create, @@ -1143,13 +1143,13 @@ void wtap_opttypes_initialize(void) }; static wtap_blocktype_t nrb_block = { - WTAP_BLOCK_NG_NRB, /* block_type */ - "NRB", /* name */ - "Name Resolution Block", /* description */ - nrb_create, /* create */ - NULL, /* free_mand */ - NULL, /* copy_mand */ - NULL /* options */ + WTAP_BLOCK_NAME_RESOLUTION, /* block_type */ + "NRB", /* name */ + "Name Resolution Block", /* description */ + nrb_create, /* create */ + NULL, /* free_mand */ + NULL, /* copy_mand */ + NULL /* options */ }; static const wtap_opttype_t ns_dnsname = { "dnsname", @@ -1171,7 +1171,7 @@ void wtap_opttypes_initialize(void) }; static wtap_blocktype_t isb_block = { - WTAP_BLOCK_IF_STATS, /* block_type */ + WTAP_BLOCK_IF_STATISTICS, /* block_type */ "ISB", /* name */ "Interface Statistics Block", /* description */ isb_create, /* create */ @@ -1230,7 +1230,7 @@ void wtap_opttypes_initialize(void) /* * Register the SHB and the options that can appear in it. */ - wtap_opttype_block_register(WTAP_BLOCK_NG_SECTION, &shb_block); + wtap_opttype_block_register(WTAP_BLOCK_SECTION, &shb_block); wtap_opttype_option_register(&shb_block, OPT_SHB_HARDWARE, &shb_hardware); wtap_opttype_option_register(&shb_block, OPT_SHB_OS, &shb_os); wtap_opttype_option_register(&shb_block, OPT_SHB_USERAPPL, &shb_userappl); @@ -1238,7 +1238,7 @@ void wtap_opttypes_initialize(void) /* * Register the IDB and the options that can appear in it. */ - wtap_opttype_block_register(WTAP_BLOCK_IF_DESCR, &idb_block); + wtap_opttype_block_register(WTAP_BLOCK_IF_DESCRIPTION, &idb_block); wtap_opttype_option_register(&idb_block, OPT_IDB_NAME, &if_name); wtap_opttype_option_register(&idb_block, OPT_IDB_DESCR, &if_description); wtap_opttype_option_register(&idb_block, OPT_IDB_SPEED, &if_speed); @@ -1251,7 +1251,7 @@ void wtap_opttypes_initialize(void) /* * Register the NRB and the options that can appear in it. */ - wtap_opttype_block_register(WTAP_BLOCK_NG_NRB, &nrb_block); + wtap_opttype_block_register(WTAP_BLOCK_NAME_RESOLUTION, &nrb_block); wtap_opttype_option_register(&nrb_block, OPT_NS_DNSNAME, &ns_dnsname); wtap_opttype_option_register(&nrb_block, OPT_NS_DNSIP4ADDR, &ns_dnsIP4addr); wtap_opttype_option_register(&nrb_block, OPT_NS_DNSIP6ADDR, &ns_dnsIP6addr); @@ -1259,7 +1259,7 @@ void wtap_opttypes_initialize(void) /* * Register the ISB and the options that can appear in it. */ - wtap_opttype_block_register(WTAP_BLOCK_IF_STATS, &isb_block); + wtap_opttype_block_register(WTAP_BLOCK_IF_STATISTICS, &isb_block); wtap_opttype_option_register(&isb_block, OPT_ISB_STARTTIME, &isb_starttime); wtap_opttype_option_register(&isb_block, OPT_ISB_ENDTIME, &isb_endtime); wtap_opttype_option_register(&isb_block, OPT_ISB_IFRECV, &isb_ifrecv); @@ -1271,7 +1271,7 @@ void wtap_opttypes_initialize(void) /* * Register the DSB, currently no options are defined. */ - wtap_opttype_block_register(WTAP_BLOCK_DSB, &dsb_block); + wtap_opttype_block_register(WTAP_BLOCK_DECRYPTION_SECRETS, &dsb_block); } void wtap_opttypes_cleanup(void) diff --git a/wiretap/wtap_opttypes.h b/wiretap/wtap_opttypes.h index d2e4a39f10f..252e1718c1c 100644 --- a/wiretap/wtap_opttypes.h +++ b/wiretap/wtap_opttypes.h @@ -126,14 +126,20 @@ typedef struct wtap_block *wtap_block_t; /* * Currently supported blocks; these are not the pcapng block type values - * for them, they're identifiers used internally. + * for them, they're identifiers used internally, and more than one + * pcapng block type may use a given block type. + * + * WTAP_BLOCK_PACKET (which corresponds to the Enhanced Packet Block, + * the Simple Packet Block, and the deprecated Packet Block) is not + * currently used; it's reserved for future use. */ typedef enum { - WTAP_BLOCK_NG_SECTION = 0, - WTAP_BLOCK_IF_DESCR, - WTAP_BLOCK_NG_NRB, - WTAP_BLOCK_IF_STATS, - WTAP_BLOCK_DSB, + WTAP_BLOCK_SECTION = 0, + WTAP_BLOCK_IF_DESCRIPTION, + WTAP_BLOCK_NAME_RESOLUTION, + WTAP_BLOCK_IF_STATISTICS, + WTAP_BLOCK_DECRYPTION_SECRETS, + WTAP_BLOCK_PACKET, WTAP_BLOCK_END_OF_LIST } wtap_block_type_t;