File stream.h¶
FileList > inc > stream > stream.h
Go to the source code of this file
Streaming API for doppler — PUB/SUB, PUSH/PULL, REQ/REP. More...
#include <complex.h>#include <stddef.h>#include <stdint.h>#include "clib_common.h"#include "dp_interrupt.h"#include "dp_format.h"
Classes¶
| Type | Name |
|---|---|
| struct | dp_chunk_t Reassembly geometry, present only when DP_FLAG_CHUNKED . |
| struct | dp_header_t Frame metadata carried in every stream message. |
Detailed Description¶
Provides NATS-backed signal streaming using three messaging patterns:
| Pattern | Sender function | Receiver function | Use case |
|---|---|---|---|
| PUB/SUB | dp_pub_* | dp_sub_* | Fan-out broadcast |
| PUSH/PULL | dp_push_* | dp_pull_* | Pipeline load-balance |
| REQ/REP | dp_req_* | dp_rep_* | Control metadata |
Requires a running nats-server (nats-server -js for the PUSH/PULL JetStream work-queue tier). An endpoint is "nats://host:port[/subject]"; the subject defaults to "default" if omitted.
Quick start (C)¶
#include "stream/stream.h"
// Transmitter
dp_pub_t *pub = dp_pub_create("nats://127.0.0.1:4222/iq", CF64);
double _Complex samples[1024] = { ... };
dp_pub_send_cf64(pub, samples, 1024, 1e6, 2.4e9);
dp_pub_destroy(pub);
// Receiver (zero-copy)
dp_sub_t *sub = dp_sub_create("nats://127.0.0.1:4222/iq");
dp_msg_t *msg; dp_header_t hdr;
dp_sub_recv(sub, &msg, &hdr);
double _Complex *cf64 = (double _Complex *)dp_msg_data(msg);
size_t n = dp_msg_num_samples(msg);
// use cf64[0..n-1] ...
dp_msg_free(msg);
dp_sub_destroy(sub);
The documentation for this class was generated from the following file native/inc/stream/stream.h