[0001]
[0002]
[0003]
[0004]
[0005]
[0006]
[0007]
[0008]
[0009]
[0010]
[0011]
[0012]
[0013]
[0014]
[0015]
[0016]
[0017]
[0018]
[0019]
[0020]
[0021]
[0022]
[0023]
[0024]
[0025]
[0026]
[0027]
[0028]
[0029]
[0030]
[0031]
[0032]
[0033]
[0034]
[0035]
[0036]
[0037]
[0038]
[0039]
[0040]
[0041]
[0042]
[0043]
[0044]
[0045]
[0046]
[0047]
[0048]
[0049]
[0050]
[0051]
[0052]
[0053]
[0054]
[0055]
[0056]
[0057]
[0058]
[0059]
[0060]
[0061]
[0062]
[0063]
[0064]
[0065]
[0066]
[0067]
[0068]
[0069]
[0070]
[0071]
[0072]
[0073]
[0074]
[0075]
[0076]
[0077]
[0078]
[0079]
[0080]
[0081]
[0082]
[0083]
[0084]
[0085]
[0086]
[0087]
[0088]
[0089]
[0090]
[0091]
[0092]
[0093]
[0094]
[0095]
[0096]
[0097]
[0098]
[0099]
[0100]
[0101]
[0102]
[0103]
[0104]
[0105]
[0106]
[0107]
[0108]
[0109]
[0110]
[0111]
[0112]
[0113]
[0114]
[0115]
[0116]
[0117]
[0118]
[0119]
[0120]
[0121]
[0122]
[0123]
[0124]
[0125]
[0126]
[0127]
[0128]
[0129]
[0130]
[0131]
[0132]
[0133]
[0134]
[0135]
[0136]
[0137]
[0138]
[0139]
[0140]
[0141]
[0142]
[0143]
[0144]
[0145]
[0146]
[0147]
[0148]
[0149]
[0150]
[0151]
[0152]
[0153]
[0154]
[0155]
[0156]
[0157]
[0158]
[0159]
[0160]
[0161]
[0162]
[0163]
[0164]
[0165]
[0166]
[0167]
[0168]
[0169]
[0170]
[0171]
[0172]
[0173]
[0174]
[0175]
[0176]
[0177]
[0178]
[0179]
[0180]
[0181]
[0182]
[0183]
[0184]
[0185]
[0186]
[0187]
[0188]
[0189]
[0190]
[0191]
[0192]
[0193]
[0194]
[0195]
[0196]
[0197]
[0198]
[0199]
[0200]
[0201]
[0202]
[0203]
[0204]
[0205]
[0206]
[0207]
[0208]
[0209]
[0210]
[0211]
[0212]
[0213]
[0214]
[0215]
[0216]
[0217]
[0218]
[0219]
[0220]
[0221]
[0222]
[0223]
[0224]
[0225]
[0226]
[0227]
[0228]
[0229]
[0230]
[0231]
[0232]
[0233]
[0234]
[0235]
[0236]
[0237]
[0238]
[0239]
[0240]
[0241]
[0242]
[0243]
[0244]
[0245]
[0246]
[0247]
[0248]
[0249]
[0250]
[0251]
[0252]
[0253]
[0254]
[0255]
[0256]
[0257]
[0258]
[0259]
[0260]
[0261]
[0262]
[0263]
[0264]
[0265]
[0266]
[0267]
[0268]
[0269]
[0270]
[0271]
[0272]
[0273]
[0274]
[0275]
[0276]
[0277]
[0278]
[0279]
[0280]
[0281]
[0282]
[0283]
[0284]
[0285]
[0286]
[0287]
[0288]
[0289]
[0290]
[0291]
[0292]
[0293]
[0294]
[0295]
[0296]
[0297]
[0298]
[0299]
[0300]
[0301]
[0302]
[0303]
[0304]
[0305]
[0306]
[0307]
[0308]
[0309]
[0310]
[0311]
[0312]
[0313]
[0314]
[0315]
[0316]
[0317]
[0318]
[0319]
[0320]
[0321]
[0322]
[0323]
[0324]
[0325]
[0326]
[0327]
[0328]
[0329]
[0330]
[0331]
[0332]
[0333]
[0334]
[0335]
[0336]
[0337]
[0338]
[0339]
[0340]
[0341]
[0342]
[0343]
[0344]
[0345]
[0346]
[0347]
[0348]
[0349]
[0350]
[0351]
[0352]
[0353]
[0354]
[0355]
[0356]
[0357]
[0358]
[0359]
[0360]
[0361]
[0362]
[0363]
[0364]
[0365]
[0366]
[0367]
[0368]
[0369]
[0370]
[0371]
[0372]
[0373]
[0374]
[0375]
[0376]
[0377]
[0378]
[0379]
[0380]
[0381]
[0382]
[0383]
[0384]
[0385]
[0386]
[0387]
[0388]
[0389]
[0390]
[0391]
[0392]
[0393]
[0394]
[0395]
[0396]
[0397]
[0398]
[0399]
[0400]
[0401]
[0402]
[0403]
[0404]
[0405]
[0406]
[0407]
[0408]
[0409]
[0410]
[0411]
[0412]
[0413]
[0414]
[0415]
[0416]
[0417]
[0418]
[0419]
[0420]
[0421]
[0422]
[0423]
[0424]
[0425]
[0426]
[0427]
[0428]
[0429]
[0430]
[0431]
[0432]
[0433]
[0434]
[0435]
[0436]
[0437]
[0438]
[0439]
[0440]
[0441]
[0442]
[0443]
[0444]
[0445]
[0446]
[0447]
[0448]
[0449]
[0450]
[0451]
[0452]
[0453]
[0454]
[0455]
[0456]
[0457]
[0458]
[0459]
[0460]
[0461]
[0462]
[0463]
[0464]
[0465]
[0466]
[0467]
[0468]
[0469]
[0470]
[0471]
[0472]
[0473]
[0474]
[0475]
[0476]
[0477]
[0478]
[0479]
[0480]
[0481]
[0482]
[0483]
[0484]
[0485]
[0486]
[0487]
[0488]
[0489]
[0490]
[0491]
[0492]
[0493]
[0494]
[0495]
[0496]
[0497]
[0498]
[0499]
[0500]
[0501]
[0502]
[0503]
[0504]
[0505]
[0506]
[0507]
[0508]
[0509]
[0510]
[0511]
[0512]
[0513]
[0514]
[0515]
[0516]
[0517]
[0518]
[0519]
[0520]
[0521]
[0522]
[0523]
[0524]
[0525]
[0526]
[0527]
[0528]
[0529]
[0530]
[0531]
[0532]
[0533]
[0534]
[0535]
[0536]
[0537]
[0538]
[0539]
[0540]
[0541]
[0542]
[0543]
[0544]
[0545]
[0546]
[0547]
[0548]
[0549]
[0550]
[0551]
[0552]
[0553]
[0554]
[0555]
[0556]
[0557]
[0558]
[0559]
[0560]
[0561]
[0562]
[0563]
[0564]
[0565]
[0566]
[0567]
[0568]
[0569]
[0570]
[0571]
[0572]
[0573]
[0574]
[0575]
[0576]
[0577]
[0578]
[0579]
[0580]
[0581]
[0582]
[0583]
[0584]
[0585]
[0586]
[0587]
[0588]
[0589]
[0590]
[0591]
[0592]
[0593]
[0594]
[0595]
[0596]
[0597]
[0598]
[0599]
[0600]
[0601]
[0602]
[0603]
[0604]
[0605]
[0606]
[0607]
[0608]
[0609]
[0610]
[0611]
[0612]
[0613]
[0614]
[0615]
[0616]
[0617]
[0618]
[0619]
[0620]
[0621]
[0622]
[0623]
[0624]
[0625]
[0626]
[0627]
[0628]
[0629]
[0630]
[0631]
[0632]
[0633]
[0634]
[0635]
[0636]
[0637]
[0638]
[0639]
[0640]
[0641]
[0642]
[0643]
[0644]
[0645]
[0646]
[0647]
[0648]
[0649]
[0650]
[0651]
[0652]
[0653]
[0654]
[0655]
[0656]
[0657]
[0658]
[0659]
[0660]
[0661]
[0662]
[0663]
[0664]
[0665]
[0666]
[0667]
[0668]
[0669]
[0670]
[0671]
[0672]
[0673]
[0674]
[0675]
[0676]
[0677]
[0678]
[0679]
[0680]
[0681]
[0682]
[0683]
[0684]
[0685]
[0686]
[0687]
[0688]
[0689]
[0690]
[0691]
[0692]
[0693]
[0694]
[0695]
[0696]
[0697]
[0698]
[0699]
[0700]
[0701]
[0702]
[0703]
[0704]
[0705]
[0706]
[0707]
[0708]
[0709]
[0710]
[0711]
[0712]
[0713]
[0714]
[0715]
[0716]
[0717]
[0718]
[0719]
[0720]
[0721]
[0722]
[0723]
[0724]
[0725]
[0726]
[0727]
[0728]
[0729]
[0730]
[0731]
[0732]
[0733]
[0734]
[0735]
[0736]
[0737]
[0738]
[0739]
[0740]
[0741]
[0742]
[0743]
[0744]
[0745]
[0746]
[0747]
[0748]
[0749]
[0750]
[0751]
[0752]
[0753]
[0754]
[0755]
[0756]
[0757]
[0758]
[0759]
[0760]
[0761]
[0762]
[0763]
[0764]
[0765]
[0766]
[0767]
[0768]
[0769]
[0770]
[0771]
[0772]
[0773]
[0774]
[0775]
[0776]
[0777]
[0778]
[0779]
[0780]
[0781]
[0782]
[0783]
[0784]
[0785]
[0786]
[0787]
[0788]
[0789]
[0790]
[0791]
[0792]
[0793]
[0794]
[0795]
[0796]
[0797]
[0798]
[0799]
[0800]
[0801]
[0802]
[0803]
[0804]
[0805]
[0806]
[0807]
[0808]
[0809]
[0810]
[0811]
[0812]
[0813]
[0814]
[0815]
[0816]
[0817]
[0818]
[0819]
[0820]
[0821]
[0822]
[0823]
[0824]
[0825]
[0826]
[0827]
[0828]
[0829]
[0830]
[0831]
[0832]
[0833]
[0834]
[0835]
[0836]
[0837]
[0838]
[0839]
[0840]
[0841]
[0842]
[0843]
[0844]
[0845]
[0846]
[0847]
[0848]
[0849]
[0850]
[0851]
[0852]
[0853]
[0854]
[0855]
[0856]
[0857]
[0858]
[0859]
[0860]
[0861]
[0862]
[0863]
[0864]
[0865]
[0866]
[0867]
[0868]
[0869]
[0870]
[0871]
[0872]
[0873]
[0874]
[0875]
[0876]
[0877]
[0878]
[0879]
[0880]
[0881]
[0882]
[0883]
[0884]
[0885]
[0886]
[0887]
[0888]
[0889]
[0890]
[0891]
[0892]
[0893]
[0894]
[0895]
[0896]
[0897]
[0898]
[0899]
[0900]
[0901]
[0902]
[0903]
[0904]
[0905]
[0906]
[0907]
[0908]
[0909]
[0910]
[0911]
[0912]
[0913]
[0914]
[0915]
[0916]
[0917]
[0918]
[0919]
[0920]
[0921]
[0922]
[0923]
[0924]
[0925]
[0926]
[0927]
[0928]
[0929]
[0930]
[0931]
[0932]
[0933]
[0934]
[0935]
[0936]
[0937]
[0938]
[0939]
[0940]
[0941]
[0942]
[0943]
[0944]
[0945]
[0946]
[0947]
[0948]
[0949]
[0950]
[0951]
[0952]
[0953]
[0954]
[0955]
[0956]
[0957]
[0958]
[0959]
[0960]
[0961]
[0962]
[0963]
[0964]
[0965]
[0966]
[0967]
[0968]
[0969]
[0970]
[0971]
[0972]
[0973]
[0974]
[0975]
[0976]
[0977]
[0978]
[0979]
[0980]
[0981]
[0982]
[0983]
[0984]
[0985]
[0986]
[0987]
[0988]
[0989]
[0990]
[0991]
[0992]
[0993]
[0994]
[0995]
[0996]
[0997]
[0998]
[0999]
[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]
[2586]
[2587]
[2588]
[2589]
[2590]
[2591]
[2592]
[2593]
[2594]
[2595]
[2596]
[2597]
[2598]
[2599]
[2600]
[2601]
[2602]
[2603]
[2604]
[2605]
[2606]
[2607]
[2608]
[2609]
[2610]
[2611]
[2612]
[2613]
[2614]
[2615]
[2616]
[2617]
[2618]
[2619]
[2620]
[2621]
[2622]
[2623]
[2624]
[2625]
[2626]
[2627]
[2628]
[2629]
[2630]
[2631]
[2632]
[2633]
[2634]
[2635]
[2636]
[2637]
[2638]
[2639]
[2640]
[2641]
[2642]
[2643]
[2644]
[2645]
[2646]
[2647]
[2648]
[2649]
[2650]
[2651]
[2652]
[2653]
[2654]
[2655]
[2656]
[2657]
[2658]
[2659]
[2660]
[2661]
[2662]
[2663]
[2664]
[2665]
[2666]
[2667]
[2668]
[2669]
[2670]
[2671]
[2672]
[2673]
[2674]
[2675]
[2676]
[2677]
[2678]
[2679]
[2680]
[2681]
[2682]
[2683]
[2684]
[2685]
[2686]
[2687]
[2688]
[2689]
[2690]
[2691]
[2692]
[2693]
[2694]
[2695]
[2696]
[2697]
[2698]
[2699]
[2700]
[2701]
[2702]
[2703]
[2704]
[2705]
[2706]
[2707]
[2708]
[2709]
[2710]
[2711]
[2712]
[2713]
[2714]
[2715]
[2716]
[2717]
[2718]
[2719]
[2720]
[2721]
[2722]
[2723]
[2724]
[2725]
[2726]
[2727]
[2728]
[2729]
[2730]
[2731]
[2732]
[2733]
[2734]
[2735]
[2736]
[2737]
[2738]
[2739]
[2740]
[2741]
[2742]
[2743]
[2744]
[2745]
[2746]
[2747]
[2748]
[2749]
[2750]
[2751]
[2752]
[2753]
[2754]
[2755]
[2756]
[2757]
[2758]
[2759]
[2760]
[2761]
[2762]
[2763]
[2764]
[2765]
[2766]
[2767]
[2768]
[2769]
[2770]
[2771]
[2772]
[2773]
[2774]
[2775]
[2776]
[2777]
[2778]
[2779]
[2780]
[2781]
[2782]
[2783]
[2784]
[2785]
[2786]
[2787]
[2788]
[2789]
[2790]
[2791]
[2792]
[2793]
[2794]
[2795]
[2796]
[2797]
[2798]
[2799]
[2800]
[2801]
[2802]
[2803]
[2804]
[2805]
[2806]
[2807]
[2808]
[2809]
[2810]
[2811]
[2812]
[2813]
[2814]
[2815]
[2816]
[2817]
[2818]
[2819]
[2820]
[2821]
[2822]
[2823]
[2824]
[2825]
[2826]
[2827]
[2828]
[2829]
[2830]
[2831]
[2832]
[2833]
[2834]
[2835]
[2836]
[2837]
[2838]
[2839]
[2840]
[2841]
[2842]
[2843]
[2844]
[2845]
[2846]
[2847]
[2848]
[2849]
[2850]
[2851]
[2852]
[2853]
[2854]
[2855]
[2856]
[2857]
[2858]
[2859]
[2860]
[2861]
[2862]
[2863]
[2864]
[2865]
[2866]
[2867]
[2868]
[2869]
[2870]
[2871]
[2872]
[2873]
[2874]
[2875]
[2876]
[2877]
[2878]
[2879]
[2880]
[2881]
[2882]
[2883]
[2884]
[2885]
[2886]
[2887]
[2888]
[2889]
[2890]
[2891]
[2892]
[2893]
[2894]
[2895]
[2896]
[2897]
[2898]
[2899]
[2900]
[2901]
[2902]
[2903]
[2904]
[2905]
[2906]
[2907]
[2908]
[2909]
[2910]
[2911]
[2912]
[2913]
[2914]
[2915]
[2916]
[2917]
[2918]
[2919]
[2920]
[2921]
[2922]
[2923]
[2924]
[2925]
[2926]
[2927]
[2928]
[2929]
[2930]
[2931]
[2932]
[2933]
[2934]
[2935]
[2936]
[2937]
[2938]
[2939]
[2940]
[2941]
[2942]
[2943]
[2944]
[2945]
[2946]
[2947]
[2948]
[2949]
[2950]
[2951]
[2952]
[2953]
[2954]
[2955]
[2956]
[2957]
[2958]
[2959]
[2960]
[2961]
[2962]
[2963]
[2964]
[2965]
[2966]
[2967]
[2968]
[2969]
[2970]
[2971]
[2972]
[2973]
[2974]
[2975]
[2976]
[2977]
[2978]
[2979]
[2980]
[2981]
[2982]
[2983]
[2984]
[2985]
[2986]
[2987]
[2988]
[2989]
[2990]
[2991]
[2992]
[2993]
[2994]
[2995]
[2996]
[2997]
[2998]
[2999]
[3000]
[3001]
[3002]
[3003]
[3004]
[3005]
[3006]
[3007]
[3008]
[3009]
[3010]
[3011]
[3012]
[3013]
[3014]
[3015]
[3016]
[3017]
[3018]
[3019]
[3020]
[3021]
[3022]
[3023]
[3024]
[3025]
[3026]
[3027]
[3028]
[3029]
[3030]
[3031]
[3032]
[3033]
[3034]
[3035]
[3036]
[3037]
[3038]
[3039]
[3040]
[3041]
[3042]
[3043]
[3044]
[3045]
[3046]
[3047]
[3048]
[3049]
[3050]
[3051]
[3052]
[3053]
[3054]
[3055]
[3056]
[3057]
[3058]
[3059]
[3060]
[3061]
[3062]
[3063]
[3064]
[3065]
[3066]
[3067]
[3068]
[3069]
[3070]
[3071]
[3072]
[3073]
[3074]
[3075]
[3076]
[3077]
[3078]
[3079]
[3080]
[3081]
[3082]
[3083]
[3084]
[3085]
[3086]
[3087]
[3088]
[3089]
[3090]
[3091]
[3092]
[3093]
[3094]
[3095]
[3096]
[3097]
[3098]
[3099]
[3100]
[3101]
[3102]
[3103]
[3104]
[3105]
[3106]
[3107]
[3108]
[3109]
[3110]
[3111]
[3112]
[3113]
[3114]
[3115]
[3116]
[3117]
[3118]
[3119]
[3120]
[3121]
[3122]
[3123]
[3124]
[3125]
[3126]
[3127]
[3128]
[3129]
[3130]
[3131]
[3132]
[3133]
[3134]
[3135]
[3136]
[3137]
[3138]
[3139]
[3140]
[3141]
[3142]
[3143]
[3144]
[3145]
[3146]
[3147]
[3148]
[3149]
[3150]
[3151]
[3152]
[3153]
[3154]
[3155]
[3156]
[3157]
[3158]
[3159]
[3160]
[3161]
[3162]
[3163]
[3164]
[3165]
[3166]
[3167]
[3168]
[3169]
[3170]
[3171]
[3172]
[3173]
[3174]
[3175]
[3176]
[3177]
[3178]
[3179]
[3180]
[3181]
[3182]
[3183]
[3184]
[3185]
[3186]
[3187]
[3188]
[3189]
[3190]
[3191]
[3192]
[3193]
[3194]
[3195]
[3196]
[3197]
[3198]
[3199]
[3200]
[3201]
[3202]
[3203]
[3204]
[3205]
[3206]
[3207]
[3208]
[3209]
[3210]
[3211]
[3212]
[3213]
[3214]
[3215]
[3216]
[3217]
[3218]
[3219]
[3220]
[3221]
[3222]
[3223]
[3224]
[3225]
[3226]
[3227]
[3228]
[3229]
[3230]
[3231]
[3232]
[3233]
[3234]
[3235]
[3236]
[3237]
[3238]
[3239]
[3240]
[3241]
[3242]
[3243]
[3244]
[3245]
[3246]
[3247]
[3248]
[3249]
[3250]
[3251]
[3252]
[3253]
[3254]
[3255]
[3256]
[3257]
[3258]
[3259]
[3260]
[3261]
[3262]
[3263]
[3264]
[3265]
[3266]
[3267]
[3268]
[3269]
[3270]
[3271]
[3272]
[3273]
[3274]
[3275]
[3276]
[3277]
[3278]
[3279]
[3280]
[3281]
[3282]
[3283]
[3284]
[3285]
[3286]
[3287]
[3288]
[3289]
[3290]
[3291]
[3292]
[3293]
[3294]
[3295]
[3296]
[3297]
[3298]
[3299]
[3300]
[3301]
[3302]
[3303]
[3304]
[3305]
[3306]
[3307]
[3308]
[3309]
[3310]
[3311]
[3312]
[3313]
[3314]
[3315]
[3316]
[3317]
[3318]
[3319]
[3320]
[3321]
[3322]
[3323]
[3324]
[3325]
[3326]
[3327]
[3328]
[3329]
[3330]
[3331]
[3332]
[3333]
[3334]
[3335]
[3336]
[3337]
[3338]
[3339]
[3340]
[3341]
[3342]
[3343]
[3344]
[3345]
[3346]
[3347]
[3348]
[3349]
[3350]
[3351]
[3352]
[3353]
[3354]
[3355]
[3356]
[3357]
[3358]
[3359]
[3360]
[3361]
[3362]
[3363]
[3364]
[3365]
[3366]
[3367]
[3368]
[3369]
[3370]
[3371]
[3372]
[3373]
[3374]
[3375]
[3376]
[3377]
[3378]
[3379]
[3380]
[3381]
[3382]
[3383]
[3384]
[3385]
[3386]
[3387]
[3388]
[3389]
[3390]
[3391]
[3392]
[3393]
[3394]
[3395]
[3396]
[3397]
[3398]
[3399]
[3400]
[3401]
[3402]
[3403]
[3404]
[3405]
[3406]
[3407]
[3408]
[3409]
[3410]
[3411]
[3412]
[3413]
[3414]
[3415]
[3416]
[3417]
[3418]
[3419]
[3420]
[3421]
[3422]
[3423]
[3424]
[3425]
[3426]
[3427]
[3428]
[3429]
[3430]
[3431]
[3432]
[3433]
[3434]
[3435]
[3436]
[3437]
[3438]
[3439]
[3440]
[3441]
[3442]
[3443]
[3444]
[3445]
[3446]
[3447]
[3448]
[3449]
[3450]
[3451]
[3452]
[3453]
[3454]
[3455]
[3456]
[3457]
[3458]
[3459]
[3460]
[3461]
[3462]
[3463]
[3464]
[3465]
[3466]
[3467]
[3468]
[3469]
[3470]
[3471]
[3472]
[3473]
[3474]
[3475]
[3476]
[3477]
[3478]
[3479]
[3480]
[3481]
[3482]
[3483]
[3484]
[3485]
[3486]
[3487]
[3488]
[3489]
[3490]
[3491]
[3492]
[3493]
[3494]
[3495]
[3496]
[3497]
[3498]
[3499]
[3500]
[3501]
[3502]
[3503]
[3504]
[3505]
[3506]
[3507]
[3508]
[3509]
[3510]
[3511]
[3512]
[3513]
[3514]
[3515]
[3516]
[3517]
[3518]
[3519]
[3520]
[3521]
[3522]
[3523]
[3524]
[3525]
[3526]
[3527]
[3528]
[3529]
[3530]
[3531]
[3532]
[3533]
[3534]
[3535]
[3536]
[3537]
[3538]
[3539]
[3540]
[3541]
[3542]
[3543]
[3544]
[3545]
[3546]
[3547]
[3548]
[3549]
[3550]
[3551]
[3552]
[3553]
[3554]
[3555]
[3556]
[3557]
[3558]
[3559]
[3560]
[3561]
[3562]
[3563]
[3564]
[3565]
[3566]
[3567]
[3568]
[3569]
[3570]
[3571]
[3572]
[3573]
[3574]
[3575]
[3576]
[3577]
[3578]
[3579]
[3580]
[3581]
[3582]
[3583]
[3584]
[3585]
[3586]
[3587]
[3588]
[3589]
[3590]
[3591]
[3592]
[3593]
[3594]
[3595]
[3596]
[3597]
[3598]
[3599]
[3600]
[3601]
[3602]
[3603]
[3604]
[3605]
[3606]
[3607]
[3608]
[3609]
[3610]
[3611]
[3612]
[3613]
[3614]
[3615]
[3616]
[3617]
[3618]
[3619]
[3620]
[3621]
[3622]
[3623]
[3624]
[3625]
[3626]
[3627]
[3628]
[3629]
[3630]
[3631]
[3632]
[3633]
[3634]
[3635]
[3636]
[3637]
[3638]
[3639]
[3640]
[3641]
[3642]
[3643]
[3644]
[3645]
[3646]
[3647]
[3648]
[3649]
[3650]
[3651]
[3652]
[3653]
[3654]
[3655]
[3656]
[3657]
[3658]
[3659]
[3660]
[3661]
[3662]
[3663]
[3664]
[3665]
[3666]
[3667]
[3668]
[3669]
[3670]
[3671]
[3672]
[3673]
[3674]
[3675]
[3676]
[3677]
[3678]
[3679]
[3680]
[3681]
[3682]
[3683]
[3684]
[3685]
[3686]
[3687]
[3688]
[3689]
[3690]
[3691]
[3692]
[3693]
[3694]
[3695]
[3696]
[3697]
[3698]
[3699]
[3700]
[3701]
[3702]
[3703]
[3704]
[3705]
[3706]
[3707]
[3708]
[3709]
[3710]
[3711]
[3712]
[3713]
[3714]
[3715]
[3716]
[3717]
[3718]
[3719]
[3720]
[3721]
[3722]
[3723]
[3724]
[3725]
[3726]
[3727]
[3728]
[3729]
[3730]
[3731]
[3732]
[3733]
[3734]
[3735]
[3736]
[3737]
[3738]
[3739]
[3740]
[3741]
[3742]
[3743]
[3744]
[3745]
[3746]
[3747]
[3748]
[3749]
[3750]
[3751]
[3752]
[3753]
[3754]
[3755]
[3756]
[3757]
[3758]
[3759]
[3760]
[3761]
[3762]
[3763]
[3764]
[3765]
[3766]
[3767]
[3768]
[3769]
[3770]
[3771]
[3772]
[3773]
[3774]
[3775]
[3776]
[3777]
[3778]
[3779]
[3780]
[3781]
[3782]
[3783]
[3784]
[3785]
[3786]
[3787]
[3788]
[3789]
[3790]
[3791]
[3792]
[3793]
[3794]
[3795]
[3796]
[3797]
[3798]
[3799]
[3800]
[3801]
[3802]
[3803]
[3804]
[3805]
[3806]
[3807]
[3808]
[3809]
[3810]
[3811]
[3812]
[3813]
[3814]
[3815]
[3816]
[3817]
[3818]
[3819]
[3820]
[3821]
[3822]
[3823]
[3824]
[3825]
[3826]
[3827]
[3828]
[3829]
[3830]
[3831]
[3832]
[3833]
[3834]
[3835]
[3836]
[3837]
[3838]
[3839]
[3840]
[3841]
[3842]
[3843]
[3844]
[3845]
[3846]
[3847]
[3848]
[3849]
[3850]
[3851]
[3852]
[3853]
[3854]
[3855]
[3856]
[3857]
[3858]
[3859]
[3860]
[3861]
[3862]
[3863]
[3864]
[3865]
[3866]
[3867]
[3868]
[3869]
[3870]
[3871]
[3872]
[3873]
[3874]
[3875]
[3876]
[3877]
[3878]
[3879]
[3880]
[3881]
[3882]
[3883]
[3884]
[3885]
[3886]
[3887]
[3888]
[3889]
[3890]
[3891]
[3892]
[3893]
[3894]
[3895]
[3896]
[3897]
[3898]
[3899]
[3900]
[3901]
[3902]
[3903]
[3904]
[3905]
[3906]
[3907]
[3908]
[3909]
[3910]
[3911]
[3912]
[3913]
[3914]
[3915]
[3916]
[3917]
[3918]
[3919]
[3920]
[3921]
[3922]
[3923]
[3924]
[3925]
[3926]
[3927]
[3928]
[3929]
[3930]
[3931]
[3932]
[3933]
[3934]
[3935]
[3936]
[3937]
[3938]
[3939]
[3940]
[3941]
[3942]
[3943]
[3944]
[3945]
[3946]
[3947]
[3948]
[3949]
[3950]
[3951]
[3952]
[3953]
[3954]
[3955]
[3956]
[3957]
[3958]
[3959]
[3960]
[3961]
[3962]
[3963]
[3964]
[3965]
[3966]
[3967]
[3968]
[3969]
[3970]
[3971]
[3972]
[3973]
[3974]
[3975]
[3976]
[3977]
[3978]
[3979]
[3980]
[3981]
[3982]
[3983]
[3984]
[3985]
[3986]
[3987]
[3988]
[3989]
[3990]
[3991]
[3992]
[3993]
[3994]
[3995]
[3996]
[3997]
[3998]
[3999]
[4000]
[4001]
[4002]
[4003]
[4004]
[4005]
[4006]
[4007]
[4008]
[4009]
[4010]
[4011]
[4012]
[4013]
[4014]
[4015]
[4016]
[4017]
[4018]
[4019]
[4020]
[4021]
[4022]
[4023]
[4024]
[4025]
[4026]
[4027]
[4028]
[4029]
[4030]
[4031]
[4032]
[4033]
[4034]
[4035]
[4036]
[4037]
[4038]
[4039]
[4040]
[4041]
[4042]
[4043]
[4044]
[4045]
[4046]
[4047]
[4048]
[4049]
[4050]
[4051]
[4052]
[4053]
[4054]
[4055]
[4056]
[4057]
[4058]
[4059]
[4060]
[4061]
[4062]
[4063]
[4064]
[4065]
[4066]
[4067]
[4068]
[4069]
[4070]
[4071]
[4072]
[4073]
[4074]
[4075]
[4076]
[4077]
[4078]
[4079]
[4080]
[4081]
[4082]
[4083]
[4084]
[4085]
[4086]
[4087]
[4088]
[4089]
[4090]
[4091]
[4092]
[4093]
[4094]
[4095]
[4096]
[4097]
[4098]
[4099]
[4100]
[4101]
[4102]
[4103]
[4104]
[4105]
[4106]
[4107]
[4108]
[4109]
[4110]
[4111]
[4112]
[4113]
[4114]
[4115]
[4116]
[4117]
[4118]
[4119]
[4120]
[4121]
[4122]
[4123]
[4124]
[4125]
[4126]
[4127]
[4128]
[4129]
[4130]
[4131]
[4132]
[4133]
[4134]
[4135]
[4136]
[4137]
[4138]
[4139]
[4140]
[4141]
[4142]
[4143]
[4144]
[4145]
[4146]
[4147]
[4148]
[4149]
[4150]
[4151]
[4152]
[4153]
[4154]
[4155]
[4156]
[4157]
[4158]
[4159]
[4160]
[4161]
[4162]
[4163]
[4164]
[4165]
[4166]
[4167]
[4168]
[4169]
[4170]
[4171]
[4172]
[4173]
[4174]
[4175]
[4176]
[4177]
[4178]
[4179]
[4180]
[4181]
[4182]
[4183]
[4184]
[4185]
[4186]
[4187]
[4188]
[4189]
[4190]
[4191]
[4192]
[4193]
[4194]
[4195]
[4196]
[4197]
[4198]
[4199]
[4200]
[4201]
[4202]
[4203]
[4204]
[4205]
[4206]
[4207]
[4208]
[4209]
[4210]
[4211]
[4212]
[4213]
[4214]
[4215]
[4216]
[4217]
[4218]
[4219]
[4220]
[4221]
[4222]
[4223]
[4224]
[4225]
[4226]
[4227]
[4228]
[4229]
[4230]
[4231]
[4232]
[4233]
[4234]
[4235]
[4236]
[4237]
[4238]
[4239]
[4240]
[4241]
[4242]
[4243]
[4244]
[4245]
[4246]
[4247]
[4248]
[4249]
[4250]
[4251]
[4252]
[4253]
[4254]
[4255]
[4256]
[4257]
[4258]
[4259]
[4260]
[4261]
[4262]
[4263]
[4264]
[4265]
[4266]
[4267]
[4268]
[4269]
[4270]
[4271]
[4272]
[4273]
[4274]
[4275]
[4276]
[4277]
[4278]
[4279]
[4280]
[4281]
[4282]
[4283]
[4284]
[4285]
[4286]
[4287]
[4288]
[4289]
[4290]
[4291]
[4292]
[4293]
[4294]
[4295]
[4296]
[4297]
[4298]
[4299]
[4300]
[4301]
[4302]
[4303]
[4304]
[4305]
[4306]
[4307]
[4308]
[4309]
[4310]
[4311]
[4312]
[4313]
[4314]
[4315]
[4316]
[4317]
[4318]
[4319]
[4320]
[4321]
[4322]
[4323]
[4324]
[4325]
[4326]
[4327]
[4328]
[4329]
[4330]
[4331]
[4332]
[4333]
[4334]
[4335]
[4336]
[4337]
[4338]
[4339]
[4340]
[4341]
[4342]
[4343]
[4344]
[4345]
[4346]
[4347]
[4348]
[4349]
[4350]
[4351]
[4352]
[4353]
[4354]
[4355]
[4356]
[4357]
[4358]
[4359]
[4360]
[4361]
[4362]
[4363]
[4364]
[4365]
[4366]
[4367]
[4368]
[4369]
[4370]
[4371]
[4372]
[4373]
[4374]
[4375]
[4376]
[4377]
[4378]
[4379]
[4380]
[4381]
[4382]
[4383]
[4384]
[4385]
[4386]
[4387]
[4388]
[4389]
[4390]
[4391]
[4392]
[4393]
[4394]
[4395]
[4396]
[4397]
[4398]
[4399]
[4400]
[4401]
[4402]
[4403]
[4404]
[4405]
[4406]
[4407]
[4408]
[4409]
[4410]
[4411]
[4412]
[4413]
[4414]
[4415]
[4416]
[4417]
[4418]
[4419]
[4420]
[4421]
[4422]
[4423]
[4424]
[4425]
[4426]
[4427]
[4428]
[4429]
[4430]
[4431]
[4432]
[4433]
[4434]
[4435]
[4436]
[4437]
[4438]
[4439]
[4440]
[4441]
[4442]
[4443]
[4444]
[4445]
[4446]
[4447]
[4448]
[4449]
[4450]
[4451]
[4452]
[4453]
[4454]
[4455]
[4456]
[4457]
[4458]
[4459]
[4460]
[4461]
[4462]
[4463]
[4464]
[4465]
[4466]
[4467]
[4468]
[4469]
[4470]
[4471]
[4472]
[4473]
[4474]
[4475]
[4476]
[4477]
[4478]
[4479]
[4480]
[4481]
[4482]
[4483]
[4484]
[4485]
[4486]
[4487]
[4488]
[4489]
[4490]
[4491]
[4492]
[4493]
[4494]
[4495]
[4496]
[4497]
[4498]
[4499]
[4500]
[4501]
[4502]
[4503]
[4504]
[4505]
[4506]
[4507]
[4508]
[4509]
[4510]
[4511]
[4512]
[4513]
[4514]
[4515]
[4516]
[4517]
[4518]
[4519]
[4520]
[4521]
[4522]
[4523]
[4524]
[4525]
[4526]
[4527]
[4528]
[4529]
[4530]
[4531]
[4532]
[4533]
[4534]
[4535]
[4536]
[4537]
[4538]
[4539]
[4540]
[4541]
[4542]
[4543]
[4544]
[4545]
[4546]
[4547]
[4548]
[4549]
[4550]
[4551]
[4552]
[4553]
[4554]
[4555]
[4556]
[4557]
[4558]
[4559]
[4560]
[4561]
[4562]
[4563]
[4564]
[4565]
[4566]
[4567]
[4568]
[4569]
[4570]
[4571]
[4572]
[4573]
[4574]
[4575]
[4576]
[4577]
[4578]
[4579]
[4580]
[4581]
[4582]
[4583]
[4584]
[4585]
[4586]
[4587]
[4588]
[4589]
[4590]
[4591]
[4592]
[4593]
[4594]
[4595]
[4596]
[4597]
[4598]
[4599]
[4600]
[4601]
[4602]
[4603]
[4604]
[4605]
[4606]
[4607]
[4608]
[4609]
[4610]
[4611]
[4612]
[4613]
[4614]
[4615]
[4616]
[4617]
[4618]
[4619]
[4620]
[4621]
[4622]
[4623]
[4624]
[4625]
[4626]
[4627]
[4628]
[4629]
[4630]
[4631]
[4632]
[4633]
[4634]
[4635]
[4636]
[4637]
[4638]
[4639]
[4640]
[4641]
[4642]
[4643]
[4644]
[4645]
[4646]
[4647]
[4648]
[4649]
[4650]
[4651]
[4652]
[4653]
[4654]
[4655]
[4656]
[4657]
[4658]
[4659]
[4660]
[4661]
[4662]
[4663]
[4664]
[4665]
[4666]
[4667]
[4668]
[4669]
[4670]
[4671]
[4672]
[4673]
[4674]
[4675]
[4676]
[4677]
[4678]
[4679]
[4680]
[4681]
[4682]
[4683]
[4684]
[4685]
[4686]
[4687]
[4688]
[4689]
[4690]
[4691]
[4692]
[4693]
[4694]
[4695]
[4696]
[4697]
[4698]
[4699]
[4700]
[4701]
[4702]
[4703]
[4704]
[4705]
[4706]
[4707]
[4708]
[4709]
[4710]
[4711]
[4712]
[4713]
[4714]
[4715]
[4716]
[4717]
[4718]
[4719]
[4720]
[4721]
[4722]
[4723]
[4724]
[4725]
[4726]
[4727]
[4728]
[4729]
[4730]
[4731]
[4732]
[4733]
[4734]
[4735]
[4736]
[4737]
[4738]
[4739]
[4740]
[4741]
[4742]
[4743]
[4744]
[4745]
[4746]
[4747]
[4748]
[4749]
[4750]
[4751]
[4752]
[4753]
[4754]
[4755]
[4756]
[4757]
[4758]
[4759]
[4760]
[4761]
[4762]
[4763]
[4764]
[4765]
[4766]
[4767]
[4768]
[4769]
[4770]
[4771]
[4772]
[4773]
[4774]
[4775]
[4776]
[4777]
[4778]
[4779]
[4780]
[4781]
[4782]
[4783]
[4784]
[4785]
[4786]
[4787]
[4788]
[4789]
[4790]
[4791]
[4792]
[4793]
[4794]
[4795]
[4796]
[4797]
[4798]
[4799]
[4800]
[4801]
[4802]
[4803]
[4804]
[4805]
[4806]
[4807]
[4808]
[4809]
[4810]
[4811]
[4812]
[4813]
[4814]
[4815]
[4816]
[4817]
[4818]
[4819]
[4820]
[4821]
[4822]
[4823]
[4824]
[4825]
[4826]
[4827]
[4828]
[4829]
[4830]
[4831]
[4832]
[4833]
[4834]
[4835]
[4836]
[4837]
[4838]
[4839]
[4840]
[4841]
[4842]
[4843]
[4844]
[4845]
[4846]
[4847]
[4848]
[4849]
[4850]
[4851]
[4852]
[4853]
[4854]
[4855]
[4856]
[4857]
[4858]
[4859]
[4860]
[4861]
[4862]
[4863]
[4864]
[4865]
[4866]
[4867]
[4868]
[4869]
[4870]
[4871]
[4872]
[4873]
[4874]
[4875]
[4876]
[4877]
[4878]
[4879]
[4880]
[4881]
[4882]
[4883]
[4884]
[4885]
[4886]
[4887]
[4888]
[4889]
[4890]
[4891]
[4892]
[4893]
[4894]
[4895]
[4896]
[4897]
[4898]
[4899]
[4900]
[4901]
[4902]
[4903]
[4904]
[4905]
[4906]
[4907]
[4908]
[4909]
[4910]
[4911]
[4912]
[4913]
[4914]
[4915]
[4916]
[4917]
[4918]
[4919]
[4920]
[4921]
[4922]
[4923]
[4924]
[4925]
[4926]
[4927]
[4928]
[4929]
[4930]
[4931]
[4932]
[4933]
[4934]
[4935]
[4936]
[4937]
[4938]
[4939]
[4940]
[4941]
[4942]
[4943]
[4944]
[4945]
[4946]
[4947]
[4948]
[4949]
[4950]
[4951]
[4952]
[4953]
[4954]
[4955]
[4956]
[4957]
[4958]
[4959]
[4960]
[4961]
[4962]
[4963]
[4964]
[4965]
[4966]
[4967]
[4968]
[4969]
[4970]
[4971]
[4972]
[4973]
[4974]
[4975]
[4976]
[4977]
[4978]
[4979]
[4980]
[4981]
[4982]
[4983]
[4984]
[4985]
[4986]
[4987]
[4988]
[4989]
[4990]
[4991]
[4992]
[4993]
[4994]
[4995]
[4996]
[4997]
[4998]
[4999]
[5000]
[5001]
[5002]
[5003]
[5004]
[5005]
[5006]
[5007]
[5008]
[5009]
[5010]
[5011]
[5012]
[5013]
[5014]
[5015]
[5016]
[5017]
[5018]
[5019]
[5020]
[5021]
[5022]
[5023]
[5024]
[5025]
[5026]
[5027]
[5028]
[5029]
[5030]
[5031]
[5032]
[5033]
[5034]
[5035]
[5036]
[5037]
[5038]
[5039]
[5040]
[5041]
[5042]
[5043]
[5044]
[5045]
[5046]
[5047]
[5048]
[5049]
[5050]
[5051]
[5052]
[5053]
[5054]
[5055]
[5056]
[5057]
[5058]
[5059]
[5060]
[5061]
[5062]
[5063]
[5064]
[5065]
[5066]
[5067]
[5068]
[5069]
[5070]
[5071]
[5072]
[5073]
[5074]
[5075]
[5076]
[5077]
[5078]
[5079]
[5080]
[5081]
[5082]
[5083]
[5084]
[5085]
[5086]
[5087]
[5088]
[5089]
[5090]
[5091]
[5092]
[5093]
[5094]
[5095]
[5096]
[5097]
[5098]
[5099]
[5100]
[5101]
[5102]
[5103]
[5104]
[5105]
[5106]
[5107]
[5108]
[5109]
[5110]
[5111]
[5112]
[5113]
[5114]
[5115]
[5116]
[5117]
[5118]
[5119]
[5120]
[5121]
[5122]
[5123]
[5124]
[5125]
[5126]
[5127]
[5128]
[5129]
[5130]
[5131]
[5132]
[5133]
[5134]
[5135]
[5136]
[5137]
[5138]
[5139]
[5140]
[5141]
[5142]
[5143]
[5144]
[5145]
[5146]
[5147]
[5148]
[5149]
[5150]
[5151]
[5152]
[5153]
[5154]
[5155]
[5156]
[5157]
[5158]
[5159]
[5160]
[5161]
[5162]
[5163]
[5164]
[5165]
[5166]
[5167]
[5168]
[5169]
[5170]
[5171]
[5172]
[5173]
[5174]
[5175]
[5176]
[5177]
[5178]
[5179]
[5180]
[5181]
[5182]
[5183]
[5184]
[5185]
[5186]
[5187]
[5188]
[5189]
[5190]
[5191]
[5192]
[5193]
[5194]
[5195]
[5196]
[5197]
[5198]
[5199]
[5200]
[5201]
[5202]
[5203]
[5204]
[5205]
[5206]
[5207]
[5208]
[5209]
[5210]
[5211]
[5212]
[5213]
[5214]
[5215]
[5216]
[5217]
[5218]
[5219]
[5220]
[5221]
[5222]
[5223]
[5224]
[5225]
[5226]
[5227]
[5228]
[5229]
[5230]
[5231]
[5232]
[5233]
[5234]
[5235]
[5236]
[5237]
[5238]
[5239]
[5240]
[5241]
[5242]
[5243]
[5244]
[5245]
[5246]
[5247]
[5248]
[5249]
[5250]
[5251]
[5252]
[5253]
[5254]
[5255]
[5256]
[5257]
[5258]
[5259]
[5260]
[5261]
[5262]
[5263]
[5264]
[5265]
[5266]
[5267]
[5268]
[5269]
[5270]
[5271]
[5272]
[5273]
[5274]
[5275]
[5276]
[5277]
[5278]
[5279]
[5280]
[5281]
[5282]
[5283]
[5284]
[5285]
[5286]
[5287]
[5288]
[5289]
[5290]
[5291]
[5292]
[5293]
[5294]
[5295]
[5296]
[5297]
[5298]
[5299]
[5300]
[5301]
[5302]
[5303]
[5304]
[5305]
[5306]
[5307]
[5308]
[5309]
[5310]
[5311]
[5312]
[5313]
[5314]
[5315]
[5316]
[5317]
[5318]
[5319]
[5320]
[5321]
[5322]
[5323]
[5324]
[5325]
[5326]
[5327]
[5328]
[5329]
[5330]
[5331]
[5332]
[5333]
[5334]
[5335]
[5336]
[5337]
[5338]
[5339]
[5340]
[5341]
[5342]
[5343]
[5344]
[5345]
[5346]
[5347]
[5348]
[5349]
[5350]
[5351]
[5352]
[5353]
[5354]
[5355]
[5356]
[5357]
[5358]
[5359]
[5360]
[5361]
[5362]
[5363]
[5364]
[5365]
[5366]
[5367]
[5368]
[5369]
[5370]
[5371]
[5372]
[5373]
[5374]
[5375]
[5376]
[5377]
[5378]
[5379]
[5380]
[5381]
[5382]
[5383]
[5384]
[5385]
[5386]
[5387]
[5388]
[5389]
[5390]
[5391]
[5392]
[5393]
[5394]
[5395]
[5396]
[5397]
[5398]
[5399]
[5400]
[5401]
[5402]
[5403]
[5404]
[5405]
[5406]
[5407]
[5408]
[5409]
[5410]
[5411]
[5412]
[5413]
[5414]
[5415]
[5416]
[5417]
[5418]
[5419]
[5420]
[5421]
[5422]
[5423]
[5424]
[5425]
[5426]
[5427]
[5428]
[5429]
[5430]
[5431]
[5432]
[5433]
[5434]
[5435]
[5436]
[5437]
[5438]
[5439]
[5440]
[5441]
[5442]
[5443]
[5444]
[5445]
[5446]
[5447]
[5448]
[5449]
[5450]
[5451]
[5452]
[5453]
[5454]
[5455]
[5456]
[5457]
[5458]
[5459]
[5460]
[5461]
[5462]
[5463]
[5464]
[5465]
[5466]
[5467]
[5468]
[5469]
[5470]
[5471]
[5472]
[5473]
[5474]
[5475]
[5476]
[5477]
[5478]
[5479]
[5480]
[5481]
[5482]
[5483]
[5484]
[5485]
[5486]
[5487]
[5488]
[5489]
[5490]
[5491]
[5492]
[5493]
[5494]
[5495]
[5496]
[5497]
[5498]
[5499]
[5500]
[5501]
[5502]
[5503]
[5504]
[5505]
[5506]
[5507]
[5508]
[5509]
[5510]
[5511]
[5512]
[5513]
[5514]
[5515]
[5516]
[5517]
[5518]
[5519]
[5520]
[5521]
[5522]
[5523]
[5524]
[5525]
[5526]
[5527]
[5528]
[5529]
[5530]
[5531]
[5532]
[5533]
[5534]
[5535]
[5536]
[5537]
[5538]
[5539]
[5540]
[5541]
[5542]
[5543]
[5544]
[5545]
[5546]
[5547]
[5548]
[5549]
[5550]
[5551]
[5552]
[5553]
[5554]
[5555]
[5556]
[5557]
[5558]
[5559]
[5560]
[5561]
[5562]
[5563]
[5564]
[5565]
[5566]
[5567]
[5568]
[5569]
[5570]
[5571]
[5572]
[5573]
[5574]
[5575]
[5576]
[5577]
[5578]
[5579]
[5580]
[5581]
[5582]
[5583]
[5584]
[5585]
[5586]
[5587]
[5588]
[5589]
[5590]
[5591]
[5592]
[5593]
[5594]
[5595]
[5596]
[5597]
[5598]
[5599]
[5600]
[5601]
[5602]
[5603]
[5604]
[5605]
[5606]
[5607]
[5608]
[5609]
[5610]
[5611]
[5612]
[5613]
[5614]
[5615]
[5616]
[5617]
[5618]
[5619]
[5620]
[5621]
[5622]
[5623]
[5624]
[5625]
[5626]
[5627]
[5628]
[5629]
[5630]
[5631]
[5632]
[5633]
[5634]
[5635]
[5636]
[5637]
[5638]
[5639]
[5640]
[5641]
[5642]
[5643]
[5644]
[5645]
[5646]
[5647]
[5648]
[5649]
/*****************************************************************************/
#ifdef COMMENTS_WITH_COMMENTS
/*
                                MetaCon.c

"MetaCon"fig attempts to provide an overall structure and consistent set of
functions for WASD configuration.

The META_CONFIG file structure is designed for "high-level" parsing by
MetaConParse().  This function implements the meta-config configuration
directives described below.  Calling a function for each "line" of a file is
moderately more expensive than parsing them inline so for efficiency and speed
configuration facilities (such as mapping and authorization) also explicitly
parse this structure.  If it detects a line with a token that is not _TEXT
only then does it call the MetaConParse() to perform the high-level parse.

For configuration requiring "rule" interpretation (such as mapping and
authorization) it creates an internal representation of the original file.


META FILES
----------
There are two 'types' of configuration file.  The ones belonging to the primary
configuration and administered by the site administrator.  And those belonging
to virtual service administrators.

  [IncludeFile]       include a configuration file
  [ConfigDirectory]   virtual service administered directory
  [ConfigFile]        virtual service administered configuration file

The [IncludeFile] directive allows a primary configuration to be built up of
one of more files included from elsewhere.  These directives must have an
absolute file specification and must exists at server startup or other
configuration load.  They can contain all configuration directives available to
the site administratator.  Those belonging to a virtual service administrator
are included using the [ConfigFile] directive.  The should but do not need to
exists at configuration load.  The directives used in these files may have
limitations depending on the configuration context.  The file specification can
be absolute r relative to anything currently specified by [ConfigDirectory].


META VERSION
------------
Configurations can have sections conditionally processed based on the WASD
version.  Where a version does not match the intervening directives are not
processed at all.  This means that unknown conditionals, etc., are not reported
and do not result in directive processing aborts.  All WASD configuration files
support the version conditional.  The syntax is:

  [[wasd<comparison-operator><major>.<minor>.<tweak>]]

Only the major version number is required.  The minor and tweak numbers if
omitted default to zero.  Comparison operators are as follows:

  [[wasd==11.0]]      equal to
  [[wasd<=11.1]]      less than or equal to
  [[wasd<11.2]]       less than
  [[wasd>=11.2.1]]    greater than or equal to
  [[wasd>11.3.2]]     greater than
  [[wasd!=11.4.0]]    not equal to
  [[wasd!<11.5]]      not less than
  [[wasd!>11]]        not greater than
  [[wasd==*]]         all versions

Any version restricted block can and should be ended using [[wasd==*]]. 


META DIRECTIVES
---------------
A number of directives allow the conditional interpretation of the following or
intervening lines (these are similar in concept to the pre-8.0 mapping rule
conditionals).  The decision statements can be nested up to eight levels.

  if()    if parenthesis expression is true
  elif()  else if parenthesis expression is true
  else    else last if() or elif() expression (or ifif) was false
  unif    unconditional anywhere inside if()..endif block
  ifif    if last if() or elif() expression was true
  endif   end of conditional block

as with the following examples ...

  if(<conditional>) interpret the rest of the line

  if(<conditional>)
     <interpret the block
     up until the corresponding>
  endif

  if(<conditional>)
     <interpret the block
     up until a corresponding>
  else
     <which provides an
     alternative block>
  endif

  if(<conditional>)
     <interpret the block
     up until a corresponding>
  elif(<conditional>)
     <providing a style of
     "case" with an optional>
  else
     <which provides
     a default block>
  endif

  if(<conditional>)
     <interpret the block>
  unif
     <interpret this block
     unconditionally>
  ifif
     <interpret this block
     if the original if was true>
  else
     <interpret this block
     if the original if was false>
  unif
     <interpret this block
     unconditionally>
  else
     <interpret this block
     if the original if was false>
  endif


META DICTIONARY
---------------
The "dict=[<key>[=<value>]]" meta configuration directive allows dictionary
entries to be managed using the same mechansim as the path mapping
"SET dict=[<key>[=<value>]]" directive (in fact path mapping SET uses the
meta-config routine).  Placement of quotes is important, across the entire
"<key>=<value>" string, or they become part of the key and/or value.  A key
value may be set using 

  dict <key-string>=<value-string>
  dict "<key-string>=<value-string>"

(to end of line in the first case and between the quotes in the second) and
removed (deleted) using

  dict <key-string>=

(i.e. an empty value).  A dictionary entry can be set to an empty value by
making the value a single (escaped) backslash (i.e. "\\").  Bit of a kludge but
one is needed for either setting empty or removing, so choose your poison.
 
All meta configuration entries can be removed using

  dict=

Of course dictionary entries can be tested with the "dict:" conditional.

Values from dictionary entries may be substituted using (the somewhat
familiar) ''<key>' syntax when setting dictionary entries (DICT and SET
DICT=..)  These are some examples.

  DICT "first=''user-agent'"
  SET  dict="first=''user-agent'"
  DICT "X-response-header=''host'"
  SET  dict="X-response-header=''host'"
  DICT one=two
  SET  dict=one=two
  DICT three=\"fo\ ur\"
  SET  dict=three=\"fo\ ur\"


META CONDITIONALS
-----------------
Conditionals often use data that can also be found as CGI variables, although
some have no such analogue.  Conditional expressions expecting strings may have
those string enclosed in balanced double or single quotation marks.  Reserved
characters may be escaped using the backslash character.  The following lists
conditionals with a brief explanation of their meaning.

[[wasd*n.n.n]]       server version conditional
[[service]]          virtual service (or [[scheme://service:port]])
                     [[?]] or [[?:port]] for an unknown virtual service
accept:              'Accept:'  (HTTP_ACCEPT)
accept-charset:      'Accept-Charset:'  (HTTP_ACCEPT_CHARSET)
accept-encoding:     'Accept-Encoding:'  (HTTP_ACCEPT_ENCODING)
accept-language:     'Accept-Language:'  (HTTP_ACCEPT_LANGUAGE)
alpn:                TLS application level protocol negotiation
callout:             boolean, true if during a callout, false otherwise
client_connect_gt:   boolean, client greater than number of concurrent requests
cluster_member:      is the specified node a cluster member
command_line:        server startup command line  (qualifiers, etc.)
decnet:              0/4/5 is none/PhaseIV/V
demo:                boolean, true if started /DEMO, false otherwise
dict:                <key>[=<match>]
directory:           if this directory exists (request path if empty)
document-root:       'Document-Root:' (DOCUMENT_ROOT)
file:                if this file (or directory) exists (request path if empty)
http2:               true if underlying protocol is HTTP/2
instance:            test cluster member has a WASD instance (see note below)
jpi_username:        $GETJPI user name  (server process username)
mapped-path:         remainder after script name parsing, or after 'map' rule
meta_agent:          response from v12... meta agent script
multihome:           an IP address if client used IP address different to
                     IP address of the current service (i.e. no service match)
note:                admin mapping notes (via /DO=NOTE= or Server Admin menu)
notepad:             per-request keywords added/modified during mapping
                     NOTEPAD PERSISTS ACROSS INTERNALLY REDIRECTED REQUESTS!
ods:                 on-disk-structure  (2 or 5)
pass:                usually 0, can be 1 or 2 only in second pass of mapping
path-info:           request path  (PATH_INFO)
path-translated:     VMS-style mapped-path (available after mapping)
proctor:             if this is a proctored script activation
query-string:        request query string  (QUERY_STRING)
rand:                random number generator  (see note below)
redirected:          usually 0, can be 1..4 (count internally redirected)
regex:               boolean, true if regular expressions enabled
remote-addr:         client address  (REMOTE_ADDR)
remote-host:         client host name  (REMOTE_HOST)
request:             request fields  (e.g. "Keep-Alive: 300")
request-method:      GET, POST, etc.  (REQUEST_METHOD)
                     "?" for HTTP extension method (i.e. not GET, PUT, etc.)
request_peek:        request peek buffer (443 tunnel processing)
request-protocol:    server/request HTTP protocol ("2", "1.1", "1.0", "0.9")
request-scheme:      request scheme  (REQUEST_SCHEME)
request-uri:         undecoded request line (e.g. /path?query=%20string)
restart:             number of times rule processing restarted (0 is default)
robin:               round-robin between specified node names (see note below)
script-name:         if mapped (or during mapping if pass 2)
server-addr:         server address  (SERVER_ADDR)
server_connect_gt:   boolean, if current server connections greater than
server-name:         server host name  (SERVER_NAME)
server-port:         server port  (SERVER_PORT)
server_process_gt:   boolean, if server processing greater than
server-protocol:     server/request HTTP protocol ("1.1", "1.0", "0.9")
server-software:     server identification string  (SERVER_SOFTWARE)
service:             essentially server-name plus server-port as one string
                     "?" or "?:port" for an unknown virtual service
ssl:                 boolean, if Secure Sockets Layer  (https:)
syi_arch_name:       $GETSYI arch_name  ("Alpha", "IA64" or "VAX")
syi_hw_name:         $GETSYI hw_name
syi_nodename:        $GETSYI nodename
syi_version:         $GETSYI version  (e.g. "V7.3")
tcpip:               identification string generated from UCX$IPC_SHR
time:                system time  (see note below)
trnlnm:              $TRNLNM logical name  (see note below)
upstream-addr:       upstream proxy/accelerator address  (UPSTREAM_ADDR)
webdav:              boolean, request using a WebDAV-specific method
webdav:all           true if path SET webdav=all
webdav:auth          true if path SET webdav=auth
webdav:MSagent       true if a Microsoft WebDAV agent
websocket:           boolean, request is a WebSocket (ws: or wss:)
x509:[keyword[=...]] X509 client certificate

<any-other-field:>   any request header name can be specified (see below)


Request Header Fields
~~~~~~~~~~~~~~~~~~~~~
Any request header field name, known or unknown to the server, can be specified
as a conditional.  This provided in the list immediately above may be processed
in some non-string comparison mode (e.g. the network masks available against
remote-addr:').  This following list provides the current recognised header
fields (may not be exhaustive).

  Accept: Accept-Charset: Accept-Encoding: Accept-Language: Authorization:
  Cache-Control: Connection: Content-Length: Content-Type: Cookie:
  ETag: Expect:
  Forwarded:
  Host:
  If-Match: If-None-Match: If-Modified-Since: If-Unmodified-Since: If-Range:
  Keep-Alive:
  Max-Forwards:
  Origin:
  Pragma: Proxy-Authorization: Range: Referer:
  Trailer: Transfer-Encoding:
  Upgrade: User-Agent:
  WebSocket-Protocol:
  X-Forwarded-For:

And any other field name that can be sent.  If the field is found in the
request header the comparison string is used against the value and the result
returned based on that.  If the field name cannot be found false is always
returned.


Host Addresses
~~~~~~~~~~~~~~
The host names or addresses can be a dotted-decimal network address, a slash,
then a dotted-decimal mask.  For example "131.185.250.0/255.255.255.192".
This has a 6 bit subnet.  It operates by bitwise-ANDing the client host address
with the mask, bitwise-ANDing the network address supplied with the mask, then
comparing the two results for equality.  Using the above example the host
131.185.250.250 would be accepted, but 131.185.250.50 would be rejected. 
Equivalent notation for this rule would be "131.185.250.0/26"


Logical Name Translations
~~~~~~~~~~~~~~~~~~~~~~~~~
The 'trnlnm' conditional dynamically translates a logical name and uses that. 
One mandatory and up to two optional parameters may be supplied.

  trnlnm:logical-name[;name-table][:string-to-match]

The 'logical-name' must be supplied, without it false is always returned.  If
just the 'logical-name' is supplied the conditional returns true if the name
exists or false if it does not.  The default 'name-table' is LNM$FILE_DEV. 
When the optional 'name-table' is supplied the lookup is confined to that
table.  If the optional 'string-to-match' is supplied it is matched against the
value of the logical and the result returned.


Random Numbers
~~~~~~~~~~~~~~
This number is generated once for each pass through a set of rules, and
therefore remains constant during that pass.  The 'rand' conditional is
intended to allow some sort of distribution to be built into a set of rules,
where each pass (request) generates a different one.  The random conditional
accepts two parameters, a 'modulas' number, which is used to modulas the base
number, and a comparison number, which is compared to the modulas result. 
Hence the following conditional rules

  if (rand:3:0)
     <do this>
  elif (rand:3:1)
     <do this>
  else
     <do this>
  endif

would pseudo-randomly generate base numbers of 0, 1, 2 and perform the
appropriate conditional block.  Over a sufficient number of usages this should
produce a relatively even distribution of numbers.  If the modulas is specified
as less than two (i.e. no distribution factor at all) it defaults to 2 (i.e. a
distribution of 50% - the equivalent of a coin toss!)


Client and Server Concurrency
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The client_connect_gt:, server_connect_gt: and server_process_gt: conditionals
attempt to allow some measurement of the number of requests a particular
client currently has being processed (on the local instance), and the total
requests the server (all instances) is currently processing.  Using these
decision critera subsequent request mapping or processing can be undertaken. 
It is not intended to provide fine-grained control over activities, rather just
to prevent a single client (or clients) hogging a sizeable proportion of the
resources.

For example.  If the number of request from one particulat client looks like it
has got out of control (at the client end) then it becomes possible to queue
(throttle) or reject further requests.  In WASD_CONFIG_MAP

  if (client_connect_gt:10) set * throttle=10

  if (client_connect_gt:10) \
     pass * "503 Your client is exceeding its concurrency limit!"

While not completely foolproof it does offer some measure of control over
client concurrency and server behaviour under specified loads.


System Time
~~~~~~~~~~~
The time: conditional allows server behaviour to change according to the time
of day (or even year), comparing the supplied parameter to the current system
time in one of three forms.

1) A twenty-four hour clock range as 'hhmm-hhmm', for example '1200-1759',
which should be read as "twelve noon to five fifty-nine PM" (i.e.  as a time
range in minutes), where the first is the start time and the second the end
time of a range.  If the current time is within that range (inclusive) the
conditional returns true, otherwise false.  If the range doesn't look correct
false is always returned.

2) A single digit, '1'..'7', representing the day of the week, where 1 is
Monday, 2 is Tuesday .. 7 is Sunday.  Not exactly the historical way of
numbering weekdays (ask any student of Judaism) but it is what
lib$day_of_week() returns :^)

3) The final way (if neither of the above) is as a string match with a VMS
comparision time (i.e. 'yyyy-mmm-dd hh-mm-ss.hh').

Some examples:

  if (time:0000-0000)
     <it's midnight>
  elif (time:0001-1159)
     <it's AM>
  elif (time:1200-1200)
     <it's noon>
  else
     <it's PM>
  endif

  if (time:6 || time:7)
     <it's the weekend>
  else
     <it's the working week>
  endif

  if (time:%%%%-05-*)
     <it's the month May>
  endif


Instance
~~~~~~~~
The instance: directive allows testing for a particular cluster member having a
WASD instance currently running.  This can allow requests to be redirected or
reverse-proxied to a particular system with the knowlege that it should be
processed (of course there is a small window of uncertainty as events such as
system shutdown and startup occur asynchronously).  The behaviour of the
conditional block is entirely determinate based on which node names have a WASD
instance and the order of evaluation.  Compare this to a similar construct
using the robin: directive, as described below.                 

This conditional is deployed in two phases.  In the first, it contains a
comma-separated list of node names (that are expected to have instances of WASD
instantiated).  In the second, containing a single node name, allowing the
selected node to be tested.  For example.

  if (instance:NODE1,NODE2,NODE3)
     if (instance:NODE1) redirect /* http://node1.domain.name/*?
     if (instance:NODE2) redirect /* http://node2.domain.name/*?
     if (instance:NODE3) redirect /* http://node3.domain.name/*?
     pass * "500 Some sort of logic error!!"
  endif
  pass * "503 No instance currently available!"

If none of the node names specified in the first phase is currently running a
WASD instance the rule returns false, otherwise true.  If true the above
example has conditional block processed with each of the node names
successively tested.  If NODE1 has a WASD instance executing it returns true
and the associated redirect is performed.  The same for NODE2 and NODE3.  At
least one of these would be expected to test true otherwise the outer
conditional established during phase one would have been expected to return
false.


Round-Robin
~~~~~~~~~~~
The robin: conditional allows rules to be applied sequentially against
specified members of a cluster that currently have instances of WASD running.
This is obviously intended to allow a form of load sharing and/or with
redundancy (not balancing, as no evaluation of the selected target's current
workload is performed, see below).  As with the instance: directive above,
there is, of course, a small window of potential uncertainty as events such as
system shutdown and startup occur asynchronously and may impact availability
between the phase one test and ultimate request distribution.

This conditional is again used in two phases.  The first, containing a
comma-separated list of node names (that are expected to have instances of WASD
instantiated).  The second, containing a single node name, allowing the
selected node (from phase one) to have a rule applied.  For example.

  if (robin:VAX1,ALPHA1,ALPHA2,IA64A)
     if (robin:VAX1) redirect /* http://vax1.domain.name/*?
     if (robin:ALPHA1) redirect /* http://alpha1.domain.name/*?
     if (robin:ALPHA2) redirect /* http://alpha2.domain.name/*?
     if (robin:IA64A) redirect /* http://ia64a.domain.name/*?
     pass * "500 Some sort of logic error!!"
  endif
  pass * "503 No round-robin node currently available!"

In this case round-robining will be made through four node names.  Of course
these do not have to represent all the systems in the cluster currently
available or having WASD instantiated.  The first time the 'robin:' rule
containing multiple names is called VAX1 will be selected.  The second time
ALPHA1, the third ALPHA2, and the fourth IA64A.  With the fifth call VAX1 is
returned to, the sixth ALPHA1, etc.  In addition, the selected nodename is
verified to have a instance of WASD currently running (using the DLM and WASD's
instance awareness).  If it does not, round-robining is applied again until one
is found (if none is available the phase one conditional returns false).  THIS
IS MOST SIGNIFICANT as it ensures that the selected node should be able to
respond to a redirected or (reverse-)proxied requested.  This is the selection
set-up phase.

Then there is the selection application phase.  Inside the set-up conditional
other conditionals APPLY the selection made in the first phase (through simple
nodename string comparison).  The rule, in the above example a redirect, is
applied if that was the node selected.

During selection set-up unequal weighting can be applied to the round-robin
algorithm by including particular node names more than once.

  if (robin:VAX1,ALPHA,VAX2,ALPHA)

In the above example, the node ALPHA will be selected twice as often as either
of VAX1 and VAX2 (and because of the ordering interleaved with the VAX
selections).


EXAMPLES
--------

  if( host:10.64.1.0/24 )
    pass /* /area-1/*
  elif( host:10.64.2.0/24 )
    pass /* /area-2/*
  else
    pass /* /default/*
  endif


VERSION HISTORY
---------------
18-FEB-2021  MGD  !#-- and !#++ selectively disable/(re)enable WATCH reporting
16-OCT-2020  MGD  webdav:all and webdav:auth
26-SEP-2020  MGD  webdav: result include ->WhiffOfWebDav
15-MAR-2020  MGD  add "alpn:<string>" TLS application level protocol negotiation
                  add "proctor:" explicitly documents proctored clause
                  bugfix; MetaConConditionalList() buggered
04-AUG-2018  MGD  bugfix; MetaConEvaluate() "webdav:MSagent"
19-JUL-2016  MGD  bugfix; MetaConEvaluate() request:, path-translated:
                    connect_gt: regressions
04-JUL-2016  MGD  bugfix; MetaConEvaluate() request-scheme: regression (ARGH!)
22-MAY-2016  MGD  add [[wasd*n.n.n]] server version conditional
                  bugfix; MetaConEvaluate() request-scheme: regression
19-DEC-2015  MGD  add "dict:<key>[=<match>]
                  add "X509:[=keyword[=...]"
                  significant rework of conditional processing
26-OCT-2015  MGD  add "request-protocol" specifically to support HTTP/2
03-OCT-2015  MGD  add "http2:" to test if HTTP/2 underlying protocol
16-APR-2015  JPP  when "remote-addr:" begins '?' translate host to IP address
12-NOV-2014  MGD  add "upstream-addr:" for "SET client=" detection
11-FEB-2012  MGD  MetaConLoad() compress non-signficant white-space
                  MetConSameField() more efficient if not inline
14-MAR-2011  MGD  MetaConLoad() ensure metacon "lines" are quadword aligned
05-SEP-2010  MGD  add "request_peek:" supporting [ServiceShareTLS] tunneling
                  lines beginning "!#" are now configured allowing WATCHable
                    commentary to be inserted into configuration files
08-JUN-2010  MGD  bugfix; MetaConEvaluate() when JustChecking: HTTP header
                  fields (e.g. "cookie:") 
29-MAY-2010  MGD  add "file:" and "directory:" to probe file-system
21-JAN-2010  MGD  add "websocket:" for WebSocket-specific requests
                  add "Origin:", "Upgrade:", "WebSocket-Protocol:" headers
13-OCT-2009  MGD  allow for []-delimited IPv6 address (as service names)
05-SEP-2009  MGD  allow "pass:-1" to indicate reverse-mapping
28-MAY-2008  MGD  add "request-uri:"
23-APR-2007  MGD  add "webdav:" for WebDAV-specific requests
15-SEP-2005  MGD  add "server-protocol:" (lamentable oversight)
10-JUL-2005  MGD  [[?]] and service:? to match unknown virtual service
13-JUN-2005  MGD  bugfix; MetaConLoad() allocate structure before non-filename
                  return! (revealed by Alex Daniels with no HTTPD$SERVICE)
26-MAY-2005  MGD  add "note:" to allow testing of admin mapping notes
01-MAY-2005  MGD  add "instance:" to allow testing of cluster WASD instances,
                  add "robin:" to allow 'round-robin'ing cluster instances,
                  bugfix; MetaConSameField(cptr,"syi_arch_name:")
20-APR-2005  MGD  add "multihome:" to allow detection of multihomed
                  IP addresses with mismatched services
04-MAR-2005  MGD  allow config files to be a logical search list
                  (initially to support multiple language HTTPD$MSG files)
02-OCT-2004  MGD  bugfix; MetaconClientConcurrent() if IP address not the same!
12-AUG-2004  MGD  MetaConShowSeconds()
28-JUL-2004  MGD  'request-method:?' now tests for an HTTP extension method,
                  any recognised request header field can now be used as
                  a conditional directive (e.g. "if-none-match:"),
                  made directive matching precise (MetaConSameField())
26-JAN-2004  MGD  add server_process_gt:, change to client_connect_gt: and
                  server_connect_gt: to better reflect functionality
29-DEC-2003  MGD  add client_current_gt: and server_current_gt:
04-OCT-2003  MGD  [ConfigDirectory] and [ConfigFile],
                  add "document-root:" (set map=root=<string>)
28-SEP-2003  MGD  add "callout:" in progress?
09-MAY-2003  MGD  regular expression support,
                  add  "notepad:", "regex:", "request:", "restart:"
22-APR-2003  MGD  bugfix; MetaConParse() decrement index (back) when
                  not currently executing an if()inline directive
02-APR-2003  MGD  add "x-forwarded-for:"
28-JAN-2003  MGD  allow [[service]] to include the [[scheme://service]]
06-NOV-2002  MGD  add "mapped-path:" (can be different to path-info)
                  add "path-translated:" (for use in authorization rules)
                  add "script-name:" (if mapped or in second pass)
                  add "redirected:[digit]" (can be used as a boolean)
12-OCT-2002  MGD  refine reporting
05-OCT-2002  MGD  add "pass:1", "pass:2" (for mapping) and "demo:"
24-SEP-2002  MGD  bugfix; expressions with inline statements
21-SEP-2002  MGD  bugfix; MetConLoad() return RMS status
24-AUG-2002  MGD  add "ods:pwk" and "ods:sri" to ods: conditional
16-APR-2002  MGD  add "unif" and "ifif" conditional statements
                  and a swag of new conditional directives
06-APR-2002  MGD  bugfix; MetaConParse() return double-null empty strings
                  to avoid having them mistaken for error strings (VAX)
11-AUG-2001  MGD  initial
*/
#endif /* COMMENTS_WITH_COMMENTS */
/*****************************************************************************/

