fixed bug in attaching nics to hosts, changed documentation format and generator (buggy but usable)

This commit is contained in:
2025-09-14 00:40:53 -04:00
parent 9ab64e18a4
commit c4141cd683
40 changed files with 5223 additions and 577 deletions

View File

@@ -1,9 +1,15 @@
# core/error.h
## Free functions
### `std::mutex &error_mutex() noexcept;`
### `inline T&& show(std::string_view name, T&& value) noexcept { ... }`
### `std::lock_guard<std::mutex> lock(error_mutex());`
### `inline T&& eval_and_show(std::string_view expr, T&& value) noexcept { ... }`
### `std::lock_guard<std::mutex> lock(error_mutex());`
## `dofs::log_error`
`void log_error(std::string_view type, std::string_view message, std::optional<uint64_t> timestamp = std::nullopt) noexcept;`
## `DOFS_ERROR`
`#define DOFS_ERROR(TYPE, MSG)`
## `DOFS_ERROR_ST`
`#define DOFS_ERROR_ST(TYPE, SRC, MSG, TS)`
## `DOFS_ERROR_T`
`#define DOFS_ERROR_T(TYPE, MSG, TS)`
## `DOFS_EVAL`
`#define DOFS_EVAL(EXPR)`
## `DOFS_SHOW`
`#define DOFS_SHOW(VAR)`
## `FORMAT`
`#define FORMAT(VAR)`

View File

@@ -1,10 +1,32 @@
# core/host.h
## `Host::Host`
`Host(Simulator *const sim, NodeId id) noexcept`
## class NetworkNic — public interface
Binds a host to a simulator under the `NodeId` id.
### `Host(Simulator *const sim, NodeId id) noexcept;`
### `virtual ~Host() = default;`
### `NetworkNic *nic() const noexcept { ... }`
### `void attach_nic(NetworkNic* nic) noexcept;`
### `void detach_nic(NetworkNic* nic) noexcept;`
### `Host(const Host &) = delete;`
## `Host::Host`
`Host(const Host &) = delete`
Binds a host to a simulator under the `NodeId` id.
## `Host::attach_nic`
`void attach_nic(NetworkNic *nic) noexcept`
Attaches a `NetworkNic` to the host.
## `Host::detach_nic`
`void detach_nic(NetworkNic *nic) noexcept`
Detaches a `NetworkNic` to the host.
## `Host::nic`
`NetworkNic *nic() const noexcept`
## `Host::operator=`
`Host &operator=(const Host &) = delete`
## `Host::recv_flow`
`virtual void recv_flow(NodeId src, FlowId flow, FlowPriority priority, Bytes flow_size) = 0`
## `Host::recv_frame`
`virtual void recv_frame(const Packet &frame) = 0`
## `Host::recv_mgmt_msg`
`virtual void recv_mgmt_msg(std::unique_ptr<struct MgmtMsg> msg) = 0`
## `Host::~Host`
`virtual ~Host() = default`

View File

@@ -1,13 +1,31 @@
# core/logger.h
## class Logger — public interface
### `Logger(std::string_view path, bool append) noexcept;`
### `~Logger() noexcept;`
### `Logger(const Logger &) = delete;`
### `Logger(Logger &&) = delete;`
### `bool is_open() const noexcept { ... }`
### `void write_line(std::string_view line) noexcept;`
### `void flush() noexcept;`
### `void close() noexcept;`
### `std::string_view path() const noexcept { ... }`
## `Logger::Logger`
`Logger(Logger &&) = delete`
## `Logger::Logger`
`Logger(const Logger &) = delete`
## `Logger::Logger`
`Logger(std::string_view path, bool append) noexcept`
## `Logger::close`
`void close() noexcept`
## `Logger::flush`
`void flush() noexcept`
## `Logger::is_open`
`bool is_open() const noexcept`
## `Logger::operator=`
`Logger &operator=(Logger &&) = delete`
## `Logger::operator=`
`Logger &operator=(const Logger &) = delete`
## `Logger::path`
`std::string_view path() const noexcept`
## `Logger::write_line`
`void write_line(std::string_view line) noexcept`
## `Logger::~Logger`
`~Logger() noexcept`
## `dofs::close`
`void close() noexcept;`
## `dofs::flush`
`void flush() noexcept;`
## `dofs::write_line`
`void write_line(std::string_view line) noexcept;`
## `open`
`private: bool open(std::ios::openmode mode) noexcept;`

View File

@@ -1,13 +1,21 @@
# core/node.h
## class Node — public interface
### `Node(Simulator *const sim, NodeId id, NodeType type) noexcept;`
### `virtual ~Node() = default;`
### `NodeId id() const noexcept;`
### `NodeStatus status() const noexcept;`
### `NodeType type() const noexcept;`
### `void set_status(NodeStatus s) noexcept;`
### `void boot(Time boottime_ns);`
### `void reboot(Time boottime_ns);`
### `Node(const Node &) = delete;`
## `Node::Node`
`Node(Simulator *const sim, NodeId id, NodeType type) noexcept`
## `Node::Node`
`Node(const Node &) = delete`
## `Node::boot`
`void boot(Time boottime_ns)`
## `Node::id`
`NodeId id() const noexcept`
## `Node::operator=`
`Node &operator=(const Node &) = delete`
## `Node::reboot`
`void reboot(Time boottime_ns)`
## `Node::set_status`
`void set_status(NodeStatus s) noexcept`
## `Node::status`
`NodeStatus status() const noexcept`
## `Node::type`
`NodeType type() const noexcept`
## `Node::~Node`
`virtual ~Node() = default`

View File

