diff options
Diffstat (limited to 'rpc/rpc-lib/src/rpc-clnt.h')
| -rw-r--r-- | rpc/rpc-lib/src/rpc-clnt.h | 62 |
1 files changed, 34 insertions, 28 deletions
diff --git a/rpc/rpc-lib/src/rpc-clnt.h b/rpc/rpc-lib/src/rpc-clnt.h index a72370881..584963ad0 100644 --- a/rpc/rpc-lib/src/rpc-clnt.h +++ b/rpc/rpc-lib/src/rpc-clnt.h @@ -1,20 +1,11 @@ /* - Copyright (c) 2010 Gluster, Inc. <http://www.gluster.com> + Copyright (c) 2008-2012 Red Hat, Inc. <http://www.redhat.com> This file is part of GlusterFS. - GlusterFS is free software; you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published - by the Free Software Foundation; either version 3 of the License, - or (at your option) any later version. - - GlusterFS is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see - <http://www.gnu.org/licenses/>. + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. */ #ifndef __RPC_CLNT_H @@ -31,8 +22,10 @@ typedef enum { RPC_CLNT_MSG } rpc_clnt_event_t; -#define AUTH_GLUSTERFS 5 -#define RPC_CLNT_MAX_AUTH_BYTES 1024 + +#define SFRAME_GET_PROGNUM(sframe) (sframe->rpcreq->prog->prognum) +#define SFRAME_GET_PROGVER(sframe) (sframe->rpcreq->prog->progver) +#define SFRAME_GET_PROCNUM(sframe) (sframe->rpcreq->procnum) struct xptr_clnt; struct rpc_req; @@ -66,6 +59,7 @@ struct saved_frame { struct saved_frames { int64_t count; struct saved_frame sf; + struct saved_frame lk_sf; }; @@ -84,7 +78,7 @@ typedef struct rpc_clnt_program { int numproc; } rpc_clnt_prog_t; -typedef int (*rpcclnt_cb_fn) (void *data); +typedef int (*rpcclnt_cb_fn) (struct rpc_clnt *rpc, void *mydata, void *data); /* The descriptor for each procedure/actor that runs * over the RPC service. @@ -112,15 +106,17 @@ typedef struct rpcclnt_cb_program { /* list member to link to list of registered services with rpc_clnt */ struct list_head program; + + /* Needed for passing back in cb_actor */ + void *mydata; } rpcclnt_cb_program_t; -#define RPC_MAX_AUTH_BYTES 400 typedef struct rpc_auth_data { - int flavour; - int datalen; - char authdata[RPC_MAX_AUTH_BYTES]; + int flavour; + int datalen; + char authdata[GF_MAX_AUTH_BYTES]; } rpc_auth_data_t; @@ -167,7 +163,7 @@ struct rpc_req { void *conn_private; }; -struct rpc_clnt { +typedef struct rpc_clnt { pthread_mutex_t lock; rpc_clnt_notify_t notifyfn; rpc_clnt_connection_t conn; @@ -184,12 +180,15 @@ struct rpc_clnt { glusterfs_ctx_t *ctx; int refcount; -}; + int auth_null; + char disabled; +} rpc_clnt_t; -struct rpc_clnt * rpc_clnt_init (struct rpc_clnt_config *config, - dict_t *options, glusterfs_ctx_t *ctx, - char *name); +struct rpc_clnt *rpc_clnt_new (dict_t *options, glusterfs_ctx_t *ctx, + char *name, uint32_t reqpool_size); + +int rpc_clnt_start (struct rpc_clnt *rpc); int rpc_clnt_register_notify (struct rpc_clnt *rpc, rpc_clnt_notify_t fn, void *mydata); @@ -223,10 +222,11 @@ rpc_clnt_ref (struct rpc_clnt *rpc); struct rpc_clnt * rpc_clnt_unref (struct rpc_clnt *rpc); +int rpc_clnt_connection_cleanup (rpc_clnt_connection_t *conn); + void rpc_clnt_set_connected (rpc_clnt_connection_t *conn); void rpc_clnt_unset_connected (rpc_clnt_connection_t *conn); - void rpc_clnt_reconnect (void *trans_ptr); void rpc_clnt_reconfig (struct rpc_clnt *rpc, struct rpc_clnt_config *config); @@ -235,6 +235,12 @@ void rpc_clnt_reconfig (struct rpc_clnt *rpc, struct rpc_clnt_config *config); * procedure handlers. */ int rpcclnt_cbk_program_register (struct rpc_clnt *svc, - rpcclnt_cb_program_t *program); + rpcclnt_cb_program_t *program, void *mydata); + +void +rpc_clnt_disable (struct rpc_clnt *rpc); + +char +rpc_clnt_is_disabled (struct rpc_clnt *rpc); #endif /* !_RPC_CLNT_H */ |
