summaryrefslogtreecommitdiffstats
path: root/rpc/xdr
diff options
context:
space:
mode:
authorPranith Kumar K <pranithk@gluster.com>2010-09-15 06:49:56 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-09-15 07:18:14 -0700
commitc109ffb893ab80dd7b9dac038f5778961859ceff (patch)
tree27bdaf888e941008abe496c4dc4721b5950d3ba4 /rpc/xdr
parent89ec6582d1977c98372cb69f6471fcfde8437bb7 (diff)
cli, mgmt/glusterd: disallow probe to a cluster
Signed-off-by: Pranith Kumar K <pranithk@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1594 (make probe oneway) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1594
Diffstat (limited to 'rpc/xdr')
-rw-r--r--rpc/xdr/src/glusterd1-xdr.c61
-rw-r--r--rpc/xdr/src/glusterd1-xdr.h12
-rw-r--r--rpc/xdr/src/glusterd1.x3
3 files changed, 66 insertions, 10 deletions
diff --git a/rpc/xdr/src/glusterd1-xdr.c b/rpc/xdr/src/glusterd1-xdr.c
index 7c9038dcfc4..fce8b87cb63 100644
--- a/rpc/xdr/src/glusterd1-xdr.c
+++ b/rpc/xdr/src/glusterd1-xdr.c
@@ -27,6 +27,7 @@
bool_t
xdr_glusterd_volume_status (XDR *xdrs, glusterd_volume_status *objp)
{
+
if (!xdr_enum (xdrs, (enum_t *) objp))
return FALSE;
return TRUE;
@@ -57,6 +58,10 @@ xdr_gd1_mgmt_probe_rsp (XDR *xdrs, gd1_mgmt_probe_rsp *objp)
return FALSE;
if (!xdr_int (xdrs, &objp->port))
return FALSE;
+ if (!xdr_int (xdrs, &objp->op_ret))
+ return FALSE;
+ if (!xdr_int (xdrs, &objp->op_errno))
+ return FALSE;
return TRUE;
}
@@ -192,6 +197,52 @@ bool_t
xdr_gd1_mgmt_stage_op_rsp (XDR *xdrs, gd1_mgmt_stage_op_rsp *objp)
{
+ register int32_t *buf;
+
+ if (xdrs->x_op == XDR_ENCODE) {
+ if (!xdr_vector (xdrs, (char *)objp->uuid, 16,
+ sizeof (u_char), (xdrproc_t) xdr_u_char))
+ return FALSE;
+ buf = XDR_INLINE (xdrs, 3 * BYTES_PER_XDR_UNIT);
+ if (buf == NULL) {
+ if (!xdr_int (xdrs, &objp->op))
+ return FALSE;
+ if (!xdr_int (xdrs, &objp->op_ret))
+ return FALSE;
+ if (!xdr_int (xdrs, &objp->op_errno))
+ return FALSE;
+
+ } else {
+ IXDR_PUT_LONG(buf, objp->op);
+ IXDR_PUT_LONG(buf, objp->op_ret);
+ IXDR_PUT_LONG(buf, objp->op_errno);
+ }
+ if (!xdr_string (xdrs, &objp->op_errstr, ~0))
+ return FALSE;
+ return TRUE;
+ } else if (xdrs->x_op == XDR_DECODE) {
+ if (!xdr_vector (xdrs, (char *)objp->uuid, 16,
+ sizeof (u_char), (xdrproc_t) xdr_u_char))
+ return FALSE;
+ buf = XDR_INLINE (xdrs, 3 * BYTES_PER_XDR_UNIT);
+ if (buf == NULL) {
+ if (!xdr_int (xdrs, &objp->op))
+ return FALSE;
+ if (!xdr_int (xdrs, &objp->op_ret))
+ return FALSE;
+ if (!xdr_int (xdrs, &objp->op_errno))
+ return FALSE;
+
+ } else {
+ objp->op = IXDR_GET_LONG(buf);
+ objp->op_ret = IXDR_GET_LONG(buf);
+ objp->op_errno = IXDR_GET_LONG(buf);
+ }
+ if (!xdr_string (xdrs, &objp->op_errstr, ~0))
+ return FALSE;
+ return TRUE;
+ }
+
if (!xdr_vector (xdrs, (char *)objp->uuid, 16,
sizeof (u_char), (xdrproc_t) xdr_u_char))
return FALSE;
@@ -225,6 +276,7 @@ xdr_gd1_mgmt_commit_op_rsp (XDR *xdrs, gd1_mgmt_commit_op_rsp *objp)
{
register int32_t *buf;
+
if (xdrs->x_op == XDR_ENCODE) {
if (!xdr_vector (xdrs, (char *)objp->uuid, 16,
sizeof (u_char), (xdrproc_t) xdr_u_char))
@@ -237,8 +289,6 @@ xdr_gd1_mgmt_commit_op_rsp (XDR *xdrs, gd1_mgmt_commit_op_rsp *objp)
return FALSE;
if (!xdr_int (xdrs, &objp->op_errno))
return FALSE;
- if (!xdr_string (xdrs, &objp->op_errstr, ~0))
- return FALSE;
} else {
IXDR_PUT_LONG(buf, objp->op);
@@ -247,6 +297,8 @@ xdr_gd1_mgmt_commit_op_rsp (XDR *xdrs, gd1_mgmt_commit_op_rsp *objp)
}
if (!xdr_bytes (xdrs, (char **)&objp->dict.dict_val, (u_int *) &objp->dict.dict_len, ~0))
return FALSE;
+ if (!xdr_string (xdrs, &objp->op_errstr, ~0))
+ return FALSE;
return TRUE;
} else if (xdrs->x_op == XDR_DECODE) {
if (!xdr_vector (xdrs, (char *)objp->uuid, 16,
@@ -260,8 +312,6 @@ xdr_gd1_mgmt_commit_op_rsp (XDR *xdrs, gd1_mgmt_commit_op_rsp *objp)
return FALSE;
if (!xdr_int (xdrs, &objp->op_errno))
return FALSE;
- if (!xdr_string (xdrs, &objp->op_errstr, ~0))
- return FALSE;
} else {
objp->op = IXDR_GET_LONG(buf);
@@ -270,6 +320,8 @@ xdr_gd1_mgmt_commit_op_rsp (XDR *xdrs, gd1_mgmt_commit_op_rsp *objp)
}
if (!xdr_bytes (xdrs, (char **)&objp->dict.dict_val, (u_int *) &objp->dict.dict_len, ~0))
return FALSE;
+ if (!xdr_string (xdrs, &objp->op_errstr, ~0))
+ return FALSE;
return TRUE;
}
@@ -286,7 +338,6 @@ xdr_gd1_mgmt_commit_op_rsp (XDR *xdrs, gd1_mgmt_commit_op_rsp *objp)
return FALSE;
if (!xdr_string (xdrs, &objp->op_errstr, ~0))
return FALSE;
-
return TRUE;
}
diff --git a/rpc/xdr/src/glusterd1-xdr.h b/rpc/xdr/src/glusterd1-xdr.h
index fe7c44eb29f..74e4d9d7656 100644
--- a/rpc/xdr/src/glusterd1-xdr.h
+++ b/rpc/xdr/src/glusterd1-xdr.h
@@ -52,6 +52,8 @@ struct gd1_mgmt_probe_rsp {
u_char uuid[16];
char *hostname;
int port;
+ int op_ret;
+ int op_errno;
};
typedef struct gd1_mgmt_probe_rsp gd1_mgmt_probe_rsp;
@@ -149,11 +151,11 @@ struct gd1_mgmt_commit_op_rsp {
int op;
int op_ret;
int op_errno;
- struct {
- u_int dict_len;
- char *dict_val;
- } dict;
- char *op_errstr;
+ struct {
+ u_int dict_len;
+ char *dict_val;
+ } dict;
+ char *op_errstr;
};
typedef struct gd1_mgmt_commit_op_rsp gd1_mgmt_commit_op_rsp;
diff --git a/rpc/xdr/src/glusterd1.x b/rpc/xdr/src/glusterd1.x
index a4f7b8558f7..ad6d32219e2 100644
--- a/rpc/xdr/src/glusterd1.x
+++ b/rpc/xdr/src/glusterd1.x
@@ -14,6 +14,8 @@
unsigned char uuid[16];
string hostname<>;
int port;
+ int op_ret;
+ int op_errno;
} ;
struct gd1_mgmt_friend_req {
@@ -92,6 +94,7 @@ struct gd1_mgmt_commit_op_rsp {
int op;
int op_ret;
int op_errno;
+ opaque dict<>;
string op_errstr<>;
} ;