backport to buster
[hcoop/debian/openafs.git] / tests / rpctestlib / rpc_test_cb_procs.c
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#include <afsconfig.h>
32#include <afs/param.h>
33
34#include <roken.h>
35
36#include <afs/stds.h>
37
38#include "rpc_test_procs.h"
39
40#include <stdio.h>
41#include <sys/types.h>
42#include <string.h>
43#include <sys/stat.h>
44#include <errno.h>
45#include <signal.h>
46#include <afs/vice.h>
47#include <afs/cmd.h>
48#include <afs/auth.h>
49#include <afs/cellconfig.h>
50
51#include <afs/com_err.h>
52#ifdef HAVE_DIRENT_H
53#include <dirent.h>
54#endif
55#ifdef HAVE_DIRECT_H
56#include <direct.h>
57#endif
58#ifdef AFS_DARWIN_ENV
59#include <sys/malloc.h>
60#endif
61#include <afs/errors.h>
62#include <afs/sys_prototypes.h>
63#include <rx/rx_prototypes.h>
64#ifdef AFS_PTHREAD_ENV
65#include <assert.h>
66#endif
67
68extern const char *prog;
69extern pthread_key_t ctx_key;
70
71#if defined(AFS_EXTENDED_CALLBACK)
72#define RPC_TEST_EXTENDED_CALLBACK 1
73
74afs_int32 SRXAFSCB_ExtendedCallBack(
75 /*IN */ struct rx_call *a_call,
76 /*IN */ HostIdentifier * Server,
77 /*IN */ AFSXCBInvocationSeq * Invocations_Array,
78 /*OUT*/ AFSExtendedCallBackRSeq * CallBack_Result_Array)
79{
80 rpc_test_request_ctx *ctx;
81
82 ctx = CTX_FOR_RXCALL(a_call);
83
84 printf("%s: SRXAFSCB_ExtendedCallBack: enter (%s)\n", prog,
85 ctx->cb_svc_name);
86
87 return (0);
88};
89#endif /* AFS_EXTENDED_CALLBACK */
90
91#if defined(AFS_BYTE_RANGE_FLOCKS)
92afs_int32 SRXAFSCB_AsyncIssueByteRangeLock(
93 /*IN */ struct rx_call *a_call,
94 /*IN */ HostIdentifier * Server,
95 /*IN */ AFSByteRangeLockSeq Locks_Array)
96{
97 rpc_test_request_ctx *ctx = CTX_FOR_RXCALL(a_call);
98
99 printf("%s: SRXAFSCB_AsyncIssueByteRangeLock: enter (%s)\n", prog,
100 ctx->cb_svc_name);
101
102 return (0);
103}
104#endif /* AFS_BYTE_RANGE_FLOCKS */
105
106afs_int32
107SRXAFSCB_CallBack(struct rx_call *a_call, AFSCBFids *Fids_Array,
108 AFSCBs *CallBack_Array)
109{
110 rpc_test_request_ctx *ctx = CTX_FOR_RXCALL(a_call);
111
112 printf("%s: SRXAFSCB_CallBack: enter (%s)\n", prog,
113 ctx->cb_svc_name);
114
115 return (0);
116}
117
118
119afs_int32
120SRXAFSCB_InitCallBackState(struct rx_call *a_call)
121{
122 return (0);
123}
124
125
126afs_int32
127SRXAFSCB_Probe(struct rx_call *a_call)
128{
129 return (0);
130}
131
132
133afs_int32
134SRXAFSCB_GetCE(struct rx_call *a_call,
135 afs_int32 index,
136 AFSDBCacheEntry * ce)
137{
138 return(0);
139}
140
141
142afs_int32
143SRXAFSCB_GetLock(struct rx_call *a_call,
144 afs_int32 index,
145 AFSDBLock * lock)
146{
147 return(0);
148}
149
150
151afs_int32
152SRXAFSCB_XStatsVersion(struct rx_call *a_call,
153 afs_int32 * versionNumberP)
154{
155 return(0);
156}
157
158
159afs_int32
160SRXAFSCB_GetXStats(struct rx_call *a_call,
161 afs_int32 clientVersionNumber,
162 afs_int32 collectionNumber,
163 afs_int32 * srvVersionNumberP,
164 afs_int32 * timeP,
165 AFSCB_CollData * dataP)
166{
167 return(0);
168}
169
170afs_int32
171SRXAFSCB_ProbeUuid(struct rx_call *a_call, afsUUID *a_uuid)
172{
173 rpc_test_request_ctx *ctx = CTX_FOR_RXCALL(a_call);
174 if ( !afs_uuid_equal(&ctx->cb_listen_addr.uuid, a_uuid) )
175 return (1);
176 else
177 return (0);
178}
179
180
181afs_int32
182SRXAFSCB_WhoAreYou(struct rx_call *a_call, struct interfaceAddr *addr)
183{
184 return SRXAFSCB_TellMeAboutYourself(a_call, addr, NULL);
185}
186
187
188afs_int32
189SRXAFSCB_InitCallBackState2(struct rx_call *a_call, struct interfaceAddr *
190 addr)
191{
192 return RXGEN_OPCODE;
193}
194
195
196afs_int32
197SRXAFSCB_InitCallBackState3(struct rx_call *a_call, afsUUID *a_uuid)
198{
199 return (0);
200}
201
202
203afs_int32
204SRXAFSCB_GetCacheConfig(struct rx_call *a_call, afs_uint32 callerVersion,
205 afs_uint32 *serverVersion, afs_uint32 *configCount,
206 cacheConfig *config)
207{
208 return RXGEN_OPCODE;
209}
210
211afs_int32
212SRXAFSCB_GetLocalCell(struct rx_call *a_call, char **a_name)
213{
214 return RXGEN_OPCODE;
215}
216
217
218afs_int32
219SRXAFSCB_GetCellServDB(struct rx_call *a_call, afs_int32 a_index,
220 char **a_name, serverList *a_hosts)
221{
222 return RXGEN_OPCODE;
223}
224
225
226afs_int32
227SRXAFSCB_GetServerPrefs(struct rx_call *a_call, afs_int32 a_index,
228 afs_int32 *a_srvr_addr, afs_int32 *a_srvr_rank)
229{
230 return RXGEN_OPCODE;
231}
232
233
234afs_int32
235SRXAFSCB_TellMeAboutYourself(struct rx_call *a_call, struct interfaceAddr *
236 addr, Capabilities *capabilities)
237{
238 rpc_test_request_ctx *ctx = CTX_FOR_RXCALL(a_call);
239
240 printf("%s: SRXAFSCB_TellMeAboutYourself: enter (%s)\n", prog,
241 ctx->cb_svc_name);
242
243 addr->numberOfInterfaces = ctx->cb_listen_addr.numberOfInterfaces;
244 addr->uuid = ctx->cb_listen_addr.uuid;
245
246 if (capabilities) {
247 afs_uint32 *dataBuffP;
248 afs_int32 dataBytes;
249
250 dataBytes = 1 * sizeof(afs_uint32);
251 dataBuffP = (afs_uint32 *) xdr_alloc(dataBytes);
252 dataBuffP[0] = CLIENT_CAPABILITY_ERRORTRANS;
253#if defined(AFS_EXTENDED_CALLBACK)
254 if (ctx->flags & RPC_TEST_REQ_CTX_FLAG_XCB)
255 dataBuffP[0] |= CLIENT_CAPABILITY_EXT_CALLBACK;
256#endif /* AFS_EXTENDED_CALLBACK */
257 capabilities->Capabilities_len = dataBytes / sizeof(afs_uint32);
258 capabilities->Capabilities_val = dataBuffP;
259 }
260
261 return (0);
262
263} /* SRXAFSCB_TellMeAboutYourself */
264
265
266afs_int32
267SRXAFSCB_GetCellByNum(struct rx_call *a_call, afs_int32 a_cellnum,
268 char **a_name, serverList *a_hosts)
269{
270 return RXGEN_OPCODE;
271}
272
273
274afs_int32
275SRXAFSCB_GetCE64(struct rx_call *a_call, afs_int32 a_index,
276 struct AFSDBCacheEntry64 *a_result)
277{
278 return RXGEN_OPCODE;
279}