aboutsummaryrefslogtreecommitdiff
path: root/xdr.c
diff options
context:
space:
mode:
authorPaul Selkirk <paul@psgd.org>2016-06-30 21:52:59 -0400
committerPaul Selkirk <paul@psgd.org>2016-06-30 21:52:59 -0400
commit3ba7ca4155c7be439108b174a3b49a508923d378 (patch)
treec066815bbb29ad52fd309c6b5103cbd1bb9716c3 /xdr.c
parent709a71c0030225ba08cddf5227a1c67c2dbb4176 (diff)
RPC wire format now includes client handle in all requests, and opcode and
client handle in all responses. This simplies the daemon a little, and means that the directly-connected serial client uses the same wire format as the daemon. The expense is some redundant code in rpc_client and rpc_server to process (and throw away) this extra stuff.
Diffstat (limited to 'xdr.c')
-rw-r--r--xdr.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/xdr.c b/xdr.c
index 6266d99..27b8593 100644
--- a/xdr.c
+++ b/xdr.c
@@ -75,6 +75,17 @@ hal_error_t hal_xdr_decode_int(const uint8_t ** const inbuf, const uint8_t * con
return HAL_OK;
}
+/* Undo the last decode_int - roll back the input pointer.
+ */
+hal_error_t hal_xdr_undecode_int(const uint8_t ** const inbuf)
+{
+ if (inbuf == NULL || *inbuf == NULL)
+ return HAL_ERROR_BAD_ARGUMENTS;
+
+ *inbuf -= sizeof(uint32_t);
+ return HAL_OK;
+}
+
/* encode/decode_buffer. This covers variable-length string and opaque types.
* The data is preceded by a 4-byte length word (encoded as above), and padded
* to a multiple of 4 bytes as necessary.