bool process_vcf_stream(std::istream &input, const std::string &sourceName, ValidationLevel validationLevel, std::vector<std::unique_ptr<ebi::vcf::ReportWriter>> &outputs) { std::vector<char> firstline; ebi::util::readline(input, firstline); check_readability_of_stream(firstline); ebi::vcf::Version version; try { version = detect_version(firstline); } catch (FileformatError * error) { for (auto &output : outputs) { output->write_error(*error); } return false; } std::unique_ptr<Parser> validator = build_parser(sourceName, validationLevel, version); return validate(firstline, input, *validator, outputs); }
*err = WTAP_ERR_SHORT_READ; return FALSE; } return TRUE; } int logcat_open(wtap *wth, int *err, gchar **err_info _U_) { int local_err; gchar *local_err_info; gint version; gint tmp_version; struct logcat_phdr *logcat; /* check first 3 packets (or 2 or 1 if EOF) versions to check file format is correct */ version = detect_version(wth, &local_err, &local_err_info); if (version <= 0) return 0; tmp_version = detect_version(wth, &local_err, &local_err_info); if (tmp_version < 0 && !file_eof(wth->fh)) { return 0; } else if (tmp_version > 0) { if (tmp_version != version) return 0; tmp_version = detect_version(wth, &local_err, &local_err_info); if (tmp_version != version && !file_eof(wth->fh)) return 0; }
proto_item *subitem; guint16 length; guint16 check_length; guint32 string_length; gint logger_version; guint8 *log; gchar *c; tvbuff_t *next_tvb; col_set_str(pinfo->cinfo, COL_PROTOCOL, "Logcat"); col_clear(pinfo->cinfo, COL_INFO); mainitem = proto_tree_add_item(tree, proto_logcat, tvb, offset, -1, ENC_NA); maintree = proto_item_add_subtree(mainitem, ett_logcat); logger_version = detect_version(tvb, offset); subitem = proto_tree_add_uint(maintree, hf_logcat_version, tvb, offset, 0, logger_version); PROTO_ITEM_SET_GENERATED(subitem); proto_tree_add_item(maintree, hf_logcat_length, tvb, offset, 2, ENC_LITTLE_ENDIAN); length = tvb_get_letohs(tvb, offset); offset += 2; if (logger_version == 1) { proto_tree_add_item(maintree, hf_logcat_padding, tvb, offset, 2, ENC_LITTLE_ENDIAN); } else { proto_tree_add_item(maintree, hf_logcat_header_size, tvb, offset, 2, ENC_LITTLE_ENDIAN); } offset += 2;