summaryrefslogtreecommitdiffstats
path: root/rpc/xdr/src/rpc-common-xdr.x
diff options
context:
space:
mode:
authorAmar Tumballi <amarts@redhat.com>2017-12-19 16:10:11 +0530
committerAmar Tumballi <amarts@redhat.com>2017-12-27 05:20:30 +0000
commitb868d6077c14e3653fdaddcb856ab2bf6ceb9c00 (patch)
tree201f61db8690929aa967808816b49d1d4280c385 /rpc/xdr/src/rpc-common-xdr.x
parent9a47978877a5415dbbac94b93b4b30d055349681 (diff)
dict: support better on-wire transfer
This patch brings data type awareness to dictionary, and also makes sure valid data is properly sent to the other side of the wire using XDR. Next step is to allow people to add more data types (for example, Bool, UUID, iatt etc), and then make it part of every fop signature in wire. Fixes #203 Change-Id: Ie0eee2db847bea2bf7dad80dec89ce3e7c5917c1 Signed-off-by: Amar Tumballi <amarts@redhat.com>
Diffstat (limited to 'rpc/xdr/src/rpc-common-xdr.x')
-rw-r--r--rpc/xdr/src/rpc-common-xdr.x23
1 files changed, 23 insertions, 0 deletions
diff --git a/rpc/xdr/src/rpc-common-xdr.x b/rpc/xdr/src/rpc-common-xdr.x
index 7ccfbb11a51..1af7c8041ed 100644
--- a/rpc/xdr/src/rpc-common-xdr.x
+++ b/rpc/xdr/src/rpc-common-xdr.x
@@ -17,6 +17,7 @@
* not captured in any section specific file */
%#include "xdr-common.h"
+%#include "glusterfs-fops.h"
struct auth_glusterfs_parms_v2 {
int pid;
@@ -64,3 +65,25 @@ struct gf_common_rsp {
int op_errno;
opaque xdata<>; /* Extra data */
} ;
+
+
+union gfx_value switch (gf_dict_data_type_t type) {
+ case GF_DATA_TYPE_INT:
+ hyper value_int;
+ case GF_DATA_TYPE_UINT:
+ unsigned hyper value_uint;
+ case GF_DATA_TYPE_DOUBLE:
+ double value_dbl;
+ case GF_DATA_TYPE_STR:
+ opaque val_string<>;
+};
+
+struct gfx_dict_pair {
+ opaque key<>;
+ gfx_value value;
+};
+
+struct gfx_dict {
+ unsigned int count;
+ gfx_dict_pair pairs<>;
+};