detphys_link.hconnection interface and room codes (version 1)
The layer that finds the other player and connects (8. Transports and room codes). It gives you a detphys_ to pass to the session.
| Function | Description |
|---|---|
detphys_link_abi_version | The version of this header (DETPHYS_) |
detphys_link_create | Creates a link from an implementation table (detphys_), to plug in your own transportUsage: Transports and room codes › Writing your own transport (your own server, ...) |
detphys_link_destroy | Destroys it (leaves the room) |
detphys_link_transport | Gets the transport to pass to the session (the link counts what is sent and received)Usage: Transports and room codes › Usage (the same for every transport) |
detphys_link_poll | Call every frame. Returns the current stateUsage: Transports and room codes › On the game side |
detphys_link_room_desc_default | Default room settings |
detphys_link_host | Creates a room (become the host). The room code is made, or yours is usedUsage: Transports and room codes › Usage (the same for every transport) |
detphys_link_join | Joins a room with a room code (become the guest). Typos are returned before any trafficUsage: Transports and room codes › Usage (the same for every transport) |
detphys_link_close | Leaves the room |
detphys_link_wait | Waits until something can be received (headless tests) |
detphys_link_get_info | State, role, path, reason, counters, room code |
detphys_link_error | Text for the last failure (with NULL, why creating failed)Usage: Transports and room codes › States and reasons |
detphys_link_state_name / detphys_link_reason_name | ASCII names of states and reasons (translation keys)Usage: Transports and room codes › States and reasons |
detphys_room_code_make | Makes a room code (six digits) from a seed |
detphys_room_code_parse | Checks typed text and normalizes it to six digits (skips full-width digits and separators; format error / check digit error)Usage: Transports and room codes › Room codes |
detphys_link_create_udp | A link over UDP (detphys_udp.h). The role is chosen at creationUsage: Transports and room codes › Transports that come with DetPhys |
detphys_link_create_loopback | A link wrapping one side of a loopbackUsage: Transports and room codes › Transports that come with DetPhys |
detphys_link_hub_desc_default | Default test lobby settings |
detphys_link_hub_create / detphys_link_hub_destroy | Creates / destroys a test lobbyUsage: Transports and room codes › Transports that come with DetPhys |
detphys_link_hub_pump | Advances the test lobby's time by oneUsage: Transports and room codes › Transports that come with DetPhys |
detphys_link_hub_room_count | The number of rooms now |
detphys_link_create_hub | Creates a link to the test lobbyUsage: Transports and room codes › Transports that come with DetPhys |
| Struct | Description |
|---|---|
detphys_link | A link (opaque)Usage: Transports and room codes › Usage (the same for every transport) |
detphys_link_room_desc | Room settings (members, bucket, room code, seed for making a code, timeout)Usage: Transports and room codes › Room codes |
detphys_link_info | State, role, path, reason, round trip, datagram limit, largest datagram sent, counters, kind, room code, descriptions of the other side and yourselfUsage: Transports and room codes › Room codes |
detphys_link_vtable | An implementation table (send, recv and get_info are required; poll, host, join, wait, error, close and destroy are optional)Usage: Transports and room codes › Writing your own transport (your own server, ...) |
detphys_link_hub | A test lobby (opaque) |
detphys_link_hub_desc | Test lobby settings (time per operation, room limit, path to report, datagram limit, per-room transport)Usage: Transports and room codes › Transports that come with DetPhys |
Constants: results DETPHYS_LINK_OK, DETPHYS_LINK_E_* (ARGUMENT, UNSUPPORTED, STATE, CODE_FORMAT, CODE_CHECK, TOO_LARGE, NOT_READY, BACKEND, MEMORY); states DETPHYS_ (IDLE, OPENING, WAITING, CONNECTED, CLOSED, FAILED); roles DETPHYS_ (HOST = 0, GUEST = 1, UNKNOWN); paths DETPHYS_ (UNKNOWN, DIRECT, RELAYED, LOCAL); reasons DETPHYS_; room codes DETPHYS_ (6), DETPHYS_ (8).