Circuit
Circuit Definitions
A circuit is a two-way UDP connection between two nodes, be they the viewer and the simulator, two simulators, or the simulator and a utility server. Circuits are built with no custom session management, so endpoint processes can and do sometimes disappear and restart. Due to this fact, it cannot be accurately predicted if one node trusts another since it may have restarted since it was last contacted.
Two kinds of circuits exist, trusted and untrusted.
Untrusted Circuits
All circuits begin as untrusted circuits, and all viewer to simulator connections are made through untrusted circuits. In the message template, messages are flagged as either trusted or untrusted. Any trusted packet going over an untrusted circuit will be discarded by the receiving node.
Trusted Circuits
Trusted circuits only exist between simulators themselves and/or utility servers (The Userserver, Dataserver, or Spaceserver). These circuits are established in response to the DenyTrustedCircuit message, using the CreateTrustedCircuit message.
Circuit Establishment
As all circuits are handled by the Message System, a circuit is established by calling LLMessageSystem::enableCircuit. If a circuit has not already been established, this function is in charge of creating one. While establishment of trust is also a parameter in circuit creation function, a trusted circuit will not be created unless the CreateTrustedCircuit message is sent using the correct handshake protocol.
Circuit Lifetime
Circuits are established at multiple points in a viewer's lifetime, including login, creation of child agents, and transfers between simulators (teleports or region crosses). Each of these circuits has multiple "pulse" methods to make sure the connection is alive, as well as that it is sending/receiving correct data.