175 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
17 lines
931 B
C
17 lines
931 B
C
#pragma once
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
#include <string.h>
|
|
/* Public routing fields only. Caller separately proves actual engine ownership
|
|
* and the opaque Turtle channel authentication before using this layout helper.
|
|
* No account/session prefix, auth flags, tokens or realm-change state is set.
|
|
*/
|
|
static inline int gw_engine_adopt_realm_routing(void* owner,size_t size,uint32_t namespace_id,uint32_t previous_current,uint32_t previous_route){
|
|
uint32_t state,current,route;unsigned char* p=(unsigned char*)owner;
|
|
if(!p || size<0xc4b || !namespace_id)return -1;
|
|
memcpy(&state,p+0x98,4);memcpy(¤t,p+0x898,4);memcpy(&route,p+0x198,4);
|
|
if(state!=5 || p[0x7e8]!=1 || p[0xc49]!=1 || p[0xc4a] ||
|
|
(current!=previous_current && current!=namespace_id) || (route!=previous_route && route!=namespace_id))return -1;
|
|
memcpy(p+0x198,&namespace_id,4);memcpy(p+0x898,&namespace_id,4);return 0;
|
|
}
|