backport to buster
[hcoop/debian/openafs.git] / tests / rpctestlib / rpc_test_procs.h
CommitLineData
805e021f
CE
1/*
2 * Copyright (c) 2010, Linux Box Corporation.
3 * All Rights Reserved.
4 *
5 * Portions Copyright (c) 2007, Hartmut Reuter,
6 * RZG, Max-Planck-Institut f. Plasmaphysik.
7 * All Rights Reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in
16 * the documentation and/or other materials provided with the
17 * distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
20 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
21 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
26 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31#ifndef _RPC_TEST_PROCS_H
32#define _RPC_TEST_PROCS_H
33
34#include <afsconfig.h>
35#include <afs/param.h>
36#include <afs/stds.h>
37
38#include <afs/afsutil.h>
39#include <rx/rx.h>
40#include <rx/xdr.h>
41#include <afs/afs_consts.h>
42#include <afs/afsint.h>
43#define FSINT_COMMON_XG 1
44#include <afs/afscbint.h>
45#include <pthread.h>
46
47#define RPC_TEST_REQ_CTX_FLAG_NONE 0x0000
48#define RPC_TEST_REQ_CTX_FLAG_XCB 0x0001
49
50typedef struct rpc_test_request_ctx {
51 afs_uint32 flags;
52 /* sync */
53 pthread_mutex_t mtx;
54 /* local address */
55 char cb_svc_name[256];
56 char cb_if_s[256];
57 char cb_listen_addr_s[256];
58 char cb_prefix_s[256];
59 char fs_addr_s[256];
60 interfaceAddr cb_listen_addr;
61 interfaceAddr fs_addr;
62 /* rx connection */
63 afs_uint32 cno;
64 afs_uint32 cb_port;
65 struct rx_connection *conn;
66 struct rx_securityClass *sc;
67 struct rx_service *svc; /* until rx fixes client socket mgmt */
68 afs_int32 sc_index;
69 /* stats */
70 afs_uint32 calls;
71} rpc_test_request_ctx;
72
73
74#define CTX_FOR_RXCALL(call) \
75 (rx_GetServiceSpecific((rx_ServiceOf(rx_ConnectionOf(call))), ctx_key))
76
77afs_int32 rpc_test_PkgInit(void);
78void rpc_test_PkgShutdown(void);
79
80/* call channel, callback RPC server multiplexing */
81afs_int32 init_fs_channel(rpc_test_request_ctx **ctx /* out */, char *cb_if,
82 char *listen_addr_s, char *prefix, char *fs_addr_s, afs_uint32 flags);
83afs_int32 destroy_fs_channel(rpc_test_request_ctx *ctx);
84
85/* test proc wrappers */
86afs_int32 rpc_test_fetch_status(void);
87afs_int32 rpc_test_afs_fetch_status(rpc_test_request_ctx *ctx, AFSFid *fid,
88 AFSFetchStatus *outstatus);
89#if defined(AFS_BYTE_RANGE_FLOCKS) /* when will then be now? soon. */
90afs_int32 rpc_test_afs_set_byterangelock(rpc_test_request_ctx *ctx,
91 AFSByteRangeLock * Lock);
92afs_int32 rpc_test_afs_release_byterangelock(rpc_test_request_ctx *ctx,
93 AFSByteRangeLock * Lock);
94afs_int32 rpc_test_afs_upgrade_byterangelock(rpc_test_request_ctx *ctx,
95 AFSByteRangeLock * Lock);
96afs_int32 rpc_test_afs_downgrade_byterangelock(rpc_test_request_ctx *ctx,
97 AFSByteRangeLock * Lock);
98#endif /* AFS_BYTE_RANGE_FLOCKS */
99
100afs_int32 rpc_test_afs_store_status(rpc_test_request_ctx *ctx, AFSFid *fid,
101 AFSStoreStatus *instatus, AFSFetchStatus *outstatus);
102afs_int32 rpc_test_afs_storedata_range(rpc_test_request_ctx *ctx, AFSFid *fid,
103 void *stuff);
104
105#endif /* _RPC_TEST_PROCS_H */