Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions ffi/moq/ffi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ prefix = "moq"
# a hand-written wrapper still has to cover.
exclude = [
"ALPNS",
"AsPath",
"BoundsExceeded",
"Client::connect",
"Client::with_url",
Expand All @@ -20,10 +19,8 @@ exclude = [
"Hops::iter",
"IntoBytes",
"InvalidEpoch",
"Path::borrow",
"Path::new",
"Path::from_static",
"Path::parts",
"Path::strip_prefix",
"Server::accept",
"Server::accept_request",
"Timed",
Expand All @@ -35,6 +32,13 @@ exclude = [
"Versions::iter",
"announce::Announce",
"announce::Consumer::poll_synced",
"auth::Dial",
"auth::EmptyToken",
"auth::Token",
"auth::Tokens::changed",
"auth::Tokens::dial",
"auth::Tokens::new",
"auth::Tokens::set",
"bytes",
"frame::Buffer",
"frame::Producer::group",
Expand All @@ -44,8 +48,6 @@ exclude = [
"group::Producer::write_frames",
"origin::Requesting",
"origin::Routing",
"path::Relative::borrow",
"path::Relative::new",
"server::Handshake",
"stats::Failure::ALL",
"stats::RefusalKind::ALL",
Expand All @@ -59,14 +61,13 @@ exclude = [
"time::Driver",
"time::run",
"track::Fetching",
"track::Querying",
"track::Resolving",
"track::Subscribing",
"track::Subscription::ranges",
"track::Subscription::with_ranges",
"transport::Error",
"transport::MaybeSend",
"transport::MaybeSync",
"transport::StatsUnavailable",
"transport::memory::Chunks",
"transport::memory::SendStream",
"transport::poll::AcceptBi",
Expand Down Expand Up @@ -166,10 +167,7 @@ exclude = [
"connect::Config::tokens",
"connect::Config::url",
"connect::Config::version",
"connect::EmptyToken",
"connect::Resolved::bind",
"connect::Token",
"connect::Tokens::set",
"connection::Monitor::poll_presence",
"crypto::install_default",
"crypto::provider",
Expand Down Expand Up @@ -200,7 +198,6 @@ exclude = [
"quic::driver::Connecting",
"quic::driver::Connection::accept_bi",
"quic::driver::Connection::accept_uni",
"quic::driver::Connection::authenticated",
"quic::driver::Connection::close",
"quic::driver::Connection::close_reason",
"quic::driver::Connection::closed",
Expand Down
26 changes: 23 additions & 3 deletions ffi/moq/moq.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,16 @@ int main(void) {
root = moq_origin_producer_root(scoped);
CHECK(is(moq_path_as_str(root), "room"));
moq_path_free(root);
moq_path *absolute = moq_origin_producer_absolute(scoped, str("alice"));
moq_path *absolute = NULL;
CHECK(moq_origin_producer_absolute(scoped, str("alice"), &absolute, &err));
CHECK(is(moq_path_as_str(absolute), "room/alice"));
moq_path_free(absolute);
moq_patterns *allowed = moq_origin_producer_allowed(scoped);
CHECK(moq_patterns_matches(allowed, str("alice/cam")));
CHECK(!moq_patterns_matches(allowed, str("bob")));
moq_patterns_free(allowed);
moq_origin_consumer *reader = moq_origin_producer_consume(scoped);
absolute = moq_origin_consumer_absolute(reader, str("bob"));
CHECK(moq_origin_consumer_absolute(reader, str("bob"), &absolute, &err));
CHECK(is(moq_path_as_str(absolute), "room/bob"));
moq_path_free(absolute);
moq_origin_consumer_free(reader);
Expand All @@ -191,9 +192,28 @@ int main(void) {
moq_broadcast_info *stamped = moq_broadcast_producer_info(created);
moq_path *path = moq_broadcast_info_path(stamped);
CHECK(is(moq_path_as_str(path), "room/alice"));
moq_path *joined = moq_path_join(path, str("cam"));

/* Paths own their segments, so C builds them, and relative ones, from a string. */
moq_path *cam = NULL;
moq_path_too_long *too_long = NULL;
CHECK(moq_path_new(str("/cam/"), &cam, &too_long));
CHECK(is(moq_path_as_str(cam), "cam"));
moq_path *joined = NULL;
CHECK(moq_path_join(path, cam, &joined, &too_long));
CHECK(is(moq_path_as_str(joined), "room/alice/cam"));
moq_path *stripped = moq_path_strip_prefix(joined, path);
CHECK(stripped != NULL && moq_path_eq(stripped, cam));
moq_path_free(stripped);
CHECK(moq_path_strip_prefix(path, joined) == NULL);
moq_relative *up = NULL;
CHECK(moq_relative_new(str("../bob"), &up, &too_long));
moq_path *resolved = NULL;
CHECK(moq_path_resolve(joined, up, &resolved, &too_long));
CHECK(is(moq_path_as_str(resolved), "room/bob"));
moq_path_free(resolved);
moq_relative_free(up);
moq_path_free(joined);
moq_path_free(cam);
moq_path_free(path);
moq_broadcast_info_free(stamped);
moq_broadcast_producer_free(created);
Expand Down
1 change: 0 additions & 1 deletion quest/m1/ffi-export/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ Every generator on the C ABI:

## Required

- [Paths without a lifetime](/quest/m1/ffi-export/paths.md) - moq's owned `Path` exports, and its excludes go
- [Instances the config can't name yet](/quest/m1/ffi-export/instance-keys.md) - `&T` keys, `IntoIterator` as a `Vec`, `serde_json::Value`, and `Catalog<()>`
- [moq-clock's C names once it moves into kio](/quest/m1/ffi-export/crates.md) - `moq_now` and `moq_origin` become the clock's, after moq moves it into `kio::clock`
- [Sessions on moq-tokio](/quest/m1/ffi-export/session-tokio.md) - bindings connect and accept with one call, the library running moq-tokio inside
Expand Down
14 changes: 0 additions & 14 deletions quest/m1/ffi-export/paths.md

This file was deleted.

2 changes: 1 addition & 1 deletion ts/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ set shell := ["bash", "-euo", "pipefail", "-c"]
export PATH := if env("RUST2_TS_TOOLCHAIN", "") == "" { env("PATH") } else { env("RUST2_TS_TOOLCHAIN") / "bin:" + env("PATH") }

# The moq revision `moq` translates by default.
moq_rev := "88448d9c66ddf4b202eb873edbfe0ef859835a21"
moq_rev := "c764acebb90b5c102a8ea90207dd125ae4fd326b"

default:
@just --list
Expand Down