386BSD 0.1 development
[unix-history] / usr / othersrc / contrib / isode / dsap / net / dapread.c
CommitLineData
04c6839a
WJ
1/* dapread.c - */
2
3#ifndef lint
4static char *rcsid = "$Header: /f/osi/dsap/net/RCS/dapread.c,v 7.1 91/02/22 09:21:04 mrose Interim $";
5#endif
6
7/*
8 * $Header: /f/osi/dsap/net/RCS/dapread.c,v 7.1 91/02/22 09:21:04 mrose Interim $
9 *
10 *
11 * $Log: dapread.c,v $
12 * Revision 7.1 91/02/22 09:21:04 mrose
13 * Interim 6.8
14 *
15 * Revision 7.0 90/07/26 14:45:23 mrose
16 * *** empty log message ***
17 *
18 */
19
20/*
21 * NOTICE
22 *
23 * Acquisition, use, and distribution of this module and related
24 * materials are subject to the restrictions of a license agreement.
25 * Consult the Preface in the User's Manual for the full terms of
26 * this agreement.
27 *
28 */
29
30
31/* LINTLIBRARY */
32
33#include "tailor.h"
34#include "quipu/util.h"
35#include "quipu/dap2.h"
36#include "../x500as/DAS-types.h"
37
38extern LLog *log_dsap;
39
40dap_read (ad, id, arg, error, result)
41int ad;
42int *id;
43struct ds_read_arg *arg;
44struct ds_read_result *result;
45struct DSError *error;
46{
47 struct DAPindication di_s;
48 struct DAPindication * di = &(di_s);
49
50 DLOG(log_dsap, LLOG_TRACE, ("dap_read()"));
51
52 ++(*id);
53
54 (void) DapRead (ad, (*id), arg, di, ROS_INTR);
55
56 error->dse_type = DSE_NOERROR;
57
58 switch (di->di_type)
59 {
60 case DI_RESULT:
61 {
62 struct DAPresult * dr = &(di->di_result);
63
64 /* Nasty struct copy */
65 (*result) = dr->dr_res.res_rd; /* struct copy */
66 dr->dr_res.result_type = -1; /* Prevent freeing */
67 DRFREE (dr);
68 return (DS_OK);
69 }
70
71 case DI_ERROR:
72 {
73 struct DAPerror * de = &(di->di_error);
74
75 (*error) = de->de_err; /* struct copy */
76 return (DS_ERROR_REMOTE);
77 }
78
79 case DI_PREJECT:
80 error->dse_type = DSE_REMOTEERROR;
81 return (DS_ERROR_PROVIDER);
82
83 case DI_ABORT:
84 error->dse_type = DSE_REMOTEERROR;
85 return (DS_ERROR_CONNECT);
86
87 default:
88 error->dse_type = DSE_REMOTEERROR;
89 return (DS_ERROR_PROVIDER);
90 }
91}
92
93int DapRead (ad, id, arg, di, asyn)
94int ad;
95int id;
96struct ds_read_arg * arg;
97struct DAPindication * di;
98int asyn;
99{
100 PE arg_pe;
101
102 if(encode_DAS_ReadArgument(&arg_pe,1,0,NULLCP,arg) != OK)
103 {
104 return(dapreject (di, DP_INVOKE, id, NULLCP, "Read argument encoding failed"));
105 }
106
107 return (DapInvokeReqAux (ad, id, OP_READ, arg_pe, di, asyn));
108
109}
110