@@ -1,16 +1,45 @@
# core/rng.h
## class Rng — public interface
### `: _eng(seed) { ... }`
### `void seed(seed_type s) noexcept { ... }`
### `_eng.seed(s);`
### `double uniform01() { ... }`
### `Int uniform_range(Int lo_inclusive, Int hi_exclusive) { ... }`
### `Int uniform_range(Int hi_exclusive) { ... }`
### `double uniform_range(double lo_inclusive, double hi_exclusive) { ... }`
### `std::uint64_t poisson(double lambda) { ... }`
### `T choose_weighted(const std::vector<std::pair<double, T>>& items) { ... }`
### `return choose_weighted_impl(items.begin(), items.end());`
### `T choose_weighted(std::initializer_list<std::pair<double, T>> items) { ... }`
### `return choose_weighted_impl(items.begin(), items.end());`
## `Rng::Rng`
`explicit Rng(seed_type seed = default_seed()) noexcept : _eng(seed)`
## `Rng::choose_weighted`
`template<typename T> template<typename T> T choose_weighted(const std::vector<std::pair<double, T>> &items)`
## `Rng::choose_weighted`
`template<typename T> template<typename T> T choose_weighted(std::initializer_list<std::pair<double, T>> items)`
## `Rng::poisson`
`std::uint64_t poisson(double lambda)`
## `Rng::seed`
`void seed(seed_type s) noexcept`
## `Rng::uniform01`
`double uniform01()`
## `Rng::uniform_range`
`double uniform_range(double lo_inclusive, double hi_exclusive)`
## `Rng::uniform_range`
`template<typename Int,
typename = std::enable_if_t<std::is_integral<Int>::value>> template<typename Int, typename = std::enable_if_t<std::is_integral<Int>::value>> Int uniform_range(Int hi_exclusive)`
## `Rng::uniform_range`
`template<typename Int,
typename = std::enable_if_t<std::is_integral<Int>::value>> template<typename Int, typename = std::enable_if_t<std::is_integral<Int>::value>> Int uniform_range(Int lo_inclusive, Int hi_exclusive)`
## `choose_weighted`
`template <typename T> T choose_weighted(const std::vector<std::pair<double, T>> &items){`
## `choose_weighted`
`template <typename T> T choose_weighted(std::initializer_list<std::pair<double, T>> items){`
## `choose_weighted_impl`
`return choose_weighted_impl(items.begin(), items.end());`
## `choose_weighted_impl`
`return choose_weighted_impl(items.begin(), items.end());`
## `choose_weighted_impl`
`template <typename Iter> auto choose_weighted_impl(Iter first, Iter last) -> typename std::iterator_traits<Iter>::value_type::second_type{`
## `default_seed`
`static constexpr seed_type default_seed() noexcept{`
## `dofs::seed`
`void seed(seed_type s) noexcept{`
## `poisson`
`std::uint64_t poisson(double lambda){`
## `uniform01`
`double uniform01(){`
## `uniform_range`
`Int uniform_range(Int hi_exclusive){`
## `uniform_range`
`Int uniform_range(Int lo_inclusive, Int hi_exclusive){`
## `uniform_range`
`double uniform_range(double lo_inclusive, double hi_exclusive){`

View File

@@ -1,27 +1,49 @@
# core/simulator.h
## Free functions
### `std::numeric_limits<InstanceId>::max();`
### `std::numeric_limits<LinkId>::max();`
## class Rng — public interface
### `Simulator() = default;`
### `static std::pair<InstanceId, Simulator *> create_simulator(InstanceId id);`
### `static Simulator *get_simulator(InstanceId id) noexcept;`
### `Time now() const noexcept;`
### `EventId schedule_at(Time abs_time, F&& f, Args&&... args) { ... }`
### `_event_pq.push(std::move(it));`
### `EventId schedule_after(Time delay, F&& f, Args&&... args) { ... }`
### `bool cancel(EventId id);`
### `bool run_next();`
### `void run_until(Time end_time);`
### `void lock() noexcept;`
### `bool is_locked() const noexcept { ... }`
### `void flush_after(Time grace) noexcept;`
### `Rng* create_rng(std::uint64_t seed);`
### `Rng* get_rng() noexcept;`
### `Rng const* get_rng() const noexcept;`
### `Link* get_link(LinkId id) noexcept;`
### `Link const* get_link(LinkId id) const noexcept;`
## `Simulator::Cmp::operator`
`bool operator()(const Item &a, const Item &b) const noexcept`
## `Simulator::Simulator`
`Simulator() = default`
## `Simulator::cancel`
`bool cancel(EventId id)`
## `Simulator::create_link`
`std::pair<LinkId, Link *> create_link(NetworkNode *a, PortId a_port, NetworkNode *b, PortId b_port, Time latency, double bandwidth_gbps)`
## `Simulator::create_rng`
`Rng *create_rng(std::uint64_t seed)`
## `Simulator::create_simulator`
`static std::pair<InstanceId, Simulator *> create_simulator(InstanceId id)`
## `Simulator::flush_after`
`void flush_after(Time grace) noexcept`
## `Simulator::get_link`
`Link *get_link(LinkId id) noexcept`
## `Simulator::get_link`
`Link const *get_link(LinkId id) const noexcept`
## `Simulator::get_rng`
`Rng *get_rng() noexcept`
## `Simulator::get_rng`
`Rng const *get_rng() const noexcept`
## `Simulator::get_simulator`
`static Simulator *get_simulator(InstanceId id) noexcept`
## `Simulator::is_locked`
`bool is_locked() const noexcept`
## `Simulator::lock`
`void lock() noexcept`
## `Simulator::now`
`Time now() const noexcept`
## `Simulator::run_next`
`bool run_next()`
## `Simulator::run_until`
`void run_until(Time end_time)`
## `Simulator::schedule_after`
`template<class F, class... Args> template<class F, class... Args> EventId schedule_after(Time delay, F&&f, Args&&... args)`
## `Simulator::schedule_at`
`template<class F, class... Args> template<class F, class... Args> EventId schedule_at(Time abs_time, F&&f, Args&&... args)`
## `cancel`
`bool cancel(EventId id);`
## `flush_after`
`void flush_after(Time grace) noexcept;`
## `lock`
`void lock() noexcept;`
## `run_next`
`bool run_next();`
## `run_until`
`void run_until(Time end_time);`

View File

