Ivyware P2Pmsgcore Message routing kernel C++ 2002 → Java 17 Melbourne, AU
Ivyware

Ivyware/P2Pmsgcore

Walkthrough — hub, connection, message

One address.
Any transport.
Every message routed.

A hub owns an address on the virtual network, keeps a priority queue, and runs pump threads that hand each message to a MAP handler. Watch all of it happen, one call at a time — the code beside the diagram is the same com.ivyware.p2pmsgcore API you'd write.

The bench

CLIENT PEER Root.Sender P2PeerConWsa ECDH·GCM 42 HUB ADDRESS Root.MyHub P2PEERHUB PORT :9000 listen P2PeerMsgQue HEAD = LOWEST PRI VALUE msg 17 pri 7 · NORMAL msg 03 pri 12 · LOW msg 42 pri 2 · HIGH PUMP POOL 0 1 2 THREADS MSG MAP 17 → onStatus CONTINUE 42 → onChat HANDLED CON → onAccept CONTINUE MapResult.HANDLED
new P2PeerHub()

The hub takes an address on the virtual network. Every hop is a dot-separated name — routing decisions read this string, not an IP.

Caller code


        

Event log — P2Pevent

Same hub, different wire

Transports

A connection is just a typed transport bolted to the hub. Swap the class and the routing above is unchanged — the address, the queue, and the MAP stay exactly as they are.

P2PeerConWsaTCP sockets over the network
P2PeerConPipeNamed pipes between local processes
P2PeerCon232RS-232 serial to attached hardware
P2PeerConDmxDirect memory exchange inside one process

What the kernel gives you

Design properties

Addressing

Names, not endpoints

A hub cannot join a network without a valid hierarchical address. Routing reads the dotted path, so moving a service between processes or machines changes its connection class, not its callers.

Concurrency

Pumps, not thread-per-peer

Connection state changes and messages are pumped through shared threads — one pump per thread, a ceiling set when the hub is created, and none reserved per peer. Concurrent clients are bounded by system resources rather than by a thread you spend on each of them.

Payload

Messages that describe themselves

A message manages its own private heap and holds a hierarchical, field-addressed structure — native types, strings, blobs, XML, images — resized as you fill it.

Load balancing

Change context mid-handler

P2PeerContext() and P2PeerContextSwap() re-pump the message you are holding into a different pump, from inside the handler, in one call.

Security

Key exchange and encryption

Ephemeral ECDH P-256 to HKDF-SHA256 to AES-256-GCM, one key per connection, with no algorithm negotiation. Peer authentication is on by default, and the login proof is bound to the exchange it arrived on.

Diagnostics

Everything serialises

Every kernel object can be serialised into a message, which is what makes reporting and logging inside a live distributed network tractable at all.

Licence

Open source, soon

P2Pmsgcore will be published under the Apache 2.0 licence on GitHub. The integration libraries and reference applications are already free downloads with full source.

The pieces

Component model

Seven object families do the work. The full reference — including the map macros and the state each family owns — is on the architecture page.

P2Pmsgcore object families
ObjectResponsibility
P2PeerHubOwns an address, a connection registry, a priority queue and the primary pump. The unit of deployment and re-use.
P2PeerTargetHolds the system, connection and message maps. Register one with a hub to extend its behaviour or add another pump.
P2PeerConManages the state of one inter-hub or third-party connection, and translates addresses as messages cross it.
P2PeerioDoes the physical I/O and the protocol translation — binary, ASCII, XML, HTML, FIX — plus key exchange and encryption.
P2PeerMsgThe unit of exchange. Hierarchical, self-sizing, cloneable, and addressable by field and path name.
P2PeerMsg_MAPBinds message names to handlers, with normal, reflected, acknowledged and exception-catch variants.
P2PeventEvents and exceptions. Throwable as ordinary C++ exceptions, or attachable to a message and routed across the network.