summaryrefslogtreecommitdiffstats
path: root/doc/MessageQueueService.html
blob: 92d60ac8a520249722e3346f66382b0b7981415a (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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en"><head>
<META http-equiv="Content-Type" content="text/html;
      charset=ISO-8859-1"><meta http-equiv="Content-Type"
				content="text/html;
				charset=ISO-8859-1"><title>Pegasus
      Meta Dispatcher </title><style type="text/css">

body {
  margin: 2em 1em 2em;
  font-family: sans-serif;
  color: black;
  background: white;
  background-position: top left;
  background-attachment: fixed;
  background-repeat: no-repeat;
}
:link { color: #00C; background: transparent }
:visited { color: #609; background: transparent }
:active { color: #C00; background: transparent }

th, td { /* ns 4 */
  font-family: sans-serif;
}

h1, h2, h3, h4, h5, h6 { text-align: left }
/* background should be transparent, but WebTV has a bug */
h1, h2, h3 { color: #005A9C; background: white }
h1 { font: 170% sans-serif }
h2 { font: 140% sans-serif }
h3 { font: 120% sans-serif }
h4 { font: bold 100% sans-serif }
h5 { font: italic 100% sans-serif }
h6 { font: small-caps 100% sans-serif }

.hide { display: none }

div.head { margin-bottom: 1em }
div.head h1 { margin-top: 2em; clear: both }
div.head table { margin-left: 2em; margin-top: 2em }
div.head img { color: white; border: none } /* remove border from top image */

p.copyright { font-size: small }
p.copyright small { font-size: small }

pre { margin-left: 2em }

p {
  margin-top: 0.6em;
  margin-bottom: 0.6em;
}

dt, dd { margin-top: 0; margin-bottom: 0 } /* opera 3.50 */
dt { font-weight: bold }

pre, code { font-family: monospace } /* navigator 4 requires this */

ul.toc {
  list-style: disc;		/* Mac NS has problem with 'none' */
  list-style: none;
}

code        { font-family: monospace; }
var {font-family: monospace; font-style: normal; font-weight: bold;}
div.constraint,
div.issue,
div.note,
div.notice     { margin-left: 2em; }

li p           { margin-top: 0.8em;
                 margin-bottom: 0.8em; }

li {margin-top: 0.4em; margin-bottom: 0.4em;}

div.exampleInner pre { margin-left: 1em;
                       margin-top: 0em; margin-bottom: 0em}
div.exampleOuter {border: 4px double gray;
                  margin: 0em; padding: 0em}
div.exampleInner { background-color: #d5dee3;
                   border-top-width: 4px;
                   border-top-style: double;
                   border-top-color: #d3d3d3;
                   border-bottom-width: 4px;
                   border-bottom-style: double;
                   border-bottom-color: #d3d3d3;
                   padding: 4px; margin: 0em }
div.exampleWrapper { margin: 4px }
div.exampleHeader { font-weight: bold;
                    margin: 4px}

table { background-color: #d5dee3;
        width: 85% ;
        border-style: double;
        border-width: 4px;
        border-color: #d3d3d3;
}
        </style>

<html>
  <head>
    <title>Pegasus Meta Dispatcher</title>
  </head>

  <body>

    <h1>Pegasus Meta Dispatcher</h1>
    <p>
      The Pegasus Meta Dispatcher is a set of classes that extend the
      existing MessageQueue messaging system to be dynamic,
      asynchronous, and multithreaded. The primary classes consist of the
      folowing:
    </p>
	<table>
	    <tr align="left"><th>Class</th><th>Derived from</th><th>Source file</th></tr>
	    <tr><td><div class="exampleInner">cimom</div></td><td>MessageQueue</td><td>Pegasus/Common/Cimom.h</td></tr>
	    <tr><td>MessageQueueService</td><td>MessageQueue</td><td>Pegasus/Common/MessageQueueServices.h</td></tr>
	    <tr><td>CimomMessage</td><td>Message</td><td>Pegasus/Common/CimomMessage.h</td></tr>
	<tr><td>AsyncOpNode</td><td>n/a</td><td>Pegasus/Common/AsyncOpNode.h</td></tr>
	    <tr><td>AsyncDQueue</td><td>unlocked_dq</td><td>Pegasus/Common/DQueue.h</td></tr>
	    <tr><td>IPC classes</td><td>n/a</td><td>Pegasus/Common/IPC.h</td></tr>
	    <tr><td>Threading classes</td><td>n/a</td><td>Pegasus/Common/Thread.h</td></tr>

	</table>
	
	<br>
	<br>

	<a href = "#non-blocking">Jump to the non-blocking message interface.</a>

      <h2>Purposes of Meta Dispatcher</h2>
    <p>
      The Meta Dispatcher has three primary goals:
      <ol>
      <li>Provide for orderly asynchronous message-based communication
	among a dynamic set of Pegasus Services.</li>
      <li>Preserve the existing message-passing architecture of
	Pegasus.</li>
      <li>Allow Pluggable Services such as repositories, provider
	managers, and others.</li>
    </ol>
<br>
<br>
    Most of the purposes listed above revolve around maintaining the
    integrity of data and control flow in an asynchronous
    multithreaded environment.
    </p>

    <h2>Terms</h2>
    <p>
    <dl>
      <dt><b>Meta Dispatcher</b></dt><dd>The central message broker, or
	router, that provides the asynchronous communications within
	Pegasus. Derived from the <b>MessageQueue</b> class. <br>
      </dd>
      <dt><b>Service</b></dt><dd>A Pegasus module that sends and
	receives messages to other modules through the meta
	dispatcher; A module that has enhanced privileges within
	Pegasus and which provides one or more functions necessary to
	the operation of Pegasus. Derived from the
	<b>MessageQueue</b>class.<dt>
      <dt><b>Asynchronous Message</b></dt><dd>A <b>pair</b> of
	messages, consisting of a <b>request</b> and a <b>response</b>
	that are treated as a single operation by Services. An
	asynchronous message may be fronted by a synchronous
	programming interface. Derived from the <b>Message</b> class.</dd>
      <dt><b>AsyncOpNode</b></dt><dd>A control object that manages the
	lifetime of an <b>Asynchronous Message</b>.The AsyncOpNode uses
	many of the IPC object classes. A Service manages the lifetime
	of an AsyncOpNode during the processing of the
	message. However, it necessarily cedes control of the
	AsyncOpNode to the <b>Meta Dispatcher</b> while the
	Asynchronous Message is being processed.</dd>
    </dl>

    </p>

    <h2>Meta Dispatcher Design</h2>
    <p>
      Three points are necessary to avoid deadlocks and to
      provide pluggable services in Pegaus. The first thing is
      <b>independent execution paths</b> of service modules. i.e.,
      each service must have its own thread(s), which must not intersect
      with the thread(s) of other services. Intersection of execution
      paths can occur indirectly through IPC objects such as mutexes,
      conditions, and semaphores.
    </p>
    <p>
      The second point that is necessary is <b>interface
	abstraction</b>, which the Meta Dispatcher provides through
      C++ polymorphism. This allows pluggable services. i.e., one
      service can replace another and the system will continue to
      function (hopefully in an improved manner).
    </p>
    <p>
      The third point that is neccesary is a <b>central
	message broker</b> that isolates services from each other,
      thereby preventing deadlocks. The central message broker also
      provides message responses for services that are paused,
      stopped, or not present (plugged in).
    </p>


    <h3>Central Hub</h3>
    <p>
      The Meta Dispatcher therefore acts as a central message
      hub. Services communicate with each other <i>via</i> the Meta
      Dispatcher.
	<div class="exampleOuter"><div class="exampleInner">
      <pre>      Service A--Message----1----> (block on semaphore)
                                  |
                                  |
                                  Meta Dispatcher|
                                                 |
                                               Message----2->Service B
                                                                 |
                                                                 |
                           (Signal Semaphore) <---Response---3-- +
                                 |
      Service A <--Response--4---+

    </pre>

	  </div></div>
    The numbered steps above are as follows:
    <ol>
      <li><b>Service A</b> creates a new <code>AsyncMessage</code> and
	<code>AsyncOpNode</code>and sends that message to <b>Service
	  B</b> by calling
	<code>MessageQueueService::SendWait</code>. The calling thread
      blocks on the <b>client emaphore</b> until the response is ready.</li><br>

      <li>The Meta Dispatcher's routing thread picks up the message
	and inserts it into <b>Service B's</b> incoming message
	queue. The routing thread returns to the Meta Dispatcher to
	route the next message in the system.</li><br>

      <li><b>Service B's</b>incoming thread picks up the message and
	calls the its message handler. Message handlers are virtual,
	so a class derived from <b>MessageQueueService</b>can define
	its own message handlers to override the default
	handlers. When the message handler has constructed an
	<b>AsyncReply</b> that reply gets linked to the
	<b>AsyncOpNode</b>. The MessageQueueService then signals the
	<b>client semaphore</b> within the op node.</li><br>

      <li><b>Service A</b> awakens when the <b>client semaphore</b> is
	signalled. It pulls the <b>AsyncResponse</b> message from the
	<b>AsyncOpNode</b> and processes the result. Service A is
	responsible for discarding the request, response, and
	AsyncOpNode objects. The existing classes have mechanisms for
	caching these objects to avoid too frequent
	construction/destruction of them.
    </ol>
    </p>

<h2>Test Program</h2>
      <p>
	The concepts explained below are all contained in the test
	program for the Meta Dispatcher, which is located in
	<code>$PEGASUS_HOME/src/Pegasus/Common/tests/MessageQueueService/</code>

      </p>

      <h2>Service Registration and Deregistration</h2>
      <p>
	Services (classes derived from
	<code>MessageQueueService</code>must register their presence
	with the Meta Dispatcher. This is done as follows (taken from
	the test program):

	<ol>
	<li><b>Define the Service Class</b></li>
<pre>// Define our service class

class MessageQueueClient : public MessageQueueService
{

   public:
      typedef MessageQueueService Base;

      MessageQueueClient(char *name)
	 : Base(name, MessageQueue::getNextQueueId(), 0,
		message_mask::type_cimom |
		message_mask::type_service |
		message_mask::ha_request |
		message_mask::ha_reply |
		message_mask::ha_async ),
	   client_xid(1)
      {
	 _client_capabilities = Base::_capabilities;
	 _client_mask = Base::_mask;
      }

      virtual ~MessageQueueClient(void)
      {
      }

      // method to indicate acceptance of message to
      // Meta Dispatcher
      virtual Boolean messageOK(const Message *msg);

      // function to send a request to another service
      void send_test_request(char *greeting, Uint32 qid);
      Uint32 get_qid(void);

      Uint32 _client_capabilities;
      Uint32 _client_mask;

      // method to receive messages from the Meta Dispatcher,
      // MUST be defined
      virtual void _handle_async_request(AsyncRequest *req);

      AtomicInt client_xid;
};

</pre>
      <li><b>Construct the Service</b></li>
<pre>// Create our Service
   MessageQueueClient *q_client =
          new MessageQueueClient("test client");

</pre>
      <li><b>Register the Service</b></li>
<pre>// Register our service with the Meta Dispatcher
   q_client-&gt;register_service("test client",
                               q_client-&gt;_client_capabilities,
                               q_client-&gt;_client_mask);
   cout &lt;&lt; " client registered " &lt;&lt; endl;
</pre>

</ol>

      The example above hides many of the details which are handled by
      the MessageQueueService's constructor, such as creating the
      background thread, finding the Meta Dispatcher, and constructing
      the queues. But a derived class as the example shows does not
      need to worry about those details.
      </p>

<h2>Finding Other Services</h2>
      <p>
	The MessageQueueService class has an api for finding other
	services. This api is built using messages that are defined in
	<code>CimomMessage.h</code>. Here is an example from the test
	program:

<pre>
   Array&lt;Uint32&gt;; services;

   while( services.size() == 0 )
   {
      q_client-&gt;find_services(String("test server"), 0, 0, &services);
      pegasus_yield();
   }

   cout &lt;&lt; "found server at " &lt;&lt; services[0] &lt;&lt; endl;


</pre>

      The code sample above shows how to find services by their
      name. The api also allows finding services by their capabilities
      or the messages they support. Note that the return is an array
      of Queue IDs. It is possible, for example, to find multiple
      services.
      </p>

<h2>Sending an Asynchronous Message to Another Service</h2>
      <p>
	The "handle" for a services is its Queue ID. Once you have the
	Queue ID you can send a message to that service. The example
	above shows one way to get a service's Queue ID. Here is an
	example that shows how to send that service a message.

<ol>
<li><b>Define the Request and Response Message Pair by Inheriting from AsyncMessage.</b></li>
<pre>
class test_request : public AsyncRequest
{

   public:
      typedef AsyncRequest Base;

      test_request(Uint32 routing,
		   AsyncOpNode *op,
		   Uint32 destination,
		   Uint32 response,
		   char *message)
	 : Base(0x04100000,
		Message::getNextKey(),
		routing,
		0,
		op,
		destination,
		response,
		true),
	   greeting(message)
      {
	
      }

      virtual ~test_request(void)
      {


      }

      String greeting;
};


class test_response : public AsyncReply
{
   public:
      typedef AsyncReply Base;


      test_response(Uint32 key,
		    Uint32 routing,
		    AsyncOpNode *op,
		    Uint32 result,
		    Uint32 destination,
		    char *message)
	 : Base(0x04200000,
		key,
		routing,
		0,
		op,
		result,
		destination,
		true),
	   greeting(message)
      {
	
      }

      virtual ~test_response(void)
      {
	
      }

      String greeting;
};

</pre>

      The function <code>send_test_request</code> shows everything
      that is necessary to send a message to another service and
      process the reply.

<pre>
void MessageQueueClient::send_test_request(char *greeting, Uint32 qid)
{

</pre>
<li><b>Construct the Request</b></li>

<pre>   test_request *req =
      new test_request(Base::get_next_xid(),
		       0,
		       qid,        // destination queue ID
		       _queueId,   // my own queue ID
		       greeting);  // message parameter

</pre>

<li><b>Send the message using <code>MessageQueueService::SendWait</code></b></li>

<pre>   AsyncMessage *response = SendWait(req);

</pre>

<li><b>Process the Response.</b></i>
<pre>   if( response != 0  )
   {
      msg_count++;
      delete response;
      cout << " test message " << msg_count.value() << endl;

   }
   delete req;
}

</pre>

<li><b>Delete the Request and the Response. The
	    <code>SendWait</code> interface creates and disposes of
	    everything else.</b></li>

</ol>
      </p>


<h2>Handling an Incoming Message </h2>

	<p>
	  To handle messages the service needs to implement the
	  following methods.

<ol>

<li><b><code>virtual Boolean MessageOK(const Message
		*)</code></b></li>

	  This method allows the Service to accept or reject the
	message. The Meta Dispatcher will always call this method
	before inserting the request on the Service's queue.

<pre>
Boolean MessageQueueServer::messageOK(const Message *msg)
{
   if(msg->getMask() & message_mask::ha_async)
   {
      if( msg->getType() == 0x04100000 ||
	  msg->getType() == async_messages::CIMSERVICE_STOP ||
	  msg->getType() == async_messages::CIMSERVICE_PAUSE ||
	  msg->getType() == async_messages::CIMSERVICE_RESUME )
      return true;
   }
   return false;
}

</pre>

<li><b><code>virtual Boolean accept_async(AsyncOpNode
	      *operation)</code> (optional) </b></li>

	This method executes on the Meta Dispatcher's thread and links
	the incoming message to the Service's queue. <br><br>



<li><b><code>virtual void _handle_incoming_operation(AsyncOpNode
	      *)</code></b></li><br>


This method is called by the Service's background thread. Here is an
	example implementation that just does some sanity checking on
	the message.

<pre>
void MessageQueueServer::_handle_incoming_operation(AsyncOpNode *op)
{
   if ( operation != 0 )
   {
      Message *rq = operation-&gt;get_request();
      PEGASUS_ASSERT(rq != 0 );
      PEGASUS_ASSERT(rq-&gt;getMask() & message_mask::ha_async );
      PEGASUS_ASSERT(rq-&gt;getMask() & message_mask::ha_request);
      _handle_async_request(static_cast&lt;AsyncRequest *&gt;(rq));
   }

   return;

}


</pre>

<li><b><code>virtual void _handle_async_request(AsyncRequest *)</code></b></li><br>
<br>

	This method handles the request. The Service must implement
	this method. <b>If the Service does not handle the Request it
	  must pass the Request to the Base class by calling <code>Base::_handle_async_request(req)</code></b>

<pre>void MessageQueueServer::_handle_async_request(AsyncRequest *req)
{
   if (req->getType() == 0x04100000 )
   {
      req->op->processing();
      handle_test_request(req);   // Message Handler
   }
   else if ( req->getType() == async_messages::CIMSERVICE_STOP )
   {
      req->op->processing();
      handle_CimServiceStop(static_cast<CimServiceStop *>(req));
   }

   else
      Base::_handle_async_request(req);  // Give it to the Base !!
}

</pre>

<li><b>Specific Message Handlers</b>

	  Each Message handler will be defined by the format of the
	  Request/Response pair. Here is an example from the test
	  program.

<pre>
   if( msg-&gt;getType() == 0x04100000 )
   {

</pre>
	  <ol>
	    <li><b>Construct the Reply</b></li>
<pre>
      test_response *resp =
	 new test_response(msg-&gt;getKey(),
			   msg-&gt;getRouting(),
			   msg-&gt;op,
			   async_results::OK,
			   msg-&gt;dest,
			   "i am a test response");


</pre>
	    <li><b>Complete the Reply</b> by calling the following
	    helper routine in the Base class</li>

<pre>      _completeAsyncResponse(msg, resp, ASYNC_OPSTATE_COMPLETE, 0);

   }
</pre>

</ol>
	</p>

<h2>Handling CIMMessage and Other Pre-existing Message Classes</h2>
	  <p>
	    Existing Messages, including all of the <code>CIMMessage</code>
	    derivitives, are not configured to be asynchronous
	    request/reply pairs. They are designed to travel through
	    Pegasus as events that trigger other processing events,
	    which is the end of their lifetime. This is not an optimal
	    use model for asynchronous operation because the
	    originator of the event does not require nor receive any
	    completion notification. Further, there is not a
	    one-to-one correspondence of "event messages" to replies.
	  </p>
	
	  <h3>AsyncLegacyOperationStart Message</h3>
	  <p>
	    The AsyncLegacyOperationStart message is an envelope that
	    allows a <code>MessageQueueService</code>-based service to
	    send, receive, and process pre-existing "legacy"
	    messages.
	  </p>
	  <p>
	    The <code>AsyncLegacyOperationStart</code> Message allows
	    an asynchronous service to create, package, and send a
	    "legacy" message to another service or, indirectly,
	    enqueue it to a non-asynchronous message queue. The code
	    example below shows how this works:
	  </p>

<pre>
   cout &lt;&lt; " sending LEGACY to test server" &lt;&lt; endl;

   Message *legacy = new Message(0x11100011,
				 Message::getNextKey());

   AsyncLegacyOperationStart *req =
      new AsyncLegacyOperationStart(q_client-&gt;get_next_xid(),
				    0,
				    services[0],
				    legacy,
				    q_client-&gt;getQueueId());
   reply = q_client-&gt;SendWait(req);
   delete req;
   delete reply;

</pre>
	  <p>
	   The code sample above shows a <code>Message</code> object
	   being embedded inside an
	    <code>AsyncLegacyOperationStart</code> message and sent
	    using the <code>SendWait</code>API.
	  </p>

	  <h3>Default Handler for Legacy Messages</h3>
	  <p>
	    The <code>MessageQueueService</code> class has a default
	    handler for legacy messages that extracts the
	    <code>Message</code> out of its asynchronous "envelope"
	    and dispatches it using the pre-existing synchronous
	    interface, as shown below.
	  </p>

<pre>
void MessageQueueService::handle_AsyncLegacyOperationStart(
                                               AsyncLegacyOperationStart *req)
{
   // remove the legacy message from the request and enqueue it to its destination
   Uint32 result = async_results::CIM_NAK;

   Message *legacy = req-&gt;act;
   if ( legacy != 0 )
   {
      MessageQueue* queue = MessageQueue::lookup(req-&gt;legacy_destination);
      if( queue != 0 )
      {
	// Enqueue the response:
	 queue-&gt;enqueue(legacy);
	 result = async_results::OK;
      }
   }
   _make_response(req, result);
}

</pre>

	  <p>
	    The default handler shown above extracts the legacy
	    message and attempts to <code>enqueue</code> that message
	    syncrhonously using the pre-existing interface.
	  </p>

<h3>Example of Custom Handler for Legacy Messages</h3>
	  <p>
	    By implementing the virtual
	    <code>_handle_async_request</code> method,
	    a service can choose to implement its own handler for
	    Legacy messages, as the code below shows:
	  </p>

<ol>

<li><b>Implement the virtual <code>_handle_async_request</code> method.</b></li>
<pre>
void MessageQueueServer::_handle_async_request(AsyncRequest *req)
{
   if (req->getType() == 0x04100000 )
   {
      req->op->processing();
      handle_test_request(req);
   }
   else if ( req->getType() == async_messages::CIMSERVICE_STOP )
   {
      req->op->processing();
      handle_CimServiceStop(static_cast<CimServiceStop *>(req));
   }
</pre>
<li><b>Implement a dispatcher for <code>ASYNC_LEGACY_OP_START</code></b></li>
<pre>   else if ( req->getType() == async_messages::ASYNC_LEGACY_OP_START )
   {
      req->op->processing();
      handle_LegacyOpStart(static_cast<AsyncLegacyOperationStart *>(req));
   }

   else
      Base::_handle_async_request(req);
}

</pre>
<li><b>Implement a dispatcher for <code>ASYNC_LEGACY_OP_START</code></b></li>
<pre>
void MessageQueueServer::handle_LegacyOpStart(AsyncLegacyOperationStart *req)
{

   Message *legacy = req-&gt;act;
   cout &lt;&lt; " ### handling legacy messages " &lt;&lt; endl;


      AsyncReply *resp =
	 new AsyncReply(async_messages::REPLY,
			req-&gt;getKey(),
			req-&gt;getRouting(),
			0,
			req-&gt;op,
			async_results::OK,
			req-&gt;resp,
			req-&gt;block);
      _completeAsyncResponse(req, resp, ASYNC_OPSTATE_COMPLETE, 0 );

      if (legacy != 0 )
	 cout &lt;&lt; " legacy msg type: " &lt;&lt; legacy-&gt;getType() &lt;&lt; endl;

}

</pre>


</ol>

    <hr>


<a name="non-blocking"><h2>Sending Messages without Blocking (Async with Callback)</h2></a>

	      <p>
		Whenever there is a possibility that the processing of
		one message may generate a nested message (message
		generated within the handler of a message) it is
		necessary to send messages without blocking, and to
		receive responses via callback routines. The diagram
		below shows the (more complicated) flow of
		non-blocking messages.
	      </p>
<br>
	      <div class="exampleOuter"><div class="exampleInner">
      <pre>      Service A--Message----1---->
                               |
        . <-----------(return)-+----->-(loop)--->-+
        .                      |  Meta Dispatcher |
        .                      +----<-----<---<---+
        .                                      Message---2-->Service B
        .                                                            |
        .                                        <--Response--3------+
        .                                        |
        .                        +--<--<-----<-----+--(return)---->
        .                        | Meta Dispatcher |
      Service A <--Callback--4---+--->-(loop)-->---+
                   |       ^
                   +-------+
    </pre>
		</div></div>

	      <h3>Test Program</h3>
	
	      <p>
		There is a test program that sends and receives
		non-blocking messages in
		<code>$(PEGASUS_ROOT)/src/Pegasus/Common/tests/async_callback/</code>
	      </p>

	      <h3>SendAsync method</h3>

	      <p>
		The <code>MessageQueueService</code> class sends
		non-blocking messages using the <code>SendAsync</code>
		method from <code>MessageQueueService.h</code>.
	      </p><br>


	      <div class="exampleOuter"><div class="exampleInner">
<pre>
Boolean <b><font color=#000000>SendAsync</font></b><font color=#990000>(</font>AsyncOpNode <font color=#990000>*</font>op<font color=#990000>,</font>
 		  Uint32 destination<font color=#990000>,</font>
 		  <font color=#009900>void</font> <font color=#990000>(</font><font color=#990000>*</font>callback<font color=#990000>)</font><font color=#990000>(</font>AsyncOpNode <font color=#990000>*</font><font color=#990000>,</font> MessageQueue <font color=#990000>*</font><font color=#990000>,</font> <font color=#009900>void</font> <font color=#990000>*</font><font color=#990000>)</font><font color=#990000>,</font>
		  MessageQueue <font color=#990000>*</font>callback_q<font color=#990000>,</font>
		  <font color=#009900>void</font> <font
						      color=#990000>*</font>callback_ptr<font color=#990000>)</font><font color=#990000>;</font>
		</pre>
		<br>
		<div class="note">
		  <var>AsyncOpNode *op (In)</var> is the shared data
		  structure that controls the message flow and
		  consolidates the response data. This data structure is
		  also passed to the callback function as the first
		  parameter. The caller must
		  allocate and free this data structure. <br>
		  <br>
		  <var>Uint32 destination (In)</var> is the queue ID of
		  the service which will receive the asynchronous
		  request message.</var><br>
		  <br>
		  <var>void (*callback)(AsyncOpNode *, MessageQueue *,
		    void *) (In)</var> is the static class method that
		  will be called when the request/response pair is complete.<br>
		  <br>
		  The callback is always passed <var>op</var> as the
		  first parameter. The second parameter is the
		  <var>MessageQueue *</var> object instance that is
		  executing the callback function. Because callback
		  functions must be static class methods, the callback
		  can use the <var>MessageQueue *</var> parameter as a
		  pseudo <var>this</var> pointer. <br>
		  <br>
		  <var>MessageQueue *callback_q (In)</var> is the
		  queue pointer that will be passed to the callback
		  routine as the second parameter. It also controls
		  which queue instance receives the callback.
		  <br>
		  <br>
		  <var>void *callback_ptr (In)</var> is a pointer that will
		  be passed to the callback function.

		</div>
	      </div></div>

	      <br>

	      <h3>How the Meta Dispatcher Processes Non-Blocking Messages</h3>
	      <p>
		The focus of processing non-blocking messages is to
		remove the possibility of deadlock. Therefore, all
		message processing is performed by background
		threads. All access by services to shared data
		structures is discrete in the sense that one service
		never calls into another service. For example,
		callback routines are executed by the background
		thread of the receiving service. (As opposed to the
		sending service making a callback <i>into</i> the
		receiving service.)
	      </p>

		  <ol>
		    <li>The requesting service creates a request, an
		    <code>AsyncOpNode</code> and calls
		    <code>MessageQueueService::SendAsync(...)</code>.</li>
		    <li><code>SendAsync</code> marks the
		    <code>AsyncOpNode</code> as
		    <code>ASYNC_OPFLAGS_CALLBACK</code> with the
		    <code>ASYNC_OPSTATE_COMPLETE</code> bit
		    <i>clear</i>.</li> <li>The Meta Dispatcher routes
		    the <code>AsyncOpNode</code> to the responding
		    service.</li> <li>The responding service's
		    background thread pulls the message off its
		    internal queue and processes the request. This
		    will frequently entail creating and inserting a
		    response message into the <code>AsyncOpNode</code>
		    by calling
		    <code>AsyncOpNode::put_response(AsyncMessage
		    *)</code>.</li> <li>The responding service
		    completes the response by calling
		    <code>MessageQueueService::_complete_op_node(AsyncOpNode
		    *, Uint32, Uint32, Uint32)</code>.</li>
		    <li><code>_complete_op_node</code> passes the
		    operation back to the Meta Dispatcher, which
		    routes it <i>back</i> to the requesting
		    service.</li> <li>The requesting service's
		    background thread pulls the
		    <code>AsyncOpNode</code> off its internal queue
		    and calls
		    <code>AsyncOpNode::_async_callback</code>, which
		  is a function pointer that holds the address of the
		  requesting service's static callback method..</li>
		    <li>The requesting service deallocates the op
		      node, the request message, and the response message.</li>
		  </ol>

	      <h3>Virtual Methods for Non-Blocking Messages</h3>
	      <p>
		To use non-blocking messages, a service should
		implement the following virtual method from
		<code>MessageQueueService</code>, plus a static class
		callback function.
	      </p>
	      <div class="exampleOuter"><div class="exampleInner">
		  <pre><b><font color=#0000FF>virtual</font></b> <font color=#009900>void</font> <b><font color=#000000>_handle_async_request</font></b><font color=#990000>(</font>AsyncRequest <font color=#990000>*</font>req<font color=#990000>)</font><font color=#990000>;</font>
		  </pre>
		  <div class="note">
		    <var>AsyncRequest *req (In)</var> is the incoming
		    request. <code>req->op</code> is the
		    <code>AsyncOpNode</code> that is controlling this
		    operation.
		    <br><br>
		    This method is called by the service's background
		    thread whenever an <code>AsyncRequest</code>
		    message is sent to the service. <i>This includes
		      both blocking and non-blocking request messages.</i><p>
		    <p>
		      Within <code>_handle_async_request</code> you
		      can determine whether the message is blocking or
		      non-blocking by using the following code
		      segment:
<pre><code>

if(req->op->read_flags() & ASYNC_OPFLAGS_CALLBACK )
{

   // let everyone know you are working on the request
   req->op->processing();

   // this request is part of a callback (non-blocking) operation
   AsyncResponse *response = new AsyncResponse(...);

   // initialize the response message however is appropriate

  // put the response to the op node
  req->op->put_response(response);

  // complete the operation
  _complete_op_node(req->op, 0, 0, async_results::OK);

  return;
}
</code></pre>
		  </div>		
		</div>
	      </div>
	      <br>


<div class="exampleOuter"><div class = "exampleInner">

		  <pre>
<b><font color=#0000FF>static</font></b> <font color=#009900>void</font> <b><font color=#000000>async_callback_function</font></b><font color=#990000>(</font>AsyncOpNode <font color=#990000>*</font>op<font color=#990000>,</font> MessageQueue <font color=#990000>*</font><font color=#990000>,</font> <font color=#009900>void</font> <font color=#990000>*</font><font color=#990000>)</font><font color=#990000>;</font>

		  </pre>
		  <div class="note">
		    <var>AsyncOpNode *op (In)</var> is the
		    incoming shared object that is controlling this
		    completing operation.<br>
		    <br>
		    <var>MessageQueue *q (In)</var> is a pointer to
		    the class that has received the complete
		    <var>op</var>. This parameter is meant to be used
		    as a <code>this</code> pointer because the
		    callback is a static class method.
		    <br>
		    <br>
		    <var>void *parm (In)</var> is a pointer that the
		    class passed to <code>SendAsync</code>. It can be
		    used as a convenience for the class.<br>
		    <br>

		    This method is <i>only</i> called when a
		    non-blocking operation is complete, meaning that
		    the responding service has added a response
		    message to the <var>op</var> and set the
		    <code>ASYNC_OPSTATE_COMPLETE</code> bit. <br><br>
		    <pre>
void my_class::async_callback_function(AsyncOpNode *op,
                                       MessageQueue *q,
                                       void *parm)
{

   my_class *myself = static_cast&lt;my_class *&gt;(q);
   AsyncRequest *request = op-&gt;get_request();
   AsyncResponse *response = op-&gt;get_response();

   // process response

   delete request;
   delete response;
   myself-&gt;put_op(op);
   return;
}

		  </div>
		</div>
	      </div>

	      <h3>Strategies for Handling Non-Blocking Responses</h3>
	      <p>
		All of the legacy message handling code in Pegasus is syncrhonous, meaning that a service can send a request
		and receive the response in two adjacent lines of
		code. Non-blocking messages are different because the
		timing and existence of a response message is
		undetermined. </p>
	      <p>
		There are couple of possible strategies for handing
		non-blocking response messages. <ol>
		  <li>Seperate the request creation and sending code
		  from the response handling code into distinct methods.</li>
		<li>Handle request creation and sending and response
		  handling in the same method using different code blocks.
		</ol>
	      </p>

	      <h4>Separate Request and Response Handling Methods</h4>
	      <div class="exampleOuter">
		<div class="exampleInner">
		  <ol>
		    <li>Write the request generation method.
		  <pre>
 void my_class::generate_request(Uint32 destination)
{
   AsyncOpNode *op = get_op();
   my_request *req = new my_request(...);
   op-&gt;put_request(req);

   SendAsync(op, destination, my_callback, this, (void *)0);
   return;
}
		      </pre>
		      </li>
		    <li> Write the request handling method.
		      <pre>
void my_class::handle_response(AsyncOpNode *op)
{
   my_response *res = op-&gt;get_response();
   if(res != 0 )
   {
      // handle response
      delete response;
   }
   put_op(op);
   return;
}
		      </pre>
		    </li>
		    <li> Have your callback method call your response
		      method.
		      <pre>
void my_class:my_callback(AsyncOpNode *op, MessageQueue *queue, void *parm)
{
   my_class *myself = static_cast&lt;queue&gt;

   myself-&gt;handle_response(op);
   return;
}
		      </pre>
		    </li>
		  </ol>
		</div>
	      </div>

	
	      <h4>Singe Request and Response Handling Method</h4>
	      <p>
		This strategy requires two separate code blocks within
		the request/response method, and conditional execution
		depending on the status of the operation. </p>
	      <p>
		I think the advantage of this strategy is that it
		matches more closely the current<br>
		<code>handleEnqueue(Message *msg)</code> code
		convention that is in Pegasus. </p>

	      <div class="exampleOuter">
		<div class="exampleInner">
		  <ol>
		    <li>Write the request generation block.
		  <pre>
 void my_class::handle_operation(AsyncOpNode *op)
{
   if(op == NULL)
   {
      AsyncOpNode *op = get_op();
      my_request *req = new my_request(...);
      op-&gt;put_request(req);

      SendAsync(op, destination, my_callback, this, (void *)0);

   }
   else
   {

   }
   return;
}
		      </pre>
		      </li>
		    <li> Write the request handling block.
		      <pre>
 void my_class::handle_operation(AsyncOpNode *op)
{
   if(op == NULL)
   {
      AsyncOpNode *op = get_op();
      my_request *req = new my_request(...);
      op-&gt;put_request(req);

      SendAsync(op, destination, my_callback, this, (void *)0);

   }
   else
   {
      my_response *res = op-&gt;get_response();
      if(res != 0 )
      {
         // handle response
         delete response;
      }
      put_op(op);
   }
   return;
}

		      </pre>
		    </li>
		    <li> Have your callback method call your handler
		      method.
		      <pre>
void my_class:my_callback(AsyncOpNode *op, MessageQueue *queue, void *parm)
{
   my_class *myself = static_cast&lt;queue&gt;

   myself-&gt;handle_operation(op);
   return;
}
		      </pre>
		    </li>
		  </ol>
		</div>
	      </div>

<hr><hr>

<h2>Class Definitions</h2>

<h3>cimom (Meta Dispatcher)</h3>

<pre><tt>
<i><font color=#9A1900>//%LICENSE////////////////////////////////////////////////////////////////</font></i>
<i><font color=#9A1900>//</font></i>
<i><font color=#9A1900>// Licensed to The Open Group (TOG) under one or more contributor license</font></i>
<i><font color=#9A1900>// agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with</font></i>
<i><font color=#9A1900>// this work for additional information regarding copyright ownership.</font></i>
<i><font color=#9A1900>// Each contributor licenses this file to you under the OpenPegasus Open</font></i>
<i><font color=#9A1900>// Source License; you may not use this file except in compliance with the</font></i>
<i><font color=#9A1900>// License.</font></i>
<i><font color=#9A1900>//</font></i>
<i><font color=#9A1900>// Permission is hereby granted, free of charge, to any person obtaining a</font></i>
<i><font color=#9A1900>// copy of this software and associated documentation files (the "Software"),</font></i>
<i><font color=#9A1900>// to deal in the Software without restriction, including without limitation</font></i>
<i><font color=#9A1900>// the rights to use, copy, modify, merge, publish, distribute, sublicense,</font></i>
<i><font color=#9A1900>// and/or sell copies of the Software, and to permit persons to whom the</font></i>
<i><font color=#9A1900>// Software is furnished to do so, subject to the following conditions:</font></i>
<i><font color=#9A1900>//</font></i>
<i><font color=#9A1900>// The above copyright notice and this permission notice shall be included</font></i>
<i><font color=#9A1900>// in all copies or substantial portions of the Software.</font></i>
<i><font color=#9A1900>//</font></i>
<i><font color=#9A1900>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS</font></i>
<i><font color=#9A1900>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</font></i>
<i><font color=#9A1900>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.</font></i>
<i><font color=#9A1900>// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY</font></i>
<i><font color=#9A1900>// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,</font></i>
<i><font color=#9A1900>// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE</font></i>
<i><font color=#9A1900>// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</font></i>
<i><font color=#9A1900>//</font></i>
<i><font color=#9A1900>//////////////////////////////////////////////////////////////////////////</font></i>
<i><font color=#9A1900>//</font></i>
<i><font color=#9A1900>// Author: Mike Day (mdday@us.ibm.com</font></i>
<i><font color=#9A1900>//</font></i>
<i><font color=#9A1900>// Modified By: </font></i>
<i><font color=#9A1900>//</font></i>
<i><font color=#9A1900>//////////////////////////////////////////////////////////////////////////</font></i>

<b><font color=#000080>#ifndef</font></b> CIMOM_include
<b><font color=#000080>#define</font></b> CIMOM_include

<b><font color=#000080>#include</font></b> <font color=#FF0000>&lt;Pegasus/Common/Config.h&gt;</font>
<b><font color=#000080>#include</font></b> <font color=#FF0000>&lt;Pegasus/Common/Exception.h&gt;</font>
<b><font color=#000080>#include</font></b> <font color=#FF0000>&lt;Pegasus/Common/MessageQueue.h&gt;</font>
<b><font color=#000080>#include</font></b> <font color=#FF0000>&lt;Pegasus/Common/DQueue.h&gt;</font>
<b><font color=#000080>#include</font></b> <font color=#FF0000>&lt;Pegasus/Common/Thread.h&gt;</font>
<b><font color=#000080>#include</font></b> <font color=#FF0000>&lt;Pegasus/Common/Array.h&gt;</font>
<b><font color=#000080>#include</font></b> <font color=#FF0000>&lt;Pegasus/Common/AsyncOpNode.h&gt;</font>
<b><font color=#000080>#include</font></b> <font color=#FF0000>&lt;Pegasus/Common/CimomMessage.h&gt;</font>
<b><font color=#000080>#include</font></b> <font color=#FF0000>&lt;Pegasus/Common/MessageQueueService.h&gt;</font>

PEGASUS_NAMESPACE_BEGIN

<b><font color=#0000FF>extern</font></b> <b><font color=#0000FF>const</font></b> Uint32 CIMOM_Q_ID<font color=#990000>;</font>

<b><font color=#0000FF>class</font></b> PEGASUS_COMMON_LINKAGE module_capabilities
<font color=#FF0000>{</font>
   <b><font color=#0000FF>public</font></b><font color=#990000>:</font>
      <b><font color=#0000FF>static</font></b> Uint32 async<font color=#990000>;</font>
      <b><font color=#0000FF>static</font></b> Uint32 remote<font color=#990000>;</font>
      <b><font color=#0000FF>static</font></b> Uint32 trusted<font color=#990000>;</font>
      <b><font color=#0000FF>static</font></b> Uint32 paused<font color=#990000>;</font>
      <b><font color=#0000FF>static</font></b> Uint32 stopped<font color=#990000>;</font>
<font color=#FF0000>}</font> <font color=#990000>;</font>

<b><font color=#0000FF>class</font></b> PEGASUS_COMMON_LINKAGE cimom<font color=#990000>;</font>

<b><font color=#0000FF>class</font></b> PEGASUS_COMMON_LINKAGE message_module
<font color=#FF0000>{</font>
   <b><font color=#0000FF>public</font></b><font color=#990000>:</font>
      <b><font color=#000000>message_module</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font>
	 <font color=#990000>:</font> <b><font color=#000000>_name</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>,</font> <b><font color=#000000>_capabilities</font></b><font color=#990000>(</font><font color=#993399>0</font><font color=#990000>)</font><font color=#990000>,</font>
	   <b><font color=#000000>_mask</font></b><font color=#990000>(</font><font color=#993399>0</font><font color=#990000>)</font><font color=#990000>,</font> <b><font color=#000000>_q_id</font></b><font color=#990000>(</font><font color=#993399>0</font><font color=#990000>)</font> <font color=#FF0000>{</font> <font color=#FF0000>}</font>

      <b><font color=#000000>message_module</font></b><font color=#990000>(</font><b><font color=#0000FF>const</font></b> String <font color=#990000>&amp;</font> name<font color=#990000>,</font>
		     Uint32 capabilities<font color=#990000>,</font>
		     Uint32 mask<font color=#990000>,</font>
		     Uint32 queue<font color=#990000>)</font>
      	 <font color=#990000>:</font> <b><font color=#000000>_name</font></b><font color=#990000>(</font>name<font color=#990000>)</font><font color=#990000>,</font> <b><font color=#000000>_capabilities</font></b><font color=#990000>(</font>capabilities<font color=#990000>)</font><font color=#990000>,</font>
	   <b><font color=#000000>_mask</font></b><font color=#990000>(</font>mask<font color=#990000>)</font><font color=#990000>,</font> <b><font color=#000000>_q_id</font></b><font color=#990000>(</font>queue<font color=#990000>)</font>  <font color=#FF0000>{</font> <font color=#FF0000>}</font>

      Boolean <b><font color=#0000FF>operator</font></b> <font color=#990000>=</font><font color=#990000>=</font> <font color=#990000>(</font><b><font color=#0000FF>const</font></b> message_module <font color=#990000>*</font>mm<font color=#990000>)</font> <b><font color=#0000FF>const</font></b><font color=#990000>;</font>
      Boolean <b><font color=#0000FF>operator</font></b> <font color=#990000>=</font><font color=#990000>=</font> <font color=#990000>(</font><b><font color=#0000FF>const</font></b> String <font color=#990000>&amp;</font> name <font color=#990000>)</font> <b><font color=#0000FF>const</font></b> <font color=#990000>;</font>
      Boolean <b><font color=#0000FF>operator</font></b> <font color=#990000>=</font><font color=#990000>=</font> <font color=#990000>(</font><b><font color=#0000FF>const</font></b> message_module <font color=#990000>&amp;</font> mm <font color=#990000>)</font> <b><font color=#0000FF>const</font></b> <font color=#990000>;</font>
      Boolean <b><font color=#0000FF>operator</font></b> <font color=#990000>=</font><font color=#990000>=</font> <font color=#990000>(</font><b><font color=#0000FF>const</font></b> <font color=#009900>void</font> <font color=#990000>*</font><font color=#990000>)</font> <b><font color=#0000FF>const</font></b><font color=#990000>;</font>
      Boolean <b><font color=#0000FF>operator</font></b> <font color=#990000>=</font><font color=#990000>=</font> <font color=#990000>(</font>Uint32<font color=#990000>)</font> <b><font color=#0000FF>const</font></b><font color=#990000>;</font>

      <b><font color=#0000FF>const</font></b> String <font color=#990000>&amp;</font> <b><font color=#000000>get_name</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font> <b><font color=#0000FF>const</font></b> <font color=#990000>;</font>
      Uint32 <b><font color=#000000>get_capabilities</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font> <b><font color=#0000FF>const</font></b> <font color=#990000>;</font>
      Uint32 <b><font color=#000000>get_mask</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font> <b><font color=#0000FF>const</font></b> <font color=#990000>;</font>
      Uint32 <b><font color=#000000>get_queue</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font> <b><font color=#0000FF>const</font></b> <font color=#990000>;</font>

      <font color=#009900>void</font> <b><font color=#000000>put_name</font></b><font color=#990000>(</font>String <font color=#990000>&amp;</font> name<font color=#990000>)</font><font color=#990000>;</font>
      <font color=#009900>void</font> <b><font color=#000000>put_capabilities</font></b><font color=#990000>(</font>Uint32 capabilities<font color=#990000>)</font><font color=#990000>;</font>
      <font color=#009900>void</font> <b><font color=#000000>put_mask</font></b><font color=#990000>(</font>Uint32 mask<font color=#990000>)</font><font color=#990000>;</font>
      <font color=#009900>void</font> <b><font color=#000000>put_queue</font></b><font color=#990000>(</font>Uint32 queue<font color=#990000>)</font> <font color=#990000>;</font>

   <b><font color=#0000FF>private</font></b><font color=#990000>:</font>
      String _name<font color=#990000>;</font>
      Uint32 _capabilities<font color=#990000>;</font>
      Uint32 _mask<font color=#990000>;</font>
      <b><font color=#0000FF>struct</font></b> timeval _heartbeat<font color=#990000>;</font>


      Uint32 _q_id<font color=#990000>;</font>
      <b><font color=#0000FF>friend</font></b> <b><font color=#0000FF>class</font></b> cimom<font color=#990000>;</font>
<font color=#FF0000>}</font><font color=#990000>;</font>

<b><font color=#0000FF>class</font></b> MessageQueueService<font color=#990000>;</font>


<b><font color=#0000FF>class</font></b> PEGASUS_COMMON_LINKAGE cimom <font color=#990000>:</font> <b><font color=#0000FF>public</font></b> MessageQueue
<font color=#FF0000>{</font>
   <b><font color=#0000FF>public</font></b> <font color=#990000>:</font>
      <b><font color=#000000>cimom</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font><font color=#990000>;</font>

      <b><font color=#0000FF>virtual</font></b> <font color=#990000>~</font><b><font color=#000000>cimom</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font> <font color=#990000>;</font>

      Boolean <b><font color=#000000>moduleChange</font></b><font color=#990000>(</font><b><font color=#0000FF>struct</font></b> timeval last<font color=#990000>)</font><font color=#990000>;</font>

      Uint32 <b><font color=#000000>getModuleCount</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font><font color=#990000>;</font>
      Uint32 <b><font color=#000000>getModuleIDs</font></b><font color=#990000>(</font>Uint32 <font color=#990000>*</font>ids<font color=#990000>,</font> Uint32 count<font color=#990000>)</font> <b><font color=#0000FF>throw</font></b><font color=#990000>(</font>IPCException<font color=#990000>)</font><font color=#990000>;</font>

      AsyncOpNode <font color=#990000>*</font><b><font color=#000000>get_cached_op</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font> <b><font color=#0000FF>throw</font></b><font color=#990000>(</font>IPCException<font color=#990000>)</font><font color=#990000>;</font>
      <font color=#009900>void</font> <b><font color=#000000>cache_op</font></b><font color=#990000>(</font>AsyncOpNode <font color=#990000>*</font>op<font color=#990000>)</font> <b><font color=#0000FF>throw</font></b><font color=#990000>(</font>IPCException<font color=#990000>)</font><font color=#990000>;</font>

      <font color=#009900>void</font> <b><font color=#000000>set_default_op_timeout</font></b><font color=#990000>(</font><b><font color=#0000FF>const</font></b> <b><font color=#0000FF>struct</font></b> timeval <font color=#990000>*</font>buffer<font color=#990000>)</font><font color=#990000>;</font>
      <font color=#009900>void</font> <b><font color=#000000>get_default_op_timeout</font></b><font color=#990000>(</font><b><font color=#0000FF>struct</font></b> timeval <font color=#990000>*</font>timeout<font color=#990000>)</font> <b><font color=#0000FF>const</font></b> <font color=#990000>;</font>

      <b><font color=#0000FF>virtual</font></b> <font color=#009900>void</font> <b><font color=#000000>handleEnqueue</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>;</font>
      <font color=#009900>void</font> <b><font color=#000000>register_module</font></b><font color=#990000>(</font>RegisterCimService <font color=#990000>*</font>msg<font color=#990000>)</font><font color=#990000>;</font>
      <font color=#009900>void</font> <b><font color=#000000>deregister_module</font></b><font color=#990000>(</font>Uint32 quid<font color=#990000>)</font><font color=#990000>;</font>
      <font color=#009900>void</font> <b><font color=#000000>update_module</font></b><font color=#990000>(</font>UpdateCimService <font color=#990000>*</font>msg <font color=#990000>)</font><font color=#990000>;</font>
      <font color=#009900>void</font> <b><font color=#000000>ioctl</font></b><font color=#990000>(</font>AsyncIoctl <font color=#990000>*</font>msg <font color=#990000>)</font><font color=#990000>;</font>

      <font color=#009900>void</font> <b><font color=#000000>find_service_q</font></b><font color=#990000>(</font>FindServiceQueue <font color=#990000>*</font>msg <font color=#990000>)</font><font color=#990000>;</font>
      <font color=#009900>void</font> <b><font color=#000000>enumerate_service</font></b><font color=#990000>(</font>EnumerateService <font color=#990000>*</font>msg <font color=#990000>)</font><font color=#990000>;</font>
      Boolean <b><font color=#000000>route_async</font></b><font color=#990000>(</font>AsyncOpNode <font color=#990000>*</font>operation<font color=#990000>)</font><font color=#990000>;</font>
      <font color=#009900>void</font> <b><font color=#000000>_shutdown_routed_queue</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font><font color=#990000>;</font>


   <b><font color=#0000FF>protected</font></b><font color=#990000>:</font>
      Uint32 <b><font color=#000000>get_module_q</font></b><font color=#990000>(</font><b><font color=#0000FF>const</font></b> String <font color=#990000>&amp;</font> name<font color=#990000>)</font><font color=#990000>;</font>
      <b><font color=#0000FF>static</font></b> <font color=#009900>void</font> <b><font color=#000000>_make_response</font></b><font color=#990000>(</font>Message <font color=#990000>*</font>req<font color=#990000>,</font> Uint32 code<font color=#990000>)</font><font color=#990000>;</font>
      <b><font color=#0000FF>static</font></b> <font color=#009900>void</font> <b><font color=#000000>_completeAsyncResponse</font></b><font color=#990000>(</font>AsyncRequest <font color=#990000>*</font>request<font color=#990000>,</font>
				  AsyncReply <font color=#990000>*</font>reply<font color=#990000>,</font>
				  Uint32 state<font color=#990000>,</font>
				  Uint32 flag<font color=#990000>)</font><font color=#990000>;</font>
      <b><font color=#0000FF>static</font></b> <font color=#009900>void</font> <b><font color=#000000>_complete_op_node</font></b><font color=#990000>(</font>AsyncOpNode <font color=#990000>*</font>op<font color=#990000>,</font> Uint32 state<font color=#990000>,</font> Uint32 flag<font color=#990000>,</font> Uint32 code<font color=#990000>)</font><font color=#990000>;</font>
      <b><font color=#0000FF>static</font></b> <font color=#009900>void</font> <b><font color=#000000>_default_callback</font></b><font color=#990000>(</font>AsyncOpNode <font color=#990000>*</font><font color=#990000>,</font> MessageQueue <font color=#990000>*</font><font color=#990000>,</font> <font color=#009900>void</font> <font color=#990000>*</font><font color=#990000>)</font><font color=#990000>;</font>

   <b><font color=#0000FF>private</font></b><font color=#990000>:</font>
      <b><font color=#0000FF>struct</font></b> timeval _default_op_timeout<font color=#990000>;</font>
      <b><font color=#0000FF>struct</font></b> timeval _last_module_change<font color=#990000>;</font>
      DQueue<font color=#FF0000>&lt;message_module&gt;</font> _modules<font color=#990000>;</font>

      DQueue<font color=#FF0000>&lt;AsyncOpNode&gt;</font> _recycle<font color=#990000>;</font>

      AsyncDQueue<font color=#FF0000>&lt;AsyncOpNode&gt;</font> _routed_ops<font color=#990000>;</font>
      DQueue<font color=#FF0000>&lt;AsyncOpNode&gt;</font> _internal_ops<font color=#990000>;</font>

      <b><font color=#0000FF>static</font></b> PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL <b><font color=#000000>_routing_proc</font></b><font color=#990000>(</font><font color=#009900>void</font> <font color=#990000>*</font><font color=#990000>)</font><font color=#990000>;</font>

      Thread _routing_thread<font color=#990000>;</font>

      <b><font color=#0000FF>static</font></b> Uint32 <b><font color=#000000>get_xid</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font><font color=#990000>;</font>
      <font color=#009900>void</font> <b><font color=#000000>_handle_cimom_op</font></b><font color=#990000>(</font>AsyncOpNode <font color=#990000>*</font>op<font color=#990000>,</font> Thread <font color=#990000>*</font>thread<font color=#990000>,</font> MessageQueue <font color=#990000>*</font>queue<font color=#990000>)</font><font color=#990000>;</font>
      Uint32 <b><font color=#000000>_ioctl</font></b><font color=#990000>(</font>Uint32<font color=#990000>,</font> Uint32<font color=#990000>,</font> <font color=#009900>void</font> <font color=#990000>*</font><font color=#990000>)</font><font color=#990000>;</font>


      AtomicInt _die<font color=#990000>;</font>
      AtomicInt _routed_queue_shutdown<font color=#990000>;</font>

      <b><font color=#0000FF>static</font></b> AtomicInt _xid<font color=#990000>;</font>
      <b><font color=#0000FF>static</font></b> cimom <font color=#990000>*</font>_global_this<font color=#990000>;</font>

      <b><font color=#0000FF>friend</font></b> <b><font color=#0000FF>class</font></b> MessageQueueService<font color=#990000>;</font>

<font color=#FF0000>}</font><font color=#990000>;</font>

PEGASUS_NAMESPACE_END

<b><font color=#000080>#endif</font></b> <i><font color=#9A1900>// CIMOM_include</font></i>
</tt>
</pre>

<h3>MessageQueueService</h3>

<pre><tt>
<i><font color=#9A1900>//%LICENSE////////////////////////////////////////////////////////////////</font></i>
<i><font color=#9A1900>//</font></i>
<i><font color=#9A1900>// Licensed to The Open Group (TOG) under one or more contributor license</font></i>
<i><font color=#9A1900>// agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with</font></i>
<i><font color=#9A1900>// this work for additional information regarding copyright ownership.</font></i>
<i><font color=#9A1900>// Each contributor licenses this file to you under the OpenPegasus Open</font></i>
<i><font color=#9A1900>// Source License; you may not use this file except in compliance with the</font></i>
<i><font color=#9A1900>// License.</font></i>
<i><font color=#9A1900>//</font></i>
<i><font color=#9A1900>// Permission is hereby granted, free of charge, to any person obtaining a</font></i>
<i><font color=#9A1900>// copy of this software and associated documentation files (the "Software"),</font></i>
<i><font color=#9A1900>// to deal in the Software without restriction, including without limitation</font></i>
<i><font color=#9A1900>// the rights to use, copy, modify, merge, publish, distribute, sublicense,</font></i>
<i><font color=#9A1900>// and/or sell copies of the Software, and to permit persons to whom the</font></i>
<i><font color=#9A1900>// Software is furnished to do so, subject to the following conditions:</font></i>
<i><font color=#9A1900>//</font></i>
<i><font color=#9A1900>// The above copyright notice and this permission notice shall be included</font></i>
<i><font color=#9A1900>// in all copies or substantial portions of the Software.</font></i>
<i><font color=#9A1900>//</font></i>
<i><font color=#9A1900>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS</font></i>
<i><font color=#9A1900>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</font></i>
<i><font color=#9A1900>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.</font></i>
<i><font color=#9A1900>// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY</font></i>
<i><font color=#9A1900>// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,</font></i>
<i><font color=#9A1900>// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE</font></i>
<i><font color=#9A1900>// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</font></i>
<i><font color=#9A1900>//</font></i>
<i><font color=#9A1900>//////////////////////////////////////////////////////////////////////////</font></i>
<i><font color=#9A1900>//</font></i>
<i><font color=#9A1900>// Author: Mike Day (mdday@us.ibm.com</font></i>
<i><font color=#9A1900>//</font></i>
<i><font color=#9A1900>// Modified By: </font></i>
<i><font color=#9A1900>//</font></i>
<i><font color=#9A1900>//////////////////////////////////////////////////////////////////////////</font></i>

<b><font color=#000080>#ifndef</font></b> Pegasus_MessageQueue_Service_h
<b><font color=#000080>#define</font></b> Pegasus_MessageQueue_Service_h

<b><font color=#000080>#include</font></b> <font color=#FF0000>&lt;Pegasus/Common/Config.h&gt;</font>
<b><font color=#000080>#include</font></b> <font color=#FF0000>&lt;Pegasus/Common/Message.h&gt;</font>
<b><font color=#000080>#include</font></b> <font color=#FF0000>&lt;Pegasus/Common/Exception.h&gt;</font>
<b><font color=#000080>#include</font></b> <font color=#FF0000>&lt;Pegasus/Common/IPC.h&gt;</font>
<b><font color=#000080>#include</font></b> <font color=#FF0000>&lt;Pegasus/Common/Thread.h&gt;</font>
<b><font color=#000080>#include</font></b> <font color=#FF0000>&lt;Pegasus/Common/AsyncOpNode.h&gt;</font>
<b><font color=#000080>#include</font></b> <font color=#FF0000>&lt;Pegasus/Common/Cimom.h&gt;</font>
<b><font color=#000080>#include</font></b> <font color=#FF0000>&lt;Pegasus/Common/CimomMessage.h&gt;</font>

PEGASUS_NAMESPACE_BEGIN

<b><font color=#0000FF>extern</font></b> <b><font color=#0000FF>const</font></b> Uint32 CIMOM_Q_ID<font color=#990000>;</font>

<b><font color=#0000FF>class</font></b> message_module<font color=#990000>;</font>

<b><font color=#0000FF>class</font></b> PEGASUS_COMMON_LINKAGE MessageQueueService <font color=#990000>:</font> <b><font color=#0000FF>public</font></b> MessageQueue
<font color=#FF0000>{</font>
   <b><font color=#0000FF>public</font></b><font color=#990000>:</font>

      <b><font color=#0000FF>typedef</font></b> MessageQueue Base<font color=#990000>;</font>

      <b><font color=#000000>MessageQueueService</font></b><font color=#990000>(</font><b><font color=#0000FF>const</font></b> <font color=#009900>char</font> <font color=#990000>*</font>name<font color=#990000>,</font> Uint32 queueID<font color=#990000>,</font>
			  Uint32 capabilities <font color=#990000>=</font> <font color=#993399>0</font><font color=#990000>,</font>
			  Uint32 mask <font color=#990000>=</font> message_mask<font color=#990000>:</font><font color=#990000>:</font>type_cimom <font color=#990000>|</font>
			  message_mask<font color=#990000>:</font><font color=#990000>:</font>type_service <font color=#990000>|</font>
			  message_mask<font color=#990000>:</font><font color=#990000>:</font>ha_request <font color=#990000>|</font>
			  message_mask<font color=#990000>:</font><font color=#990000>:</font>ha_reply <font color=#990000>|</font>
			  message_mask<font color=#990000>:</font><font color=#990000>:</font>ha_async <font color=#990000>)</font> <font color=#990000>;</font>

      <b><font color=#0000FF>virtual</font></b> <font color=#990000>~</font><b><font color=#000000>MessageQueueService</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font><font color=#990000>;</font>

      <b><font color=#0000FF>virtual</font></b> Boolean <b><font color=#000000>isAsync</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font> <font color=#FF0000>{</font>  <b><font color=#0000FF>return</font></b> <b><font color=#0000FF>true</font></b><font color=#990000>;</font>  <font color=#FF0000>}</font>

      <b><font color=#0000FF>virtual</font></b> <font color=#009900>void</font> <b><font color=#000000>enqueue</font></b><font color=#990000>(</font>Message <font color=#990000>*</font><font color=#990000>)</font> <b><font color=#0000FF>throw</font></b><font color=#990000>(</font>IPCException<font color=#990000>)</font><font color=#990000>;</font>

      AsyncReply <font color=#990000>*</font><b><font color=#000000>SendWait</font></b><font color=#990000>(</font>AsyncRequest <font color=#990000>*</font>request<font color=#990000>)</font><font color=#990000>;</font>
      Boolean <b><font color=#000000>SendAsync</font></b><font color=#990000>(</font>AsyncOpNode <font color=#990000>*</font>op<font color=#990000>,</font>
			Uint32 destination<font color=#990000>,</font>
			<font color=#009900>void</font> <font color=#990000>(</font><font color=#990000>*</font>callback<font color=#990000>)</font><font color=#990000>(</font>AsyncOpNode <font color=#990000>*</font><font color=#990000>,</font> MessageQueue <font color=#990000>*</font><font color=#990000>,</font> <font color=#009900>void</font> <font color=#990000>*</font><font color=#990000>)</font><font color=#990000>,</font>
			MessageQueue <font color=#990000>*</font>callback_q<font color=#990000>,</font>
			<font color=#009900>void</font> <font color=#990000>*</font>callback_ptr<font color=#990000>)</font><font color=#990000>;</font>
      Boolean  <b><font color=#000000>SendForget</font></b><font color=#990000>(</font>Message <font color=#990000>*</font>msg<font color=#990000>)</font><font color=#990000>;</font>
      Boolean <b><font color=#000000>ForwardOp</font></b><font color=#990000>(</font>AsyncOpNode <font color=#990000>*</font><font color=#990000>,</font> Uint32 destination<font color=#990000>)</font><font color=#990000>;</font>


      Boolean <b><font color=#000000>register_service</font></b><font color=#990000>(</font>String name<font color=#990000>,</font> Uint32 capabilities<font color=#990000>,</font> Uint32 mask<font color=#990000>)</font><font color=#990000>;</font>
      Boolean <b><font color=#000000>update_service</font></b><font color=#990000>(</font>Uint32 capabilities<font color=#990000>,</font> Uint32 mask<font color=#990000>)</font><font color=#990000>;</font>
      Boolean <b><font color=#000000>deregister_service</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font><font color=#990000>;</font>
      <b><font color=#0000FF>virtual</font></b> <font color=#009900>void</font> <b><font color=#000000>_shutdown_incoming_queue</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font><font color=#990000>;</font>

      <font color=#009900>void</font> <b><font color=#000000>find_services</font></b><font color=#990000>(</font>String name<font color=#990000>,</font>
			 Uint32 capabilities<font color=#990000>,</font>
			 Uint32 mask<font color=#990000>,</font>
			 Array<font color=#FF0000>&lt;Uint32&gt;</font> <font color=#990000>*</font>results<font color=#990000>)</font><font color=#990000>;</font>
      <font color=#009900>void</font> <b><font color=#000000>enumerate_service</font></b><font color=#990000>(</font>Uint32 queue<font color=#990000>,</font> message_module <font color=#990000>*</font>result<font color=#990000>)</font><font color=#990000>;</font>
      Uint32 <b><font color=#000000>get_next_xid</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font><font color=#990000>;</font>
      AsyncOpNode <font color=#990000>*</font><b><font color=#000000>get_op</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font><font color=#990000>;</font>
      <font color=#009900>void</font> <b><font color=#000000>return_op</font></b><font color=#990000>(</font>AsyncOpNode <font color=#990000>*</font>op<font color=#990000>)</font><font color=#990000>;</font>

      Uint32 _mask<font color=#990000>;</font>
      AtomicInt _die<font color=#990000>;</font>
   <b><font color=#0000FF>protected</font></b><font color=#990000>:</font>
      <b><font color=#0000FF>virtual</font></b> Boolean <b><font color=#000000>accept_async</font></b><font color=#990000>(</font>AsyncOpNode <font color=#990000>*</font>op<font color=#990000>)</font><font color=#990000>;</font>
      <b><font color=#0000FF>virtual</font></b> Boolean <b><font color=#000000>messageOK</font></b><font color=#990000>(</font><b><font color=#0000FF>const</font></b> Message <font color=#990000>*</font>msg<font color=#990000>)</font> <font color=#990000>;</font>
      <b><font color=#0000FF>virtual</font></b> <font color=#009900>void</font> <b><font color=#000000>handleEnqueue</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font> <font color=#990000>=</font> <font color=#993399>0</font><font color=#990000>;</font>
      <b><font color=#0000FF>virtual</font></b> <font color=#009900>void</font> <b><font color=#000000>handleEnqueue</font></b><font color=#990000>(</font>Message <font color=#990000>*</font><font color=#990000>)</font> <font color=#990000>=</font> <font color=#993399>0</font><font color=#990000>;</font>
      Boolean <b><font color=#000000>_enqueueResponse</font></b><font color=#990000>(</font>Message <font color=#990000>*</font><font color=#990000>,</font> Message <font color=#990000>*</font><font color=#990000>)</font><font color=#990000>;</font>
      <b><font color=#0000FF>virtual</font></b> <font color=#009900>void</font> <b><font color=#000000>_handle_incoming_operation</font></b><font color=#990000>(</font>AsyncOpNode <font color=#990000>*</font><font color=#990000>)</font><font color=#990000>;</font>

      <b><font color=#0000FF>virtual</font></b> <font color=#009900>void</font> <b><font color=#000000>_handle_async_request</font></b><font color=#990000>(</font>AsyncRequest <font color=#990000>*</font>req<font color=#990000>)</font><font color=#990000>;</font>
      <b><font color=#0000FF>virtual</font></b> <font color=#009900>void</font> <b><font color=#000000>_handle_async_callback</font></b><font color=#990000>(</font>AsyncOpNode <font color=#990000>*</font>operation<font color=#990000>)</font><font color=#990000>;</font>
      <b><font color=#0000FF>virtual</font></b> <font color=#009900>void</font> <b><font color=#000000>_make_response</font></b><font color=#990000>(</font>Message <font color=#990000>*</font>req<font color=#990000>,</font> Uint32 code<font color=#990000>)</font><font color=#990000>;</font>


      <b><font color=#0000FF>virtual</font></b> <font color=#009900>void</font> <b><font color=#000000>handle_heartbeat_request</font></b><font color=#990000>(</font>AsyncRequest <font color=#990000>*</font>req<font color=#990000>)</font><font color=#990000>;</font>
      <b><font color=#0000FF>virtual</font></b> <font color=#009900>void</font> <b><font color=#000000>handle_heartbeat_reply</font></b><font color=#990000>(</font>AsyncReply <font color=#990000>*</font>rep<font color=#990000>)</font><font color=#990000>;</font>

      <b><font color=#0000FF>virtual</font></b> <font color=#009900>void</font> <b><font color=#000000>handle_AsyncIoctl</font></b><font color=#990000>(</font>AsyncIoctl <font color=#990000>*</font>req<font color=#990000>)</font><font color=#990000>;</font>
      <b><font color=#0000FF>virtual</font></b> <font color=#009900>void</font> <b><font color=#000000>handle_CimServiceStart</font></b><font color=#990000>(</font>CimServiceStart <font color=#990000>*</font>req<font color=#990000>)</font><font color=#990000>;</font>
      <b><font color=#0000FF>virtual</font></b> <font color=#009900>void</font> <b><font color=#000000>handle_CimServiceStop</font></b><font color=#990000>(</font>CimServiceStop <font color=#990000>*</font>req<font color=#990000>)</font><font color=#990000>;</font>
      <b><font color=#0000FF>virtual</font></b> <font color=#009900>void</font> <b><font color=#000000>handle_CimServicePause</font></b><font color=#990000>(</font>CimServicePause <font color=#990000>*</font>req<font color=#990000>)</font><font color=#990000>;</font>
      <b><font color=#0000FF>virtual</font></b> <font color=#009900>void</font> <b><font color=#000000>handle_CimServiceResume</font></b><font color=#990000>(</font>CimServiceResume <font color=#990000>*</font>req<font color=#990000>)</font><font color=#990000>;</font>

      <b><font color=#0000FF>virtual</font></b> <font color=#009900>void</font> <b><font color=#000000>handle_AsyncOperationStart</font></b><font color=#990000>(</font>AsyncOperationStart <font color=#990000>*</font>req<font color=#990000>)</font><font color=#990000>;</font>
      <b><font color=#0000FF>virtual</font></b> <font color=#009900>void</font> <b><font color=#000000>handle_AsyncOperationResult</font></b><font color=#990000>(</font>AsyncOperationResult <font color=#990000>*</font>rep<font color=#990000>)</font><font color=#990000>;</font>
      <b><font color=#0000FF>virtual</font></b> <font color=#009900>void</font> <b><font color=#000000>handle_AsyncLegacyOperationStart</font></b><font color=#990000>(</font>AsyncLegacyOperationStart <font color=#990000>*</font>req<font color=#990000>)</font><font color=#990000>;</font>
      <b><font color=#0000FF>virtual</font></b> <font color=#009900>void</font> <b><font color=#000000>handle_AsyncLegacyOperationResult</font></b><font color=#990000>(</font>AsyncLegacyOperationResult <font color=#990000>*</font>rep<font color=#990000>)</font><font color=#990000>;</font>

      <font color=#009900>void</font> <b><font color=#000000>_completeAsyncResponse</font></b><font color=#990000>(</font>AsyncRequest <font color=#990000>*</font>request<font color=#990000>,</font>
				 AsyncReply <font color=#990000>*</font>reply<font color=#990000>,</font>
				 Uint32 state<font color=#990000>,</font>
				 Uint32 flag<font color=#990000>)</font><font color=#990000>;</font>
      <font color=#009900>void</font> <b><font color=#000000>_complete_op_node</font></b><font color=#990000>(</font>AsyncOpNode <font color=#990000>*</font><font color=#990000>,</font> Uint32<font color=#990000>,</font> Uint32<font color=#990000>,</font> Uint32<font color=#990000>)</font><font color=#990000>;</font>


      <b><font color=#0000FF>static</font></b> cimom <font color=#990000>*</font>_meta_dispatcher<font color=#990000>;</font>
      <b><font color=#0000FF>static</font></b> AtomicInt _service_count<font color=#990000>;</font>
      <b><font color=#0000FF>static</font></b> Mutex _meta_dispatcher_mutex<font color=#990000>;</font>

   <b><font color=#0000FF>private</font></b><font color=#990000>:</font>

      DQueue<font color=#FF0000>&lt;AsyncOpNode&gt;</font> _pending<font color=#990000>;</font>
      AsyncDQueue<font color=#FF0000>&lt;AsyncOpNode&gt;</font> _incoming<font color=#990000>;</font>
      AsyncDQueue<font color=#FF0000>&lt;AsyncOpNode&gt;</font> _callback<font color=#990000>;</font>

      <b><font color=#0000FF>static</font></b> PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL <b><font color=#000000>_req_proc</font></b><font color=#990000>(</font><font color=#009900>void</font> <font color=#990000>*</font><font color=#990000>)</font><font color=#990000>;</font>
      <b><font color=#0000FF>static</font></b> <font color=#009900>void</font> <b><font color=#000000>_sendwait_callback</font></b><font color=#990000>(</font>AsyncOpNode <font color=#990000>*</font><font color=#990000>,</font> MessageQueue <font color=#990000>*</font><font color=#990000>,</font> <font color=#009900>void</font> <font color=#990000>*</font><font color=#990000>)</font><font color=#990000>;</font>
      AtomicInt _incoming_queue_shutdown<font color=#990000>;</font>
      Thread _req_thread<font color=#990000>;</font>
      <b><font color=#0000FF>struct</font></b> timeval _default_op_timeout<font color=#990000>;</font>
      <b><font color=#0000FF>static</font></b> AtomicInt _xid<font color=#990000>;</font>
      <b><font color=#0000FF>friend</font></b> <b><font color=#0000FF>class</font></b> cimom<font color=#990000>;</font>
<font color=#FF0000>}</font><font color=#990000>;</font>

PEGASUS_NAMESPACE_END

<b><font color=#000080>#endif</font></b> <i><font color=#9A1900>/* Pegasus_MessageQueue_Service_h */</font></i>
</tt>
</pre>

<h3>Asynchronous Messages</h3>

<pre><tt>
<i><font color=#9A1900>//%LICENSE////////////////////////////////////////////////////////////////</font></i>
<i><font color=#9A1900>//</font></i>
<i><font color=#9A1900>// Licensed to The Open Group (TOG) under one or more contributor license</font></i>
<i><font color=#9A1900>// agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with</font></i>
<i><font color=#9A1900>// this work for additional information regarding copyright ownership.</font></i>
<i><font color=#9A1900>// Each contributor licenses this file to you under the OpenPegasus Open</font></i>
<i><font color=#9A1900>// Source License; you may not use this file except in compliance with the</font></i>
<i><font color=#9A1900>// License.</font></i>
<i><font color=#9A1900>//</font></i>
<i><font color=#9A1900>// Permission is hereby granted, free of charge, to any person obtaining a</font></i>
<i><font color=#9A1900>// copy of this software and associated documentation files (the "Software"),</font></i>
<i><font color=#9A1900>// to deal in the Software without restriction, including without limitation</font></i>
<i><font color=#9A1900>// the rights to use, copy, modify, merge, publish, distribute, sublicense,</font></i>
<i><font color=#9A1900>// and/or sell copies of the Software, and to permit persons to whom the</font></i>
<i><font color=#9A1900>// Software is furnished to do so, subject to the following conditions:</font></i>
<i><font color=#9A1900>//</font></i>
<i><font color=#9A1900>// The above copyright notice and this permission notice shall be included</font></i>
<i><font color=#9A1900>// in all copies or substantial portions of the Software.</font></i>
<i><font color=#9A1900>//</font></i>
<i><font color=#9A1900>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS</font></i>
<i><font color=#9A1900>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</font></i>
<i><font color=#9A1900>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.</font></i>
<i><font color=#9A1900>// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY</font></i>
<i><font color=#9A1900>// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,</font></i>
<i><font color=#9A1900>// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE</font></i>
<i><font color=#9A1900>// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</font></i>
<i><font color=#9A1900>//</font></i>
<i><font color=#9A1900>//////////////////////////////////////////////////////////////////////////</font></i>
<i><font color=#9A1900>//</font></i>
<i><font color=#9A1900>// Author: Mike Day (mdday@us.ibm.com</font></i>
<i><font color=#9A1900>//</font></i>
<i><font color=#9A1900>// Modified By: </font></i>
<i><font color=#9A1900>//</font></i>
<i><font color=#9A1900>//////////////////////////////////////////////////////////////////////////</font></i>

<b><font color=#000080>#ifndef</font></b> Pegasus_CimomMessage_h
<b><font color=#000080>#define</font></b> Pegasus_CimomMessage_h

<b><font color=#000080>#include</font></b> <font color=#FF0000>&lt;Pegasus/Common/Config.h&gt;</font>
<b><font color=#000080>#include</font></b> <font color=#FF0000>&lt;Pegasus/Common/Exception.h&gt;</font>
<b><font color=#000080>#include</font></b> <font color=#FF0000>&lt;Pegasus/Common/MessageQueue.h&gt;</font>
<b><font color=#000080>#include</font></b> <font color=#FF0000>&lt;Pegasus/Common/AsyncOpNode.h&gt;</font>

PEGASUS_NAMESPACE_BEGIN
<i><font color=#9A1900>//</font></i>
<i><font color=#9A1900>// This identifier is the queue id for CIMOM queue. It is initialized in</font></i>
<i><font color=#9A1900>// CimomMessage.cpp by calling MessageQueue::getNextQueueId(). Note that</font></i>
<i><font color=#9A1900>// this value is passed in the constructor for the CIMOM queue.</font></i>
<i><font color=#9A1900>//</font></i>
<b><font color=#0000FF>extern</font></b> <b><font color=#0000FF>const</font></b> Uint32 CIMOM_Q_ID<font color=#990000>;</font>

<b><font color=#0000FF>class</font></b> AsyncOpNode<font color=#990000>;</font>

<b><font color=#0000FF>class</font></b> PEGASUS_COMMON_LINKAGE async_results
<font color=#FF0000>{</font>
   <b><font color=#0000FF>public</font></b><font color=#990000>:</font>
      <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>const</font></b> Uint32 OK<font color=#990000>;</font>
      <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>const</font></b> Uint32 PARAMETER_ERROR<font color=#990000>;</font>
      <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>const</font></b> Uint32 MODULE_ALREADY_REGISTERED<font color=#990000>;</font>
      <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>const</font></b> Uint32 MODULE_NOT_FOUND<font color=#990000>;</font>
      <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>const</font></b> Uint32 INTERNAL_ERROR<font color=#990000>;</font>

      <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>const</font></b> Uint32 ASYNC_STARTED<font color=#990000>;</font>
      <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>const</font></b> Uint32 ASYNC_PROCESSING<font color=#990000>;</font>
      <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>const</font></b> Uint32 ASYNC_COMPLETE<font color=#990000>;</font>
      <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>const</font></b> Uint32 ASYNC_CANCELLED<font color=#990000>;</font>
      <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>const</font></b> Uint32 ASYNC_PAUSED<font color=#990000>;</font>
      <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>const</font></b> Uint32 ASYNC_RESUMED<font color=#990000>;</font>

      <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>const</font></b> Uint32 CIM_SERVICE_STARTED<font color=#990000>;</font>
      <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>const</font></b> Uint32 CIM_SERVICE_STOPPED<font color=#990000>;</font>
      <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>const</font></b> Uint32 CIM_SERVICE_PAUSED<font color=#990000>;</font>

      <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>const</font></b> Uint32 CIM_SERVICE_RESUMED<font color=#990000>;</font>
      <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>const</font></b> Uint32 CIM_NAK<font color=#990000>;</font>

      <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>const</font></b> Uint32 ASYNC_PHASE_COMPLETE<font color=#990000>;</font>
      <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>const</font></b> Uint32 ASYNC_CHILD_COMPLETE<font color=#990000>;</font>
      <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>const</font></b> Uint32 ASYNC_PHASE_STARTED<font color=#990000>;</font>
      <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>const</font></b> Uint32 ASYNC_CHILD_STARTED<font color=#990000>;</font>
      <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>const</font></b> Uint32 CIM_PAUSED<font color=#990000>;</font>
      <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>const</font></b> Uint32 CIM_STOPPED<font color=#990000>;</font>

<font color=#FF0000>}</font><font color=#990000>;</font>


<b><font color=#0000FF>class</font></b> PEGASUS_COMMON_LINKAGE async_messages
<font color=#FF0000>{</font>
   <b><font color=#0000FF>public</font></b><font color=#990000>:</font>
      <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>const</font></b> Uint32 HEARTBEAT<font color=#990000>;</font>
      <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>const</font></b> Uint32 REPLY<font color=#990000>;</font>
      <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>const</font></b> Uint32 REGISTER_CIM_SERVICE<font color=#990000>;</font>
      <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>const</font></b> Uint32 DEREGISTER_CIM_SERVICE<font color=#990000>;</font>
      <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>const</font></b> Uint32 UPDATE_CIM_SERVICE<font color=#990000>;</font>
      <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>const</font></b> Uint32 IOCTL<font color=#990000>;</font>
      <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>const</font></b> Uint32 CIMSERVICE_START<font color=#990000>;</font>
      <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>const</font></b> Uint32 CIMSERVICE_STOP<font color=#990000>;</font>
      <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>const</font></b> Uint32 CIMSERVICE_PAUSE<font color=#990000>;</font>
      <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>const</font></b> Uint32 CIMSERVICE_RESUME<font color=#990000>;</font>

      <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>const</font></b> Uint32 ASYNC_OP_START<font color=#990000>;</font>
      <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>const</font></b> Uint32 ASYNC_OP_RESULT<font color=#990000>;</font>
      <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>const</font></b> Uint32 ASYNC_LEGACY_OP_START<font color=#990000>;</font>
      <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>const</font></b> Uint32 ASYNC_LEGACY_OP_RESULT<font color=#990000>;</font>

      <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>const</font></b> Uint32 FIND_SERVICE_Q<font color=#990000>;</font>
      <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>const</font></b> Uint32 FIND_SERVICE_Q_RESULT<font color=#990000>;</font>
      <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>const</font></b> Uint32 ENUMERATE_SERVICE<font color=#990000>;</font>
      <b><font color=#0000FF>static</font></b> <b><font color=#0000FF>const</font></b> Uint32 ENUMERATE_SERVICE_RESULT<font color=#990000>;</font>
<font color=#FF0000>}</font><font color=#990000>;</font>


<b><font color=#0000FF>class</font></b> PEGASUS_COMMON_LINKAGE AsyncMessage <font color=#990000>:</font> <b><font color=#0000FF>public</font></b> Message
<font color=#FF0000>{</font>
   <b><font color=#0000FF>public</font></b><font color=#990000>:</font>
      <b><font color=#000000>AsyncMessage</font></b><font color=#990000>(</font>Uint32 type<font color=#990000>,</font>
		   Uint32 destination<font color=#990000>,</font>
		   Uint32 key<font color=#990000>,</font>
		   Uint32 routing<font color=#990000>,</font>
		   Uint32 mask<font color=#990000>,</font>
		   AsyncOpNode <font color=#990000>*</font>operation<font color=#990000>)</font><font color=#990000>;</font>

      <b><font color=#0000FF>virtual</font></b> <font color=#990000>~</font><b><font color=#000000>AsyncMessage</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font>
      <font color=#FF0000>{</font>
	
      <font color=#FF0000>}</font>

      Boolean <b><font color=#0000FF>operator</font></b> <font color=#990000>=</font><font color=#990000>=</font><font color=#990000>(</font><b><font color=#0000FF>const</font></b> <font color=#009900>void</font> <font color=#990000>*</font>key<font color=#990000>)</font><font color=#990000>;</font>
      Boolean <b><font color=#0000FF>operator</font></b> <font color=#990000>=</font><font color=#990000>=</font><font color=#990000>(</font><b><font color=#0000FF>const</font></b> AsyncMessage<font color=#990000>&amp;</font> msg<font color=#990000>)</font><font color=#990000>;</font>

      AsyncOpNode <font color=#990000>*</font>op<font color=#990000>;</font>
<font color=#FF0000>}</font><font color=#990000>;</font>


<b><font color=#0000FF>inline</font></b> Boolean AsyncMessage<font color=#990000>:</font><font color=#990000>:</font><b><font color=#0000FF>operator</font></b> <font color=#990000>=</font><font color=#990000>=</font><font color=#990000>(</font><b><font color=#0000FF>const</font></b> <font color=#009900>void</font> <font color=#990000>*</font>key<font color=#990000>)</font>
<font color=#FF0000>{</font>
   <b><font color=#0000FF>if</font></b><font color=#990000>(</font> key <font color=#990000>=</font><font color=#990000>=</font> <b><font color=#0000FF>reinterpret_cast</font></b><font color=#990000>&lt;</font><font color=#009900>void</font> <font color=#990000>*</font><font color=#990000>&gt;</font><font color=#990000>(</font><b><font color=#0000FF>this</font></b><font color=#990000>)</font><font color=#990000>)</font>
      <b><font color=#0000FF>return</font></b> <b><font color=#0000FF>true</font></b><font color=#990000>;</font>
   <b><font color=#0000FF>return</font></b> <b><font color=#0000FF>false</font></b><font color=#990000>;</font>
<font color=#FF0000>}</font>

<b><font color=#0000FF>inline</font></b> Boolean AsyncMessage<font color=#990000>:</font><font color=#990000>:</font><b><font color=#0000FF>operator</font></b> <font color=#990000>=</font><font color=#990000>=</font><font color=#990000>(</font><b><font color=#0000FF>const</font></b> AsyncMessage<font color=#990000>&amp;</font> msg<font color=#990000>)</font>
<font color=#FF0000>{</font>
   <b><font color=#0000FF>return</font></b> <b><font color=#0000FF>this</font></b><font color=#990000>-</font><font color=#990000>&gt;</font><b><font color=#0000FF>operator</font></b><font color=#990000>=</font><font color=#990000>=</font><font color=#990000>(</font><b><font color=#0000FF>reinterpret_cast</font></b><font color=#990000>&lt;</font><font color=#009900>void</font> <font color=#990000>*</font><font color=#990000>&gt;</font><font color=#990000>(</font><b><font color=#0000FF>const_cast</font></b><font color=#990000>&lt;</font>AsyncMessage <font color=#990000>*</font><font color=#990000>&gt;</font><font color=#990000>(</font><font color=#990000>&amp;</font>msg<font color=#990000>)</font><font color=#990000>)</font><font color=#990000>)</font><font color=#990000>;</font>
<font color=#FF0000>}</font>


<b><font color=#0000FF>class</font></b> PEGASUS_COMMON_LINKAGE AsyncRequest <font color=#990000>:</font> <b><font color=#0000FF>public</font></b> AsyncMessage
<font color=#FF0000>{</font>
   <b><font color=#0000FF>public</font></b><font color=#990000>:</font>
      <b><font color=#000000>AsyncRequest</font></b><font color=#990000>(</font>Uint32 type<font color=#990000>,</font>
		   Uint32 key<font color=#990000>,</font>
		   Uint32 routing<font color=#990000>,</font>
		   Uint32 mask<font color=#990000>,</font>
		   AsyncOpNode <font color=#990000>*</font>operation<font color=#990000>,</font>
		   Uint32 destination<font color=#990000>,</font>
		   Uint32 response<font color=#990000>,</font>
		   Boolean blocking<font color=#990000>)</font><font color=#990000>;</font>


      <b><font color=#0000FF>virtual</font></b> <font color=#990000>~</font><b><font color=#000000>AsyncRequest</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font>
      <font color=#FF0000>{</font>

      <font color=#FF0000>}</font>

      Uint32 resp<font color=#990000>;</font>
      Boolean block<font color=#990000>;</font>
<font color=#FF0000>}</font><font color=#990000>;</font>

<b><font color=#0000FF>class</font></b> PEGASUS_COMMON_LINKAGE AsyncReply <font color=#990000>:</font> <b><font color=#0000FF>public</font></b> AsyncMessage
<font color=#FF0000>{</font>
   <b><font color=#0000FF>public</font></b><font color=#990000>:</font>
      <b><font color=#000000>AsyncReply</font></b><font color=#990000>(</font>Uint32 type<font color=#990000>,</font>
		 Uint32 key<font color=#990000>,</font>
		 Uint32 routing<font color=#990000>,</font>
		 Uint32 mask<font color=#990000>,</font>
		 AsyncOpNode <font color=#990000>*</font>operation<font color=#990000>,</font>
		 Uint32 result_code<font color=#990000>,</font>
		 Uint32 destination<font color=#990000>,</font>
		 Boolean blocking<font color=#990000>)</font><font color=#990000>;</font>


      <b><font color=#0000FF>virtual</font></b> <font color=#990000>~</font><b><font color=#000000>AsyncReply</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font>
      <font color=#FF0000>{</font>
	
      <font color=#FF0000>}</font>

      Uint32 result<font color=#990000>;</font>
      Boolean block<font color=#990000>;</font>
<font color=#FF0000>}</font><font color=#990000>;</font>



<b><font color=#0000FF>class</font></b> PEGASUS_COMMON_LINKAGE RegisterCimService <font color=#990000>:</font> <b><font color=#0000FF>public</font></b> AsyncRequest
<font color=#FF0000>{</font>
   <b><font color=#0000FF>public</font></b><font color=#990000>:</font>
      <b><font color=#000000>RegisterCimService</font></b><font color=#990000>(</font>Uint32 routing<font color=#990000>,</font>
			 AsyncOpNode <font color=#990000>*</font>operation<font color=#990000>,</font>
			 Boolean blocking<font color=#990000>,</font>
			 String service_name<font color=#990000>,</font>
			 Uint32 service_capabilities<font color=#990000>,</font>
			 Uint32 service_mask<font color=#990000>,</font>
			 Uint32 service_queue<font color=#990000>)</font><font color=#990000>;</font>

      <b><font color=#0000FF>virtual</font></b> <font color=#990000>~</font><b><font color=#000000>RegisterCimService</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font>
      <font color=#FF0000>{</font>

      <font color=#FF0000>}</font>

      String name<font color=#990000>;</font>
      Uint32 capabilities<font color=#990000>;</font>
      Uint32 mask<font color=#990000>;</font>
      Uint32 queue<font color=#990000>;</font>
<font color=#FF0000>}</font><font color=#990000>;</font>

<b><font color=#0000FF>class</font></b> PEGASUS_COMMON_LINKAGE DeRegisterCimService <font color=#990000>:</font> <b><font color=#0000FF>public</font></b> AsyncRequest
<font color=#FF0000>{</font>
   <b><font color=#0000FF>public</font></b><font color=#990000>:</font>
      <b><font color=#000000>DeRegisterCimService</font></b><font color=#990000>(</font>Uint32 routing<font color=#990000>,</font>
			   AsyncOpNode <font color=#990000>*</font>operation<font color=#990000>,</font>
			   Boolean blocking<font color=#990000>,</font>
			   Uint32 service_queue<font color=#990000>)</font><font color=#990000>;</font>


      <b><font color=#0000FF>virtual</font></b> <font color=#990000>~</font><b><font color=#000000>DeRegisterCimService</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font>
      <font color=#FF0000>{</font>

      <font color=#FF0000>}</font>

      Uint32 queue<font color=#990000>;</font>
<font color=#FF0000>}</font> <font color=#990000>;</font>

<b><font color=#0000FF>class</font></b> PEGASUS_COMMON_LINKAGE UpdateCimService <font color=#990000>:</font> <b><font color=#0000FF>public</font></b> AsyncRequest
<font color=#FF0000>{</font>
   <b><font color=#0000FF>public</font></b><font color=#990000>:</font>
      <b><font color=#000000>UpdateCimService</font></b><font color=#990000>(</font>Uint32 routing<font color=#990000>,</font>
		       AsyncOpNode <font color=#990000>*</font>operation<font color=#990000>,</font>
		       Boolean blocking<font color=#990000>,</font>
		       Uint32 service_queue<font color=#990000>,</font>
		       Uint32 service_capabilities<font color=#990000>,</font>
		       Uint32 service_mask<font color=#990000>)</font><font color=#990000>;</font>

      <b><font color=#0000FF>virtual</font></b> <font color=#990000>~</font><b><font color=#000000>UpdateCimService</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font>
      <font color=#FF0000>{</font>

      <font color=#FF0000>}</font>

      Uint32 queue<font color=#990000>;</font>
      Uint32 capabilities<font color=#990000>;</font>
      Uint32 mask<font color=#990000>;</font>
<font color=#FF0000>}</font><font color=#990000>;</font>


<b><font color=#0000FF>class</font></b> PEGASUS_COMMON_LINKAGE AsyncIoctl <font color=#990000>:</font> <b><font color=#0000FF>public</font></b> AsyncRequest
<font color=#FF0000>{</font>
   <b><font color=#0000FF>public</font></b><font color=#990000>:</font>
      <b><font color=#000000>AsyncIoctl</font></b><font color=#990000>(</font>Uint32 routing<font color=#990000>,</font>
		 AsyncOpNode <font color=#990000>*</font>operation<font color=#990000>,</font>
		 Uint32 destination<font color=#990000>,</font>
		 Uint32 response<font color=#990000>,</font>
		 Boolean blocking<font color=#990000>,</font>
		 Uint32 code<font color=#990000>,</font>
		 Uint32 int_param<font color=#990000>,</font>
		 <font color=#009900>void</font> <font color=#990000>*</font>p_param<font color=#990000>)</font><font color=#990000>;</font>

      <b><font color=#0000FF>virtual</font></b> <font color=#990000>~</font><b><font color=#000000>AsyncIoctl</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font>
      <font color=#FF0000>{</font>

      <font color=#FF0000>}</font>

      <b><font color=#0000FF>enum</font></b>
      <font color=#FF0000>{</font>
	 IO_CLOSE<font color=#990000>,</font>
	 IO_OPEN<font color=#990000>,</font>
	 IO_SOURCE_QUENCH<font color=#990000>,</font>
	 IO_SERVICE_DEFINED
      <font color=#FF0000>}</font><font color=#990000>;</font>



      Uint32 ctl<font color=#990000>;</font>
      Uint32 intp<font color=#990000>;</font>
      <font color=#009900>void</font> <font color=#990000>*</font>voidp<font color=#990000>;</font>

<font color=#FF0000>}</font><font color=#990000>;</font>

<b><font color=#0000FF>class</font></b> PEGASUS_COMMON_LINKAGE CimServiceStart <font color=#990000>:</font> <b><font color=#0000FF>public</font></b> AsyncRequest
<font color=#FF0000>{</font>
   <b><font color=#0000FF>public</font></b><font color=#990000>:</font>
      <b><font color=#000000>CimServiceStart</font></b><font color=#990000>(</font>Uint32 routing<font color=#990000>,</font>
		      AsyncOpNode <font color=#990000>*</font>operation<font color=#990000>,</font>
		      Uint32 destination<font color=#990000>,</font>
		      Uint32 response<font color=#990000>,</font>
		      Boolean blocking<font color=#990000>)</font><font color=#990000>;</font>

      <b><font color=#0000FF>virtual</font></b> <font color=#990000>~</font><b><font color=#000000>CimServiceStart</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font>
      <font color=#FF0000>{</font>
	
      <font color=#FF0000>}</font>
<font color=#FF0000>}</font><font color=#990000>;</font>


<b><font color=#0000FF>class</font></b> PEGASUS_COMMON_LINKAGE CimServiceStop <font color=#990000>:</font> <b><font color=#0000FF>public</font></b> AsyncRequest
<font color=#FF0000>{</font>
   <b><font color=#0000FF>public</font></b><font color=#990000>:</font>
      <b><font color=#000000>CimServiceStop</font></b><font color=#990000>(</font>Uint32 routing<font color=#990000>,</font>
		     AsyncOpNode <font color=#990000>*</font>operation<font color=#990000>,</font>
		     Uint32 destination<font color=#990000>,</font>
		     Uint32 response<font color=#990000>,</font>
		     Boolean blocking<font color=#990000>)</font><font color=#990000>;</font>

      <b><font color=#0000FF>virtual</font></b> <font color=#990000>~</font><b><font color=#000000>CimServiceStop</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font>
      <font color=#FF0000>{</font>

      <font color=#FF0000>}</font>
<font color=#FF0000>}</font><font color=#990000>;</font>

<b><font color=#0000FF>class</font></b> PEGASUS_COMMON_LINKAGE CimServicePause <font color=#990000>:</font> <b><font color=#0000FF>public</font></b> AsyncRequest
<font color=#FF0000>{</font>
   <b><font color=#0000FF>public</font></b><font color=#990000>:</font>
      <b><font color=#000000>CimServicePause</font></b><font color=#990000>(</font>Uint32 routing<font color=#990000>,</font>
		      AsyncOpNode <font color=#990000>*</font>operation<font color=#990000>,</font>
		      Uint32 destination<font color=#990000>,</font>
		      Uint32 response<font color=#990000>,</font>
		      Boolean blocking<font color=#990000>)</font><font color=#990000>;</font>


      <b><font color=#0000FF>virtual</font></b> <font color=#990000>~</font><b><font color=#000000>CimServicePause</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font>
      <font color=#FF0000>{</font>

      <font color=#FF0000>}</font>
<font color=#FF0000>}</font><font color=#990000>;</font>

<b><font color=#0000FF>class</font></b> PEGASUS_COMMON_LINKAGE CimServiceResume <font color=#990000>:</font> <b><font color=#0000FF>public</font></b> AsyncRequest
<font color=#FF0000>{</font>
   <b><font color=#0000FF>public</font></b><font color=#990000>:</font>
      <b><font color=#000000>CimServiceResume</font></b><font color=#990000>(</font>Uint32 routing<font color=#990000>,</font>
		       AsyncOpNode <font color=#990000>*</font>operation<font color=#990000>,</font>
		       Uint32 destination<font color=#990000>,</font>
		       Uint32 response<font color=#990000>,</font>
		       Boolean blocking<font color=#990000>)</font><font color=#990000>;</font>


      <b><font color=#0000FF>virtual</font></b> <font color=#990000>~</font><b><font color=#000000>CimServiceResume</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font>
      <font color=#FF0000>{</font>

      <font color=#FF0000>}</font>
<font color=#FF0000>}</font><font color=#990000>;</font>

<b><font color=#0000FF>class</font></b> PEGASUS_COMMON_LINKAGE AsyncOperationStart <font color=#990000>:</font> <b><font color=#0000FF>public</font></b> AsyncRequest
<font color=#FF0000>{</font>
   <b><font color=#0000FF>public</font></b><font color=#990000>:</font>
      <b><font color=#000000>AsyncOperationStart</font></b><font color=#990000>(</font>Uint32 routing<font color=#990000>,</font>
			  AsyncOpNode <font color=#990000>*</font>operation<font color=#990000>,</font>
			  Uint32 destination<font color=#990000>,</font>
			  Uint32 response<font color=#990000>,</font>
			  Boolean blocking<font color=#990000>,</font>
			  Message <font color=#990000>*</font>action<font color=#990000>)</font><font color=#990000>;</font>


      <b><font color=#0000FF>virtual</font></b> <font color=#990000>~</font><b><font color=#000000>AsyncOperationStart</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font>
      <font color=#FF0000>{</font>
	 <b><font color=#0000FF>delete</font></b> _act<font color=#990000>;</font>
      <font color=#FF0000>}</font>


      Message <font color=#990000>*</font><b><font color=#000000>get_action</font></b><font color=#990000>(</font><font color=#009900>void</font> <font color=#990000>)</font> <font color=#990000>;</font>


   <b><font color=#0000FF>private</font></b><font color=#990000>:</font>
      <b><font color=#0000FF>friend</font></b> <b><font color=#0000FF>class</font></b> MessageQueueService<font color=#990000>;</font>
      <b><font color=#0000FF>friend</font></b> <b><font color=#0000FF>class</font></b> cimom<font color=#990000>;</font>
      Message <font color=#990000>*</font>_act<font color=#990000>;</font>
<font color=#FF0000>}</font><font color=#990000>;</font>

<b><font color=#0000FF>class</font></b> PEGASUS_COMMON_LINKAGE AsyncOperationResult <font color=#990000>:</font> <b><font color=#0000FF>public</font></b> AsyncReply
<font color=#FF0000>{</font>
   <b><font color=#0000FF>public</font></b><font color=#990000>:</font>
      <b><font color=#000000>AsyncOperationResult</font></b><font color=#990000>(</font>Uint32 key<font color=#990000>,</font>
			   Uint32 routing<font color=#990000>,</font>
			   AsyncOpNode <font color=#990000>*</font>operation<font color=#990000>,</font>
			   Uint32 result_code<font color=#990000>,</font>
			   Uint32 destination<font color=#990000>,</font>
			   Uint32 blocking<font color=#990000>)</font><font color=#990000>;</font>


      <b><font color=#0000FF>virtual</font></b> <font color=#990000>~</font><b><font color=#000000>AsyncOperationResult</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font>
      <font color=#FF0000>{</font>

      <font color=#FF0000>}</font>
<font color=#FF0000>}</font><font color=#990000>;</font>


<b><font color=#0000FF>class</font></b> PEGASUS_COMMON_LINKAGE AsyncLegacyOperationStart <font color=#990000>:</font> <b><font color=#0000FF>public</font></b> AsyncRequest
<font color=#FF0000>{</font>
   <b><font color=#0000FF>public</font></b><font color=#990000>:</font>
      <b><font color=#000000>AsyncLegacyOperationStart</font></b><font color=#990000>(</font>Uint32 routing<font color=#990000>,</font>
				AsyncOpNode <font color=#990000>*</font>operation<font color=#990000>,</font>
				Uint32 destination<font color=#990000>,</font>
				Message <font color=#990000>*</font>action<font color=#990000>,</font>
				Uint32 action_destination<font color=#990000>)</font><font color=#990000>;</font>


      <b><font color=#0000FF>virtual</font></b> <font color=#990000>~</font><b><font color=#000000>AsyncLegacyOperationStart</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font>
      <font color=#FF0000>{</font>
	 <b><font color=#0000FF>delete</font></b> _act<font color=#990000>;</font>
      <font color=#FF0000>}</font>

      Message <font color=#990000>*</font><b><font color=#000000>get_action</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font><font color=#990000>;</font>

   <b><font color=#0000FF>private</font></b><font color=#990000>:</font>
      <b><font color=#0000FF>friend</font></b> <b><font color=#0000FF>class</font></b> MessageQueueService<font color=#990000>;</font>
      <b><font color=#0000FF>friend</font></b> <b><font color=#0000FF>class</font></b> cimom<font color=#990000>;</font>
      Message <font color=#990000>*</font>_act<font color=#990000>;</font>
      Uint32 _legacy_destination<font color=#990000>;</font>

<font color=#FF0000>}</font><font color=#990000>;</font>

<b><font color=#0000FF>class</font></b> PEGASUS_COMMON_LINKAGE AsyncLegacyOperationResult <font color=#990000>:</font> <b><font color=#0000FF>public</font></b> AsyncReply
<font color=#FF0000>{</font>
   <b><font color=#0000FF>public</font></b><font color=#990000>:</font>
      <b><font color=#000000>AsyncLegacyOperationResult</font></b><font color=#990000>(</font>Uint32 key<font color=#990000>,</font>
				 Uint32 routing<font color=#990000>,</font>
				 AsyncOpNode <font color=#990000>*</font>operation<font color=#990000>,</font>
				 Message <font color=#990000>*</font>result<font color=#990000>)</font><font color=#990000>;</font>

      <b><font color=#0000FF>virtual</font></b> <font color=#990000>~</font><b><font color=#000000>AsyncLegacyOperationResult</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font>
      <font color=#FF0000>{</font>
	 <b><font color=#0000FF>delete</font></b> _res<font color=#990000>;</font>
      <font color=#FF0000>}</font>

      Message <font color=#990000>*</font><b><font color=#000000>get_result</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font><font color=#990000>;</font>


   <b><font color=#0000FF>private</font></b><font color=#990000>:</font>
      <b><font color=#0000FF>friend</font></b> <b><font color=#0000FF>class</font></b> MessageQueueService<font color=#990000>;</font>
      <b><font color=#0000FF>friend</font></b> <b><font color=#0000FF>class</font></b> cimom<font color=#990000>;</font>
      Message <font color=#990000>*</font>_res<font color=#990000>;</font>
<font color=#FF0000>}</font><font color=#990000>;</font>


<b><font color=#0000FF>class</font></b> PEGASUS_COMMON_LINKAGE FindServiceQueue <font color=#990000>:</font> <b><font color=#0000FF>public</font></b> AsyncRequest
<font color=#FF0000>{</font>
   <b><font color=#0000FF>public</font></b><font color=#990000>:</font>
      <b><font color=#000000>FindServiceQueue</font></b><font color=#990000>(</font>Uint32 routing<font color=#990000>,</font>
		       AsyncOpNode <font color=#990000>*</font>operation<font color=#990000>,</font>
		       Uint32 response<font color=#990000>,</font>
		       Boolean blocking<font color=#990000>,</font>
		       String service_name<font color=#990000>,</font>
		       Uint32 service_capabilities<font color=#990000>,</font>
		       Uint32 service_mask<font color=#990000>)</font><font color=#990000>;</font>

      <b><font color=#0000FF>virtual</font></b> <font color=#990000>~</font><b><font color=#000000>FindServiceQueue</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font>
      <font color=#FF0000>{</font>

      <font color=#FF0000>}</font>

      String name<font color=#990000>;</font>
      Uint32 capabilities<font color=#990000>;</font>
      Uint32 mask<font color=#990000>;</font>
<font color=#FF0000>}</font> <font color=#990000>;</font>

<b><font color=#0000FF>class</font></b> PEGASUS_COMMON_LINKAGE FindServiceQueueResult <font color=#990000>:</font> <b><font color=#0000FF>public</font></b> AsyncReply
<font color=#FF0000>{</font>
   <b><font color=#0000FF>public</font></b><font color=#990000>:</font>
      <b><font color=#000000>FindServiceQueueResult</font></b><font color=#990000>(</font>Uint32 key<font color=#990000>,</font>
			     Uint32 routing<font color=#990000>,</font>
			     AsyncOpNode <font color=#990000>*</font>operation<font color=#990000>,</font>
			     Uint32 result_code<font color=#990000>,</font>
			     Uint32 destination<font color=#990000>,</font>
			     Boolean blocking<font color=#990000>,</font>
			     Array<font color=#FF0000>&lt;Uint32&gt;</font> queue_ids<font color=#990000>)</font><font color=#990000>;</font>


      <b><font color=#0000FF>virtual</font></b> <font color=#990000>~</font><b><font color=#000000>FindServiceQueueResult</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font>
      <font color=#FF0000>{</font>

      <font color=#FF0000>}</font>

      Array<font color=#FF0000>&lt;Uint32&gt;</font> qids<font color=#990000>;</font>
<font color=#FF0000>}</font> <font color=#990000>;</font>

<b><font color=#0000FF>class</font></b> PEGASUS_COMMON_LINKAGE EnumerateService <font color=#990000>:</font> <b><font color=#0000FF>public</font></b> AsyncRequest
<font color=#FF0000>{</font>
   <b><font color=#0000FF>public</font></b><font color=#990000>:</font>
      <b><font color=#000000>EnumerateService</font></b><font color=#990000>(</font>Uint32 routing<font color=#990000>,</font>
		       AsyncOpNode <font color=#990000>*</font>operation<font color=#990000>,</font>
		       Uint32 response<font color=#990000>,</font>
		       Boolean blocking<font color=#990000>,</font>
		       Uint32 queue_id<font color=#990000>)</font><font color=#990000>;</font>


      <b><font color=#0000FF>virtual</font></b> <font color=#990000>~</font><b><font color=#000000>EnumerateService</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font>
      <font color=#FF0000>{</font>

      <font color=#FF0000>}</font>

      Uint32 qid<font color=#990000>;</font>
<font color=#FF0000>}</font><font color=#990000>;</font>

<b><font color=#0000FF>class</font></b> PEGASUS_COMMON_LINKAGE EnumerateServiceResponse <font color=#990000>:</font> <b><font color=#0000FF>public</font></b> AsyncReply
<font color=#FF0000>{</font>
   <b><font color=#0000FF>public</font></b><font color=#990000>:</font>
      <b><font color=#000000>EnumerateServiceResponse</font></b><font color=#990000>(</font>Uint32 key<font color=#990000>,</font>
			       Uint32 routing<font color=#990000>,</font>
			       AsyncOpNode <font color=#990000>*</font>operation<font color=#990000>,</font>
			       Uint32 result_code<font color=#990000>,</font>
			       Uint32 response<font color=#990000>,</font>
			       Boolean blocking<font color=#990000>,</font>
			       String service_name<font color=#990000>,</font>
			       Uint32 service_capabilities<font color=#990000>,</font>
			       Uint32 service_mask<font color=#990000>,</font>
			       Uint32 service_qid<font color=#990000>)</font><font color=#990000>;</font>


      <b><font color=#0000FF>virtual</font></b> <font color=#990000>~</font><b><font color=#000000>EnumerateServiceResponse</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font>
      <font color=#FF0000>{</font>

      <font color=#FF0000>}</font>

      String name<font color=#990000>;</font>
      Uint32 capabilities<font color=#990000>;</font>
      Uint32 mask<font color=#990000>;</font>
      Uint32 qid<font color=#990000>;</font>
<font color=#FF0000>}</font><font color=#990000>;</font>


PEGASUS_NAMESPACE_END

<b><font color=#000080>#endif</font></b> <i><font color=#9A1900>// CIMOM_MESSAGE_include</font></i>
</tt>
</pre>


<h3>AsyncOpNode</h3>

<pre><tt>
<i><font color=#9A1900>//%LICENSE////////////////////////////////////////////////////////////////</font></i>
<i><font color=#9A1900>//</font></i>
<i><font color=#9A1900>// Licensed to The Open Group (TOG) under one or more contributor license</font></i>
<i><font color=#9A1900>// agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with</font></i>
<i><font color=#9A1900>// this work for additional information regarding copyright ownership.</font></i>
<i><font color=#9A1900>// Each contributor licenses this file to you under the OpenPegasus Open</font></i>
<i><font color=#9A1900>// Source License; you may not use this file except in compliance with the</font></i>
<i><font color=#9A1900>// License.</font></i>
<i><font color=#9A1900>//</font></i>
<i><font color=#9A1900>// Permission is hereby granted, free of charge, to any person obtaining a</font></i>
<i><font color=#9A1900>// copy of this software and associated documentation files (the "Software"),</font></i>
<i><font color=#9A1900>// to deal in the Software without restriction, including without limitation</font></i>
<i><font color=#9A1900>// the rights to use, copy, modify, merge, publish, distribute, sublicense,</font></i>
<i><font color=#9A1900>// and/or sell copies of the Software, and to permit persons to whom the</font></i>
<i><font color=#9A1900>// Software is furnished to do so, subject to the following conditions:</font></i>
<i><font color=#9A1900>//</font></i>
<i><font color=#9A1900>// The above copyright notice and this permission notice shall be included</font></i>
<i><font color=#9A1900>// in all copies or substantial portions of the Software.</font></i>
<i><font color=#9A1900>//</font></i>
<i><font color=#9A1900>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS</font></i>
<i><font color=#9A1900>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF</font></i>
<i><font color=#9A1900>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.</font></i>
<i><font color=#9A1900>// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY</font></i>
<i><font color=#9A1900>// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,</font></i>
<i><font color=#9A1900>// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE</font></i>
<i><font color=#9A1900>// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.</font></i>
<i><font color=#9A1900>//</font></i>
<i><font color=#9A1900>//////////////////////////////////////////////////////////////////////////</font></i>
<i><font color=#9A1900>//</font></i>
<i><font color=#9A1900>// Author: Mike Day (mdday@us.ibm.com</font></i>
<i><font color=#9A1900>//</font></i>
<i><font color=#9A1900>// Modified By: </font></i>
<i><font color=#9A1900>//</font></i>
<i><font color=#9A1900>//////////////////////////////////////////////////////////////////////////</font></i>


<b><font color=#000080>#ifndef</font></b> Pegasus_AsyncOpNode_h
<b><font color=#000080>#define</font></b> Pegasus_AsyncOpNode_h

<b><font color=#000080>#include</font></b> <font color=#FF0000>&lt;Pegasus/Common/Config.h&gt;</font>
<b><font color=#000080>#include</font></b> <font color=#FF0000>&lt;Pegasus/Common/Message.h&gt;</font>
<b><font color=#000080>#include</font></b> <font color=#FF0000>&lt;Pegasus/Common/OperationContext.h&gt;</font>
<b><font color=#000080>#include</font></b> <font color=#FF0000>&lt;Pegasus/Common/internal_dq.h&gt;</font>
<b><font color=#000080>#include</font></b> <font color=#FF0000>&lt;Pegasus/Common/IPC.h&gt;</font>

PEGASUS_NAMESPACE_BEGIN

<i><font color=#9A1900>// ATTN usage of flags and state is inconsistent</font></i>
<i><font color=#9A1900>// &lt;&lt; Wed Jan 16 17:41:57 2002 mdd &gt;&gt;</font></i>
<i><font color=#9A1900>// resolved mdd </font></i>


<b><font color=#000080>#define</font></b> ASYNC_OPFLAGS_UNKNOWN           <font color=#993399>0x00000000</font>
<b><font color=#000080>#define</font></b> ASYNC_OPFLAGS_INTERVAL_REPEAT   <font color=#993399>0x00000010</font>
<b><font color=#000080>#define</font></b> ASYNC_OPFLAGS_INDICATION        <font color=#993399>0x00000020</font>
<b><font color=#000080>#define</font></b> ASYNC_OPFLAGS_REMOTE            <font color=#993399>0x00000040</font>
<b><font color=#000080>#define</font></b> ASYNC_OPFLAGS_LOCAL_OUT_OF_PROC <font color=#993399>0x00000080</font>
<b><font color=#000080>#define</font></b> ASYNC_OPFLAGS_PHASED            <font color=#993399>0x00000001</font>
<b><font color=#000080>#define</font></b> ASYNC_OPFLAGS_PARTIAL           <font color=#993399>0x00000002</font>
<b><font color=#000080>#define</font></b> ASYNC_OPFLAGS_NORMAL            <font color=#993399>0x00000000</font>
<b><font color=#000080>#define</font></b> ASYNC_OPFLAGS_SINGLE            <font color=#993399>0x00000008</font>
<b><font color=#000080>#define</font></b> ASYNC_OPFLAGS_MULTIPLE          <font color=#993399>0x00000010</font>
<b><font color=#000080>#define</font></b> ASYNC_OPFLAGS_TOTAL             <font color=#993399>0x00000020</font>
<b><font color=#000080>#define</font></b> ASYNC_OPFLAGS_META_DISPATCHER   <font color=#993399>0x00000040</font>
<b><font color=#000080>#define</font></b> ASYNC_OPFLAGS_FIRE_AND_FORGET   <font color=#993399>0x00000080</font>
<b><font color=#000080>#define</font></b> ASYNC_OPFLAGS_SIMPLE_STATUS     <font color=#993399>0x00000100</font>
<b><font color=#000080>#define</font></b> ASYNC_OPFLAGS_CALLBACK          <font color=#993399>0x00000200</font>
<b><font color=#000080>#define</font></b> ASYNC_OPFLAGS_FORWARD           <font color=#993399>0x00000400</font>

<b><font color=#000080>#define</font></b> ASYNC_OPSTATE_UNKNOWN           <font color=#993399>0x00000000</font>
<b><font color=#000080>#define</font></b> ASYNC_OPSTATE_OFFERED           <font color=#993399>0x00000001</font>
<b><font color=#000080>#define</font></b> ASYNC_OPSTATE_DECLINED          <font color=#993399>0x00000002</font>
<b><font color=#000080>#define</font></b> ASYNC_OPSTATE_STARTED           <font color=#993399>0x00000004</font>
<b><font color=#000080>#define</font></b> ASYNC_OPSTATE_PROCESSING        <font color=#993399>0x00000008</font>
<b><font color=#000080>#define</font></b> ASYNC_OPSTATE_DELIVER           <font color=#993399>0x00000010</font>
<b><font color=#000080>#define</font></b> ASYNC_OPSTATE_RESERVE           <font color=#993399>0x00000020</font>
<b><font color=#000080>#define</font></b> ASYNC_OPSTATE_COMPLETE          <font color=#993399>0x00000040</font>
<b><font color=#000080>#define</font></b> ASYNC_OPSTATE_TIMEOUT           <font color=#993399>0x00000080</font>
<b><font color=#000080>#define</font></b> ASYNC_OPSTATE_CANCELLED         <font color=#993399>0x00000100</font>
<b><font color=#000080>#define</font></b> ASYNC_OPSTATE_PAUSED            <font color=#993399>0x00000200</font>
<b><font color=#000080>#define</font></b> ASYNC_OPSTATE_SUSPENDED         <font color=#993399>0x00000400</font>
<b><font color=#000080>#define</font></b> ASYNC_OPSTATE_RESUMED           <font color=#993399>0x00000800</font>
<b><font color=#000080>#define</font></b> ASYNC_OPSTATE_ORPHANED          <font color=#993399>0x00001000</font>
<b><font color=#000080>#define</font></b> ASYNC_OPSTATE_RELEASED          <font color=#993399>0x00002000</font>

<b><font color=#0000FF>class</font></b> Cimom<font color=#990000>;</font>
<b><font color=#0000FF>class</font></b> Thread<font color=#990000>;</font>

<b><font color=#0000FF>class</font></b> PEGASUS_COMMON_LINKAGE AsyncOpNode
<font color=#FF0000>{</font>
   <b><font color=#0000FF>public</font></b><font color=#990000>:</font>

      <b><font color=#000000>AsyncOpNode</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font><font color=#990000>;</font>
      <font color=#990000>~</font><b><font color=#000000>AsyncOpNode</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font><font color=#990000>;</font>

      Boolean  <b><font color=#0000FF>operator</font></b> <font color=#990000>=</font><font color=#990000>=</font> <font color=#990000>(</font><b><font color=#0000FF>const</font></b> <font color=#009900>void</font> <font color=#990000>*</font>key<font color=#990000>)</font> <b><font color=#0000FF>const</font></b><font color=#990000>;</font>
      Boolean <b><font color=#0000FF>operator</font></b> <font color=#990000>=</font><font color=#990000>=</font> <font color=#990000>(</font><b><font color=#0000FF>const</font></b> AsyncOpNode <font color=#990000>&amp;</font> node<font color=#990000>)</font> <b><font color=#0000FF>const</font></b><font color=#990000>;</font>

      <font color=#009900>void</font> <b><font color=#000000>get_timeout_interval</font></b><font color=#990000>(</font><b><font color=#0000FF>struct</font></b> timeval <font color=#990000>*</font>buffer<font color=#990000>)</font> <font color=#990000>;</font>
      <font color=#009900>void</font> <b><font color=#000000>set_timeout_interval</font></b><font color=#990000>(</font><b><font color=#0000FF>const</font></b> <b><font color=#0000FF>struct</font></b> timeval <font color=#990000>*</font>interval<font color=#990000>)</font><font color=#990000>;</font>

      Boolean <b><font color=#000000>timeout</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font>  <font color=#990000>;</font>

      OperationContext <font color=#990000>&amp;</font> <b><font color=#000000>get_context</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font> <font color=#990000>;</font>

      <font color=#009900>void</font> <b><font color=#000000>put_request</font></b><font color=#990000>(</font><b><font color=#0000FF>const</font></b> Message <font color=#990000>*</font>request<font color=#990000>)</font> <font color=#990000>;</font>
      Message <font color=#990000>*</font><b><font color=#000000>get_request</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font> <font color=#990000>;</font>

      <font color=#009900>void</font> <b><font color=#000000>put_response</font></b><font color=#990000>(</font><b><font color=#0000FF>const</font></b> Message <font color=#990000>*</font>response<font color=#990000>)</font> <font color=#990000>;</font>
      Message <font color=#990000>*</font><b><font color=#000000>get_response</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font> <font color=#990000>;</font>

      Uint32 <b><font color=#000000>read_state</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font> <font color=#990000>;</font>
      <font color=#009900>void</font> <b><font color=#000000>write_state</font></b><font color=#990000>(</font>Uint32<font color=#990000>)</font> <font color=#990000>;</font>

      Uint32 <b><font color=#000000>read_flags</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font><font color=#990000>;</font>
      <font color=#009900>void</font> <b><font color=#000000>write_flags</font></b><font color=#990000>(</font>Uint32<font color=#990000>)</font><font color=#990000>;</font>

      <font color=#009900>void</font> <b><font color=#000000>lock</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font>  <b><font color=#0000FF>throw</font></b><font color=#990000>(</font>IPCException<font color=#990000>)</font><font color=#990000>;</font>
      <font color=#009900>void</font> <b><font color=#000000>unlock</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font> <b><font color=#0000FF>throw</font></b><font color=#990000>(</font>IPCException<font color=#990000>)</font><font color=#990000>;</font>
      <font color=#009900>void</font> <b><font color=#000000>udpate</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font> <b><font color=#0000FF>throw</font></b><font color=#990000>(</font>IPCException<font color=#990000>)</font><font color=#990000>;</font>
      <font color=#009900>void</font> <b><font color=#000000>deliver</font></b><font color=#990000>(</font><b><font color=#0000FF>const</font></b> Uint32 count<font color=#990000>)</font> <b><font color=#0000FF>throw</font></b><font color=#990000>(</font>IPCException<font color=#990000>)</font><font color=#990000>;</font>
      <font color=#009900>void</font> <b><font color=#000000>reserve</font></b><font color=#990000>(</font><b><font color=#0000FF>const</font></b> Uint32 size<font color=#990000>)</font> <b><font color=#0000FF>throw</font></b><font color=#990000>(</font>IPCException<font color=#990000>)</font><font color=#990000>;</font>
      <font color=#009900>void</font> <b><font color=#000000>processing</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font> <b><font color=#0000FF>throw</font></b><font color=#990000>(</font>IPCException<font color=#990000>)</font> <font color=#990000>;</font>
      <font color=#009900>void</font> <b><font color=#000000>processing</font></b><font color=#990000>(</font>OperationContext <font color=#990000>*</font>context<font color=#990000>)</font> <b><font color=#0000FF>throw</font></b><font color=#990000>(</font>IPCException<font color=#990000>)</font><font color=#990000>;</font>
      <font color=#009900>void</font> <b><font color=#000000>complete</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font> <b><font color=#0000FF>throw</font></b><font color=#990000>(</font>IPCException<font color=#990000>)</font> <font color=#990000>;</font>
      <font color=#009900>void</font> <b><font color=#000000>complete</font></b><font color=#990000>(</font>OperationContext <font color=#990000>*</font>context<font color=#990000>)</font> <b><font color=#0000FF>throw</font></b><font color=#990000>(</font>IPCException<font color=#990000>)</font><font color=#990000>;</font>
      <font color=#009900>void</font> <b><font color=#000000>release</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font><font color=#990000>;</font>
      <font color=#009900>void</font> <b><font color=#000000>wait</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font><font color=#990000>;</font>


   <b><font color=#0000FF>private</font></b><font color=#990000>:</font>
      Semaphore _client_sem<font color=#990000>;</font>
      Mutex _mut<font color=#990000>;</font>
      unlocked_dq<font color=#FF0000>&lt;Message&gt;</font> _request<font color=#990000>;</font>
      unlocked_dq<font color=#FF0000>&lt;Message&gt;</font> _response<font color=#990000>;</font>

      OperationContext _operation_list<font color=#990000>;</font>
      Uint32 _state<font color=#990000>;</font>
      Uint32 _flags<font color=#990000>;</font>
      Uint32 _offered_count<font color=#990000>;</font>
      Uint32 _total_ops<font color=#990000>;</font>
      Uint32 _completed_ops<font color=#990000>;</font>
      Uint32 _user_data<font color=#990000>;</font>
      Uint32 _completion_code<font color=#990000>;</font>
      MessageQueue <font color=#990000>*</font>_op_dest<font color=#990000>;</font>

      <b><font color=#0000FF>struct</font></b> timeval _start<font color=#990000>;</font>
      <b><font color=#0000FF>struct</font></b> timeval _lifetime<font color=#990000>;</font>
      <b><font color=#0000FF>struct</font></b> timeval _updated<font color=#990000>;</font>
      <b><font color=#0000FF>struct</font></b> timeval _timeout_interval<font color=#990000>;</font>

      AsyncOpNode <font color=#990000>*</font>_parent<font color=#990000>;</font>
      unlocked_dq<font color=#FF0000>&lt;AsyncOpNode&gt;</font> _children<font color=#990000>;</font>

      <font color=#009900>void</font> <b><font color=#000000>_reset</font></b><font color=#990000>(</font>unlocked_dq<font color=#FF0000>&lt;AsyncOpNode&gt;</font> <font color=#990000>*</font>dst_q<font color=#990000>)</font><font color=#990000>;</font>

      <i><font color=#9A1900>// the lifetime member is for cache management by the cimom</font></i>
      <font color=#009900>void</font> <b><font color=#000000>_set_lifetime</font></b><font color=#990000>(</font><b><font color=#0000FF>struct</font></b> timeval <font color=#990000>*</font>lifetime<font color=#990000>)</font> <font color=#990000>;</font>
      Boolean <b><font color=#000000>_check_lifetime</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font> <font color=#990000>;</font>

      Boolean <b><font color=#000000>_is_child</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font> <font color=#990000>;</font>
      Uint32 <b><font color=#000000>_is_parent</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font> <font color=#990000>;</font>
      Boolean <b><font color=#000000>_is_my_child</font></b><font color=#990000>(</font><b><font color=#0000FF>const</font></b> AsyncOpNode <font color=#990000>&amp;</font> caller<font color=#990000>)</font> <b><font color=#0000FF>const</font></b><font color=#990000>;</font>
      <font color=#009900>void</font> <b><font color=#000000>_make_orphan</font></b><font color=#990000>(</font> AsyncOpNode <font color=#990000>&amp;</font> parent<font color=#990000>)</font> <font color=#990000>;</font>
      <font color=#009900>void</font> <b><font color=#000000>_adopt_child</font></b><font color=#990000>(</font>AsyncOpNode <font color=#990000>*</font>child<font color=#990000>)</font> <font color=#990000>;</font>
      <font color=#009900>void</font> <b><font color=#000000>_disown_child</font></b><font color=#990000>(</font>AsyncOpNode <font color=#990000>*</font>child<font color=#990000>)</font> <font color=#990000>;</font>
      <font color=#009900>void</font> <font color=#990000>(</font><font color=#990000>*</font>_async_callback<font color=#990000>)</font><font color=#990000>(</font>AsyncOpNode <font color=#990000>*</font><font color=#990000>,</font>
			      MessageQueue <font color=#990000>*</font><font color=#990000>,</font>
			      <font color=#009900>void</font> <font color=#990000>*</font><font color=#990000>)</font><font color=#990000>;</font>
      <i><font color=#9A1900>// &lt;&lt; Tue Mar 12 14:44:51 2002 mdd &gt;&gt;</font></i>
      <i><font color=#9A1900>// pointers for async callbacks  - don't use </font></i>
      AsyncOpNode <font color=#990000>*</font>_callback_node<font color=#990000>;</font>
      MessageQueue <font color=#990000>*</font>_callback_response_q<font color=#990000>;</font>
      <font color=#009900>void</font> <font color=#990000>*</font>_callback_ptr<font color=#990000>;</font>
      MessageQueue <font color=#990000>*</font>_callback_request_q<font color=#990000>;</font>
      <i><font color=#9A1900>//      &lt;&lt; Tue Mar 12 14:44:53 2002 mdd &gt;&gt;</font></i>
      <i><font color=#9A1900>// pointers to help static class message handlers - don't use </font></i>
      MessageQueue <font color=#990000>*</font>_service_ptr<font color=#990000>;</font>
      Thread <font color=#990000>*</font>_thread_ptr<font color=#990000>;</font>

      <b><font color=#0000FF>friend</font></b> <b><font color=#0000FF>class</font></b> cimom<font color=#990000>;</font>
      <b><font color=#0000FF>friend</font></b> <b><font color=#0000FF>class</font></b> MessageQueueService<font color=#990000>;</font>

<font color=#FF0000>}</font><font color=#990000>;</font>


<b><font color=#0000FF>inline</font></b> Boolean AsyncOpNode<font color=#990000>:</font><font color=#990000>:</font><b><font color=#0000FF>operator</font></b> <font color=#990000>=</font><font color=#990000>=</font> <font color=#990000>(</font><b><font color=#0000FF>const</font></b> <font color=#009900>void</font> <font color=#990000>*</font>key<font color=#990000>)</font> <b><font color=#0000FF>const</font></b>
<font color=#FF0000>{</font>
   <b><font color=#0000FF>if</font></b> <font color=#990000>(</font>key <font color=#990000>=</font><font color=#990000>=</font> <font color=#990000>(</font><font color=#009900>void</font> <font color=#990000>*</font><font color=#990000>)</font><b><font color=#0000FF>this</font></b><font color=#990000>)</font>
      <b><font color=#0000FF>return</font></b> <b><font color=#0000FF>true</font></b><font color=#990000>;</font>
   <b><font color=#0000FF>return</font></b> <b><font color=#0000FF>false</font></b><font color=#990000>;</font>
<font color=#FF0000>}</font>

<b><font color=#0000FF>inline</font></b> Boolean AsyncOpNode<font color=#990000>:</font><font color=#990000>:</font><b><font color=#0000FF>operator</font></b> <font color=#990000>=</font><font color=#990000>=</font> <font color=#990000>(</font><b><font color=#0000FF>const</font></b> AsyncOpNode <font color=#990000>&amp;</font> node<font color=#990000>)</font> <b><font color=#0000FF>const</font></b>
<font color=#FF0000>{</font>
   <b><font color=#0000FF>return</font></b> AsyncOpNode<font color=#990000>:</font><font color=#990000>:</font><b><font color=#0000FF>operator</font></b><font color=#990000>=</font><font color=#990000>=</font><font color=#990000>(</font><font color=#990000>(</font><b><font color=#0000FF>const</font></b> <font color=#009900>void</font> <font color=#990000>*</font><font color=#990000>)</font><font color=#990000>&amp;</font>node<font color=#990000>)</font><font color=#990000>;</font>
<font color=#FF0000>}</font>


<b><font color=#0000FF>inline</font></b> <font color=#009900>void</font> AsyncOpNode<font color=#990000>:</font><font color=#990000>:</font><b><font color=#000000>get_timeout_interval</font></b><font color=#990000>(</font><b><font color=#0000FF>struct</font></b> timeval <font color=#990000>*</font>buffer<font color=#990000>)</font>
<font color=#FF0000>{</font>
   <b><font color=#0000FF>if</font></b><font color=#990000>(</font>buffer <font color=#990000>!</font><font color=#990000>=</font> <font color=#993399>0</font><font color=#990000>)</font>
   <font color=#FF0000>{</font>
      _mut<font color=#990000>.</font><b><font color=#000000>lock</font></b><font color=#990000>(</font> <b><font color=#000000>pegasus_thread_self</font></b><font color=#990000>(</font><font color=#990000>)</font> <font color=#990000>)</font><font color=#990000>;</font>
      buffer<font color=#990000>-</font><font color=#990000>&gt;</font>tv_sec <font color=#990000>=</font> _timeout_interval<font color=#990000>.</font>tv_sec<font color=#990000>;</font>
      buffer<font color=#990000>-</font><font color=#990000>&gt;</font>tv_usec <font color=#990000>=</font> _timeout_interval<font color=#990000>.</font>tv_usec<font color=#990000>;</font>
      _mut<font color=#990000>.</font><b><font color=#000000>unlock</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>;</font>
   <font color=#FF0000>}</font>
   <b><font color=#0000FF>return</font></b><font color=#990000>;</font>
<font color=#FF0000>}</font>

<b><font color=#0000FF>inline</font></b> <font color=#009900>void</font> AsyncOpNode<font color=#990000>:</font><font color=#990000>:</font><b><font color=#000000>set_timeout_interval</font></b><font color=#990000>(</font><b><font color=#0000FF>const</font></b> <b><font color=#0000FF>struct</font></b> timeval <font color=#990000>*</font>interval<font color=#990000>)</font>
<font color=#FF0000>{</font>
   <b><font color=#0000FF>if</font></b><font color=#990000>(</font>interval <font color=#990000>!</font><font color=#990000>=</font> <font color=#993399>0</font><font color=#990000>)</font>
   <font color=#FF0000>{</font>
      _mut<font color=#990000>.</font><b><font color=#000000>lock</font></b><font color=#990000>(</font><b><font color=#000000>pegasus_thread_self</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>)</font><font color=#990000>;</font>
      _timeout_interval<font color=#990000>.</font>tv_sec <font color=#990000>=</font> interval<font color=#990000>-</font><font color=#990000>&gt;</font>tv_sec<font color=#990000>;</font>
      _timeout_interval<font color=#990000>.</font>tv_usec <font color=#990000>=</font> interval<font color=#990000>-</font><font color=#990000>&gt;</font>tv_usec<font color=#990000>;</font>
      <b><font color=#000000>gettimeofday</font></b><font color=#990000>(</font><font color=#990000>&amp;</font>_updated<font color=#990000>,</font> NULL<font color=#990000>)</font><font color=#990000>;</font>
      _mut<font color=#990000>.</font><b><font color=#000000>unlock</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>;</font>
   <font color=#FF0000>}</font>
<font color=#FF0000>}</font>


<b><font color=#0000FF>inline</font></b> Boolean AsyncOpNode<font color=#990000>:</font><font color=#990000>:</font><b><font color=#000000>timeout</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font>
<font color=#FF0000>{</font>
   <b><font color=#0000FF>struct</font></b> timeval now<font color=#990000>;</font>
   <b><font color=#000000>gettimeofday</font></b><font color=#990000>(</font><font color=#990000>&amp;</font>now<font color=#990000>,</font> NULL<font color=#990000>)</font><font color=#990000>;</font>
   Boolean ret <font color=#990000>=</font> <b><font color=#0000FF>false</font></b><font color=#990000>;</font>
   _mut<font color=#990000>.</font><b><font color=#000000>lock</font></b><font color=#990000>(</font><b><font color=#000000>pegasus_thread_self</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>)</font><font color=#990000>;</font>
   <b><font color=#0000FF>if</font></b><font color=#990000>(</font><font color=#990000>(</font>_updated<font color=#990000>.</font>tv_sec <font color=#990000>+</font> _timeout_interval<font color=#990000>.</font>tv_sec <font color=#990000>)</font> <font color=#990000>&lt;</font> now<font color=#990000>.</font>tv_sec<font color=#990000>)</font>
      <b><font color=#0000FF>if</font></b><font color=#990000>(</font><font color=#990000>(</font>_updated<font color=#990000>.</font>tv_usec <font color=#990000>+</font> _timeout_interval<font color=#990000>.</font>tv_usec <font color=#990000>)</font> <font color=#990000>&lt;</font> now<font color=#990000>.</font>tv_usec<font color=#990000>)</font>
	 ret <font color=#990000>=</font>  <b><font color=#0000FF>true</font></b><font color=#990000>;</font>
   _mut<font color=#990000>.</font><b><font color=#000000>unlock</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>;</font>
   <b><font color=#0000FF>return</font></b> ret<font color=#990000>;</font>
<font color=#FF0000>}</font>

<i><font color=#9A1900>// context is now a locked list</font></i>
<b><font color=#0000FF>inline</font></b> OperationContext <font color=#990000>&amp;</font> AsyncOpNode<font color=#990000>:</font><font color=#990000>:</font><b><font color=#000000>get_context</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font>
<font color=#FF0000>{</font>
   <b><font color=#000000>gettimeofday</font></b><font color=#990000>(</font><font color=#990000>&amp;</font>_updated<font color=#990000>,</font> NULL<font color=#990000>)</font><font color=#990000>;</font>
   <b><font color=#0000FF>return</font></b> _operation_list<font color=#990000>;</font>
<font color=#FF0000>}</font>


<b><font color=#0000FF>inline</font></b>  <font color=#009900>void</font> AsyncOpNode<font color=#990000>:</font><font color=#990000>:</font><b><font color=#000000>put_request</font></b><font color=#990000>(</font><b><font color=#0000FF>const</font></b> Message <font color=#990000>*</font>request<font color=#990000>)</font>
<font color=#FF0000>{</font>
   _mut<font color=#990000>.</font><b><font color=#000000>lock</font></b><font color=#990000>(</font><b><font color=#000000>pegasus_thread_self</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>)</font><font color=#990000>;</font>
   <b><font color=#000000>gettimeofday</font></b><font color=#990000>(</font><font color=#990000>&amp;</font>_updated<font color=#990000>,</font> NULL<font color=#990000>)</font><font color=#990000>;</font>
   <b><font color=#0000FF>if</font></b><font color=#990000>(</font> <b><font color=#0000FF>false</font></b> <font color=#990000>=</font><font color=#990000>=</font> _request<font color=#990000>.</font><b><font color=#000000>exists</font></b><font color=#990000>(</font><b><font color=#0000FF>reinterpret_cast</font></b><font color=#990000>&lt;</font><font color=#009900>void</font> <font color=#990000>*</font><font color=#990000>&gt;</font><font color=#990000>(</font><b><font color=#0000FF>const_cast</font></b><font color=#990000>&lt;</font>Message <font color=#990000>*</font><font color=#990000>&gt;</font><font color=#990000>(</font>request<font color=#990000>)</font><font color=#990000>)</font><font color=#990000>)</font> <font color=#990000>)</font>
   _request<font color=#990000>.</font><b><font color=#000000>insert_last</font></b><font color=#990000>(</font> <b><font color=#0000FF>const_cast</font></b><font color=#990000>&lt;</font>Message <font color=#990000>*</font><font color=#990000>&gt;</font><font color=#990000>(</font>request<font color=#990000>)</font> <font color=#990000>)</font> <font color=#990000>;</font>

<i><font color=#9A1900>//   _request = const_cast&lt;Message *&gt;(request);</font></i>

   _mut<font color=#990000>.</font><b><font color=#000000>unlock</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>;</font>
<font color=#FF0000>}</font>

<b><font color=#0000FF>inline</font></b> Message <font color=#990000>*</font> AsyncOpNode<font color=#990000>:</font><font color=#990000>:</font><b><font color=#000000>get_request</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font>
<font color=#FF0000>{</font>
   Message <font color=#990000>*</font>ret<font color=#990000>;</font>
   _mut<font color=#990000>.</font><b><font color=#000000>lock</font></b><font color=#990000>(</font><b><font color=#000000>pegasus_thread_self</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>)</font><font color=#990000>;</font>
   <b><font color=#000000>gettimeofday</font></b><font color=#990000>(</font><font color=#990000>&amp;</font>_updated<font color=#990000>,</font> NULL<font color=#990000>)</font><font color=#990000>;</font>
   ret <font color=#990000>=</font> _request<font color=#990000>.</font><b><font color=#000000>remove_first</font></b><font color=#990000>(</font><font color=#990000>)</font> <font color=#990000>;</font>
<i><font color=#9A1900>//   ret = _request;</font></i>

   _mut<font color=#990000>.</font><b><font color=#000000>unlock</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>;</font>
   <b><font color=#0000FF>return</font></b> ret<font color=#990000>;</font>
<font color=#FF0000>}</font>

<b><font color=#0000FF>inline</font></b> <font color=#009900>void</font> AsyncOpNode<font color=#990000>:</font><font color=#990000>:</font><b><font color=#000000>put_response</font></b><font color=#990000>(</font><b><font color=#0000FF>const</font></b> Message <font color=#990000>*</font>response<font color=#990000>)</font>
<font color=#FF0000>{</font>
   _mut<font color=#990000>.</font><b><font color=#000000>lock</font></b><font color=#990000>(</font><b><font color=#000000>pegasus_thread_self</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>)</font><font color=#990000>;</font>
   <b><font color=#000000>gettimeofday</font></b><font color=#990000>(</font><font color=#990000>&amp;</font>_updated<font color=#990000>,</font> NULL<font color=#990000>)</font><font color=#990000>;</font>
   <b><font color=#0000FF>if</font></b> <font color=#990000>(</font><b><font color=#0000FF>false</font></b> <font color=#990000>=</font><font color=#990000>=</font> _response<font color=#990000>.</font><b><font color=#000000>exists</font></b><font color=#990000>(</font><b><font color=#0000FF>reinterpret_cast</font></b><font color=#990000>&lt;</font><font color=#009900>void</font> <font color=#990000>*</font><font color=#990000>&gt;</font><font color=#990000>(</font><b><font color=#0000FF>const_cast</font></b><font color=#990000>&lt;</font>Message <font color=#990000>*</font><font color=#990000>&gt;</font><font color=#990000>(</font>response<font color=#990000>)</font><font color=#990000>)</font><font color=#990000>)</font><font color=#990000>)</font>
   _response<font color=#990000>.</font><b><font color=#000000>insert_last</font></b><font color=#990000>(</font> <b><font color=#0000FF>const_cast</font></b><font color=#990000>&lt;</font>Message <font color=#990000>*</font><font color=#990000>&gt;</font><font color=#990000>(</font>response<font color=#990000>)</font> <font color=#990000>)</font><font color=#990000>;</font>

<i><font color=#9A1900>//   _response = const_cast&lt;Message *&gt;(response);</font></i>

   _mut<font color=#990000>.</font><b><font color=#000000>unlock</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>;</font>
<font color=#FF0000>}</font>

<b><font color=#0000FF>inline</font></b> Message <font color=#990000>*</font> AsyncOpNode<font color=#990000>:</font><font color=#990000>:</font><b><font color=#000000>get_response</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font>
<font color=#FF0000>{</font>
   Message <font color=#990000>*</font>ret<font color=#990000>;</font>

   _mut<font color=#990000>.</font><b><font color=#000000>lock</font></b><font color=#990000>(</font><b><font color=#000000>pegasus_thread_self</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>)</font><font color=#990000>;</font>
<i><font color=#9A1900>//   gettimeofday(&amp;_updated, NULL);</font></i>
   ret <font color=#990000>=</font> _response<font color=#990000>.</font><b><font color=#000000>remove_first</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>;</font>
<i><font color=#9A1900>//   ret = _response;</font></i>

   _mut<font color=#990000>.</font><b><font color=#000000>unlock</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>;</font>
   <b><font color=#0000FF>return</font></b> ret<font color=#990000>;</font>
<font color=#FF0000>}</font>

<b><font color=#0000FF>inline</font></b> Uint32 AsyncOpNode<font color=#990000>:</font><font color=#990000>:</font><b><font color=#000000>read_state</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font>
<font color=#FF0000>{</font>
   _mut<font color=#990000>.</font><b><font color=#000000>lock</font></b><font color=#990000>(</font><b><font color=#000000>pegasus_thread_self</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>)</font><font color=#990000>;</font>
   <b><font color=#000000>gettimeofday</font></b><font color=#990000>(</font><font color=#990000>&amp;</font>_updated<font color=#990000>,</font> NULL<font color=#990000>)</font><font color=#990000>;</font>
   Uint32 ret <font color=#990000>=</font> _state<font color=#990000>;</font>
   _mut<font color=#990000>.</font><b><font color=#000000>unlock</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>;</font>
   <b><font color=#0000FF>return</font></b> ret<font color=#990000>;</font>

<font color=#FF0000>}</font>

<b><font color=#0000FF>inline</font></b> <font color=#009900>void</font> AsyncOpNode<font color=#990000>:</font><font color=#990000>:</font><b><font color=#000000>write_state</font></b><font color=#990000>(</font>Uint32 state<font color=#990000>)</font>
<font color=#FF0000>{</font>
   _mut<font color=#990000>.</font><b><font color=#000000>lock</font></b><font color=#990000>(</font><b><font color=#000000>pegasus_thread_self</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>)</font><font color=#990000>;</font>
   <b><font color=#000000>gettimeofday</font></b><font color=#990000>(</font><font color=#990000>&amp;</font>_updated<font color=#990000>,</font> NULL<font color=#990000>)</font><font color=#990000>;</font>
   _state <font color=#990000>=</font> state<font color=#990000>;</font>
   _mut<font color=#990000>.</font><b><font color=#000000>unlock</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>;</font>
<font color=#FF0000>}</font>

<b><font color=#0000FF>inline</font></b> Uint32 AsyncOpNode<font color=#990000>:</font><font color=#990000>:</font><b><font color=#000000>read_flags</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font>
<font color=#FF0000>{</font>
   _mut<font color=#990000>.</font><b><font color=#000000>lock</font></b><font color=#990000>(</font><b><font color=#000000>pegasus_thread_self</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>)</font><font color=#990000>;</font>
   <b><font color=#000000>gettimeofday</font></b><font color=#990000>(</font><font color=#990000>&amp;</font>_updated<font color=#990000>,</font> NULL<font color=#990000>)</font><font color=#990000>;</font>
   Uint32 ret <font color=#990000>=</font> _flags<font color=#990000>;</font>
   _mut<font color=#990000>.</font><b><font color=#000000>unlock</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>;</font>
   <b><font color=#0000FF>return</font></b> ret<font color=#990000>;</font>
<font color=#FF0000>}</font>

<b><font color=#0000FF>inline</font></b> <font color=#009900>void</font> AsyncOpNode<font color=#990000>:</font><font color=#990000>:</font><b><font color=#000000>write_flags</font></b><font color=#990000>(</font>Uint32 flags<font color=#990000>)</font>
<font color=#FF0000>{</font>
   _mut<font color=#990000>.</font><b><font color=#000000>lock</font></b><font color=#990000>(</font><b><font color=#000000>pegasus_thread_self</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>)</font><font color=#990000>;</font>
   <b><font color=#000000>gettimeofday</font></b><font color=#990000>(</font><font color=#990000>&amp;</font>_updated<font color=#990000>,</font> NULL<font color=#990000>)</font><font color=#990000>;</font>
   _flags <font color=#990000>=</font> flags<font color=#990000>;</font>
   _mut<font color=#990000>.</font><b><font color=#000000>unlock</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>;</font>
<font color=#FF0000>}</font>


<b><font color=#0000FF>inline</font></b>  <font color=#009900>void</font> AsyncOpNode<font color=#990000>:</font><font color=#990000>:</font><b><font color=#000000>lock</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font>
   <b><font color=#0000FF>throw</font></b><font color=#990000>(</font>IPCException<font color=#990000>)</font>
<font color=#FF0000>{</font>
   _mut<font color=#990000>.</font><b><font color=#000000>lock</font></b><font color=#990000>(</font><b><font color=#000000>pegasus_thread_self</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>)</font><font color=#990000>;</font>
<font color=#FF0000>}</font>

<b><font color=#0000FF>inline</font></b> <font color=#009900>void</font> AsyncOpNode<font color=#990000>:</font><font color=#990000>:</font><b><font color=#000000>unlock</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font>
   <b><font color=#0000FF>throw</font></b><font color=#990000>(</font>IPCException<font color=#990000>)</font>
<font color=#FF0000>{</font>
   _mut<font color=#990000>.</font><b><font color=#000000>unlock</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>;</font>
<font color=#FF0000>}</font>

<b><font color=#0000FF>inline</font></b> <font color=#009900>void</font> AsyncOpNode<font color=#990000>:</font><font color=#990000>:</font><b><font color=#000000>udpate</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font>
   <b><font color=#0000FF>throw</font></b><font color=#990000>(</font>IPCException<font color=#990000>)</font>
<font color=#FF0000>{</font>
   _mut<font color=#990000>.</font><b><font color=#000000>lock</font></b><font color=#990000>(</font><b><font color=#000000>pegasus_thread_self</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>)</font><font color=#990000>;</font>
   <b><font color=#000000>gettimeofday</font></b><font color=#990000>(</font><font color=#990000>&amp;</font>_updated<font color=#990000>,</font> NULL<font color=#990000>)</font><font color=#990000>;</font>
   _mut<font color=#990000>.</font><b><font color=#000000>unlock</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>;</font>
   <b><font color=#0000FF>return</font></b><font color=#990000>;</font>
<font color=#FF0000>}</font>

<b><font color=#0000FF>inline</font></b> <font color=#009900>void</font> AsyncOpNode<font color=#990000>:</font><font color=#990000>:</font><b><font color=#000000>deliver</font></b><font color=#990000>(</font><b><font color=#0000FF>const</font></b> Uint32 count<font color=#990000>)</font>
   <b><font color=#0000FF>throw</font></b><font color=#990000>(</font>IPCException<font color=#990000>)</font>
<font color=#FF0000>{</font>
   _mut<font color=#990000>.</font><b><font color=#000000>lock</font></b><font color=#990000>(</font><b><font color=#000000>pegasus_thread_self</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>)</font><font color=#990000>;</font>
   _completed_ops <font color=#990000>=</font> count<font color=#990000>;</font>
   _state <font color=#990000>|</font><font color=#990000>=</font> ASYNC_OPSTATE_DELIVER<font color=#990000>;</font>
   <b><font color=#000000>gettimeofday</font></b><font color=#990000>(</font><font color=#990000>&amp;</font>_updated<font color=#990000>,</font> NULL<font color=#990000>)</font><font color=#990000>;</font>
   _mut<font color=#990000>.</font><b><font color=#000000>unlock</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>;</font>
   <b><font color=#0000FF>return</font></b><font color=#990000>;</font>
<font color=#FF0000>}</font>

<b><font color=#0000FF>inline</font></b> <font color=#009900>void</font> AsyncOpNode<font color=#990000>:</font><font color=#990000>:</font><b><font color=#000000>reserve</font></b><font color=#990000>(</font><b><font color=#0000FF>const</font></b> Uint32 size<font color=#990000>)</font>
   <b><font color=#0000FF>throw</font></b><font color=#990000>(</font>IPCException<font color=#990000>)</font>
<font color=#FF0000>{</font>
   _mut<font color=#990000>.</font><b><font color=#000000>lock</font></b><font color=#990000>(</font><b><font color=#000000>pegasus_thread_self</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>)</font><font color=#990000>;</font>
   _total_ops <font color=#990000>=</font> size<font color=#990000>;</font>
   _state <font color=#990000>|</font><font color=#990000>=</font> ASYNC_OPSTATE_RESERVE<font color=#990000>;</font>
   <b><font color=#000000>gettimeofday</font></b><font color=#990000>(</font><font color=#990000>&amp;</font>_updated<font color=#990000>,</font> NULL<font color=#990000>)</font><font color=#990000>;</font>
   _mut<font color=#990000>.</font><b><font color=#000000>unlock</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>;</font>
   <b><font color=#0000FF>return</font></b><font color=#990000>;</font>
<font color=#FF0000>}</font>

<b><font color=#0000FF>inline</font></b> <font color=#009900>void</font> AsyncOpNode<font color=#990000>:</font><font color=#990000>:</font><b><font color=#000000>processing</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font>
   <b><font color=#0000FF>throw</font></b><font color=#990000>(</font>IPCException<font color=#990000>)</font>
<font color=#FF0000>{</font>
   _mut<font color=#990000>.</font><b><font color=#000000>lock</font></b><font color=#990000>(</font><b><font color=#000000>pegasus_thread_self</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>)</font><font color=#990000>;</font>
   _state <font color=#990000>|</font><font color=#990000>=</font> ASYNC_OPSTATE_PROCESSING<font color=#990000>;</font>
   <b><font color=#000000>gettimeofday</font></b><font color=#990000>(</font><font color=#990000>&amp;</font>_updated<font color=#990000>,</font> NULL<font color=#990000>)</font><font color=#990000>;</font>
   _mut<font color=#990000>.</font><b><font color=#000000>unlock</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>;</font>
   <b><font color=#0000FF>return</font></b><font color=#990000>;</font>
<font color=#FF0000>}</font>

<i><font color=#9A1900>// con will be empty upon return of this member function</font></i>
<b><font color=#0000FF>inline</font></b> <font color=#009900>void</font> AsyncOpNode<font color=#990000>:</font><font color=#990000>:</font><b><font color=#000000>processing</font></b><font color=#990000>(</font>OperationContext <font color=#990000>*</font>con<font color=#990000>)</font>
   <b><font color=#0000FF>throw</font></b><font color=#990000>(</font>IPCException<font color=#990000>)</font>
<font color=#FF0000>{</font>
   _mut<font color=#990000>.</font><b><font color=#000000>lock</font></b><font color=#990000>(</font><b><font color=#000000>pegasus_thread_self</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>)</font><font color=#990000>;</font>
   _state <font color=#990000>|</font><font color=#990000>=</font> ASYNC_OPSTATE_PROCESSING<font color=#990000>;</font>
   <b><font color=#000000>gettimeofday</font></b><font color=#990000>(</font><font color=#990000>&amp;</font>_updated<font color=#990000>,</font> NULL<font color=#990000>)</font><font color=#990000>;</font>

   context <font color=#990000>*</font>c <font color=#990000>=</font> con<font color=#990000>-</font><font color=#990000>&gt;</font><b><font color=#000000>remove_context</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>;</font>
   <b><font color=#0000FF>while</font></b><font color=#990000>(</font>c <font color=#990000>!</font><font color=#990000>=</font> <font color=#993399>0</font><font color=#990000>)</font>
   <font color=#FF0000>{</font>
      _operation_list<font color=#990000>.</font><b><font color=#000000>add_context</font></b><font color=#990000>(</font>c<font color=#990000>)</font><font color=#990000>;</font>
      c <font color=#990000>=</font> con<font color=#990000>-</font><font color=#990000>&gt;</font><b><font color=#000000>remove_context</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>;</font>
   <font color=#FF0000>}</font>
   _mut<font color=#990000>.</font><b><font color=#000000>unlock</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>;</font>
   <b><font color=#0000FF>return</font></b><font color=#990000>;</font>
<font color=#FF0000>}</font>

<b><font color=#0000FF>inline</font></b> <font color=#009900>void</font> AsyncOpNode<font color=#990000>:</font><font color=#990000>:</font><b><font color=#000000>complete</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font>
   <b><font color=#0000FF>throw</font></b><font color=#990000>(</font>IPCException<font color=#990000>)</font>
<font color=#FF0000>{</font>
   _mut<font color=#990000>.</font><b><font color=#000000>lock</font></b><font color=#990000>(</font><b><font color=#000000>pegasus_thread_self</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>)</font><font color=#990000>;</font>
   _state <font color=#990000>|</font><font color=#990000>=</font> ASYNC_OPSTATE_COMPLETE<font color=#990000>;</font>
   <b><font color=#000000>gettimeofday</font></b><font color=#990000>(</font><font color=#990000>&amp;</font>_updated<font color=#990000>,</font> NULL<font color=#990000>)</font><font color=#990000>;</font>
   _mut<font color=#990000>.</font><b><font color=#000000>unlock</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>;</font>

   <b><font color=#0000FF>return</font></b><font color=#990000>;</font>
<font color=#FF0000>}</font>

<b><font color=#0000FF>inline</font></b> <font color=#009900>void</font> AsyncOpNode<font color=#990000>:</font><font color=#990000>:</font><b><font color=#000000>complete</font></b><font color=#990000>(</font>OperationContext <font color=#990000>*</font>con<font color=#990000>)</font>
   <b><font color=#0000FF>throw</font></b><font color=#990000>(</font>IPCException<font color=#990000>)</font>
<font color=#FF0000>{</font>
   _mut<font color=#990000>.</font><b><font color=#000000>lock</font></b><font color=#990000>(</font><b><font color=#000000>pegasus_thread_self</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>)</font><font color=#990000>;</font>
   _state <font color=#990000>|</font><font color=#990000>=</font> ASYNC_OPSTATE_COMPLETE<font color=#990000>;</font>
   <b><font color=#000000>gettimeofday</font></b><font color=#990000>(</font><font color=#990000>&amp;</font>_updated<font color=#990000>,</font> NULL<font color=#990000>)</font><font color=#990000>;</font>
   context <font color=#990000>*</font>c <font color=#990000>=</font> con<font color=#990000>-</font><font color=#990000>&gt;</font><b><font color=#000000>remove_context</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>;</font>
   <b><font color=#0000FF>while</font></b><font color=#990000>(</font>c <font color=#990000>!</font><font color=#990000>=</font> <font color=#993399>0</font><font color=#990000>)</font>
   <font color=#FF0000>{</font>
      _operation_list<font color=#990000>.</font><b><font color=#000000>add_context</font></b><font color=#990000>(</font>c<font color=#990000>)</font><font color=#990000>;</font>
      c <font color=#990000>=</font> con<font color=#990000>-</font><font color=#990000>&gt;</font><b><font color=#000000>remove_context</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>;</font>
   <font color=#FF0000>}</font>
   _mut<font color=#990000>.</font><b><font color=#000000>unlock</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>;</font>
<font color=#FF0000>}</font>

<b><font color=#0000FF>inline</font></b> <font color=#009900>void</font> AsyncOpNode<font color=#990000>:</font><font color=#990000>:</font><b><font color=#000000>wait</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font>
<font color=#FF0000>{</font>
   _client_sem<font color=#990000>.</font><b><font color=#000000>wait</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>;</font>
<font color=#FF0000>}</font>

<b><font color=#0000FF>inline</font></b> <font color=#009900>void</font> AsyncOpNode<font color=#990000>:</font><font color=#990000>:</font><b><font color=#000000>release</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font>
<font color=#FF0000>{</font>
   _mut<font color=#990000>.</font><b><font color=#000000>lock</font></b><font color=#990000>(</font><b><font color=#000000>pegasus_thread_self</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>)</font><font color=#990000>;</font>
   _state <font color=#990000>|</font><font color=#990000>=</font> ASYNC_OPSTATE_RELEASED<font color=#990000>;</font>
   _mut<font color=#990000>.</font><b><font color=#000000>unlock</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>;</font>
<font color=#FF0000>}</font>

<b><font color=#0000FF>inline</font></b>  <font color=#009900>void</font> AsyncOpNode<font color=#990000>:</font><font color=#990000>:</font><b><font color=#000000>_set_lifetime</font></b><font color=#990000>(</font><b><font color=#0000FF>struct</font></b> timeval <font color=#990000>*</font>lifetime<font color=#990000>)</font>
<font color=#FF0000>{</font>
   _mut<font color=#990000>.</font><b><font color=#000000>lock</font></b><font color=#990000>(</font><b><font color=#000000>pegasus_thread_self</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>)</font><font color=#990000>;</font>
   _lifetime<font color=#990000>.</font>tv_sec <font color=#990000>=</font> lifetime<font color=#990000>-</font><font color=#990000>&gt;</font>tv_sec<font color=#990000>;</font>
   _lifetime<font color=#990000>.</font>tv_usec <font color=#990000>=</font> lifetime<font color=#990000>-</font><font color=#990000>&gt;</font>tv_usec<font color=#990000>;</font>
   _mut<font color=#990000>.</font><b><font color=#000000>unlock</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>;</font>
<font color=#FF0000>}</font>

<b><font color=#0000FF>inline</font></b> Boolean AsyncOpNode<font color=#990000>:</font><font color=#990000>:</font><b><font color=#000000>_check_lifetime</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font>
<font color=#FF0000>{</font>
   <b><font color=#0000FF>struct</font></b> timeval now<font color=#990000>;</font>

   <b><font color=#000000>gettimeofday</font></b><font color=#990000>(</font><font color=#990000>&amp;</font>now<font color=#990000>,</font> NULL<font color=#990000>)</font><font color=#990000>;</font>
   <b><font color=#0000FF>if</font></b><font color=#990000>(</font><font color=#990000>(</font>_start<font color=#990000>.</font>tv_sec <font color=#990000>+</font> _lifetime<font color=#990000>.</font>tv_sec <font color=#990000>)</font> <font color=#990000>&gt;</font><font color=#990000>=</font> now<font color=#990000>.</font>tv_sec<font color=#990000>)</font>
      <b><font color=#0000FF>if</font></b><font color=#990000>(</font><font color=#990000>(</font>_start<font color=#990000>.</font>tv_usec <font color=#990000>+</font> _lifetime<font color=#990000>.</font>tv_usec <font color=#990000>)</font> <font color=#990000>&gt;</font><font color=#990000>=</font> now<font color=#990000>.</font>tv_usec<font color=#990000>)</font>
	 <b><font color=#0000FF>return</font></b> <b><font color=#0000FF>true</font></b><font color=#990000>;</font>
   <b><font color=#0000FF>return</font></b> <b><font color=#0000FF>false</font></b><font color=#990000>;</font>
<font color=#FF0000>}</font>

<b><font color=#0000FF>inline</font></b> Boolean AsyncOpNode<font color=#990000>:</font><font color=#990000>:</font><b><font color=#000000>_is_child</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font>
<font color=#FF0000>{</font>
   <b><font color=#0000FF>if</font></b> <font color=#990000>(</font>_parent <font color=#990000>!</font><font color=#990000>=</font> <font color=#993399>0</font><font color=#990000>)</font>
      <b><font color=#0000FF>return</font></b> <b><font color=#0000FF>true</font></b><font color=#990000>;</font>
   <b><font color=#0000FF>return</font></b> <b><font color=#0000FF>false</font></b><font color=#990000>;</font>
<font color=#FF0000>}</font>

<b><font color=#0000FF>inline</font></b> Uint32 AsyncOpNode<font color=#990000>:</font><font color=#990000>:</font><b><font color=#000000>_is_parent</font></b><font color=#990000>(</font><font color=#009900>void</font><font color=#990000>)</font>
<font color=#FF0000>{</font>
   <b><font color=#0000FF>return</font></b> _children<font color=#990000>.</font><b><font color=#000000>count</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>;</font>
<font color=#FF0000>}</font>

<b><font color=#0000FF>inline</font></b> Boolean AsyncOpNode<font color=#990000>:</font><font color=#990000>:</font><b><font color=#000000>_is_my_child</font></b><font color=#990000>(</font><b><font color=#0000FF>const</font></b> AsyncOpNode <font color=#990000>&amp;</font> caller<font color=#990000>)</font> <b><font color=#0000FF>const</font></b>
<font color=#FF0000>{</font>
   <b><font color=#0000FF>if</font></b> <font color=#990000>(</font> _parent <font color=#990000>=</font><font color=#990000>=</font> <font color=#990000>&amp;</font>caller <font color=#990000>)</font>
      <b><font color=#0000FF>return</font></b> <b><font color=#0000FF>true</font></b><font color=#990000>;</font>
   <b><font color=#0000FF>return</font></b> <b><font color=#0000FF>false</font></b><font color=#990000>;</font>
<font color=#FF0000>}</font>

<b><font color=#0000FF>inline</font></b> <font color=#009900>void</font> AsyncOpNode<font color=#990000>:</font><font color=#990000>:</font><b><font color=#000000>_make_orphan</font></b><font color=#990000>(</font> AsyncOpNode <font color=#990000>&amp;</font> parent<font color=#990000>)</font>
<font color=#FF0000>{</font>
   <b><font color=#0000FF>if</font></b><font color=#990000>(</font> _parent <font color=#990000>=</font><font color=#990000>=</font> <font color=#990000>&amp;</font>parent <font color=#990000>)</font>
   <font color=#FF0000>{</font>
      _parent <font color=#990000>=</font> NULL<font color=#990000>;</font>
      parent<font color=#990000>.</font>_children<font color=#990000>.</font><b><font color=#000000>remove</font></b><font color=#990000>(</font><b><font color=#0000FF>this</font></b><font color=#990000>)</font><font color=#990000>;</font>
   <font color=#FF0000>}</font>
   <b><font color=#0000FF>else</font></b>
      <b><font color=#0000FF>throw</font></b> <b><font color=#000000>Permission</font></b><font color=#990000>(</font><b><font color=#000000>pegasus_thread_self</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>)</font><font color=#990000>;</font>
<font color=#FF0000>}</font>

<b><font color=#0000FF>inline</font></b> <font color=#009900>void</font> AsyncOpNode<font color=#990000>:</font><font color=#990000>:</font><b><font color=#000000>_adopt_child</font></b><font color=#990000>(</font>AsyncOpNode <font color=#990000>*</font>child<font color=#990000>)</font>
<font color=#FF0000>{</font>
   <b><font color=#0000FF>if</font></b><font color=#990000>(</font>child <font color=#990000>=</font><font color=#990000>=</font> NULL<font color=#990000>)</font>
      <b><font color=#0000FF>throw</font></b> <b><font color=#000000>NullPointer</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>;</font>
   <b><font color=#0000FF>if</font></b><font color=#990000>(</font><b><font color=#0000FF>true</font></b> <font color=#990000>=</font><font color=#990000>=</font> child<font color=#990000>-</font><font color=#990000>&gt;</font><b><font color=#000000>_is_child</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>)</font>
      <b><font color=#0000FF>throw</font></b> <b><font color=#000000>Permission</font></b><font color=#990000>(</font><b><font color=#000000>pegasus_thread_self</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>)</font><font color=#990000>;</font>
   child<font color=#990000>-</font><font color=#990000>&gt;</font>_parent <font color=#990000>=</font> <b><font color=#0000FF>this</font></b><font color=#990000>;</font>
   _children<font color=#990000>.</font><b><font color=#000000>insert_last</font></b><font color=#990000>(</font>child<font color=#990000>)</font><font color=#990000>;</font>
<font color=#FF0000>}</font>

<b><font color=#0000FF>inline</font></b> <font color=#009900>void</font> AsyncOpNode<font color=#990000>:</font><font color=#990000>:</font><b><font color=#000000>_disown_child</font></b><font color=#990000>(</font>AsyncOpNode <font color=#990000>*</font>child<font color=#990000>)</font>
<font color=#FF0000>{</font>
   <b><font color=#0000FF>if</font></b><font color=#990000>(</font>child <font color=#990000>=</font><font color=#990000>=</font> NULL<font color=#990000>)</font>
      <b><font color=#0000FF>throw</font></b> <b><font color=#000000>NullPointer</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>;</font>
   <b><font color=#0000FF>if</font></b><font color=#990000>(</font> <b><font color=#0000FF>false</font></b> <font color=#990000>=</font><font color=#990000>=</font> child<font color=#990000>-</font><font color=#990000>&gt;</font><b><font color=#000000>_is_child</font></b><font color=#990000>(</font><font color=#990000>)</font> <font color=#990000>|</font><font color=#990000>|</font> <b><font color=#0000FF>false</font></b> <font color=#990000>=</font><font color=#990000>=</font> child<font color=#990000>-</font><font color=#990000>&gt;</font><b><font color=#000000>_is_my_child</font></b><font color=#990000>(</font> <font color=#990000>*</font><b><font color=#0000FF>this</font></b> <font color=#990000>)</font><font color=#990000>)</font>
      <b><font color=#0000FF>throw</font></b> <b><font color=#000000>Permission</font></b><font color=#990000>(</font><b><font color=#000000>pegasus_thread_self</font></b><font color=#990000>(</font><font color=#990000>)</font><font color=#990000>)</font><font color=#990000>;</font>
   child<font color=#990000>-</font><font color=#990000>&gt;</font><b><font color=#000000>_make_orphan</font></b><font color=#990000>(</font> <font color=#990000>*</font><b><font color=#0000FF>this</font></b> <font color=#990000>)</font><font color=#990000>;</font>
   _children<font color=#990000>.</font><b><font color=#000000>remove</font></b><font color=#990000>(</font>child<font color=#990000>)</font><font color=#990000>;</font>
<font color=#FF0000>}</font>

PEGASUS_NAMESPACE_END

<b><font color=#000080>#endif</font></b> <i><font color=#9A1900>//Pegasus_AsyncOpNode_h</font></i>
</tt>
</pre>


<hr>
    <address><a href="mailto:mdday@us.ibm.com">Michael Day</a></address>
<!-- Created: Tue Feb  5 13:21:55 EST 2002 -->
<!-- hhmts start -->
Last modified: Wed Mar 13 12:26:56 EST 2002
<!-- hhmts end -->
  </body></html>