@@ -1,36 +1,61 @@
# core/time.h
## Free functions
### `constexpr Time operator""_ns(unsigned long long v) noexcept { ... }`
### `return Time::from_ns(static_cast<Time::rep>(v));`
### `constexpr Time operator""_us(unsigned long long v) noexcept { ... }`
### `return Time::from_us(static_cast<Time::rep>(v));`
### `constexpr Time operator""_ms(unsigned long long v) noexcept { ... }`
### `return Time::from_ms(static_cast<Time::rep>(v));`
### `constexpr Time operator""_s (unsigned long long v) noexcept { ... }`
### `return Time::from_s (static_cast<Time::rep>(v));`
## class Time — public interface
### `constexpr Time() : _nsec(0) { ... }`
### `explicit constexpr Time(rep ns) : _nsec(ns) { ... }`
### `static constexpr Time from_ns(rep ns) noexcept { ... }`
### `return Time(ns);`
### `static constexpr Time from_us(rep us) noexcept { ... }`
### `return Time(us * 1000ULL);`
### `static constexpr Time from_ms(rep ms) noexcept { ... }`
### `return Time(ms * 1000ULL * 1000ULL);`
### `static constexpr Time from_s (rep s ) noexcept { ... }`
### `return Time(s * 1000ULL * 1000ULL * 1000ULL);`
### `constexpr rep ns() const noexcept { ... }`
### `constexpr rep count() const noexcept { ... }`
### `static constexpr rep us_to_ns(rep us) noexcept { ... }`
### `static constexpr rep ms_to_ns(rep ms) noexcept { ... }`
### `return Time(a._nsec + b._nsec);`
### `return Time(a._nsec * b._nsec);`
### `return safe_sub(a, b);`
### `if (a._nsec < b._nsec) { ... }`
### `return Time(a._nsec - b._nsec);`
### `constexpr Time unsafe_sub(Time t) const noexcept { ... }`
### `return Time(this->_nsec - t._nsec);`
## `Time`
`return Time(a._nsec * b._nsec);`
## `Time`
`return Time(a._nsec + b._nsec);`
## `Time`
`return Time(a._nsec - b._nsec);`
## `Time`
`return Time(ms * 1000ULL * 1000ULL);`
## `Time`
`return Time(ns);`
## `Time`
`return Time(s * 1000ULL * 1000ULL * 1000ULL);`
## `Time`
`return Time(this->_nsec - t._nsec);`
## `Time`
`return Time(us * 1000ULL);`
## `Time::Time`
`constexpr Time() : _nsec(0)`
## `Time::Time`
`explicit constexpr Time(rep ns) : _nsec(ns)`
## `Time::count`
`constexpr rep count() const noexcept`
## `Time::from_ms`
`static constexpr Time from_ms(rep ms) noexcept`
## `Time::from_ns`
`static constexpr Time from_ns(rep ns) noexcept`
## `Time::from_s`
`static constexpr Time from_s (rep s ) noexcept`
## `Time::from_us`
`static constexpr Time from_us(rep us) noexcept`
## `Time::ms_to_ns`
`static constexpr rep ms_to_ns(rep ms) noexcept`
## `Time::ns`
`constexpr rep ns() const noexcept`
## `Time::us_to_ns`
`static constexpr rep us_to_ns(rep us) noexcept`
## `_ms`
`constexpr Time operator _ms(unsigned long long v) noexcept{`
## `_ns`
`constexpr Time operator _ns(unsigned long long v) noexcept{`
## `_s`
`constexpr Time operator _s (unsigned long long v) noexcept{`
## `_us`
`constexpr Time operator _us(unsigned long long v) noexcept{`
## `from_ms`
`static constexpr Time from_ms(rep ms) noexcept{`
## `from_ns`
`static constexpr Time from_ns(rep ns) noexcept{`
## `from_s`
`static constexpr Time from_s (rep s ) noexcept{`
## `from_us`
`static constexpr Time from_us(rep us) noexcept{`
## `ms_to_ns`
`static constexpr rep ms_to_ns(rep ms) noexcept{`
## `safe_sub`
`friend constexpr std::optional<Time> safe_sub(Time a, Time b) noexcept{`
## `safe_sub`
`return safe_sub(a, b);`
## `us_to_ns`
`static constexpr rep us_to_ns(rep us) noexcept{`

View File

@@ -1,13 +1,13 @@
# core/timer.h
## class Timer — public interface
### `Timer() { ... }`
### `init();`
### `void init() noexcept { ... }`
### `_start = clock::now();`
### `Time start() const noexcept { ... }`
### `auto tp = _start.time_since_epoch();`
### `Time now() const noexcept { ... }`
### `auto tp = clock::now().time_since_epoch();`
### `Time elapsed() const noexcept { ... }`
## `Timer::Timer`
`Timer()`
## `Timer::elapsed`
`Time elapsed() const noexcept`
## `Timer::init`
`void init() noexcept`
## `Timer::now`
`Time now() const noexcept`
## `Timer::start`
`Time start() const noexcept`
## `dofs::init`
`void init() noexcept{`

View File

@@ -1,6 +1,3 @@
# core/types.h
## Free functions
### `inline IPv4Addr ipv4(NodeId n, PortId p) noexcept { ... }`
### `return (static_cast<uint32_t>(n) << 16) | static_cast<uint32_t>(p);`
## `dofs::ipv4`
`inline IPv4Addr ipv4(NodeId n, PortId p) noexcept{`

View File

@@ -1,19 +1,15 @@
# hosts/mgmt_msg.h
## class MgmtMsg — public interface
### `virtual ~MgmtMsg() = default;`
## class HeartbeatMsg — public interface
### `: subscriber_id(sid), status(st), generated_at(t) { ... }`
### `MgmtKind kind() const noexcept override { ... }`
## class JobFinishedMsg — public interface
### `: flow_id(fid), finished_at(t) { ... }`
### `MgmtKind kind() const noexcept override { ... }`
## class EndSimulationMsg — public interface
### `MgmtKind kind() const noexcept override { ... }`
## `EndSimulationMsg::kind`
`MgmtKind kind() const noexcept override`
## `HeartbeatMsg::HeartbeatMsg`
`explicit HeartbeatMsg(NodeId sid, NodeStatus st, Time t) noexcept : subscriber_id(sid), status(st), generated_at(t)`
## `HeartbeatMsg::kind`
`MgmtKind kind() const noexcept override`
## `JobFinishedMsg::JobFinishedMsg`
`explicit JobFinishedMsg(FlowId fid, Time t) noexcept : flow_id(fid), finished_at(t)`
## `JobFinishedMsg::kind`
`MgmtKind kind() const noexcept override`
## `MgmtMsg::kind`
`virtual MgmtKind kind() const noexcept = 0`
## `MgmtMsg::~MgmtMsg`
`virtual ~MgmtMsg() = default`

View File

@@ -1,20 +1,13 @@
# hosts/policies.h
## class PubBasePolicy — public interface
### `virtual ~PubBasePolicy() = default;`
## class PubRRPolicy — public interface
### `: _ranges(std::move(ranges)) { ... }`
### `validate_and_build();`
### `PacketGroups select_multicast_groups(PacketGroups update_groups_mask) override { ... }`
### `for (auto const& r : _ranges) { ... }`
## class SubBasePolicy — public interface
### `virtual ~SubBasePolicy() = default;`
## class SubDummyPolicy — public interface
### `~SubDummyPolicy() override = default;`
## `PubBasePolicy::select_multicast_groups`
`virtual PacketGroups select_multicast_groups(PacketGroups update_groups_mask) = 0`
## `PubBasePolicy::~PubBasePolicy`
`virtual ~PubBasePolicy() = default`
## `PubRRPolicy::PubRRPolicy`
`explicit PubRRPolicy(std::vector<ReplicaRange> ranges) : _ranges(std::move(ranges))`
## `PubRRPolicy::select_multicast_groups`
`PacketGroups select_multicast_groups(PacketGroups update_groups_mask) override`
## `group_present`
`static bool group_present(PacketGroups mask, uint32_t gid) noexcept{`
## `validate_and_build`
`void validate_and_build(){`

View File

