1 /* umapisrv.c - universal message API - server interface */
2
3 #include <stdlib.h>
4 #include <stdio.h>
5 #include "typesize.h"
6 #include "umapi.h"
7 #include "umapisq.h"
8 #include "umapisdm.h"
9
umAreaOpen(tUmAreaType areaType,char * areaName)10 tUmArea *umAreaOpen(tUmAreaType areaType, char *areaName)
11 {
12 switch (areaType)
13 {
14 case cUmAreaTypeSquish:
15 return sqAreaOpen(areaName);
16 break;
17
18 case cUmAreaTypeSdm:
19 return sdmAreaOpen(areaName);
20 break;
21
22 case cUmAreaTypeJam:
23 return NULL;
24 break;
25
26 case cUmAreaTypeSql:
27 return NULL;
28 break;
29 }
30 }
31
umAreaClose(tUmArea * area)32 void umAreaClose(tUmArea *area)
33 {
34 switch (area->areaType)
35 {
36 case cUmAreaTypeSquish:
37 sqAreaClose(area);
38 break;
39
40 case cUmAreaTypeSdm:
41 sdmAreaClose(area);
42 break;
43
44 case cUmAreaTypeJam:
45 return;
46 break;
47
48 case cUmAreaTypeSql:
49 return;
50 break;
51 }
52 }
53
umAreaEmptyMsg(tUmArea * area)54 tUmMsg *umAreaEmptyMsg(tUmArea *area)
55 {
56 switch (area->areaType)
57 {
58 case cUmAreaTypeSquish:
59 return sqAreaEmptyMsg(area);
60 break;
61
62 case cUmAreaTypeSdm:
63 return sdmAreaEmptyMsg(area);
64 break;
65
66 case cUmAreaTypeJam:
67 return NULL;
68 break;
69
70 case cUmAreaTypeSql:
71 return NULL;
72 break;
73 }
74 }
75
umAreaReadMsgHdr(tUmArea * area,tUmMsgNr msgNr)76 tUmMsgHdr *umAreaReadMsgHdr(tUmArea *area, tUmMsgNr msgNr)
77 {
78 switch (area->areaType)
79 {
80 case cUmAreaTypeSquish:
81 return sqAreaReadMsgHdr(area, msgNr);
82 break;
83
84 case cUmAreaTypeSdm:
85 return sdmAreaReadMsgHdr(area, msgNr);
86 break;
87
88 case cUmAreaTypeJam:
89 return NULL;
90 break;
91
92 case cUmAreaTypeSql:
93 return NULL;
94 break;
95 }
96 }
97
umAreaReadMsg(tUmArea * area,tUmMsgNr msgNr)98 tUmMsg *umAreaReadMsg(tUmArea *area, tUmMsgNr msgNr)
99 {
100 switch (area->areaType)
101 {
102 case cUmAreaTypeSquish:
103 return sqAreaReadMsg(area, msgNr);
104 break;
105
106 case cUmAreaTypeSdm:
107 return sdmAreaReadMsg(area, msgNr);
108 break;
109
110 case cUmAreaTypeJam:
111 return NULL;
112 break;
113
114 case cUmAreaTypeSql:
115 return NULL;
116 break;
117 }
118 }
119
umAreaChangeMsgHdr(tUmArea * area,tUmMsgNr msgNr,tUmMsgHdr * msgHdr)120 CHAR umAreaChangeMsgHdr(tUmArea *area, tUmMsgNr msgNr, tUmMsgHdr *msgHdr)
121 {
122 switch (area->areaType)
123 {
124 case cUmAreaTypeSquish:
125 return sqAreaChangeMsgHdr(area, msgNr, msgHdr);
126 break;
127
128 case cUmAreaTypeSdm:
129 return sdmAreaChangeMsgHdr(area, msgNr, msgHdr);
130 break;
131
132 case cUmAreaTypeJam:
133 return -1;
134 break;
135
136 case cUmAreaTypeSql:
137 return -1;
138 break;
139 }
140 }
141
umAreaChangeMsg(tUmArea * area,tUmMsgNr msgNr,tUmMsg * msg)142 CHAR umAreaChangeMsg(tUmArea *area, tUmMsgNr msgNr, tUmMsg *msg)
143 {
144 switch (area->areaType)
145 {
146 case cUmAreaTypeSquish:
147 return sqAreaChangeMsg(area, msgNr, msg);
148 break;
149
150 case cUmAreaTypeSdm:
151 return sdmAreaChangeMsg(area, msgNr, msg);
152 break;
153
154 case cUmAreaTypeJam:
155 return -1;
156 break;
157
158 case cUmAreaTypeSql:
159 return -1;
160 break;
161 }
162 }
163
umAreaAppendMsg(tUmArea * area,tUmMsg * msg)164 tUmMsgNr umAreaAppendMsg(tUmArea *area, tUmMsg *msg)
165 {
166 switch (area->areaType)
167 {
168 case cUmAreaTypeSquish:
169 return sqAreaAppendMsg(area, msg);
170 break;
171
172 case cUmAreaTypeSdm:
173 return sdmAreaAppendMsg(area, msg);
174 break;
175
176 case cUmAreaTypeJam:
177 return -1;
178 break;
179
180 case cUmAreaTypeSql:
181 return -1;
182 break;
183 }
184 }
185
umAreaDeleteMsg(tUmArea * area,tUmMsgNr msgNr)186 CHAR umAreaDeleteMsg(tUmArea *area, tUmMsgNr msgNr)
187 {
188 switch (area->areaType)
189 {
190 case cUmAreaTypeSquish:
191 return sqAreaDeleteMsg(area, msgNr);
192 break;
193
194 case cUmAreaTypeSdm:
195 return sdmAreaDeleteMsg(area, msgNr);
196 break;
197
198 case cUmAreaTypeJam:
199 return -1;
200 break;
201
202 case cUmAreaTypeSql:
203 return -1;
204 break;
205 }
206 }
207
umAreaLock(tUmArea * area)208 CHAR umAreaLock(tUmArea *area)
209 {
210 switch (area->areaType)
211 {
212 case cUmAreaTypeSquish:
213 return sqAreaLock(area);
214 break;
215
216 case cUmAreaTypeSdm:
217 return sdmAreaLock(area);
218 break;
219
220 case cUmAreaTypeJam:
221 return -1;
222 break;
223
224 case cUmAreaTypeSql:
225 return -1;
226 break;
227 }
228 }
229
umAreaUnlock(tUmArea * area)230 CHAR umAreaUnlock(tUmArea *area)
231 {
232 switch (area->areaType)
233 {
234 case cUmAreaTypeSquish:
235 return sqAreaUnlock(area);
236 break;
237
238 case cUmAreaTypeSdm:
239 return sdmAreaUnlock(area);
240 break;
241
242 case cUmAreaTypeJam:
243 return -1;
244 break;
245
246 case cUmAreaTypeSql:
247 return -1;
248 break;
249 }
250 }
251
umAreaLockMsg(tUmArea * area,tUmMsgNr msgNr)252 CHAR umAreaLockMsg(tUmArea *area, tUmMsgNr msgNr)
253 {
254 switch (area->areaType)
255 {
256 case cUmAreaTypeSquish:
257 return sqAreaLockMsg(area, msgNr);
258 break;
259
260 case cUmAreaTypeSdm:
261 return sdmAreaLockMsg(area, msgNr);
262 break;
263
264 case cUmAreaTypeJam:
265 return -1;
266 break;
267
268 case cUmAreaTypeSql:
269 return -1;
270 break;
271 }
272 }
273
umAreaUnlockMsg(tUmArea * area,tUmMsgNr msgNr)274 CHAR umAreaUnlockMsg(tUmArea *area, tUmMsgNr msgNr)
275 {
276 switch (area->areaType)
277 {
278 case cUmAreaTypeSquish:
279 return sqAreaUnlockMsg(area, msgNr);
280 break;
281
282 case cUmAreaTypeSdm:
283 return sdmAreaUnlockMsg(area, msgNr);
284 break;
285
286 case cUmAreaTypeJam:
287 return -1;
288 break;
289
290 case cUmAreaTypeSql:
291 return -1;
292 break;
293 }
294 }
295
umAreaGetLastread(tUmArea * area,tUmUserNr userNr)296 tUmMsgNr umAreaGetLastread(tUmArea *area, tUmUserNr userNr)
297 {
298 switch (area->areaType)
299 {
300 case cUmAreaTypeSquish:
301 return sqAreaGetLastread(area, userNr);
302 break;
303
304 case cUmAreaTypeSdm:
305 return sdmAreaGetLastread(area, userNr);
306 break;
307
308 case cUmAreaTypeJam:
309 return -1;
310 break;
311
312 case cUmAreaTypeSql:
313 return -1;
314 break;
315 }
316 }
317
umAreaSetLastread(tUmArea * area,tUmUserNr userNr,tUmMsgNr msgNr)318 CHAR umAreaSetLastread(tUmArea *area, tUmUserNr userNr, tUmMsgNr msgNr)
319 {
320 switch (area->areaType)
321 {
322 case cUmAreaTypeSquish:
323 return sqAreaSetLastread(area, userNr, msgNr);
324 break;
325
326 case cUmAreaTypeSdm:
327 return sdmAreaSetLastread(area, userNr, msgNr);
328 break;
329
330 case cUmAreaTypeJam:
331 return -1;
332 break;
333
334 case cUmAreaTypeSql:
335 return -1;
336 break;
337 }
338 }
339
umAreaNumMsgs(tUmArea * area)340 tUmMsgNr umAreaNumMsgs(tUmArea *area)
341 {
342 switch (area->areaType)
343 {
344 case cUmAreaTypeSquish:
345 return sqAreaNumMsgs(area);
346 break;
347
348 case cUmAreaTypeSdm:
349 return sdmAreaNumMsgs(area);
350 break;
351
352 case cUmAreaTypeJam:
353 return 0;
354 break;
355
356 case cUmAreaTypeSql:
357 return 0;
358 break;
359 }
360 }
361
umAreaMsgList(tUmArea * area,tUmMsgNr * numMsgs)362 tUmMsgNr *umAreaMsgList(tUmArea *area, tUmMsgNr *numMsgs)
363 {
364 switch (area->areaType)
365 {
366 case cUmAreaTypeSquish:
367 return sqAreaMsgList(area, numMsgs);
368 break;
369
370 case cUmAreaTypeSdm:
371 return sdmAreaMsgList(area, numMsgs);
372 break;
373
374 case cUmAreaTypeJam:
375 return NULL;
376 break;
377
378 case cUmAreaTypeSql:
379 return NULL;
380 break;
381 }
382 }
383
umMsgDispose(tUmMsg * msg)384 void umMsgDispose(tUmMsg *msg)
385 {
386 switch (msg->msgHdr->areaType)
387 {
388 case cUmAreaTypeSquish:
389 sqMsgDispose(msg);
390 break;
391
392 case cUmAreaTypeSdm:
393 sdmMsgDispose(msg);
394 break;
395
396 case cUmAreaTypeJam:
397 return;
398 break;
399
400 case cUmAreaTypeSql:
401 return;
402 break;
403 }
404 }
405
umMsgHdrDispose(tUmMsgHdr * msgHdr)406 void umMsgHdrDispose(tUmMsgHdr *msgHdr)
407 {
408 switch (msgHdr->areaType)
409 {
410 case cUmAreaTypeSquish:
411 sqMsgHdrDispose(msgHdr);
412 break;
413
414 case cUmAreaTypeSdm:
415 sdmMsgHdrDispose(msgHdr);
416 break;
417
418 case cUmAreaTypeJam:
419 return;
420 break;
421
422 case cUmAreaTypeSql:
423 return;
424 break;
425 }
426 }
427
428