aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-cell/src/chancell/codec.rs
Commit message (Collapse)AuthorAgeFilesLines
* cell: Add helper functionsDavid Goulet2025-08-201-0/+5
| | | | | | | | | | | | Add is_known_cmd() to the restricted_msg!() macro which can be used to learn if a specific ChanCmd is part of the restricted set or not. Then add a simple function to get the link protocol version from a channel codec. Part of #1597 Signed-off-by: David Goulet <[email protected]>
* tor-cell: fix comment in `ChannelCodec::encode`Steven Engler2025-08-121-1/+3
| | | | | | This comment isn't correct if the encode() was given a non-empty buffer (for example if two cells were written to the same buffer, the second encode() would be given a non-empty buffer, so `pos != 5`).
* Switch Cargo.toml files to edition 2024.Nick Mathewson2025-08-071-2/+2
| | | | | | | | | | | | | | First, run ``` git grep -l "^edition =" | xargs perl -i -pe 's/^edition *=.*/edition = "2024"/;' ``` Second, manually verify that all Cargo.toml files have changed, and nothing else has changed. Third, run cargo fmt again.
* Use uXX::MAX in place of std::uXX::MAXNick Mathewson2024-04-221-1/+1
| | | | | | The old code produced a warning from clippy nightly; we may as well update to use the new associated consts. (They've been there since Rust 1.4x.)
* Change `CircId` to never be zeroJim Newsome2023-10-251-3/+4
| | | | | | | | | | This changes the internal representation to be `NonZeroU32` instead of just `u32`. Various places where a circuit ID is optional now use `Option<CircId>`. Fixes a bug in `CircIdRange::sample` that would previously return a circuit ID of 0, when the rng returned 0x8000_0000 for a low range.
* tor-cell: remove use of arrayrefNick Mathewson2023-06-011-3/+7
| | | | Closes #872
* cell: Parameterize ChannelCodec::decode and encode.Nick Mathewson2023-02-091-7/+14
| | | | | | | 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: Rename ChanMsg and ChanCell-related types.Nick Mathewson2023-02-071-6/+6
|
* tor-cell: Remove ChanMsg methods that are duplicated in ChanMsgClass.Nick Mathewson2023-02-071-4/+4
|
* Fix typosDimitris Apostolou2022-11-061-1/+1
|
* tor-cell: Make historical comments more concreteEmil Engler2022-10-211-3/+6
| | | | | This commit extends comments that make references to historical protocol versions of Tor, by adding the concrete protocol version numbers.
* tor-cell: Make encoding method signatures fallible.Nick Mathewson2022-07-111-2/+2
|
* tor-cell: convert BytesErr to a struct variantNick Mathewson2022-06-221-1/+4
|
* tor-cell: error usefulness and style fixesNick Mathewson2022-06-221-3/+8
|
* tor-cell: provide HasKind.Nick Mathewson2022-02-151-2/+3
| | | | | | | | | Additionally, refactor the IoError out of tor_cell::Error: nothing in TorCell created this; it was only used by tor_proto. This required refactoring in tor_proto to use a new error type. Here I decided to use a new CodecError for now, though we may refactor that away soon too.
* Move all crates into a `crates` subdirectory.Nick Mathewson2021-08-271-0/+114
This will cause some pain for now, but now is really the best time to do this kind of thing.