summaryrefslogtreecommitdiffstats
path: root/openpgp/src/parse/packet_pile_parser.rs
AgeCommit message (Collapse)Author
2020-09-17openpgp: Improve parsing examples to demonstrate body handling.Justus Winter
- Demonstrate dropping, buffering of all bodies, buffering of individual bodies, and streaming. - Fixes #540.
2020-07-24openpgp: Improve PacketParserResult::as_ref, as_mut, and map.Justus Winter
- Previously, these method withheld information in the EOF case (and in case of `map` this loss is irrecoverable). Fix this by returning a Result instead.
2020-07-21openpgp: Remove PacketParserResult::is_none.Justus Winter
- There is no variant called `None`, so having this predicate seems wrong. - See #489.
2020-05-28openpgp: Improve the PacketPileParser documentation.Justus Winter
- See #471.
2020-05-28openpgp: Align PacketPileParser::recursion_depth with PacketParser'sJustus Winter
2020-05-28openpgp: Fix PacketPileParser's API.Justus Winter
- Previously, inspecting the first packet was weird, because only .next() and .recurse() returned a reference to the underlying packet parser. Having to call .next() to get the first package differs from how the packet parser behaves (though I have to admit that it aligns with Iterator::next()). - Instead of returning the packet parser result from .next() and .recurse(), make PacketPileParser deref to it. This allows to inspect the first packet without weirdly calling .next() first, and improves code using the PPP in a parsing loop. It also simplifies the implementation, removing the need for the `returned_first` hack.
2020-04-16Revert "openpgp: Make PacketParserResult a std::result::Result."Justus Winter
This reverts commit 2e1eec5fe4157a391a13554ff7df3075cfe043cc.
2020-04-09openpgp: Make PacketParserResult a std::result::Result.Justus Winter
- This avoids the partial implementation imitating std::option::Option, replacing it with std::result::Result. - As a benefit, std::result::Result is in the prelude, simplifying a lot of parsing loops.
2020-04-09openpgp: Remove convenience functions.Justus Winter
2020-04-09openpgp: Rename PacketParserBuilder::finalize to build.Justus Winter
- Writers should be finalized, builders should be built.
2020-04-08openpgp: Impl TryFrom<PacketParserBuilder> for PacketPileParser.Justus Winter
2020-03-31openpgp: Move definition of struct PacketPile.Justus Winter
- Implement Default for PacketPile, add internal accessor for the top-level.
2020-03-30openpgp: Add test for PacketPileParser::next.Justus Winter
2020-03-26openpgp: Change packet bodies to be tristate.Justus Winter
- Packet bodies can now be either unprocessed (e.g. compressed, encrypted), processed (e.g. uncompressed, decrypted), or structured (e.g. parsed into packets). - Make the container types deref to Container, and container deref to packet bodies. - This cleanly avoids the confusion when serializing containers: We can serialize compressed data packets with either body, but we can only serialize encryption containers with unprocessed bodies. - Fixes #187.
2020-03-13openpgp: Decouple PacketPile and Container.Justus Winter
- Likewise for the test.
2019-12-20openpgp: Embed struct Container in the container packets.Justus Winter
- This allows us to implement PartialEq and related traits more selectively. See #93.
2019-12-20openpgp: Move fields from Common to Container.Justus Winter
2019-12-11openpgp: Make the PacketPileParser interface safe.Justus Winter
- Do not expose the PacketParserResult, improve error handling. - Fixes #278.
2019-09-27linting: Clear up bare trait object warningsDaniel Silverstone
Newer Rust compilers requre `dyn` marking trait objects. Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2019-09-18openpgp: Make Parse::from_bytes polymorphic over AsRef<[u8]>.Justus Winter
- A drawback of this change is that currently AsRef<[u8]> is not implemented for [u8; _], only for specific lengths. This is a compiler limitation that may be lifted in the future. This limitation required fixing some tests, notably those using include_bytes!. - Fixes #296.
2019-09-17openpgp: Make packet::Common::children private.Justus Winter
2019-08-21openpgp: Fix documentation.Justus Winter
2019-07-15Prepare for Rust 2018.Justus Winter
- This is the result of running `cargo fix --edition`, with some manual adjustments. - The vast majority of changes merely qualify module paths with 'crate::'. - Two instances of adding an anonymous pattern to a trait's function. - `async` is a keyword in Rust 2018, and hence it needs to be escaped (e.g. in the case of the net::r#async module). - The manual adjustments were needed due to various shortcomings of the analysis employed by `cargo fix`, e.g. unexpanded macros, procedural macros, lalrpop grammars.
2019-05-14openpgp: Clean up test data handling.Justus Winter
- Use the new framework instead of including the files everywhere.
2019-05-14openpgp: Add a filesystem-like framework for test data.Justus Winter
- Fixes #267.
2019-03-27openpgp: Move test file.Justus Winter
2019-03-01buffered-reader: Drop BufferedReader prefix.Justus Winter
- For example, `buffered_reader::BufferedReaderMemory` is now called `buffered_reader::Memory`. This makes the type names less unwieldy. - Fixes #206.
2019-02-06openpgp: Rename consuming conversion functions.Justus Winter
- Rename functions that consume their receiver but are called .to_...() to .into_...(). - For the packet types, simply drop the conversion function in favor of using the From trait. - Fixes #160.
2018-12-14openpgp: Introduce trait Parse.Justus Winter
- Trait Parse introduces a uniform interface to parse packets, messages, keys, and related data structures.
2018-11-24Rename the openpgp crate to sequoia-openpgp.Justus Winter
2018-10-09openpgp: Don't return the depth from PacketParser::{next,recurse}Neal H. Walfield
- Change PacketParser::next and PacketParser::recurse to not return the packets' depths. Instead, require the caller to query them using accessor functions, if they are needed (they usually aren't).
2018-10-09openpgp: Drop redundant recursive_depth field.Neal H. Walfield
- The packet parser's recursive depth can be computed from the path, which we now track. As such, don't track the recursive depth separately, just derive it from the path.
2018-09-17openpgp: Use the new reader.Justus Winter
- Use the new reader either directly, or make sure that calls to from_file(..) use it down the call chain.
2018-08-24openpgp: Make PacketParser's next() and recurse() return two tuples.Justus Winter
- This logically groups the returned values, and makes it easier to ignore both packet-related values. - See #27.
2018-07-02openpgp: Create a special Option-like type for PacketParser.Neal H. Walfield
- In the future, we want to return some summary information about a parsed packet sequence after the packet sequence is fully parsed. Currently, PacketParser::next() and PacketParser::recurse() consume the PacketParser and return None on EOF. Thus, even if the summary information were stored in the PacketParser, it becomes inaccessible on EOF. - This change introduces a new type, PacketParserResult, that contains either a PacketParser or a PacketParserEOF. PacketParserEOF is returned on EOF instead of None. Since it is a struct, it can hold only any information that we want to return to the caller.
2018-06-19openpgp: make missing docs a warning.Kai Michaelis
Missing doc comments on public functions and types now procude a warning. Also adds all missing comments.
2018-06-19openpgp, buffered-reader: Make compression an optional feature.Justus Winter
- This helps to reduce the trusted computing base if compression is not needed. - This makes it easier to fuzz Sequoia, previously the fuzzer was doing a great job creating compression bombs that triggered the fuzzers timeout. - Currently, the cargo workspace feature does not propagate --no-default-features, but it is possible to depend on the openpgp crate with `default-features = false`. - Unfortunately, a lot of test cases include compressed packages. This change conditionally disables these tests.
2018-06-13openpgp: Add missing files for commit 99d0dbe.Neal H. Walfield