summaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
Diffstat (limited to 'rpc')
-rw-r--r--rpc/block.h53
-rw-r--r--rpc/block.x12
-rw-r--r--rpc/block_clnt.c25
-rw-r--r--rpc/block_svc.c102
-rw-r--r--rpc/block_xdr.c16
5 files changed, 208 insertions, 0 deletions
diff --git a/rpc/block.h b/rpc/block.h
new file mode 100644
index 0000000..54315b7
--- /dev/null
+++ b/rpc/block.h
@@ -0,0 +1,53 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#ifndef _BLOCK_H_RPCGEN
+#define _BLOCK_H_RPCGEN
+
+#include <rpc/rpc.h>
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+struct blockTrans {
+ int exit;
+ char *out;
+};
+typedef struct blockTrans blockTrans;
+
+#define GLUSTER_BLOCK 21215311
+#define GLUSTER_BLOCK_VERS 1
+
+#if defined(__STDC__) || defined(__cplusplus)
+#define BLOCK_EXEC 1
+extern blockTrans * block_exec_1(char **, CLIENT *);
+extern blockTrans * block_exec_1_svc(char **, struct svc_req *);
+extern int gluster_block_1_freeresult (SVCXPRT *, xdrproc_t, caddr_t);
+
+#else /* K&R C */
+#define BLOCK_EXEC 1
+extern blockTrans * block_exec_1();
+extern blockTrans * block_exec_1_svc();
+extern int gluster_block_1_freeresult ();
+#endif /* K&R C */
+
+/* the xdr functions */
+
+#if defined(__STDC__) || defined(__cplusplus)
+extern bool_t xdr_blockTrans (XDR *, blockTrans*);
+
+#else /* K&R C */
+extern bool_t xdr_blockTrans ();
+
+#endif /* K&R C */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !_BLOCK_H_RPCGEN */
diff --git a/rpc/block.x b/rpc/block.x
new file mode 100644
index 0000000..c88fdf2
--- /dev/null
+++ b/rpc/block.x
@@ -0,0 +1,12 @@
+
+
+struct blockTrans {
+ int exit; /* exit code of the command */
+ string out<>; /* stdout of the command */
+};
+
+program GLUSTER_BLOCK {
+ version GLUSTER_BLOCK_VERS {
+ blockTrans BLOCK_EXEC(string) = 1;
+ } = 1;
+} = 21215311; /* B2 L12 O15 C3 K11 */
diff --git a/rpc/block_clnt.c b/rpc/block_clnt.c
new file mode 100644
index 0000000..9e5b585
--- /dev/null
+++ b/rpc/block_clnt.c
@@ -0,0 +1,25 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include <memory.h> /* for memset */
+#include "block.h"
+
+/* Default timeout can be changed using clnt_control() */
+static struct timeval TIMEOUT = { 25, 0 };
+
+blockTrans *
+block_exec_1(char **argp, CLIENT *clnt)
+{
+ static blockTrans clnt_res;
+
+ memset((char *)&clnt_res, 0, sizeof(clnt_res));
+ if (clnt_call (clnt, BLOCK_EXEC,
+ (xdrproc_t) xdr_wrapstring, (caddr_t) argp,
+ (xdrproc_t) xdr_blockTrans, (caddr_t) &clnt_res,
+ TIMEOUT) != RPC_SUCCESS) {
+ return (NULL);
+ }
+ return (&clnt_res);
+}
diff --git a/rpc/block_svc.c b/rpc/block_svc.c
new file mode 100644
index 0000000..144b7e1
--- /dev/null
+++ b/rpc/block_svc.c
@@ -0,0 +1,102 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "block.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <rpc/pmap_clnt.h>
+#include <string.h>
+#include <memory.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+
+#ifndef SIG_PF
+#define SIG_PF void(*)(int)
+#endif
+
+static void
+gluster_block_1(struct svc_req *rqstp, register SVCXPRT *transp)
+{
+ union {
+ char *block_exec_1_arg;
+ } argument;
+ char *result;
+ xdrproc_t _xdr_argument, _xdr_result;
+ char *(*local)(char *, struct svc_req *);
+
+ switch (rqstp->rq_proc) {
+ case NULLPROC:
+ (void) svc_sendreply (transp, (xdrproc_t) xdr_void, (char *)NULL);
+ return;
+
+ case BLOCK_EXEC:
+ _xdr_argument = (xdrproc_t) xdr_wrapstring;
+ _xdr_result = (xdrproc_t) xdr_blockTrans;
+ local = (char *(*)(char *, struct svc_req *)) block_exec_1_svc;
+ break;
+
+ default:
+ svcerr_noproc (transp);
+ return;
+ }
+ memset ((char *)&argument, 0, sizeof (argument));
+ if (!svc_getargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ svcerr_decode (transp);
+ return;
+ }
+ result = (*local)((char *)&argument, rqstp);
+ if (result != NULL && !svc_sendreply(transp, (xdrproc_t) _xdr_result, result)) {
+ svcerr_systemerr (transp);
+ }
+ if (!svc_freeargs (transp, (xdrproc_t) _xdr_argument, (caddr_t) &argument)) {
+ fprintf (stderr, "%s", "unable to free arguments");
+ exit (1);
+ }
+ return;
+}
+
+int
+main (int argc, char **argv)
+{
+ register SVCXPRT *transp;
+ struct sockaddr_in addr;
+ int sockfd;
+
+ pmap_unset (GLUSTER_BLOCK, GLUSTER_BLOCK_VERS);
+
+ if ((sockfd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) {
+ fprintf (stderr, "%s", "socket failed");
+ }
+
+ addr.sin_family = AF_INET;
+ addr.sin_addr.s_addr = INADDR_ANY;
+ addr.sin_port = htons(24009);
+
+ if (bind(sockfd, (struct sockaddr *)&addr, sizeof (addr)) < 0) {
+ fprintf (stderr, "%s", "bind failed");
+ }
+
+ if (listen(sockfd, 10) < 0) {
+ fprintf (stderr, "%s", "server: listen failed");
+ exit(1);
+ }
+
+ transp = svctcp_create(sockfd, 0, 0);
+ if (transp == NULL) {
+ fprintf (stderr, "%s", "cannot create tcp service");
+ exit(1);
+ }
+
+ if (!svc_register(transp, GLUSTER_BLOCK, GLUSTER_BLOCK_VERS, gluster_block_1, IPPROTO_TCP)) {
+ fprintf (stderr, "%s", "unable to register (BLOCK_PROG, GLUSTER_BLOCK_VERS, tcp).");
+ exit(1);
+ }
+
+ svc_run ();
+
+ fprintf (stderr, "%s", "svc_run returned");
+ exit (1);
+ /* NOTREACHED */
+}
diff --git a/rpc/block_xdr.c b/rpc/block_xdr.c
new file mode 100644
index 0000000..cd8400e
--- /dev/null
+++ b/rpc/block_xdr.c
@@ -0,0 +1,16 @@
+/*
+ * Please do not edit this file.
+ * It was generated using rpcgen.
+ */
+
+#include "block.h"
+
+bool_t
+xdr_blockTrans (XDR *xdrs, blockTrans *objp)
+{
+ if (!xdr_int (xdrs, &objp->exit))
+ return FALSE;
+ if (!xdr_string (xdrs, &objp->out, ~0))
+ return FALSE;
+ return TRUE;
+}