dfx 0.1.0
Linux-based dynamic dataflow executor
Loading...
Searching...
No Matches
Writer.hpp
1// SPDX-FileCopyrightText: 2025 Vincent Leroy
2// SPDX-License-Identifier: MIT
3//
4// This file is part of dfx.
5//
6// Licensed under the MIT License. See the LICENSE file in the project root
7// for full license information.
8
9#pragma once
10
11// Standard includes
12#include <cstdint>
13#include <string>
14#include <string_view>
15#include <vector>
16
17// Project includes
18#include <dfx-core/Node.hpp>
19#include <dfx-core/messages/Message.hpp>
20#include <dfx-core/ports/Kind.hpp>
21
22namespace dfx::Pcapng
23{
66class Writer
67{
68public:
74 struct NodeInfo
75 {
79 std::string name;
80 };
81
93
112
113public:
126 static std::vector<uint8_t> writeSectionHeaderBlock(std::string_view hardware,
127 std::string_view os,
128 std::string_view userapp);
129
140 static std::vector<uint8_t> writeInterfaceDescriptionBlock(Core::Kind kind);
141
153 static std::vector<uint8_t> writeEnhancedPacketBlock(Entry const & entry);
154};
155} // !namespace dfx::Pcapng
Base class for all runtime-executed nodes in a dfx dataflow graph.
uint32_t Id
Node identifier type (unique and stable within a graph instance).
Definition Node.hpp:113
uint32_t Id
Identifier type of a port (unique within a node by not unique accross a graph).
Definition Port.hpp:69
Stateless PCAPNG block writer helpers for dfx captures.
Definition Writer.hpp:67
static std::vector< uint8_t > writeSectionHeaderBlock(std::string_view hardware, std::string_view os, std::string_view userapp)
Serialize a PCAPNG Section Header Block (SHB).
static std::vector< uint8_t > writeEnhancedPacketBlock(Entry const &entry)
Serialize a PCAPNG Enhanced Packet Block (EPB) for a captured message event.
static std::vector< uint8_t > writeInterfaceDescriptionBlock(Core::Kind kind)
Serialize a PCAPNG Interface Description Block (IDB).
std::unique_ptr< Message > MessagePtr
Unique ownership handle for messages.
Definition Message.hpp:27
Kind
Port kind (connection domain).
Definition Kind.hpp:29
Definition Capture.hpp:27
Captured message event used to generate a packet block.
Definition Writer.hpp:104
Info destination
Destination endpoint identity.
Definition Writer.hpp:110
Core::MessagePtr message
Message payload.
Definition Writer.hpp:106
Info source
Source endpoint identity.
Definition Writer.hpp:108
Minimal endpoint identifier for message routing metadata.
Definition Writer.hpp:87
Core::Port::Id portId
Port identifier within the node.
Definition Writer.hpp:91
Core::Node::Id nodeId
Node identifier.
Definition Writer.hpp:89
Minimal node identity used for PCAPNG metadata.
Definition Writer.hpp:75
std::string name
Human-readable node name.
Definition Writer.hpp:79
Core::Node::Id id
Stable node identifier.
Definition Writer.hpp:77