#ifdef WASD_VMS_V7
#undef _VMS__V6__SOURCE
#define _VMS__V6__SOURCE
#undef __VMS_VER
#undef __VMS_VER
#undef __CRTL_VER
#define __CRTL_VER 70000000
#endif

/* standard C header files */
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>

/* VMS related header files */
#include <lnmdef.h>
#include <syidef.h>

/* application related header files */
#include "wasd.h"

#define WASD_MODULE "METACON"

/******************/
/* global storage */
/******************/

/* mainline configuration plus depth of four [IncludeFile] or [ConfigFile] */
#define METACON_FILE_DEPTH_MAX 4

#define METACON_STACK_MAX 16

META_CONFIG  *MetaGlobalAuthPtr,
             *MetaGlobalConfigPtr,
             *MetaGlobalMappingPtr,
             *MetaGlobalMsgPtr,
             *MetaGlobalServicePtr;

int  MetaConInstanceListCount;
char  *MetaConInstanceListPtr = "";

BOOL  MetaConNoteValid;
char  MetaConNote [LOCK_VALUE_BLOCK_64];

BOOL  MetaConAgentUsed;
char  MetaConAgentScript [] = "/cgiplus-bin/metagent";
char  ProblemMetaConAgent [] = "Problem initiating META agent";

