page1
UDPInterface
ETHInterface
???
IfController
SwitchCore
ControlHandler
UpperDistributor
IpTunnel
TUNAdapter
Pathfinder
SessionManager
EventEmitter
Peer connected or lost (PFChan_Core_PEER, PFChan_Core_PEER_GONE)
Switch level error – usually bad label (PFChan_Core_SWITCH_ERR)
(better) path to active node discovered (PFChan_Pathfinder_NODE)
Session begun or ended
(PFChan_Core_SESSION, PFChan_Core_SESSION_ENDED)
Path discovered by core
(incoming packet with different path) (PFChan_Core_DISCOVERED_PATH)
End-to-end encryption below this line.
Point-to-point encryption below this line.
Cjdns Module Structure
This is an illustration of the cjdns module structure. There are 4 distinct internal protocols which the modules use to communicate with one another. In this drawing they are numbered but in the codebase they are never referred to by number.
1. IfController external protocol, Sockaddr with the sender's address is followed by the sender's message, (see util/platform/Sockaddr.h)
2. wire/SwitchHeader.h followed by 4 byte handle and control message or encrypted data.
3. wire/RouteHeader.h followed by wire/DataHeader.h (except for CTRL frames)
4. Plain IPv4 or IPv6.
1
1
1
2
2
3
3
3
3
4
The EventEmitter allows
“events” to be subscribed to
and asynchronously broadcast. net/Event.h
contains a list of events. The red lines indicate events which are sent from one module to another.
ControlHandler handles special “CTRL” frames which are not end-to-end encrypted, these include low level ping requests and error messages which are sent back in the event a packet cannot be forwarded. See: wire/Control.h for protocol info.
tun0
4
Incoming Inter-router message (PFChan_Core_MSG)
Outgoing Inter-router message (PFChan_Pathfinder_SENDMSG)