summaryrefslogtreecommitdiff
path: root/crates/tor-netdoc/src/parse2
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'encoded-authcert' into 'main'Ian Jackson2026-01-1511-135/+149
|\ | | | | | | | | Implement EncodedAuthCert and use it in poc for votes See merge request tpo/core/arti!3592
| * tor-netdoc: EncodedAuthCert: use in poc integration test / demoIan Jackson2026-01-151-6/+15
| |
| * tor-netdoc: Expose whole input string (rustfmt)Ian Jackson2026-01-151-2/+1
| |
| * tor-netdoc: Expose whole input stringIan Jackson2026-01-151-8/+17
| | | | | | | | | | | | | | | | The string so far is exposed already via whole_for_signatures. It is unusual for a doc parser to need this, but embedded documents can use this plus byte_position to get the original input text for their part of the outer document.
| * tor-netdoc: parse2: Provide NetdocParseable::is_structural_keyword (rustfmt)Ian Jackson2026-01-151-3/+2
| |
| * tor-netdoc: parse2: Provide NetdocParseable::is_structural_keywordIan Jackson2026-01-155-2/+86
| | | | | | | | Roughly as per the proposal in `doc/dev/notes/authcert-in-consensus.md`.
| * tor-netdoc: Abolish poc's AuthCert (rustfmt)Ian Jackson2026-01-152-8/+3
| |
| * tor-netdoc: Abolish poc's AuthCertIan Jackson2026-01-154-109/+13
| | | | | | | | | | | | | | | | | | | | | | We can use the real AuthCert now that it implements the parse2 traits. The verification function is still used by poc's netstatus code and by a test case. We must change the field names in a few places, because the real AuthCert's struct field names are the keywords, whereas the poc's are the key names. (A shame that they're different!)
| * tor-netdoc: Prepare poc's DirAuthKeyCertSigned::verify_selfcertIan Jackson2026-01-151-7/+8
| | | | | | | | | | | | | | Use accessors for the body. (Eventually this function will replace, be replaced by, or merge with, the existing signature code outside poc.)
| * tor-netdoc: Add an error variant we'll need for parsing embedded docsIan Jackson2026-01-151-0/+3
| |
| * tor-netdoc: Improve Keyword API slightlyIan Jackson2026-01-151-1/+12
| |
* | tor-netdoc: Change error variantsClara Engler2026-01-152-17/+17
|/ | | | | | | This commit changes `ErrorProblem::Other` to `ErrorProblem::OtherBadDocument` while adding two new variants: * `ErrorProblem::Internal` * `ErrorProblem::BadApiUsage`
* tor-netdoc: derives: New `skip` document field optionIan Jackson2026-01-141-4/+16
| | | | | This lets us having document items that are "manually non exhaustive" which is necessary for struct literal constructors.
* tor-netdoc: RSA: check exponent and min size in parse2Ian Jackson2026-01-061-1/+14
| | | | | | | | | | | | | | | According to the spec we always use this fixed exponent, and we have a minimum size of 1024. This is checked adhoc in the old parser with some slight assistance from what is now `RsaPublicParse1Helper`. It's not clear to me that checking the exponent is actually a good idea. I think checking the size is probably a bad idea, and if it is a good idea then 1024 is clearly too short. But rather than revisit these questions, let's reproduce the old behaviour in parse2. In parse2 these checks should be features of the type.
* tor-netdoc: Break out and expose ItemStream::byte_positionIan Jackson2025-12-181-3/+10
|
* tor-netdoc: Use $P for prelude in one placeIan Jackson2025-12-181-1/+1
| | | | This was missed, apparently.
* tor-netdoc: Add two TODOs re trait namingIan Jackson2025-12-101-0/+2
|
* tor-netdoc: derive netdoc encoding traitsIan Jackson2025-12-101-0/+8
| | | | | Signature encoding is not yet supported. We need to consider how this will work.
* tor-netdoc: debug: Add a placeholder debug print to all the other derivesIan Jackson2025-12-101-0/+15
| | | | | | | | We want to recognise `#[deftly(netdoc(debug))]` because otherwise we have to make lots of these attributes conditional. So, implement it for *all* the derives, providing a nugatory debug statement.
* tor-netdoc: parse2: debug: Explain why we use io::stderr()Ian Jackson2025-12-101-0/+2
|
* tor-netdoc: parse2: debug: Fix an error messageIan Jackson2025-12-101-1/+1
| | | | What is being written to here is StderrLock, not a String.
* tor-netdoc: parse2: debug: Fix scoping of netdoc_parseable_derive_debugIan Jackson2025-12-102-1/+2
| | | | | | While testing I discovered that the `#[deftly(netdoc(debug))]` feature (which dumps parsing progress to stderr) didn't compile if the derive was invoked from elsewhere.
* tor-netdoc: derive_common: Break out docs for attrs in flattenIan Jackson2025-12-101-8/+2
| | | | | | Code motion fromk NetdocParseableFields to NetdocFieldsDeriveCommon. This uses the derive-deftly imported doc comment feature.
* tor-netdoc: derive_common: Break out field ordering checkIan Jackson2025-12-101-16/+1
| | | | Code motion from NetdocParseable to NetdocEntireDeriveCommon.
* tor-netdoc: derive_common: Break out item field type definitionsIan Jackson2025-12-101-6/+0
| | | | Code motion from ItemValueParseable to NetdocItemDeriveCommon.
* tor-netdoc: derive_common: Break out main field type definitionsIan Jackson2025-12-101-12/+0
| | | | | | | | Code motion from NetdocParseable to NetdocEntireDeriveCommon. Code motion from NetdocParseableFields to NetdocFieldsDeriveCommon. Again, the encoder wants exactly this logic.
* tor-netdoc: derive_common: Break out F_KEYWORD_*, F_FLATTEN, F_NORMALIan Jackson2025-12-101-34/+0
| | | | | | | Code motion from NetdocSomeItemsParseableCommon to NetdocSomeItemsDeriveCommon. Encoding wants exactly the same logic.
* tor-netdoc: Introduce new derive_common Rust module with d-d modulesIan Jackson2025-12-101-0/+13
| | | | | | | There is nothing actually in any of these yet. But it is most convenient to lay out the structure now. We'll move code into these modules in forthcoming commits.
* tor-netdoc: parse2: Rename NetdocParseableCommon d-d moduleIan Jackson2025-12-101-3/+3
| | | | | | | | This is only used for structs which contain items, not item value structs. We need a name that reflects this, especially as we are going to add a bunch more modules full of common macro elements.
* tor-netdoc: Break out netdoc_ordering_check into new derive_common.rsIan Jackson2025-12-101-34/+0
|
* tor-netdoc: encoding: Provide multiplicity moduleIan Jackson2025-12-101-1/+12
| | | | | | | | This is quite like the one for parse2, but separate for Reasons. Also add a bit of explanation to parse2's multiplicity.rs, about why there are all these different FooSetMethods traits, which the encoder doesn't need.
* tor-netdoc: NetdocParseable: Document that BTreeSet is allowedIan Jackson2025-12-102-0/+5
| | | | | | | When we implemented this we documented it for ItemValueParseable but forgot to do so for NetdocParseable. Add some xrefs to the traits to try to stop similar mistakes.
* tor-netdoc: Implement new authority certificatesClara Engler2025-12-041-0/+18
| | | | | | | | | This commit implements directory authority certificates using the `parse2` approaches. For now, those are in a module `doc::authcert::tmp`, with the eventual goal of moving it into its super module after removing/deprecating the legacy types.
* tor-netdoc: Implement (Partial)Eq for VerifyFailedClara Engler2025-12-041-1/+1
|
* tor-netdoc: Suppress a clippy warning more thoroughlyIan Jackson2025-12-041-1/+2
|
* tor-netdoc: Suppress a clippy warningIan Jackson2025-12-031-0/+1
| | | | | | | This code sometimes expands to `let item = item;`. That's OK. In derive-deftly 1.5.x the two `item` wrongly had different hygiene span so the warning didn't trigger.
* parse2: ItemValueParseable, netdoc(object, rest): docs: state signatureIan Jackson2025-12-021-1/+3
| | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/3502/diffs?commit_id=f9a6d90ec6d5abf2958534d2c100c84f325e3634#2525aaf11b44162850101813478c4734160e11fa_920_919
* parse2: ItemValueParseable, netdoc(object, rest): docs: clarify errorsIan Jackson2025-12-021-1/+1
| | | | | | The error is not really discarded (which would seem to mean ignoring it). The erorr *value* is discarded and is replaced with a less informative error value.
* parse2: ItemValueParseable, netdoc(object, rest): docs: fix typoIan Jackson2025-12-021-1/+1
|
* parse2: ItemValueParseable, netdoc(rest, with): reworkIan Jackson2025-12-021-5/+8
| | | | | | | | | | The path in `with` must always be a module, not a function, because we need to use it for encoding too. In the case of `rest`, it's probably sensible to require a different function name, given that the semantics are subtly different to those of `rest` without `with`, since the latter can only get a single word but with `rest` you get the whole line.
* parse2: ItemValueParseable, netdoc(rest): docs: clarify behaviourIan Jackson2025-12-021-1/+1
|
* parse2: Move naming convention to pocClara Engler2025-11-271-1/+15
| | | | | | | | | | | This commit moves the "Naming Convention" of the parse2::poc module into the respective module, as it does not apply to parse2 itself, as outlined in arti!3462. With this commit, there remains `NdaSystemTimeDeprecatedSyntax` as the only type outside poc following this naming schema. However, because it is more or less already deprecated anyways, there is no real need to bother with it any further.
* tor-netdoc: Minor wording fix in a docIan Jackson2025-11-261-1/+1
| | | | | This is in the ItemValueParseable derive, so the individual fields are Arguments, not Items.
* tor-netdoc: Minor grammar fix in a docIan Jackson2025-11-261-1/+1
|
* Merge branch 'nd-test' into 'main'Ian Jackson2025-11-251-747/+0
|\ | | | | | | | | tor-netdoc: Move parse2/test.rs to test2.rs See merge request tpo/core/arti!3486
| * tor-netdoc: Move parse2/test.rs to test2.rsIan Jackson2025-11-241-747/+0
| | | | | | | | | | | | | | We're going to use this for the encoder testing too, so it needs to be not buried inside parse2. This commit is the file rename plus minimal changes to make it compile.
* | Merge branch 'p2-mult' into 'main'Ian Jackson2025-11-253-66/+48
|\ \ | |/ |/| | | | | tor-netdoc: parse2: Combine MultiplicitySelector See merge request tpo/core/arti!3478
| * tor-netdoc: rustfmt to tidy up importsIan Jackson2025-11-191-4/+1
| |
| * tor-netdoc: parse2: Combine all the multiplicity SelectorsIan Jackson2025-11-193-49/+34
| | | | | | | | | | There is no conflict between the different uses. Having just one type makes things simpler.
| * tor-netdoc: parse2: Move multiplicity docs examples into Methods traitsIan Jackson2025-11-191-32/+32
| | | | | | | | | | | | | | We're going to combine all the Selector types, so it won't be able to have these. The diff is misleading: it's docs for the Selectors that's moving.