@@ -1,10 +1,25 @@
# hosts/publisher.h
## class Publisher — public interface
### `void recv_update(Bytes size, PacketGroups update_groups_mask) noexcept;`
### `void set_status(NodeStatus s, Time new_latency = Time{}) noexcept;`
### `virtual void recv_mgmt_msg(MgmtMsgPtr msg) noexcept override;`
### `virtual void recv_frame(const Packet& frame) override;`
### `uint64_t updates_in() const noexcept { ... }`
### `uint64_t bytes_out() const noexcept { ... }`
## `Publisher::Pending::arm_staging_if_needed`
`void arm_staging_if_needed() noexcept`
## `Publisher::Pending::on_staging_timer`
`void on_staging_timer() noexcept`
## `Publisher::Publisher`
`Publisher(Simulator *sim, NodeId id, Time update_latency_base, std::unique_ptr<PubBasePolicy> policy, Time mgmt_latency) noexcept`
## `Publisher::bytes_out`
`uint64_t bytes_out() const noexcept`
## `Publisher::recv_flow`
`virtual void recv_flow(NodeId src, FlowId flow, FlowPriority prio, Bytes flow_size) override`
## `Publisher::recv_frame`
`virtual void recv_frame(const Packet &frame) override`
## `Publisher::recv_mgmt_msg`
`virtual void recv_mgmt_msg(MgmtMsgPtr msg) noexcept override`
## `Publisher::recv_update`
`void recv_update(Bytes size, PacketGroups update_groups_mask) noexcept`
## `Publisher::set_status`
`void set_status(NodeStatus s, Time new_latency = Time{}) noexcept`
## `Publisher::updates_in`
`uint64_t updates_in() const noexcept`
## `arm_staging_if_needed`
`void arm_staging_if_needed() noexcept;`
## `on_staging_timer`
`void on_staging_timer() noexcept;`

View File

@@ -1,8 +1,19 @@
# hosts/subscriber.h
## class Publisher — public interface
### `virtual void recv_mgmt_msg(MgmtMsgPtr msg) noexcept override;`
### `void recv_frame(const Packet& frame) override;`
### `void set_status(NodeStatus s) noexcept;`
### `void set_publisher(Publisher* p) noexcept { ... }`
## `Subscriber::Subscriber`
`Subscriber(Simulator *sim, NodeId id, Publisher *publisher, std::unique_ptr<SubBasePolicy> policy, Time mgmt_latency, Time heartbeat_period) noexcept`
## `Subscriber::recv_flow`
`void recv_flow(NodeId src, FlowId flow, FlowPriority prio, Bytes flow_size) override`
## `Subscriber::recv_frame`
`void recv_frame(const Packet &frame) override`
## `Subscriber::recv_mgmt_msg`
`virtual void recv_mgmt_msg(MgmtMsgPtr msg) noexcept override`
## `Subscriber::set_publisher`
`void set_publisher(Publisher *p) noexcept`
## `Subscriber::set_status`
`void set_status(NodeStatus s) noexcept`
## `dofs::on_heartbeat_timer`
`void on_heartbeat_timer() noexcept;`
## `dofs::schedule_next_heartbeat`
`void schedule_next_heartbeat(Time delay) noexcept;`
## `dofs::send_job_finished`
`void send_job_finished(FlowId flow) noexcept;`

3899
docs/index.json Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,19 +1,37 @@
# network/link.h
## class Link — public interface
### `void send_pkt(Packet &pkt, NodeId caller);`
### `void schedule_delivery_after(Packet &pkt, NodeId caller, Time after);`
### `Time next_available(NodeId sender) const noexcept;`
### `std::optional<Reservation> reserve(Bytes bytes, NodeId sender) noexcept;`
### `Time serialization_time(Bytes bytes) const noexcept { ... }`
### `return serialization_time(bytes, _bandwidth_gbps_cur);`
### `Time propagation_latency() const noexcept { ... }`
### `LinkId id() const noexcept { ... }`
### `LinkStatus status() const noexcept { ... }`
### `double bandwidth_gbps() const noexcept { ... }`
### `NodeId src_id() const noexcept { ... }`
### `NodeId dst_id() const noexcept { ... }`
### `PortId src_port() const noexcept { ... }`
### `PortId dst_port() const noexcept { ... }`
### `static Time serialization_time(Bytes bytes, double gbps) noexcept;`
## `Link::Link`
`Link(Simulator *const sim, LinkId id, NetworkNode *a, PortId a_port, NetworkNode *b, PortId b_port, Time latency, double bandwidth_gbps) noexcept`
## `Link::bandwidth_gbps`
`double bandwidth_gbps() const noexcept`
## `Link::dst_id`
`NodeId dst_id() const noexcept`
## `Link::dst_port`
`PortId dst_port() const noexcept`
## `Link::id`
`LinkId id() const noexcept`
## `Link::next_available`
`Time next_available(NodeId sender) const noexcept`
## `Link::propagation_latency`
`Time propagation_latency() const noexcept`
## `Link::reserve`
`std::optional<Reservation> reserve(Bytes bytes, NodeId sender) noexcept`
## `Link::schedule_delivery_after`
`void schedule_delivery_after(Packet &pkt, NodeId caller, Time after)`
## `Link::send_pkt`
`void send_pkt(Packet &pkt, NodeId caller)`
## `Link::serialization_time`
`Time serialization_time(Bytes bytes) const noexcept`
## `Link::serialization_time`
`static Time serialization_time(Bytes bytes, double gbps) noexcept`
## `Link::set_status`
`void set_status(LinkStatus s, Time new_latency = Time(0), double new_bandwidth_gbps = 0.0)`
## `Link::src_id`
`NodeId src_id() const noexcept`
## `Link::src_port`
`PortId src_port() const noexcept`
## `Link::status`
`LinkStatus status() const noexcept`
## `serialization_time`
`static Time serialization_time(Bytes bytes, double gbps) noexcept;`
## `set_status`
`void set_status(LinkStatus s, Time new_latency = Time(0), double new_bandwidth_gbps = 0.0);`

View File

