00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 #ifndef _RPC_CLNT_H_
00044 #define _RPC_CLNT_H_
00045 #ifndef WIN32
00046 #include <sys/cdefs.h>
00047 #endif
00048
00049
00050
00051
00052
00053
00054 enum clnt_stat {
00055 RPC_SUCCESS=0,
00056
00057
00058
00059 RPC_CANTENCODEARGS=1,
00060 RPC_CANTDECODERES=2,
00061 RPC_CANTSEND=3,
00062 RPC_CANTRECV=4,
00063 RPC_TIMEDOUT=5,
00064
00065
00066
00067 RPC_VERSMISMATCH=6,
00068 RPC_AUTHERROR=7,
00069 RPC_PROGUNAVAIL=8,
00070 RPC_PROGVERSMISMATCH=9,
00071 RPC_PROCUNAVAIL=10,
00072 RPC_CANTDECODEARGS=11,
00073 RPC_SYSTEMERROR=12,
00074
00075
00076
00077
00078 RPC_UNKNOWNHOST=13,
00079 RPC_UNKNOWNPROTO=17,
00080
00081
00082
00083
00084 RPC_PMAPFAILURE=14,
00085 RPC_PROGNOTREGISTERED=15,
00086
00087
00088
00089 RPC_FAILED=16
00090 };
00091
00092
00093
00094
00095
00096 struct rpc_err {
00097 enum clnt_stat re_status;
00098 union {
00099 int RE_errno;
00100 enum auth_stat RE_why;
00101 struct {
00102 u_int32_t low;
00103 u_int32_t high;
00104 } RE_vers;
00105 struct {
00106 int32_t s1;
00107 int32_t s2;
00108 } RE_lb;
00109 } ru;
00110 #define re_errno ru.RE_errno
00111 #define re_why ru.RE_why
00112 #define re_vers ru.RE_vers
00113 #define re_lb ru.RE_lb
00114 };
00115
00116
00117
00118
00119
00120
00121
00122 typedef struct __rpc_client {
00123 AUTH *cl_auth;
00124 struct clnt_ops {
00125
00126 enum clnt_stat (*cl_call) __P((struct __rpc_client *,
00127 u_long, xdrproc_t, caddr_t, xdrproc_t,
00128 caddr_t, struct timeval));
00129
00130 void (*cl_abort) __P((struct __rpc_client *));
00131
00132 void (*cl_geterr) __P((struct __rpc_client *,
00133 struct rpc_err *));
00134
00135 bool_t (*cl_freeres) __P((struct __rpc_client *,
00136 xdrproc_t, caddr_t));
00137
00138 void (*cl_destroy) __P((struct __rpc_client *));
00139
00140 bool_t (*cl_control) __P((struct __rpc_client *, u_int,
00141 void *));
00142 } *cl_ops;
00143 caddr_t cl_private;
00144 } CLIENT;
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165 #define CLNT_CALL(rh, proc, xargs, argsp, xres, resp, secs) \
00166 ((*(rh)->cl_ops->cl_call)(rh, proc, xargs, (caddr_t)argsp, \
00167 xres, (caddr_t)resp, secs))
00168 #define clnt_call(rh, proc, xargs, argsp, xres, resp, secs) \
00169 ((*(rh)->cl_ops->cl_call)(rh, proc, xargs, (caddr_t)argsp, \
00170 xres, (caddr_t)resp, secs))
00171
00172
00173
00174
00175
00176
00177 #define CLNT_ABORT(rh) ((*(rh)->cl_ops->cl_abort)(rh))
00178 #define clnt_abort(rh) ((*(rh)->cl_ops->cl_abort)(rh))
00179
00180
00181
00182
00183
00184
00185 #define CLNT_GETERR(rh,errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp))
00186 #define clnt_geterr(rh,errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp))
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196 #define CLNT_FREERES(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp))
00197 #define clnt_freeres(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh,xres,resp))
00198
00199
00200
00201
00202
00203
00204
00205
00206 #define CLNT_CONTROL(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in))
00207 #define clnt_control(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in))
00208
00209
00210
00211
00212 #define CLSET_TIMEOUT 1
00213 #define CLGET_TIMEOUT 2
00214 #define CLGET_SERVER_ADDR 3
00215
00216
00217
00218 #define CLSET_RETRY_TIMEOUT 4
00219 #define CLGET_RETRY_TIMEOUT 5
00220
00221
00222
00223
00224
00225
00226 #define CLNT_DESTROY(rh) ((*(rh)->cl_ops->cl_destroy)(rh))
00227 #define clnt_destroy(rh) ((*(rh)->cl_ops->cl_destroy)(rh))
00228
00229
00230
00231
00232
00233
00234
00235
00236 #define RPCTEST_PROGRAM ((u_long)1)
00237 #define RPCTEST_VERSION ((u_long)1)
00238 #define RPCTEST_NULL_PROC ((u_long)2)
00239 #define RPCTEST_NULL_BATCH_PROC ((u_long)3)
00240
00241
00242
00243
00244
00245 #define NULLPROC ((u_int)0)
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260 __BEGIN_DECLS
00261 extern CLIENT *clntraw_create __P((u_long, u_long));
00262 __END_DECLS
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274 __BEGIN_DECLS
00275 extern CLIENT *clnt_create __P((char *, u_long, u_long, char *));
00276 __END_DECLS
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290 __BEGIN_DECLS
00291 extern CLIENT *clnttcp_create __P((struct sockaddr_in *,
00292 u_long,
00293 u_long,
00294 int *,
00295 u_int,
00296 u_int));
00297 __END_DECLS
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321 __BEGIN_DECLS
00322 extern CLIENT *clntudp_create __P((struct sockaddr_in *,
00323 u_long,
00324 u_long,
00325 struct timeval,
00326 int *));
00327 extern CLIENT *clntudp_bufcreate __P((struct sockaddr_in *,
00328 u_long,
00329 u_long,
00330 struct timeval,
00331 int *,
00332 u_int,
00333 u_int));
00334 __END_DECLS
00335
00336
00337
00338
00339
00340 __BEGIN_DECLS
00341 extern void clnt_pcreateerror __P((char *));
00342 extern char *clnt_spcreateerror __P((char *));
00343 __END_DECLS
00344
00345
00346
00347
00348 __BEGIN_DECLS
00349 extern void clnt_perrno __P((enum clnt_stat));
00350 extern char *clnt_sperrno __P((enum clnt_stat));
00351 __END_DECLS
00352
00353
00354
00355
00356 __BEGIN_DECLS
00357 extern void clnt_perror __P((CLIENT *, char *));
00358 extern char *clnt_sperror __P((CLIENT *, char *));
00359 __END_DECLS
00360
00361
00362
00363
00364
00365 struct rpc_createerr {
00366 enum clnt_stat cf_stat;
00367 struct rpc_err cf_error;
00368 };
00369
00370 extern struct rpc_createerr rpc_createerr;
00371
00372
00373 #define UDPMSGSIZE 8800
00374 #define RPCSMALLMSGSIZE 400
00375
00376 #endif