Commit graph

2216 commits

Author SHA1 Message Date
xmppftw
580fdeffa9 Added a test for prosody bug 1664 workaround 2024-12-16 15:19:54 +00:00
Emmanuel Gil Peyrot
011585594f xmpp: Adapt to xmpp-parsers changes wrt autojoin
This attribute is now a simple bool instead of an enum.
2024-12-16 13:32:49 +00:00
Emmanuel Gil Peyrot
866991bda5 xmpp-parsers: Replace all instances of bool attributes with bool
These bring basically nothing, so we can throw them away alongside their
generator macro.
2024-12-16 13:32:49 +00:00
45be2b34f0 tokio-xmpp: Add 'component' feature
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2024-12-16 00:33:43 +00:00
Emmanuel Gil Peyrot
16b232523d xmpp-parsers: Convert vCard-temp to xso
This also keeps all additional elements in the vCard, so they get
serialized back on the wire instead of being dropped.
2024-12-15 17:38:56 +00:00
Emmanuel Gil Peyrot
aaf2dd7925 xmpp-parsers: Convert bookmarks2 to xso 2024-12-15 17:38:56 +00:00
Emmanuel Gil Peyrot
1c22e17955 xmpp-parsers: Convert Jingle File Transfer to xso 2024-12-15 17:38:56 +00:00
Emmanuel Gil Peyrot
af0bd35e7a xmpp-parsers: Implement XEP-0490: Message Displayed Synchronization
This XEP is used to synchronize where each client has stopped reading a
conversation, so that we can e.g. stop displaying a notification when
the user has read this particular message on a different device.
2024-12-15 17:30:24 +00:00
Emmanuel Gil Peyrot
d738939f89 xmpp-parsers: Simplify hash conversion to Vec
Use `GenericArray::to_vec()` and `slice::to_vec()` directly.
2024-12-15 17:17:01 +00:00
Emmanuel Gil Peyrot
e358bd405f sasl: Simplify hash conversion to Vec
Use `GenericArray::to_vec()` directly.
2024-12-15 17:17:01 +00:00
Emmanuel Gil Peyrot
57e6e98c6a xmpp-parsers: Add test for StartTLS
This tests each element we support, and also keep track of the sizes.

Additionally the copyright year was wrong.
2024-12-15 17:45:26 +01:00
Emmanuel Gil Peyrot
5e9635add3 rustfmt has changed, so update xso so CI is happy again 2024-12-15 16:26:05 +01:00
Emmanuel Gil Peyrot
c390af2b36 jid: Remove the std feature
Since Rust 1.81, std::error::Error has been moved to core::error::Error,
which we can use without depending on std.
2024-11-13 10:52:51 +01:00
Emmanuel Gil Peyrot
dc842c44d1 sasl: Make this crate no_std
We mostly had to import from alloc some structs that are part of the std
prelude, such as Vec and String.
2024-10-27 21:25:14 +01:00
Emmanuel Gil Peyrot
0267383803 sasl: Improve frame parsing
All keys only have a single char, so avoid allocating a whole String for
them.  Also move to a BTreeMap as this is more efficient on such keys.
2024-10-27 21:25:14 +01:00
Jonas Schäfer
7d8ffe45a7 xso: add support for ignoring unknown stuff in extracts 2024-10-26 17:37:32 +00:00
Jonas Schäfer
66233b0150 xso: add support for ignoring unknown children 2024-10-26 17:37:32 +00:00
Jonas Schäfer
290460ba9d xso: add support for ignoring unknown attributes 2024-10-26 17:37:32 +00:00
Jonas Schäfer
74c81b6a37 xso: add from_reader 2024-10-03 12:57:32 +02:00
Alvaro Parker
347e8d6f17 Impl Error for ReadError 2024-09-20 15:17:54 -03:00
Emmanuel Gil Peyrot
c24275c098 tokio-xmpp: Add support for kernel TLS
This drastically improve the debuggability of the network parts, by
moving the task of encrypting/decrypting TLS packets from userland to
the kernel.  This makes them appear in clear in strace as sendto() and
recvfrom().

I introduced a new tls-rust-ktls feature which depends on both rustls
and ktls, but isn’t enabled by default since it probably isn’t available
on every computer.  It requires the tls kernel module to be loaded,
which then can offload encryption/decryption to dedicated hardware if
available.