@@ -1,11 +1,95 @@
# network/network_nic.h
## class NetworkNic — public interface
### `virtual void recv_pkt(Packet &pkt, PortId ingress) override;`
### `void attach_host(Host* host) noexcept;`
### `void detach_host(Host* host) noexcept;`
### `void set_status(NodeStatus s, Time new_latency = Time(0)) noexcept;`
### `const NicTelemetry &telemetry() const noexcept { ... }`
### `void set_port_blacklisted(PortId port, bool blacklisted) noexcept;`
### `bool is_port_blacklisted(PortId port) const noexcept;`
## `NicSchedulingWeights::NetworkNic::NetworkNic`
`NetworkNic(Simulator *const sim, NodeId id, uint16_t total_ports, SwitchBuffer *const buf, Time nic_latency, Bytes mice_elephant_threshold, PacketSeq ooo_threshold, CCType cc_type, LBType lb_type, Bytes cc_init_cwnd, Bytes cc_max_cwnd, const NicSchedulingWeights &schedw) noexcept`
## `NicSchedulingWeights::NetworkNic::PortQueues::enqueue_packet`
`void enqueue_packet(PortId port, QClass cls, Packet pkt) noexcept`
## `NicSchedulingWeights::NetworkNic::PortQueues::is_elephant`
`bool is_elephant(Bytes sz) const noexcept`
## `NicSchedulingWeights::NetworkNic::PortQueues::lookup_rtt_and_erase`
`bool lookup_rtt_and_erase(const Packet &ack_like, Time now, Time &out_rtt) noexcept`
## `NicSchedulingWeights::NetworkNic::PortQueues::make_ack_packet`
`Packet make_ack_packet(const Packet &rx_data, PortId ingress) noexcept`
## `NicSchedulingWeights::NetworkNic::PortQueues::make_data_packet`
`Packet make_data_packet(NodeId dst, PortId out_port, FlowPriority prio, FlowId fid, PacketSeq seq, Bytes payload) noexcept`
## `NicSchedulingWeights::NetworkNic::PortQueues::make_nack_packet`
`Packet make_nack_packet(NodeId peer, FlowId flow, PacketSeq miss, FlowPriority prio, PortId ingress) noexcept`
## `NicSchedulingWeights::NetworkNic::PortQueues::make_trim_back_response`
`Packet make_trim_back_response(const Packet &trim, PortId ingress) noexcept`
## `NicSchedulingWeights::NetworkNic::PortQueues::pick_next_qclass`
`bool pick_next_qclass(const PortQueues &pq, QClass &out_cls) const noexcept`
## `NicSchedulingWeights::NetworkNic::PortQueues::pick_src_port_for_flow`
`PortId pick_src_port_for_flow(NodeId dst) noexcept`
## `NicSchedulingWeights::NetworkNic::PortQueues::port_drain_task`
`void port_drain_task(PortId port) noexcept`
## `NicSchedulingWeights::NetworkNic::PortQueues::record_tx_timestamp`
`void record_tx_timestamp(const Packet &pkt) noexcept`
## `NicSchedulingWeights::NetworkNic::PortQueues::schedule_ack`
`void schedule_ack(const Packet &rx_data, PortId ingress) noexcept`
## `NicSchedulingWeights::NetworkNic::PortQueues::schedule_nack`
`void schedule_nack(NodeId peer, FlowId flow, PacketSeq missing_seq, FlowPriority prio, PortId ingress) noexcept`
## `NicSchedulingWeights::NetworkNic::PortQueues::schedule_port_if_needed`
`void schedule_port_if_needed(PortId port) noexcept`
## `NicSchedulingWeights::NetworkNic::PortQueues::schedule_trim_back_response`
`void schedule_trim_back_response(const Packet &trim, PortId ingress) noexcept`
## `NicSchedulingWeights::NetworkNic::PortQueues::start_tx_multicast`
`void start_tx_multicast(PacketGroups gmask, Bytes size, FlowPriority prio)`
## `NicSchedulingWeights::NetworkNic::PortQueues::start_tx_unicast`
`void start_tx_unicast(NodeId dst, Bytes size, FlowPriority prio)`
## `NicSchedulingWeights::NetworkNic::PortQueues::try_send_one`
`bool try_send_one(PortId port, QClass cls) noexcept`
## `NicSchedulingWeights::NetworkNic::PortQueues::txkey`
`static inline std::uint64_t txkey(FlowId f, PacketSeq s) noexcept`
## `NicSchedulingWeights::NetworkNic::attach_host`
`void attach_host(Host *host) noexcept`
## `NicSchedulingWeights::NetworkNic::detach_host`
`void detach_host(Host *host) noexcept`
## `NicSchedulingWeights::NetworkNic::is_port_blacklisted`
`bool is_port_blacklisted(PortId port) const noexcept`
## `NicSchedulingWeights::NetworkNic::recv_pkt`
`virtual void recv_pkt(Packet &pkt, PortId ingress) override`
## `NicSchedulingWeights::NetworkNic::send_flow`
`void send_flow(NodeId dst, Bytes size, FlowPriority desired = FlowPriority::AUTO)`
## `NicSchedulingWeights::NetworkNic::send_flow`
`void send_flow(PacketGroups group_mask, Bytes size, FlowPriority desired = FlowPriority::AUTO)`
## `NicSchedulingWeights::NetworkNic::set_port_blacklisted`
`void set_port_blacklisted(PortId port, bool blacklisted) noexcept`
## `NicSchedulingWeights::NetworkNic::set_status`
`void set_status(NodeStatus s, Time new_latency = Time(0)) noexcept`
## `NicSchedulingWeights::NetworkNic::telemetry`
`const NicTelemetry &telemetry() const noexcept`
## `enqueue_packet`
`void enqueue_packet(PortId port, QClass cls, Packet pkt) noexcept;`
## `lookup_rtt_and_erase`
`bool lookup_rtt_and_erase(const Packet &ack_like, Time now, Time &out_rtt) noexcept;`
## `make_ack_packet`
`Packet make_ack_packet(const Packet &rx_data, PortId ingress) noexcept;`
## `make_data_packet`
`Packet make_data_packet(NodeId dst, PortId out_port, FlowPriority prio, FlowId fid, PacketSeq seq, Bytes payload) noexcept;`
## `make_nack_packet`
`Packet make_nack_packet(NodeId peer, FlowId flow, PacketSeq miss, FlowPriority prio, PortId ingress) noexcept;`
## `make_trim_back_response`
`Packet make_trim_back_response(const Packet &trim, PortId ingress) noexcept;`
## `pick_src_port_for_flow`
`PortId pick_src_port_for_flow(NodeId dst) noexcept;`
## `port_drain_task`
`void port_drain_task(PortId port) noexcept;`
## `record_tx_timestamp`
`void record_tx_timestamp(const Packet &pkt) noexcept;`
## `schedule_ack`
`void schedule_ack(const Packet &rx_data, PortId ingress) noexcept;`
## `schedule_nack`
`void schedule_nack(NodeId peer, FlowId flow, PacketSeq missing_seq, FlowPriority prio, PortId ingress) noexcept;`
## `schedule_port_if_needed`
`void schedule_port_if_needed(PortId port) noexcept;`
## `schedule_trim_back_response`
`void schedule_trim_back_response(const Packet &trim, PortId ingress) noexcept;`
## `set_port_blacklisted`
`void set_port_blacklisted(PortId port, bool blacklisted) noexcept;`
## `start_tx_multicast`
`void start_tx_multicast(PacketGroups gmask, Bytes size, FlowPriority prio);`
## `start_tx_unicast`
`void start_tx_unicast(NodeId dst, Bytes size, FlowPriority prio);`
## `try_send_one`
`bool try_send_one(PortId port, QClass cls) noexcept;`
## `txkey`
`static inline std::uint64_t txkey(FlowId f, PacketSeq s) noexcept;`

View File

@@ -1,6 +1,7 @@
# network/network_node.h
## class NetworkNode — public interface
### `explicit NetworkNode(Simulator *const sim, NodeId id, NodeType type) noexcept;`
### `virtual ~NetworkNode() = default;`
## `NetworkNode::NetworkNode`
`explicit NetworkNode(Simulator *const sim, NodeId id, NodeType type) noexcept`
## `NetworkNode::recv_pkt`
`virtual void recv_pkt(Packet &pkt, PortId ingress) = 0`
## `NetworkNode::~NetworkNode`
`virtual ~NetworkNode() = default`

View File

