From bee7bdaa70286dfa4247490957c622b6eb64a539 Mon Sep 17 00:00:00 2001 From: evgeny Date: Sun, 11 Oct 2026 13:17:37 +0200 Subject: [PATCH] Expose stream load and network APIs with C linkage --- src/stream/stream_load.h | 7 +++++++ src/stream/stream_network.h | 7 +++++++ src/stream/stream_wire.h | 7 +++++++ 3 files changed, 21 insertions(+) diff --git a/src/stream/stream_load.h b/src/stream/stream_load.h index 65ef5355..ca116381 100644 --- a/src/stream/stream_load.h +++ b/src/stream/stream_load.h @@ -7,6 +7,10 @@ #include "stream_proto.h" +#ifdef __cplusplus +extern "C" { +#endif + #define STREAM_LOAD_PERIOD_MS 200 #define STREAM_LOAD_HISTORY 50 #define STREAM_LOAD_CONFIRM_MS 500 @@ -38,4 +42,7 @@ int stream_load_add(struct stream_load *load, uint64_t packets, uint64_t bytes); int stream_load_remove(struct stream_load *load, uint64_t packets, uint64_t bytes, int sent); void stream_load_changed(struct stream_load *load); int stream_load_poll(struct stream_load *load, uint64_t now_ms, uint64_t oldest_age_ms, struct stream_load_snapshot *snapshot); +#ifdef __cplusplus +} +#endif #endif diff --git a/src/stream/stream_network.h b/src/stream/stream_network.h index 30a88d54..bc6eba7f 100644 --- a/src/stream/stream_network.h +++ b/src/stream/stream_network.h @@ -9,6 +9,10 @@ #include "stream_wire.h" #include "stream_load.h" +#ifdef __cplusplus +extern "C" { +#endif + struct stream_network; struct STREAM_RECEIVE; enum stream_receive_state { STREAM_RECEIVE_CONNECTING, STREAM_RECEIVE_INFO, STREAM_RECEIVE_REQUESTED, @@ -47,4 +51,7 @@ void stream_network_cancel(struct stream_network *network, const struct stream_d void stream_network_membership_changed(struct stream_network *network, uint64_t node_id, const char *channel); void stream_network_cache_event(struct stream_network *network, const struct stream_descriptor *descriptor, const uint8_t *wire, size_t length, int added); +#ifdef __cplusplus +} +#endif #endif diff --git a/src/stream/stream_wire.h b/src/stream/stream_wire.h index 5e67330c..0b9f4532 100644 --- a/src/stream/stream_wire.h +++ b/src/stream/stream_wire.h @@ -6,6 +6,10 @@ #include "stream_proto.h" #include "stream_metrics.h" +#ifdef __cplusplus +extern "C" { +#endif + #define STREAM_WIRE_VERSION 2 #define STREAM_WIRE_HEADER 52 #define STREAM_PATH_MAX 32 @@ -48,4 +52,7 @@ int stream_metric_read(const uint8_t *wire, struct stream_metric_snapshot *snaps int stream_end_sign(const struct stream_descriptor *descriptor, uint64_t last, const uint8_t key[32], uint8_t wire[STREAM_END_SIZE]); int stream_end_verify(const struct stream_descriptor *descriptor, const uint8_t key[32], const uint8_t *wire, size_t length, uint64_t *last); +#ifdef __cplusplus +} +#endif #endif