summaryrefslogtreecommitdiffstats
path: root/src/isode/h/rosy.h
blob: 41f58b6132bdc0526e480cef6d07a1249c1c680a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
/* rosy.h - include file for ROSY users */

/* 
 * isode/h/rosy.h
 */

/*
 *				  NOTICE
 *
 *    Acquisition, use, and distribution of this module and related
 *    materials are subject to the restrictions of a license agreement.
 *    Consult the Preface in the User's Manual for the full terms of
 *    this agreement.
 *
 */


#ifndef	_ROSY_
#define	_ROSY_

#ifndef	_MANIFEST_
#include "manifest.h"
#endif
#ifndef	_GENERAL_
#include "general.h"
#endif

#ifndef	_RoSAP_
#include "rosap.h"		/* definitions for RoS-USERs */
#endif

/*  */

#ifdef PEPSY_VERSION
#include "pepsy.h"
#endif

#ifdef PEPSY_DEFINITIONS
/* This is really to change the name of the function RyOperation but the macro
 * is unselective so we have to change the name of the structure as well, which
 * shouldn't cause any problems
 */
#define RyOperation		PRyOperation
#endif PEPSY_DEFINITIONS
struct RyOperation {
    char   *ryo_name;		/* operation name */
    int	    ryo_op;		/* operation code */

#ifdef PEPSY_DEFINITIONS
    modtyp *ryo_arg_mod;	/* pointer to table for arguement type */
    int	    ryo_arg_index;	/* index to entry in tables */
#else
    IFP	    ryo_arg_encode;	/* encodes argument */
    IFP	    ryo_arg_decode;	/* decodes   .. */
    IFP	    ryo_arg_free;	/* frees     .. */
#endif

    int	    ryo_result;		/* result possible */
#ifdef PEPSY_DEFINITIONS
    modtyp *ryo_res_mod;	/* pointer to table for result type */
    int	    ryo_res_index;	/* index to entry in tables */
#else
    IFP	    ryo_res_encode;	/* encodes result */
    IFP	    ryo_res_decode;	/* decodes   .. */
    IFP	    ryo_res_free;	/* frees     .. */
#endif

    struct RyError **ryo_errors;/* errors possible */
};



struct RyError {
    char   *rye_name;		/* error name */
    int	    rye_err;		/* error code */

#ifdef PEPSY_DEFINITIONS
    modtyp *rye_param_mod;	/* pointer to table for result type */
    int	    rye_param_index;	/* index to entry in tables */
#else
    IFP	    rye_param_encode;	/* encodes parameter */
    IFP	    rye_param_decode;	/* decodes   .. */
    IFP	    rye_param_free;	/* frees     .. */
#endif
};

/*  */

struct opsblk {
    struct opsblk *opb_forw;	/* doubly-linked list */
    struct opsblk *opb_back;	/*   .. */

    short	opb_flags;	/* our state */
#define	OPB_NULL	0x0000
#define	OPB_EVENT	0x0001	/* event present */
#define	OPB_INITIATOR	0x0002	/* initiator block */
#define	OPB_RESPONDER	0x0004	/* responder block */

    int	    opb_fd;		/* association descriptor */
    int	    opb_id;		/* invoke ID */

    IFP	    opb_resfnx;		/* result vector */
    IFP	    opb_errfnx;		/* error vector */

    struct RyOperation *opb_ryo;/* entry in operation table */

    struct RoSAPindication opb_event;	/* resulting event */
    caddr_t opb_out;			/* event parameter */
#ifdef PEPSY_DEFINITIONS
    modtyp *opb_free_mod;	/* pointer to table for result type */
    int	    opb_free_index;	/* index to entry in tables */
#else
    IFP	    opb_free;			/* free routine for event parameter */
#endif

    PE	    opb_pe;		/* for Simon */
};
#define	NULLOPB		((struct opsblk *) 0)




struct dspblk {
    struct dspblk *dsb_forw;	/* doubly-linked list */
    struct dspblk *dsb_back;	/*   .. */

    int	    dsb_fd;		/* association descriptor */
				/* NOTOK-valued is wildcard for RyWait */

    struct RyOperation *dsb_ryo;/* entry in operation table */
    
    IFP	    dsb_vector;		/* dispatch vector */
};
#define	NULLDSB		((struct dspblk *) 0)



#define	RY_RESULT	(-1)	/* distinguishes RESULTs from ERRORs */
#define	RY_REJECT	(-2)	/* distinguishes REJECTs from ERRORs */

/*  */
/* Change the names to use the pepsy based rosy library */
#ifdef PEPSY_DEFINITIONS
#define RyDiscard		PRyDiscard
#define RyDispatch		PRyDispatch
#define RyDsError		PRyDsError
#define RyDsResult		PRyDsResult
#define RyDsUReject		PRyDsUReject
#define RyGenID			PRyGenID
#define RyLose			PRyLose
#define RyOpInvoke		PRyOpInvoke
#define RyStub			PRyStub
#define RyWait			PRyWait
#define RyWaitAux		PRyWaitAux
#define finddsblk		Pfinddsblk
#define finderrbyerr		Pfinderrbyerr
#define finderrbyname		Pfinderrbyname
#define findopblk		Pfindopblk
#define findopbyname		Pfindopbyname
#define findopbyop		Pfindopbyop
#define firstopblk		Pfirstopblk
#define freedsblk		Pfreedsblk
#define freeopblk		Pfreeopblk
#define losedsblk		Plosedsblk
#define loseopblk		Ploseopblk
#define newdsblk		Pnewdsblk
#define newopblk		Pnewopblk
#endif

int	RyWait ();		/* WAIT */

				/* Initiator */
int	RyStub ();		/* STUB */
#define	ROS_INTR	2	/*   invoke stub but return on interrupt */
int	RyDiscard ();		/* DISCARD */
int	RyOperation ();		/* OPERATION */
int	RyOpInvoke ();		/* INVOKE */
int	RyGenID ();		/* generate unique invoke ID */

				/* Responder */
int	RyDispatch ();		/* DISPATCH */
int	RyDsResult ();		/* RESULT */
int	RyDsError ();		/* ERROR */
int	RyDsUReject ();		/* U-REJECT */

int	RyLose ();		/* clean-up after association termination */

struct RyOperation *findopbyop (), *findopbyname ();

struct RyError *finderrbyerr (), *finderrbyname ();

int	freeopblk (), loseopblk ();
struct opsblk *newopblk (), *findopblk (), *firstopblk ();

int	freedsblk (), losedsblk ();
struct dspblk *newdsblk (), *finddsblk ();

#endif