@@ -1,9 +1,19 @@
# network/network_switch.h
## class NetworkSwitch — public interface
### `virtual void recv_pkt(Packet &pkt, PortId ingress) override;`
### `void set_status(NodeStatus s, Time new_forward_latency = Time(0)) noexcept;`
### `NodeStatus get_status() const noexcept { ... }`
### `return status();`
### `uint16_t port_cnt() const noexcept { ... }`
## `NetworkSwitch::NetworkSwitch`
`NetworkSwitch(Simulator *const sim, NodeId id, uint16_t total_ports, ECNEngine *const ecn, SwitchBuffer *const buf, const RoutingTables *const rt, Time forwarding_latency, Time multicast_dup_delay) noexcept`
## `NetworkSwitch::get_status`
`NodeStatus get_status() const noexcept`
## `NetworkSwitch::port_cnt`
`uint16_t port_cnt() const noexcept`
## `NetworkSwitch::recv_pkt`
`virtual void recv_pkt(Packet &pkt, PortId ingress) override`
## `NetworkSwitch::set_status`
`void set_status(NodeStatus s, Time new_forward_latency = Time(0)) noexcept`
## `enqueue_one`
`void enqueue_one(Packet pkt, PortId egress, FlowPriority prio) noexcept;`
## `forward_after_delay`
`private: void forward_after_delay(Packet pkt, PortId ingress) noexcept;`
## `group_bit_set`
`static inline bool group_bit_set(PacketGroups mask, std::size_t gid) noexcept;`
## `merge_sorted_unique`
`static void merge_sorted_unique(std::vector<PortId> &base, const std::vector<PortId> &add);`

View File

@@ -1,18 +1,21 @@
# network/nic/congestion_control.h
## class CongestionControl — public interface
### `explicit CongestionControl(Bytes init_cwnd, Bytes max_cwnd) noexcept;`
### `virtual ~CongestionControl() = default;`
### `Bytes cwnd() const noexcept { ... }`
### `Bytes cwnd_max() const noexcept { ... }`
## class DCQCN — public interface
### `explicit DCQCN(Bytes init_cwnd, Bytes max_cwnd) noexcept;`
### `virtual void update(const Packet& pkt, Time rtt) noexcept override;`
## class NSCC — public interface
### `explicit NSCC(Bytes init_cwnd, Bytes max_cwnd) noexcept;`
### `virtual void update(const Packet& pkt, Time rtt) noexcept override;`
## `CongestionControl::CongestionControl`
`explicit CongestionControl(Bytes init_cwnd, Bytes max_cwnd) noexcept`
## `CongestionControl::cwnd`
`Bytes cwnd() const noexcept`
## `CongestionControl::cwnd_max`
`Bytes cwnd_max() const noexcept`
## `CongestionControl::is_allowed_to_send`
`virtual bool is_allowed_to_send(Bytes bytes_outstanding, Bytes next_bytes) const noexcept`
## `CongestionControl::update`
`virtual void update(const Packet &pkt, Time rtt) noexcept = 0`
## `CongestionControl::~CongestionControl`
`virtual ~CongestionControl() = default`
## `DCQCN::DCQCN`
`explicit DCQCN(Bytes init_cwnd, Bytes max_cwnd) noexcept`
## `DCQCN::update`
`virtual void update(const Packet &pkt, Time rtt) noexcept override`
## `NSCC::NSCC`
`explicit NSCC(Bytes init_cwnd, Bytes max_cwnd) noexcept`
## `NSCC::update`
`virtual void update(const Packet &pkt, Time rtt) noexcept override`

View File

@@ -1,12 +1,15 @@
# network/nic/load_balance.h
## class LoadBalance — public interface
### `explicit LoadBalance(Rng *const rng) noexcept : _rng(rng) { ... }`
### `virtual ~LoadBalance() = default;`
## class LBRandomPacketSpraying — public interface
### `explicit LBRandomPacketSpraying(Rng *const rng) noexcept : LoadBalance(rng) { ... }`
### `virtual void update(const Packet& pkt) noexcept override;`
### `virtual uint16_t get_entropy(const Packet& context) noexcept override;`
## `LBRandomPacketSpraying::LBRandomPacketSpraying`
`explicit LBRandomPacketSpraying(Rng *const rng) noexcept : LoadBalance(rng)`
## `LBRandomPacketSpraying::get_entropy`
`virtual uint16_t get_entropy(const Packet &context) noexcept override`
## `LBRandomPacketSpraying::update`
`virtual void update(const Packet &pkt) noexcept override`
## `LoadBalance::LoadBalance`
`explicit LoadBalance(Rng *const rng) noexcept : _rng(rng)`
## `LoadBalance::get_entropy`
`virtual uint16_t get_entropy(const Packet &context) noexcept = 0`
## `LoadBalance::update`
`virtual void update(const Packet &pkt) noexcept = 0`
## `LoadBalance::~LoadBalance`
`virtual ~LoadBalance() = default`

View File

@@ -0,0 +1,2 @@
# network/nic/nic_telemetry.h
_No public API symbols found in this header._

View File

@@ -1,35 +1,65 @@
# network/packet.h
## class Packet — public interface
### `NodeId src_node() const noexcept;`
### `PortId src_port() const noexcept;`
### `NodeId dst_node() const noexcept;`
### `PortId dst_port() const noexcept;`
### `PacketProtocol protocol() const noexcept;`
### `PacketSeq seq() const noexcept;`
### `FlowId flow_id() const noexcept;`
### `uint32_t entropy() const noexcept;`
### `void set_src_node(NodeId n) noexcept;`
### `void set_src_port(PortId p) noexcept;`
### `void set_dst_node(NodeId n) noexcept;`
### `void set_dst_port(PortId p) noexcept;`
### `void set_seq(PacketSeq s) noexcept;`
### `void set_flow_id(FlowId f) noexcept;`
### `void set_entropy(uint32_t e) noexcept;`
### `void set_protocol(PacketProtocol p) noexcept;`
### `void set_payload_size(Bytes size) noexcept;`
### `void set_ecn_enabled(bool v) noexcept;`
### `void set_ecn_marked(bool v) noexcept;`
### `void set_eof(bool v) noexcept;`
### `bool is_ecn_enabled() const noexcept;`
### `bool is_ecn() const noexcept;`
### `bool is_eof() const noexcept;`
### `FlowPriority priority() const noexcept;`
### `uint8_t priority_raw() const noexcept;`
### `Bytes header_size() const noexcept;`
### `Bytes payload_size() const noexcept;`
### `Bytes total_size() const noexcept;`
### `PacketGroups groups() const noexcept;`
### `void set_groups(PacketGroups g) noexcept;`
### `void add_groups(PacketGroups gmask) noexcept;`
## `Packet::Packet`
`Packet(NodeId src_node, PortId src_port, NodeId dst_node, PortId dst_port, PacketProtocol proto, FlowPriority prio, PacketSeq seq = 0, FlowId flow = 0, uint16_t entropy = 0, uint8_t notifications = 0, Bytes payload_bytes = DEFAULT_MSS_BYTES) noexcept`
## `Packet::add_groups`
`void add_groups(PacketGroups gmask) noexcept`
## `Packet::dst_node`
`NodeId dst_node() const noexcept`
## `Packet::dst_port`
`PortId dst_port() const noexcept`
## `Packet::entropy`
`uint32_t entropy() const noexcept`
## `Packet::flow_id`
`FlowId flow_id() const noexcept`
## `Packet::groups`
`PacketGroups groups() const noexcept`
## `Packet::header_size`
`Bytes header_size() const noexcept`
## `Packet::is_ecn`
`bool is_ecn() const noexcept`
## `Packet::is_ecn_enabled`
`bool is_ecn_enabled() const noexcept`
## `Packet::is_eof`
`bool is_eof() const noexcept`
## `Packet::payload_size`
`Bytes payload_size() const noexcept`
## `Packet::priority`
`FlowPriority priority() const noexcept`
## `Packet::priority_raw`
`uint8_t priority_raw() const noexcept`
## `Packet::protocol`
`PacketProtocol protocol() const noexcept`
## `Packet::seq`
`PacketSeq seq() const noexcept`
## `Packet::set_dst_node`
`void set_dst_node(NodeId n) noexcept`
## `Packet::set_dst_port`
`void set_dst_port(PortId p) noexcept`
## `Packet::set_ecn_enabled`
`void set_ecn_enabled(bool v) noexcept`
## `Packet::set_ecn_marked`
`void set_ecn_marked(bool v) noexcept`
## `Packet::set_entropy`
`void set_entropy(uint32_t e) noexcept`
## `Packet::set_eof`
`void set_eof(bool v) noexcept`
## `Packet::set_flow_id`
`void set_flow_id(FlowId f) noexcept`
## `Packet::set_groups`
`void set_groups(PacketGroups g) noexcept`
## `Packet::set_payload_size`
`void set_payload_size(Bytes size) noexcept`
## `Packet::set_protocol`
`void set_protocol(PacketProtocol p) noexcept`
## `Packet::set_seq`
`void set_seq(PacketSeq s) noexcept`
## `Packet::set_src_node`
`void set_src_node(NodeId n) noexcept`
## `Packet::set_src_port`
`void set_src_port(PortId p) noexcept`
## `Packet::src_node`
`NodeId src_node() const noexcept`
## `Packet::src_port`
`PortId src_port() const noexcept`
## `Packet::total_size`
`Bytes total_size() const noexcept`

