Files
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

17 lines
1.1 KiB
C++

#include "source_auth_detail_contract.h"
/* Opt-in, same-generation Source rejection detail; no UI/native error mapping. */
static volatile LONG64 gw_auth_detail_record;
static int gw_auth_detail_valid(uint32_t v){uint32_t phase=(v>>8)&255u;return (v&0xffff0000u)==GW_AUTH_DETAIL_RESPONSE_V1 && (phase==1||phase==2) && (v&255u);}
static void gw_auth_detail_begin(uint32_t generation){InterlockedExchange64(&gw_auth_detail_record,(LONG64)((uint64_t)generation<<32));}
static void gw_auth_detail_clear(void){InterlockedExchange64(&gw_auth_detail_record,0);}
static void gw_auth_detail_publish(uint32_t generation,uint32_t value){
uint64_t empty=(uint64_t)generation<<32;
if(!generation||generation>64||!gw_auth_detail_valid(value))return;
InterlockedCompareExchange64(&gw_auth_detail_record,(LONG64)(empty|value),(LONG64)empty);
}
__declspec(dllexport) uint32_t WINAPI gw_source_auth_detail_v1(uint32_t generation){
uint64_t record=(uint64_t)InterlockedCompareExchange64(&gw_auth_detail_record,0,0);
uint32_t value=(uint32_t)record;
return generation && (uint32_t)(record>>32)==generation && gw_auth_detail_valid(value)?value:0;
}