122 lines
7.1 KiB
C
122 lines
7.1 KiB
C
#pragma once
|
||
#include "session.h"
|
||
#define GW_WINE_WIRE_ABI 1
|
||
/* WORLD_PACKET-only breadcrumbs in the existing reserved word. This is
|
||
* metadata, not a wire opcode or a change to the shared call layout. */
|
||
#define GW_WORLD_CALL_PHASE_MAGIC 0x47570000u
|
||
#define GW_WORLD_CALL_PHASE_MAX 4u
|
||
/* Successful local gameplay call with a pending presentation in the current world. */
|
||
#define GW_WIRE_LOCAL_PRESENTATION_READY 0x504f4931u
|
||
enum gw_wire_operation {
|
||
GW_WIRE_PING, GW_WIRE_AUTHENTICATE, GW_WIRE_DISCOVER, GW_WIRE_REALM_COUNT,
|
||
GW_WIRE_REALM_AT, GW_WIRE_LOGIN_CLOSE, GW_WIRE_TRANSPORT_OPEN,
|
||
GW_WIRE_PORT, GW_WIRE_CHALLENGE, GW_WIRE_AUTH_REQUEST, GW_WIRE_FEED,
|
||
GW_WIRE_PACKET, GW_WIRE_SEND, GW_WIRE_AUTHENTICATED, GW_WIRE_TRANSPORT_CLOSE,
|
||
GW_WIRE_CHARACTER_COUNT, GW_WIRE_CHARACTER_AT, GW_WIRE_ENCODE_ROSTER, GW_WIRE_COUNTS,
|
||
GW_WIRE_AUTH_INITIALIZATION, GW_WIRE_GLUE_FEATURES, GW_WIRE_RESTRICTIONS, GW_WIRE_CLIENT_INITIALIZATION, GW_WIRE_DB_REPLY_MISSING,
|
||
GW_WIRE_BEGIN_WORLD, GW_WIRE_WORLD_PACKET, GW_WIRE_ACTIVE_MOVER, GW_WIRE_MOVEMENT, GW_WIRE_SAY, GW_WIRE_WORLD_REQUEST, GW_WIRE_ENTITY_STATE, GW_WIRE_MOTION_STATE, GW_WIRE_GAMEPLAY, GW_WIRE_INVENTORY_STATE, GW_WIRE_HOTFIX_REPLY, GW_WIRE_AURA_STATE,
|
||
GW_WIRE_AUTHENTICATE_MEMORY, GW_WIRE_AUTHENTICATE_MEMORY_IPV4,
|
||
GW_WIRE_TRANSPORT_OPEN_IPV4, GW_WIRE_ROSTER_DIAGNOSTICS,
|
||
GW_WIRE_CREATE_CHARACTER, GW_WIRE_CREATE_RESULT, GW_WIRE_PRIVATE_GAMEPLAY_CAPTURE,
|
||
GW_WIRE_AUTHENTICATE_MEMORY_IPV4_HASH,
|
||
GW_WIRE_TRANSPORT_OPEN_IPV4_BYTES,
|
||
/* No input. Registry-locked authenticated preSelf SourceGUID/spell copy;
|
||
* see gw_native_transport_initial_spell_ids. Existing operations unchanged. */
|
||
GW_WIRE_INITIAL_SPELL_IDS,
|
||
/* Passive metadata only: opcode + build(bytecount), no input/output. */
|
||
GW_WIRE_DIAGNOSTIC_CLIENT_DROP,
|
||
GW_WIRE_CONFIRM_REALM_LIST,
|
||
/* No input; authenticated plain account name, bounded33-byte output incl NUL. */
|
||
GW_WIRE_ACCOUNT_NAME,
|
||
/* Same ABI layout; reserved carries validated Source challenge_mask input. */
|
||
GW_WIRE_CREATE_CHARACTER_CHALLENGES
|
||
};
|
||
/* Exact70334 native client controls. Pinned ClassicOpcodes::TranslateClientOpcode
|
||
* lowers current connection group0x46 to70245group0x45 before its explicit
|
||
* 450008->core440008 mapping. Main-group WorldPortResponse stays440025.
|
||
* These are native opcodes, not new wire operations or an ABI/layout change. */
|
||
enum gw_native_far_opcode {
|
||
GW_NATIVE_SUSPEND_TOKEN_RESPONSE=0x460008,
|
||
GW_NATIVE_WORLD_PORT_RESPONSE=0x440025
|
||
};
|
||
enum gw_native_far_control {GW_NATIVE_FAR_NONE,GW_NATIVE_FAR_SUSPEND,GW_NATIVE_FAR_WORLDPORT};
|
||
static inline unsigned gw_native_far_control_kind(uint32_t opcode){
|
||
if(opcode==GW_NATIVE_SUSPEND_TOKEN_RESPONSE)return GW_NATIVE_FAR_SUSPEND;
|
||
if(opcode==GW_NATIVE_WORLD_PORT_RESPONSE)return GW_NATIVE_FAR_WORLDPORT;
|
||
return GW_NATIVE_FAR_NONE;
|
||
}
|
||
/* Append-only creation operations40/41. Input for CREATE_CHARACTER is only
|
||
* native420070 body; source transport authentication remains mandatory.
|
||
* output is selected solely by value; required is its bounded byte count.
|
||
* SOURCE_FRAME is already encrypted by the existing source transport sender;
|
||
* NATIVE_REPLY is a native4701ac body for the original packet queue.
|
||
* CREATE_RESULT has no input and polls already observed genuine3a/3b outcomes.
|
||
* No outcome or followup is consumed on capacity−3. BUSY never replays source36.
|
||
*/
|
||
enum gw_wire_create_action {GW_CREATE_NONE=0,GW_CREATE_SOURCE_FRAME=1,GW_CREATE_NATIVE_REPLY=2};
|
||
enum gw_wire_create_rejection {GW_CREATE_REJECT_NONE=0,GW_CREATE_REJECT_UNSUPPORTED=1,GW_CREATE_REJECT_BUSY=2,GW_CREATE_REJECT_MALFORMED=3};
|
||
/* Fixed64-bit own-module ABI. Account/transport numbers are typed registry tokens,
|
||
* never engine objects, socket descriptors, keys or raw C++ ownership pointers.
|
||
* Buffer pointers remain borrowed in the same process for the synchronous call.
|
||
* AUTHENTICATE_MEMORY uses auth.{abi,auth_port,username,version_hash_path} and
|
||
* input/input_bytes for 1..64 password bytes. auth.password_path must be null.
|
||
* It never retains the password; its owner must wipe it after dispatch returns.
|
||
* AUTHENTICATE_MEMORY_IPV4 borrows input as exactly one
|
||
* gw_native_auth_memory_ipv4_config (including its pointed inputs), with every
|
||
* auth field zero. TRANSPORT_OPEN_IPV4 requires that explicit-profile login.
|
||
* Neither operation adds DNS, endpoint defaults, or a world socket.
|
||
* The existing POD layout and all preceding operation numbers stay unchanged.
|
||
*/
|
||
struct gw_wire_call {
|
||
uint32_t abi,size;
|
||
int32_t result;
|
||
uint32_t operation;
|
||
uint64_t login,transport;
|
||
struct gw_native_auth_config auth;
|
||
uint32_t index,build,opcode,input_bytes,capacity,required,consumed,value;
|
||
uint32_t realm_id,virtual_address,super_district,reserved;
|
||
const char* addon_path;
|
||
const uint8_t* input;
|
||
uint8_t* output;
|
||
struct gw_native_packet packet;
|
||
struct gw_native_character character;
|
||
struct gw_native_realm realm;
|
||
};
|
||
|
||
/* Optional private control specimens; unchanged wire-call ABI/admission.
|
||
* Inspect's18B cap bounds one packed128-GUID-sized specimen; it does not
|
||
* certify its grammar or authorize forwarding. Bank auto-store's3B cap is
|
||
* likewise a specimen bound, not field-order proof.
|
||
* Other opcodes remain metadata.
|
||
*/
|
||
#define GW_WIRE_PRIVATE_INVITE_BODY_MAX 4096u
|
||
#define GW_WIRE_PRIVATE_INSPECT_BODY_MAX 18u
|
||
#define GW_WIRE_PRIVATE_BANK_AUTOSTORE_BODY_MAX 3u
|
||
#define GW_WIRE_PRIVATE_LOGOUT_BODY_MAX 1u
|
||
#define GW_WIRE_PRIVATE_AREA_TRIGGER_BODY_MAX 5u
|
||
#define GW_WIRE_PRIVATE_LOG_DISCONNECT_BODY_BYTES 4u
|
||
static inline uint32_t gw_wire_private_body_limit(uint32_t opcode){
|
||
if(opcode==0x440030)return GW_WIRE_PRIVATE_INVITE_BODY_MAX;
|
||
if(opcode==0x3f00ce)return GW_WIRE_PRIVATE_INSPECT_BODY_MAX;
|
||
if(opcode==0x410002)return GW_WIRE_PRIVATE_BANK_AUTOSTORE_BODY_MAX;
|
||
if(opcode==0x3f0074)return GW_WIRE_PRIVATE_LOGOUT_BODY_MAX;
|
||
if(opcode==0x3e008a)return GW_WIRE_PRIVATE_AREA_TRIGGER_BODY_MAX;
|
||
if(opcode==0x460007)return GW_WIRE_PRIVATE_LOG_DISCONNECT_BODY_BYTES;
|
||
return 0;
|
||
}
|
||
#define GW_WIRE_PRIVATE_HOTFIX_BODY_MAX 1048576u
|
||
static inline int gw_wire_private_gameplay_body_input(struct gw_wire_call* c,int authenticated,int self_created,const uint8_t* body,uint32_t bytes){
|
||
/* Server hotfix replies are recorded only after the engine submit returns.
|
||
Login hotfixes can precede self creation; authentication is still required. */
|
||
if(c && c->operation==GW_WIRE_PRIVATE_GAMEPLAY_CAPTURE && c->index==4){
|
||
if(!authenticated || (c->opcode!=0x4b0003u && c->opcode!=0x4b0000u) || !body || bytes<(c->opcode==0x4b0000u?17u:8u) ||
|
||
bytes>GW_WIRE_PRIVATE_HOTFIX_BODY_MAX || bytes!=c->build)return 0;
|
||
c->input=body;c->input_bytes=bytes;return 1;
|
||
}
|
||
if(!c || c->operation!=GW_WIRE_PRIVATE_GAMEPLAY_CAPTURE || c->index!=1 ||
|
||
!authenticated || !self_created || !body || !bytes || bytes>gw_wire_private_body_limit(c->opcode) || bytes!=c->build)return 0;
|
||
if(c->opcode==0x3e008a && bytes!=GW_WIRE_PRIVATE_AREA_TRIGGER_BODY_MAX)return 0;
|
||
if(c->opcode==0x460007 && bytes!=GW_WIRE_PRIVATE_LOG_DISCONNECT_BODY_BYTES)return 0;
|
||
c->input=body;c->input_bytes=bytes;return 1;
|
||
}
|