#define METACON_AGENT_ACTIVE_MAX 8
#define METACON_AGENT_BUSY_MAX 100
static int  MetaConAgentActiveCount,
            MetaConAgentActiveMax = METACON_AGENT_ACTIVE_MAX,
            MetaConAgentBusyMax = METACON_AGENT_BUSY_MAX;
            MetaConAgentBusyCount,
            MetaConAgentBusyLimit;

/********************/
/* external storage */
/********************/

extern BOOL  CliDemo,
             NetAcceptAgent,
             TcpIpLookupAgent;

extern int  EfnWait,
            HttpdDayOfWeek,
            HttpdServerExecuting,
            HttpdServerStartup,
            InstanceNodeCurrent,
            InstanceNodeJoiningCount,
            InstanceNumber,
            NetCurrentProcessing,
            OpcomMessages;

extern int64  HttpdTime64;

extern const int64  Delta100mSec;

ulong  HttpdVersionNumber;

extern int  ToLowerCase[],
            ToUpperCase[];

extern ushort  HttpdTime7[];

extern ulong  SysPrvMask[];

extern char  CommandLine[],
             ErrorSanityCheck[],
             SoftwareId[],
             TcpIpAgentInfo[];

extern LIST_HEAD  RequestList;

extern ACCOUNTING_STRUCT  *AccountingPtr;
extern CONFIG_STRUCT  Config;
extern HTTPD_GBLSEC  *HttpdGblSecPtr;
extern HTTPD_PROCESS  HttpdProcess;
extern MSG_STRUCT  Msgs;
extern SYS_INFO  SysInfo;
extern WATCH_STRUCT  Watch;

/*****************************************************************************/
/*
Load the contents of the specific file into a METACON configuration file
structure.  Allow the file to [IncludeFile].  Two passes are made through the
primary and any included files.  The first is used to determine how much space
needs to be allocated for METACON structure.  The second populates it once
allocated.
*/

int MetaConLoad
(
META_CONFIG **MetaConPtrPtr,
char *FileName,
CALL_BACK CallBackFunction,
BOOL ContinueLines,
BOOL ReportVirtualService
)
{
   static ulong  LnmIndex;
   static $DESCRIPTOR (LogNameDsc, "");
   static $DESCRIPTOR (LnmFileDevDsc, "LNM$FILE_DEV");
   static ulong  LnmAttributes;
   static VMS_ITEM_LIST3
   LnmItems [] =
   {
      { sizeof(LnmIndex), LNM$_INDEX, &LnmIndex, 0 },
      { sizeof(LnmAttributes), LNM$_ATTRIBUTES, &LnmAttributes, 0 },
      { 0, LNM$_STRING, 0, 0 },
      { 0,0,0,0 }
   };

#if WATCH_MOD
   /* for testing purposes only */
   BOOL  TestToken = false;
#endif

   BOOL  ok,
         NotThisVersion,
         WatchInactive,
         WatchThisOne;
   int  status,
        ByteCount,
        BytesAligned,
        FlowControlLevel,
        MetaFileLevel,
        ParseNumber,
        TotalLineCount;
   int  MetaFileType [METACON_FILE_DEPTH_MAX+1];
   ushort  LogValueLength;
   ulong  LnmCount;
   char  ch;
   char  *cptr, *sptr, *tptr, *zptr,
         *BackslashMeans,
         *InlinePtr;
   char  ConfigDirectory [METACON_CONFIG_DIR_LENGTH+1],
         LogValue [256],
         MetaFileName [ODS_MAX_FILE_NAME_LENGTH+1];
   ODS_STRUCT  ConfigFileOds [METACON_FILE_DEPTH_MAX+1];
   ODS_STRUCT  *odsptr;
   META_CONFIG  *mcptr;
   METACON_LINE  *mclptr,
                 *NextLinePtr;

   /*********/
   /* begin */
   /*********/

   if (WATCH_MODULE(WATCH_MOD_METACON))
      WatchThisOne = true;
   else
      WatchThisOne = false;

   if (WATCH_MOD && WatchThisOne)
      WatchThis (WATCHALL, WATCH_MOD_METACON,
                 "MetaConLoad() !&Z !&A !&B !&B",
                 FileName, CallBackFunction,
                 ContinueLines, ReportVirtualService);

   WatchInactive = false;
   ByteCount = sizeof(META_CONFIG);

   /* allocate a structure that will be used only for problem reports */
   mcptr = (META_CONFIG*)VmGet(ByteCount);
   *MetaConPtrPtr = mcptr;

   /* if there is no file to load and we just want the structure */
   if (!FileName) return (SS$_NORMAL);

   if (ContinueLines)
      BackslashMeans = '\\';
   else
      BackslashMeans = '\n';

   /* use SYSPRV to allow access to possibly protected files */
   sys$setprv (1, &SysPrvMask, 0, 0);

   LogNameDsc.dsc$w_length = strlen(FileName);
   LogNameDsc.dsc$a_pointer = FileName;

   LnmItems[2].buf_len = sizeof(LogValue)-1;
   LnmItems[2].buf_addr = LogValue;
   LnmItems[2].ret_len = &LogValueLength;

   for (LnmIndex = 0; LnmIndex <= 127; LnmIndex++)
   {
      status = sys$trnlnm (0, &LnmFileDevDsc, &LogNameDsc, 0, &LnmItems);
      if (VMSnok (status)) ErrorExitVmsStatus (status, FileName, FI_LI);
      if (!(LnmAttributes & LNM$M_EXISTS)) break;
      LogValue[LogValueLength] = '\0';
      if (WATCH_MODULE(WATCH_MOD_MSG))
         WatchThis (WATCHALL, WATCH_MOD_MSG, "!UL !AZ",
                    LnmIndex, LogValue);
   }
   LnmCount = LnmIndex;

   /********************/
   /* preliminary pass */
   /********************/

   mcptr->LnmCount = LnmCount;

   MetaFileLevel = TotalLineCount = 0;
   ConfigDirectory[0] = MetaFileName[0] = '\0';
   odsptr = mcptr->CurrentOdsPtr = &ConfigFileOds[MetaFileLevel];

   for (LnmIndex = 0; LnmIndex <= 127; LnmIndex++)
   {
      status = sys$trnlnm (0, &LnmFileDevDsc, &LogNameDsc, 0, &LnmItems);
      if (VMSnok (status)) ErrorExitVmsStatus (status, FileName, FI_LI);
      if (!(LnmAttributes & LNM$M_EXISTS)) break;
      if (LnmIndex+1 > LnmCount)
         ErrorExitVmsStatus (SS$_BUGCHECK, FileName, FI_LI);
      LogValue[LogValueLength] = '\0';
      mcptr->LnmIndex = LnmIndex;
      if (WATCH_MOD && WatchThisOne)
         WatchThis (WATCHALL, WATCH_MOD_METACON,
                    "!UL !&Z", LnmIndex, LogValue);

      status = OdsLoadTextFile (odsptr, LogValue);
      if (VMSnok (status))
      {
         sys$setprv (0, &SysPrvMask, 0, 0);
         MetaConReport (mcptr, METACON_REPORT_ERROR,
                        "Error opening !AZ, !&m", LogValue, status);
         return (status);
      }

      for (;;)
      { 
         if (!(cptr = OdsParseTextFile (odsptr, BackslashMeans)))
         {
            /* end of source file */
            OdsFreeTextFile (odsptr);
            mcptr->CurrentOdsPtr = NULL;
            /* if original (not an included) file then break */
            if (!MetaFileLevel) break;
            /* nest out of an included file */
            odsptr = mcptr->CurrentOdsPtr = &ConfigFileOds[--MetaFileLevel];
            continue;
         }

         TotalLineCount++;
         /* skip over leading white-space */
         while (*cptr && ISLWS(*cptr)) cptr++;

         /* if a blank line */
         if (!*cptr) continue;
         /* if a comment line and not comment-include line */
         if (*cptr == '#' || *cptr == '!')
            if (!SAME2(cptr,'!#')) continue;

         /* compress white-space */
         sptr = tptr = cptr;
         while (ch = *tptr)
         {
            if (ch == '\"' || ch == '\'')
            {
               *sptr++ = *tptr++;
               while (*tptr && *tptr != ch)
               {
                  /* step over any escape character */
                  if (*tptr == '\\' && *(tptr+1)) *sptr++ = *tptr++;
                  *sptr++ = *tptr++;
               }
               continue;
            }
            *sptr++ = *tptr++;
            if (ISLWS(ch)) while (ISLWS(*tptr)) tptr++;
         }
         *sptr++ = '\0';

         ByteCount += sizeof(METACON_LINE) + (sptr - cptr);
         /* ensure it allows for the quadword alignment */
         if (ByteCount % 8) ByteCount += 8 - (ByteCount % 8);

         if (WATCH_MOD && WatchThisOne)
            WatchDataFormatted ("!UL {!UL}!-!#AZ\n",
                                ByteCount, strlen(cptr), cptr);

         if (strsame (cptr, "[ConfigDirectory]", 17))
         {
            /********************/
            /* config directory */
            /********************/

            cptr += 17;
            /* skip over intervening white-space */
            while (*cptr && ISLWS(*cptr)) cptr++;

            if (!MetaFileLevel)
            {
               /* can be an empty string, which resets the directory */
               zptr = (sptr = ConfigDirectory) + sizeof(ConfigDirectory)-1;
               while (*cptr && !ISLWS(*cptr) && sptr < zptr) *sptr++ = *cptr++;
               *sptr = '\0';
            }
            continue;
         }
         else
         if (strsame (cptr, "[ConfigFile]", 12))
         {
            /* config file statement */
            cptr += 12;
            /* skip over intervening white-space */
            while (*cptr && ISLWS(*cptr)) cptr++;

            if (MetaFileLevel > METACON_FILE_DEPTH_MAX) continue;

            zptr = (sptr = MetaFileName) + sizeof(MetaFileName)-1;
            /* if the file name is not absolute then include any directory */
            for (tptr = cptr; *tptr && *tptr != ':'; tptr++);
            if (!*tptr)
               for (tptr = ConfigDirectory;
                    *tptr && sptr < zptr;
                    *sptr++ = *tptr++);
            while (*cptr && !ISLWS(*cptr) && sptr < zptr) *sptr++ = *cptr++;
            *sptr = '\0';
            odsptr = mcptr->CurrentOdsPtr = &ConfigFileOds[++MetaFileLevel];
            status = OdsLoadTextFile (odsptr, MetaFileName);
            if (VMSnok (status))
               odsptr = mcptr->CurrentOdsPtr = &ConfigFileOds[--MetaFileLevel];
         }
         else
         if (strsame (cptr, "[IncludeFile]", 13))
         {
            /* include file statement */
            cptr += 13;
            /* skip over intervening white-space */
            while (*cptr && ISLWS(*cptr)) cptr++;

            if (MetaFileLevel > METACON_FILE_DEPTH_MAX) continue;

            zptr = (sptr = MetaFileName) + sizeof(MetaFileName)-1;
            while (*cptr && !ISLWS(*cptr) && sptr < zptr) *sptr++ = *cptr++;
            *sptr = '\0';
            odsptr = mcptr->CurrentOdsPtr = &ConfigFileOds[++MetaFileLevel];
            status = OdsLoadTextFile (odsptr, MetaFileName);
            if (VMSnok (status))
            {
               odsptr = mcptr->CurrentOdsPtr = &ConfigFileOds[--MetaFileLevel];
               if (OpcomMessages)
                  FaoToOpcom (
"%HTTPD-E-INCLUDE, failed to include !AZ (!&m) by !AZ",
                              MetaFileName, status, odsptr->ExpFileName);
            }
         }
      }
   }

   /* terminating empty (zero-length) line */
   ByteCount += sizeof(METACON_LINE);

   /* dispose of the previously allocated structure */
   MetaConUnload (&mcptr, NULL);

   /*****************/
   /* populate pass */
   /*****************/

   mcptr = (META_CONFIG*)VmGet(ByteCount);
   *MetaConPtrPtr = mcptr;

   if (WATCH_MOD && WatchThisOne)
      WatchThis (WATCHALL, WATCH_MOD_METACON, "!&X", mcptr);

   NotThisVersion = false;
   mcptr->ThisSize = ByteCount;
   mcptr->LineCount = TotalLineCount;
   mcptr->ContentPtr = mcptr->ParsePtr = mclptr = &mcptr->Lines;

   mcptr->LnmCount = LnmCount;
   if (mcptr->LnmCount > 1) mcptr->IncludeFile = true;

   /* due to some peculiarity with ANSI aliasing rules (BADANSIALIAS)! */
   mcptr->LoadReport.ErrorCount = 0;
   mcptr->LoadReport.InformCount = 0;
   mcptr->LoadReport.ItemCount = 0;
   mcptr->LoadReport.WarningCount = 0;

   sys$gettim (&mcptr->LoadReport.LoadTime64);

   MetaFileLevel = FlowControlLevel = ParseNumber = 0;
   ConfigDirectory[0] = MetaFileName[0] = '\0';
   MetaFileType[MetaFileLevel] = METACON_TYPE_FILE;
   odsptr = mcptr->CurrentOdsPtr = &ConfigFileOds[MetaFileLevel];

   for (LnmIndex = 0; LnmIndex <= 127; LnmIndex++)
   {
      status = sys$trnlnm (0, &LnmFileDevDsc, &LogNameDsc, 0, &LnmItems);
      if (VMSnok (status)) ErrorExitVmsStatus (status, FileName, FI_LI);
      if (!(LnmAttributes & LNM$M_EXISTS)) break;
      if (LnmIndex+1 > LnmCount)
         ErrorExitVmsStatus (SS$_BUGCHECK, FileName, FI_LI);
      LogValue[LogValueLength] = '\0';
      mcptr->LnmIndex = LnmIndex;

      status = OdsLoadTextFile (odsptr, LogValue);
      if (VMSnok (status))
      {
         sys$setprv (0, &SysPrvMask, 0, 0);
         MetaConReport (mcptr, METACON_REPORT_ERROR,
                        "Error opening !AZ, !&m", FileName, status);
         return (SS$_ABORT);
      }

      strcpy (mcptr->LoadReport.FileName, odsptr->ResFileName);
      mcptr->LoadReport.FileTime64 = odsptr->XabDat.xab$q_rdt;

      /* initial callback to allow pre-configuration initialization */
      mcptr->ParsePtr = mclptr;
      mclptr->Token = METACON_TOKEN_PRE;
      if (CallBackFunction)
         ok = (*CallBackFunction)(mcptr);
      else
         ok = true;

      while (ok)
      { 
         /*************/
         /* next line */
         /*************/

         if (!(cptr = OdsParseTextFile (odsptr, BackslashMeans)))
         {
            /* end of source file */
            OdsFreeTextFile (odsptr);
            mcptr->CurrentOdsPtr = NULL;
            /* if original (not an included) file then break */
            if (!MetaFileLevel) break;
            /* nest out of an included file */
            odsptr = mcptr->CurrentOdsPtr = &ConfigFileOds[--MetaFileLevel];
            continue;
         }

         /* skip over any text leading white-space */
         while (*cptr && ISLWS(*cptr)) cptr++;
         /* if a blank line */
         if (!*cptr) continue;

         /* if a comment line and not comment-include line */
         if (*cptr == '#' || *cptr == '!')
            if (!SAME2(cptr,'!#')) continue;

         /* point to the string storage area of that "line" */
         sptr = mclptr->TextPtr = (char*)&mclptr->Storage;

         /* copy remainder of the line compressing white-space */
         tptr = cptr;
         while (ch = *tptr)
         {
            if (ch == '\"' || ch == '\'')
            {
               *sptr++ = *tptr++;
               while (*tptr && *tptr != ch)
               {
                  /* step over any escape character */
                  if (*tptr == '\\') *sptr++ = *tptr++;
                  if (*tptr) *sptr++ = *tptr++;
               }
               if (*tptr) *sptr++ = *tptr++;
            }
            else
               *sptr++ = *tptr++;
            if (ISLWS(ch)) while (ISLWS(*tptr)) tptr++;
         }
         *sptr++ = '\0';

         /* quadword alignment!! */
         if ((ulong)sptr % 8) sptr += 8 - ((ulong)sptr % 8);

         InlinePtr = "";
         mclptr->Size = sptr - (char*)mclptr;

         /* quick sanity check might be opportune at this point */
         if (sptr > (char*)mcptr + ByteCount)
            ErrorExitVmsStatus (SS$_BUGCHECK, ErrorSanityCheck, FI_LI);

         /* point at the next "line" - already quadword aligned of course! */
         NextLinePtr = (METACON_LINE*)sptr;

         mclptr->Number = ++ParseNumber;
         mclptr->VersionNumber = -1;
         NotThisVersion = false;

         if (strsame (cptr, "[[wasd", 6) &&
             (cptr[6] == '!' || cptr[6] == '=' || 
              cptr[6] == '<' || cptr[6] == '>'))
         {
            /****************/
            /* wasd-version */
            /****************/

            mclptr->Token = METACON_TOKEN_VERSION;
            mclptr->FlowControlLevel = FlowControlLevel = 0;

            /* eliminate the leading "[[" and trailing "]]" */
            sptr = mclptr->TextPtr;
            for (cptr = mclptr->TextPtr + 2;
                 *cptr && *cptr != ']';
                 *sptr++ = *cptr++);
            *sptr = '\0';

            /* e.g. "[[wasd==11.0.1]]", "[[wasd<11.1]]", "[[wasd!=11.2]]" */
            cptr = mclptr->TextPtr + 4;
            *(USHORTPTR)mclptr->VersionCompare = 0;
            if (*cptr == '!' || *cptr == '=' || *cptr == '<' || *cptr == '>')
            {
               mclptr->VersionCompare[0] = *cptr++;
               if (*cptr == '=' || *cptr == '<' || *cptr == '>')
                  mclptr->VersionCompare[1] = *cptr++;
            }

            if (*cptr == '*')
            {
               /* only valid uses of '*' are [[wasd=*]] and [[wasd==*]] */
               if (mclptr->VersionCompare[0] != '=')
                  *(USHORTPTR)mclptr->VersionCompare = 0;
               else
                  mclptr->VersionNumber = -1;
            }
            else
            {
               mclptr->VersionNumber = atoi(cptr) * 10000;
               while (isdigit(*cptr)) cptr++;
               if (*cptr == '.') cptr++;
               mclptr->VersionNumber += atoi(cptr) * 100;
               while (isdigit(*cptr)) cptr++;
               if (*cptr == '.') cptr++;
               mclptr->VersionNumber += atoi(cptr);
            }

            switch (*(USHORTPTR)mclptr->VersionCompare)
            {
               case '=\0' :
               case '==' :
                  if (mclptr->VersionNumber == -1)
                     NotThisVersion = false;
                  else
                     NotThisVersion = HttpdVersionNumber !=
                                      mclptr->VersionNumber;
                  break;
               case '!=' :
                  NotThisVersion = HttpdVersionNumber == mclptr->VersionNumber;
                  break;
               case '<\0' :
                  NotThisVersion = HttpdVersionNumber >= mclptr->VersionNumber;
                  break;
               case '!>' :
               case '<=' :
                  NotThisVersion = HttpdVersionNumber > mclptr->VersionNumber;
                  break;
               case '>\0' :
                  NotThisVersion = HttpdVersionNumber <= mclptr->VersionNumber;
                  break;
               case '!<' :
               case '>=' :
                  NotThisVersion = HttpdVersionNumber < mclptr->VersionNumber;
                  break;
               default :
                  NotThisVersion = true;
                  MetaConReport (mcptr, METACON_REPORT_ERROR,
                                "Version conditional not understood");
                  mclptr->ConfigProblem = true;
            }

            if (mclptr->VersionNumber != -1 &&
                mclptr->VersionNumber < 110000)
            {
               NotThisVersion = true;
               MetaConReport (mcptr, METACON_REPORT_ERROR,
                              "Version conditional less than v11.0");
               mclptr->ConfigProblem = true;
               continue;
            }
         }

         if (strsame (cptr, "if(", 3) ||
             strsame (cptr, "if ", 3))
         {
            /******/
            /* if */
            /******/

            mclptr->Token = METACON_TOKEN_IF;
            mclptr->FlowControlLevel = FlowControlLevel++;
            mclptr->MetaFileLevel = MetaFileLevel;
            mclptr->MetaFileType = MetaFileType[MetaFileLevel];
            /* perform a basic syntax check */
            InlinePtr = MetaConEvaluate (mclptr);
            if (*InlinePtr || SAME4 (InlinePtr, '\0\0\0\1'))
            { 
               /* inline directive (true or false) */
               mclptr->FlowControlLevel = --FlowControlLevel;
               mclptr->MetaFileLevel = MetaFileLevel;
               mclptr->MetaFileType = MetaFileType[MetaFileLevel];
            }
            else
            if (!*InlinePtr && *(InlinePtr+1))
               MetaConReport (mcptr, METACON_REPORT_ERROR, "!AZ", InlinePtr+1);
         }
         else
         if (strsame (cptr, "unif", 4))
         {
            /********/
            /* unif */
            /********/

            mclptr->Token = METACON_TOKEN_UNIF;
            mclptr->FlowControlLevel = FlowControlLevel;
            mclptr->MetaFileLevel = MetaFileLevel;
            mclptr->MetaFileType = MetaFileType[MetaFileLevel];
            while (*cptr && !ISLWS(*cptr)) cptr++;
            while (*cptr && ISLWS(*cptr)) cptr++;
            if (*cptr) InlinePtr = cptr;
         }
         else
         if (strsame (cptr, "ifif", 4))
         {
            /********/
            /* ifif */
            /********/

            mclptr->Token = METACON_TOKEN_IFIF;
            mclptr->FlowControlLevel = FlowControlLevel;
            mclptr->MetaFileLevel = MetaFileLevel;
            mclptr->MetaFileType = MetaFileType[MetaFileLevel];
            while (*cptr && !ISLWS(*cptr)) cptr++;
            while (*cptr && ISLWS(*cptr)) cptr++;
            if (*cptr) InlinePtr = cptr;
         }
         else
         if (strsame (cptr, "elif(", 5) ||
             strsame (cptr, "elif ", 5))
         {
            /********/
            /* elif */
            /********/

            mclptr->Token = METACON_TOKEN_ELIF;
            mclptr->FlowControlLevel = FlowControlLevel;
            mclptr->MetaFileLevel = MetaFileLevel;
            mclptr->MetaFileType = MetaFileType[MetaFileLevel];
            /* perform a basic syntax check */
            InlinePtr = MetaConEvaluate (mclptr);
            if (!*InlinePtr && *(InlinePtr+1))
               MetaConReport (mcptr, METACON_REPORT_ERROR, "!AZ", InlinePtr+1);
         }
         else
#if WATCH_MOD
         if (strsame (cptr, "test(", 5) ||
             strsame (cptr, "test ", 5))
         {
            /********/
            /* test */
            /********/

            mclptr->Token = METACON_TOKEN_TEST;
            mclptr->FlowControlLevel = FlowControlLevel;
            mclptr->MetaFileLevel = MetaFileLevel;
            mclptr->MetaFileType = MetaFileType[MetaFileLevel];
            TestToken = true;
            /* perform a a basic syntax check */
            InlinePtr = MetaConEvaluate (mclptr);
            if (!*InlinePtr && *(InlinePtr+1))
               MetaConReport (mcptr, METACON_REPORT_ERROR, "!AZ", InlinePtr+1);
         }
         else
#endif /* WATCH_MOD */
         if (strsame (cptr, "else", 4))
         {
            /********/                  
            /* else */
            /********/

            mclptr->Token = METACON_TOKEN_ELSE;
            mclptr->FlowControlLevel = FlowControlLevel;
            mclptr->MetaFileLevel = MetaFileLevel;
            mclptr->MetaFileType = MetaFileType[MetaFileLevel];
            while (*cptr && !ISLWS(*cptr)) cptr++;
            while (*cptr && ISLWS(*cptr)) cptr++;
            if (*cptr) InlinePtr = cptr;
         }
         else
         if (strsame (cptr, "endif", 5))
         {
            /*********/
            /* endif */
            /*********/

            mclptr->Token = METACON_TOKEN_ENDIF;
            if (FlowControlLevel > 0) FlowControlLevel--;
            mclptr->FlowControlLevel = FlowControlLevel;
            mclptr->MetaFileLevel = MetaFileLevel;
            mclptr->MetaFileType = MetaFileType[MetaFileLevel];
         }
         else
         if (SAME2(cptr,'[['))
         {
            /*******************/
            /* virtual-service */
            /*******************/

            mclptr->Token = METACON_TOKEN_SERVICE;
            mclptr->FlowControlLevel = FlowControlLevel = 0;

            /* eliminate the leading "[[" and trailing "]]" */
            sptr = mclptr->TextPtr;
            cptr = mclptr->TextPtr + 2;
            if (*cptr == '[' ||
                strsame (cptr, "http://[", 8) ||
                strsame (cptr, "https://[", 9))
            {
               /* IPv6 address */
               while (*cptr && *cptr != ']') *sptr++ = *cptr++; 
               if (SAME2(cptr,']]') && !SAME2(cptr+1,']]'))
               {
                  MetaConReport (mcptr, METACON_REPORT_ERROR,
                                 "IPv6 address format problem");
                  mclptr->ConfigProblem = true;
               }
               else
               if (*cptr)
                  *sptr++ = *cptr++;
            }
            else
               while (*cptr && *cptr != ':' && *cptr != ']')
                   *sptr++ = *cptr++;

            if (*cptr == ':')
               while (*cptr && *cptr != ']') *sptr++ = *cptr++;
            else
               /* no port component, add a wildcard */
               for (cptr = ":*"; *cptr; *sptr++ = *cptr++);
            *sptr++ = '\0';

            if (ReportVirtualService)
            {
               cptr = mclptr->TextPtr;
               if (SAME4 (cptr, 'http'))
               {
                  if (SAME3 (cptr+4, '://'))
                     cptr += 7;
                  else
                  if (SAME4 (cptr+4, 's://'))
                     cptr += 8;
               }
               if (!SAME4(cptr,'*:*\0') &&
                   /* do not report virtual services for command-line checks */
                   (HttpdServerExecuting || HttpdServerStartup) &&
                   !ServiceIsConfigured (cptr))
               {
                  MetaConReport (mcptr, METACON_REPORT_ERROR,
                                 "Virtual service not configured");
                  mclptr->ConfigProblem = true;
               }
            }
         }
         else
         if (strsame (cptr, "[ConfigDirectory]", 17))
         {
            /********************/
            /* config directory */
            /********************/

            cptr += 17;
            /* skip over intervening white-space */
            while (*cptr && ISLWS(*cptr)) cptr++;

            if (MetaFileType[MetaFileLevel] == METACON_TYPE_CONFIG)
            {
               /* limit the use of [ConfigDirectory] to site admin */
               MetaConReport (mcptr, METACON_REPORT_ERROR,
                              "Cannot [ConfigDirectory] inside [ConfigFile]");
               mclptr->ConfigProblem = true;
            }
            else
            {
               /* can be an empty string, which resets the directory */
               zptr = (sptr = ConfigDirectory) + sizeof(ConfigDirectory)-1;
               while (*cptr && !ISLWS(*cptr) && sptr < zptr) *sptr++ = *cptr++;
               *sptr = '\0';
            }

            mclptr->Token = METACON_TOKEN_DIRECTORY;
            mclptr->FlowControlLevel = FlowControlLevel;
            mclptr->MetaFileLevel = MetaFileLevel;
            mclptr->MetaFileType = MetaFileType[MetaFileLevel];
         }
         else
         if (strsame (cptr, "[ConfigFile]", 12))
         {
            /***************/
            /* config file */
            /***************/

            if (MetaFileLevel > METACON_FILE_DEPTH_MAX)
            {
               sys$setprv (0, &SysPrvMask, 0, 0);
               MetaConReport (mcptr, METACON_REPORT_ERROR,
                              "Exceeded file depth");
               mclptr->ConfigProblem = true;
            }
            else
            {
               cptr += 12;
               /* skip over intervening white-space */
               while (*cptr && ISLWS(*cptr)) cptr++;

               zptr = (sptr = MetaFileName) + sizeof(MetaFileName)-1;
               /* if file name is not absolute then include any directory */
               for (tptr = cptr; *tptr && *tptr != ':'; tptr++);
               if (!*tptr)
                  for (tptr = ConfigDirectory;
                       *tptr && sptr < zptr;
                       *sptr++ = *tptr++);
               while (*cptr && !ISLWS(*cptr) && sptr < zptr) *sptr++ = *cptr++;
               *sptr = '\0';

               odsptr = &ConfigFileOds[++MetaFileLevel];
               status = OdsLoadTextFile (odsptr, MetaFileName);
               if (VMSok (status))
               {
                  /* successfully loaded this file */
                  mcptr->CurrentOdsPtr = odsptr;

                  /* config functions can tell what type of file it is from */
                  MetaFileType[MetaFileLevel] = METACON_TYPE_CONFIG;
               }
               else
               {
                  MetaConReport (mcptr, METACON_REPORT_ERROR,
                                 "Error including config file, !&m", status);
                  mclptr->ConfigProblem = true;
                  odsptr = &ConfigFileOds[--MetaFileLevel];
               }
            }

            mclptr->Token = METACON_TOKEN_CONFIG;
            mclptr->FlowControlLevel = FlowControlLevel;
            mclptr->MetaFileLevel = MetaFileLevel-1;
            mclptr->MetaFileType = MetaFileType[MetaFileLevel];

            mcptr->IncludeFile = true;
         }
         else
         if (strsame (cptr, "[IncludeFile]", 13))
         {
            /****************/
            /* include file */
            /****************/

            cptr += 13;
            /* skip over intervening white-space */
            while (*cptr && ISLWS(*cptr)) cptr++;

            if (MetaFileType[MetaFileLevel] == METACON_TYPE_CONFIG)
            {
               /* limit the use of [IncludeFile] to site admin */
               MetaConReport (mcptr, METACON_REPORT_ERROR,
                              "Cannot [IncludeFile] inside [ConfigFile]");
               mclptr->ConfigProblem = true;
            }
            else
            if (MetaFileLevel > METACON_FILE_DEPTH_MAX)
            {
               /* fatal error */
               sys$setprv (0, &SysPrvMask, 0, 0);
               MetaConReport (mcptr, METACON_REPORT_ERROR,
                              "Exceeded file depth");
               return (SS$_ABORT);
            }
            else
            {
               zptr = (sptr = MetaFileName) + sizeof(MetaFileName)-1;
               while (*cptr && !ISLWS(*cptr) && sptr < zptr) *sptr++ = *cptr++;
               *sptr = '\0';

               odsptr = &ConfigFileOds[++MetaFileLevel];
               status = OdsLoadTextFile (odsptr, MetaFileName);
               if (VMSnok (status))
               {
                  /* fatal error */
                  MetaConReport (mcptr, METACON_REPORT_ERROR,
                                 "Error including file, !&m", status);
                  sys$setprv (0, &SysPrvMask, 0, 0);
                  return (SS$_ABORT);
               }
               mcptr->CurrentOdsPtr = odsptr;

               /* config functions can tell what type of file it is from */
               MetaFileType[MetaFileLevel] = METACON_TYPE_FILE;
            }

            mclptr->Token = METACON_TOKEN_INCLUDE;
            mclptr->FlowControlLevel = FlowControlLevel;
            mclptr->MetaFileLevel = MetaFileLevel-1;
            mclptr->MetaFileType = MetaFileType[MetaFileLevel];

            mcptr->IncludeFile = true;
         }
         else
         if (strsame (cptr, "dict", 4))
         {
            /********/                  
            /* dict */
            /********/

            mclptr->Token = METACON_TOKEN_DICT;
            mclptr->FlowControlLevel = FlowControlLevel;
            mclptr->MetaFileLevel = MetaFileLevel;
            mclptr->MetaFileType = MetaFileType[MetaFileLevel];
         }
         else
         if (SAME2(cptr,'!#'))
         {
            /********************/
            /* included comment */
            /********************/

            if (SAME4(cptr,'!#--') && *(cptr+5) != '-')
               WatchInactive = true;
            else
            if (SAME4(cptr,'!#++') && *(cptr+5) != '+')
               WatchInactive = false;

            mclptr->Token = METACON_TOKEN_COMMENT;
            mclptr->FlowControlLevel = FlowControlLevel;
            mclptr->MetaFileLevel = MetaFileLevel-1;
            mclptr->MetaFileType = MetaFileType[MetaFileLevel];
         }
         else
         if (mclptr->Token != METACON_TOKEN_VERSION)
         {
            /*********************/
            /* just another line */
            /*********************/

            mclptr->Token = METACON_TOKEN_TEXT;
            mclptr->FlowControlLevel = FlowControlLevel;
            mclptr->MetaFileLevel = MetaFileLevel;
            mclptr->MetaFileType = MetaFileType[MetaFileLevel];
         }

         if (NotThisVersion && mclptr->Token != METACON_TOKEN_VERSION)
            continue;

         /****************/
         /* post-process */
         /****************/

         mclptr->Length = sptr - (char*)&mclptr->Storage;
         mclptr->InlineTextPtr = InlinePtr && InlinePtr[0] ? InlinePtr : NULL;
         mclptr->LineDataPtr = NULL;
         mclptr->WatchInactive = WatchInactive;
         if (mclptr->LookupAgentUsed) mcptr->LookupAgentUsed = true;
         if (mclptr->MetaAgentUsed) mcptr->MetaAgentUsed = true;
         if (mclptr->NetAcceptAgentUsed) mcptr->NetAcceptAgentUsed = true;

         if (WATCH_MOD && WatchThisOne)
            WatchDataFormatted ("!&X !UL !UL !UL !UL !&X !&Z !&Z\n",
                 mclptr, mclptr->Size, mclptr->Token, mclptr->Number,
                 mclptr->Length, mclptr->LineDataPtr, mclptr->TextPtr,
                 mclptr->InlineTextPtr);

         /* point to the current "line" (for callback purposes) */
         mcptr->ParsePtr = mclptr;
         if (CallBackFunction)
            if (!(ok = (*CallBackFunction)(mcptr))) break;

         /* point at the start of the next "line" storage area */
         mclptr = NextLinePtr;
      }

      /* terminating empty (zero-length) line */
      mclptr->Size = 0;

      /* final callback to allow post-configuration processing */
      mclptr->Token = METACON_TOKEN_POST;
      mcptr->ParsePtr = mclptr;
      if (CallBackFunction) ok = (*CallBackFunction)(mcptr);
   }

   /* disable SYSPRV after accessing the required files */
   sys$setprv (0, &SysPrvMask, 0, 0);

   /* replace the last file name with the search list logical name */
   if (mcptr->LnmCount > 1) strcpy (mcptr->LoadReport.FileName, FileName);

   if (mcptr->LookupAgentUsed)
   {
      MetaConReport (mcptr, METACON_REPORT_INFORM, "Lookup agent used");
      if (mcptr == MetaGlobalAuthPtr ||
          mcptr == MetaGlobalMappingPtr)
         TcpIpLookupAgent = true;
   }

   if (mcptr->MetaAgentUsed)
   {
      MetaConReport (mcptr, METACON_REPORT_INFORM, "Meta agent used");
      if (mcptr == MetaGlobalAuthPtr ||
          mcptr == MetaGlobalMappingPtr)
         MetaConAgentUsed = true;
   }

   if (mcptr->NetAcceptAgentUsed)
   {
      MetaConReport (mcptr, METACON_REPORT_INFORM, "Accept agent used");
      if (mcptr == MetaGlobalAuthPtr ||
          mcptr == MetaGlobalMappingPtr)
         NetAcceptAgent = true;
   }

#if WATCH_MOD
   if (TestToken)
   {
      fprintf (stdout, "%s", mcptr->LoadReport.TextPtr);
      exit (SS$_NORMAL);
   }
#endif /* WATCH_MOD */

   MetaConParseReset (mcptr, true);
   while (cptr = MetaConParse (NULL, mcptr, NULL, false))
      if (!cptr[0] && cptr[1])
         MetaConReport (mcptr, METACON_REPORT_ERROR, cptr+1);

   if (ok) return (SS$_NORMAL);
   return (SS$_ABORT);
} 

