/usr/share/gtk-doc/html/libuhttpmock-0.0/UhmServer.html is in libuhttpmock-dev 0.3.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>libuhttpmock Reference Manual: UhmServer</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="index.html" title="libuhttpmock Reference Manual">
<link rel="up" href="ch02.html" title="Core API">
<link rel="prev" href="libuhttpmock-0.0-Version-Information.html" title="Version Information">
<link rel="next" href="UhmResolver.html" title="UhmResolver">
<meta name="generator" content="GTK-Doc V1.21 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts">
<a href="#" class="shortcut">Top</a><span id="nav_description"> <span class="dim">|</span>
<a href="#UhmServer.description" class="shortcut">Description</a></span><span id="nav_hierarchy"> <span class="dim">|</span>
<a href="#UhmServer.object-hierarchy" class="shortcut">Object Hierarchy</a></span><span id="nav_properties"> <span class="dim">|</span>
<a href="#UhmServer.properties" class="shortcut">Properties</a></span><span id="nav_signals"> <span class="dim">|</span>
<a href="#UhmServer.signals" class="shortcut">Signals</a></span>
</td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="ch02.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="libuhttpmock-0.0-Version-Information.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="UhmResolver.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="UhmServer"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="UhmServer.top_of_page"></a>UhmServer</span></h2>
<p>UhmServer — mock HTTP(S) server</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="UhmServer.stability-level"></a><h2>Stability Level</h2>
<acronym title="Unstable interfaces are experimental or transitional. They are typically used to
give outside developers early access to new or rapidly changing technology, or
to provide an interim solution to a problem where a more general solution is
anticipated. No claims are made about either source or binary compatibility from
one minor release to the next.
The Unstable interface level is a warning that these interfaces are subject to
change without warning and should not be used in unbundled products.
Given such caveats, customer impact need not be a factor when considering
incompatible changes to an Unstable interface in a major or minor release.
Nonetheless, when such changes are introduced, the changes should still be
mentioned in the release notes for the affected release.
"><span class="acronym">Unstable</span></acronym>, unless otherwise indicated
</div>
<div class="refsect1">
<a name="UhmServer.functions"></a><h2>Functions</h2>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="functions_return">
<col class="functions_name">
</colgroup>
<tbody>
<tr>
<td class="function_type">
<a class="link" href="UhmServer.html" title="UhmServer"><span class="returnvalue">UhmServer</span></a> *
</td>
<td class="function_name">
<a class="link" href="UhmServer.html#uhm-server-new" title="uhm_server_new ()">uhm_server_new</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="UhmServer.html#uhm-server-run" title="uhm_server_run ()">uhm_server_run</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="UhmServer.html#uhm-server-stop" title="uhm_server_stop ()">uhm_server_stop</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="UhmServer.html#uhm-server-start-trace" title="uhm_server_start_trace ()">uhm_server_start_trace</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="UhmServer.html#uhm-server-start-trace-full" title="uhm_server_start_trace_full ()">uhm_server_start_trace_full</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="UhmServer.html#uhm-server-end-trace" title="uhm_server_end_trace ()">uhm_server_end_trace</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="UhmServer.html#uhm-server-load-trace" title="uhm_server_load_trace ()">uhm_server_load_trace</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="UhmServer.html#uhm-server-load-trace-async" title="uhm_server_load_trace_async ()">uhm_server_load_trace_async</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="UhmServer.html#uhm-server-load-trace-finish" title="uhm_server_load_trace_finish ()">uhm_server_load_trace_finish</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="UhmServer.html#uhm-server-unload-trace" title="uhm_server_unload_trace ()">uhm_server_unload_trace</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="UhmServer.html#uhm-server-received-message-chunk" title="uhm_server_received_message_chunk ()">uhm_server_received_message_chunk</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="UhmServer.html#uhm-server-received-message-chunk-with-direction" title="uhm_server_received_message_chunk_with_direction ()">uhm_server_received_message_chunk_with_direction</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="UhmServer.html#uhm-server-received-message-chunk-from-soup" title="uhm_server_received_message_chunk_from_soup ()">uhm_server_received_message_chunk_from_soup</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">gboolean</span>
</td>
<td class="function_name">
<a class="link" href="UhmServer.html#uhm-server-get-enable-logging" title="uhm_server_get_enable_logging ()">uhm_server_get_enable_logging</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="UhmServer.html#uhm-server-set-enable-logging" title="uhm_server_set_enable_logging ()">uhm_server_set_enable_logging</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">gboolean</span>
</td>
<td class="function_name">
<a class="link" href="UhmServer.html#uhm-server-get-enable-online" title="uhm_server_get_enable_online ()">uhm_server_get_enable_online</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="UhmServer.html#uhm-server-set-enable-online" title="uhm_server_set_enable_online ()">uhm_server_set_enable_online</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">GFile</span> *
</td>
<td class="function_name">
<a class="link" href="UhmServer.html#uhm-server-get-trace-directory" title="uhm_server_get_trace_directory ()">uhm_server_get_trace_directory</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="UhmServer.html#uhm-server-set-trace-directory" title="uhm_server_set_trace_directory ()">uhm_server_set_trace_directory</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">GTlsCertificate</span> *
</td>
<td class="function_name">
<a class="link" href="UhmServer.html#uhm-server-get-tls-certificate" title="uhm_server_get_tls_certificate ()">uhm_server_get_tls_certificate</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="UhmServer.html#uhm-server-set-tls-certificate" title="uhm_server_set_tls_certificate ()">uhm_server_set_tls_certificate</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">GTlsCertificate</span> *
</td>
<td class="function_name">
<a class="link" href="UhmServer.html#uhm-server-set-default-tls-certificate" title="uhm_server_set_default_tls_certificate ()">uhm_server_set_default_tls_certificate</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="UhmServer.html#uhm-server-set-expected-domain-names" title="uhm_server_set_expected_domain_names ()">uhm_server_set_expected_domain_names</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">const <span class="returnvalue">gchar</span> *
</td>
<td class="function_name">
<a class="link" href="UhmServer.html#uhm-server-get-address" title="uhm_server_get_address ()">uhm_server_get_address</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">guint</span>
</td>
<td class="function_name">
<a class="link" href="UhmServer.html#uhm-server-get-port" title="uhm_server_get_port ()">uhm_server_get_port</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="UhmResolver.html" title="UhmResolver"><span class="returnvalue">UhmResolver</span></a> *
</td>
<td class="function_name">
<a class="link" href="UhmServer.html#uhm-server-get-resolver" title="uhm_server_get_resolver ()">uhm_server_get_resolver</a> <span class="c_punctuation">()</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="UhmServer.properties"></a><h2>Properties</h2>
<div class="informaltable"><table border="0">
<colgroup>
<col width="150px" class="properties_type">
<col width="300px" class="properties_name">
<col width="200px" class="properties_flags">
</colgroup>
<tbody>
<tr>
<td class="property_type">
<span class="type">gchar</span> *</td>
<td class="property_name"><a class="link" href="UhmServer.html#UhmServer--address" title="The “address” property">address</a></td>
<td class="property_flags">Read</td>
</tr>
<tr>
<td class="property_type"><span class="type">gboolean</span></td>
<td class="property_name"><a class="link" href="UhmServer.html#UhmServer--enable-logging" title="The “enable-logging” property">enable-logging</a></td>
<td class="property_flags">Read / Write</td>
</tr>
<tr>
<td class="property_type"><span class="type">gboolean</span></td>
<td class="property_name"><a class="link" href="UhmServer.html#UhmServer--enable-online" title="The “enable-online” property">enable-online</a></td>
<td class="property_flags">Read / Write</td>
</tr>
<tr>
<td class="property_type"><span class="type">guint</span></td>
<td class="property_name"><a class="link" href="UhmServer.html#UhmServer--port" title="The “port” property">port</a></td>
<td class="property_flags">Read</td>
</tr>
<tr>
<td class="property_type">
<a class="link" href="UhmResolver.html" title="UhmResolver"><span class="type">UhmResolver</span></a> *</td>
<td class="property_name"><a class="link" href="UhmServer.html#UhmServer--resolver" title="The “resolver” property">resolver</a></td>
<td class="property_flags">Read</td>
</tr>
<tr>
<td class="property_type">
<span class="type">GTlsCertificate</span> *</td>
<td class="property_name"><a class="link" href="UhmServer.html#UhmServer--tls-certificate" title="The “tls-certificate” property">tls-certificate</a></td>
<td class="property_flags">Read / Write</td>
</tr>
<tr>
<td class="property_type">
<span class="type">GFile</span> *</td>
<td class="property_name"><a class="link" href="UhmServer.html#UhmServer--trace-directory" title="The “trace-directory” property">trace-directory</a></td>
<td class="property_flags">Read / Write</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="UhmServer.signals"></a><h2>Signals</h2>
<div class="informaltable"><table border="0">
<colgroup>
<col width="150px" class="signals_return">
<col width="300px" class="signals_name">
<col width="200px" class="signals_flags">
</colgroup>
<tbody>
<tr>
<td class="signal_type"><span class="returnvalue">gboolean</span></td>
<td class="signal_name"><a class="link" href="UhmServer.html#UhmServer-compare-messages" title="The “compare-messages” signal">compare-messages</a></td>
<td class="signal_flags">Run Last</td>
</tr>
<tr>
<td class="signal_type"><span class="returnvalue">gboolean</span></td>
<td class="signal_name"><a class="link" href="UhmServer.html#UhmServer-handle-message" title="The “handle-message” signal">handle-message</a></td>
<td class="signal_flags">Run Last</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="UhmServer.other"></a><h2>Types and Values</h2>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="name">
<col class="description">
</colgroup>
<tbody>
<tr>
<td class="datatype_keyword"> </td>
<td class="function_name"><a class="link" href="UhmServer.html#UhmServer-struct" title="UhmServer">UhmServer</a></td>
</tr>
<tr>
<td class="datatype_keyword"> </td>
<td class="function_name"><a class="link" href="UhmServer.html#UhmServerClass" title="UhmServerClass">UhmServerClass</a></td>
</tr>
<tr>
<td class="datatype_keyword">enum</td>
<td class="function_name"><a class="link" href="UhmServer.html#UhmServerError" title="enum UhmServerError">UhmServerError</a></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="UhmServer.object-hierarchy"></a><h2>Object Hierarchy</h2>
<pre class="screen"> GObject
<span class="lineart">╰──</span> UhmServer
</pre>
</div>
<div class="refsect1">
<a name="UhmServer.includes"></a><h2>Includes</h2>
<pre class="synopsis">#include <libuhttpmock/uhm-server.h>
</pre>
</div>
<div class="refsect1">
<a name="UhmServer.description"></a><h2>Description</h2>
<p>This is a mock HTTPS server which can be used to run unit tests of network client code on a loopback interface rather than on the real Internet.
At its core, it's a simple HTTPS server which runs on a loopback address on an arbitrary port. The code under test must be modified to send its
requests to this port, although <a class="link" href="UhmResolver.html" title="UhmResolver"><span class="type">UhmResolver</span></a> may be used to transparently redirect all IP addresses to the mock server.
A convenience layer on the mock server provides loading of and recording to trace files, which are sequences of request–response HTTPS message pairs
where each request is expected by the server (in order). On receiving an expected request, the mock server will return the relevant response and move
to expecting the next request in the trace file.</p>
<p>The mock server currently only operates on a single network interface, on HTTPS only. This may change in future. A dummy TLS certificate is used
to authenticate the server. This certificate is not signed by a CA, so the <span class="type">“ssl-strict”</span> property must be set to <code class="literal">FALSE</code> in client code
during (and only during!) testing.</p>
<p>The server can operate in three modes: logging, testing, and comparing. These are set by <a class="link" href="UhmServer.html#UhmServer--enable-logging" title="The “enable-logging” property"><span class="type">“enable-logging”</span></a> and <a class="link" href="UhmServer.html#UhmServer--enable-online" title="The “enable-online” property"><span class="type">“enable-online”</span></a>.
• Logging mode (<a class="link" href="UhmServer.html#UhmServer--enable-logging" title="The “enable-logging” property"><span class="type">“enable-logging”</span></a>: <code class="literal">TRUE</code>, <a class="link" href="UhmServer.html#UhmServer--enable-online" title="The “enable-online” property"><span class="type">“enable-online”</span></a>: <code class="literal">TRUE</code>): Requests are sent to the real server online, and the
request–response pairs recorded to a log file.
• Testing mode (<a class="link" href="UhmServer.html#UhmServer--enable-logging" title="The “enable-logging” property"><span class="type">“enable-logging”</span></a>: <code class="literal">FALSE</code>, <a class="link" href="UhmServer.html#UhmServer--enable-online" title="The “enable-online” property"><span class="type">“enable-online”</span></a>: <code class="literal">FALSE</code>): Requests are sent to the mock server, which responds
from the trace file.
• Comparing mode (<a class="link" href="UhmServer.html#UhmServer--enable-logging" title="The “enable-logging” property"><span class="type">“enable-logging”</span></a>: <code class="literal">FALSE</code>, <a class="link" href="UhmServer.html#UhmServer--enable-online" title="The “enable-online” property"><span class="type">“enable-online”</span></a>: <code class="literal">TRUE</code>): Requests are sent to the real server online, and
the request–response pairs are compared against those in an existing log file to see if the log file is up-to-date.</p>
</div>
<div class="refsect1">
<a name="UhmServer.functions_details"></a><h2>Functions</h2>
<div class="refsect2">
<a name="uhm-server-new"></a><h3>uhm_server_new ()</h3>
<pre class="programlisting"><a class="link" href="UhmServer.html" title="UhmServer"><span class="returnvalue">UhmServer</span></a> *
uhm_server_new (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>Creates a new <a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a> with default properties.</p>
<div class="refsect3">
<a name="id-1.3.2.3.11.2.5"></a><h4>Returns</h4>
<p> a new <a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a>; unref with <code class="function">g_object_unref()</code>. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
<p class="since">Since 0.1.0</p>
</div>
<hr>
<div class="refsect2">
<a name="uhm-server-run"></a><h3>uhm_server_run ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
uhm_server_run (<em class="parameter"><code><a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a> *self</code></em>);</pre>
<p>Runs the mock server, binding to a loopback TCP/IP interface and preparing a HTTPS server which is ready to accept requests.
The TCP/IP address and port number are chosen randomly out of the loopback addresses, and are exposed as <a class="link" href="UhmServer.html#UhmServer--address" title="The “address” property"><span class="type">“address”</span></a> and <a class="link" href="UhmServer.html#UhmServer--port" title="The “port” property"><span class="type">“port”</span></a>
once this function has returned. A <a class="link" href="UhmResolver.html" title="UhmResolver"><span class="type">UhmResolver</span></a> (exposed as <a class="link" href="UhmServer.html#UhmServer--resolver" title="The “resolver” property"><span class="type">“resolver”</span></a>) is set as the default <span class="type">GResolver</span> while the server is running.</p>
<p>The server is started in a worker thread, so this function returns immediately and the server continues to run in the background. Use <a class="link" href="UhmServer.html#uhm-server-stop" title="uhm_server_stop ()"><code class="function">uhm_server_stop()</code></a>
to shut it down.</p>
<p>This function always succeeds.</p>
<div class="refsect3">
<a name="id-1.3.2.3.11.3.7"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>self</p></td>
<td class="parameter_description"><p>a <a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<p class="since">Since 0.1.0</p>
</div>
<hr>
<div class="refsect2">
<a name="uhm-server-stop"></a><h3>uhm_server_stop ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
uhm_server_stop (<em class="parameter"><code><a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a> *self</code></em>);</pre>
<p>Stops a mock server started by calling <a class="link" href="UhmServer.html#uhm-server-run" title="uhm_server_run ()"><code class="function">uhm_server_run()</code></a>. This shuts down the server's worker thread and unbinds it from its TCP/IP socket.</p>
<p>This unloads any trace file loaded by calling <a class="link" href="UhmServer.html#uhm-server-load-trace" title="uhm_server_load_trace ()"><code class="function">uhm_server_load_trace()</code></a> (or its asynchronous counterpart). It also resets the set of domain
names loaded into the <a class="link" href="UhmServer.html#UhmServer--resolver" title="The “resolver” property"><span class="type">“resolver”</span></a>.</p>
<p>This function always succeeds.</p>
<div class="refsect3">
<a name="id-1.3.2.3.11.4.7"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>self</p></td>
<td class="parameter_description"><p>a <a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<p class="since">Since 0.1.0</p>
</div>
<hr>
<div class="refsect2">
<a name="uhm-server-start-trace"></a><h3>uhm_server_start_trace ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
uhm_server_start_trace (<em class="parameter"><code><a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a> *self</code></em>,
<em class="parameter"><code>const <span class="type">gchar</span> *trace_name</code></em>,
<em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
<p>Starts a mock server which follows the trace file of filename <em class="parameter"><code>trace_name</code></em>
in the <a class="link" href="UhmServer.html#UhmServer--trace-directory" title="The “trace-directory” property"><span class="type">“trace-directory”</span></a> directory.
See <a class="link" href="UhmServer.html#uhm-server-start-trace-full" title="uhm_server_start_trace_full ()"><code class="function">uhm_server_start_trace_full()</code></a> for further documentation.</p>
<p>This function has undefined behaviour if <a class="link" href="UhmServer.html#UhmServer--trace-directory" title="The “trace-directory” property"><span class="type">“trace-directory”</span></a> is <code class="literal">NULL</code>.</p>
<p>On failure, <em class="parameter"><code>error</code></em>
will be set and the <a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a> state will remain unchanged. See <a class="link" href="UhmServer.html#uhm-server-start-trace-full" title="uhm_server_start_trace_full ()"><code class="function">uhm_server_start_trace_full()</code></a> for
details of the error domains used.</p>
<div class="refsect3">
<a name="id-1.3.2.3.11.5.7"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>self</p></td>
<td class="parameter_description"><p>a <a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>trace_name</p></td>
<td class="parameter_description"><p>name of the trace</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p> return location for a <span class="type">GError</span>, or <code class="literal">NULL</code>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since 0.1.0</p>
</div>
<hr>
<div class="refsect2">
<a name="uhm-server-start-trace-full"></a><h3>uhm_server_start_trace_full ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
uhm_server_start_trace_full (<em class="parameter"><code><a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a> *self</code></em>,
<em class="parameter"><code><span class="type">GFile</span> *trace_file</code></em>,
<em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
<p>Convenience function to start logging to or reading from the given <em class="parameter"><code>trace_file</code></em>
, depending on the values of <a class="link" href="UhmServer.html#UhmServer--enable-logging" title="The “enable-logging” property"><span class="type">“enable-logging”</span></a> and
<a class="link" href="UhmServer.html#UhmServer--enable-online" title="The “enable-online” property"><span class="type">“enable-online”</span></a>.</p>
<p>If <a class="link" href="UhmServer.html#UhmServer--enable-logging" title="The “enable-logging” property"><span class="type">“enable-logging”</span></a> is <code class="literal">TRUE</code>, a log handler will be set up to redirect all client network activity into the given <em class="parameter"><code>trace_file</code></em>
.
If <em class="parameter"><code>trace_file</code></em>
already exists, it will be overwritten.</p>
<p>If <a class="link" href="UhmServer.html#UhmServer--enable-online" title="The “enable-online” property"><span class="type">“enable-online”</span></a> is <code class="literal">FALSE</code>, the given <em class="parameter"><code>trace_file</code></em>
is loaded using <a class="link" href="UhmServer.html#uhm-server-load-trace" title="uhm_server_load_trace ()"><code class="function">uhm_server_load_trace()</code></a> and then a mock server is
started using <a class="link" href="UhmServer.html#uhm-server-run" title="uhm_server_run ()"><code class="function">uhm_server_run()</code></a>.</p>
<p>On failure, <em class="parameter"><code>error</code></em>
will be set and the <a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a> state will remain unchanged. A <span class="type">GIOError</span> will be set if logging is enabled
(<a class="link" href="UhmServer.html#UhmServer--enable-logging" title="The “enable-logging” property"><span class="type">“enable-logging”</span></a>) and there is a problem writing to the trace file; or if a trace needs to be loaded and there is a problem
reading from the trace file.</p>
<div class="refsect3">
<a name="id-1.3.2.3.11.6.8"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>self</p></td>
<td class="parameter_description"><p>a <a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>trace_file</p></td>
<td class="parameter_description"><p>a trace file to load</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p> return location for a <span class="type">GError</span>, or <code class="literal">NULL</code>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since 0.1.0</p>
</div>
<hr>
<div class="refsect2">
<a name="uhm-server-end-trace"></a><h3>uhm_server_end_trace ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
uhm_server_end_trace (<em class="parameter"><code><a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a> *self</code></em>);</pre>
<p>Convenience function to finish logging to or reading from a trace file previously passed to <a class="link" href="UhmServer.html#uhm-server-start-trace" title="uhm_server_start_trace ()"><code class="function">uhm_server_start_trace()</code></a> or
<a class="link" href="UhmServer.html#uhm-server-start-trace-full" title="uhm_server_start_trace_full ()"><code class="function">uhm_server_start_trace_full()</code></a>.</p>
<p>If <a class="link" href="UhmServer.html#UhmServer--enable-online" title="The “enable-online” property"><span class="type">“enable-online”</span></a> is <code class="literal">FALSE</code>, this will shut down the mock server (as if <a class="link" href="UhmServer.html#uhm-server-stop" title="uhm_server_stop ()"><code class="function">uhm_server_stop()</code></a> had been called).</p>
<div class="refsect3">
<a name="id-1.3.2.3.11.7.6"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>self</p></td>
<td class="parameter_description"><p>a <a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<p class="since">Since 0.1.0</p>
</div>
<hr>
<div class="refsect2">
<a name="uhm-server-load-trace"></a><h3>uhm_server_load_trace ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
uhm_server_load_trace (<em class="parameter"><code><a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a> *self</code></em>,
<em class="parameter"><code><span class="type">GFile</span> *trace_file</code></em>,
<em class="parameter"><code><span class="type">GCancellable</span> *cancellable</code></em>,
<em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
<p>Synchronously loads the given <em class="parameter"><code>trace_file</code></em>
of network messages, ready to simulate a network conversation by matching
requests against the file and returning the associated responses. Call <a class="link" href="UhmServer.html#uhm-server-run" title="uhm_server_run ()"><code class="function">uhm_server_run()</code></a> to start the mock
server afterwards.</p>
<p>Loading the trace file may be cancelled from another thread using <em class="parameter"><code>cancellable</code></em>
.</p>
<p>On error, <em class="parameter"><code>error</code></em>
will be set and the state of the <a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a> will not change. A <span class="type">GIOError</span> will be set if there is
a problem reading the trace file.</p>
<div class="refsect3">
<a name="id-1.3.2.3.11.8.7"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>self</p></td>
<td class="parameter_description"><p>a <a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>trace_file</p></td>
<td class="parameter_description"><p>trace file to load</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>cancellable</p></td>
<td class="parameter_description"><p> a <span class="type">GCancellable</span>, or <code class="literal">NULL</code>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p> return location for a <span class="type">GError</span>, or <code class="literal">NULL</code>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since 0.1.0</p>
</div>
<hr>
<div class="refsect2">
<a name="uhm-server-load-trace-async"></a><h3>uhm_server_load_trace_async ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
uhm_server_load_trace_async (<em class="parameter"><code><a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a> *self</code></em>,
<em class="parameter"><code><span class="type">GFile</span> *trace_file</code></em>,
<em class="parameter"><code><span class="type">GCancellable</span> *cancellable</code></em>,
<em class="parameter"><code><span class="type">GAsyncReadyCallback</span> callback</code></em>,
<em class="parameter"><code><span class="type">gpointer</span> user_data</code></em>);</pre>
<p>Asynchronous version of <a class="link" href="UhmServer.html#uhm-server-load-trace" title="uhm_server_load_trace ()"><code class="function">uhm_server_load_trace()</code></a>. In <em class="parameter"><code>callback</code></em>
, call <a class="link" href="UhmServer.html#uhm-server-load-trace-finish" title="uhm_server_load_trace_finish ()"><code class="function">uhm_server_load_trace_finish()</code></a> to complete the operation.</p>
<div class="refsect3">
<a name="id-1.3.2.3.11.9.5"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>self</p></td>
<td class="parameter_description"><p>a <a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>trace_file</p></td>
<td class="parameter_description"><p>trace file to load</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>cancellable</p></td>
<td class="parameter_description"><p> a <span class="type">GCancellable</span>, or <code class="literal">NULL</code>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>callback</p></td>
<td class="parameter_description"><p>function to call once the async operation is complete</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>user_data</p></td>
<td class="parameter_description"><p> user data to pass to <em class="parameter"><code>callback</code></em>
, or <code class="literal">NULL</code>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since 0.1.0</p>
</div>
<hr>
<div class="refsect2">
<a name="uhm-server-load-trace-finish"></a><h3>uhm_server_load_trace_finish ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
uhm_server_load_trace_finish (<em class="parameter"><code><a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a> *self</code></em>,
<em class="parameter"><code><span class="type">GAsyncResult</span> *result</code></em>,
<em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
<p>Finishes an asynchronous operation started by <a class="link" href="UhmServer.html#uhm-server-load-trace-async" title="uhm_server_load_trace_async ()"><code class="function">uhm_server_load_trace_async()</code></a>.</p>
<p>On error, <em class="parameter"><code>error</code></em>
will be set and the state of the <a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a> will not change.
See <a class="link" href="UhmServer.html#uhm-server-load-trace" title="uhm_server_load_trace ()"><code class="function">uhm_server_load_trace()</code></a> for details on the error domains used.</p>
<div class="refsect3">
<a name="id-1.3.2.3.11.10.6"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>self</p></td>
<td class="parameter_description"><p>a <a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>result</p></td>
<td class="parameter_description"><p>asynchronous operation result passed to the callback</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p> return location for a <span class="type">GError</span>, or <code class="literal">NULL</code>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since 0.1.0</p>
</div>
<hr>
<div class="refsect2">
<a name="uhm-server-unload-trace"></a><h3>uhm_server_unload_trace ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
uhm_server_unload_trace (<em class="parameter"><code><a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a> *self</code></em>);</pre>
<p>Unloads the current trace file of network messages, as loaded by <a class="link" href="UhmServer.html#uhm-server-load-trace" title="uhm_server_load_trace ()"><code class="function">uhm_server_load_trace()</code></a> or <a class="link" href="UhmServer.html#uhm-server-load-trace-async" title="uhm_server_load_trace_async ()"><code class="function">uhm_server_load_trace_async()</code></a>.</p>
<div class="refsect3">
<a name="id-1.3.2.3.11.11.5"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>self</p></td>
<td class="parameter_description"><p>a <a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<p class="since">Since 0.1.0</p>
</div>
<hr>
<div class="refsect2">
<a name="uhm-server-received-message-chunk"></a><h3>uhm_server_received_message_chunk ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
uhm_server_received_message_chunk (<em class="parameter"><code><a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a> *self</code></em>,
<em class="parameter"><code>const <span class="type">gchar</span> *message_chunk</code></em>,
<em class="parameter"><code><span class="type">goffset</span> message_chunk_length</code></em>,
<em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
<p>Indicates to the mock server that a single new line of a message was received from the real server. The message line may be
appended to the current trace file if logging is enabled (<a class="link" href="UhmServer.html#UhmServer--enable-logging" title="The “enable-logging” property"><span class="type">“enable-logging”</span></a> is <code class="literal">TRUE</code>), adding a newline character
at the end. If logging is disabled but online mode is enabled (<a class="link" href="UhmServer.html#UhmServer--enable-online" title="The “enable-online” property"><span class="type">“enable-online”</span></a> is <code class="literal">TRUE</code>), the message line will
be compared to the next expected line in the existing trace file. Otherwise, this function is a no-op.</p>
<p>On failure, <em class="parameter"><code>error</code></em>
will be set and the <a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a> state will remain unchanged apart from the parse state machine, which will remain
in the state reached after parsing <em class="parameter"><code>message_chunk</code></em>
. A <code class="literal">G_IO_ERROR</code> will be returned if writing to the trace file failed. If in
comparison mode and the received message chunk corresponds to an unexpected message in the trace file, a <code class="literal">UHM_SERVER_ERROR</code> will
be returned.</p>
<div class="note"><p>In common cases where message log data only needs to be passed to a <a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a> and not (for example) logged to an
application-specific file or the command line as well, it is simpler to use <a class="link" href="UhmServer.html#uhm-server-received-message-chunk-from-soup" title="uhm_server_received_message_chunk_from_soup ()"><code class="function">uhm_server_received_message_chunk_from_soup()</code></a>, passing
it directly to <code class="function">soup_logger_set_printer()</code>. See the documentation for <a class="link" href="UhmServer.html#uhm-server-received-message-chunk-from-soup" title="uhm_server_received_message_chunk_from_soup ()"><code class="function">uhm_server_received_message_chunk_from_soup()</code></a> for details.</p></div>
<div class="refsect3">
<a name="id-1.3.2.3.11.12.7"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>self</p></td>
<td class="parameter_description"><p>a <a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>message_chunk</p></td>
<td class="parameter_description"><p>single line of a message which was received</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>message_chunk_length</p></td>
<td class="parameter_description"><p>length of <em class="parameter"><code>message_chunk</code></em>
in bytes</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p> return location for a <span class="type">GError</span>, or <code class="literal">NULL</code>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since 0.1.0</p>
</div>
<hr>
<div class="refsect2">
<a name="uhm-server-received-message-chunk-with-direction"></a><h3>uhm_server_received_message_chunk_with_direction ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
uhm_server_received_message_chunk_with_direction
(<em class="parameter"><code><a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a> *self</code></em>,
<em class="parameter"><code><span class="type">char</span> direction</code></em>,
<em class="parameter"><code>const <span class="type">gchar</span> *data</code></em>,
<em class="parameter"><code><span class="type">goffset</span> data_length</code></em>,
<em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
<p>Convenience version of <a class="link" href="UhmServer.html#uhm-server-received-message-chunk" title="uhm_server_received_message_chunk ()"><code class="function">uhm_server_received_message_chunk()</code></a> which takes the
message <em class="parameter"><code>direction</code></em>
and <em class="parameter"><code>data</code></em>
separately, as provided by libsoup in a
<span class="type">SoupLoggerPrinter</span> callback.</p>
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21</pre></td>
<td class="listing_code"><pre class="programlisting">UhmServer <span class="gtkdoc opt">*</span>mock_server<span class="gtkdoc opt">;</span>
SoupSession <span class="gtkdoc opt">*</span>session<span class="gtkdoc opt">;</span>
SoupLogger <span class="gtkdoc opt">*</span>logger<span class="gtkdoc opt">;</span>
<span class="gtkdoc kwb">static void</span>
<span class="function">soup_log_printer</span> <span class="gtkdoc opt">(</span>SoupLogger <span class="gtkdoc opt">*</span>logger<span class="gtkdoc opt">,</span> SoupLoggerLogLevel level<span class="gtkdoc opt">,</span> <span class="gtkdoc kwb">char</span> direction<span class="gtkdoc opt">,</span> <span class="gtkdoc kwb">const char</span> <span class="gtkdoc opt">*</span>data<span class="gtkdoc opt">,</span> gpointer user_data<span class="gtkdoc opt">)</span>
<span class="gtkdoc opt">{</span>
<span class="comment">/* Pass the data to libuhttpmock. */</span>
UhmServer <span class="gtkdoc opt">*</span>mock_server <span class="gtkdoc opt">=</span> <span class="function">UHM_SERVER</span> <span class="gtkdoc opt">(</span>user_data<span class="gtkdoc opt">);</span>
<span class="function"><a href="UhmServer.html#uhm-server-received-message-chunk-with-direction">uhm_server_received_message_chunk_with_direction</a></span> <span class="gtkdoc opt">(</span>mock_server<span class="gtkdoc opt">,</span> direction<span class="gtkdoc opt">,</span> data<span class="gtkdoc opt">,</span> <span class="function">strlen</span> <span class="gtkdoc opt">(</span>data<span class="gtkdoc opt">),</span> NULL<span class="gtkdoc opt">);</span>
<span class="gtkdoc opt">}</span>
mock_server <span class="gtkdoc opt">=</span> <span class="function"><a href="UhmServer.html#uhm-server-new">uhm_server_new</a></span> <span class="gtkdoc opt">();</span>
session <span class="gtkdoc opt">=</span> <span class="function">soup_session_new</span> <span class="gtkdoc opt">();</span>
logger <span class="gtkdoc opt">=</span> <span class="function">soup_logger_new</span> <span class="gtkdoc opt">(</span>SOUP_LOGGER_LOG_BODY<span class="gtkdoc opt">, -</span><span class="number">1</span><span class="gtkdoc opt">);</span>
<span class="function">soup_logger_set_printer</span> <span class="gtkdoc opt">(</span>logger<span class="gtkdoc opt">, (</span>SoupLoggerPrinter<span class="gtkdoc opt">)</span> soup_log_printer<span class="gtkdoc opt">,</span> <span class="function">g_object_ref</span> <span class="gtkdoc opt">(</span>mock_server<span class="gtkdoc opt">),</span> g_object_unref<span class="gtkdoc opt">);</span>
<span class="function">soup_session_add_feature</span> <span class="gtkdoc opt">(</span>session<span class="gtkdoc opt">,</span> <span class="function">SOUP_SESSION_FEATURE</span> <span class="gtkdoc opt">(</span>logger<span class="gtkdoc opt">));</span>
<span class="function">g_object_unref</span> <span class="gtkdoc opt">(</span>logger<span class="gtkdoc opt">);</span>
<span class="comment">/* Do something with mock_server here. */</span></pre></td>
</tr>
</tbody>
</table>
</div>
<div class="refsect3">
<a name="id-1.3.2.3.11.13.6"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>self</p></td>
<td class="parameter_description"><p>a <a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>direction</p></td>
<td class="parameter_description"><p>single character indicating the direction of message transmission</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>data</p></td>
<td class="parameter_description"><p>single line of a message which was received</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>data_length</p></td>
<td class="parameter_description"><p>length of <em class="parameter"><code>data</code></em>
in bytes</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p> return location for a <span class="type">GError</span>, or <code class="literal">NULL</code>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since 0.3.0</p>
</div>
<hr>
<div class="refsect2">
<a name="uhm-server-received-message-chunk-from-soup"></a><h3>uhm_server_received_message_chunk_from_soup ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
uhm_server_received_message_chunk_from_soup
(<em class="parameter"><code><span class="type">SoupLogger</span> *logger</code></em>,
<em class="parameter"><code><span class="type">SoupLoggerLogLevel</span> level</code></em>,
<em class="parameter"><code><span class="type">char</span> direction</code></em>,
<em class="parameter"><code>const <span class="type">char</span> *data</code></em>,
<em class="parameter"><code><span class="type">gpointer</span> user_data</code></em>);</pre>
<p>Convenience version of <a class="link" href="UhmServer.html#uhm-server-received-message-chunk" title="uhm_server_received_message_chunk ()"><code class="function">uhm_server_received_message_chunk()</code></a> which can be passed directly to <code class="function">soup_logger_set_printer()</code>
to forward all libsoup traffic logging to a <a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a>. The <a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a> must be passed to <code class="function">soup_logger_set_printer()</code> as
its user data.</p>
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13</pre></td>
<td class="listing_code"><pre class="programlisting">UhmServer <span class="gtkdoc opt">*</span>mock_server<span class="gtkdoc opt">;</span>
SoupSession <span class="gtkdoc opt">*</span>session<span class="gtkdoc opt">;</span>
SoupLogger <span class="gtkdoc opt">*</span>logger<span class="gtkdoc opt">;</span>
mock_server <span class="gtkdoc opt">=</span> <span class="function"><a href="UhmServer.html#uhm-server-new">uhm_server_new</a></span> <span class="gtkdoc opt">();</span>
session <span class="gtkdoc opt">=</span> <span class="function">soup_session_new</span> <span class="gtkdoc opt">();</span>
logger <span class="gtkdoc opt">=</span> <span class="function">soup_logger_new</span> <span class="gtkdoc opt">(</span>SOUP_LOGGER_LOG_BODY<span class="gtkdoc opt">, -</span><span class="number">1</span><span class="gtkdoc opt">);</span>
<span class="function">soup_logger_set_printer</span> <span class="gtkdoc opt">(</span>logger<span class="gtkdoc opt">,</span> uhm_server_received_message_chunk_from_soup<span class="gtkdoc opt">,</span> <span class="function">g_object_ref</span> <span class="gtkdoc opt">(</span>mock_server<span class="gtkdoc opt">),</span> g_object_unref<span class="gtkdoc opt">);</span>
<span class="function">soup_session_add_feature</span> <span class="gtkdoc opt">(</span>session<span class="gtkdoc opt">,</span> <span class="function">SOUP_SESSION_FEATURE</span> <span class="gtkdoc opt">(</span>logger<span class="gtkdoc opt">));</span>
<span class="function">g_object_unref</span> <span class="gtkdoc opt">(</span>logger<span class="gtkdoc opt">);</span>
<span class="comment">/* Do something with mock_server here. */</span></pre></td>
</tr>
</tbody>
</table>
</div>
<div class="refsect3">
<a name="id-1.3.2.3.11.14.6"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>logger</p></td>
<td class="parameter_description"><p>a <span class="type">SoupLogger</span></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>level</p></td>
<td class="parameter_description"><p>the detail level of this log message</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>direction</p></td>
<td class="parameter_description"><p>the transmission direction of the message</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>data</p></td>
<td class="parameter_description"><p>message data</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>user_data</p></td>
<td class="parameter_description"><p> user data passed to the <span class="type">SoupLogger</span>, or <code class="literal">NULL</code>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since 0.3.0</p>
</div>
<hr>
<div class="refsect2">
<a name="uhm-server-get-enable-logging"></a><h3>uhm_server_get_enable_logging ()</h3>
<pre class="programlisting"><span class="returnvalue">gboolean</span>
uhm_server_get_enable_logging (<em class="parameter"><code><a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a> *self</code></em>);</pre>
<p>Gets the value of the <a class="link" href="UhmServer.html#UhmServer--enable-logging" title="The “enable-logging” property"><span class="type">“enable-logging”</span></a> property.</p>
<div class="refsect3">
<a name="id-1.3.2.3.11.15.5"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>self</p></td>
<td class="parameter_description"><p>a <a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.3.2.3.11.15.6"></a><h4>Returns</h4>
<p> <code class="literal">TRUE</code> if client network traffic is being logged to a trace file; <code class="literal">FALSE</code> otherwise</p>
<p></p>
</div>
<p class="since">Since 0.1.0</p>
</div>
<hr>
<div class="refsect2">
<a name="uhm-server-set-enable-logging"></a><h3>uhm_server_set_enable_logging ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
uhm_server_set_enable_logging (<em class="parameter"><code><a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a> *self</code></em>,
<em class="parameter"><code><span class="type">gboolean</span> enable_logging</code></em>);</pre>
<p>Sets the value of the <a class="link" href="UhmServer.html#UhmServer--enable-logging" title="The “enable-logging” property"><span class="type">“enable-logging”</span></a> property.</p>
<div class="refsect3">
<a name="id-1.3.2.3.11.16.5"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>self</p></td>
<td class="parameter_description"><p>a <a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>enable_logging</p></td>
<td class="parameter_description"><p><code class="literal">TRUE</code> to log client network traffic to a trace file; <code class="literal">FALSE</code> otherwise</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since 0.1.0</p>
</div>
<hr>
<div class="refsect2">
<a name="uhm-server-get-enable-online"></a><h3>uhm_server_get_enable_online ()</h3>
<pre class="programlisting"><span class="returnvalue">gboolean</span>
uhm_server_get_enable_online (<em class="parameter"><code><a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a> *self</code></em>);</pre>
<p>Gets the value of the <a class="link" href="UhmServer.html#UhmServer--enable-online" title="The “enable-online” property"><span class="type">“enable-online”</span></a> property.</p>
<div class="refsect3">
<a name="id-1.3.2.3.11.17.5"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>self</p></td>
<td class="parameter_description"><p>a <a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.3.2.3.11.17.6"></a><h4>Returns</h4>
<p> <code class="literal">TRUE</code> if the server does not intercept and handle network connections from client code; <code class="literal">FALSE</code> otherwise</p>
<p></p>
</div>
<p class="since">Since 0.1.0</p>
</div>
<hr>
<div class="refsect2">
<a name="uhm-server-set-enable-online"></a><h3>uhm_server_set_enable_online ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
uhm_server_set_enable_online (<em class="parameter"><code><a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a> *self</code></em>,
<em class="parameter"><code><span class="type">gboolean</span> enable_online</code></em>);</pre>
<p>Sets the value of the <a class="link" href="UhmServer.html#UhmServer--enable-online" title="The “enable-online” property"><span class="type">“enable-online”</span></a> property.</p>
<div class="refsect3">
<a name="id-1.3.2.3.11.18.5"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>self</p></td>
<td class="parameter_description"><p>a <a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>enable_online</p></td>
<td class="parameter_description"><p><code class="literal">TRUE</code> to not intercept and handle network connections from client code; <code class="literal">FALSE</code> otherwise</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since 0.1.0</p>
</div>
<hr>
<div class="refsect2">
<a name="uhm-server-get-trace-directory"></a><h3>uhm_server_get_trace_directory ()</h3>
<pre class="programlisting"><span class="returnvalue">GFile</span> *
uhm_server_get_trace_directory (<em class="parameter"><code><a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a> *self</code></em>);</pre>
<p>Gets the value of the <a class="link" href="UhmServer.html#UhmServer--trace-directory" title="The “trace-directory” property"><span class="type">“trace-directory”</span></a> property.</p>
<div class="refsect3">
<a name="id-1.3.2.3.11.19.5"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>self</p></td>
<td class="parameter_description"><p>a <a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.3.2.3.11.19.6"></a><h4>Returns</h4>
<p> the directory to load/store trace files from, or <code class="literal">NULL</code>. </p>
<p><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>][<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
<p class="since">Since 0.1.0</p>
</div>
<hr>
<div class="refsect2">
<a name="uhm-server-set-trace-directory"></a><h3>uhm_server_set_trace_directory ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
uhm_server_set_trace_directory (<em class="parameter"><code><a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a> *self</code></em>,
<em class="parameter"><code><span class="type">GFile</span> *trace_directory</code></em>);</pre>
<p>Sets the value of the <a class="link" href="UhmServer.html#UhmServer--trace-directory" title="The “trace-directory” property"><span class="type">“trace-directory”</span></a> property.</p>
<div class="refsect3">
<a name="id-1.3.2.3.11.20.5"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>self</p></td>
<td class="parameter_description"><p>a <a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>trace_directory</p></td>
<td class="parameter_description"><p> a directory to load/store trace files from, or <code class="literal">NULL</code> to unset it. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>][<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since 0.1.0</p>
</div>
<hr>
<div class="refsect2">
<a name="uhm-server-get-tls-certificate"></a><h3>uhm_server_get_tls_certificate ()</h3>
<pre class="programlisting"><span class="returnvalue">GTlsCertificate</span> *
uhm_server_get_tls_certificate (<em class="parameter"><code><a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a> *self</code></em>);</pre>
<p>Gets the value of the <a class="link" href="UhmServer.html#UhmServer--tls-certificate" title="The “tls-certificate” property"><span class="type">“tls-certificate”</span></a> property.</p>
<div class="refsect3">
<a name="id-1.3.2.3.11.21.5"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>self</p></td>
<td class="parameter_description"><p>a <a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.3.2.3.11.21.6"></a><h4>Returns</h4>
<p> the server's current TLS certificate; or <code class="literal">NULL</code> if it's serving HTTP only. </p>
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></p>
</div>
<p class="since">Since 0.1.0</p>
</div>
<hr>
<div class="refsect2">
<a name="uhm-server-set-tls-certificate"></a><h3>uhm_server_set_tls_certificate ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
uhm_server_set_tls_certificate (<em class="parameter"><code><a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a> *self</code></em>,
<em class="parameter"><code><span class="type">GTlsCertificate</span> *tls_certificate</code></em>);</pre>
<p>Sets the value of the <a class="link" href="UhmServer.html#UhmServer--tls-certificate" title="The “tls-certificate” property"><span class="type">“tls-certificate”</span></a> property.</p>
<div class="refsect3">
<a name="id-1.3.2.3.11.22.5"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>self</p></td>
<td class="parameter_description"><p>a <a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>tls_certificate</p></td>
<td class="parameter_description"><p> TLS certificate for the server to use; or <code class="literal">NULL</code> to serve HTTP only. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since 0.1.0</p>
</div>
<hr>
<div class="refsect2">
<a name="uhm-server-set-default-tls-certificate"></a><h3>uhm_server_set_default_tls_certificate ()</h3>
<pre class="programlisting"><span class="returnvalue">GTlsCertificate</span> *
uhm_server_set_default_tls_certificate
(<em class="parameter"><code><a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a> *self</code></em>);</pre>
<p>Sets the value of the <a class="link" href="UhmServer.html#UhmServer--tls-certificate" title="The “tls-certificate” property"><span class="type">“tls-certificate”</span></a> property to the default TLS certificate built in to libuhttpmock.
This default certificate is not signed by any certificate authority, and contains minimal metadata details. It may
be used by clients which have no special certificate requirements; clients which have special requirements should
construct a custom <span class="type">GTlsCertificate</span> and pass it to <a class="link" href="UhmServer.html#uhm-server-set-tls-certificate" title="uhm_server_set_tls_certificate ()"><code class="function">uhm_server_set_tls_certificate()</code></a>.</p>
<div class="refsect3">
<a name="id-1.3.2.3.11.23.5"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>self</p></td>
<td class="parameter_description"><p>a <a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.3.2.3.11.23.6"></a><h4>Returns</h4>
<p> the default certificate set as <a class="link" href="UhmServer.html#UhmServer--tls-certificate" title="The “tls-certificate” property"><span class="type">“tls-certificate”</span></a>. </p>
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
<p class="since">Since 0.1.0</p>
</div>
<hr>
<div class="refsect2">
<a name="uhm-server-set-expected-domain-names"></a><h3>uhm_server_set_expected_domain_names ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
uhm_server_set_expected_domain_names (<em class="parameter"><code><a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a> *self</code></em>,
<em class="parameter"><code>const <span class="type">gchar</span> * const *domain_names</code></em>);</pre>
<p>Set the domain names which are expected to have requests made of them by the client code interacting with this <a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a>.
This is a convenience method which calls <a class="link" href="UhmResolver.html#uhm-resolver-add-A" title="uhm_resolver_add_A ()"><code class="function">uhm_resolver_add_A()</code></a> on the server’s <a class="link" href="UhmResolver.html" title="UhmResolver"><span class="type">UhmResolver</span></a> for each of the domain names
listed in <em class="parameter"><code>domain_names</code></em>
. It associates them with the server’s current IP address, and automatically updates the mappings
if the IP address or resolver change.</p>
<p>Note that this will reset all records on the server’s <a class="link" href="UhmResolver.html" title="UhmResolver"><span class="type">UhmResolver</span></a>, replacing all of them with the provided <em class="parameter"><code>domain_names</code></em>
.</p>
<p>It is safe to add further domain names to the <a class="link" href="UhmResolver.html" title="UhmResolver"><span class="type">UhmResolver</span></a> in a callback for the <span class="type">“notify”</span> signal for <a class="link" href="UhmServer.html#UhmServer--resolver" title="The “resolver” property"><span class="type">“resolver”</span></a>;
that signal is emitted after the resolver is cleared and these <em class="parameter"><code>domain_names</code></em>
are added.</p>
<div class="refsect3">
<a name="id-1.3.2.3.11.24.7"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>self</p></td>
<td class="parameter_description"><p>a <a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>domain_names</p></td>
<td class="parameter_description"><p> <code class="literal">NULL</code>-terminated array of domain names to expect, or <code class="literal">NULL</code> to not expect any. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> zero-terminated=1][<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> utf8]</span></td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since 0.3.0</p>
</div>
<hr>
<div class="refsect2">
<a name="uhm-server-get-address"></a><h3>uhm_server_get_address ()</h3>
<pre class="programlisting">const <span class="returnvalue">gchar</span> *
uhm_server_get_address (<em class="parameter"><code><a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a> *self</code></em>);</pre>
<p>Gets the value of the <a class="link" href="UhmServer.html#UhmServer--address" title="The “address” property"><span class="type">“address”</span></a> property.</p>
<div class="refsect3">
<a name="id-1.3.2.3.11.25.5"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>self</p></td>
<td class="parameter_description"><p>a <a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.3.2.3.11.25.6"></a><h4>Returns</h4>
<p> the physical address of the listening socket the server is currently bound to; or <code class="literal">NULL</code> if the server is not running. </p>
<p><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>][<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
<p class="since">Since 0.1.0</p>
</div>
<hr>
<div class="refsect2">
<a name="uhm-server-get-port"></a><h3>uhm_server_get_port ()</h3>
<pre class="programlisting"><span class="returnvalue">guint</span>
uhm_server_get_port (<em class="parameter"><code><a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a> *self</code></em>);</pre>
<p>Gets the value of the <a class="link" href="UhmServer.html#UhmServer--port" title="The “port” property"><span class="type">“port”</span></a> property.</p>
<div class="refsect3">
<a name="id-1.3.2.3.11.26.5"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>self</p></td>
<td class="parameter_description"><p>a <a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.3.2.3.11.26.6"></a><h4>Returns</h4>
<p> the port of the listening socket the server is currently bound to; or <code class="code">0</code> if the server is not running</p>
<p></p>
</div>
<p class="since">Since 0.1.0</p>
</div>
<hr>
<div class="refsect2">
<a name="uhm-server-get-resolver"></a><h3>uhm_server_get_resolver ()</h3>
<pre class="programlisting"><a class="link" href="UhmResolver.html" title="UhmResolver"><span class="returnvalue">UhmResolver</span></a> *
uhm_server_get_resolver (<em class="parameter"><code><a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a> *self</code></em>);</pre>
<p>Gets the value of the <a class="link" href="UhmServer.html#UhmServer--resolver" title="The “resolver” property"><span class="type">“resolver”</span></a> property.</p>
<div class="refsect3">
<a name="id-1.3.2.3.11.27.5"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>self</p></td>
<td class="parameter_description"><p>a <a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.3.2.3.11.27.6"></a><h4>Returns</h4>
<p> the mock resolver in use by the mock server, or <code class="literal">NULL</code> if no resolver is active. </p>
<p><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>][<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
<p class="since">Since 0.1.0</p>
</div>
</div>
<div class="refsect1">
<a name="UhmServer.other_details"></a><h2>Types and Values</h2>
<div class="refsect2">
<a name="UhmServer-struct"></a><h3>UhmServer</h3>
<pre class="programlisting">typedef struct _UhmServer UhmServer;</pre>
<p>All the fields in the <a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a> structure are private and should never be accessed directly.</p>
<p class="since">Since 0.1.0</p>
</div>
<hr>
<div class="refsect2">
<a name="UhmServerClass"></a><h3>UhmServerClass</h3>
<pre class="programlisting">typedef struct {
gboolean (*handle_message) (UhmServer *self, SoupMessage *message, SoupClientContext *client);
gboolean (*compare_messages) (UhmServer *self, SoupMessage *expected_message, SoupMessage *actual_message, SoupClientContext *actual_client);
} UhmServerClass;
</pre>
<p>Most of the fields in the <a class="link" href="UhmServer.html#UhmServerClass" title="UhmServerClass"><span class="type">UhmServerClass</span></a> structure are private and should never be accessed directly.</p>
<div class="refsect3">
<a name="id-1.3.2.3.12.3.5"></a><h4>Members</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="300px" class="struct_members_name">
<col class="struct_members_description">
<col width="200px" class="struct_members_annotations">
</colgroup>
<tbody>
<tr>
<td class="struct_member_name"><p><em class="structfield"><code><a name="UhmServerClass.handle-message"></a>handle_message</code></em> ()</p></td>
<td class="struct_member_description"><p>Class handler for the <a class="link" href="UhmServer.html#UhmServer-handle-message" title="The “handle-message” signal"><span class="type">“handle-message”</span></a> signal. Subclasses may implement this to override the
default handler for the signal. The default handler should always return <code class="literal">TRUE</code> to indicate that it has handled
the <em class="parameter"><code>message</code></em>
from <em class="parameter"><code>client</code></em>
by setting an appropriate response on the <span class="type">SoupMessage</span>.</p></td>
<td class="struct_member_annotations"> </td>
</tr>
<tr>
<td class="struct_member_name"><p><em class="structfield"><code><a name="UhmServerClass.compare-messages"></a>compare_messages</code></em> ()</p></td>
<td class="struct_member_description"><p>Class handler for the <a class="link" href="UhmServer.html#UhmServer-compare-messages" title="The “compare-messages” signal"><span class="type">“compare-messages”</span></a> signal. Subclasses may implement this to override
the default handler for the signal. The handler should return <code class="literal">TRUE</code> if <em class="parameter"><code>expected_message</code></em>
and <em class="parameter"><code>actual_message</code></em>
compare
equal, and <code class="literal">FALSE</code> otherwise.</p></td>
<td class="struct_member_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since 0.1.0</p>
</div>
<hr>
<div class="refsect2">
<a name="UhmServerError"></a><h3>enum UhmServerError</h3>
<p>Error codes for <a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a> operations.</p>
<div class="refsect3">
<a name="id-1.3.2.3.12.4.4"></a><h4>Members</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="300px" class="enum_members_name">
<col class="enum_members_description">
<col width="200px" class="enum_members_annotations">
</colgroup>
<tbody><tr>
<td class="enum_member_name"><p><a name="UHM-SERVER-ERROR-MESSAGE-MISMATCH:CAPS"></a>UHM_SERVER_ERROR_MESSAGE_MISMATCH</p></td>
<td class="enum_member_description">
<p>In comparison mode, a message received from the client did not match the next message in the current trace file.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr></tbody>
</table></div>
</div>
</div>
</div>
<div class="refsect1">
<a name="UhmServer.property-details"></a><h2>Property Details</h2>
<div class="refsect2">
<a name="UhmServer--address"></a><h3>The <code class="literal">“address”</code> property</h3>
<pre class="programlisting"> “address” <span class="type">gchar</span> *</pre>
<p>Address of the local mock server if it's running, or <code class="literal">NULL</code> otherwise. This will be non-<code class="literal">NULL</code> between calls to <a class="link" href="UhmServer.html#uhm-server-run" title="uhm_server_run ()"><code class="function">uhm_server_run()</code></a> and
<a class="link" href="UhmServer.html#uhm-server-stop" title="uhm_server_stop ()"><code class="function">uhm_server_stop()</code></a>. The address is a physical IP address, e.g. <code class="code">127.0.0.1</code>.</p>
<p>This should not normally need to be passed into client code under test, unless the code references IP addresses specifically. The mock server
runs a DNS resolver which automatically redirects client requests for known domain names to this address (<a class="link" href="UhmServer.html#UhmServer--resolver" title="The “resolver” property"><span class="type">“resolver”</span></a>).</p>
<p>Flags: Read</p>
<p>Default value: NULL</p>
<p class="since">Since 0.1.0</p>
</div>
<hr>
<div class="refsect2">
<a name="UhmServer--enable-logging"></a><h3>The <code class="literal">“enable-logging”</code> property</h3>
<pre class="programlisting"> “enable-logging” <span class="type">gboolean</span></pre>
<p><code class="literal">TRUE</code> if network traffic should be logged to a trace file (specified by calling <a class="link" href="UhmServer.html#uhm-server-start-trace" title="uhm_server_start_trace ()"><code class="function">uhm_server_start_trace()</code></a>). This operates independently
of whether traffic is online or being handled locally by the mock server.
Use this in conjunction with <a class="link" href="UhmServer.html#UhmServer--enable-online" title="The “enable-online” property"><span class="type">“enable-online”</span></a> to either log online traffic, or replay logged traffic locally.</p>
<p>Flags: Read / Write</p>
<p>Default value: FALSE</p>
<p class="since">Since 0.1.0</p>
</div>
<hr>
<div class="refsect2">
<a name="UhmServer--enable-online"></a><h3>The <code class="literal">“enable-online”</code> property</h3>
<pre class="programlisting"> “enable-online” <span class="type">gboolean</span></pre>
<p><code class="literal">TRUE</code> if network traffic should reach the Internet as normal; <code class="literal">FALSE</code> to redirect it to the local mock server.
Use this in conjunction with <a class="link" href="UhmServer.html#UhmServer--enable-logging" title="The “enable-logging” property"><span class="type">“enable-logging”</span></a> to either log online traffic, or replay logged traffic locally.</p>
<p>Flags: Read / Write</p>
<p>Default value: FALSE</p>
<p class="since">Since 0.1.0</p>
</div>
<hr>
<div class="refsect2">
<a name="UhmServer--port"></a><h3>The <code class="literal">“port”</code> property</h3>
<pre class="programlisting"> “port” <span class="type">guint</span></pre>
<p>Port of the local mock server if it's running, or <code class="code">0</code> otherwise. This will be non-<code class="code">0</code> between
calls to <a class="link" href="UhmServer.html#uhm-server-run" title="uhm_server_run ()"><code class="function">uhm_server_run()</code></a> and <a class="link" href="UhmServer.html#uhm-server-stop" title="uhm_server_stop ()"><code class="function">uhm_server_stop()</code></a>.</p>
<p>It is intended that this port be passed into the client code under test, to substitute for the default HTTPS port (443) which it would otherwise
use.</p>
<p>Flags: Read</p>
<p>Default value: 0</p>
<p class="since">Since 0.1.0</p>
</div>
<hr>
<div class="refsect2">
<a name="UhmServer--resolver"></a><h3>The <code class="literal">“resolver”</code> property</h3>
<pre class="programlisting"> “resolver” <a class="link" href="UhmResolver.html" title="UhmResolver"><span class="type">UhmResolver</span></a> *</pre>
<p>Mock resolver used to redirect HTTP requests from specified domain names to the local mock server instance. This will always be set while the
server is running (between calls to <a class="link" href="UhmServer.html#uhm-server-run" title="uhm_server_run ()"><code class="function">uhm_server_run()</code></a> and <a class="link" href="UhmServer.html#uhm-server-stop" title="uhm_server_stop ()"><code class="function">uhm_server_stop()</code></a>), and is <code class="literal">NULL</code> otherwise.</p>
<p>Use the resolver specified in this property to add domain names which are expected to be requested by the current trace. Domain names not added
to the resolver will be rejected by the mock server. The set of domain names in the resolver will be reset when <a class="link" href="UhmServer.html#uhm-server-stop" title="uhm_server_stop ()"><code class="function">uhm_server_stop()</code></a> is
called.</p>
<p>Flags: Read</p>
<p class="since">Since 0.1.0</p>
</div>
<hr>
<div class="refsect2">
<a name="UhmServer--tls-certificate"></a><h3>The <code class="literal">“tls-certificate”</code> property</h3>
<pre class="programlisting"> “tls-certificate” <span class="type">GTlsCertificate</span> *</pre>
<p>TLS certificate for the mock server to use when serving HTTPS pages. If this is non-<code class="literal">NULL</code>, the server will always use HTTPS. If it is <code class="literal">NULL</code>,
the server will always use HTTP. The TLS certificate may be changed after constructing the <a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a>, but changes to the property will not
take effect until the next call to <a class="link" href="UhmServer.html#uhm-server-run" title="uhm_server_run ()"><code class="function">uhm_server_run()</code></a>.</p>
<p>A certificate and private key may be generated by executing:</p>
<code class="code">openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -nodes</code>. These files may then be used to construct a
<p><span class="type">GTlsCertificate</span> by calling <code class="function">g_tls_certificate_new_from_files()</code>.</p>
<p>Alternatively, a default <span class="type">GTlsCertificate</span> which wraps a dummy certificate (not signed by any certificate authority) may be set by
calling <a class="link" href="UhmServer.html#uhm-server-set-default-tls-certificate" title="uhm_server_set_default_tls_certificate ()"><code class="function">uhm_server_set_default_tls_certificate()</code></a>. This may be used as the <a class="link" href="UhmServer.html#UhmServer--tls-certificate" title="The “tls-certificate” property"><span class="type">“tls-certificate”</span></a> if the code under test has no specific
requirements of the certificate used by the mock server it's tested against.</p>
<p>Flags: Read / Write</p>
<p class="since">Since 0.1.0</p>
</div>
<hr>
<div class="refsect2">
<a name="UhmServer--trace-directory"></a><h3>The <code class="literal">“trace-directory”</code> property</h3>
<pre class="programlisting"> “trace-directory” <span class="type">GFile</span> *</pre>
<p>Directory relative to which all trace files specified in calls to <a class="link" href="UhmServer.html#uhm-server-start-trace" title="uhm_server_start_trace ()"><code class="function">uhm_server_start_trace()</code></a> will be resolved.
This is not used for any other methods, but must be non-<code class="literal">NULL</code> if <a class="link" href="UhmServer.html#uhm-server-start-trace" title="uhm_server_start_trace ()"><code class="function">uhm_server_start_trace()</code></a> is called.</p>
<p>Flags: Read / Write</p>
<p class="since">Since 0.1.0</p>
</div>
</div>
<div class="refsect1">
<a name="UhmServer.signal-details"></a><h2>Signal Details</h2>
<div class="refsect2">
<a name="UhmServer-compare-messages"></a><h3>The <code class="literal">“compare-messages”</code> signal</h3>
<pre class="programlisting"><span class="returnvalue">gboolean</span>
user_function (<a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a> *self,
<span class="type">SoupMessage</span> *expected_message,
<span class="type">SoupMessage</span> *actual_message,
<span class="type">SoupClientContext</span> *actual_client,
<span class="type">gpointer</span> user_data)</pre>
<p>Emitted whenever the mock server must compare two <span class="type">SoupMessage</span>s for equality; e.g. when in the testing or comparison modes.
Test code may connect to this signal and implement a handler which checks custom properties of the messages. The default handler compares
the URI and method of the messages, but no headers and not the message bodies.</p>
<p>Signal handlers should return <code class="literal">TRUE</code> if the messages match; and <code class="literal">FALSE</code> otherwise. The first signal handler executed when
this signal is emitted wins.</p>
<div class="refsect3">
<a name="id-1.3.2.3.14.2.6"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>self</p></td>
<td class="parameter_description"><p>a <a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>expected_message</p></td>
<td class="parameter_description"><p>a message containing the expected HTTP(S) message provided by <a class="link" href="UhmServer.html#UhmServer-handle-message" title="The “handle-message” signal"><span class="type">“handle-message”</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>actual_message</p></td>
<td class="parameter_description"><p>a message containing the incoming HTTP(S) request</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>actual_client</p></td>
<td class="parameter_description"><p>additional data about the HTTP client making the request</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>user_data</p></td>
<td class="parameter_description"><p>user data set when the signal handler was connected.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p>Flags: Run Last</p>
<p class="since">Since 0.1.0</p>
</div>
<hr>
<div class="refsect2">
<a name="UhmServer-handle-message"></a><h3>The <code class="literal">“handle-message”</code> signal</h3>
<pre class="programlisting"><span class="returnvalue">gboolean</span>
user_function (<a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a> *self,
<span class="type">SoupMessage</span> *message,
<span class="type">SoupClientContext</span> *client,
<span class="type">gpointer</span> user_data)</pre>
<p>Emitted whenever the mock server is running and receives a request from a client. Test code may connect to this signal and implement a handler
which builds and returns a suitable response for a given message. The default handler reads a request–response pair from the current trace file,
matches the requests and then returns the given response. If the requests don't match, an error is raised.</p>
<p>Signal handlers should return <code class="literal">TRUE</code> if they have handled the request and set an appropriate response; and <code class="literal">FALSE</code> otherwise.</p>
<div class="refsect3">
<a name="id-1.3.2.3.14.3.6"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>self</p></td>
<td class="parameter_description"><p>a <a class="link" href="UhmServer.html" title="UhmServer"><span class="type">UhmServer</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>message</p></td>
<td class="parameter_description"><p>a message containing the incoming HTTP(S) request, and which the outgoing HTTP(S) response should be set on</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>client</p></td>
<td class="parameter_description"><p>additional data about the HTTP client making the request</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>user_data</p></td>
<td class="parameter_description"><p>user data set when the signal handler was connected.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p>Flags: Run Last</p>
<p class="since">Since 0.1.0</p>
</div>
</div>
</div>
<div class="footer">
<hr>
Generated by GTK-Doc V1.21</div>
</body>
</html>
|