Files
WoW-Hybrid-gateway/native/private_account_switch_gate.h
praxisandClaude Fable 5.2 8e02dccb86 In-client stack: transport, session lifecycle and engine bridge
175 files, from working commit b1a079a.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-19 01:32:48 +02:00

32 lines
1.4 KiB
C

#ifndef GW_PRIVATE_ACCOUNT_SWITCH_GATE_H
#define GW_PRIVATE_ACCOUNT_SWITCH_GATE_H
#include <stdint.h>
/* Diagnostic only: generation one and ordinary runs are unchanged. A private
* owner must explicitly arm a pre-create stop observer before admitting one
* next-generation realm attempt. This never authenticates or retires state. */
struct gw_private_account_switch_gate {
uint32_t abi, size, requested_generation, admitted_generation;
uint64_t owner;
volatile int32_t command;
uint32_t reserved;
};
_Static_assert(sizeof(struct gw_private_account_switch_gate)==32,"Private realm gate ABI differs");
#ifndef GW_PRIVATE_ACCOUNT_SWITCH_CAS
#define GW_PRIVATE_ACCOUNT_SWITCH_CAS(p,n,o) InterlockedCompareExchange((volatile LONG*)(p),(n),(o))
#endif
static int gw_private_account_switch_realm_allowed(
struct gw_private_account_switch_gate *gate, int enabled,
uint32_t generation, uint64_t owner) {
if(!enabled || generation<=1)return 1;
if(!gate || !owner || gate->abi!=1 || gate->size!=sizeof(*gate) ||
gate->reserved || gate->owner!=owner ||
gate->requested_generation!=generation)return 0;
if(gate->admitted_generation==generation &&
GW_PRIVATE_ACCOUNT_SWITCH_CAS(&gate->command,2,2)==2)return 1;
if(gate->admitted_generation ||
GW_PRIVATE_ACCOUNT_SWITCH_CAS(&gate->command,2,1)!=1)return 0;
gate->admitted_generation=generation;
return 1;
}
#endif