/*****************************************************************************/
/*
Free the memory associated with a meta-config structure.  If there is any
related data associated with a "line" then either free it or if a callback
function was supplied then call that to do the job.
*/

MetaConUnload
(
META_CONFIG **MetaConPtrPtr,
CALL_BACK CallBackFunction
)
{
   META_CONFIG  *mcptr;
   METACON_LINE  *mclptr;

   /*********/
   /* begin */
   /*********/

   if (WATCH_MODULE(WATCH_MOD_METACON))
      WatchThis (WATCHALL, WATCH_MOD_METACON,
                 "MetaConUnload() !&A", CallBackFunction);

   if (!(mcptr = *MetaConPtrPtr)) return;

   for (mclptr = mcptr->ContentPtr;
        mclptr && mclptr->Size;
        mclptr = (METACON_LINE*)((char*)mclptr + mclptr->Size))
   {
      if (mclptr->LineDataPtr)
      {
         if (CallBackFunction)
            (*CallBackFunction)(mclptr->LineDataPtr);
         else
            VmFree (mclptr->LineDataPtr, FI_LI);
      }
      /* free any precompiled regular expression structures */
      for (mclptr->RegexPregCount = 0;
           mclptr->RegexPregCount < METACON_REGEX_PREG_MAX;
           mclptr->RegexPregCount++)
         if (mclptr->RegexPreg[mclptr->RegexPregCount].buffer)
            regfree (&mclptr->RegexPreg[mclptr->RegexPregCount]);
   }

   if (mcptr->LoadReport.TextPtr)
      VmFree (mcptr->LoadReport.TextPtr, FI_LI);

   if (mcptr->AuthMetaPtr) AuthConfigUnload (mcptr);
   if (mcptr->ConfigMetaPtr) ConfigUnload (mcptr);
   if (mcptr->MappingMetaPtr) MapUrl_ConfigUnload (mcptr);
   if (mcptr->MsgMetaPtr) MsgConfigUnload (mcptr);
   if (mcptr->ServiceMetaPtr) ServiceConfigUnload (mcptr);

   VmFree (mcptr, FI_LI);
   *MetaConPtrPtr = NULL;
} 

/*****************************************************************************/
/*
Restart the parse processing by reseting some pointers and optionally
flow-control information.
*/

MetaConParseReset
(
META_CONFIG *mcptr,
BOOL StateReset
)
{
   /*********/
   /* begin */
   /*********/

   if (WATCH_MODULE(WATCH_MOD_METACON))
      WatchThis (WATCHALL, WATCH_MOD_METACON,
                 "MetaConParseReset() !&X !&B", mcptr, StateReset);

   if (StateReset)
   {
      mcptr->ParseIndex = 0;
      mcptr->ParseFlow[mcptr->ParseIndex] = METACON_FLOW_DEFAULT;
      mcptr->ParseState[mcptr->ParseIndex] = METACON_STATE_NOW;
      MetaconClientConcurrent (NULL, NULL, 0);
   }
   mcptr->ParsePtr = mcptr->ParseNextPtr = mcptr->ContentPtr;
   MetaConNoteValid = false;
} 

/*****************************************************************************/
/*
Successively called to parse raw "lines" (i.e. the METACON_LINE structure)
from the configuration.  When exhausted return NULL.  MetaConParseReset() needs
to be called prior to beginning the parse.          
*/

METACON_LINE* MetaConParseRaw (META_CONFIG *mcptr)

{
   METACON_LINE  *mclptr;

   /*********/
   /* begin */
   /*********/

   if (WATCH_MODULE(WATCH_MOD_METACON))
      WatchThis (WATCHALL, WATCH_MOD_METACON,
                 "MetaConParseRaw() !&X", mcptr);

   mclptr = mcptr->ParsePtr = mcptr->ParseNextPtr;

   if (WATCH_MODULE(WATCH_MOD_METACON))
      WatchDataFormatted ("!&X !UL !UL !UL !UL !&X !&Z\n",
         mclptr, mclptr->Size, mclptr->Token, mclptr->Number,
         mclptr->Length, mclptr->LineDataPtr, mclptr->TextPtr);

   /* if terminating empty "line" */
   if (mclptr->Size == 0) return (NULL);

   /* adjust the parse context to the next "line" */
   mcptr->ParseNextPtr = (METACON_LINE*)((char*)mclptr + mclptr->Size);

   return (mclptr);
} 

/*****************************************************************************/
/*
Successively called to parse "lines" from the configuration.  The function
automatically processes the conditional directives and returns to the caller
successive lines that the caller can process.  When the configuration "lines"
are exhausted it returns NULL.  MetaConParseReset() needs to be called prior to
beginning the parse.  If 'rqptr' parameter is NULL then the function is just
being used for checking.  Note that 'empty strings' are returned as "\0"
(i.e. two successive null characters) because error strings are returned with a
leading null character followed by the error message characters!
*/

char* MetaConParse
(
REQUEST_STRUCT *rqptr,
META_CONFIG *mcptr,
METACON_LINE **LinePtrPtr,
BOOL WatchingThis
)
{
   BOOL  NotThisVersion,
         NotThisVirtualService,
         UnresolvedFlowControl,
         WatchThisOne;
   int  LineSize,
        LineToken;
   ulong  number;
   char  *cptr;
   METACON_LINE  *mclptr;
   SERVICE_STRUCT  *svptr;

   /*********/
   /* begin */
   /*********/

   if (WatchingThis && WATCH_MODULE(WATCH_MOD_METACON))
      WatchThis (WATCHITM(rqptr), WATCH_MOD_METACON,
                 "MetaConParse() !&X !&X", mcptr, LinePtrPtr);

   WatchThisOne = WatchingThis;
   NotThisVersion = NotThisVirtualService = false;
   if (rqptr) svptr = rqptr->ServicePtr;

   for (;;)
   {
      mclptr = mcptr->ParsePtr = mcptr->ParseNextPtr;

      /* used by the parse functions */
      mclptr->RequestPtr = rqptr;
      if (!rqptr)
         mclptr->WatchThisOne = WatchThisOne = 0;
      else
         WatchThisOne = mclptr->WatchThisOne = WatchingThis &&
                                               !mclptr->WatchInactive;

      if (WatchThisOne && WATCH_MODULE(WATCH_MOD_METACON))
         WatchDataFormatted (
"flow[!UL]=!UL state[!UL]=!UL\n\
!&X !UL !UL !UL !UL !&X !&Z !&Z\n",
            mcptr->ParseIndex, mcptr->ParseFlow[mcptr->ParseIndex],
            mcptr->ParseIndex, mcptr->ParseState[mcptr->ParseIndex],
            mclptr, mclptr->Size, mclptr->Token, mclptr->Number,
            mclptr->Length, mclptr->LineDataPtr, mclptr->TextPtr,
            mclptr->InlineTextPtr);

      /* if terminating empty "line" */
      if (!(LineSize = mclptr->Size))
      {
         if (LinePtrPtr) *LinePtrPtr = NULL;
         if (!mcptr->ParseIndex) return (NULL);
         mcptr->ParseIndex = 0;
         return ("\0Unresolved flow-control 1");
      }
      /* adjust the parse context to the next "line" */
      mcptr->ParseNextPtr = (METACON_LINE*)((char*)mclptr + LineSize);

      if (LinePtrPtr) *LinePtrPtr = mclptr;

      LineToken = mclptr->Token;

      if (LineToken == METACON_TOKEN_COMMENT)
      {
         /* just so that '!#--' and '!#++' are reported */
         if (WatchingThis)
         {
            cptr = mclptr->TextPtr;
            if (SAME4 (cptr, '!#--') || SAME4 (cptr, '!#++'))
               WatchDataFormatted ("!4ZL !AZ\n", mclptr->Number, cptr);
         }
         continue;
      }

      if (LineToken == METACON_TOKEN_VERSION)
      {
         if (WatchThisOne)
            WatchDataFormatted ("!4ZL [[!AZ]]\n",
                                mclptr->Number, mclptr->TextPtr);

         /* "[[wasd*n.n.n]]" resets all meta-config flow-control */
         UnresolvedFlowControl = mcptr->ParseIndex;
         mcptr->ParseIndex = 0;
         mcptr->ParseFlow[mcptr->ParseIndex] = METACON_FLOW_DEFAULT;
         mcptr->ParseState[mcptr->ParseIndex] = METACON_STATE_NOW;
         if (UnresolvedFlowControl) return ("\0Unresolved flow-control 2");

         /* if just doing a syntax check */
         if (!rqptr) continue;

         /* e.g. "[[wasd==11.0.1]]", "[[wasd<11.1]]", "[[wasd!=11.2]]" */
         switch (*(USHORTPTR)mclptr->VersionCompare)
         {
            case '=\0' :
            case '==' :
               if (mclptr->VersionNumber == -1)
                  NotThisVersion = false;
               else
                  NotThisVersion = HttpdVersionNumber != mclptr->VersionNumber;
               break;
            case '!=' :
               NotThisVersion = HttpdVersionNumber == mclptr->VersionNumber;
               break;
            case '<\0' :
               NotThisVersion = HttpdVersionNumber >= mclptr->VersionNumber;
               break;
            case '!>' :
            case '<=' :
               NotThisVersion = HttpdVersionNumber > mclptr->VersionNumber;
               break;
            case '>\0' :
               NotThisVersion = HttpdVersionNumber <= mclptr->VersionNumber;
               break;
            case '!<' :
            case '>=' :
               NotThisVersion = HttpdVersionNumber < mclptr->VersionNumber;
               break;
            default :
               NotThisVersion = true;
         }

         continue;
      }

      if (NotThisVersion) continue;

      if (LineToken == METACON_TOKEN_SERVICE)
      {
         if (WatchThisOne)
            WatchDataFormatted ("!4ZL [[!AZ]]\n",
                                mclptr->Number, mclptr->TextPtr);

         /* "[[service]]" resets all meta-config flow-control */
         UnresolvedFlowControl = mcptr->ParseIndex;
         mcptr->ParseIndex = 0;
         mcptr->ParseFlow[mcptr->ParseIndex] = METACON_FLOW_DEFAULT;
         mcptr->ParseState[mcptr->ParseIndex] = METACON_STATE_NOW;
         if (UnresolvedFlowControl) return ("\0Unresolved flow-control 3");

         /* start off with it being of interest and deny as necessary */
         NotThisVirtualService = false;

         /* if just doing a syntax check */
         if (!rqptr) continue;

         cptr = mclptr->TextPtr;
         if (SAME4 (cptr, 'http'))
         {
            if (SAME3 (cptr+4, '://'))
            {
               if (svptr->RequestScheme != SCHEME_HTTP)
               {
                  NotThisVirtualService = true;
                  continue;
               }
               cptr += 7;
            }
            else
            if (SAME4 (cptr+4, 's://'))
            {
               if (svptr->RequestScheme != SCHEME_HTTPS)
               {
                  NotThisVirtualService = true;
                  continue;
               }
               cptr += 8;
            }
         }

         /* if for all virtual services */
         if (SAME4(cptr,'*:*\0')) continue;

         /* if for an unknown virtual service */
         if (*cptr == '?')
         {
            if (!rqptr->UnknownVirtualService)
            {
               NotThisVirtualService = true;
               continue;
            }
            /* check port specificity */
            while (*cptr && *cptr != ':') cptr++;
            if (*cptr) cptr++;
            if (!*cptr || *cptr == '?' || SAME2(cptr,'*\0')) continue;
            NotThisVirtualService =
               !StringMatch (rqptr, svptr->ServerPortString, cptr);
            continue;
         }

         /* if conditional matches this request's virtual service */
         NotThisVirtualService =
            !StringMatch (rqptr, svptr->ServerHostPort, cptr);
         continue;
      }

      /* if it wasn't a service spec and not interested in the current one */
      if (NotThisVirtualService) continue;

      if (LineToken == METACON_TOKEN_CONFIG ||
          LineToken == METACON_TOKEN_INCLUDE)
      {
         if (WatchThisOne)
            WatchDataFormatted ("!AZ!4ZL !AZ\n",
                                mclptr->ConfigProblem ? "?" : "",
                                mclptr->Number, mclptr->TextPtr);
         continue;
      }

      if (LineToken == METACON_TOKEN_DICT)
      {
         if (mcptr->ParseState[mcptr->ParseIndex] == METACON_STATE_NOW)
         {
            if (WatchThisOne)
               WatchDataFormatted ("!4ZL !AZ\n",
                                   mclptr->Number, mclptr->TextPtr); 
            /* if not just checking */
            if (rqptr != NULL)
            {
               for (cptr = mclptr->TextPtr + 4; *cptr && ISLWS(*cptr); cptr++);
               MetaConBuffer (mclptr, NULL, 0);
               MetaConBuffer (mclptr, &cptr, 0);
               MetaConDictionary (rqptr, mclptr->BufferPtr);
               if (WatchThisOne && WATCH_CATEGORY(WATCH_INTERNAL))
                  DictWatch (rqptr->rqDictPtr, DICT_TYPE_CONFIG, "*");
            }
         }
         continue;
      }

      if (LineToken == METACON_TOKEN_TEXT ||
          LineToken == METACON_TOKEN_DIRECTORY)
      {
         if (mcptr->ParseState[mcptr->ParseIndex] == METACON_STATE_NOW)
         {
            if (WatchThisOne)
               if (LineToken == METACON_TOKEN_DIRECTORY)
                  WatchDataFormatted ("!4ZL !AZ\n",
                                      mclptr->Number, mclptr->TextPtr);
            return (mclptr->TextPtr);
         }

         if (WatchThisOne)
            WatchDataFormatted ("!4ZL !AZ\n",
                                mclptr->Number, mclptr->TextPtr);
         /* return if just checking */
         if (!rqptr) return ("\0");
         continue;
      }

      if (WatchThisOne)
         WatchDataFormatted ("!4ZL !AZ\n",
                             mclptr->Number, mclptr->TextPtr);

      if (LineToken == METACON_TOKEN_IF)
      {
         if (mcptr->ParseIndex >= METACON_MAX_FLOW_CONTROL-1)
         {
            if (WatchThisOne) WatchDataFormatted ("TOO MANY CONDITIONS\n");
            return ("\0Too many conditions");
         }

         mcptr->ParseIndex++;
         mcptr->ParseFlow[mcptr->ParseIndex] = METACON_FLOW_IF;
         mcptr->ParseState[mcptr->ParseIndex] = METACON_STATE_BEFORE;
         if (mcptr->ParseState[mcptr->ParseIndex-1] == METACON_STATE_NOW)
         {
            cptr = MetaConEvaluate (mclptr);
            if (*cptr || SAME4(cptr,'\0\0\0\1'))
            {
               /* expression with inline string (true or false) */
               mcptr->ParseIndex--;
               return (cptr);
            }
            /* set processing-now if expression is true */
            if (SAME4(cptr,'\0\0\1\0'))
               mcptr->ParseState[mcptr->ParseIndex] = METACON_STATE_NOW;
            else
            /* return if a problem report */
            if (!*cptr && *(cptr+1))
            {
               /* decrement the parse index if it was an inline directive */
               if (mclptr->InlineTextPtr)
               {
                  mcptr->ParseFlow[mcptr->ParseIndex] =
                     mcptr->ParseState[mcptr->ParseIndex] = 0;
                  mcptr->ParseIndex--;
               }
               return (cptr);
            }
            /* return if just checking */
            if (!rqptr) return ("\0");
         }
         else
         {
            /* decrement the parse index if it was an inline directive */
            if (mclptr->InlineTextPtr)
            {
               mcptr->ParseFlow[mcptr->ParseIndex] =
                  mcptr->ParseState[mcptr->ParseIndex] = 0;
               mcptr->ParseIndex--;
            }
         }
         continue;
      }

      if (LineToken == METACON_TOKEN_ELIF)
      {
         if (mcptr->ParseFlow[mcptr->ParseIndex] != METACON_FLOW_IF &&
             mcptr->ParseFlow[mcptr->ParseIndex] != METACON_FLOW_IFIF &&
             mcptr->ParseFlow[mcptr->ParseIndex] != METACON_FLOW_UNIF &&
             mcptr->ParseFlow[mcptr->ParseIndex] != METACON_FLOW_ELIF)
         {
            if (WatchThisOne) WatchDataFormatted ("OUT-OF-PLACE \'ELIF()\'\n");
            return ("\0Out-of-place \'elif()\'");
         }

         if (mcptr->ParseFlow[mcptr->ParseIndex] == METACON_FLOW_UNIF)
         {
            /* 'unif' unconditional execution must be popped */
            mcptr->ParseFlow[mcptr->ParseIndex] =
                mcptr->ParseState[mcptr->ParseIndex] = 0;
            mcptr->ParseIndex--;
         }

         if (mcptr->ParseState[mcptr->ParseIndex-1] == METACON_STATE_NOW)
         {
            mcptr->ParseFlow[mcptr->ParseIndex] = METACON_FLOW_ELIF;
            if (mcptr->ParseState[mcptr->ParseIndex] == METACON_STATE_NOW)
               mcptr->ParseState[mcptr->ParseIndex] = METACON_STATE_AFTER;
            else
            if (mcptr->ParseState[mcptr->ParseIndex] == METACON_STATE_BEFORE)
            {
               cptr = MetaConEvaluate (mclptr);
               if (*cptr)
               {
                  /* an inline directive following the expression */
                  return ("\0Extraneous text follows \'elif()\'");
               }
               /* set processing-now if sentinal string is true */
               if (SAME4(cptr,'\0\0\1\0'))
                  mcptr->ParseState[mcptr->ParseIndex] = METACON_STATE_NOW;
               else
               /* return if a problem report */
               if (!*cptr && *(cptr+1)) return (cptr);
               /* return if just checking */
               if (!rqptr) return ("\0");
            }
         }
         continue;
      }

      if (LineToken == METACON_TOKEN_ELSE)
      {
         if (mcptr->ParseFlow[mcptr->ParseIndex] != METACON_FLOW_IF &&
             mcptr->ParseFlow[mcptr->ParseIndex] != METACON_FLOW_ELIF &&
             mcptr->ParseFlow[mcptr->ParseIndex] != METACON_FLOW_UNIF)
         {
            if (WatchThisOne) WatchDataFormatted ("OUT-OF-PLACE \'ELSE\'\n");
            return ("\0Out-of-place \'else\'");
         }

         if (mcptr->ParseFlow[mcptr->ParseIndex] == METACON_FLOW_UNIF)
         {
            /* 'unif' unconditional execution must be popped */
            mcptr->ParseFlow[mcptr->ParseIndex] =
                mcptr->ParseState[mcptr->ParseIndex] = 0;
            mcptr->ParseIndex--;
         }

         if (mcptr->ParseState[mcptr->ParseIndex-1] == METACON_STATE_NOW)
         {
            mcptr->ParseFlow[mcptr->ParseIndex] = METACON_FLOW_ELSE;
            if (mcptr->ParseState[mcptr->ParseIndex] == METACON_STATE_NOW)
               mcptr->ParseState[mcptr->ParseIndex] = METACON_STATE_AFTER;
            else
            if (mcptr->ParseState[mcptr->ParseIndex] == METACON_STATE_BEFORE)
            {
               cptr = mclptr->TextPtr;
               while (*cptr && !ISLWS(*cptr)) cptr++;
               while (*cptr && ISLWS(*cptr)) cptr++;
               /* return if directive following the conditional */
               if (*cptr) return (cptr);
               mcptr->ParseState[mcptr->ParseIndex] = METACON_STATE_NOW;
               /* return if just checking */
               if (!rqptr) return ("\0");
            }
         }
         continue;
      }

      if (LineToken == METACON_TOKEN_IFIF)
      {
         if (mcptr->ParseFlow[mcptr->ParseIndex] == METACON_FLOW_ELSE)
         {
            /* 'ifif' after 'else' executes only if the 'else' wasn't */
            if (mcptr->ParseState[mcptr->ParseIndex-1] == METACON_STATE_NOW)
            {
               mcptr->ParseFlow[mcptr->ParseIndex] = METACON_FLOW_IFIF;
               if (mcptr->ParseState[mcptr->ParseIndex] == METACON_STATE_NOW)
                  mcptr->ParseState[mcptr->ParseIndex] = METACON_STATE_AFTER;
               else
               if (mcptr->ParseState[mcptr->ParseIndex] == METACON_STATE_AFTER)
               {
                  /* i.e. after the original 'if' or 'elif' executed */
                  cptr = mclptr->TextPtr;
                  while (*cptr && !ISLWS(*cptr)) cptr++;
                  while (*cptr && ISLWS(*cptr)) cptr++;
                  /* return if directive following the conditional */
                  if (*cptr) return (cptr);
                  mcptr->ParseState[mcptr->ParseIndex] = METACON_STATE_NOW;
                  /* return if just checking */
                  if (!rqptr) return ("\0");
               }
            }
            continue;
         }

         if (mcptr->ParseFlow[mcptr->ParseIndex] == METACON_FLOW_UNIF)
         {
            /* 'unif' unconditional execution must be popped */
            mcptr->ParseFlow[mcptr->ParseIndex] =
                mcptr->ParseState[mcptr->ParseIndex] = 0;
            mcptr->ParseIndex--;
            /* return if just checking */
            if (!rqptr) return ("\0");
            continue;
         }

         /* 'ifif' after anything other than 'else' or 'unif' */
         if (WatchThisOne) WatchDataFormatted ("OUT-OF-PLACE \'IFIF\'\n");
         return ("\0Out-of-place \'ifif\'");
      }

      if (LineToken == METACON_TOKEN_UNIF)
      {
         /* unconditional execution */
         if (mcptr->ParseFlow[mcptr->ParseIndex] != METACON_FLOW_IF &&
             mcptr->ParseFlow[mcptr->ParseIndex] != METACON_FLOW_ELIF &&
             mcptr->ParseFlow[mcptr->ParseIndex] != METACON_FLOW_IFIF &&
             mcptr->ParseFlow[mcptr->ParseIndex] != METACON_FLOW_ELSE)
         {
            if (WatchThisOne) WatchDataFormatted ("OUT-OF-PLACE \'UNIF\'\n");
            return ("\0Out-of-place \'unif\'");
         }

         if (mcptr->ParseIndex >= METACON_MAX_FLOW_CONTROL-1)
         {
            if (WatchThisOne) WatchDataFormatted ("TOO MANY CONDITIONS\n");
            return ("\0Too many conditions");
         }

         mcptr->ParseIndex++;
         mcptr->ParseFlow[mcptr->ParseIndex] = METACON_FLOW_UNIF;
         mcptr->ParseState[mcptr->ParseIndex] = METACON_STATE_NOW;
         /* return if just checking */
         if (!rqptr) return ("\0");
         continue;
      }

      if (LineToken == METACON_TOKEN_ENDIF)
      {
         if (mcptr->ParseIndex == 0 ||
             (mcptr->ParseFlow[mcptr->ParseIndex] != METACON_FLOW_IF &&
              mcptr->ParseFlow[mcptr->ParseIndex] != METACON_FLOW_ELIF &&
              mcptr->ParseFlow[mcptr->ParseIndex] != METACON_FLOW_ELSE &&
              mcptr->ParseFlow[mcptr->ParseIndex] != METACON_FLOW_UNIF))
         {
            if (WatchThisOne) WatchDataFormatted ("OUT-OF-PLACE \'ENDIF\'\n");
            return ("\0Out-of-place \'endif\'");
         }

         mcptr->ParseFlow[mcptr->ParseIndex] =
             mcptr->ParseState[mcptr->ParseIndex] = 0;
         mcptr->ParseIndex--;
         /* return if just checking */
         if (!rqptr) return ("\0");
         continue;
      }

#if WATCH_MOD
      if (LineToken == METACON_TOKEN_TEST)
      {
         /* used for testing of MetaConEvaluate() */ 
         cptr = MetaConEvaluate (mclptr);
         continue;
      }
#endif /* WATCH_MOD */

      ErrorExitVmsStatus (SS$_BUGCHECK, ErrorSanityCheck, FI_LI);
   }

   ErrorExitVmsStatus (SS$_BUGCHECK, ErrorSanityCheck, FI_LI);
} 

