You have to pass the payload
pointer by reference, and de-reference it in your STRIP_CONTAINER
function. In your original call, you are passing the value of payload
. This means that you are creating a copy of payload
in STRIP CONTAINER
's call stack and operating on the copy instead of the "original." The copy is lost after STRIP_CONTAINER
terminates.
The function header/prototype of STRIP_CONTAINER
will instead look like this:
void STRIP_CONTAINER(const char *container, uint16_t *type, uint16_t *code, uint64_t *payload_size, char **payload)
Inside your function, you can de-reference payload
normally and operate on it.
Your call can then be modified to:
STRIP_CONTAINER(container, &type, &code, &payload_size, &payload);