View File

@@ -1,5 +1,7 @@
# network/switch/dedicated_buffer.h
## class DedicatedBuffer — public interface
### `bool drain_one(PortId port) override;`
## `DedicatedBuffer::DedicatedBuffer`
`DedicatedBuffer(Simulator *const sim, NetworkSwitch *const owner, Bytes total_bytes, uint16_t ports)`
## `DedicatedBuffer::drain_one`
`bool drain_one(PortId port) override`
## `DedicatedBuffer::enqueue_packet`
`bool enqueue_packet(const Packet &pkt, PortId egress, FlowPriority prio) override`

View File

@@ -1,5 +1,7 @@
# network/switch/ecn_dedicated_red.h
## class DedicatedREDEngine — public interface
### `_rng(rng) { ... }`
## `DedicatedREDEngine::DedicatedREDEngine`
`DedicatedREDEngine(Bytes min_th, Bytes max_th, double p_max, bool back_to_sender, Rng *const rng) noexcept : _min_th(min_th), _max_th(max_th), _p_max(p_max), _back_to_sender(back_to_sender), _rng(rng)`
## `DedicatedREDEngine::process_packet`
`virtual Packet &process_packet(Packet &pkt, SwitchBuffer *buf) noexcept override`
## `dofs::ensure_size`
`private: void ensure_size(uint16_t port_cnt){`

View File

@@ -1,5 +1,7 @@
# network/switch/ecn_engine.h
## class SwitchBuffer — public interface
### `virtual ~ECNEngine() = default;`
## `ECNEngine::process_packet`
`virtual Packet &process_packet(Packet &pkt, SwitchBuffer *buf) noexcept = 0`
## `ECNEngine::~ECNEngine`
`virtual ~ECNEngine() = default`
## `dofs::header_trim`
`static inline void header_trim(Packet &pkt, bool back_to_sender) noexcept{`

View File

@@ -1,5 +1,13 @@
# network/switch/ecn_shared_red.h
## class SharedREDEngine — public interface
### `_avg_port_bytes() { ... }`
## `SharedREDEngine::SharedREDEngine`
`explicit SharedREDEngine(Rng *const rng = nullptr) noexcept : _rng(rng), _avg_total_bytes(0.0), _avg_port_bytes()`
## `SharedREDEngine::process_packet`
`virtual Packet &process_packet(Packet &pkt, SwitchBuffer *buf) noexcept override`
## `dofs::ensure_size`
`private: void ensure_size(uint16_t port_cnt){`
## `is_ctrl`
`static inline bool is_ctrl(const Packet &p) noexcept{`
## `is_ele`
`static inline bool is_ele (const Packet &p) noexcept{`
## `is_mice`
`static inline bool is_mice(const Packet &p) noexcept{`

View File

@@ -1,15 +1,23 @@
# network/switch/multicast_table.h
## class MulticastTable — public interface
### `MulticastTable();`
### `bool add_tree(std::size_t group_id, uint16_t tree_id);`
### `bool delete_tree(std::size_t group_id, uint16_t tree_id);`
### `bool add_child_port(std::size_t group_id, uint16_t tree_id, PortId out_port);`
### `bool delete_child_port(std::size_t group_id, uint16_t tree_id, PortId out_port);`
### `bool set_parent(std::size_t group_id, uint16_t tree_id, PortId parent);`
### `bool set_weight(std::size_t group_id, uint16_t tree_id, uint8_t w);`
### `bool set_epoch(std::size_t group_id, uint16_t tree_id, uint8_t epoch);`
### `const std::vector<McTree> *trees_of(std::size_t group_id) const;`
### `std::size_t group_count() const noexcept;`
### `std::vector<PortId> get_port_list(PacketGroups groups) const;`
## `McTree::MulticastTable::MulticastTable`
`MulticastTable()`
## `McTree::MulticastTable::add_child_port`
`bool add_child_port(std::size_t group_id, uint16_t tree_id, PortId out_port)`
## `McTree::MulticastTable::add_tree`
`bool add_tree(std::size_t group_id, uint16_t tree_id)`
## `McTree::MulticastTable::delete_child_port`
`bool delete_child_port(std::size_t group_id, uint16_t tree_id, PortId out_port)`
## `McTree::MulticastTable::delete_tree`
`bool delete_tree(std::size_t group_id, uint16_t tree_id)`
## `McTree::MulticastTable::get_port_list`
`std::vector<PortId> get_port_list(PacketGroups groups) const`
## `McTree::MulticastTable::group_count`
`std::size_t group_count() const noexcept`
## `McTree::MulticastTable::set_epoch`
`bool set_epoch(std::size_t group_id, uint16_t tree_id, uint8_t epoch)`
## `McTree::MulticastTable::set_parent`
`bool set_parent(std::size_t group_id, uint16_t tree_id, PortId parent)`
## `McTree::MulticastTable::set_weight`
`bool set_weight(std::size_t group_id, uint16_t tree_id, uint8_t w)`
## `McTree::MulticastTable::trees_of`
`const std::vector<McTree> *trees_of(std::size_t group_id) const`

