Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
3988a07
fix(http/streams): resolve cross-thread use-after-free data races
vijayee Aug 26, 2026
0bc7c94
fix(http): fix GET-path pipeline refcount leak in _setup_stream_pipeline
vijayee Aug 26, 2026
0182dfd
docs: update OPERATIONS.md to reflect GET-path leak fix
vijayee Aug 26, 2026
061efa1
test(network): make StoreBlockTest.LowCapacityAccepts statistical, no…
vijayee Aug 26, 2026
5090959
docs: add QR peer connect design spec
vijayee Aug 28, 2026
16f17d5
docs: add QR peer connect implementation plan
vijayee Aug 28, 2026
e277bdf
chore: cross-platform ASan instrumentation and project version propag…
vijayee Aug 28, 2026
21b5fbb
build: vendor libqrencode and quirc as required submodules
vijayee Aug 28, 2026
e9bc588
fix(build): exclude libqrencode tests, link quirc against libm, MSVC …
vijayee Aug 28, 2026
9c75fd6
fix(build): shadow BUILD_TESTING for libqrencode subdirectory only
vijayee Aug 28, 2026
40252ba
feat(qr): add PPM QR codec module (libqrencode encode, quirc decode)
vijayee Aug 28, 2026
7a2a1aa
fix(qr): raise quirc region limit and add capacity round-trip tests
vijayee Aug 28, 2026
8db2c73
feat(wire): PEER_INFO_REQUEST gains response format byte (2 = PPM QR …
vijayee Aug 28, 2026
5f593e8
fix(wire): preserve 1-element PEER_INFO_REQUEST frame for format 0
vijayee Aug 28, 2026
48fbb0b
feat(peers): QR format 2 in socket peer handlers via shared payload h…
vijayee Aug 28, 2026
a275bbf
fix(peers): base58-encode PEER_INFO_RESPONSE for format-1 requests
vijayee Aug 28, 2026
bf2feec
fix(wire): raise peer-info payload caps to 2MB for PPM QR images
vijayee Aug 28, 2026
adb2cd8
feat(http): QR peer info via vendored encoder; accept PPM QR bodies o…
vijayee Aug 28, 2026
52ae10b
fix(http): correct truncated error-message length in peer info handler
vijayee Aug 28, 2026
c6407e4
feat(client): C client library peer info/connect/friend-add with QR f…
vijayee Aug 28, 2026
2fbe13b
fix(client): validate peer op inputs and document error delivery
vijayee Aug 28, 2026
7586f57
feat(js-client): QR peer info/connect/friend support (format byte 2)
vijayee Aug 28, 2026
8409cd7
fix(js-client): rebuild dist from committed sources (drop uncommitted…
vijayee Aug 28, 2026
63ec3a9
refactor(js-client): centralize peer format maps in wire.js
vijayee Aug 28, 2026
51f1425
docs: document QR peer-info support across API spec
vijayee Aug 28, 2026
b309337
docs: add cache load command design spec
vijayee Aug 29, 2026
81756d1
docs: add cache load command implementation plan
vijayee Aug 30, 2026
dce7058
feat(wire): LOAD_REQUEST/LOAD_PROGRESS/LOAD_END frames (39-41) for ca…
vijayee Aug 30, 2026
3b69928
fix(wire): LOAD_REQUEST matches GET_REQUEST optional-range frame shape
vijayee Aug 30, 2026
66d06ab
fix(wire): load decode hardening, ori validation, negative wire tests
vijayee Aug 30, 2026
b652c09
feat(off-stream): load mode skips missing tuples and emits counted pr…
vijayee Aug 30, 2026
1766e34
fix(off-stream): prune answered fetches and emit load tally before close
vijayee Aug 30, 2026
4aa67c1
fix(off-stream): prune the skip-triggering miss node to prevent stale…
vijayee Aug 30, 2026
f86b736
feat(transports): dispatch LOAD frames on unix/tcp/ws transports
vijayee Aug 30, 2026
c252f82
fix(transports): close load stream when tuple tally completes (partia…
vijayee Aug 30, 2026
46e7859
test(transports): unix LOAD directory/auth rejection coverage
vijayee Aug 30, 2026
dc5d3a3
feat(http): ?load=1 streams ndjson tuple progress for cache-only fetch
vijayee Aug 30, 2026
71a0597
fix(transports): guard unix load error handlers against deactivate loop
vijayee Aug 30, 2026
0f5d6c0
feat(client): C client library load operation with tuple progress cal…
vijayee Aug 30, 2026
710f2c7
feat(js-client): load() — cache-only fetch with tuple progress
vijayee Aug 30, 2026
3c1e495
fix(js-client): rebuild dist from committed sources (drop uncommitted…
vijayee Aug 30, 2026
4bf591d
feat(binding): Dart loadContent + QR peer image catch-up
vijayee Aug 30, 2026
6d6b71e
docs: document cache load surface (HTTP ?load, frames 39-41, bindings…
vijayee Aug 30, 2026
3f8ed5d
test(transports): fix leaks and uninit reads in load test harness
vijayee Aug 30, 2026
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
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,9 @@
[submodule "deps/bcrypt"]
path = deps/bcrypt
url = https://github.com/rg3/bcrypt
[submodule "deps/libqrencode"]
path = deps/libqrencode
url = https://github.com/fukuchi/libqrencode.git
[submodule "deps/quirc"]
path = deps/quirc
url = https://github.com/dlbeer/quirc.git
127 changes: 114 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.22)
project(offs C CXX)
project(offs LANGUAGES C CXX VERSION 0.1.0)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)

Expand Down Expand Up @@ -173,6 +173,10 @@ else()
endif()

add_library(offs STATIC ${C_SRC})
# Propagate the project version as OFFS_VERSION so version.h's default
# "0.0.0" is only a fallback for non-CMake builds. PUBLIC so consumers link
# the version metadata. Update update_actor.c:183 reads this at runtime.
target_compile_definitions(offs PUBLIC OFFS_VERSION="${PROJECT_VERSION}")
# Opt-in AddressSanitizer instrumentation of the offs library only (not the
# external deps: msquic/poll-dancer/libcbor are add_subdirectory/ExternalProject
# targets that inherit CMAKE_C_FLAGS, so setting /fsanitize=address globally
Expand All @@ -184,8 +188,37 @@ add_library(offs STATIC ${C_SRC})
# unaffected.
option(OFFS_ENABLE_ASAN "Instrument the offs library with AddressSanitizer (MSVC) for debugging" OFF)
if(OFFS_ENABLE_ASAN)
target_compile_options(offs PRIVATE /fsanitize=address /Z7)
if(MSVC)
target_compile_options(offs PRIVATE /fsanitize=address /Z7)
else()
# GCC/Clang: -fsanitize=address with -g for symbolicated stack traces.
# Scoping to the offs target (PRIVATE) keeps external deps uninstrumented,
# matching the MSVC policy above. The test executable must also enable ASan
# so the runtime is pulled in at link time — see OFFS_ENABLE_ASAN handling
# in test/CMakeLists.txt.
target_compile_options(offs PRIVATE -fsanitize=address -fno-omit-frame-pointer -g)
target_link_options(offs INTERFACE -fsanitize=address)
endif()
endif()

# Optional UndefinedBehaviorSanitizer and ThreadSanitizer (GCC/Clang only).
# These are OFF by default and have no MSVC equivalent in this build. TSan and
# ASan are mutually exclusive — do not enable both in the same build.
option(OFFS_ENABLE_UBSAN "Instrument the offs library with UndefinedBehaviorSanitizer (GCC/Clang)" OFF)
if(OFFS_ENABLE_UBSAN AND NOT MSVC)
target_compile_options(offs PRIVATE -fsanitize=undefined -fno-omit-frame-pointer -g)
target_link_options(offs INTERFACE -fsanitize=undefined)
endif()

option(OFFS_ENABLE_TSAN "Instrument the offs library with ThreadSanitizer (GCC/Clang). Mutually exclusive with OFFS_ENABLE_ASAN." OFF)
if(OFFS_ENABLE_TSAN AND NOT MSVC)
if(OFFS_ENABLE_ASAN)
message(FATAL_ERROR "OFFS_ENABLE_TSAN and OFFS_ENABLE_ASAN are mutually exclusive; enable only one.")
endif()
target_compile_options(offs PRIVATE -fsanitize=thread -fno-omit-frame-pointer -g)
target_link_options(offs INTERFACE -fsanitize=thread)
endif()

# Release manifest signature verification: the ed25519 public key (PEM) used by
# update_verify_manifest to verify signed release manifests. Pass a path to a
# PEM file at configure time; the contents are embedded as a C string literal
Expand Down Expand Up @@ -357,23 +390,91 @@ else()
message(FATAL_ERROR "OpenSSL not found.")
endif()

# libqrencode for QR code generation (optional)
find_package(PkgConfig QUIET)
if(PkgConfig_FOUND)
pkg_check_modules(QRENCODE QUIET libqrencode)
# libqrencode — QR encoder, vendored submodule (deps/libqrencode). Required:
# QR peer-info generation is a first-class client-API feature, not an optional
# extra, so a missing submodule is a loud error like deps/bcrypt. Built
# without PNG support and without CLI tools — only the core encoder is used,
# via src/QR/qr.c (added by the next task).
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/deps/libqrencode/CMakeLists.txt)
set(WITH_TOOLS OFF CACHE BOOL "" FORCE)
set(WITH_TESTS OFF CACHE BOOL "" FORCE)
set(WITHOUT_PNG ON CACHE BOOL "" FORCE)
# libqrencode turns its own tests back on whenever BUILD_TESTING is set
# (its CMakeLists does `if(BUILD_TESTING) set(WITH_TESTS ON)`), which would
# defeat the WITH_TESTS=OFF above and register ctest entries for binaries
# that are never built. Shadow BUILD_TESTING with a plain directory-scoped
# variable just for this add_subdirectory — the cache value the project's
# own test suite (test/CMakeLists.txt) depends on stays untouched.
set(_OFFS_QRENCODE_BUILD_TESTING ${BUILD_TESTING})
set(BUILD_TESTING OFF)
add_subdirectory(deps/libqrencode EXCLUDE_FROM_ALL)
set(BUILD_TESTING ${_OFFS_QRENCODE_BUILD_TESTING})
unset(_OFFS_QRENCODE_BUILD_TESTING)
target_include_directories(offs PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/deps/libqrencode)
target_link_libraries(offs PRIVATE qrencode)
else()
message(FATAL_ERROR "deps/libqrencode submodule missing. Run: git submodule update --init --recursive")
endif()
if(QRENCODE_FOUND)
target_compile_definitions(offs PRIVATE HAS_QRENCODE)
target_include_directories(offs PRIVATE ${QRENCODE_INCLUDE_DIRS})
target_link_libraries(offs PRIVATE ${QRENCODE_LIBRARIES})
message(STATUS "libqrencode found — QR code generation enabled")

# quirc — QR decoder, vendored submodule (deps/quirc). Upstream ships no
# CMakeLists.txt (Makefile-only, see deps/quirc/Makefile LIB_OBJ), so compile
# its four decoder sources (quirc.c, decode.c, identify.c, version_db.c)
# directly into a static library. Only decode is used (via src/QR/qr.c).
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/deps/quirc/lib/quirc.c)
add_library(quirc STATIC
deps/quirc/lib/quirc.c
deps/quirc/lib/decode.c
deps/quirc/lib/identify.c
deps/quirc/lib/version_db.c)
target_include_directories(quirc PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/deps/quirc/lib)
# The default QUIRC_MAX_REGIONS=254 is too small for dense version-40 QR
# codes (one region per isolated module): the region budget is exhausted
# before the bottom-left finder pattern is labeled, making large payloads
# undecodable. 65000 is near quirc's documented ceiling (65534); pixel type
# widens beyond 8-bit automatically (16-bit for limits below UINT16_MAX).
target_compile_definitions(quirc PRIVATE QUIRC_MAX_REGIONS=65000)
if(NOT MSVC)
# identify.c uses rint/sqrt; MSVC's CRT provides both intrinsically.
target_link_libraries(quirc PUBLIC m)
endif()
if(MSVC)
# Silence size-conversion warnings in vendored code, matching the bcrypt target's policy.
target_compile_options(quirc PRIVATE /W0)
endif()
target_link_libraries(offs PRIVATE quirc)
else()
message(STATUS "libqrencode not found — QR code generation disabled")
message(FATAL_ERROR "deps/quirc submodule missing. Run: git submodule update --init --recursive")
endif()

add_subdirectory(src/Platform)
add_subdirectory(src/Network/Relay)
add_subdirectory(tools/offs-ca)
add_subdirectory(tools/offs-release-sign)
add_subdirectory(test)
add_subdirectory(examples)
add_subdirectory(examples)

# ---------------------------------------------------------------------------
# Install / packaging
# ---------------------------------------------------------------------------
# Public client API headers — the installed surface of liboffs. Keep this
# list explicit (not a glob) so an accidental header addition does not become
# part of the installed API.
set(OFFS_PUBLIC_HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/src/ClientLibs/c/offs_client.h
${CMAKE_CURRENT_SOURCE_DIR}/src/ClientLibs/c/offs_ofd_resolver.h
)

include(GNUInstallDirs)
install(TARGETS offs
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(FILES ${OFFS_PUBLIC_HEADERS}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/offs)

# Generate a pkg-config file so downstream consumers can do
# pkg-config --cflags --libs offs
# The .pc.in template is configured with the install dirs and version.
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/offs.pc.in"
"${CMAKE_CURRENT_BINARY_DIR}/offs.pc" @ONLY)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/offs.pc"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
1 change: 1 addition & 0 deletions deps/libqrencode
Submodule libqrencode added at 715e29
1 change: 1 addition & 0 deletions deps/quirc
Submodule quirc added at 927d68
Loading
Loading