I have tested this change on Linux 6.11 on a rk3588.
2024-09-17 20:45:41 +00:00
Alvaro Parker
904bdeae11 add debug to StreamHeader 2024-09-17 12:07:06 -03:00
Emmanuel Gil Peyrot
ebfae4bddc tokio-xmpp: Run rustfmt on that one example
It started breaking CI for some reason, probably a rustfmt update.
2024-09-16 23:32:49 +02:00
Alvaro Parker
2ff89a9e42 fix typos 2024-09-16 18:29:44 -03:00
Jonas Schäfer
a503c8534f parsers: add support for handled-count-too-high error 2024-09-01 13:01:29 +02:00
Jonas Schäfer
0f0759b207 parsers: add support for <optional/> in stream management feature 2024-09-01 13:01:29 +02:00
Emmanuel Gil Peyrot
425be4bef4 tokio-xmpp: Improve highlight_xml()
First switch to LazyLock from OnceLock, to simplify the code.

Then concatenate the colour reset escape code instead of using
format!(), since the vast majority of those strings have more capacity
than their length it will avoid a reallocation in most cases.
2024-09-01 12:32:50 +02:00
Jonas Schäfer
263839a5f8 xmlstream: add tests to capture thingy
This would've caught the embarrassing error made in the previous commit.
2024-09-01 09:07:34 +00:00
Jonas Schäfer
c795921631 xmlstream: fix crash
This happened when (a bit too hastily) applying suggestions from a
review.
2024-09-01 09:07:34 +00:00
Jonas Schäfer
bfe723cf46 parsers: make stream errors more ergonomic for error processing 2024-09-01 08:54:50 +00:00
Jonas Schäfer
b39ad99ecd parsers: add stream error XSO 2024-09-01 08:54:50 +00:00
Jonas Schäfer
ce4b739026 xmlstream: allow simplex stream shutdown
Unlike poll_close, poll_shutdown will only kill the sending side of the
stream. This is relevant to perform a fully clean shutdown procedure in
XMPP.
2024-09-01 10:02:36 +02:00
Jonas Schäfer
4cfe4f8429 xmlstream: implement simple timeout logic
This allows to detect and handle dying streams without getting stuck
forever.

Timeouts are always wrong, though, so we put the burden of choosing the
right values (mostly) on the creator of a stream.
2024-09-01 10:02:36 +02:00
Jonas Schäfer
960fd782bd xmlstream: fix clean shutdown sequence
Without the early return in XmlStream::poll_next in case of the stream
footer, the read state gets recreated and the logic at the top of that
function to actually handle stream shutdown gracefully is never
triggered.

Also that logic was incorrect; the correct behaviour is to wait for the
true EOF.
2024-09-01 10:02:36 +02:00
Jonas Schäfer
efc859abc0 xmlstream: re-introduce syntax-highlit logging of XML stream I/O 2024-09-01 10:02:36 +02:00
Jonas Schäfer
c01eb090b8 xso-proc: improve error messages on cast mismatch for extracts
The old error message was pointing at the `FromXml` / `AsXml` invocation
and not on the field which actually caused the problem. The new error
message points exactly at the type of the affected field.
2024-08-31 10:50:44 +02:00
Jonas Schäfer
51884eedf7 Fix missing copyright header 2024-08-30 15:40:32 +02:00
Jonas Schäfer
c85c98b0bf xmlstream: improve responder-side of stream resets
This makes the stream resets a lot safer, by preventing the forbidden
send-read-reset combination of events: the reset function on the
responder side now takes the element to send right before the reset,
enforcing a send-reset pattern.
2024-08-29 16:47:13 +02:00
Jonas Schäfer
ab10e30ac0 Port crates to use new XSO-based xmlstream 2024-08-29 16:47:13 +02:00
Jonas Schäfer
7cfda820a6 xmlstream: introduce XMPP specifics 2024-08-29 16:43:20 +02:00
Jonas Schäfer
2c944ebbf8 xmlstream: add access to inner stream 2024-08-29 16:43:06 +02:00
Jonas Schäfer
2931df22db xmlstream: split initiation reset in two phases 2024-08-29 16:43:00 +02:00
Jonas Schäfer
c723897326 tokio_xmpp: introduce xmlstream module
This module provides XSO-based parsing, proper typestates and will
soon replace the proto module.
2024-08-29 16:42:57 +02:00
schnell
274baaef9a
add support for local trust store for rustls
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
2024-08-22 15:38:39 +02:00
Jonas Schäfer
f77c21f0fc Update to rxml 0.12.0 2024-08-12 16:16:32 +02:00
xmppftw
cc3400bac7 Reorganize component modules 2024-08-12 10:59:20 +00:00
xmppftw
e6863bd9dd Reorganized client modules 2024-08-12 10:59:20 +00:00
xmppftw
46dc30c045 Deny doc warnings in Gitlab CI
Github/Gitea/Forgejo CI not affected because it doesnt build docs yet
2024-08-12 10:47:23 +00:00
xmppftw
df106dfbaf Relative dependencies 2024-08-12 10:39:09 +00:00
Jonas Schäfer
54e1a98cde parsers: add starttls XSOs 2024-08-12 12:35:26 +02:00