View File

@@ -0,0 +1,7 @@
# network/switch/routing_alg.h
## `dofs::hash_ecmp`
`PortId hash_ecmp(NodeId src_node, PortId src_port, NodeId dst_node, PortId dst_port, uint32_t differentiator, uint16_t port_count) noexcept;`
## `dofs::hash_ecmp`
`inline PortId hash_ecmp(NodeId src_node, NodeId dst_node, uint32_t differentiator, uint16_t port_count) noexcept{`
## `dofs::hash_ecmp`
`return hash_ecmp(src_node, static_cast<PortId>(0), dst_node, static_cast<PortId>(0), differentiator, port_count);`

View File

@@ -0,0 +1,2 @@
# network/switch/routing_tables.h
_No public API symbols found in this header._

View File

@@ -1,5 +1,7 @@
# network/switch/shared_buffer.h
## class SharedBuffer — public interface
### `virtual bool drain_one(PortId port) override;`
## `SharedBuffer::SharedBuffer`
`SharedBuffer(Simulator *const sim, NetworkSwitch *const owner, Bytes total_bytes, uint16_t ports)`
## `SharedBuffer::drain_one`
`virtual bool drain_one(PortId port) override`
## `SharedBuffer::enqueue_packet`
`virtual bool enqueue_packet(const Packet &pkt, PortId egress, FlowPriority prio) override`

View File

@@ -1,19 +1,65 @@
# network/switch/switch_buffer.h
## class NetworkSwitch — public interface
### `virtual ~SwitchBuffer() = default;`
### `Bytes buffer_size() const noexcept;`
### `SwitchBufferType type() const noexcept;`
### `uint16_t port_cnt() const noexcept;`
### `Bytes port_buffered(PortId p) const noexcept;`
### `const std::vector<Bytes> &ports_buffered() const noexcept;`
### `uint8_t share_ctrl() const noexcept;`
### `uint8_t share_mice() const noexcept;`
### `uint8_t share_elephant() const noexcept;`
### `void set_share_ctrl(uint8_t pct) noexcept;`
### `void set_share_mice(uint8_t pct) noexcept;`
### `void set_share_elephant(uint8_t pct) noexcept;`
### `const Simulator *simulator() const noexcept;`
### `const NetworkSwitch *owner() const noexcept;`
### `void set_egress_links(const std::vector<Link*> &links);`
## `SwitchBuffer::PerPortSched::drain_once`
`void drain_once(PortId port)`
## `SwitchBuffer::PerPortSched::drain_one_common`
`bool drain_one_common(PortId port)`
## `SwitchBuffer::PerPortSched::on_dequeue_commit`
`virtual void on_dequeue_commit(PortId port, Bytes sz) = 0`
## `SwitchBuffer::PerPortSched::on_enqueue_cap_check`
`virtual bool on_enqueue_cap_check(PortId port, Bytes sz) = 0`
## `SwitchBuffer::PerPortSched::on_enqueue_commit`
`virtual void on_enqueue_commit(PortId port, Bytes sz) = 0`
## `SwitchBuffer::PerPortSched::queued_bytes_port`
`Bytes queued_bytes_port(PortId p) const noexcept`
## `SwitchBuffer::PerPortSched::queued_bytes_total`
`Bytes queued_bytes_total() const noexcept`
## `SwitchBuffer::PerPortSched::queues_for`
`virtual const std::array<std::deque<Queued>, PRI_COUNT> &queues_for( PortId p) const = 0`
## `SwitchBuffer::PerPortSched::queues_for`
`virtual std::array<std::deque<Queued>, PRI_COUNT> &queues_for(PortId p) = 0`
## `SwitchBuffer::PerPortSched::schedule_drain_if_needed`
`void schedule_drain_if_needed(PortId port)`
## `SwitchBuffer::PerPortSched::try_reserve_and_send`
`std::optional<Time> try_reserve_and_send(PortId port, Queued &q)`
## `SwitchBuffer::buffer_size`
`Bytes buffer_size() const noexcept`
## `SwitchBuffer::drain_one`
`virtual bool drain_one(PortId port) = 0`
## `SwitchBuffer::enqueue_packet`
`virtual bool enqueue_packet(const Packet &pkt, PortId egress, FlowPriority prio) = 0`
## `SwitchBuffer::owner`
`const NetworkSwitch *owner() const noexcept`
## `SwitchBuffer::port_buffered`
`Bytes port_buffered(PortId p) const noexcept`
## `SwitchBuffer::port_cnt`
`uint16_t port_cnt() const noexcept`
## `SwitchBuffer::ports_buffered`
`const std::vector<Bytes> &ports_buffered() const noexcept`
## `SwitchBuffer::set_egress_links`
`void set_egress_links(const std::vector<Link*> &links)`
## `SwitchBuffer::set_share_ctrl`
`void set_share_ctrl(uint8_t pct) noexcept`
## `SwitchBuffer::set_share_elephant`
`void set_share_elephant(uint8_t pct) noexcept`
## `SwitchBuffer::set_share_mice`
`void set_share_mice(uint8_t pct) noexcept`
## `SwitchBuffer::share_ctrl`
`uint8_t share_ctrl() const noexcept`
## `SwitchBuffer::share_elephant`
`uint8_t share_elephant() const noexcept`
## `SwitchBuffer::share_mice`
`uint8_t share_mice() const noexcept`
## `SwitchBuffer::simulator`
`const Simulator *simulator() const noexcept`
## `SwitchBuffer::type`
`SwitchBufferType type() const noexcept`
## `SwitchBuffer::~SwitchBuffer`
`virtual ~SwitchBuffer() = default`
## `drain_once`
`void drain_once(PortId port);`
## `drain_one_common`
`bool drain_one_common(PortId port);`
## `schedule_drain_if_needed`
`void schedule_drain_if_needed(PortId port);`
## `try_reserve_and_send`
`std::optional<Time> try_reserve_and_send(PortId port, Queued &q);`

View File

@@ -1,8 +1,9 @@
# network/switch/unicast_table.h
## class UnicastTable — public interface
### `UnicastTable() = default;`
### `std::vector<PortId> get_port_list(NodeId dst_node, PortId dst_port) const;`
### `bool add_entry(NodeId dst_node, PortId dst_port, PortId out_port);`
### `bool delete_entry(NodeId dst_node, PortId dst_port, PortId out_port);`
## `UnicastTable::UnicastTable`
`UnicastTable() = default`
## `UnicastTable::add_entry`
`bool add_entry(NodeId dst_node, PortId dst_port, PortId out_port)`
## `UnicastTable::delete_entry`
`bool delete_entry(NodeId dst_node, PortId dst_port, PortId out_port)`
## `UnicastTable::get_port_list`
`std::vector<PortId> get_port_list(NodeId dst_node, PortId dst_port) const`