glusterfs  8.2
About: GlusterFS is a network/cluster filesystem. The storage server (or each in a cluster) runs glusterfsd and the clients use mount command or glusterfs client to mount the exported filesystem. Release series 8.x (latest version).
  Fossies Dox: glusterfs-8.2.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

xdr-rpc.h
Go to the documentation of this file.
1 /*
2  Copyright (c) 2008-2012 Red Hat, Inc. <http://www.redhat.com>
3  This file is part of GlusterFS.
4 
5  This file is licensed to you under your choice of the GNU Lesser
6  General Public License, version 3 or any later version (LGPLv3 or
7  later), or the GNU General Public License, version 2 (GPLv2), in all
8  cases as published by the Free Software Foundation.
9 */
10 
11 #ifndef _XDR_RPC_H_
12 #define _XDR_RPC_H_
13 
14 #ifndef GF_SOLARIS_HOST_OS
15 #include <rpc/rpc.h>
16 #endif
17 
18 #ifdef GF_SOLARIS_HOST_OS
19 #include <rpc/auth.h>
20 #include <rpc/auth_sys.h>
21 #endif
22 
23 #include <arpa/inet.h>
24 #include <rpc/xdr.h>
25 #include <sys/uio.h>
26 
27 #include "xdr-common.h"
28 
29 typedef enum {
31  AUTH_GLUSTERFS_v2 = 390039, /* using a number from 'unused' range,
32  from the list available in RFC5531 */
33  AUTH_GLUSTERFS_v3 = 390040, /* this too is unused */
35 
36 /* Converts a given network buffer from its XDR format to a structure
37  * that contains everything an RPC call needs to work.
38  */
39 extern int
40 xdr_to_rpc_call(char *msgbuf, size_t len, struct rpc_msg *call,
41  struct iovec *payload, char *credbytes, char *verfbytes);
42 
43 extern int
44 rpc_fill_empty_reply(struct rpc_msg *reply, uint32_t xid);
45 
46 extern int
47 rpc_fill_denied_reply(struct rpc_msg *reply, int rjstat, int auth_err);
48 
49 extern int
50 rpc_fill_accepted_reply(struct rpc_msg *reply, int arstat, int proglow,
51  int proghigh, int verf, int len, char *vdata);
52 extern int
53 rpc_reply_to_xdr(struct rpc_msg *reply, char *dest, size_t len,
54  struct iovec *dst);
55 
56 extern int
57 xdr_to_auth_unix_cred(char *msgbuf, int msglen, struct authunix_parms *au,
58  char *machname, gid_t *gids);
59 /* Macros that simplify accessing the members of an RPC call structure. */
60 #define rpc_call_xid(call) ((call)->rm_xid)
61 #define rpc_call_direction(call) ((call)->rm_direction)
62 #define rpc_call_rpcvers(call) ((call)->ru.RM_cmb.cb_rpcvers)
63 #define rpc_call_program(call) ((call)->ru.RM_cmb.cb_prog)
64 #define rpc_call_progver(call) ((call)->ru.RM_cmb.cb_vers)
65 #define rpc_call_progproc(call) ((call)->ru.RM_cmb.cb_proc)
66 #define rpc_opaque_auth_flavour(oa) ((oa)->oa_flavor)
67 #define rpc_opaque_auth_len(oa) ((oa)->oa_length)
68 
69 #define rpc_call_cred_flavour(call) \
70  (rpc_opaque_auth_flavour((&(call)->ru.RM_cmb.cb_cred)))
71 #define rpc_call_cred_len(call) \
72  (rpc_opaque_auth_len((&(call)->ru.RM_cmb.cb_cred)))
73 
74 #define rpc_call_verf_flavour(call) \
75  (rpc_opaque_auth_flavour((&(call)->ru.RM_cmb.cb_verf)))
76 #define rpc_call_verf_len(call) \
77  (rpc_opaque_auth_len((&(call)->ru.RM_cmb.cb_verf)))
78 
79 #if defined(GF_DARWIN_HOST_OS) || !defined(HAVE_RPC_RPC_H)
80 #define GF_PRI_RPC_XID PRIu32
81 #define GF_PRI_RPC_VERSION PRIu32
82 #define GF_PRI_RPC_PROG_ID PRIu32
83 #define GF_PRI_RPC_PROG_VERS PRIu32
84 #define GF_PRI_RPC_PROC PRIu32
85 #define GF_PRI_RPC_PROC_VERSION PRIu32
86 #else
87 #define GF_PRI_RPC_XID PRIu64
88 #define GF_PRI_RPC_VERSION PRIu64
89 #define GF_PRI_RPC_PROG_ID PRIu64
90 #define GF_PRI_RPC_PROG_VERS PRIu64
91 #define GF_PRI_RPC_PROC PRIu64
92 #define GF_PRI_RPC_PROC_VERSION PRIu64
93 #endif
94 
95 #endif
AUTH_GLUSTERFS_v2
@ AUTH_GLUSTERFS_v2
Definition: xdr-rpc.h:31
rpc_fill_accepted_reply
int rpc_fill_accepted_reply(struct rpc_msg *reply, int arstat, int proglow, int proghigh, int verf, int len, char *vdata)
Definition: xdr-rpc.c:115
rpc_fill_denied_reply
int rpc_fill_denied_reply(struct rpc_msg *reply, int rjstat, int auth_err)
Definition: xdr-rpc.c:91
S40ufo-stop.dest
dest
Definition: S40ufo-stop.py:15
xdr_to_rpc_call
int xdr_to_rpc_call(char *msgbuf, size_t len, struct rpc_msg *call, struct iovec *payload, char *credbytes, char *verfbytes)
Definition: xdr-rpc.c:24
xdr-common.h
gf_rpc_authtype_t
gf_rpc_authtype_t
Definition: xdr-rpc.h:29
rpc_reply_to_xdr
int rpc_reply_to_xdr(struct rpc_msg *reply, char *dest, size_t len, struct iovec *dst)
Definition: xdr-rpc.c:145
AUTH_GLUSTERFS
@ AUTH_GLUSTERFS
Definition: xdr-rpc.h:30
xdr_to_auth_unix_cred
int xdr_to_auth_unix_cred(char *msgbuf, int msglen, struct authunix_parms *au, char *machname, gid_t *gids)
Definition: xdr-rpc.c:170
rpc_fill_empty_reply
int rpc_fill_empty_reply(struct rpc_msg *reply, uint32_t xid)
Definition: xdr-rpc.c:72
AUTH_GLUSTERFS_v3
@ AUTH_GLUSTERFS_v3
Definition: xdr-rpc.h:33