/*****************************************************************************/
/*
Evaluate the conditional expression pointed to by 'LinePtr'.
If 'rqptr' parameter is NULL then the function is just being used to check the
syntax of the conditional and/or return and error or in-line text.
*/

char* MetaConEvaluate (METACON_LINE *mclptr)

{
#define IFRQ(datum) (rqptr != NULL ? (void*)rqptr->datum : (void*)NULL)

   static ulong  RandomNumber;
   static int64  PrevTime64;

   BOOL  result,
         WatchThisOne;
   BOOL  ResultStack [METACON_STACK_MAX];
   int  idx, klen, modulas, number,
        CurrentNumber,
        FileNameLength,
        OperatorIndex,
        ResultIndex;
   char  ch1, ch2;
   char  *cptr, *fptr, *sptr, *zptr,
         *DirectivePtr;
   char  key [256];
   char  FileName [ODS_MAX_FILE_NAME_LENGTH+1];
   char  *OperatorStack [METACON_STACK_MAX];
   char  IpAddrString [128];
   DICT_ENTRY_STRUCT  *denptr;
   REQUEST_STRUCT  *rqptr;
   SERVICE_STRUCT  *svptr;
   TCPIP_HOST_LOOKUP  HostLookup;

   /*********/
   /* begin */
   /*********/

   rqptr = mclptr->RequestPtr;
   WatchThisOne = mclptr->WatchThisOne;

   if (WatchThisOne && WATCH_MODULE(WATCH_MOD_METACON))
   {
      WatchThis (WATCHITM(rqptr), WATCH_MOD_METACON, "MetaConEvaluate()");
      WatchDataFormatted ("!&Z\n", mclptr->TextPtr);
   }

   if (rqptr) svptr = rqptr->ServicePtr;

   /* (re)seed the random number every second or so */
   if (PrevTime64 != HttpdTime64) RandomNumber += (PrevTime64 = HttpdTime64);
   /* cheap (no subroutine call) MTH$RANDOM() */
   RandomNumber = RandomNumber * 69069 + 1;

   OperatorIndex = ResultIndex = 0;
   OperatorStack[OperatorIndex] = "";
   ResultStack[ResultIndex] = false;

   cptr = mclptr->TextPtr;
   while (isalpha(*cptr)) cptr++;
   while (*cptr)
   {
      while (ISLWS(*cptr)) cptr++;
      if (!(ch1 = *cptr)) break;

      if (WatchThisOne && WATCH_MODULE(WATCH_MOD_METACON))
         WatchDataFormatted ("!&Z\n", cptr);

      if (ch1 == '!' ||
          ch1 == '&' ||
          ch1 == '|' ||
          ch1 == '(')
      {
         if (OperatorIndex++ > METACON_STACK_MAX)
         {
            if (WatchThisOne) WatchDataFormatted ("TOO MANY \'(..)\'\n");
            return ("\0Too many \'(..)\'");
         }
         OperatorStack[OperatorIndex] = cptr++;
         if (*cptr == '&' || *cptr == '|') cptr++;

         if (WatchThisOne && WATCH_MODULE(WATCH_MOD_METACON))
            WatchDataFormatted (">opr[!UL]=!1AZ\n",
               OperatorIndex, OperatorStack[OperatorIndex]);

         continue;
      }

      /* if the end of the conditional expression has been reached */
      if (OperatorIndex <= 0 && ch1 != ')') break;

      /* initialize */
      MetaConBuffer (mclptr, NULL, 0);
      mclptr->RegexPregCount = 0;
      result = false;

      /* buffer the keyword, pushing it to lower-case */
      DirectivePtr = cptr;
      zptr = (sptr = key) + sizeof(key)-1;
      while (*cptr && *cptr != ':' && sptr < zptr) *sptr++ = TOLO(*cptr++);
      *sptr = '\0';
      klen = sptr - key;
      cptr = DirectivePtr;

      if (WATCHMOD (rqptr, WATCH_MOD_METACON))
         WatchThis (WATCHITM(rqptr), WATCH_MOD_METACON, "!UL !&Z", klen, key);

      if (sptr >= zptr)
      {
         if (WatchThisOne) WatchDataFormatted ("Unfinished keyword\n");
         return ("\0Unfinished keyword");
      }

      if (ch1 == ')')
         cptr++;
      else
      if (key[0] == 'a')
      {
         /*******/
         /* a.. */
         /*******/

         /* also match the trailing null character (in all these cases) */
         if (klen == 6 && MATCH7(key, "accept"))
            result = MetaConConditionalList (mclptr, &cptr, klen,
                                             IFRQ(rqHeader.AcceptPtr));
         else
         if (klen == 15 && MATCH16(key, "accept-language"))
            result = MetaConConditionalList (mclptr, &cptr, klen,
                                             IFRQ(rqHeader.AcceptLangPtr));
         else
         if (klen == 14 && MATCH15(key,"accept-charset"))
            result = MetaConConditionalList (mclptr, &cptr, klen,
                                             IFRQ(rqHeader.AcceptCharsetPtr));
         else
         if (klen == 15 && MATCH16(key,"accept-encoding"))
            result = MetaConConditionalList (mclptr, &cptr, klen,
                                             IFRQ(rqHeader.AcceptEncodingPtr));
         else
         if (klen == 12 && MATCH13(key,"accept_agent"))
         {
            mclptr->NetAcceptAgentUsed = true;
            sptr = MetaConBuffer (mclptr, &cptr, klen);
            if (rqptr == NULL) goto JustChecking;
            result = StringMatchAndRegex (rqptr, sptr, mclptr->BufferPtr,
                                          SMATCH_GREEDY_REGEX,
                                          mclptr->RegexPregPtr,
                                          NULL);
            if (WatchThisOne)
               WatchDataFormatted ("!&B accept_agent:!AZ \'!AZ\'\n",
                                   result, mclptr->BufferPtr, sptr);
         }
         else
         if (klen == 4 && MATCH5(key,"alpn"))
            result = MetaConSimpleMatch (mclptr, &cptr, klen,
                                         SesolaRequestALPN(rqptr));
      }
      else
      if (key[0] == 'c')
      {
         /*******/
         /* c.. */
         /*******/

         if (klen == 7 && MATCH8(key,"callout"))
            result = MetaConSimpleBoolean (mclptr, &cptr, klen,
                                           IFRQ(rqCgi.CalloutInProgress));
         else
         if (klen == 17 && MATCH18(key,"client_connect_gt"))
            result = MetaconClientConcurrent (mclptr, &cptr, klen);
         else
         if (klen == 14 && MATCH15(key,"cluster_member"))
            result = MetaConEvaluateClusterMember (mclptr, &cptr, klen);
         else
         if (klen == 12 && MATCH13(key,"command_line"))
            result = MetaConSimpleMatch (mclptr, &cptr, klen, CommandLine);
      }
      else
      if (key[0] == 'd')
      {
         /*******/
         /* d.. */
         /*******/

         if (klen == 6 && MATCH7(key,"decnet"))
            result = MetaConSimpleBoolean (mclptr, &cptr, klen,
                                  (SysInfo.DECnetVersion == *cptr - '0'));
         else
         if (klen == 4 && MATCH5(key,"demo"))
            result = MetaConSimpleBoolean (mclptr, &cptr, klen, CliDemo);
         else
         if (klen == 4 && MATCH5(key,"dict"))
         {
            int  keylen;
            char  *aptr, *keyptr;
            char  DictType [2];
            DICT_ENTRY_STRUCT  *denptr;

            aptr = MetaConBuffer (mclptr, &cptr, klen);
            if (rqptr == NULL) goto JustChecking;

            for (keyptr = aptr; *aptr && *aptr != '='; aptr++);
            keylen = aptr - keyptr;
            if (*aptr) aptr++;
            /* if key first char is not an alpha-numeric use it as the type */
            if (isalnum (*keyptr))
               DictType[0] = DICT_TYPE_CONFIG[0];
            else
            {
               DictType[0] = *keyptr++;
               keylen--;
            }
            DictType[1] = '\0';

            /* at this stage |aptr| points to the test expression */
            denptr = DictLookup (rqptr->rqDictPtr, DictType, keyptr, keylen);
            if (denptr == NULL)
               result = false;
            else
            if (!*aptr)
               result = true;
            else
               result = StringMatchAndRegex (rqptr,
                                             DICT_GET_VALUE(denptr),
                                             aptr,
                                             SMATCH_GREEDY_REGEX,
                                             mclptr->RegexPregPtr,
                                             NULL);
            if (WatchThisOne)
               WatchDataFormatted ("!&B dict:!AZ \'!AZ\'\n",
                  result, mclptr->BufferPtr,
                  denptr == NULL ? "(null)" : (char*)DICT_GET_VALUE(denptr));
         }
         else
         if (klen == 9 && MATCH10(key,"directory:"))
         {
            MetaConBuffer (mclptr, &cptr, klen);
            if (rqptr == NULL) goto JustChecking;

            FileName[0] = '\0';
            if (!mclptr->BufferPtr[0] && rqptr->rqHeader.PathInfoPtr)
               strzcpy (mclptr->BufferPtr,
                        rqptr->rqHeader.PathInfoPtr,
                        mclptr->BufferSize);
            for (sptr = mclptr->BufferPtr; *sptr && !SAME2(sptr,':['); sptr++);
            if (*sptr)
               strzcpy (FileName, mclptr->BufferPtr, sizeof(FileName));
            else
               MapOdsUrlToVms (mclptr->BufferPtr, FileName, sizeof(FileName),
                               0, FALSE, rqptr->PathOds);
            for (sptr = FileName; *sptr; sptr++);
            if (sptr > FileName && *(sptr-1) == ']')
            {
               OdsNameOfDirectoryFile (FileName, 0, FileName, &FileNameLength);
               if (mclptr->BufferPtr[0] && FileName[0])
                  result = VMSok (OdsFileExists (NULL, FileName));
               else
                  result = false;
            }
            else
               result = false;
            if (WatchThisOne)
               WatchDataFormatted ("!&B directory:!AZ \'!AZ\'\n",
                                   result, mclptr->BufferPtr, FileName);
         }
         else
         if (klen == 12 && MATCH13(key,"document-root"))
            result = MetaConSimpleMatch (mclptr, &cptr, klen,
                                         IFRQ(rqPathSet.MapRootPtr));
      }
      else
      if (key[0] == 'f' && klen == 4 && MATCH5(key,"file"))
      {
         /*******/
         /* f.. */
         /*******/

         MetaConBuffer (mclptr, &cptr, klen);
         if (rqptr == NULL) goto JustChecking;

         FileName[0] = '\0';
         if (!mclptr->BufferPtr[0] && rqptr->rqHeader.PathInfoPtr)
            strzcpy (mclptr->BufferPtr,
                     rqptr->rqHeader.PathInfoPtr,
                     mclptr->BufferSize);
         for (sptr = mclptr->BufferPtr; *sptr && !SAME2(sptr,':['); sptr++);
         if (*sptr)
            strzcpy (FileName, mclptr->BufferPtr, sizeof(FileName));
         else
            MapOdsUrlToVms (mclptr->BufferPtr, FileName, sizeof(FileName),
                            0, FALSE, rqptr->PathOds);
         for (sptr = FileName; *sptr; sptr++);
         if (sptr > FileName && *(sptr-1) == ']')
            OdsNameOfDirectoryFile (FileName, 0, FileName, &FileNameLength);
         if (mclptr->BufferPtr[0] && FileName[0])
            result = VMSok (OdsFileExists (NULL, FileName));
         else
            result = false;
         if (WatchThisOne)
            WatchDataFormatted ("!&B file:!AZ \'!AZ\'\n",
                                result, mclptr->BufferPtr, FileName);
      }
      else
      if (key[0] == 'h')
      {
         /*******/
         /* h.. */
         /*******/

         if (klen == 4 && MATCH5(key,"host"))
            result = MetaConSimpleMatch (mclptr, &cptr, klen,
                                         IFRQ(rqHeader.HostPtr));
         else
         if (klen == 5 && MATCH6(key,"http2"))
            result = MetaConSimpleBoolean (mclptr, &cptr, klen,
                             (IFRQ(Http2Stream.Http2Ptr) != NULL));
      }
      else
      if (key[0] == 'i' && klen == 8 && MATCH9(key,"instance"))
      {
         /*******/
         /* i.. */
         /*******/

         result = MetaConEvaluateInstance (mclptr, &cptr, klen);
      }
      else
      if (key[0] == 'j' && klen == 12 && MATCH13(key,"jpi_username"))
      {
         /*******/
         /* j.. */
         /*******/

         result = MetaConSimpleMatch (mclptr, &cptr, klen,
                                      HttpdProcess.UserName);
      }
      else
      if (klen == 12 && MATCH13(key,"lookup_agent"))
      {
         mclptr->LookupAgentUsed = true;
         sptr = MetaConBuffer (mclptr, &cptr, klen);
         if (rqptr == NULL) goto JustChecking;
         result = StringMatchAndRegex (rqptr, sptr, mclptr->BufferPtr,
                                       SMATCH_GREEDY_REGEX,
                                       mclptr->RegexPregPtr,
                                       NULL);
         if (WatchThisOne)
            WatchDataFormatted ("!&B lookup_agent:!AZ \'!AZ\'\n",
                                result, mclptr->BufferPtr, sptr);
      }
      else
      if (key[0] == 'm')
      {
         /*******/
         /* m.. */
         /*******/

         if (klen == 11 && MATCH12(key,"mapped-path"))
         {
            /* different to path-info, result after script or 'map' rule */
            MetaConBuffer (mclptr, &cptr, klen);
            if (rqptr == NULL) goto JustChecking;

            if (rqptr->MetaConMappedPtr)
               /* only valid during rule mapping (what a kludge!) */
               sptr = rqptr->MetaConMappedPtr;
            else
               sptr = rqptr->MappedPathPtr;
            if (sptr)
               result = StringMatchAndRegex (rqptr, sptr, mclptr->BufferPtr,
                                             SMATCH_GREEDY_REGEX,
                                             mclptr->RegexPregPtr,
                                             NULL);
            if (WatchThisOne)
               WatchDataFormatted ("!&B mapped-path:!AZ \'!AZ\'\n",
                                   result, mclptr->BufferPtr, sptr);
         }
         else
         if (klen == 10 && MATCH11(key,"meta_agent"))
         {
            mclptr->MetaAgentUsed = true;
            sptr = MetaConBuffer (mclptr, &cptr, klen);
            if (rqptr == NULL) goto JustChecking;
            result = StringMatchAndRegex (rqptr, sptr, mclptr->BufferPtr,
                                          SMATCH_GREEDY_REGEX,
                                          mclptr->RegexPregPtr,
                                          NULL);
            if (WatchThisOne)
               WatchDataFormatted ("!&B meta_agent:!AZ \'!AZ\'\n",
                                   result, mclptr->BufferPtr, sptr);
         }
         else
         if (klen == 9 && MATCH10(key,"multihome"))
         {
            MetaConBuffer (mclptr, &cptr, klen);
            if (rqptr == NULL) goto JustChecking;

            if (!rqptr->ClientPtr->MultiHomeIpAddressString[0])
            {
               /* it is not a mismatched multi-homed service */
               result = false;
            }
            else
            if (!strchr (mclptr->BufferPtr, '/'))
            {
               /* not a network mask */
               sptr = rqptr->ClientPtr->MultiHomeIpAddressString;
               result = StringMatchAndRegex (rqptr, sptr, mclptr->BufferPtr,
                                             SMATCH_GREEDY_REGEX,
                                             mclptr->RegexPregPtr,
                                             NULL);
            }
            else
            {
               /* a network mask */
               char *tptr = mclptr->BufferPtr;  /* preserve string address */
               result = VMSok (TcpIpNetMask (rqptr, WatchThisOne, &tptr,
                               &rqptr->ClientPtr->MultiHomeIpAddress));
            }
            if (WatchThisOne)
               WatchDataFormatted ("!&B server_multihome:!AZ !AZ\n",
                                   result, mclptr->BufferPtr,
                                   rqptr->ClientPtr->MultiHomeIpAddressString);
         }
      }
      else
      if (key[0] == 'n')
      {
         /*******/
         /* n.. */
         /*******/

         if (klen == 4 && MATCH5(key,"note"))
         {
            MetaConBuffer (mclptr, &cptr, klen);
            if (rqptr == NULL) goto JustChecking;

            if (!MetaConNoteValid)
            {
               /* only need to get the value once per parse reset */
               InstanceMutexLock (INSTANCE_MUTEX_HTTPD);
               strzcpy (MetaConNote,
                        HttpdGblSecPtr->MetaConNote,
                        sizeof(MetaConNote));
               InstanceMutexUnLock (INSTANCE_MUTEX_HTTPD);
               MetaConNoteValid = true;
            }

            /* this semi-boolean just tests if the note has content */
            if (!mclptr->BufferPtr[0] && MetaConNote[0])
               result = true;
            else
            if (mclptr->BufferPtr[0])
               result = StringMatchAndRegex (rqptr,
                                             MetaConNote,
                                             mclptr->BufferPtr,
                                             SMATCH_GREEDY_REGEX,
                                             mclptr->RegexPregPtr,
                                             NULL);
            if (WatchThisOne)
               WatchDataFormatted ("!&B note:!AZ \'!AZ\'\n",
                                   result, mclptr->BufferPtr, MetaConNote);
         }
         else
         if (klen == 7 && MATCH8(key,"notepad"))
            result = MetaConSimpleMatch (mclptr, &cptr, klen,
                                         IFRQ(NotePadPtr));
      }
      else
      if (key[0] == 'o' && klen == 3 && MATCH4(key,"ods"))
      {
         /*******/
         /* o.. */
         /*******/

         sptr = MetaConBuffer (mclptr, &cptr, klen);
         if (rqptr == NULL) goto JustChecking;

         if (*sptr == '2')
            result = rqptr->PathOds == MAPURL_PATH_ODS_2;
         else
         if (*sptr == '5')
            result = rqptr->PathOds == MAPURL_PATH_ODS_5;
         else
         if (TOUP(*sptr) == 'A')
            result = rqptr->PathOds == MAPURL_PATH_ODS_ADS;
         else
         if (TOUP(*sptr) == 'P')
            result = rqptr->PathOds == MAPURL_PATH_ODS_PWK;
         else
         if (TOUP(*sptr) == 'S' && TOUP(*(sptr+1)) == 'M')
            result = rqptr->PathOds == MAPURL_PATH_ODS_SMB;
         else
         if (TOUP(*sptr) == 'S' && TOUP(*(sptr+1)) == 'R')
            result = rqptr->PathOds == MAPURL_PATH_ODS_SRI;
         else
            result = false;

         if (WatchThisOne)
            WatchDataFormatted ("!&B ods:!&C !&?2\r5\r\n",
                                result, *sptr, !rqptr->PathOdsExtended);
      }
      else
      if (key[0] == 'p')
      {
         /*******/
         /* p.. */
         /*******/

         if (klen == 4 && MATCH5(key,"pass"))
         {
            MetaConBuffer (mclptr, &cptr, klen);
            if (rqptr == NULL) goto JustChecking;
            if (mclptr->BufferPtr[0] == '-')
               result = (rqptr->MetaConPass < 0);
            else
               result = (mclptr->BufferPtr[0] - '0' == rqptr->MetaConPass); 
            if (WatchThisOne)
               WatchDataFormatted ("!&B pass:!AZ \'!SL\'\n",
                                   result, mclptr->BufferPtr,
                                   rqptr->MetaConPass);
         }
         else
         if (klen == 9 && MATCH10(key,"path-info"))
            result = MetaConSimpleMatch (mclptr, &cptr, klen,
                                         IFRQ(rqHeader.PathInfoPtr));
         else
         if (klen == 15 && MATCH16(key,"path-translated"))
            result = MetaConSimpleMatch (mclptr, &cptr, klen,
                                         IFRQ(RequestMappedFile));
         else
         if (klen == 7 && MATCH8(key,"proctor"))
         {
            MetaConBuffer (mclptr, &cptr, klen);
            if (rqptr) result = !rqptr->rqHeader.MethodName[0];
         }
      }
      else
      if (key[0] == 'q' && klen == 12 && MATCH13(key,"query-string"))
      {
         /*******/
         /* q.. */
         /*******/

         result = MetaConSimpleMatch (mclptr, &cptr, klen,
                                      IFRQ(rqHeader.QueryStringPtr));
      }
      else
      if (key[0] == 'r')
      {
         /*******/
         /* r.. */
         /*******/

         if (klen == 4 && MATCH5(key,"rand"))
         {
            sptr = MetaConBuffer (mclptr, &cptr, klen);
            if (rqptr == NULL) goto JustChecking;

            /* conversion from ASCII string is relatively expensive */
            if (isdigit(*sptr))
            {
               if (isdigit(sptr[1]))
               {
                  modulas = atoi(sptr);
                  while (*sptr && isdigit(*sptr)) sptr++;
               }
               else
                  modulas = *sptr++ - '0';
            }
            else
               modulas = 0;
            if (*sptr == ':') sptr++;
            if (isdigit(*sptr))
            {
               if (isdigit(sptr[1]))
               {
                  number = atoi(sptr);
                  while (*sptr && isdigit(*sptr)) sptr++;
               }
               else
                  number = *sptr++ - '0';
            }
            else
               number = 0;
            if (modulas < 2) modulas = 2;
            result = RandomNumber % modulas == number;

            if (WatchThisOne)
               WatchDataFormatted ("!&B rand:!UL:!UL !UL\n",
                                   result, modulas, number, RandomNumber);
         }
         else
         if (klen == 10 && MATCH11(key,"redirected"))
         {
            sptr = MetaConBuffer (mclptr, &cptr, klen);
            if (rqptr == NULL) goto JustChecking;

            if (sptr[0])
               /* specific count */
               result = (sptr[0] - '0' == rqptr->RedirectCount);
            else
               /* no count specified, treat as a boolean */
               result = rqptr->RedirectCount;
            if (WatchThisOne)
               WatchDataFormatted ("!&B redirected:!AZ \'!UL\'\n",
                                   result, sptr, rqptr->RedirectCount);
         }
         else
         if (klen == 7 && MATCH8(key,"referer"))
            result = MetaConSimpleMatch (mclptr, &cptr, klen,
                                         IFRQ(rqHeader.RefererPtr));
         else
         if (klen == 5 && MATCH6(key,"regex"))
            result = MetaConSimpleBoolean (mclptr, &cptr, klen,
                                           Config.cfMisc.RegexSyntax);
         else
         if (klen == 11 && MATCH12(key,"remote-addr"))
         {
            MetaConBuffer (mclptr, &cptr, klen);
            if (rqptr == NULL) goto JustChecking;

            if (strchr (mclptr->BufferPtr, '/'))
            {
               /* a network mask */
               char *tptr = mclptr->BufferPtr;  /* preserve string address */
               sptr = &rqptr->ClientPtr->IpAddressString;
               result = VMSok (TcpIpNetMask (rqptr, WatchThisOne, &tptr,
                                             &rqptr->ClientPtr->IpAddress));
            }
	    else
            if (mclptr->BufferPtr[0] == '?')
            {
               /* attempt to resolve a host name and use its IP address */
               if (WatchThisOne)
                  WatchDataFormatted ("LOOKUP !AZ\n", mclptr->BufferPtr+1);
               memset (&HostLookup, 0, sizeof(HostLookup));
               TcpIpNameToAddress (&HostLookup, mclptr->BufferPtr+1,
                                   1, NULL, 0);
               result = IPADDRESS_IS_SAME (&rqptr->ClientPtr->IpAddress,
                                           &HostLookup.IpAddress);
               if (WatchThisOne)
                  FaoToBuffer (sptr = IpAddrString, sizeof(IpAddrString), 0,
                               "!&I", &HostLookup.IpAddress); 
            }
            else
            {
               sptr = &rqptr->ClientPtr->IpAddressString;
               result = StringMatchAndRegex (rqptr, sptr, mclptr->BufferPtr,
                                             SMATCH_GREEDY_REGEX,
                                             mclptr->RegexPregPtr,
                                             NULL);
            }
            if (WatchThisOne)
               WatchDataFormatted ("!&B remote-addr:!AZ !AZ\n",
                                   result, mclptr->BufferPtr, sptr);
         }
         else
         if (klen == 11 && MATCH12(key,"remote-host"))
         {
            MetaConBuffer (mclptr, &cptr, klen);
            if (rqptr == NULL) goto JustChecking;

            if (strchr (mclptr->BufferPtr, '/'))
            {
               /* a network mask */
               char *tptr = mclptr->BufferPtr;  /* preserve string address */
               sptr = &rqptr->ClientPtr->IpAddressString;
               result = VMSok (TcpIpNetMask (rqptr, WatchThisOne, &tptr,
                               &rqptr->ClientPtr->IpAddress));
            }
            else
            if (isdigit(mclptr->BufferPtr[0]) || strchr(mclptr->BufferPtr,':'))
            {
               sptr = &rqptr->ClientPtr->IpAddressString;
               result = StringMatchAndRegex (rqptr, sptr, mclptr->BufferPtr,
                                             SMATCH_GREEDY_REGEX,
                                             mclptr->RegexPregPtr,
                                             NULL);
            }
            else
            {
               sptr = rqptr->ClientPtr->Lookup.HostName;
               result = StringMatchAndRegex (rqptr, sptr, mclptr->BufferPtr,
                                             SMATCH_GREEDY_REGEX,
                                             mclptr->RegexPregPtr,
                                             NULL);
            }
            if (WatchThisOne)
               WatchDataFormatted ("!&B remote-host:!AZ !AZ\n",
                                   result, mclptr->BufferPtr, sptr);
         }
         else
         if (klen == 7 && MATCH8(key,"request"))
         {
            char  *aptr;
            sptr = MetaConBuffer (mclptr, &cptr, klen);
            if (rqptr == NULL) goto JustChecking;

            for (aptr = sptr; *aptr && *aptr != ':'; aptr++);
            if (denptr = DictLookup (rqptr->rqDictPtr, DICT_TYPE_REQUEST,
                                     sptr, aptr - sptr))
            {
               result = StringMatchAndRegex (rqptr,
                                             sptr = DICT_GET_VALUE(denptr),
                                             *aptr == ':' ? aptr+1 : aptr,
                                             SMATCH_GREEDY_REGEX,
                                             mclptr->RegexPregPtr,
                                             NULL);
            }
            if (WatchThisOne)
               WatchDataFormatted ("!&B request:!AZ \'!AZ\'\n",
                                   result, mclptr->BufferPtr, sptr);
         }
         else
         if (klen == 14 && MATCH15(key,"request-method"))
         {
            sptr = MetaConBuffer (mclptr, &cptr, klen);
            if (rqptr == NULL) goto JustChecking;

            if (sptr[0] == '?')
               result = (rqptr->rqHeader.Method == HTTP_METHOD_EXTENSION);
            else
               result = StringMatchAndRegex (rqptr,
                                             rqptr->rqHeader.MethodName,
                                             sptr,
                                             SMATCH_GREEDY_REGEX,
                                             mclptr->RegexPregPtr,
                                             NULL);
            if (WatchThisOne)
               WatchDataFormatted ("!&B request-method:!AZ !AZ\n",
                                   result, sptr, rqptr->rqHeader.MethodName);
         }
         else
         if (klen == 16 && MATCH17(key,"request-protocol"))
         {
            sptr = MetaConBuffer (mclptr, &cptr, klen);
            if (rqptr == NULL) goto JustChecking;

            if (MATCH5 (sptr, "HTTP/") || MATCH5 (sptr, "http/")) sptr += 5;
            if (HTTP2_REQUEST(rqptr))
               result = MATCH2 (sptr, "2");
            else
            if (rqptr->rqResponse.HttpVersion == HTTP_VERSION_1_1)
               result = MATCH4 (sptr, "1.1");
            else
            if (rqptr->rqResponse.HttpVersion == HTTP_VERSION_1_0)
               result = MATCH4 (sptr, "1.0");
            else
            if (rqptr->rqResponse.HttpVersion == HTTP_VERSION_0_9)
               result = MATCH4 (sptr, "0.9");
            if (WatchThisOne)
               WatchDataFormatted ("!&B request-protocol:!AZ \'!AZ\'\n",
                                   result, mclptr->BufferPtr, SoftwareId);
         }
         else
         if (klen == 14 && MATCH15(key,"request-scheme"))
         {
            sptr = MetaConBuffer (mclptr, &cptr, klen);
            if (rqptr == NULL) goto JustChecking;

            if (MATCH6(mclptr->BufferPtr,"https") ||
                MATCH7(mclptr->BufferPtr,"https:"))
               result = svptr->RequestScheme == SCHEME_HTTPS;
            else
            if (MATCH5(mclptr->BufferPtr,"http") ||
                MATCH6(mclptr->BufferPtr,"http:"))
               result = svptr->RequestScheme == SCHEME_HTTP;
            else
               result = false;
         }
         else
         if (klen == 11 && MATCH12(key,"request-uri"))
            result = MetaConSimpleMatch (mclptr, &cptr, klen,
                                         IFRQ(rqHeader.RequestUriPtr));
         else
         if (klen == 7 && MATCH8(key,"restart"))
         {
            sptr = MetaConBuffer (mclptr, &cptr, klen);
            if (rqptr == NULL) goto JustChecking;

            if (isdigit(sptr[1]))
               result = (atoi(mclptr->BufferPtr[0]) ==
                         rqptr->MetaConRestartCount);
            else
               result = (mclptr->BufferPtr[0] - '0' ==
                         rqptr->MetaConRestartCount);
            if (WatchThisOne)
               WatchDataFormatted ("!&B restart:!AZ \'!UL\'\n",
                                   result, sptr, rqptr->MetaConRestartCount);
         }
         else
         if (klen == 5 && MATCH6(key,"robin"))
            result = MetaConEvaluateRoundRobin (mclptr, &cptr, klen);
      }
      else
      if (key[0] == 's')
      {
         /*******/
         /* s.. */
         /*******/

         if (klen == 11 && MATCH12(key,"script-name"))
         {
            MetaConBuffer (mclptr, &cptr, klen);
            if (rqptr == NULL) goto JustChecking;

            if (sptr = rqptr->MetaConScriptPtr)
            {
               /* in second pass of rule mapping (groan) */
               if (*sptr == '+')
               {
                  /* CGIplus script indicator */
                  *sptr = '/';
                  result = StringMatchAndRegex (rqptr, sptr, mclptr->BufferPtr,
                                                SMATCH_GREEDY_REGEX,
                                                mclptr->RegexPregPtr,
                                                NULL);
                  if (WatchThisOne)
                     WatchDataFormatted ("!&B script-name:!AZ !AZ\n",
                                         result, mclptr->BufferPtr, sptr);
                  *sptr = '+';
               }
               else
               {
                  /* just a standard script beginning with '/' */
                  result = StringMatchAndRegex (rqptr, sptr, mclptr->BufferPtr,
                                                SMATCH_GREEDY_REGEX,
                                                mclptr->RegexPregPtr,
                                                NULL);
                  if (WatchThisOne)
                     WatchDataFormatted ("!&B script-name:!AZ !AZ\n",
                                         result, mclptr->BufferPtr, sptr);
               }
            }
            else
            {
               /* must be past rule mapping */
               result = StringMatchAndRegex (rqptr,
                                             rqptr->ScriptName,
                                             mclptr->BufferPtr,
                                             SMATCH_GREEDY_REGEX,
                                             mclptr->RegexPregPtr,
                                             NULL);
               if (WatchThisOne)
                  WatchDataFormatted ("!&B script-name:!AZ !AZ\n",
                                      result, mclptr->BufferPtr,
                                      rqptr->ScriptName);
            }
         }
         else
         if (klen == 11 && MATCH12(key,"server-addr"))
         {
            MetaConBuffer (mclptr, &cptr, klen);
            if (rqptr == NULL) goto JustChecking;

            if (!strchr (mclptr->BufferPtr, '/'))
            {
               /* not a network mask */
               sptr = svptr->ServerIpAddressString;
               result = StringMatchAndRegex (rqptr, sptr, mclptr->BufferPtr,
                                             SMATCH_GREEDY_REGEX,
                                             mclptr->RegexPregPtr,
                                             NULL);
            }
            else
            {
               /* a network mask */
               char *tptr = mclptr->BufferPtr;  /* preserve string address */
               result = VMSok (TcpIpNetMask (rqptr, WatchThisOne, &tptr,
                                             &svptr->ServerIpAddress));
            }
            if (WatchThisOne)
               WatchDataFormatted ("!&B server-addr:!AZ !AZ\n",
                                   result, mclptr->BufferPtr,
                                   svptr->ServerIpAddressString);
         }
         else
         if (klen == 17 && MATCH18(key,"server_connect_gt"))
         {
            sptr = MetaConBuffer (mclptr, &cptr, klen);
            if (rqptr == NULL) goto JustChecking;

            InstanceMutexLock (INSTANCE_MUTEX_HTTPD);
            CurrentNumber = 0;
            for (idx = 0; idx <= InstanceNodeCurrent; idx++)
               CurrentNumber += AccountingPtr->CurrentInstanceConnected[HTTP1][idx];
            InstanceMutexUnLock (INSTANCE_MUTEX_HTTPD);
            result = CurrentNumber > atoi(sptr);
            if (WatchThisOne)
               WatchDataFormatted ("!&B server_connect_gt:!AZ !UL\n",
                                   result, sptr, CurrentNumber);
         }
         else
         if (klen == 11 && MATCH12(key,"server-name"))
            result = MetaConSimpleMatch (mclptr, &cptr, klen,
                                         IFRQ(ServicePtr->ServerHostName));
         else
         if (klen == 11 && MATCH12(key,"server-port"))
            result = MetaConSimpleMatch (mclptr, &cptr, klen,
                                         IFRQ(ServicePtr->ServerPortString));
         else
         if (klen == 17 && MATCH18(key,"server_process_gt"))
         {
            sptr = MetaConBuffer (mclptr, &cptr, klen);
            if (rqptr == NULL) goto JustChecking;

            InstanceMutexLock (INSTANCE_MUTEX_HTTPD);
            CurrentNumber = NetCurrentProcessing;
            InstanceMutexUnLock (INSTANCE_MUTEX_HTTPD);
            result = CurrentNumber > atoi(sptr);
            if (WatchThisOne)
               WatchDataFormatted ("!&B server_process_gt:!AZ !UL\n",
                                   result, sptr, CurrentNumber);
         }
         else
         if (klen == 15 && MATCH16(key,"server-protocol"))
         {
            sptr = MetaConBuffer (mclptr, &cptr, klen);
            if (MATCH5 (sptr, "HTTP/")) sptr += 5;
            if (rqptr->rqResponse.HttpVersion == HTTP_VERSION_1_1)
               result = MATCH4 (sptr, "1.1");
            else
            if (rqptr->rqResponse.HttpVersion == HTTP_VERSION_1_0)
               result = MATCH4 (sptr, "1.0");
            else
            if (rqptr->rqResponse.HttpVersion == HTTP_VERSION_0_9)
               result = MATCH4 (sptr, "0.9");
            if (WatchThisOne)
               WatchDataFormatted ("!&B server-protocol:!AZ \'!AZ\'\n",
                                   result, sptr, SoftwareId);
         }
         else
         if (klen == 15 && MATCH16(key,"server-software"))
            result = MetaConSimpleMatch (mclptr, &cptr, klen,
                                         SoftwareId);
         else
         if (klen == 7 && MATCH8(key,"service"))
         {
            sptr = MetaConBuffer (mclptr, &cptr, klen);
            if (rqptr == NULL) goto JustChecking;

            if (*sptr == '?')
            {
               if (rqptr->UnknownVirtualService)
               {
                  while (*sptr && *sptr != ':') sptr++;
                  if (*sptr) sptr++;
                  if (!*sptr || *sptr == '?' || SAME2(sptr,'*\0'))
                     result = true;
                  else
                     result = StringMatch (rqptr,
                                           svptr->ServerPortString,
                                           sptr);
               }
            }
            else
               result = StringMatchAndRegex (rqptr,
                                             svptr->ServerHostPort,
                                             sptr,
                                             SMATCH_GREEDY_REGEX,
                                             mclptr->RegexPregPtr,
                                             NULL);
            if (WatchThisOne)
               WatchDataFormatted ("!&B service:!AZ !AZ\n",
                                   result, mclptr->BufferPtr,
                                   svptr->ServerHostPort);
         }
         else
         if (klen == 3 && MATCH4(key,"ssl"))
         {
            sptr = MetaConBuffer (mclptr, &cptr, klen);
            if (rqptr == NULL) goto JustChecking;

            result = svptr->RequestScheme == SCHEME_HTTPS;
            if (WatchThisOne) WatchDataFormatted ("!&B ssl:\n", result);
         }
         else
         if (klen == 13 && MATCH14(key,"syi_arch_name"))
         {
            MetaConBuffer (mclptr, &cptr, klen);
            if (rqptr == NULL) goto JustChecking;

#ifdef __ALPHA
            result = strsame (mclptr->BufferPtr, "ALPHA", -1) ||
                     strsame (mclptr->BufferPtr, "AXP", -1);
            if (WatchThisOne)
               WatchDataFormatted ("!&B syi_arch_name:!AZ Alpha/AXP\n",
                                   result, mclptr->BufferPtr);
#endif
#ifdef __ia64
            result = strsame (mclptr->BufferPtr, "IA64", -1);
            if (WatchThisOne)
               WatchDataFormatted ("!&B syi_arch_name:!AZ IA64\n",
                                   result, mclptr->BufferPtr);
#endif
#ifdef __x86_64
            result = strsame (mclptr->BufferPtr, "X86", -1);
            if (WatchThisOne)
               WatchDataFormatted ("!&B syi_arch_name:!AZ X86\n",
                                   result, mclptr->BufferPtr);
#endif
         }
         else
         if (klen == 11 && MATCH12(key,"syi_hw_name"))
            result = MetaConSimpleMatch (mclptr, &cptr, klen,
                                         SysInfo.HwName);
         else
         if (klen == 12 && MATCH13(key,"syi_nodename"))
            result = MetaConSimpleMatch (mclptr, &cptr, klen,
                                         SysInfo.NodeName);
         else
         if (klen == 11 && MATCH12(key,"syi_version"))
            result = MetaConSimpleMatch (mclptr, &cptr, klen,
                                         SysInfo.Version);
      }
      else
      if (key[0] == 't')
      {
         /*******/
         /* t.. */
         /*******/

         if (klen == 5 && MATCH6(key,"tcpip"))
            result = MetaConSimpleMatch (mclptr, &cptr, klen,
                                         TcpIpAgentInfo);
         else
         if (klen == 4 && MATCH5(key,"time"))
            result = MetaConEvaluateTime (mclptr, &cptr, klen);
         else
         if (klen == 6 && MATCH7(key,"trnlnm"))
            result = MetaConEvaluateTrnLnm (mclptr, &cptr, klen);
      }
      else
      if (key[0] == 'u')
      {
         /*******/
         /* u.. */
         /*******/

         if (klen == 13 && MATCH14(key,"upstream-addr"))
         {
            MetaConBuffer (mclptr, &cptr, klen);
            if (rqptr == NULL) goto JustChecking;

            if (!strchr (mclptr->BufferPtr, '/'))
            {
               /* not a network mask */
               sptr = rqptr->ClientPtr->UpstreamIpAddressString;
               result = StringMatchAndRegex (rqptr, sptr, mclptr->BufferPtr,
                                             SMATCH_GREEDY_REGEX,
                                             mclptr->RegexPregPtr,
                                             NULL);
            }
            else
            {
               /* a network mask */
               char *tptr = mclptr->BufferPtr;  /* preserve string address */
               result = VMSok (TcpIpNetMask (rqptr, WatchThisOne, &tptr,
                               &rqptr->ClientPtr->UpstreamIpAddress));
            }
            if (WatchThisOne)
               WatchDataFormatted ("!&B upstream-addr:!AZ !AZ\n",
                                   result, mclptr->BufferPtr,
                                   rqptr->ClientPtr->UpstreamIpAddressString);
         }
         else
         if (klen == 10 && MATCH11(key,"user-agent"))
            result = MetaConSimpleMatch (mclptr, &cptr, klen,
                                         IFRQ(rqHeader.UserAgentPtr));
      }
      else
      if (key[0] == 'w')
      {
         /*******/
         /* w.. */
         /*******/

         if (klen == 6 && MATCH7(key,"webdav"))
         {
            MetaConBuffer (mclptr, &cptr, klen);
            if (rqptr == NULL) goto JustChecking;

            if (mclptr->BufferPtr[0])
            {
               if (strsame (mclptr->BufferPtr, "all", 3))
                  result = rqptr->rqPathSet.WebDavAll;
               else
               if (strsame (mclptr->BufferPtr, "auth", 4))
                  result = rqptr->rqPathSet.WebDavAuth;
               else
               if (strsame (mclptr->BufferPtr, "MSagent", 7))
                  result = DavWebMicrosoftDetect (rqptr);
            }
            else
               result = rqptr->WebDavRequest || rqptr->WhiffOfWebDav;
            if (WatchThisOne)
               WatchDataFormatted ("!&B WebDAV:!AZ\n",
                                   result, mclptr->BufferPtr);
         }
         else
         if (klen == 9 && MATCH10(key,"websocket"))
            result = MetaConSimpleBoolean (mclptr, &cptr, klen,
                                           IFRQ(rqHeader.UpgradeWebSocket));
      }
      else
      if (key[0] == 'x' && klen == 4 && MATCH5(key,"x509"))
      {
         /*******/
         /* x.. */
         /*******/

         MetaConBuffer (mclptr, &cptr, klen);
         if (rqptr == NULL) goto JustChecking;

         if (!(result = SesolaClientCertMetaCon (rqptr, mclptr, WatchThisOne)))
            if (rqptr->X509ClientCertMeta)
               return ("\0X509 client certificate required");
         if (WatchThisOne)
            WatchDataFormatted ("!&B X509:!AZ\n", result, mclptr->BufferPtr);
      }
      else
      if (isdigit(*cptr))
      {
         /*******/
         /* 9.. */
         /*******/

         /* numeric "boolean" */
         result = atoi(sptr = cptr);
         while (isdigit(*cptr)) cptr++;
         if (WatchThisOne)
            WatchDataFormatted ("!&B !#AZ\n", result, cptr - sptr, sptr);
      }

      if (rqptr != NULL && cptr == DirectivePtr)
      {
         /************************/
         /* no directive matched */
         /************************/

         /* see if it corresponds to a request header field */
         if (denptr = DictLookup (rqptr->rqDictPtr, DICT_TYPE_REQUEST,
                                  key, klen))
         {
            sptr = MetaConBuffer (mclptr, &cptr, klen);
            if (rqptr == NULL) goto JustChecking;

            result = StringMatchAndRegex (rqptr,
                                          DICT_GET_VALUE(denptr),
                                          mclptr->BufferPtr,
                                          SMATCH_GREEDY_REGEX,
                                          mclptr->RegexPregPtr, NULL);
            if (WatchThisOne)
               WatchDataFormatted ("!&B !AZ \'!AZ\'\n",
                                   result, DICT_GET_KEY(denptr), sptr, cptr);
         }
         else
         if (WatchThisOne)
            if (MetaConCommonRequestHeader (key))
               WatchDataFormatted ("REQUEST FIELD !AZ NOT FOUND\n", key);
            else
               WatchDataFormatted ("(REQUEST FIELD?) !AZ NOT FOUND\n", key);
      }
 
      if (!mclptr->BufferPtr[0] && mclptr->BufferPtr[1])
      {
         /********************/
         /* problem reported */
         /********************/

         if (WatchThisOne) WatchDataFormatted ("!AZ\n", mclptr->BufferPtr+1);
         return (mclptr->BufferPtr);
      }

      JustChecking:  /* can you feel Edsger looking over your shoulder? */

      if (*cptr == '\"' || *cptr == '\'')
      {
         ch2 = *cptr++;
         while (*cptr && *cptr != ch2)
         {
            /* step over any escape character */
            if (*cptr == '\\') cptr++;
            if (*cptr) cptr++;
         }
         if (*cptr) cptr++;
      }
      else
      {
         while (*cptr && !ISLWS(*cptr) && *cptr != ')')
         {
            /* step over any escape character */
            if (*cptr == '\\') cptr++;
            if (*cptr) cptr++;
         }
      }

      if (ch1 != ')')
      {
         if (WatchThisOne && WATCH_MODULE(WATCH_MOD_METACON))
            WatchDataFormatted (">val[!UL]=!&?TRUE\rFALSE\r\n",
                                ResultIndex+1, result);
         if (ResultIndex++ > METACON_STACK_MAX)
         {
            if (WatchThisOne) WatchDataFormatted ("TOO MANY \'(..)\'\n");
            return ("\0Too many \'(..)\'");
         }
         ResultStack[ResultIndex] = result;
      }

      for (;;)
      {
         if (OperatorIndex <= 0)
         {
            if (WatchThisOne) WatchDataFormatted ("UNBALANCED \'(..)\'\n");
            return ("\0Unbalanced \'(..)\'");
         }

         if (*OperatorStack[OperatorIndex] == '(')
         {
            if (ch1 == ')')
            {
               if (WatchThisOne && WATCH_MODULE(WATCH_MOD_METACON))
                  WatchDataFormatted ("<opr[!UL]=(\n", OperatorIndex);
               OperatorIndex--;
               if (*OperatorStack[OperatorIndex] == '!') continue;
            }
            break;
         }

         if (*OperatorStack[OperatorIndex] == '!')
         {
            if (ResultIndex <= 0)
            {
               if (WatchThisOne)
                  WatchDataFormatted ("INSUFFICIENT CONDITIONALS FOR \'!\'\n");
               return ("\0Insufficient conditionals for \'!\'");
            }
            if (WatchThisOne && WATCH_MODULE(WATCH_MOD_METACON))
               WatchDataFormatted (
"<val[!UL]=!&?TRUE\rFALSE\r\n<opr[!UL]=!1AZ\n>val[!UL]=!&?TRUE\rFALSE\r\n",
               ResultIndex, ResultStack[ResultIndex],
                  OperatorIndex, OperatorStack[OperatorIndex],
                  ResultIndex, !ResultStack[ResultIndex]);
            ResultStack[ResultIndex] = !ResultStack[ResultIndex]; 
            OperatorIndex--;
            continue;
         }

         if (*OperatorStack[OperatorIndex] == '&')
         {
            if (ResultIndex <= 1)
            {
               if (WatchThisOne)
                  WatchDataFormatted ("INSUFFICIENT CONDITIONALS FOR \'&&\'\n");
               return ("\0Insufficient conditionals for \'&&\'");
            }
            if (WatchThisOne && WATCH_MODULE(WATCH_MOD_METACON))
               WatchDataFormatted (
"<val[!UL]=!&?TRUE\rFALSE\r\n<val[!UL]=!&?TRUE\rFALSE\r\n\
<opr[!UL]=!1AZ\n>val[!UL]=!&?TRUE\rFALSE\r\n",
                  ResultIndex, ResultStack[ResultIndex],
                  ResultIndex-1, ResultStack[ResultIndex-1],
                  OperatorIndex, OperatorStack[OperatorIndex],
                  ResultIndex-1, ResultStack[ResultIndex-1] &&
                                 ResultStack[ResultIndex]);
            ResultStack[ResultIndex-1] = ResultStack[ResultIndex-1] &&
                                         ResultStack[ResultIndex];
            ResultIndex--;
            OperatorIndex--;
            continue;
         }

         if (*OperatorStack[OperatorIndex] == '|')
         {
            if (ResultIndex <= 1)
            {
               if (WatchThisOne)
                  WatchDataFormatted ("INSUFFICIENT CONDITIONALS FOR \'||\'\n");
               return ("\0Insufficient conditionals for \'||\'");
            }
            if (WatchThisOne && WATCH_MODULE(WATCH_MOD_METACON))
               WatchDataFormatted (
"<val[!UL]=!&?TRUE\rFALSE\r\n<val[!UL]=!&?TRUE\rFALSE\r\n\
<opr[!UL]=!1AZ\n>val[!UL]=!&?TRUE\rFALSE\r\n",
                  ResultIndex, ResultStack[ResultIndex],
                  ResultIndex-1, ResultStack[ResultIndex-1],
                  OperatorIndex, OperatorStack[OperatorIndex],
                  ResultIndex-1, ResultStack[ResultIndex-1] ||
                                 ResultStack[ResultIndex]);
            ResultStack[ResultIndex-1] = ResultStack[ResultIndex-1] ||
                                         ResultStack[ResultIndex];
            ResultIndex--;
            OperatorIndex--;
            continue;
         }

         if (WatchThisOne) WatchDataFormatted ("SANITY CHECK\n");
         return ("\0Sanity check");
      }
   }

   if (!rqptr) mclptr->RegexCompiled = true;

   if (OperatorIndex)
   {
      if (WatchThisOne) WatchDataFormatted ("UNBALANCED \'(..)\'\n");
      return ("\0Unbalanced \'(..)\'");
   }
   if (ResultIndex != 1)
   {
      if (WatchThisOne)
         WatchDataFormatted ("MISSING \'&&\', \'||\', \'!\' OR CONDITIONAL\n");
      return ("\0Missing \'&&\', \'||\', \'!\' or conditional");
   }

   if (ResultStack[ResultIndex])
   {
      if (WatchThisOne) WatchDataFormatted ("TRUE\n");
      /* a sentinal string indicating block-statement true */
      if (!*cptr) return ("\0\0\1\0");
      /* return an in-line directive (also indicates true) */
      return (cptr);
   }

   if (WatchThisOne) WatchDataFormatted ("FALSE\n");
   if (!*cptr)
   {
      /* a sentinal string indicating block-statement false */
      return ("\0\0\0\0");
   }
   /* a sentinal string indicating inline false */
   if (rqptr) return ("\0\0\0\1");
   /* just doing a rule check, return any inline text */
   return (cptr);

#undef IFRQ
}

