-
Notifications
You must be signed in to change notification settings - Fork 32
Description
Is your feature request related to a problem? Please describe.
I'm implementing the ONC-RPC protocol using this XDR library. Part of the spec has structs that represent headers for arbitrary data requests and responses, thus I need a way to specify a type that basically says 'the rest of the data in the buffer', like varOpaque but without the length header.
For example, the struct:
struct accepted_reply {
opaque_auth verf;
union switch (accept_stat stat) {
case SUCCESS:
opaque results[0];
/*
* procedure-specific results start here
*/
case PROG_MISMATCH:
struct {
unsigned int low;
unsigned int high;
} mismatch_info;
default:
void;
} reply_data;
};The procedure-specific results start here is where the rest response of the rpc call lives. But how can I access that after using fromXDR?
Describe the solution you'd like
Here's what I've hacked together: https://github.com/EvanPurkhiser/prolink-typescript/blob/957918208b0399ceaa1d6978ae23c7d3415b8436/src/nfs/xdr.ts#L3-L18
Then the union definition looks like this
Describe alternatives you've considered
Alternatively some access to the cursor could potentially be OK, but it would be nice to get the data back as part of the result object