STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
fsw::net Namespace Reference

Namespaces

namespace  anonymous_namespace{DaqInterface.cpp}

Classes

struct  DaqBindResult
 Which local NIC board traffic leaves from. More...

Functions

DaqBindResult resolveDaqBindAddress (const ::fsw::config::Config &cfg, const char *who)
 Decide which local address board traffic should leave from, and log the decision.
bool bindToDaqInterface (int sock, const std::string &address, const char *who)
 bind() an already-created socket to address on an ephemeral port.

Function Documentation

◆ bindToDaqInterface()

bool fsw::net::bindToDaqInterface ( int sock,
const std::string & address,
const char * who )

bind() an already-created socket to address on an ephemeral port.

A no-op returning true for "0.0.0.0" or "", so callers need no special case for the dev path. Logs and returns false on failure.

Definition at line 188 of file DaqInterface.cpp.

Referenced by anonymous_namespace{ota_service_main.cpp}::flashFirmware(), fsw::control::ControllerService::initialize(), main(), main(), and sequencer::AbortBroadcaster::sendPacket().

◆ resolveDaqBindAddress()

DaqBindResult fsw::net::resolveDaqBindAddress ( const ::fsw::config::Config & cfg,
const char * who )

Decide which local address board traffic should leave from, and log the decision.

  1. [network].bind_ip set to something other than 0.0.0.0 — use it verbatim. If it cannot be bound, return ok=false. An explicit pin that silently degrades to 0.0.0.0 is this bug wearing a config key.
  2. Otherwise auto-detect: the local IPv4 interface whose subnet contains the configured board addresses. Exactly one match is the normal case, on the rig and under the sim (whose boards are 127.0.0.x, matched by loopback's /8).
  3. More than one match — return ok=false, naming the candidates. Ambiguity is the defect; picking one is how we got here.
  4. No match — 0.0.0.0 with a warning. This is a dev laptop or CI, where the board subnet does not exist and hard-failing would break ./dev.sh.
Parameters
whoService name for log lines, e.g. "Sequencer".

Definition at line 85 of file DaqInterface.cpp.

References b, and r.

Referenced by sequencer::SequencerService::applyConfig(), main(), and main().