EntropyEngine::Networking
EntropyEngine::Networking
Section titled “EntropyEngine::Networking”Namespaces
Section titled “Namespaces”| Name |
|---|
| EntropyEngine::Networking::Wire |
| EntropyEngine::Networking::WebDAV |
| EntropyEngine::Networking::SharedMemory |
| EntropyEngine::Networking::HTTP |
Classes
Section titled “Classes”| Name | |
|---|---|
| struct | EntropyEngine::Networking::WebRTCServerConfig Configuration for WebRTC-specific settings. |
| class | EntropyEngine::Networking::WebRTCServer WebRTC-based implementation of RemoteServer. |
| class | EntropyEngine::Networking::WebRTCConnection WebRTC-based network connection using data channels. |
| struct | EntropyEngine::Networking::WebRTCConfig WebRTC-specific configuration. |
| class | EntropyEngine::Networking::WebDavAdapter VFS-to-WebDAV adapter for HTTP server integration. |
| class | EntropyEngine::Networking::UnixSocketServer Unix domain socket server implementation. |
| class | EntropyEngine::Networking::UnixSocketConnection Unix domain socket implementation for local IPC. |
| struct | [EntropyEngine::Networking::TypeToPropertyType< uint64_t >](/api/EntropyEngine/Networking/TypeToPropertyType< uint64_t >/) |
| struct | [EntropyEngine::Networking::TypeToPropertyType< std::vector< uint8_t > >](/api/EntropyEngine/Networking/TypeToPropertyType< std/vector< uint8_t > >/) |
| struct | [EntropyEngine::Networking::TypeToPropertyType< std::vector< uint64_t > >](/api/EntropyEngine/Networking/TypeToPropertyType< std/vector< uint64_t > >/) |
| struct | [EntropyEngine::Networking::TypeToPropertyType< std::vector< int64_t > >](/api/EntropyEngine/Networking/TypeToPropertyType< std/vector< int64_t > >/) |
| struct | [EntropyEngine::Networking::TypeToPropertyType< std::vector< int32_t > >](/api/EntropyEngine/Networking/TypeToPropertyType< std/vector< int32_t > >/) |
| struct | [EntropyEngine::Networking::TypeToPropertyType< std::vector< float > >](/api/EntropyEngine/Networking/TypeToPropertyType< std/vector< float > >/) |
| struct | [EntropyEngine::Networking::TypeToPropertyType< std::vector< Vec3 > >](/api/EntropyEngine/Networking/TypeToPropertyType< std/vector< Vec3 > >/) |
| struct | [EntropyEngine::Networking::TypeToPropertyType< std::string >](/api/EntropyEngine/Networking/TypeToPropertyType< std/string >/) |
| struct | [EntropyEngine::Networking::TypeToPropertyType< int64_t >](/api/EntropyEngine/Networking/TypeToPropertyType< int64_t >/) |
| struct | [EntropyEngine::Networking::TypeToPropertyType< int32_t >](/api/EntropyEngine/Networking/TypeToPropertyType< int32_t >/) |
| struct | [EntropyEngine::Networking::TypeToPropertyType< float >](/api/EntropyEngine/Networking/TypeToPropertyType< float >/) |
| struct | [EntropyEngine::Networking::TypeToPropertyType< double >](/api/EntropyEngine/Networking/TypeToPropertyType< double >/) |
| struct | [EntropyEngine::Networking::TypeToPropertyType< bool >](/api/EntropyEngine/Networking/TypeToPropertyType< bool >/) |
| struct | [EntropyEngine::Networking::TypeToPropertyType< Vec4 >](/api/EntropyEngine/Networking/TypeToPropertyType< Vec4 >/) |
| struct | [EntropyEngine::Networking::TypeToPropertyType< Vec3 >](/api/EntropyEngine/Networking/TypeToPropertyType< Vec3 >/) |
| struct | [EntropyEngine::Networking::TypeToPropertyType< Vec2 >](/api/EntropyEngine/Networking/TypeToPropertyType< Vec2 >/) |
| struct | [EntropyEngine::Networking::TypeToPropertyType< T >](/api/EntropyEngine/Networking/TypeToPropertyType< T >/) |
| struct | [EntropyEngine::Networking::TypeToPropertyType< Quat >](/api/EntropyEngine/Networking/TypeToPropertyType< Quat >/) |
| struct | EntropyEngine::Networking::TypeToPropertyType Compile-time mapping from C++ types to PropertyType enum. |
| struct | EntropyEngine::Networking::SignalingCallbacks WebRTC signaling callbacks. |
| class | EntropyEngine::Networking::SharedMemoryServer Server for accepting shared memory connections. |
| class | EntropyEngine::Networking::SharedMemoryConnection Shared memory implementation for high-performance local IPC. |
| class | EntropyEngine::Networking::SessionManager Slot-based session manager for protocol-level operations. |
| class | EntropyEngine::Networking::SessionHandle EntropyObject-stamped handle for network sessions. |
| class | EntropyEngine::Networking::SchemaNackTracker Tracks schema NACKs with rate limiting and metrics. |
| struct | EntropyEngine::Networking::SchemaNackPolicy Global, thread-safe policy for schema NACK behavior. |
| struct | [EntropyEngine::Networking::Result< void >](/api/EntropyEngine/Networking/Result< void >/) Result specialization for void operations. |
| struct | EntropyEngine::Networking::Result Result type for operations that may fail. |
| struct | EntropyEngine::Networking::RemoteServerConfig Configuration for remote server connections. |
| class | EntropyEngine::Networking::RemoteServer Abstract base class for remote server connections. |
| class | EntropyEngine::Networking::PropertyRegistry Thread-safe global property registry. |
| struct | EntropyEngine::Networking::PropertyMetadata Metadata for a registered property instance. |
| struct | EntropyEngine::Networking::PropertyHash 128-bit property hash for per-instance property identification |
| struct | EntropyEngine::Networking::PropertyDefinition Property definition within a component schema. |
| class | EntropyEngine::Networking::NetworkSession NetworkSession - High-level session that manages a peer connection. |
| class | EntropyEngine::Networking::NetworkConnection Abstract base interface for network connections. |
| class | EntropyEngine::Networking::NamedPipeServer Windows named pipe server implementation. |
| class | EntropyEngine::Networking::NamedPipeConnection Windows named pipe implementation for local IPC. |
| struct | EntropyEngine::Networking::LocalServerConfig Local server configuration (platform-agnostic). |
| class | EntropyEngine::Networking::LocalServer Platform-agnostic local server for accepting IPC connections. |
| struct | EntropyEngine::Networking::HttpResponseLite Minimal HTTP response representation for WebDAV operations. |
| struct | EntropyEngine::Networking::HttpRequestLite Minimal HTTP request representation for WebDAV operations. |
| struct | EntropyEngine::Networking::ConnectionStats Connection statistics. |
| class | EntropyEngine::Networking::ConnectionManager Slot-based connection manager with platform-agnostic API. |
| class | EntropyEngine::Networking::ConnectionHandle EntropyObject-stamped handle for network connections. |
| struct | EntropyEngine::Networking::ConnectionConfig Unified connection configuration. |
| class | EntropyEngine::Networking::ComponentSchemaRegistry Thread-safe registry for component schemas. |
| struct | EntropyEngine::Networking::ComponentSchema Component schema definition. |
| class | EntropyEngine::Networking::BatchManager Batches high-frequency property updates for efficient network transmission. |
| struct | EntropyEngine::Networking::AssetId Content-addressed asset identifier using SHA-256. |
| Name | |
|---|---|
| using glm::vec4 | Vec4 4D vector type (GLM) |
| using glm::vec3 | Vec3 3D vector type (GLM) |
| using glm::vec2 | Vec2 2D vector type (GLM) |
| using std::string | TypeName Type name for entities. |
| enum class uint8_t | SignalingMessageType { SDP = 0x01, SDP = 0x01, ICE = 0x02, ICE = 0x02} |
| enum class uint8_t | SignalingMessageType { SDP = 0x01, SDP = 0x01, ICE = 0x02, ICE = 0x02} |
| using uint32_t | RequestId Request identifier for control messages. |
| using glm::quat | Quat Quaternion type for rotations (GLM). |
| using std::variant< int32_t, int64_t, float, double, Vec2, Vec3, Vec4, Quat, std::string, bool, std::vector< uint8_t >, std::vector< int32_t >, std::vector< int64_t >, std::vector< float >, std::vector< double >, std::vector< Vec2 >, std::vector< Vec3 >, std::vector< Vec4 >, std::vector< Quat >, AssetId, std::vector< AssetId >, Mat3, Mat4 > | PropertyValue Type-safe variant for property values. |
| enum class | PropertyType { Vec4Array, Vec4, Vec3Array, Vec3, Vec2Array, Vec2, TextureCubeArray, TextureCube, Texture3D, Texture2DArray, Texture2D, Texture1D, String, Sampler, QuatArray, Quat, Mat4, Mat3, Int64Array, Int64, Int32Array, Int32, Float64Array, Float64, Float32Array, Float32, Bytes, Bool, AssetIdArray, AssetId} Property type enumeration. |
| enum class | NetworkError { WouldBlock, UnknownProperty, TypeMismatch, Timeout, SharedMemorySizeMismatch, SharedMemoryPermission, SharedMemoryNotAvailable, SharedMemoryCorrupted, SerializationFailed, SchemaValidationFailed, SchemaNotPublic, SchemaNotFound, SchemaIncompatible, SchemaAlreadyExists, ResourceLimitExceeded, RegistryFull, None, InvalidParameter, InvalidMessage, HashCollision, HandshakeFailed, EntityNotFound, DeserializationFailed, DecompressionFailed, ConnectionClosed, CompressionFailed, AlreadyExists} Error codes for networking operations. |
| using glm::mat4 | Mat4 4x4 matrix type (GLM, column-major) |
| using glm::mat3 | Mat3 3x3 matrix type (GLM, column-major) |
| using uint64_t | EntityId Unique identifier for entities in the scene. |
| enum class | ConnectionType { Remote, Local} High-level connection type abstraction. |
| enum class | ConnectionState { Failed, Disconnecting, Disconnected, Connecting, Connected} Connection state during lifecycle. |
| enum class | ConnectionBackend { XPC, WebRTC, UnixSocket, SharedMemory, NamedPipe, Auto} Explicit backend selection (advanced use). |
| using PropertyHash | ComponentTypeHash Type alias for component type identification. |
| using Protocol::PropertyValue | CapnpPropertyValue Serialization helpers for ComponentSchema ↔ Cap’n Proto. |
| using Protocol::PropertyType | CapnpPropertyType |
| using std::string | AppId Application identifier. |
Functions
Section titled “Functions”| Name | |
|---|---|
| bool | validatePropertyType(const PropertyValue & value, PropertyType expectedType) Validate that a property value matches the expected type. |
| std::string | toString(const PropertyHash & hash) Convert PropertyHash to string for logging/diagnostics. |
| uint16_t | toCapnpPropertyType(PropertyType type) Convert C++ PropertyType to Cap’n Proto PropertyType enum. |
| void | serializePropertyValue(const PropertyValue & value, CapnpPropertyValue::Builder builder) Serialize a PropertyValue to Cap’n Proto. |
| void | serializePropertyDefinition(const PropertyDefinition & definition, Protocol::PropertyDefinitionData::Builder builder) Serialize a PropertyDefinition to Cap’n Proto. |
| void | serializeComponentSchema(const ComponentSchema & schema, Protocol::ComponentSchemaData::Builder builder) Serialize a ComponentSchema to Cap’n Proto. |
| Result< std::vector< uint8_t > > | serialize(capnp::MessageBuilder & builder) Serialize a Cap’n Proto message to a byte vector. |
| const char * | rtcStateToString(rtcState s) |
| const char * | propertyTypeToString(PropertyType type) Convert PropertyType to human-readable string. |
| std::optional< PropertyType > | mapTypeIdToPropertyType(TypeID typeId) Runtime mapping from TypeID to PropertyType. |
| bool | iequal_prefix(std::string_view a, std::string_view b) |
| PropertyType | getPropertyType(const PropertyValue & value) Get the PropertyType for a PropertyValue variant. |
| size_t | getPropertySize(PropertyType type) Get the minimum required size in bytes for a property type. |
| size_t | getFieldSize(TypeID typeId) Runtime field size lookup. |
| uint64_t | getCurrentTimestampMicros() Get current timestamp in microseconds since epoch. |
| template <typename T > Result< ComponentSchema > | generateComponentSchema(const std::string & appId, uint32_t schemaVersion, bool isPublic =true) Auto-generate ComponentSchema from TypeInfo reflection. |
| PropertyType | fromCapnpPropertyType(uint16_t capnpType) Convert Cap’n Proto PropertyType to C++ PropertyType enum. |
| const char * | errorToString(NetworkError error) Convert error code to human-readable string. |
| void | encodeU32BigEndian(uint32_t value, uint8_t * dest) |
| void | encodeU32BigEndian(uint32_t value, uint8_t * dest) |
| std::vector< uint8_t > | encodeSDPMessage(const std::string & type, const std::string & sdp) |
| std::vector< uint8_t > | encodeSDPMessage(const std::string & type, const std::string & sdp) |
| std::vector< uint8_t > | encodeICEMessage(const std::string & candidate, const std::string & mid) |
| std::vector< uint8_t > | encodeICEMessage(const std::string & candidate, const std::string & mid) |
| PropertyValue | deserializePropertyValue(CapnpPropertyValue::Reader reader) Deserialize a PropertyValue from Cap’n Proto. |
| PropertyDefinition | deserializePropertyDefinition(Protocol::PropertyDefinitionData::Reader reader) Deserialize a PropertyDefinition from Cap’n Proto. |
| Result< ComponentSchema > | deserializeComponentSchema(Protocol::ComponentSchemaData::Reader reader) Deserialize a ComponentSchema from Cap’n Proto. |
| Result< kj::Array< capnp::word > > | deserialize(const std::vector< uint8_t > & buffer) Deserialize a byte vector to a Cap’n Proto message. |
| Result< std::vector< uint8_t > > | decompress(const std::vector< uint8_t > & compressedData) Decompress zstd-compressed data. |
| uint32_t | decodeU32BigEndian(const uint8_t * src) |
| uint32_t | decodeU32BigEndian(const uint8_t * src) |
| std::optional< std::tuple< SignalingMessageType, std::string, std::string > > | decodeSignalingMessage(const std::vector< uint8_t > & data) |
| std::optional< std::tuple< SignalingMessageType, std::string, std::string > > | decodeSignalingMessage(const std::vector< uint8_t > & data) |
| std::unique_ptr< SharedMemoryServer > | createSharedMemoryServer(ConnectionManager * connMgr, const std::string & baseName) Creates a shared memory server. |
| std::unique_ptr< SharedMemoryServer > | createSharedMemoryServer(ConnectionManager * connMgr, const std::string & baseName, const SharedMemoryServer::Config & config) Creates a shared memory server with configuration. |
| std::unique_ptr< RemoteServer > | createRemoteServer(ConnectionManager * connMgr, uint16_t port =8080) Create a remote server with default configuration. |
| std::unique_ptr< RemoteServer > | createRemoteServer(ConnectionManager * connMgr, const RemoteServerConfig & config) Create a remote server with custom configuration. |
| std::unique_ptr< LocalServer > | createLocalServer(ConnectionManager * connMgr, const std::string & endpoint) Creates a platform-appropriate LocalServer instance. |
| std::unique_ptr< LocalServer > | createLocalServer(ConnectionManager * connMgr, const std::string & endpoint, const LocalServerConfig & config) Creates a LocalServer with configuration options. |
| const char * | connStateToString(ConnectionState s) |
| PropertyHash | computePropertyHash(uint64_t entityId, ComponentTypeHash componentType, const std::string & propertyName) Compute property hash from components. |
| Result< std::vector< uint8_t > > | compress(const std::vector< uint8_t > & data, int compressionLevel =3) Compress data using zstd. |
| template NetworkSession::ComponentHandle & | NetworkSession::ComponentHandle::set< std::string >(const std::string & , const std::string & ) |
Attributes
Section titled “Attributes”| Name | |
|---|---|
| size_t | DEFAULT_XPC_MAX_MESSAGE_SIZE |
| int | DEFAULT_WEBRTC_MAX_MESSAGE_SIZE |
| size_t | DEFAULT_SHARED_MEMORY_REGION_SIZE |
| size_t | DEFAULT_MAX_MESSAGE_SIZE |
Types Documentation
Section titled “Types Documentation”using Vec4
Section titled “using Vec4”using EntropyEngine::Networking::Vec4 = glm::vec4;4D vector type (GLM)
using Vec3
Section titled “using Vec3”using EntropyEngine::Networking::Vec3 = glm::vec3;3D vector type (GLM)
using Vec2
Section titled “using Vec2”using EntropyEngine::Networking::Vec2 = glm::vec2;2D vector type (GLM)
using TypeName
Section titled “using TypeName”using EntropyEngine::Networking::TypeName = std::string;Type name for entities.
Identifies the class/type of an entity within an application.
enum SignalingMessageType
Section titled “enum SignalingMessageType”| Enumerator | Value | Description |
|---|---|---|
| SDP | 0x01 | |
| SDP | 0x01 | |
| ICE | 0x02 | |
| ICE | 0x02 |
enum SignalingMessageType
Section titled “enum SignalingMessageType”| Enumerator | Value | Description |
|---|---|---|
| SDP | 0x01 | |
| SDP | 0x01 | |
| ICE | 0x02 | |
| ICE | 0x02 |
using RequestId
Section titled “using RequestId”using EntropyEngine::Networking::RequestId = uint32_t;Request identifier for control messages.
Used to correlate requests and responses in the control plane.
using Quat
Section titled “using Quat”using EntropyEngine::Networking::Quat = glm::quat;Quaternion type for rotations (GLM).
using PropertyValue
Section titled “using PropertyValue”using EntropyEngine::Networking::PropertyValue = std::variant<int32_t, int64_t, float, double, Vec2, Vec3, Vec4, Quat, std::string, bool, std::vector<uint8_t>,
std::vector<int32_t>, std::vector<int64_t>, std::vector<float>, std::vector<double>, std::vector<Vec2>, std::vector<Vec3>, std::vector<Vec4>, std::vector<Quat>,
AssetId, std::vector<AssetId>,
Mat3, Mat4>;Type-safe variant for property values.
Holds any of the supported property types in a type-safe manner. Includes scalar types and array types.
enum PropertyType
Section titled “enum PropertyType”| Enumerator | Value | Description |
|---|---|---|
| Vec4Array | ||
| Vec4 | ||
| Vec3Array | ||
| Vec3 | ||
| Vec2Array | ||
| Vec2 | ||
| TextureCubeArray | ||
| TextureCube | ||
| Texture3D | ||
| Texture2DArray | ||
| Texture2D | ||
| Texture1D | ||
| String | ||
| Sampler | ||
| QuatArray | ||
| Quat | ||
| Mat4 | ||
| Mat3 | ||
| Int64Array | ||
| Int64 | ||
| Int32Array | ||
| Int32 | ||
| Float64Array | ||
| Float64 | ||
| Float32Array | ||
| Float32 | ||
| Bytes | ||
| Bool | ||
| AssetIdArray | ||
| AssetId |
Property type enumeration.
Matches the PropertyType enum in entropy.capnp
enum NetworkError
Section titled “enum NetworkError”| Enumerator | Value | Description |
|---|---|---|
| WouldBlock | Operation would block (non-blocking backpressure). | |
| UnknownProperty | Property hash not found in registry. | |
| TypeMismatch | Property value type doesn’t match expected type. | |
| Timeout | Operation timed out. | |
| SharedMemorySizeMismatch | Shared memory region size mismatch. | |
| SharedMemoryPermission | Permission denied for shared memory operation. | |
| SharedMemoryNotAvailable | Shared memory not available on this platform. | |
| SharedMemoryCorrupted | Shared memory control block corrupted (magic/version mismatch). | |
| SerializationFailed | Failed to serialize message. | |
| SchemaValidationFailed | Schema field validation failed. | |
| SchemaNotPublic | Schema is not published for discovery. | |
| SchemaNotFound | Component schema not found in registry. | |
| SchemaIncompatible | Schemas are structurally incompatible. | |
| SchemaAlreadyExists | Schema already registered with different content. | |
| ResourceLimitExceeded | Resource limit exceeded (entities, properties, etc.). | |
| RegistryFull | Registry has reached capacity limit. | |
| None | No error. | |
| InvalidParameter | Invalid parameter provided. | |
| InvalidMessage | Malformed or invalid message. | |
| HashCollision | Property hash collision detected. | |
| HandshakeFailed | Handshake protocol failed. | |
| EntityNotFound | Entity ID not found. | |
| DeserializationFailed | Failed to deserialize message. | |
| DecompressionFailed | Failed to decompress data. | |
| ConnectionClosed | Connection was closed. | |
| CompressionFailed | Failed to compress data. | |
| AlreadyExists | Entity or property already exists. |
Error codes for networking operations.
using Mat4
Section titled “using Mat4”using EntropyEngine::Networking::Mat4 = glm::mat4;4x4 matrix type (GLM, column-major)
using Mat3
Section titled “using Mat3”using EntropyEngine::Networking::Mat3 = glm::mat3;3x3 matrix type (GLM, column-major)
using EntityId
Section titled “using EntityId”using EntropyEngine::Networking::EntityId = uint64_t;Unique identifier for entities in the scene.
EntityId 0 is reserved to represent the root/no parent.
enum ConnectionType
Section titled “enum ConnectionType”| Enumerator | Value | Description |
|---|---|---|
| Remote | Remote network connection - uses WebRTC. | |
| Local | Local IPC - platform selects appropriate backend. |
High-level connection type abstraction.
Represents platform-agnostic connection categories:
- Local: In-process or local IPC (Unix socket, Named pipe, XPC)
- Remote: Network connections (WebRTC, future: QUIC, WebTransport)
enum ConnectionState
Section titled “enum ConnectionState”| Enumerator | Value | Description |
|---|---|---|
| Failed | Connection failed. | |
| Disconnecting | Graceful disconnect in progress. | |
| Disconnected | Initial state or after disconnect. | |
| Connecting | Connection in progress. | |
| Connected | Fully connected and ready. |
Connection state during lifecycle.
enum ConnectionBackend
Section titled “enum ConnectionBackend”| Enumerator | Value | Description |
|---|---|---|
| XPC | Force XPC connection (macOS). | |
| WebRTC | Force WebRTC data channel (all platforms). | |
| UnixSocket | Force Unix domain socket (Linux/macOS). | |
| SharedMemory | Force shared memory transport (all platforms, local only). | |
| NamedPipe | Force named pipe (Windows). | |
| Auto | Automatic selection based on platform. |
Explicit backend selection (advanced use).
Allows overriding platform auto-selection for specific backend choice. Use Auto for typical cases - platform picks the best backend.
using ComponentTypeHash
Section titled “using ComponentTypeHash”using EntropyEngine::Networking::ComponentTypeHash = PropertyHash;Type alias for component type identification.
ComponentTypeHash identifies a component type across applications. Computed from appId, componentName, schemaVersion, and structural hash.
Uses the same 128-bit hash structure as PropertyHash for consistency.
using CapnpPropertyValue
Section titled “using CapnpPropertyValue”using EntropyEngine::Networking::CapnpPropertyValue = Protocol::PropertyValue;Serialization helpers for ComponentSchema ↔ Cap’n Proto.
Provides functions to convert between C++ ComponentSchema structures and Cap’n Proto ComponentSchemaData messages.
using CapnpPropertyType
Section titled “using CapnpPropertyType”using EntropyEngine::Networking::CapnpPropertyType = Protocol::PropertyType;using AppId
Section titled “using AppId”using EntropyEngine::Networking::AppId = std::string;Application identifier.
Uniquely identifies an application in the Entropy ecosystem.
Functions Documentation
Section titled “Functions Documentation”function validatePropertyType
Section titled “function validatePropertyType”bool validatePropertyType( const PropertyValue & value, PropertyType expectedType)Validate that a property value matches the expected type.
Parameters:
- value The property value variant
- expectedType The expected type
Return: true if types match, false otherwise
PropertyValue val = 42;if (validatePropertyType(val, PropertyType::Int32)) { // Safe to use as int32}function toString
Section titled “function toString”inline std::string toString( const PropertyHash & hash)Convert PropertyHash to string for logging/diagnostics.
Parameters:
- hash PropertyHash to convert
Return: String representation in format “high:low” (hex)
function toCapnpPropertyType
Section titled “function toCapnpPropertyType”uint16_t toCapnpPropertyType( PropertyType type)Convert C++ PropertyType to Cap’n Proto PropertyType enum.
Parameters:
- type The C++ PropertyType
Return: The corresponding Cap’n Proto PropertyType ordinal
Provides explicit, safe conversion between C++ and Cap’n Proto enum types rather than relying on implicit static_cast which assumes matching ordinals.
Note: Return type is uint16_t to avoid including capnp headers here. Cast result to ::PropertyType when using with Cap’n Proto builders.
function serializePropertyValue
Section titled “function serializePropertyValue”void serializePropertyValue( const PropertyValue & value, CapnpPropertyValue::Builder builder)Serialize a PropertyValue to Cap’n Proto.
Parameters:
- value The C++ PropertyValue to serialize
- builder Cap’n Proto builder for PropertyValue
function serializePropertyDefinition
Section titled “function serializePropertyDefinition”void serializePropertyDefinition( const PropertyDefinition & definition, Protocol::PropertyDefinitionData::Builder builder)Serialize a PropertyDefinition to Cap’n Proto.
Parameters:
- definition The C++ PropertyDefinition to serialize
- builder Cap’n Proto builder for PropertyDefinitionData
function serializeComponentSchema
Section titled “function serializeComponentSchema”void serializeComponentSchema( const ComponentSchema & schema, Protocol::ComponentSchemaData::Builder builder)Serialize a ComponentSchema to Cap’n Proto.
Parameters:
- schema The C++ ComponentSchema to serialize
- builder Cap’n Proto builder for ComponentSchemaData
function serialize
Section titled “function serialize”Result< std::vector< uint8_t > > serialize( capnp::MessageBuilder & builder)Serialize a Cap’n Proto message to a byte vector.
Parameters:
- builder The message builder containing the message
Return: Result containing byte vector or error
Converts a Cap’n Proto message builder to a flat byte array suitable for transmission over the network.
capnp::MallocMessageBuilder builder;auto msg = builder.initRoot<entropy::Message>();// ... populate message ...
auto result = serialize(builder);if (result.success()) { // Send result.value over network}function rtcStateToString
Section titled “function rtcStateToString”static const char * rtcStateToString( rtcState s)function propertyTypeToString
Section titled “function propertyTypeToString”const char * propertyTypeToString( PropertyType type)Convert PropertyType to human-readable string.
Parameters:
- type The property type
Return: String representation
function mapTypeIdToPropertyType
Section titled “function mapTypeIdToPropertyType”inline std::optional< PropertyType > mapTypeIdToPropertyType( TypeID typeId)Runtime mapping from TypeID to PropertyType.
Parameters:
Return: PropertyType if mapped, nullopt otherwise
Dispatches TypeID comparison to known types. Required because TypeID is runtime hash-based (not compile-time constexpr).
Applications can extend this by adding their own type checks:
inline std::optional<PropertyType> mapTypeIdToPropertyType(TypeID typeId) { // Check application types first if (typeId == createTypeId<MyCustomType>()) return PropertyType::Int32;
// Fall back to EntropyNetworking defaults return EntropyEngine::Networking::mapTypeIdToPropertyTypeDefault(typeId);}function iequal_prefix
Section titled “function iequal_prefix”static bool iequal_prefix( std::string_view a, std::string_view b)function getPropertyType
Section titled “function getPropertyType”PropertyType getPropertyType( const PropertyValue & value)Get the PropertyType for a PropertyValue variant.
Parameters:
- value The property value
Return: The PropertyType corresponding to the active variant
PropertyValue val = Vec3{1.0f, 2.0f, 3.0f};PropertyType type = getPropertyType(val); // Returns PropertyType::Vec3function getPropertySize
Section titled “function getPropertySize”size_t getPropertySize( PropertyType type)Get the minimum required size in bytes for a property type.
Parameters:
- type The property type
Return: Size in bytes
Used for safety checks to ensure schema definitions provide enough space for the data type.
function getFieldSize
Section titled “function getFieldSize”inline size_t getFieldSize( TypeID typeId)Runtime field size lookup.
Parameters:
Return: Field size in bytes, or 0 if unknown
Workaround for FieldInfo not containing size information.
TODO: Submit PR to EntropyCore to add size_t to FieldInfo, eliminating need for this dispatch table.
Applications can extend this by adding their own type checks:
inline size_t getFieldSize(TypeID typeId) { // Check application types first if (typeId == createTypeId<MyCustomType>()) return sizeof(MyCustomType);
// Fall back to EntropyNetworking defaults return EntropyEngine::Networking::getFieldSizeDefault(typeId);}function getCurrentTimestampMicros
Section titled “function getCurrentTimestampMicros”inline uint64_t getCurrentTimestampMicros()Get current timestamp in microseconds since epoch.
Return: Timestamp in microseconds since Unix epoch
Returns the current system time as microseconds since the Unix epoch. This is the standard timestamp format used throughout the networking protocol for message batches and timing information.
function generateComponentSchema
Section titled “function generateComponentSchema”template <typename T >Result< ComponentSchema > generateComponentSchema( const std::string & appId, uint32_t schemaVersion, bool isPublic =true)Auto-generate ComponentSchema from TypeInfo reflection.
Parameters:
- appId Application identifier (e.g., “CanvasEngine”)
- schemaVersion Schema version number (increment on breaking changes)
- isPublic Whether to publish for discovery (default: true)
Template Parameters:
- T Component type with reflection (must have ENTROPY_REGISTER_TYPE)
Return: Result with ComponentSchema on success, error on failure
Eliminates manual PropertyDefinition boilerplate by extracting field information from ENTROPY_FIELD macro registrations.
Requirements:
- Component must use ENTROPY_REGISTER_TYPE macro
- All reflected fields must use ENTROPY_FIELD macro
- Field types must be mapped in TypeToPropertyType specializations or mapTypeIdToPropertyType()
Example:
struct Transform { ENTROPY_REGISTER_TYPE(Transform); ENTROPY_FIELD(Vec3, position) = {0.0f, 0.0f, 0.0f}; ENTROPY_FIELD(Quat, rotation) = {0.0f, 0.0f, 0.0f, 1.0f}; ENTROPY_FIELD(Vec3, scale) = {1.0f, 1.0f, 1.0f};};
auto result = generateComponentSchema<Transform>("MyApp", 1, true);if (result.success()) { ComponentSchema schema = result.value; // Register with ComponentSchemaRegistry...}function fromCapnpPropertyType
Section titled “function fromCapnpPropertyType”PropertyType fromCapnpPropertyType( uint16_t capnpType)Convert Cap’n Proto PropertyType to C++ PropertyType enum.
Parameters:
- capnpType The Cap’n Proto PropertyType ordinal
Return: The corresponding C++ PropertyType
Provides explicit, safe conversion between Cap’n Proto and C++ enum types.
function errorToString
Section titled “function errorToString”inline const char * errorToString( NetworkError error)Convert error code to human-readable string.
Parameters:
- error The error code
Return: Description of the error
function encodeU32BigEndian
Section titled “function encodeU32BigEndian”static void encodeU32BigEndian( uint32_t value, uint8_t * dest)function encodeU32BigEndian
Section titled “function encodeU32BigEndian”static void encodeU32BigEndian( uint32_t value, uint8_t * dest)function encodeSDPMessage
Section titled “function encodeSDPMessage”static std::vector< uint8_t > encodeSDPMessage( const std::string & type, const std::string & sdp)function encodeSDPMessage
Section titled “function encodeSDPMessage”static std::vector< uint8_t > encodeSDPMessage( const std::string & type, const std::string & sdp)function encodeICEMessage
Section titled “function encodeICEMessage”static std::vector< uint8_t > encodeICEMessage( const std::string & candidate, const std::string & mid)function encodeICEMessage
Section titled “function encodeICEMessage”static std::vector< uint8_t > encodeICEMessage( const std::string & candidate, const std::string & mid)function deserializePropertyValue
Section titled “function deserializePropertyValue”PropertyValue deserializePropertyValue( CapnpPropertyValue::Reader reader)Deserialize a PropertyValue from Cap’n Proto.
Parameters:
- reader Cap’n Proto reader for PropertyValue
Return: PropertyValue The deserialized C++ variant
function deserializePropertyDefinition
Section titled “function deserializePropertyDefinition”PropertyDefinition deserializePropertyDefinition( Protocol::PropertyDefinitionData::Reader reader)Deserialize a PropertyDefinition from Cap’n Proto.
Parameters:
- reader Cap’n Proto reader for PropertyDefinitionData
Return: PropertyDefinition The deserialized C++ structure
function deserializeComponentSchema
Section titled “function deserializeComponentSchema”Result< ComponentSchema > deserializeComponentSchema( Protocol::ComponentSchemaData::Reader reader)Deserialize a ComponentSchema from Cap’n Proto.
Parameters:
- reader Cap’n Proto reader for ComponentSchemaData
Return: Result
function deserialize
Section titled “function deserialize”Result< kj::Array< capnp::word > > deserialize( const std::vector< uint8_t > & buffer)Deserialize a byte vector to a Cap’n Proto message.
Parameters:
- buffer Serialized message bytes
Return: Result containing message reader or error
Parses a flat byte array into a Cap’n Proto message reader. The returned reader is valid for the lifetime of the input buffer.
std::vector<uint8_t> received = ...;auto result = deserialize(received);if (result.success()) { auto reader = result.value; // Access message via reader}function decompress
Section titled “function decompress”Result< std::vector< uint8_t > > decompress( const std::vector< uint8_t > & compressedData)Decompress zstd-compressed data.
Parameters:
- compressedData Compressed data
Return: Result containing decompressed data or error
std::vector<uint8_t> compressed = ...;auto result = decompress(compressed);if (result.success()) { auto original = result.value;}function decodeU32BigEndian
Section titled “function decodeU32BigEndian”static uint32_t decodeU32BigEndian( const uint8_t * src)function decodeU32BigEndian
Section titled “function decodeU32BigEndian”static uint32_t decodeU32BigEndian( const uint8_t * src)function decodeSignalingMessage
Section titled “function decodeSignalingMessage”static std::optional< std::tuple< SignalingMessageType, std::string, std::string > > decodeSignalingMessage( const std::vector< uint8_t > & data)function decodeSignalingMessage
Section titled “function decodeSignalingMessage”static std::optional< std::tuple< SignalingMessageType, std::string, std::string > > decodeSignalingMessage( const std::vector< uint8_t > & data)function createSharedMemoryServer
Section titled “function createSharedMemoryServer”std::unique_ptr< SharedMemoryServer > createSharedMemoryServer( ConnectionManager * connMgr, const std::string & baseName)Creates a shared memory server.
Parameters:
- connMgr Connection manager that will own accepted connections
- baseName Base name for shared memory regions
Return: Unique pointer to SharedMemoryServer
function createSharedMemoryServer
Section titled “function createSharedMemoryServer”std::unique_ptr< SharedMemoryServer > createSharedMemoryServer( ConnectionManager * connMgr, const std::string & baseName, const SharedMemoryServer::Config & config)Creates a shared memory server with configuration.
Parameters:
- connMgr Connection manager that will own accepted connections
- baseName Base name for shared memory regions
- config Server configuration
Return: Unique pointer to SharedMemoryServer
function createRemoteServer
Section titled “function createRemoteServer”std::unique_ptr< RemoteServer > createRemoteServer( ConnectionManager * connMgr, uint16_t port =8080)Create a remote server with default configuration.
Parameters:
- connMgr ConnectionManager to adopt new connections
- port Port number to listen on (default 8080)
Return: Unique pointer to RemoteServer instance
Creates a RemoteServer using the default protocol (WebRTC). The server will listen on the specified port.
function createRemoteServer
Section titled “function createRemoteServer”std::unique_ptr< RemoteServer > createRemoteServer( ConnectionManager * connMgr, const RemoteServerConfig & config)Create a remote server with custom configuration.
Parameters:
- connMgr ConnectionManager to adopt new connections
- config Complete server configuration
Return: Unique pointer to RemoteServer instance
Creates a RemoteServer with full control over configuration. Allows customization of TLS, polling intervals, protocol-specific settings, etc.
function createLocalServer
Section titled “function createLocalServer”std::unique_ptr< LocalServer > createLocalServer( ConnectionManager * connMgr, const std::string & endpoint)Creates a platform-appropriate LocalServer instance.
Parameters:
- connMgr Connection manager that will own accepted connections
- endpoint Platform-specific endpoint (socket path or pipe name)
Return: Unique pointer to LocalServer implementation
function createLocalServer
Section titled “function createLocalServer”std::unique_ptr< LocalServer > createLocalServer( ConnectionManager * connMgr, const std::string & endpoint, const LocalServerConfig & config)Creates a LocalServer with configuration options.
function connStateToString
Section titled “function connStateToString”static const char * connStateToString( ConnectionState s)function computePropertyHash
Section titled “function computePropertyHash”PropertyHash computePropertyHash( uint64_t entityId, ComponentTypeHash componentType, const std::string & propertyName)Compute property hash from components.
Parameters:
- entityId Entity instance identifier
- componentType Component type hash from ComponentSchema
- propertyName Property name within the component (e.g., “position”)
Return: 128-bit property hash
Computes a 128-bit hash using SHA-256. The hash is deterministic and provides per-instance property identification with ecosystem-scale collision resistance.
Hash construction: SHA-256(entityId || componentType || propertyName)
- entityId: 8 bytes (big-endian uint64)
- componentType: 16 bytes (ComponentTypeHash.high + ComponentTypeHash.low)
- propertyName: UTF-8 string (e.g., “position”, “health”)
Result is truncated to 128 bits (high 128 bits of SHA-256 output).
The hash should be computed ONCE on property registration and stored/reused. Never recompute the hash - it is a stable identifier for the property instance.
// Compute hash once when property is createdauto typeHash = schema.typeHash;auto hash = computePropertyHash(42, typeHash, "position");// hash uniquely identifies property on entity 42 with this component type
// Different entity = different hashauto hash2 = computePropertyHash(99, typeHash, "position");// hash != hash2 (different entity IDs)function compress
Section titled “function compress”Result< std::vector< uint8_t > > compress( const std::vector< uint8_t > & data, int compressionLevel =3)Compress data using zstd.
Parameters:
- data Uncompressed data
- compressionLevel Compression level (1-22, default 3)
Return: Result containing compressed data or error
Compresses byte data for efficient transmission. Typically used for scene snapshots which can be large.
std::vector<uint8_t> largePayload = ...;auto result = compress(largePayload);if (result.success()) { // Compressed size: result.value.size()}function NetworkSession::ComponentHandle::set< std::string >
Section titled “function NetworkSession::ComponentHandle::set< std::string >”template NetworkSession::ComponentHandle & NetworkSession::ComponentHandle::set< std::string >( const std::string & , const std::string &)Attributes Documentation
Section titled “Attributes Documentation”variable DEFAULT_XPC_MAX_MESSAGE_SIZE
Section titled “variable DEFAULT_XPC_MAX_MESSAGE_SIZE”static size_t DEFAULT_XPC_MAX_MESSAGE_SIZE = 64ull * 1024ull * 1024ull;variable DEFAULT_WEBRTC_MAX_MESSAGE_SIZE
Section titled “variable DEFAULT_WEBRTC_MAX_MESSAGE_SIZE”static int DEFAULT_WEBRTC_MAX_MESSAGE_SIZE = 256 * 1024;variable DEFAULT_SHARED_MEMORY_REGION_SIZE
Section titled “variable DEFAULT_SHARED_MEMORY_REGION_SIZE”static size_t DEFAULT_SHARED_MEMORY_REGION_SIZE = 4ull * 1024ull * 1024ull;variable DEFAULT_MAX_MESSAGE_SIZE
Section titled “variable DEFAULT_MAX_MESSAGE_SIZE”static size_t DEFAULT_MAX_MESSAGE_SIZE = 16ull * 1024ull * 1024ull;Updated on 2026-01-26 at 17:14:35 -0500