The chooser runs before ScopeModel exists, so declining costs no buffer and no socket. UDPSCOPE_PROBE_SOURCES=1 prints what the discovery found and exits, before gtk_init(), so the list is checkable with no display.
48 lines
1.8 KiB
C++
48 lines
1.8 KiB
C++
// SPDX-License-Identifier: MIT
|
|
// SPDX-FileCopyrightText: 2026 Martino Ferrari
|
|
|
|
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <string>
|
|
|
|
namespace udpscope {
|
|
|
|
/// Everything the command line can say. Defaults are the ones the spec names
|
|
/// (200 MB per buffer, 10 ms trigger hold-off) unless the user overrides them.
|
|
struct Config {
|
|
std::string server = "127.0.0.1"; ///< IPv4 dotted quad of the stream source.
|
|
std::uint16_t port = 8000; ///< UDP port (unicast) or TCP port (multicast).
|
|
std::string multicast; ///< Empty selects unicast.
|
|
std::string interface_addr; ///< Local IPv4 to join the group on; empty = default route.
|
|
|
|
/// Whether `--server` was given. Absent, the application asks which source to open rather
|
|
/// than silently taking the default above -- so this is "did the user choose", not "is
|
|
/// `server` valid". The default stays a usable value for every other path.
|
|
bool server_specified = false;
|
|
|
|
/// Size of *each* of the two sample buffers, in megabytes. The application
|
|
/// always allocates two identical buffers (spec item 1).
|
|
double buffer_mb = 200.0;
|
|
|
|
/// Largest time window the toolbar offers, in seconds. The buffer partition is
|
|
/// sized to hold at least this much time (spec: decimation).
|
|
double max_window_s = 600.0;
|
|
|
|
double trigger_holdoff_s = 0.010;
|
|
int recv_buffer_bytes = 8 * 1024 * 1024;
|
|
|
|
/// Number of stacked plots (rows) to start with, 1..`RowSet::kMaxRows`. Only the
|
|
/// starting point: rows are added and removed from the layout editor.
|
|
int plots = 1;
|
|
};
|
|
|
|
/// Parses argv. On `--help` prints usage to stdout and exits(0); on a bad
|
|
/// argument prints a diagnostic to stderr and exits(2).
|
|
Config parse_args(int argc, char** argv);
|
|
|
|
/// Writes the usage text to `out`.
|
|
void print_usage(std::FILE* out, const char* argv0);
|
|
|
|
} // namespace udpscope
|