/*****************************************************************************/
/*
Copies the parameter string following a directive name into the specified
buffer.  For example, this function would buffer "*.vsm.com.au" from the
conditional "host:*.vsm.com.au".  These strings can be enclosed by single or
double quotes and contain backslash-escaped characters.  Escaped chacaters are
unescaped by this function.  If the parameter |klen| is zero then it's a DICT
keyword and can be processed to end-of-string.  For conditionals, an unquoted
string is terminated by white-space, closing parenthesis, or end-of-string.  If
the buffer contents are a regular expression, and there is still available
precompile regex buffers available, then compile the regex.  Don't try to mix
up substitution syntax (''..') inside single quoted strings!!
*/

char* MetaConBuffer
(
METACON_LINE *mclptr,
char **text,
int klen
)
{
   static int  BufferSize;
   static char  *BufferPtr;

   char  *cptr, *sptr, *tptr, *zptr;
   regex_t  RegexPreg;
   REQUEST_STRUCT  *rqptr;

   /*********/
   /* begin */
   /*********/

   rqptr = mclptr->RequestPtr;

   if (WATCHMOD (rqptr, WATCH_MOD_METACON))
      WatchThis (WATCHITM(rqptr), WATCH_MOD_METACON,
                 "MetaConBuffer() !&Z", text ? *text : "(null)");

   zptr = (sptr = BufferPtr) + BufferSize;

   if (text != NULL)
      if (klen)
         tptr = *text + klen + 1;  /* key length plus the colon */
      else
         tptr = *text;

   for (;;)
   {
      if (sptr >= zptr)
      {
         BufferSize = BufferSize ? BufferSize + BufferSize : 512;
         BufferPtr = VmRealloc (BufferPtr, BufferSize, FI_LI);
         zptr = (sptr = BufferPtr) + BufferSize;
      }
      mclptr->BufferPtr = BufferPtr;
      mclptr->BufferSize = BufferSize;

      if (text == NULL)
      {
         /* intialise the buffer */
         mclptr->BufferLength = 0;
         SET4(mclptr->BufferPtr,'\0\0\0\0');
         return (NULL);
      }

      cptr = tptr;
      while (*cptr && NOTEOL(*cptr))
      {
         if (mclptr->Token != METACON_TOKEN_DICT)
            if (*cptr == ')' || ISLWS(*cptr) || ISEOL(*cptr))
               break;

         if (*cptr == '\"')
         {
            cptr++;
            while (*cptr && *cptr != '\"' && sptr < zptr)
            {
               if (*cptr == '\\') cptr++;
               if (*cptr) *sptr++ = *cptr++;
            }
            if (*cptr) cptr++;
         }
         else
         /* if two leading quotes (i.e. substitution) */
         if (*cptr == '\'' && *(cptr+1) == '\'')
         {
            if (sptr < zptr) *sptr++ = *cptr++;
            if (sptr < zptr) *sptr++ = *cptr++;
            while (*cptr && *cptr != '\'' && sptr < zptr)
            {
               if (*cptr == '\\') cptr++;
               if (*cptr) *sptr++ = *cptr++;
            }
            if (*cptr) *sptr++ = *cptr++;
         }
         else
         /* a single leading quote (i.e. not substitution) */
         if (*cptr == '\'')
         {
            cptr++;
            while (*cptr && *cptr != '\'' && sptr < zptr)
            {
               if (*cptr == '\\') cptr++;
               if (*cptr) *sptr++ = *cptr++;
            }
            if (*cptr) cptr++;
         }
         else
         {
            if (*cptr == '\\') cptr++;
            if (*cptr) *sptr++ = *cptr++;
         }
      }
      /* if the buffer overflowed then expand and do it all again */
      if (sptr >= zptr) continue;

      *sptr = '\0';
      mclptr->BufferLength = sptr - mclptr->BufferPtr;
      break;
   }

   if (mclptr->RegexCompiled)
   {
      /* this is during rule processing */
      if (Config.cfMisc.RegexSyntax && mclptr->BufferPtr[0] == REGEX_CHAR)
      {
         if (mclptr->RegexPregCount < METACON_REGEX_PREG_MAX)
            mclptr->RegexPregPtr = &mclptr->RegexPreg[mclptr->RegexPregCount];
         else
            mclptr->RegexPregPtr = NULL;
         mclptr->RegexPregCount++;
      }
      else
         mclptr->RegexPregPtr = NULL;
   }
   else
   if (Config.cfMisc.RegexSyntax &&
       mclptr->BufferPtr[0] == REGEX_CHAR)
   {
      /* this is during rule load */
      if (mclptr->RegexPregCount < METACON_REGEX_PREG_MAX)
         mclptr->RegexPregPtr = &mclptr->RegexPreg[mclptr->RegexPregCount];
      else
         mclptr->RegexPregPtr = &RegexPreg;
      sptr = StringRegexCompile (mclptr->BufferPtr+1, mclptr->RegexPregPtr);
      if (sptr)
      {
         memcpy (mclptr->BufferPtr, "\0Regex: ", 8);
         strzcpy (mclptr->BufferPtr+8, sptr, mclptr->BufferSize-8);
      }
      else
         mclptr->RegexPregCount++;
      if (mclptr->RegexPregPtr == &RegexPreg)
         regfree (mclptr->RegexPregPtr);
      mclptr->RegexPregPtr = NULL;
   }

   if (WATCH_MODULE(WATCH_MOD_METACON))
      WatchDataFormatted ("regex:!&B !&Z\n", mclptr->RegexPregPtr,
                                             mclptr->BufferPtr);
   *text = cptr;

   return (BufferPtr);
} 

