summaryrefslogtreecommitdiff
path: root/crates/tor-cell
Commit message (Collapse)AuthorAgeFilesLines
...
* | slicewriter: rename a local variable.Nick Mathewson2023-02-151-4/+4
| |
* | Move slicewriter to tor-cell and make it private.Nick Mathewson2023-02-153-1/+137
| | | | | | | | Also, add some comments about how it is likely to change.
* | tor-cell: Add RelayCell::into_msg.Nick Mathewson2023-02-151-0/+4
| |
* | tor-cell: Implement {Relay,Chan}Msg for every body typeNick Mathewson2023-02-153-5/+97
| | | | | | | | | | This will make it ergonomic to decode a single body type without having to declare a variant that accepts only a single message.
* | tor-cell: Note an opportunity for future optimizationNick Mathewson2023-02-151-0/+5
| |
* | tor-cell: Add a new UnparsedRelayCellNick Mathewson2023-02-152-2/+60
| | | | | | | | | | | | We'll use this to router relay messages on a circuit to the appropriate stream, and hand them to that stream, without parsing the message until the stream has been determined.
* | tor-cell: Refactor relay cells to copy much lessNick Mathewson2023-02-155-42/+70
|/ | | | | | | | | | | | | We now manipulate raw relay cell bodies as (an alias for) `Box<[u8;509]>` rather than as (an alias for) `[u8;509]`. This enables us to do much less copying. It will become more important soon, as we defer parsing relay cell bodies even longer. Related to #7. We also use SliceWriter to avoid allocating a Vec<> for every relay message we want to encode, and instead encode directly into the cell.
* tor-cell: Return a useful error when restrist_msg rejects a command.Nick Mathewson2023-02-091-2/+3
|
* Change tor_bytes::Error::BadMessage to a Cow.Nick Mathewson2023-02-0910-34/+51
| | | | | | | | | | Actually, to avoid making a breaking change, I'm deprecating BadMessage and creating a new InvalidMessage variant that takes a Cow. This way I don't need to track every crate that re-exposes tor_bytes::Error and call this a breaking change in those. Making this change will allow tor_bytes errors to be much more helpful.
* tor-cell: Re-export paste so restrict_msg can work outside the crate.Nick Mathewson2023-02-091-3/+3
|
* tor-cell: Remove chancell::msg::Body::into_message.Nick Mathewson2023-02-091-52/+1
| | | | | It's now redundant, since `restricted_msg!` defines From and Into for us.
* tor-cell: Make RelayEarly a separate type.Nick Mathewson2023-02-094-8/+32
| | | | This allows us to remove a shenanigan from `restricted_msg!{}`.
* tor-cell: Have restrict_msg add conversion functions.Nick Mathewson2023-02-095-102/+70
| | | | | | | | | | | | | | | | Every FooMsg type now implements Into<AnyFooMsg>, and TryFrom<FooMsg>. Additionally, it now implements From<X> for every distinct type that it supports. This last part lets us discard a bunch of code. Unfortunately, I needed some downright hackish trickery in order to get these macros to avoid generating `From<AnyFooMsg> for AnyFooMsg` and conflicting with the blanket implementation. The trickery to deal with RelayEarly and Relay being the same type was not necessarily worth it; I will be separating them and removing said trickery in the next commit.
* cell: Parameterize ChannelCodec::decode and encode.Nick Mathewson2023-02-093-12/+21
| | | | | | | This change lets us use ChannelCodec to encode and decode any restricted channel message type we want. (Later on, we'll turn the related Codec class in tor-proto into a more type-restricted version of this.)
* tor-cell: documentation cleanups related to restricted_msgNick Mathewson2023-02-074-6/+8
|
* tor-cell: correct handling of optional msg types.Nick Mathewson2023-02-072-12/+17
| | | | | | We need to make sure any `#[cfg(feature=...)]` attributes are applied not only to our variant declarations, but also to the branches in the match statements that deal with them.
* tor-cell: Rename RelayMsg and RelayCell-related types.Nick Mathewson2023-02-078-79/+80
| | | | Thanks to rust-analyzer for making this simple.
* tor-cell: Rename ChanMsg and ChanCell-related types.Nick Mathewson2023-02-077-65/+66
|
* tor-cell: Remove RelayMsg methods that are duplicated in RelayMsgClass.Nick Mathewson2023-02-074-17/+3
|
* tor-cell: Remove ChanMsg methods that are duplicated in ChanMsgClass.Nick Mathewson2023-02-075-33/+11
|
* tor-cell: Use macro to generate ChanMsg too.Nick Mathewson2023-02-073-108/+38
|
* tor-cell: Use macro to define RelayMsg type too.Nick Mathewson2023-02-072-185/+103
|
* tor-cell: Macro to generate restricted RelayMsg and ChanMsg.Nick Mathewson2023-02-073-0/+198
| | | | This is the main implementation part of #525.
* tor-cell: Change all variants of RelayMsg to have a body.Nick Mathewson2023-02-073-15/+53
| | | | | Previously, there were some unit variants, but that makes things quite awkward for #525.
* tor-cell: Make Body and MsgClass traits more uniform.Nick Mathewson2023-02-077-85/+88
| | | | | | | | Doing this will make it much easier to implement a macro that generates restricted instances of the Msg types (for #525). The Body change is a breaking change. I don't think anybody else implements Body, but in theory they could.
* tor-cell: Generic "Restricted{Relay,Chan}Cell" types.Nick Mathewson2023-02-074-33/+101
| | | | | | | These are generalizations of RelayCell and ChanCell respectively, that allow using an arbitrary message type in place of the fully general RelayMsg and ChanMsg types. Doing this is a prerequisite for usefully implementing arti#525.
* Remove semver.md files now that 1.1.1 is tagged.Nick Mathewson2023-02-011-2/+0
|
* Bump minor version of tor-cell.Nick Mathewson2023-02-011-1/+1
| | | | | | | | | In !948 we renamed a couple of accessor functions, which is a breaking change in `tor-cell`'s API. In retrospect, perhaps we should have deprecated the old names and added the new ones, so we wouldn't have to break the API. (This is the only API break AFAICT since 1.1.0.)
* Bump the patch version of every crate that had API additionsNick Mathewson2023-02-011-4/+4
| | | | | | These crates had API or behavior changes that may affect downstream crates. Fortunately, they're all version 0.x, and don't need minor bumps for this.
* Bump the patch-level version of crates with _minor_ changes.Nick Mathewson2023-02-011-1/+1
| | | | | | | These changes influence behavior, but not effect compatibility. (If I messed up, and any crate except for `arti` has non-breaking API changes, that's still fine, since they are all version 0.x.)
* Move tor-proto/semver.md to tor-cellNick Mathewson2023-02-011-0/+2
| | | | It was erroneously created in the wrong place.
* Allow clippy::unchecked_duration_subtraction in testsNick Mathewson2023-01-271-0/+1
| | | | | This panics on error, and we're fine with a panic on misbehavior in tests.
* Disable clippy::unlinlined-format-argsNick Mathewson2023-01-275-0/+7
| | | | | | | | This warning kind of snuck up on us! (See #748) For now, let's disable it. (I've cleaned it up in a couple of examples, since those are meant to be more idiomatic and user-facing.) Closes #748.
* Do not .gitignore crates/*/fuzz/corpusIan Jackson2023-01-201-1/+0
| | | | | These are symlinks which are actually checked in. They should not be ignored. (This caused trouble for some of my privsep tooling...)
* Fix typosDimitris Apostolou2023-01-071-4/+4
|
* Sketch a solution for arti#525Nick Mathewson2023-01-062-0/+35
|
* Sketch out new required APIs in tor-cellNick Mathewson2023-01-063-10/+129
|
* Merge branch 'test-lints' into 'main'eta2023-01-061-0/+9
|\ | | | | | | | | Add test lint blocks to all "mod test" See merge request tpo/core/arti!937
| * test lint blocks: Add many many automaticallyIan Jackson2022-12-121-0/+9
| | | | | | | | | | This is precisely the result of running the rune in maint/adhoc-add-lint-blocks.
* | msg::{CreateFast/CreatedFast}: Rename accessor to (into_)body()Neel Chauhan2022-12-182-4/+4
|/
* Remove semver.md files now that 1.1.0 is released.Nick Mathewson2022-11-301-1/+0
|
* Bump the minor version of every crate.Nick Mathewson2022-11-301-9/+9
| | | | | We made this job easy this time around: by incrementing our MSRV, we have forced ourselves to do at least a minor bump everywhere.
* bump rust-version to 1.60 in every crate.Nick Mathewson2022-11-101-1/+1
|
* Fix typosDimitris Apostolou2022-11-061-1/+1
|
* Run add_warnings.Nick Mathewson2022-11-031-0/+1
|
* set all crate edition to 2021trinity-1686a2022-11-011-1/+1
|
* Merge branch 'assert_maxlen' into 'main'Nick Mathewson2022-10-271-1/+2
|\ | | | | | | | | tor-cell: Assert data length in Data cells See merge request tpo/core/arti!800
| * tor-cell: Assert data length in Data cellsEmil Engler2022-10-241-1/+2
| | | | | | | | | | | | This commit adds a `debug_assert!` macro into the `new_unchecked()` function of the Data cell. Beside this, it also fixes a misleading comment regarding that limit.
* | Merge branch 'safe_u16_conversion' into 'main'Nick Mathewson2022-10-251-1/+1
|\ \ | | | | | | | | | | | | tor-cell: Consistent and secure conversion to u16 See merge request tpo/core/arti!803
| * | tor-cell: Consistent and secure conversion to u16Emil Engler2022-10-241-1/+1
| |/ | | | | | | | | | | | | This commit improves the overflow protection of one call to Vec::write_u16(), by replacing the cast conversion from self.sig.len() with a call to u16::try_from(), like it is already done in the rest of the accompanying function.