/*****************************************************************************/
/*
Return the result in |result| (after parsing any parameter and discarding).
*/

BOOL MetaConSimpleBoolean
(
METACON_LINE *mclptr,
char **text,
int klen,
BOOL result
)
{
   char  *bptr, *key;
   REQUEST_STRUCT  *rqptr;

   /*********/
   /* begin */
   /*********/

   rqptr = mclptr->RequestPtr;

   if (rqptr == NULL || (WATCHMOD (rqptr, WATCH_MOD_METACON)))
      WatchThis (WATCHITM(rqptr), WATCH_MOD_METACON, "MetaConSimpleBoolean()");

   key = *text;

   bptr = MetaConBuffer (mclptr, text, klen);

   if (mclptr->WatchThisOne)
      WatchDataFormatted ("!&B !#AZ:!AZ\n", result, klen, key, bptr);

   return (result);
} 

/*****************************************************************************/
/*
Parse the directive parameter and return the result of a string match with the
supplied |string|.
*/

BOOL MetaConSimpleMatch
(
METACON_LINE *mclptr,
char **text,
int klen,
char *string
)
{
   BOOL  result;
   char  *bptr, *key;
   REQUEST_STRUCT  *rqptr;

   /*********/
   /* begin */
   /*********/

   rqptr = mclptr->RequestPtr;

   if (WATCHMOD (rqptr, WATCH_MOD_METACON))
      WatchThis (WATCHITM(rqptr), WATCH_MOD_METACON, "MetaConSimpleMatch()");

   key = *text;

   bptr = MetaConBuffer (mclptr, text, klen);

   if (rqptr == NULL) return (false);

   if (string)
      result = StringMatchAndRegex (rqptr, string, bptr,
                                    SMATCH_GREEDY_REGEX,
                                    mclptr->RegexPregPtr, NULL);
   else
      result = false;

   if (mclptr->WatchThisOne)
      WatchDataFormatted ("!&B !#AZ:!AZ \'!AZ\'\n",
                          result, klen, key, bptr,
                          string ? string : "(null)");

   return (result);
} 

/*****************************************************************************/
/*
Provide the "cluster-member:" conditional evaluation.
Regenerates the list of cluster members only when the cluster member count
changes.  I guess it's not impossible that one can leave and another join
disabling this approach but that's just tough, I'm not adding the overhead of a
complete round of sys$getsyiw()s to each usage.
*/

BOOL MetaConEvaluateClusterMember
(
METACON_LINE *mclptr,
char **text,
int klen
)
{
#  define SYI_NODENAME_SIZE 15
   struct ClusterNodeStruct {
      char  Name [SYI_NODENAME_SIZE+1];
   };
   static ushort  ClusterNodesCount,
                  Length,
                  SyiClusterNodes;
   static struct ClusterNodeStruct  *ClusterNodesPtr;
   static char  SyiNodeName [16];
   static VMS_ITEM_LIST3  SyiClusterNodesItem [] =
   {
     { sizeof(SyiClusterNodes), SYI$_CLUSTER_NODES, &SyiClusterNodes, 0 },
     { 0,0,0,0 }
   };
   static VMS_ITEM_LIST3  SyiNodeNameItem [] =
   {
     { SYI_NODENAME_SIZE, SYI$_NODENAME, NULL, &Length },
     { 0,0,0,0 }
   };

   BOOL  Result;
   int  idx, status;
   ulong  CsidAdr;
   char  *bptr, *cptr, *sptr, *zptr;
   IO_SB  IOsb;
   REQUEST_STRUCT  *rqptr;

   /*********/
   /* begin */
   /*********/

   rqptr = mclptr->RequestPtr;

   if (rqptr == NULL || (WATCHMOD (rqptr, WATCH_MOD_METACON)))
      WatchThis (WATCHITM(rqptr), WATCH_MOD_METACON,
                 "MetaConEvaluateClusterMember()");

   bptr = MetaConBuffer (mclptr, text, klen);

   if (rqptr == NULL) return (false);

   status = sys$getsyiw (EfnWait, 0, 0, &SyiClusterNodesItem, &IOsb, 0, 0);
   if (VMSok (status)) status = IOsb.Status;
   if (VMSnok (status))
   {
      ErrorNoticed (rqptr, status, NULL, FI_LI);
      return (false);
   }
#ifdef WATCH_MOD
   if (!SyiClusterNodes)
      if (cptr = SysTrnLnm (WASD_CLUSTER_NODES))
         SyiClusterNodes = atoi(cptr);
#endif

   if (SyiClusterNodes != ClusterNodesCount)
   {
      if (ClusterNodesPtr) VmFree (ClusterNodesPtr, FI_LI);
      ClusterNodesPtr = VmGet (sizeof(struct ClusterNodeStruct) *
                               SyiClusterNodes);
      ClusterNodesCount = idx = 0;
      CsidAdr = -1;
      for (idx = 0; idx < SyiClusterNodes; idx++)
      {
         SyiNodeNameItem[0].buf_addr = ClusterNodesPtr[idx].Name;
         status = sys$getsyiw (EfnWait, &CsidAdr, 0,
                               &SyiNodeNameItem, &IOsb, 0, 0);
         if (VMSok (status)) status = IOsb.Status;
         if (status == SS$_NOMORENODE) break;
         if (VMSnok (status))
         {
            ErrorNoticed (rqptr, status, NULL, FI_LI);
            return (false);
         }
      }
      ClusterNodesCount = idx;
   }

   Result = false;
   for (idx = 0; idx < ClusterNodesCount; idx++)
   {
      if (StringMatchAndRegex (rqptr, ClusterNodesPtr[idx].Name, bptr,
                               SMATCH_GREEDY_REGEX,
                               mclptr->RegexPregPtr, NULL))
      {
         if (!mclptr->WatchThisOne) return (true);
         Result = true;
         break;
      }
   }

   if (!mclptr->WatchThisOne) return (Result);

   WatchDataFormatted ("!&B cluster-member:!AZ", Result, bptr);
   for (idx = 0; idx < ClusterNodesCount; idx++)
      WatchDataFormatted (" !AZ", ClusterNodesPtr[idx].Name);
   WatchDataFormatted ("\n");
   return (Result);
} 

/*****************************************************************************/
/*
Provide the "time:" conditional evaluation.
See description in module prologue.
*/

BOOL MetaConEvaluateTime
(
METACON_LINE *mclptr,
char **text,
int klen
)
{
   static char  TimeString [24];
   static $DESCRIPTOR (TimeStringDsc, TimeString);
   static $DESCRIPTOR (TimeFaoDsc, "!4UL-!2ZL-!2ZL !2ZL:!2ZL:!2ZL.!2ZL\0");

   BOOL  Result;
   int  CurrentMinute,
        DayOfWeek,
        EndMinute,
        StartMinute;
   char  *bptr;
   REQUEST_STRUCT  *rqptr;

   /*********/
   /* begin */
   /*********/

   rqptr = mclptr->RequestPtr;

   if (rqptr == NULL || (WATCHMOD (rqptr, WATCH_MOD_METACON)))
      WatchThis (WATCHITM(rqptr), WATCH_MOD_METACON, "MetaConEvaluateTime()");

   bptr = MetaConBuffer (mclptr, text, klen);

   if (rqptr == NULL) return (false);

   if (isdigit(bptr[0]) && !bptr[1])
   {
      /* day of week, 1 == Monday, 2 == Tuesday .. 7 == Sunday */
      DayOfWeek = bptr[0] - '0';
      Result = (DayOfWeek == HttpdDayOfWeek);
      if (mclptr->WatchThisOne)
         WatchDataFormatted ("!&B !UL == !UL\n",
                             Result, DayOfWeek, HttpdDayOfWeek);
      return (Result);
   }

   if (isdigit(bptr[0]) && isdigit(bptr[1]) &&
       isdigit(bptr[2]) && isdigit(bptr[3]) && bptr[4] == '-' &&
       isdigit(bptr[5]) && isdigit(bptr[6]) &&
       isdigit(bptr[7]) && isdigit(bptr[8])) 
   {
      /* time range */
      Result = true;
      StartMinute = (((bptr[0]-'0')*10) + (bptr[1]-'0')) * 60;
      if (StartMinute > 1380) Result = false;
      StartMinute += ((bptr[2]-'0')*10) + (bptr[3]-'0');
      if (StartMinute >= 1440) Result = false;
      EndMinute = (((bptr[5]-'0')*10) + (bptr[6]-'0')) * 60;
      if (EndMinute > 1380) Result = false;
      EndMinute += ((bptr[7]-'0')*10) + (bptr[8]-'0');
      if (EndMinute >= 1440) Result = false;
      if (Result)
      {
         CurrentMinute = HttpdTime7[3] * 60 + HttpdTime7[4];
         if (StartMinute <= CurrentMinute && CurrentMinute <= EndMinute)
            Result = true;
         else
            Result = false;
         if (mclptr->WatchThisOne)
            WatchDataFormatted ("!&B !UL <= !UL <= !UL\n",
               Result, StartMinute, CurrentMinute, EndMinute);
         return (Result);
      }
      if (mclptr->WatchThisOne) WatchDataFormatted ("FALSE times?\n");
      return (Result);
   }

   /* comparison time string */
   sys$fao (&TimeFaoDsc, NULL, &TimeStringDsc,
            HttpdTime7[0], HttpdTime7[1], HttpdTime7[2],
            HttpdTime7[3], HttpdTime7[4], HttpdTime7[5],
            HttpdTime7[6]);
   Result = StringMatchAndRegex (rqptr, TimeString, bptr,
                                 SMATCH_GREEDY_REGEX,
                                 mclptr->RegexPregPtr, NULL);
   if (mclptr->WatchThisOne)
      WatchDataFormatted ("!&B !AZ \'!AZ\'\n", Result, TimeString, bptr);
   return (Result);
} 

/*****************************************************************************/
/*
Provide the "trnlnm:" conditional evaluation.
See description in module prologue.
*/

BOOL MetaConEvaluateTrnLnm
(
METACON_LINE *mclptr,
char **text,
int klen
)
{
   static long  LnmCaseBlind = LNM$M_CASE_BLIND;
   static ushort  Length;
   static $DESCRIPTOR (NameDsc, "");
   static $DESCRIPTOR (LnmTableDsc, "");
   static VMS_ITEM_LIST3  LnmItem [] =
   {
      { 255, LNM$_STRING, NULL, &Length },
      { 0,0,0,0 }
   };

   BOOL  Result;
   int  status;
   char  *bptr, *cptr;
   char  LnmValue [256];
   REQUEST_STRUCT  *rqptr;

   /*********/
   /* begin */
   /*********/

   rqptr = mclptr->RequestPtr;

   if (rqptr == NULL || (WATCHMOD (rqptr, WATCH_MOD_METACON)))
      WatchThis (WATCHITM(rqptr), WATCH_MOD_METACON, "MetaConEvaluateTrnLnm()");

   bptr = MetaConBuffer (mclptr, text, klen);

   if (rqptr == NULL) return (false);

   /* syntax is 'trnlnm:name[;table][:value]' */
   for (cptr = bptr;
        *cptr && *cptr != ';' && *cptr != ':';
        cptr++);
   if (*cptr == ';')
   {
      /* a logical name table has been specified */
      *cptr++ = '\0';
      LnmTableDsc.dsc$a_pointer = cptr;
      while (*cptr && *cptr != ':') cptr++;
      LnmTableDsc.dsc$w_length = cptr - LnmTableDsc.dsc$a_pointer;
      if (*cptr == ':') *cptr++ = '\0';
   }
   else
   {
      if (*cptr == ':') *cptr++ = '\0';
      LnmTableDsc.dsc$a_pointer = "LNM$FILE_DEV";
      LnmTableDsc.dsc$w_length = 12;
   }
   if (!bptr[0]) return (false);
   NameDsc.dsc$a_pointer = bptr;
   NameDsc.dsc$w_length = strlen(bptr);

   LnmItem[0].buf_addr = LnmValue;

   status = sys$trnlnm (&LnmCaseBlind, &LnmTableDsc, &NameDsc, 0, &LnmItem);

   if (WATCH_MODULE(WATCH_MOD_METACON))
      WatchDataFormatted ("!&S !&Z !&Z {!UL}!-!#AZ !&Z\n",
                          status, bptr, LnmTableDsc.dsc$a_pointer,
                          Length, LnmValue, cptr); 

   if (VMSok (status))
   {
      LnmValue[Length] = '\0';
      if (*cptr)
         Result = StringMatchAndRegex (rqptr, LnmValue, cptr,
                                       SMATCH_GREEDY_REGEX,
                                       mclptr->RegexPregPtr, NULL);
      else
         Result = true;
      if (mclptr->WatchThisOne)
         WatchDataFormatted ("!&B !AZ !AZ \'!AZ\' \'!AZ\'\n",
                             Result, NameDsc.dsc$a_pointer,
                             LnmTableDsc.dsc$a_pointer, LnmValue, cptr);
      return (Result);
   }

   if (mclptr->WatchThisOne)
      WatchDataFormatted ("FALSE !AZ !AZ %!&M\n",
                          NameDsc.dsc$a_pointer, LnmTableDsc.dsc$a_pointer,
                          status);
   if (status == SS$_NOLOGNAM || status == SS$_IVLOGTAB) return (false);
   ErrorNoticed (rqptr, status, NULL, FI_LI);
   return (false);
} 

/*****************************************************************************/
/*
This function is called with 'String' containing either a comma-separated list
of node names (that are expected to have instances of WASD instantiated) or a
single node name.  The first case is used to set up the round-robin selection
(i.e. select the next node name to apply the second case to), while that second
case is used to apply a particular rule against.  See description of the
functioning of the (round-)robin: rule in the module description.
*/ 

MetaConEvaluateRoundRobin
(
METACON_LINE *mclptr,
char **text,
int klen
)
{
   static char  NodeName [32];

   BOOL  Result;
   int  cnt, NodeCount, SearchCount;
   char  *bptr, *cptr, *sptr, *zptr;
   REQUEST_STRUCT  *rqptr;

   /*********/
   /* begin */
   /*********/

   rqptr = mclptr->RequestPtr;

   if (rqptr == NULL || (WATCHMOD (rqptr, WATCH_MOD_METACON)))
      WatchThis (WATCHITM(rqptr), WATCH_MOD_METACON,
                 "MetaConEvaluateRoundRobin() !UL",
                 mclptr->RoundRobinCount+1);

   bptr = MetaConBuffer (mclptr, text, klen);

   if (rqptr == NULL) return (false);

   NodeCount = 1;
   for (cptr = bptr; *cptr; cptr++) if (*cptr == ',') NodeCount++;
   /* if it's a comma-separated list */
   if (NodeCount > 1)
   {
      /* then it's setting-up the round-robin conditional */
      MetaConInstanceList ();

      /* search for each of the nodes of the conditional in the list */ 
      for (SearchCount = NodeCount; SearchCount; SearchCount--)
      {
         /* modulas the round-robin count by the node count */
         cnt = mclptr->RoundRobinCount++ % NodeCount;
         /* find a particular node name in the cluster instance list */
         for (cptr = bptr; *cptr && cnt; cptr++) if (*cptr == ',') cnt--;
         if (*cptr == ',') cptr++;
         zptr = (sptr = NodeName) + sizeof(NodeName);
         while (*cptr && *cptr != ',' && sptr < zptr) *sptr++ = *cptr++;
         *sptr = '\0';

         /* check if the above name is found in the current instance list */
         sptr = MetaConInstanceListPtr;
         while (*sptr)
         {
            cptr = NodeName;
            while (*cptr && *sptr && *sptr != ',' &&
                   TOLO(*cptr) == TOLO(*sptr))
            {
               cptr++;
               sptr++;
            }
            if (!*cptr && (!*sptr || *sptr == ',')) break;
            while (*sptr && *sptr != ',') sptr++;
            if (*sptr) sptr++;
         }
         /* if it was found in the instance list */
         if (!*cptr && (!*sptr || *sptr == ',')) break;
      }
      if (SearchCount)
         Result = true;
      else
      {
         Result = false;
         NodeName[0] = '?';
         NodeName[1] = '\0';
      }

      if (mclptr->WatchThisOne)
         WatchDataFormatted ("!&B !AZ from !AZ in instances !AZ\n",
                             Result, NodeName, bptr, MetaConInstanceListPtr);
   }
   else
   {
      /* it's applying the round-robin conditional */
      Result = strsame (NodeName, bptr, -1);

      if (mclptr->WatchThisOne)
         WatchDataFormatted ("!&B !AZ in instances !AZ\n",
                             Result, NodeName, bptr);
   }

   return (Result);
}

/*****************************************************************************/
/*
This function is called with 'String' containing either a comma-separated list
of node names (that are expected to have instances of WASD instantiated) or a
single node name.  The first case is used to set up the round-robin selection
(i.e. select the next node name to apply the second case to), while that second
case is used to apply a particular rule against.  See description of the
functioning of the instance: rule in the module description.
*/ 

MetaConEvaluateInstance
(
METACON_LINE *mclptr,
char **text,
int klen
)
{
   BOOL  Result;
   int  NodeCount;
   char  *aptr, *bptr, *cptr, *sptr, *zptr;
   char  NodeName [32];
   REQUEST_STRUCT  *rqptr;

   /*********/
   /* begin */
   /*********/

   rqptr = mclptr->RequestPtr;

   if (mclptr->WatchThisOne && WATCH_MODULE(WATCH_MOD_METACON))
      WatchThis (WATCHITM(rqptr), WATCH_MOD_METACON, "MetaConEvaluateInstance()");

   bptr = MetaConBuffer (mclptr, text, klen);

   if (rqptr == NULL) return (false);

   NodeCount = 1;
   for (cptr = bptr; *cptr; cptr++) if (*cptr == ',') NodeCount++;
   /* if it's a comma-separated list */
   if (NodeCount > 1)
   {
      /* then it's setting-up the instance conditional */
      MetaConInstanceList ();

      /* search for each of the nodes of the conditional in the list */ 
      aptr = bptr;
      while (*aptr)
      {
         zptr = (sptr = NodeName) + sizeof(NodeName);
         while (*aptr && *aptr != ',' && sptr < zptr) *sptr++ = *aptr++;
         *sptr = '\0';
         while (*aptr == ',') aptr++;

         /* check if the above name is found in the current instance list */
         sptr = MetaConInstanceListPtr;
         while (*sptr)
         {
            cptr = NodeName;
            while (*cptr && *sptr && *sptr != ',' &&
                   TOLO(*cptr) == TOLO(*sptr))
            {
               cptr++;
               sptr++;
            }
            if (!*cptr && (!*sptr || *sptr == ',')) break;
            while (*sptr && *sptr != ',') sptr++;
            if (*sptr) sptr++;
         }
         if (!*cptr && (!*sptr || *sptr == ',')) break;
      }

      /* if at least one of the specified nodenames is in the instance list */
      if (!*cptr && (!*sptr || *sptr == ','))
         Result = true;
      else
         Result = false;

      if (mclptr->WatchThisOne)
         WatchDataFormatted ("!&B at least one of !AZ in instances !AZ\n",
                             Result, bptr, MetaConInstanceListPtr);
   }
   else
   {
      /* find the specified node name in the cluster instance list */
      sptr = MetaConInstanceListPtr;
      while (*sptr)
      {
         cptr = bptr;
         while (*cptr && *sptr && *sptr != ',' && TOLO(*cptr) == TOLO(*sptr))
         {
            cptr++;
            sptr++;
         }
         if (!*cptr && (!*sptr || *sptr == ',')) break;
         while (*sptr && *sptr != ',') sptr++;
         if (*sptr) sptr++;
      }
      /* if it was found in the instance list */
      if (!*cptr && (!*sptr || *sptr == ','))
         Result = true;
      else
         Result = false;

      if (mclptr->WatchThisOne)
         WatchDataFormatted ("!&B !AZ in instances !AZ\n",
                             Result, bptr, MetaConInstanceListPtr);
   }

   return (Result);
}

/*****************************************************************************/
/*
Generate a global pointer to a comma-separated list of the cluster node names
currently executing instances of WASD.  If a node has joined the instance group
(i.e. potentially more nodes) or the number of members of that group has
changed (i.e. potenitally fewer nodes) then regenerate the list.
*/ 

MetaConInstanceList ()

{
   static int  NodeJoiningCount;

   int  InstanceCount;
   char  *cptr, *sptr;

   /*********/
   /* begin */
   /*********/

   if (WATCH_MODULE(WATCH_MOD_METACON))
      WatchThis (WATCHALL, WATCH_MOD_METACON,
                 "MetaConInstanceList() !UL !AZ",
                 MetaConInstanceListCount, MetaConInstanceListPtr);

   if (InstanceNodeJoiningCount == NodeJoiningCount)
      InstanceCount = InstanceLockList (INSTANCE_CLUSTER, NULL, NULL);
   else
   {
      /* cluster instance composition may have changed */
      NodeJoiningCount = InstanceNodeJoiningCount;
      InstanceCount = -1;
   }

   /* if no changes just continue using the current pointer */
   if (InstanceCount == MetaConInstanceListCount) return;

   /* changed since last time, regenerate the list */
   if (MetaConInstanceListPtr) free (MetaConInstanceListPtr);
   MetaConInstanceListCount = InstanceLockList (INSTANCE_CLUSTER, ",",
                                                &MetaConInstanceListPtr);

   /* turn "NODE1::WASD:80,NODE2::WASD:80" into "NODE1,NODE2" */
   cptr = sptr = MetaConInstanceListPtr;
   while (*cptr)
   {
      if (*cptr != ':')
      {
         *sptr++ = *cptr++;
         continue;
      }
      while (*cptr && *cptr != ',') cptr++;
   }
   *sptr = '\0';

   if (WATCH_MODULE(WATCH_MOD_METACON))
      WatchThis (WATCHALL, WATCH_MOD_METACON, "!UL !AZ",
                 MetaConInstanceListCount, MetaConInstanceListPtr);
}

/*****************************************************************************/
/*
Try to establish how many other requests the client represented by 'rqptr' has
being processed by the server.  It does this by scanning the list of requests,
initially looking for requests with the same client IP address.  When it finds
one it then checks if both the candidate and list requests are being handled by
a proxy server (or reasonable indication thereof).  If it is it compares the
proxy data (if any, if not then too bad for the proxy) and it's the same then
this is counted as a concurrent request.  Request structures in a keep-alive
state (i.e. not actually currently having a request processed are not counted. 
Note that it will always find at least one matching request in the list - its
own, and so the concurrent value returned will always be at least one!  This
mechanism breaks down a little with multiple instances so we're going to try a
guesstimate.  This facility is not intended for fine-grained control anyway,
just to stop one client hogging a sizable proportion of the resources.  This
function needs to be called with 'rqptr' NULL to reset the client with each
metacon rule parse reset.
*/ 

BOOL MetaconClientConcurrent
(
METACON_LINE *mclptr,
char **text,
int klen
)
{
   static BOOL  ConcurrentCurrent;
   static int  ClientConcurrent; 

   BOOL  result;
   char  *bptr;
   IPADDRESS  IpAddress;
   LIST_ENTRY  *leptr;
   REQUEST_STRUCT  *rqptr;
   REQUEST_STRUCT  *rqeptr;

   /*********/
   /* begin */
   /*********/

   if (mclptr == NULL)
   {
      /* reset */
      ConcurrentCurrent = false;
      ClientConcurrent = 0;
      return (false);
   }

   rqptr = mclptr->RequestPtr;

   if (WATCHMOD (rqptr, WATCH_MOD_METACON))
      WatchThis (WATCHITM(rqptr), WATCH_MOD_REQUEST,
                 "MetaconClientConcurrent()");

   bptr = MetaConBuffer (mclptr, text, klen);

   if (rqptr == NULL) return (false);

   if (ConcurrentCurrent)
   {
      result = (ClientConcurrent > atoi(mclptr->BufferPtr));

      if (mclptr->WatchThisOne)
         WatchDataFormatted ("!&B client_connect_gt:!AZ !UL\n",
                             result, bptr, ClientConcurrent);

      return (result);
   }
   ConcurrentCurrent = true;

   memcpy (&IpAddress, &rqptr->ClientPtr->IpAddress, sizeof(IpAddress));

   for (leptr = RequestList.HeadPtr; leptr; leptr = leptr->NextPtr)
   {
      rqeptr = (REQUEST_STRUCT*)leptr;

      /* if most probably a persistent connection waiting */
      if (!rqeptr->BytesRx64 && rqeptr->rqNet.PersistentCount) continue;

      if (!IPADDRESS_IS_SAME (&IpAddress, &rqeptr->ClientPtr->IpAddress))
         continue;

      if (rqptr->rqHeader.XForwardedForPtr &&
          rqeptr->rqHeader.XForwardedForPtr)
      {
         /* if the "X-Forwarded-For:" fields are not the same then next */
         if (strcmp (rqptr->rqHeader.XForwardedForPtr,
                     rqeptr->rqHeader.XForwardedForPtr)) continue;
      }
      else
      if (rqptr->rqHeader.ForwardedPtr &&
          rqeptr->rqHeader.ForwardedPtr)
      {
         /* if the "Forwarded:" fields are not the same then next */
         if (strcmp (rqptr->rqHeader.ForwardedPtr,
                     rqeptr->rqHeader.ForwardedPtr)) continue;
      }

      ClientConcurrent++;
   }

   if (InstanceNodeCurrent > 1)
   {
      /* if three or more on this instance it's likely the same on others */
      if (ClientConcurrent > 2) ClientConcurrent *= InstanceNodeCurrent;
   }

   result = (ClientConcurrent > atoi(mclptr->BufferPtr));

   if (mclptr->WatchThisOne)
      WatchDataFormatted ("!&B client_connect_gt:!AZ !UL\n",
                          result, bptr, ClientConcurrent);

   return (result);
}

/*****************************************************************************/
/*
Compare single "??:" conditional string to each of a comma-separated list in
the form "item" or "item1, item2, item3", etc. String may contain '*' and '%'
wildcards.  We can munge the list string like this because it's in a scratch
buffer.
*/

BOOL MetaConConditionalList
(
METACON_LINE *mclptr,
char **text,
int klen,
char *string
)
{
   BOOL  result;
   char  ch;
   char  *bptr, *cptr, *key, *sptr;
   REQUEST_STRUCT  *rqptr;

   /*********/
   /* begin */
   /*********/

   rqptr = mclptr->RequestPtr;

   if (WATCHMOD (rqptr, WATCH_MOD_METACON))
      WatchThis (WATCHITM(rqptr), WATCH_MOD_METACON,
                 "MetaConConditionalList() !&Z !&Z", *text, string);

   if (string == NULL) return (false);

   result = false;

   key = *text;

   bptr = MetaConBuffer (mclptr, text, klen);

   if (*(cptr = string))
   {
      while (*cptr)
      {
         /* spaces and commas are element separators, step over */
         while (ISLWS(*cptr) || *cptr == ',') cptr++;
         /* if end of list (or empty) then finished */
         if (!*cptr) break;
         /* find end of this element, save next character, terminate element */
         for (sptr = cptr; *sptr && !ISLWS(*cptr) && *sptr != ','; sptr++);
         ch = *sptr;
         *sptr = '\0';
         /* look for what we want */
         result = StringMatchAndRegex (rqptr, bptr, cptr, 
                                       SMATCH_GREEDY_REGEX,
                                       mclptr->RegexPregPtr,
                                       NULL);
         if (result) break;
         if (*(cptr = sptr) = ch) cptr++;
      }
   }

   if (mclptr->WatchThisOne)
      WatchDataFormatted ("!&B !#AZ:!AZ \'!AZ\'\n",
                          result, klen, key, bptr, string);

   return (result);
}

/*****************************************************************************/
/*
Process a meta-config key in the request dictionary.
Strings have already been processed to remove enclosing quotes and to escape
characters.  Prefix the key with an exclamation point to remove an entry.
Used by both the DICT meta directive and the mapping SET DICT=.. directive.
*/

void MetaConDictionary
(
REQUEST_STRUCT *rqptr,
char *string
)
{
   BOOL  remove;
   int  klen, vlen;
   char  *cptr, *kptr, *type, *vptr;
   DICT_ENTRY_STRUCT  *denptr;

   /*********/
   /* begin */
   /*********/

   if (WATCHMOD (rqptr, WATCH_MOD_METACON))
      WatchThis (WATCHITM(rqptr), WATCH_MOD_METACON,
                 "MetaConDictionary() !&Z", string);

   /* use substitution only when indicated */
   for (cptr = string; *cptr; cptr++)
      if (MATCH2(cptr, "\'\'")) break;
   if (*cptr) string = MetaConSubstitute (rqptr, string);

   for (kptr = cptr = string; *cptr && *cptr != '='; cptr++);
   klen = cptr - kptr;
   if (*cptr) cptr++;
   for (vptr = cptr; *cptr; cptr++);
   vlen = cptr - vptr;

   if (remove = (kptr[0] == '!'))
   {
      /* remove entry */
      kptr++;
      klen--;
   }

   if (remove && !klen && !vlen)
   {
      /* remove all config (DICT and SET DICT..) entries */
      DictIterate (rqptr->rqDictPtr, NULL);
      while (denptr = DictIterate (rqptr->rqDictPtr, DICT_TYPE_CONFIG))
         DictRemoveEntry (denptr);
   }
   else
   {
      if (isalnum(kptr[0]))
         type = DICT_TYPE_CONFIG;
      else
      {
         /* control exactly what other types of entry can be managed */
         if (kptr[0] == DICT_TYPE_CONFIG[0])
            type = DICT_TYPE_CONFIG;
         else
         if (kptr[0] == DICT_TYPE_INTERNAL[0])
            type = DICT_TYPE_INTERNAL;
         else
         if (kptr[0] == DICT_TYPE_REQUEST[0])
            type = DICT_TYPE_REQUEST;
         else
         if (kptr[0] == DICT_TYPE_RESPONSE[0])
            type = DICT_TYPE_RESPONSE;
         else
         {
            if (WATCHING (rqptr, WATCH_INTERNAL))
               WatchThis (WATCHITM(rqptr), WATCH_INTERNAL,
                          "DICT key \\!#AZ\\ type \\!&C\\ not permitted",
                          klen, kptr, kptr[0]);
            return;
         }
         kptr++;
         klen--;
      }

      if (remove)
         DictRemove (rqptr->rqDictPtr, type, kptr, klen);
      else
         DictInsert (rqptr->rqDictPtr, type, kptr, klen, vptr, vlen);
   }
}

/*****************************************************************************/
/*
Maintaining its own dynamic buffer, parse the supplied string looking for
''..' substitution escape sequence and replace the ''<key>' with the contents
of that key.  If the key word is unknown the "''<key>'" just becomes a literal. 
*/

char* MetaConSubstitute
(
REQUEST_STRUCT *rqptr,
char *string
)
{
   static int  BufferSize;
   static char  *BufferPtr;

   char  ch;
   char  *aptr, *cptr, *sptr, *tptr, *zptr;

   /*********/
   /* begin */
   /*********/

   if (WATCHMOD (rqptr, WATCH_MOD_METACON))
      WatchThis (WATCHITM(rqptr), WATCH_MOD_METACON,
                 "MetaConSubstitute() !AZ", string);

   zptr = (sptr = BufferPtr) + BufferSize;

   for (;;)
   {
      if (sptr >= zptr)
      {
         BufferSize = BufferSize ? BufferSize + BufferSize : 512;
         BufferPtr = VmRealloc (BufferPtr, BufferSize, FI_LI);
         zptr = (sptr = BufferPtr) + BufferSize;
      }

      zptr = (sptr = BufferPtr) + BufferSize;
      for (cptr = string; *cptr && sptr < zptr;)
      {
         if (MATCH2(cptr, "\'\'"))
         {
            tptr = cptr;
            for (aptr = (cptr += 2); *cptr && *cptr != '\''; cptr++);
            if (*cptr == '\'')
            {
               /* search for the keyword and copy in if found */
               if (aptr = MetaConDatum (rqptr, aptr, cptr - aptr))
               {
                  while (*aptr && sptr < zptr) *sptr++ = *aptr++;
                  cptr++;
               }
               else
               {
                  /* key not found - copy as-is */
                  while (*tptr && tptr <= cptr && sptr < zptr)
                     *sptr++ = *tptr++;
                  cptr++;
               }
            }
            else
               /* key not finalised with a single quote - copy as-is */
               while (*tptr && sptr < zptr) *sptr++ = *tptr++;
         }
         else
            *sptr++ = *cptr++;
      }

      /* if the buffer overflowed then expand and do it all again */
      if (sptr >= zptr) continue;

      *sptr = '\0';
      break;
   }

   return (BufferPtr);
} 

/*****************************************************************************/
/*
Look up the substitution key and return a pointer to the value string. 
Return NULL if the key word is unknown.  If the key begins with an
alpha-numeric it is looked for in the meta entries, then the request field
entries, then the internal entries.  If it begins with a non-alpha-numeric then
it is understood to be an entry type character and the look-up is specific.
*/

void* MetaConDatum
(
REQUEST_STRUCT *rqptr,
char *key,
int klen
)
{
   char  *aptr, *cptr, *sptr, *zptr;
   DICT_ENTRY_STRUCT  *denptr;

   /*********/
   /* begin */
   /*********/

   if (WATCHMOD (rqptr, WATCH_MOD_METACON))
      WatchThis (WATCHITM(rqptr), WATCH_MOD_METACON, "MetaConDatum()");

   if (!isalnum(key[0]))
   {
      /* leading character must be an entry type character (e.g. '$', '~') */
      denptr = DictLookup (rqptr->rqDictPtr, key, key+1, klen-1); 
      if (denptr != NULL) return ((void*)DICT_GET_VALUE(denptr));
      return (NULL);
   }

   /* configuration set meta data */
   denptr = DictLookup (rqptr->rqDictPtr, DICT_TYPE_CONFIG, key, klen); 
   if (denptr != NULL) return ((void*)DICT_GET_VALUE(denptr));

   /* request header fields */
   denptr = DictLookup (rqptr->rqDictPtr, DICT_TYPE_REQUEST, key, klen); 
   if (denptr != NULL) return ((void*)DICT_GET_VALUE(denptr));

   /* internal dictionary data */
   denptr = DictLookup (rqptr->rqDictPtr, DICT_TYPE_INTERNAL, key, klen); 
   if (denptr != NULL) return ((void*)DICT_GET_VALUE(denptr));

   return (NULL);
} 

/*****************************************************************************/
/*
Manage the notepad dictionary entry.  Notepad is somewhat obsolescent with the
arrival of dictionary meta-config (v11.0) but obviously kept for backward
compatibility.
*/

void MetaConNotePad
(
REQUEST_STRUCT *rqptr,
char *string,
BOOL WatchThisOne
)
{
   int  length;
   char  *bptr, *cptr, *sptr, *zptr;
   DICT_ENTRY_STRUCT  *denptr;

   /*********/
   /* begin */
   /*********/

   if (WATCH_MODULE(WATCH_MOD_METACON))
      WatchThis (WATCHALL, WATCH_MOD_METACON,
                 "MetaConNotePad() !&Z", string);

   if (string == NULL || !string[0])
   {
      /* reset the notepad */
      if (rqptr->NotePadPtr != NULL)
         DictRemove (rqptr->rqDictPtr, DICT_TYPE_INTERNAL, "notepad", 7);
      rqptr->NotePadPtr = NULL;
      rqptr->NotePadDictEntry = NULL;
      return;
   }

   for (cptr = string; *cptr; cptr++);
   length = cptr - string;

   if ((denptr = rqptr->NotePadDictEntry) == NULL)
   {
      /* two times whatever asked for with a minimum of 256 bytes */
      if (length < 128) length = 128;
      /* create a dictionary entry reserving space */
      denptr = DictInsert (rqptr->rqDictPtr, DICT_TYPE_INTERNAL,
                           "notepad", 7, NULL, length * 2);
      rqptr->NotePadDictEntry = denptr;
      rqptr->NotePadPtr = DICT_GET_VALUE(denptr);
   }
   else
   if (DICT_GET_VALUE_LEN(denptr) + length > DICT_GET_BYTES(denptr))
   {
      /* the difference times two */
      denptr = DictExpandEntry (denptr, (length - DICT_GET_BYTES(denptr)) * 2);
      rqptr->NotePadDictEntry = denptr;
      rqptr->NotePadPtr = DICT_GET_VALUE(denptr);
   }
   bptr = DICT_GET_VALUE(denptr);

   zptr = (sptr = bptr) + DICT_GET_BYTES(denptr);
   if (string[0] == '+')
   {
      string++;
      sptr += DICT_GET_VALUE_LEN(denptr);
   }

   for (cptr = string; *cptr && sptr < zptr; *sptr++ = *cptr++);
   *sptr = '\0';
   DictValueLength (denptr, sptr - bptr);
}

/*****************************************************************************/
/*
Return true or false.
*/

BOOL MetaConCommonRequestHeader (char *key)
{
   static char  *CommonRequestHeaders [] = {
      "accept", "accept-charset", "accept-encoding", "accept-language",
      "accept-datetime", "authorization", "cache-control", "connection",
      "cookie", "cookie-length", "content-md5", "content-type", "date", "dnt",
      "expect", "from", "host", "if-match", "if-modifid-since",
      "if-none-match", "if-range", "if-unmodifid-since", "max-forwards",
      "origin", "pragma", "proxy-authorization", "range", "referer", "te",
      "user-agent", "upgrade", "via", "warning",
   NULL
};

   int  idx;
   char  *cptr;

   /*********/
   /* begin */
   /*********/

   if (WATCH_MODULE(WATCH_MOD_METACON))
      WatchThis (WATCHALL, WATCH_MOD_METACON,
                 "MetaConCommonRequestHeader() !&Z", key);

   for (idx = 0; cptr = CommonRequestHeaders[idx]; idx++)
      if (MATCH3(cptr,key) && strsame (cptr, key, -1)) return (true);
   return (false);
}

/*****************************************************************************/
/*
Put a string into the "note:" rule buffer.  Called from ControlHttpdAst().
*/

MetaConNoteThis (char *NotePtr)
{
   /*********/
   /* begin */
   /*********/

   if (WATCH_MODULE(WATCH_MOD_METACON))
      WatchThis (WATCHALL, WATCH_MOD_METACON,
                 "MetaConNoteThis() !&Z", NotePtr);

   InstanceMutexLock (INSTANCE_MUTEX_HTTPD);

   strzcpy (HttpdGblSecPtr->MetaConNote,
            NotePtr,
            sizeof(HttpdGblSecPtr->MetaConNote));

   InstanceMutexUnLock (INSTANCE_MUTEX_HTTPD);
}

/*****************************************************************************/
/*
Return SERVICE_ specific values equivalent to the string pointed to by 'pptr'.
*/

BOOL MetaConSetBoolean
(
META_CONFIG *mcptr,
char *cptr
)
{
   static char  ProblemBoolean [] = "Confusing boolean value";

   /*********/
   /* begin */
   /*********/

   if (WATCH_MODULE(WATCH_MOD_METACON))
      WatchThis (WATCHALL, WATCH_MOD_METACON,
                 "MetaConSetBoolean() !&Z", cptr);

   if (strsame (cptr, "YES", 3) ||
       strsame (cptr, "ON", 2) ||
       strsame (cptr, "ENABLED", 7))
      return (true);

   if (!cptr[0] ||
       strsame (cptr, "NO", 2) ||
       strsame (cptr, "OFF", 3) ||
       strsame (cptr, "DISABLED", 8))
      return (false);

   MetaConReport (mcptr, METACON_REPORT_ERROR, ProblemBoolean);
   return (false);
}

/*****************************************************************************/
/*
Return an integer equivalent to the numeric string pointed to by 'cptr'.
*/

int MetaConSetInteger
(
META_CONFIG *mcptr,
char *cptr
)
{
   static char  ProblemInteger [] = "Confusing integer value";

   /*********/
   /* begin */
   /*********/

   if (WATCH_MODULE(WATCH_MOD_METACON))
      WatchThis (WATCHALL, WATCH_MOD_METACON,
                 "MetaConSetInteger() !&Z", cptr);


   if (isdigit(*cptr)) return (atoi(cptr));
   if (*cptr == '-' && isdigit(*(cptr+1))) return (-atoi(cptr+1));
   MetaConReport (mcptr, METACON_REPORT_ERROR, ProblemInteger);
   return (-1);
}

/*****************************************************************************/
/*
Copy a simple string configuration parameter trimming leading and trailing
white-space.
*/

MetaConSetString
(
META_CONFIG *mcptr,
char *cptr,
char *String,
int SizeOfString
)
{
   static char  ProblemStringOverflow [] = "String value overflow";

   char  *sptr, *zptr;

   /*********/
   /* begin */
   /*********/

   if (WATCH_MODULE(WATCH_MOD_METACON))
      WatchThis (WATCHALL, WATCH_MOD_METACON,
                 "MetaConSetString() !&Z", cptr);

   zptr = (sptr = String) + SizeOfString;
   while (*cptr && ISLWS(*cptr)) cptr++;
   while (*cptr && sptr < zptr) *sptr++ = *cptr++;
   if (sptr >= zptr)
   {
      *String = '\0';
      MetaConReport (mcptr, METACON_REPORT_ERROR, ProblemStringOverflow);
      return;
   }
   *sptr = '\0';
   if (sptr > String)
   {
      sptr--;
      while (*sptr && ISLWS(*sptr) && sptr > String) sptr--;
      *++sptr = '\0';
   }
}

/*****************************************************************************/
/*
Return an integer equivalent to the HH:MM:SS string.  Examples; "0:35" is 35
seconds, "02:20" is 140 seconds, "1:0:0" is 3600 seconds.  A day can be
prefixed to the hh:mm:ss as follows; "2-00:00:00".  The
'SingleIntegerSeconds' represents what a single, unqualified-by-colon integer
represents in seconds (most commonly 60, i.e. one minute).  This is for
backward compatibility with previous configuration files that used single
integers and fixed the unit they represented.  If the 'seconds' are "NONE" then
return -1.
*/

int MetaConSetSeconds
(
META_CONFIG *mcptr,
char *cptr,
int SingleIntegerSeconds
)
{
   static char  ProblemPeriodFormat [] = "Time period format problem",
                ProblemPeriodValue [] = "One or more components out-of-range";

   int  day, hr, min, sec;

   /*********/
   /* begin */
   /*********/

   if (WATCH_MODULE(WATCH_MOD_METACON))
      WatchThis (WATCHALL, WATCH_MOD_METACON,
                 "MetaConSetSeconds() !&X !AZ !UL",
                 mcptr, cptr, SingleIntegerSeconds);

   if (strsame (cptr, "NONE", -1)) return (-1);

   day = hr = min = sec = 0;
   if (isdigit(*cptr))
      sec = atoi(cptr);
   else
   if (strsame (cptr, "none", 4))
      return (31536000+1);  /* seconds in one year */
   else
   if (strsame (cptr, "infinite", 8))
      return (31536000+1);  /* seconds in one year */
   else
   {
      MetaConReport (mcptr, METACON_REPORT_ERROR, ProblemPeriodFormat);
      /* with a period problem make it as short as practicable */
      return (1);
   }
   while (*cptr && isdigit(*cptr)) cptr++;
   if (*cptr == '-')
   {
      day = sec;
      cptr++;
      if (isdigit(*cptr))
         sec = atoi(cptr);
      else
      {
         MetaConReport (mcptr, METACON_REPORT_ERROR, ProblemPeriodFormat);
         return (-1);
      }
      while (*cptr && isdigit(*cptr)) cptr++;
   }
   if (*cptr == ':')
   {
      cptr++;
      min = sec;
      if (isdigit(*cptr))
         sec = atoi(cptr);
      else
      {
         MetaConReport (mcptr, METACON_REPORT_ERROR, ProblemPeriodFormat);
         return (-1);
      }
      while (*cptr && isdigit(*cptr)) cptr++;
      if (*cptr == ':')
      {
         cptr++;
         hr = min;
         min = sec;
         if (isdigit(*cptr))
            sec = atoi(cptr);
         else
         {
            MetaConReport (mcptr, METACON_REPORT_ERROR, ProblemPeriodFormat);
            return (-1);
         }
      }
   }
   else
   {
      /* single integer, what's it worth (i.e. a second, minute, hour?) */
      sec *= SingleIntegerSeconds;
      hr = sec / 3600;
      sec = sec % 3600;
      min = sec / 60;
      sec = sec % 60;
   }
      
   if (day < 0 || day > 36500 || hr < 0 || hr > 99 ||
       min < 0 || min > 59 || sec < 0 || sec > 59)
   {
      MetaConReport (mcptr, METACON_REPORT_ERROR, ProblemPeriodValue);
      return (-1);
   }
   return (day*86400+hr*3600+min*60+sec);
}

/*****************************************************************************/
/*
Return a heap allocated string containing a string representing the HH:MM:SS
represented by the specified number of seconds.
*/

char* MetaConShowSeconds
(
REQUEST_STRUCT  *rqptr,
int Seconds
)
{
   static $DESCRIPTOR (StrBufDsc, "");
   static $DESCRIPTOR (HourMinSecFaoDsc, "!2ZL:!2ZL:!2ZL\0");
   static $DESCRIPTOR (DayHourMinSecFaoDsc, "!UL-!2ZL:!2ZL:!2ZL\0");

   /*********/
   /* begin */
   /*********/

   if (WATCH_MODULE(WATCH_MOD_METACON))
      WatchThis (WATCHALL, WATCH_MOD_METACON,
                 "MetaConShowSeconds() !UL", Seconds);

   if (Seconds < 0) return ("NONE");

   StrBufDsc.dsc$w_length = 32;
   if (rqptr)
      StrBufDsc.dsc$a_pointer = VmGetHeap (rqptr, StrBufDsc.dsc$w_length);
   else
      /* this might leak a bit! */
      StrBufDsc.dsc$a_pointer = VmGet (StrBufDsc.dsc$w_length);

   if (Seconds > 31536000)  /* seconds in one year */
      strcpy (StrBufDsc.dsc$a_pointer, "NONE");
   else
   if (Seconds / 86400)  /* seconds in one day */
      sys$fao (&DayHourMinSecFaoDsc, 0, &StrBufDsc,
               Seconds / 86400,
               (Seconds % 86400) / 3600,
               (Seconds % 3600) / 60,
               (Seconds % 3600) % 60);
   else
      sys$fao (&HourMinSecFaoDsc, 0, &StrBufDsc,
               Seconds / 3600, (Seconds % 3600) / 60, (Seconds % 3600) % 60);

   return (StrBufDsc.dsc$a_pointer);
}

/*****************************************************************************/
/*
Meta-agents run after initial request setup but just before request execution
as CGIplus scripts.  The idea is to provide a flexible mechanism for additional
request processing configuration not provided by the standard configuration
mappings.  Meta-agents should use the CGI variables provided for request data.
As a meta-agent adds response latency to every request they should execute as
expeditiously as possible.

As appropriate, meta-agents can return request data by injecting dictionary
entries using the DICT: callout, by injecting CGI variables into the request 
(and thereby adding, deleting or modifying subsequent request execution) and
finally by the status value (200, 418, 500, 502, etc.) returned at agent end.
*/ 

char* MetaConAgentBegin (REQUEST_STRUCT* rqptr)

{
   char  *cptr, *sptr, *zptr;
   char  DclCommand [256],
         MappedFile [ODS_MAX_FILE_NAME_LENGTH+1],
         MappedScript [ODS_MAX_FILE_NAME_LENGTH+1],
         MappedRunTime [ODS_MAX_FILE_NAME_LENGTH+1],
         ScriptName [ODS_MAX_FILE_NAME_LENGTH+1];

   /*********/
   /* begin */
   /*********/

   if (WATCHMOD (rqptr, WATCH_MOD_METACON))
      WatchThis (WATCHITM(rqptr), WATCH_MOD_METACON,
                 "MetaConAgentBegin() !&Z", rqptr->AgentRequestPtr);

   if (!MetaConAgentUsed) return ("501 not implemented");

   if (rqptr->AgentResponsePtr) return ("502 existing response");

   if (MetaConAgentActiveCount >= MetaConAgentActiveMax)
   {
      /* busy, busy, busy ... requeue for a delayed subsequent attempt */
      if (rqptr->AgentBusyCount++ <= MetaConAgentBusyMax)
      {
         if (rqptr->AgentBusyCount <= MetaConAgentBusyMax / 4)
            SysDclAst (RequestExecute, rqptr);
         else
            sys$setimr (0, &Delta100mSec, RequestExecute, rqptr, 0);
         return ("202 queued");
      }
      else
      {
         ErrorNoticed (rqptr, SS$_TOOMANYREDS, "!UL exceeded (!UL)",
                       FI_LI, MetaConAgentBusyMax, MetaConAgentBusyLimit);
         MetaConAgentBusyCount++;
         return ("500 busy limit");
      }
   }
   if (rqptr->AgentBusyCount)
   {
      if (rqptr->AgentBusyCount > MetaConAgentBusyLimit)
         MetaConAgentBusyLimit = rqptr->AgentBusyCount;
      rqptr->AgentBusyCount = 0;
   }

   /************/
   /* continue */
   /************/

   if (rqptr->MetaConAgentPtr)
   {
      /* hangover from previous invocation */
      VmFreeFromHeap (rqptr, rqptr->MetaConAgentPtr, FI_LI);
      rqptr->MetaConAgentPtr = NULL;
   }

   if (!(cptr = rqptr->AgentRequestPtr))
   {
      /* use default metaconfig agent */
      cptr = MetaConAgentScript;
      rqptr->AgentRequestPtr = VmGetHeap (rqptr, strlen(cptr));
      strcpy (rqptr->AgentRequestPtr, cptr);
   }

   if (*cptr == '$')
   { 
      /* DCL command */
      zptr = (sptr = DclCommand) + sizeof(DclCommand)-1;
      for (cptr++; *cptr && sptr < zptr; *sptr++ = *cptr++);
      *sptr = '\0';

      DclBegin (rqptr, MetaConAgentEnd, DclCommand,
                NULL, NULL, NULL, NULL, NULL);
   }
   else
   {
      /* map the script */
      *(ULONGPTR)MappedFile = *(ULONGPTR)ScriptName =
         *(ULONGPTR)MappedScript = *(ULONGPTR)MappedRunTime = 0;

      cptr = MapUrl_Map (cptr, 0, 
                         MappedFile, sizeof(MappedFile),
                         ScriptName, sizeof(ScriptName),
                         MappedScript, sizeof(MappedScript),
                         MappedRunTime, sizeof(MappedRunTime),
                         NULL, rqptr, &rqptr->rqPathSet);

      if (!cptr[0] && cptr[1])
      {
         /* mapping failure */
         if (WATCHING (rqptr, WATCH_DCL))
            WatchThis (WATCHITM(rqptr), WATCH_DCL, "502 !AZ", cptr+1);
         sptr = VmGetHeap (rqptr, strlen(cptr+1)+8);
         strcpy (sptr, "502 ");
         strcpy (sptr+4, cptr+1);
         return (sptr);
      }

      if (ScriptName[0] == '+')
      {
         ScriptName[0] = '/';
         DclBegin (rqptr, MetaConAgentEnd, NULL,
                   ScriptName, NULL, MappedScript, MappedRunTime, NULL);
      }
      else
         DclBegin (rqptr, MetaConAgentEnd, NULL,
                   ScriptName, MappedScript, NULL, MappedRunTime, NULL);
   }

   MetaConAgentActiveCount++;

   return ("200 OK");
}

/*****************************************************************************/
/*
Post-process the metaconfig agent response and call the specified AST.
*/ 

void MetaConAgentEnd (REQUEST_STRUCT *rqptr)

{
   int  length;
   char  *cptr;

   /*********/
   /* begin */
   /*********/

   if (WATCHMOD (rqptr, WATCH_MOD_METACON))
      WatchThis (WATCHITM(rqptr), WATCH_MOD_METACON,
                 "MetaConAgentEnd() !&Z", rqptr->AgentRequestPtr);

   if (cptr = rqptr->AgentResponsePtr)
   {
      rqptr->MetaConAgentPtr = VmGetHeap (rqptr, length = strlen(cptr));
      memcpy (rqptr->MetaConAgentPtr, cptr, length);
   }
   else
   {
      rqptr->MetaConAgentPtr = cptr = VmGetHeap (rqptr, 32);
      memcpy (cptr, "502 agent response problem", 26);
   }

   SysDclAst (RequestExecute, rqptr);

   if (rqptr->AgentRequestPtr)
      VmFreeFromHeap (rqptr, rqptr->AgentRequestPtr, FI_LI);
   if (rqptr->AgentResponsePtr)
      VmFreeFromHeap (rqptr, rqptr->AgentResponsePtr, FI_LI);
   rqptr->AgentRequestPtr = rqptr->AgentResponsePtr = NULL;

   if (MetaConAgentActiveCount) MetaConAgentActiveCount--;
}

/*****************************************************************************/
/*
Provide information about the load (often problem reports) by building up a
text string over successive calls.  'FormatString' may contain WASD-FAO
directives and supply appropriate parameters.  It is incorporated into a
meta-message :^) which includes additional detail about the source file line
number and file name (if an [IncludeFile] has been encountered).
*/
 
int MetaConReport
(
META_CONFIG *mcptr,
int ItemSeverity,
char *FormatString,
...
)
{
   int  argcnt, cnt, status;
   ushort  Length;
   ulong  *vecptr;
   ulong  FaoVector [32+8];
   char  ch;
   char  *cptr, *sptr, *zptr;
   char  Buffer1 [1024],
         Buffer2 [1024];
   va_list  argptr;

   /*********/
   /* begin */
   /*********/

   va_count (argcnt);

   if (WATCH_MODULE(WATCH_MOD_METACON))
      WatchThis (WATCHALL, WATCH_MOD_METACON,
                 "MetaConReport() !&X !UL !UL !&Z",
                 mcptr, ItemSeverity, argcnt, FormatString);

   /* may be some occasions where we might want to call this regardless */
   if (!mcptr) return (SS$_BADPARAM);

   if (argcnt > 32) return (SS$_OVRMAXARG);

   switch (ItemSeverity)
   {
      case METACON_REPORT_INFORM :
           mcptr->LoadReport.InformCount++; ch = 'i'; break;
      case METACON_REPORT_WARNING :
           mcptr->LoadReport.WarningCount++; ch = 'w'; break;
      case METACON_REPORT_ERROR :
           mcptr->LoadReport.ErrorCount++; ch = 'e'; break;
      default : ErrorExitVmsStatus (SS$_BUGCHECK, ErrorSanityCheck, FI_LI);
   }
   mcptr->LoadReport.ItemCount++;

   vecptr = FaoVector;
   *vecptr++ = FormatString;

   /* now add the variable length arguments to the vector */
   va_start (argptr, FormatString);
   for (argcnt -= 3; argcnt; argcnt--)
      *vecptr++ = va_arg (argptr, ulong);
   va_end (argptr);

   if (mcptr->CurrentOdsPtr)
   {
      /* while source files are being loaded */
      if (mcptr->CurrentOdsPtr->DataLineNumber)
      {
         *vecptr++ = " (line !UL!&@)";
         if (mcptr->ReportLineNumber)
            *vecptr++ = mcptr->ReportLineNumber;
         else
            *vecptr++ = mcptr->CurrentOdsPtr->DataLineNumber;
         if (mcptr->IncludeFile)
         {
            *vecptr++ = " of !AZ";
            *vecptr++ = mcptr->CurrentOdsPtr->ExpFileName;
         }
         else
            *vecptr++ = "";
      }
      else
         *vecptr++ = "";
      if (mcptr->CurrentOdsPtr->DataLinePtr)
      {
         if (mcptr->ReportLinePtr)
            cptr = mcptr->ReportLinePtr;
         else
            cptr = mcptr->CurrentOdsPtr->DataLinePtr;
         while (*cptr && ISLWS(*cptr)) cptr++;
         *vecptr++ = "\\!AZ\\\n";
         *vecptr++ = cptr;
      }
      else
         *vecptr++ = "";
   }
   else
   if (mcptr->ParsePtr)
   {
      /* during the basic check parse */
      if (mcptr->ParsePtr->Number)
      {
         *vecptr++ = " (directive !UL)";
         if (mcptr->ReportLineNumber)
            *vecptr++ = mcptr->ReportLineNumber;
         else
            *vecptr++ = mcptr->ParsePtr->Number;
      }
      else
         *vecptr++ = "";
      if (mcptr->ParsePtr->TextPtr)
      {
         if (mcptr->ReportLinePtr)
            cptr = mcptr->ReportLinePtr;
         else
            cptr = mcptr->ParsePtr->TextPtr;
         while (*cptr && ISLWS(*cptr)) cptr++;
         if (*cptr)
         {
            *vecptr++ = "\\!AZ\\\n";
            *vecptr++ = cptr;
         }
         else
            *vecptr++ = "";
      }
      else
         *vecptr++ = "";
   }
   else
   {
      if (mcptr->ReportLineNumber)
      {
         *vecptr++ = " (line !UL)";
         *vecptr++ = mcptr->ReportLineNumber;
      }
      else
         *vecptr++ = "";
      if (mcptr->ReportLinePtr)
      {
         cptr = mcptr->ReportLinePtr;
         while (*cptr && ISLWS(*cptr)) cptr++;
         *vecptr++ = "\\!AZ\\\n";
         *vecptr++ = cptr;
      }
      else
         *vecptr++ = "";
   }

   status = FaolToBuffer (Buffer1, sizeof(Buffer1), NULL,
                          "!&@!&@\n!&@", &FaoVector);
   if (VMSnok (status) || status == SS$_BUFFEROVF)
   {
      ErrorNoticed (NULL, status, NULL, FI_LI);
      return (status);
   }

   /* put into 'Buffer2' ensuring newlines are padded from the left margin */
   vecptr = FaoVector;
   *vecptr++ = mcptr->LoadReport.ItemCount;
   *vecptr++ = ch;
   status = FaolToBuffer (Buffer2, sizeof(Buffer2), &Length,
                          "!UL.!&C ", &FaoVector);
   if (VMSnok (status) || status == SS$_BUFFEROVF)
   {
      ErrorNoticed (NULL, status, NULL, FI_LI);
      return (status);
   }
   zptr = (sptr = Buffer2) + sizeof(Buffer2);
   while (*sptr) sptr++;
   for (cptr = Buffer1; *cptr && sptr < zptr; *sptr++ = *cptr++)
   {
      if (cptr[0] != '\n' || !cptr[1]) continue;
      *sptr++ = *cptr++;
      for (cnt = Length; cnt && sptr < zptr; cnt--) *sptr++ = ' ';
   }
   if (sptr >= zptr)
   {
      ErrorNoticed (NULL, SS$_BUFFEROVF, NULL, FI_LI);
      return (SS$_BUFFEROVF);
   }
   *sptr = '\0';
   Length = sptr - Buffer2;

   /* append it to the report text */
   mcptr->LoadReport.TextPtr =
      VmRealloc (mcptr->LoadReport.TextPtr,
                 mcptr->LoadReport.TextLength+Length+1, FI_LI);
   memcpy (mcptr->LoadReport.TextPtr+mcptr->LoadReport.TextLength,
           Buffer2, Length);
   mcptr->LoadReport.TextLength += Length;

   return (SS$_NORMAL);
}

/*****************************************************************************/
/*
Copy a simple string configuration parameter trimming leading and trailing
white-space.
*/

MetaConStartupReport
(
META_CONFIG *mcptr,
char *Facility
)
{
   /*********/
   /* begin */
   /*********/

   if (WATCH_MODULE(WATCH_MOD_METACON))
      WatchThis (WATCHALL, WATCH_MOD_METACON,
                 "MetaConStartupString() !&Z", Facility);

   if (mcptr->LoadReport.ItemCount)
      FaoToStdout (
"%HTTPD-W-!AZ, !UL informational, !UL warning, !UL error!%s at load\n!AZ",
         Facility,
         mcptr->LoadReport.InformCount,
         mcptr->LoadReport.WarningCount,
         mcptr->LoadReport.ErrorCount,
         mcptr->LoadReport.TextPtr);

   /* only alert via OPCOM if there were severe error(s) */
   if (OpcomMessages && mcptr->LoadReport.ErrorCount)
      FaoToOpcom (
"%HTTPD-W-!AZ, !UL informational, !UL warning, !UL error!%s at load",
         Facility,
         mcptr->LoadReport.InformCount,
         mcptr->LoadReport.WarningCount,
         mcptr->LoadReport.ErrorCount);
}

/*****************************************************************************/