Compare commits
	
		
			771 Commits
		
	
	
		
			curl-7_19_
			...
			curl-7_19_
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 6bf9d56485 | ||
|   | 367114bc87 | ||
|   | 81d45ed3a2 | ||
|   | 7d74e02519 | ||
|   | 7611d30a05 | ||
|   | 3704375292 | ||
|   | ea1f30e686 | ||
|   | 9732b7cebe | ||
|   | f39380b1ac | ||
|   | c8da2980ed | ||
|   | b19dc0eeb0 | ||
|   | 41de897b6b | ||
|   | 108b414bb8 | ||
|   | be7af8beaa | ||
|   | db1281fa9b | ||
|   | 223d848104 | ||
|   | d8884168e3 | ||
|   | 5dd64e9e4b | ||
|   | ce6731baf1 | ||
|   | 2c0b65d37b | ||
|   | a76f4ab7dd | ||
|   | d68f215f03 | ||
|   | 0a5ac52b49 | ||
|   | 8acb3803e4 | ||
|   | ac62a94de3 | ||
|   | 0abcb37e3f | ||
|   | 7da5efd55c | ||
|   | d4ff44d5f6 | ||
|   | fff706d702 | ||
|   | eac4310b2e | ||
|   | e87ee29e32 | ||
|   | 61ebbc01ed | ||
|   | 15f425bdb8 | ||
|   | 861092637b | ||
|   | 3717b7a792 | ||
|   | 950a034895 | ||
|   | 982e655c07 | ||
|   | 308497ffc6 | ||
|   | b205525d34 | ||
|   | 654b6b6c63 | ||
|   | 3b908ed143 | ||
|   | 265ed24ac0 | ||
|   | 57eeee2ec3 | ||
|   | 6a79b0e859 | ||
|   | 0d9f14f5c1 | ||
|   | 9fced16efb | ||
|   | f16868d301 | ||
|   | 21af9bf1cd | ||
|   | b2f4308980 | ||
|   | 6a37135f4d | ||
|   | b8e1e63379 | ||
|   | 448d2b5f49 | ||
|   | 7867d44251 | ||
|   | 2380ca1714 | ||
|   | a1cc78d5a1 | ||
|   | 7531ac89d6 | ||
|   | 72acffc66c | ||
|   | 525549f204 | ||
|   | 3f8d3e9c50 | ||
|   | 1951cd1eee | ||
|   | 55aee95f11 | ||
|   | 777134a07b | ||
|   | 4b8ce9423f | ||
|   | 051ab439a9 | ||
|   | 12e60c6d4e | ||
|   | ff3223259f | ||
|   | 3da1ade4e5 | ||
|   | ff40c83aa7 | ||
|   | f49427d364 | ||
|   | 04e8ff84fe | ||
|   | 6f4a5a4612 | ||
|   | 6d4e6cc813 | ||
|   | 86cec97b22 | ||
|   | e5ee822745 | ||
|   | 167a92810a | ||
|   | b8b8c3d538 | ||
|   | 21105ab344 | ||
|   | e49d928ce4 | ||
|   | 5e253785af | ||
|   | 3cbc8d1ba3 | ||
|   | b4af26a188 | ||
|   | 6daede08cb | ||
|   | 3669ff3c1e | ||
|   | 9afdb05fe8 | ||
|   | 4d9279cb3b | ||
|   | 640e49976f | ||
|   | f1aa936d2c | ||
|   | a5ba25a5f6 | ||
|   | b4e6418aef | ||
|   | 0077a6d51b | ||
|   | 4798f4e652 | ||
|   | b38e28b6bc | ||
|   | 052dac0d3f | ||
|   | 2eeafcf9a6 | ||
|   | 45e093fc45 | ||
|   | e593715d72 | ||
|   | 1209f2c014 | ||
|   | 7c821a85f8 | ||
|   | cf367a62ce | ||
|   | b233957885 | ||
|   | 492aed1450 | ||
|   | cd91a1eeca | ||
|   | 5ed274d0b7 | ||
|   | 4271f44a9e | ||
|   | 78d07cb0f9 | ||
|   | 5b11e3883c | ||
|   | 7d22ce5573 | ||
|   | b64dd3c63d | ||
|   | 0ea6abe7df | ||
|   | 8646cecb78 | ||
|   | 867a0de670 | ||
|   | 4f47fc4e14 | ||
|   | 8d39a31e89 | ||
|   | 66fcebdc9e | ||
|   | af9ce990f0 | ||
|   | e3d623f190 | ||
|   | 15be441ad8 | ||
|   | c7c84e7420 | ||
|   | 37489a855f | ||
|   | f03130a36e | ||
|   | a1d18227e5 | ||
|   | 1549605c55 | ||
|   | 14a3f4cd54 | ||
|   | 9448659fc6 | ||
|   | 4002714825 | ||
|   | 61ea058d9f | ||
|   | 0fdb77d643 | ||
|   | 0c90cb7b83 | ||
|   | ede2ac0ea2 | ||
|   | d006efebc0 | ||
|   | f2f45339dc | ||
|   | be5c815f63 | ||
|   | 31e106ced2 | ||
|   | 250ba99498 | ||
|   | c2c3a46e3e | ||
|   | 3eee678ab1 | ||
|   | 62ed553054 | ||
|   | e3049e98d8 | ||
|   | 86f9168797 | ||
|   | f7690db37d | ||
|   | 7e0b0763fc | ||
|   | c67c4e7095 | ||
|   | 64a05e540e | ||
|   | beb0a345ac | ||
|   | f60cb60fc6 | ||
|   | 4002fbe1f5 | ||
|   | 7ff4b4f2b5 | ||
|   | 945feafe25 | ||
|   | 5389ac0ddf | ||
|   | 5d4a1e245b | ||
|   | 3c199daa95 | ||
|   | 4dd33ac575 | ||
|   | bb3bbfe56d | ||
|   | f09de577f5 | ||
|   | c2ce4e55f0 | ||
|   | 5e3796349a | ||
|   | 56a161e09a | ||
|   | 2786ecaeef | ||
|   | 1486a11839 | ||
|   | c4c15288d2 | ||
|   | aaed838872 | ||
|   | 43fba2627a | ||
|   | 7df26a5415 | ||
|   | f3611c2773 | ||
|   | d5de849552 | ||
|   | 6569a23890 | ||
|   | 2cf0f80e9f | ||
|   | 223c0b980b | ||
|   | 7ab1139f07 | ||
|   | d055226949 | ||
|   | cf910f3097 | ||
|   | 183c9ce1cf | ||
|   | 777168cb77 | ||
|   | 0dd6c329e3 | ||
|   | 7a642c8bf1 | ||
|   | e47c939822 | ||
|   | a0bbe25eef | ||
|   | b96f11f7ec | ||
|   | 7e07da977c | ||
|   | ddb1fb7535 | ||
|   | ea2754e028 | ||
|   | ceda7e98f8 | ||
|   | 2d0aca3b92 | ||
|   | 4e9d3c26ed | ||
|   | f3bd0c3fc3 | ||
|   | eb438719f7 | ||
|   | 44e2832b2a | ||
|   | 9539d32298 | ||
|   | 60c0994677 | ||
|   | e7f81d59b0 | ||
|   | f1320d6733 | ||
|   | 68f7d5b8d3 | ||
|   | e8baa332d7 | ||
|   | 39704bec3c | ||
|   | fad14bca01 | ||
|   | 9e8eec4816 | ||
|   | fa2ea23c96 | ||
|   | 1a255e0e28 | ||
|   | 1d92cf1dab | ||
|   | 8d1e46bdcc | ||
|   | b0b2824b58 | ||
|   | 0cb6f3053f | ||
|   | 95c2b205a4 | ||
|   | 6ede4ce79d | ||
|   | 10f2fa9c72 | ||
|   | 8b5102ca83 | ||
|   | 1048043963 | ||
|   | 2c4fcf2ea8 | ||
|   | 681162510a | ||
|   | 5c59ee9488 | ||
|   | 9075195ec4 | ||
|   | 62960f8a42 | ||
|   | 6293fe98a0 | ||
|   | 5c716247aa | ||
|   | daf688eba6 | ||
|   | c6712a0c6c | ||
|   | 4d74b52656 | ||
|   | be2fcbcbf1 | ||
|   | 6247b6d468 | ||
|   | 966cb698e6 | ||
|   | 4b44638f4d | ||
|   | 13afff5752 | ||
|   | e73fe837a8 | ||
|   | a9caeb1064 | ||
|   | 171eef68c3 | ||
|   | 33368ebd02 | ||
|   | 501f9f8309 | ||
|   | 9fe787fc1f | ||
|   | 0dec3e5e6a | ||
|   | 66f5baa16e | ||
|   | 1cb921b7f3 | ||
|   | 0cf6721898 | ||
|   | 97c8bc9757 | ||
|   | 2cad095425 | ||
|   | 37d509f04f | ||
|   | 35eb9fc6ad | ||
|   | df09088a96 | ||
|   | 1a14966577 | ||
|   | 0606b792f0 | ||
|   | a53525e930 | ||
|   | 3a9c03bef3 | ||
|   | f0dbdcff9d | ||
|   | 9d03dd7fb8 | ||
|   | 781b82baf5 | ||
|   | 2838362a7b | ||
|   | 0b66efac9c | ||
|   | 47a9660ec1 | ||
|   | aabf62e7d2 | ||
|   | 6d891d2a3b | ||
|   | c0e8bed5bf | ||
|   | 0dce2ff8a0 | ||
|   | 2642638fca | ||
|   | 8b0fc9819f | ||
|   | bf5f91244b | ||
|   | e8e84cf1da | ||
|   | 0179dbe1c2 | ||
|   | 8978b87728 | ||
|   | 0684128209 | ||
|   | 9b5c00a664 | ||
|   | b347a7a96e | ||
|   | 240bfaa69e | ||
|   | 7dc48e57a6 | ||
|   | 8570883412 | ||
|   | 1d5627b181 | ||
|   | 038fff6c9f | ||
|   | 21dd9a8021 | ||
|   | 59934c1176 | ||
|   | 2f6ff57d96 | ||
|   | 77eba8727d | ||
|   | 47c392e135 | ||
|   | 9cff716925 | ||
|   | 4c207a004c | ||
|   | 650543a042 | ||
|   | 5f0cae8037 | ||
|   | 95c2ab77e7 | ||
|   | d7f33b7e4e | ||
|   | 56e6441ceb | ||
|   | b74b5e0602 | ||
|   | b4dcbbfabd | ||
|   | 6dd0277c22 | ||
|   | fb08218a04 | ||
|   | 08d95bff5e | ||
|   | b476530755 | ||
|   | a8ea1e9ef4 | ||
|   | 6dade671ad | ||
|   | 38b88b5892 | ||
|   | 340e3b952f | ||
|   | 35c91f6ea9 | ||
|   | f5f9354093 | ||
|   | 600460ffc6 | ||
|   | 18b3833f90 | ||
|   | f671d0513c | ||
|   | 100f6b7703 | ||
|   | 4e75c70874 | ||
|   | bdbfe1f8a9 | ||
|   | bea9d2cafd | ||
|   | d709cb2ae3 | ||
|   | 444bb03fab | ||
|   | 966cc10fcc | ||
|   | 0c7087c41f | ||
|   | c42a06bc1f | ||
|   | b4c00a8fb0 | ||
|   | f3403d4c5b | ||
|   | 5cf78472e1 | ||
|   | 2aaff16a87 | ||
|   | 6236198d43 | ||
|   | 83fb285d40 | ||
|   | 3050f10676 | ||
|   | 175fc5096d | ||
|   | 18f238dd53 | ||
|   | 4f551259dd | ||
|   | 9cb68c6e32 | ||
|   | a9a89c604a | ||
|   | e96a9190a3 | ||
|   | 1ff4e9008b | ||
|   | 2d716517a8 | ||
|   | 22226a8aec | ||
|   | 9b8e56c97c | ||
|   | ad1bfc5468 | ||
|   | 2c0c05e96d | ||
|   | d6d63147b6 | ||
|   | 98f7771d74 | ||
|   | 37eba37019 | ||
|   | 40b2f2553b | ||
|   | d3e35d49ae | ||
|   | a0474685c1 | ||
|   | 0b317b72ae | ||
|   | afe06d1563 | ||
|   | c40365e9b6 | ||
|   | 4b6d3a2bfd | ||
|   | 7ae624e700 | ||
|   | c32cf33a16 | ||
|   | 7eb59de7df | ||
|   | 5931cf77f4 | ||
|   | 989aace192 | ||
|   | 65cf30e441 | ||
|   | d4480c979d | ||
|   | 169e94d68b | ||
|   | 0cc8184057 | ||
|   | a7c75142fa | ||
|   | 02d3c452e4 | ||
|   | 1c148575ea | ||
|   | d1a1865650 | ||
|   | 067544abc5 | ||
|   | 77da57057f | ||
|   | aa1da57c37 | ||
|   | c2ce2aa4de | ||
|   | 90c9fd55fc | ||
|   | 47e403640b | ||
|   | 4ea513cc38 | ||
|   | 3ca0b9bb47 | ||
|   | e592da5a59 | ||
|   | 2c93f889fd | ||
|   | 6173ce6463 | ||
|   | 065a51d2e1 | ||
|   | 7edcc22136 | ||
|   | 352177090f | ||
|   | 9d18c0b156 | ||
|   | ec65a9a364 | ||
|   | 5c4b6a8ef0 | ||
|   | 5d502eb90c | ||
|   | d6662d8442 | ||
|   | 1d97f13462 | ||
|   | 2c16681225 | ||
|   | 065047dc62 | ||
|   | eba8d6d5f5 | ||
|   | 744dceaffe | ||
|   | 8740d147c9 | ||
|   | 16ae283fb4 | ||
|   | 312600fe9c | ||
|   | 3e0c067e43 | ||
|   | f90551ff41 | ||
|   | 9442fc0b52 | ||
|   | dbb93a2718 | ||
|   | 242cf423f8 | ||
|   | 217faf778b | ||
|   | 01b74950b7 | ||
|   | 420bfbcf40 | ||
|   | 89f6567fda | ||
|   | efec05d581 | ||
|   | 47198dce5d | ||
|   | f45500c612 | ||
|   | 6f3e817372 | ||
|   | cfda5df020 | ||
|   | 2b4f41603d | ||
|   | 448f448d14 | ||
|   | ee6a618116 | ||
|   | e08f81c891 | ||
|   | 9324f1c29f | ||
|   | d71c1514f2 | ||
|   | 2df75e84e7 | ||
|   | 9ab89734de | ||
|   | 960c0319c4 | ||
|   | 439891cb9f | ||
|   | bdfb3ef11c | ||
|   | 8d581f7fe4 | ||
|   | 262907d0a3 | ||
|   | 15be673054 | ||
|   | 16a5649670 | ||
|   | 6582895b51 | ||
|   | e3d65389d7 | ||
|   | 027cb376f3 | ||
|   | f1261bcdd7 | ||
|   | 2e7b36d04f | ||
|   | ce1a58414a | ||
|   | 1012c5705a | ||
|   | 1c2947581b | ||
|   | 00883822be | ||
|   | 13fdb9d8a5 | ||
|   | 52b2bc4109 | ||
|   | b59b3a5152 | ||
|   | fe6c03370e | ||
|   | e3f128875c | ||
|   | 7bf82a814b | ||
|   | e1270928a3 | ||
|   | 6fce5b54a8 | ||
|   | 3c38eafd75 | ||
|   | 9dcc1b3370 | ||
|   | e3c37aac28 | ||
|   | 61a967095d | ||
|   | c0e004ec1c | ||
|   | 0a1b7296b9 | ||
|   | cd5e6743f7 | ||
|   | 2091fe530f | ||
|   | cda8d63d43 | ||
|   | bef1b140e9 | ||
|   | c9188e2260 | ||
|   | 15eaf27bc7 | ||
|   | bf2277e263 | ||
|   | 348ffbc47e | ||
|   | f13cbcf175 | ||
|   | 9418c56fd3 | ||
|   | 7dbd502931 | ||
|   | 0bf9c1e881 | ||
|   | bf07d37737 | ||
|   | eecb713616 | ||
|   | bf085e2c4b | ||
|   | ce1a97d6c8 | ||
|   | 34c9ec4e1a | ||
|   | e73fb6808a | ||
|   | 1c93d9dcfe | ||
|   | 675d6ec5e6 | ||
|   | 1ad43c54c0 | ||
|   | 1cf6c15ab4 | ||
|   | 8fc17ed764 | ||
|   | 26028068e8 | ||
|   | 8519682564 | ||
|   | 5ca0c73e98 | ||
|   | 4c979aa44f | ||
|   | 274dc3ecac | ||
|   | 5e2b5edde5 | ||
|   | b8b6521659 | ||
|   | e37b1b0623 | ||
|   | 4a79462c3e | ||
|   | c328cc9608 | ||
|   | cf2d39220a | ||
|   | 7dbd649f60 | ||
|   | 4282199bb4 | ||
|   | 7071dd0162 | ||
|   | e61a687eda | ||
|   | 7e85d2fbd4 | ||
|   | 969ab28261 | ||
|   | 90d36cc630 | ||
|   | 1bb68cbcfa | ||
|   | de7a14003c | ||
|   | e3ead9f585 | ||
|   | a461b0ae44 | ||
|   | 1b28f9fa89 | ||
|   | dff8076022 | ||
|   | dd3c187484 | ||
|   | 4677778f85 | ||
|   | f96204dbe0 | ||
|   | 0427b783e2 | ||
|   | 4650732f4a | ||
|   | 1e138c1401 | ||
|   | 89fb7c85bf | ||
|   | 0e51fc90e3 | ||
|   | 1b6c683ca6 | ||
|   | 501e72c3de | ||
|   | a450efb483 | ||
|   | 0cf8d4f8e8 | ||
|   | 084447e414 | ||
|   | 4c9c9f0b89 | ||
|   | 13db2916de | ||
|   | 2d64cd55a1 | ||
|   | 60a6af7498 | ||
|   | 3cb06eb2b2 | ||
|   | b8e73495a5 | ||
|   | 187cfc1594 | ||
|   | 90cd2a4753 | ||
|   | f3e6a582d4 | ||
|   | 3ae470eedf | ||
|   | 6595592a71 | ||
|   | 199389c94a | ||
|   | c31438b2f2 | ||
|   | 843f73ecaa | ||
|   | 86f043a66c | ||
|   | 80d2df7789 | ||
|   | f882a63cba | ||
|   | 611b3584d6 | ||
|   | a1f13dd31b | ||
|   | 966e7d0e36 | ||
|   | 44103abdb7 | ||
|   | 8f9d4b2b50 | ||
|   | 78c674a685 | ||
|   | 197830a57d | ||
|   | 3d024d5fce | ||
|   | 5763743614 | ||
|   | 54da964a99 | ||
|   | e25cff9328 | ||
|   | 36b397be9f | ||
|   | 468019e947 | ||
|   | 7e941baa26 | ||
|   | 63270b0665 | ||
|   | bcdbba05d3 | ||
|   | 51d1f309cd | ||
|   | f04720afb8 | ||
|   | e6e6c6e635 | ||
|   | 1f340a262f | ||
|   | 242a17b9e0 | ||
|   | 6e1632c606 | ||
|   | 56dab605f1 | ||
|   | 3aa3d7e629 | ||
|   | 75585f771a | ||
|   | 9a9f35039e | ||
|   | e6f84b8cc8 | ||
|   | 72f15da2ed | ||
|   | effbd99384 | ||
|   | d1ba4324de | ||
|   | c0b5d378dc | ||
|   | b8c438f22d | ||
|   | a85271ce0a | ||
|   | fd5e69f769 | ||
|   | ddb0b8d8b8 | ||
|   | 1345226bc9 | ||
|   | fb202e9de7 | ||
|   | 5dcb5fa862 | ||
|   | f77f2709a9 | ||
|   | bc852bca48 | ||
|   | 9314e9e853 | ||
|   | 838ddf8f55 | ||
|   | 619869c639 | ||
|   | 31baaf72b4 | ||
|   | c92b996942 | ||
|   | e84c7db049 | ||
|   | 9ef7b6afe2 | ||
|   | c5c03ac556 | ||
|   | 6ca321ca75 | ||
|   | 9c788a529b | ||
|   | 6159c356c9 | ||
|   | ac9d92587e | ||
|   | f32dc6b828 | ||
|   | 7a928b40f3 | ||
|   | 172501e10c | ||
|   | 317e030de0 | ||
|   | cfda3e6a48 | ||
|   | 4d522b8f31 | ||
|   | e93c81196f | ||
|   | 7bdd14a994 | ||
|   | afe06b48d6 | ||
|   | 63c5ed3798 | ||
|   | 77bb536542 | ||
|   | 7c6e0d5981 | ||
|   | a1708730c3 | ||
|   | d33ca87e4c | ||
|   | 3c509c5f68 | ||
|   | a840cc700a | ||
|   | b40b989523 | ||
|   | 5eba93c4e7 | ||
|   | 915dfb494e | ||
|   | a16cca7680 | ||
|   | 644482fc99 | ||
|   | 8c08ecfcbf | ||
|   | b9920bdd0e | ||
|   | bdf71e2685 | ||
|   | bd4fd9c28c | ||
|   | ff3e574187 | ||
|   | 4422f80ae7 | ||
|   | cc8c2efff2 | ||
|   | cdaca293d9 | ||
|   | 4dbc7850bd | ||
|   | 8119379d4f | ||
|   | 9b4253fe67 | ||
|   | b5c599c80c | ||
|   | 9137e717b0 | ||
|   | 80186aa7f4 | ||
|   | 6ac739630f | ||
|   | 80a61616b1 | ||
|   | 589d2ee7b5 | ||
|   | 0a294db912 | ||
|   | 2788aa366c | ||
|   | 0f29fdaf17 | ||
|   | 2912d993c2 | ||
|   | 62ceb118ee | ||
|   | 0569c9c1be | ||
|   | 5a91746b80 | ||
|   | fdc091a857 | ||
|   | 8469db016d | ||
|   | f6312b16f1 | ||
|   | c76e538231 | ||
|   | 96ea49870c | ||
|   | 6e8c73fd38 | ||
|   | 56981a2aaf | ||
|   | ec16121fb3 | ||
|   | 7bd9988c8e | ||
|   | 068312ecb8 | ||
|   | d36a86a12c | ||
|   | c174b13f8b | ||
|   | 6b95c4e358 | ||
|   | 22e2ecb003 | ||
|   | e08296f70c | ||
|   | dd50e5bdf2 | ||
|   | 504ecd5f7a | ||
|   | 7d1bb21c19 | ||
|   | 63dc2a843f | ||
|   | 296baeb096 | ||
|   | 01dabb774a | ||
|   | d0fe4071a9 | ||
|   | 3d491c470b | ||
|   | 06462e8a92 | ||
|   | dbf371344b | ||
|   | e2c6e00570 | ||
|   | e4a0001fc6 | ||
|   | 49400b0c7f | ||
|   | 5957498c6f | ||
|   | b6282b99cb | ||
|   | a8483841b5 | ||
|   | d068001102 | ||
|   | d576be58dc | ||
|   | 1a2b88964f | ||
|   | f7a188a642 | ||
|   | befbf2a206 | ||
|   | e01b7c1ede | ||
|   | dd8d472318 | ||
|   | 256489639c | ||
|   | e323abe5d9 | ||
|   | afc00b08d7 | ||
|   | af41fb79b5 | ||
|   | 535b7c5e0f | ||
|   | 217f7a7ea7 | ||
|   | 317d351423 | ||
|   | d27519c0ca | ||
|   | 255dc45dc9 | ||
|   | f4d8728df9 | ||
|   | 8611631f5e | ||
|   | 1e5ed4fa33 | ||
|   | 0daeab3b8d | ||
|   | bd27401311 | ||
|   | 14df44dd3f | ||
|   | 1272621ebc | ||
|   | 0e83482e47 | ||
|   | c0d929bed9 | ||
|   | 828a26286d | ||
|   | 082b0d822c | ||
|   | 651b4b9efa | ||
|   | ab1e54375f | ||
|   | 70e2db51e1 | ||
|   | 0145919a9e | ||
|   | 2236a247d9 | ||
|   | 7291f50e8d | ||
|   | bc5677a47b | ||
|   | 137ef36757 | ||
|   | 33a3753c3f | ||
|   | 9770899a4b | ||
|   | fe8eeb5641 | ||
|   | 8cd1f1f7f9 | ||
|   | b84876ba69 | ||
|   | 0f1ca2939a | ||
|   | 4882078469 | ||
|   | 991b120eee | ||
|   | f278d177f9 | ||
|   | 53b2ff4b04 | ||
|   | 0c89d71aee | ||
|   | b746bf7814 | ||
|   | f11969015a | ||
|   | f1b820e5fc | ||
|   | 7356ff0b18 | ||
|   | 30f7a2ff20 | ||
|   | f6b55fae79 | ||
|   | 8aa88f4d36 | ||
|   | ce7b565595 | ||
|   | 41fd08bb0d | ||
|   | d0a930cd44 | ||
|   | 9bb1854398 | ||
|   | f7400212fc | ||
|   | 6434b42481 | ||
|   | dd0b38b32f | ||
|   | 7816db8e8a | ||
|   | 9cc6ab3922 | ||
|   | 2c27e24bb4 | ||
|   | c382c550e7 | ||
|   | c663494c69 | ||
|   | 97f27ea585 | ||
|   | 379bfa5a36 | ||
|   | 235c0077b8 | ||
|   | c621546bd6 | ||
|   | aa330b8240 | ||
|   | e43606eb4d | ||
|   | 6a378a28b4 | ||
|   | 95368d9cb4 | ||
|   | 74f9c570ea | ||
|   | eed4a13b3b | ||
|   | 7e9f7659b3 | ||
|   | 4d396169c8 | ||
|   | 4cd950900b | ||
|   | 2b96c3f5ce | ||
|   | 63fad159e8 | ||
|   | e5f1480a38 | ||
|   | 020955ebc2 | ||
|   | 3733fa02ee | ||
|   | 7037e4a4b1 | ||
|   | 0e98f938c4 | ||
|   | 55d0c29f4a | ||
|   | 59997ecad5 | ||
|   | 6e2f0833ad | ||
|   | 25f626cc52 | ||
|   | ece891d6db | ||
|   | 702355da47 | ||
|   | c4fba310d2 | ||
|   | e9dd099870 | ||
|   | 070d89a561 | ||
|   | 28cc9dd331 | ||
|   | 7c1fecc94a | ||
|   | 7a9fab52be | ||
|   | 8cb8371011 | ||
|   | 875c55d86b | ||
|   | b85154f13f | ||
|   | 06047d9103 | ||
|   | 2362637e90 | ||
|   | edd02607e2 | ||
|   | 0211e420ed | ||
|   | 9a184e0bb1 | ||
|   | 168fb3a8d8 | ||
|   | 4c5307b456 | ||
|   | 626f9bd8c2 | ||
|   | a06b36dee0 | ||
|   | 18e1bee8d5 | ||
|   | 41f76801eb | ||
|   | 31a7bfc47f | ||
|   | 1b6d18fcb0 | ||
|   | 57c32b709d | ||
|   | 5f19822e37 | ||
|   | 9a0c9cd6e1 | ||
|   | 0ac8e1d80b | ||
|   | 744e55ec74 | ||
|   | 74ba4d7950 | ||
|   | fa96436661 | ||
|   | d15b8273d6 | ||
|   | 0a5cf3a928 | ||
|   | 6173e38fdc | ||
|   | 34cd99d1d9 | ||
|   | 0922a0fc3f | ||
|   | dd53b356ff | ||
|   | f1db505778 | ||
|   | 662727ca3e | ||
|   | bdec6f2b20 | ||
|   | c86c294f55 | ||
|   | a9a03b9708 | ||
|   | f4e8c406bb | ||
|   | 12bfcb501c | ||
|   | 0fc1782dd4 | ||
|   | 9274d31690 | ||
|   | 983a539503 | ||
|   | 94bb7fe5cb | ||
|   | b98e0aa09b | ||
|   | 49c6d7e32d | ||
|   | ee73fc361b | ||
|   | e84dbd28db | ||
|   | 02449d9aa5 | ||
|   | 2876329f16 | ||
|   | a1f455551f | 
							
								
								
									
										23
									
								
								.cvsignore
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								.cvsignore
									
									
									
									
									
								
							| @@ -1,17 +1,22 @@ | |||||||
| compile |  | ||||||
| config.log |  | ||||||
| Makefile | Makefile | ||||||
| libtool |  | ||||||
| Makefile.in | Makefile.in | ||||||
| aclocal.m4 | aclocal.m4 | ||||||
| aclocal.m4.bak | aclocal.m4.bak | ||||||
| configure |  | ||||||
| config.h |  | ||||||
| config.status |  | ||||||
| curl-config |  | ||||||
| autom4te.cache | autom4te.cache | ||||||
| depcomp | compile | ||||||
| config.guess | config.guess | ||||||
|  | curl_config.h | ||||||
|  | config.log | ||||||
|  | config.lt | ||||||
|  | config.status | ||||||
| config.sub | config.sub | ||||||
| ltmain.sh | configure | ||||||
|  | curl-config | ||||||
|  | depcomp | ||||||
| libcurl.pc | libcurl.pc | ||||||
|  | libtool | ||||||
|  | ltmain.sh | ||||||
|  | vc6curl.ncb | ||||||
|  | vc6curl.opt | ||||||
|  | vc6curl.sln | ||||||
|  | vc6curl.suo | ||||||
|   | |||||||
							
								
								
									
										87
									
								
								Android.mk
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										87
									
								
								Android.mk
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,87 @@ | |||||||
|  | # Google Android makefile for curl and libcurl | ||||||
|  | # | ||||||
|  | # Place the curl source (including this makefile) into external/curl/ in the | ||||||
|  | # Android source tree.  Then build them with 'make curl' or just 'make libcurl' | ||||||
|  | # from the Android root. Tested with Android 1.5 | ||||||
|  | # | ||||||
|  | # Note: you must first create a curl_config.h file by running configure in the | ||||||
|  | # Android environment. The only way I've found to do this is tricky. Perform a | ||||||
|  | # normal Android build with libcurl in the source tree, providing the target | ||||||
|  | # "showcommands" to make. The build will eventually fail (because curl_config.h | ||||||
|  | # doesn't exist yet), but the compiler commands used to build curl will be | ||||||
|  | # shown. Now, from the external/curl/ directory, run curl's normal configure | ||||||
|  | # command with flags that match what Android itself uses. This will mean | ||||||
|  | # putting the compiler directory into the PATH, putting the -I, -isystem and | ||||||
|  | # -D options into CPPFLAGS, putting the -m, -f, -O and -nostdlib options into | ||||||
|  | # CFLAGS, and putting the -Wl, -L and -l options into LIBS, along with the path | ||||||
|  | # to the files libgcc.a, crtbegin_dynamic.o, and ccrtend_android.o. Remember | ||||||
|  | # that the paths must be absolute since you will not be running configure from | ||||||
|  | # the same directory as the Android make.  The normal cross-compiler options | ||||||
|  | # must also be set. | ||||||
|  | # | ||||||
|  | # The end result will be a configure command that looks something like this | ||||||
|  | # (the environment variable A is set to the Android root path): | ||||||
|  | # | ||||||
|  | #  A=`realpath ../..` && \ | ||||||
|  | #  PATH="$A/prebuilt/linux-x86/toolchain/arm-eabi-X/bin:$PATH" \ | ||||||
|  | #  ./configure --host=arm-linux CC=arm-eabi-gcc \ | ||||||
|  | #  CPPFLAGS="-I $A/system/core/include ..." \ | ||||||
|  | #  CFLAGS="-fno-exceptions -Wno-multichar ..." \ | ||||||
|  | #  LIB="$A/prebuilt/linux-x86/toolchain/arm-eabi-X/lib/gcc/arm-eabi/X\ | ||||||
|  | #  /interwork/libgcc.a ..." \ | ||||||
|  | # | ||||||
|  | # Dan Fandrich | ||||||
|  | # September 2009 | ||||||
|  |  | ||||||
|  | LOCAL_PATH:= $(call my-dir) | ||||||
|  |  | ||||||
|  | common_CFLAGS := -Wpointer-arith -Wwrite-strings -Wunused -Winline -Wnested-externs -Wmissing-declarations -Wmissing-prototypes -Wno-long-long -Wfloat-equal -Wno-multichar -Wsign-compare -Wno-format-nonliteral -Wendif-labels -Wstrict-prototypes -Wdeclaration-after-statement -Wno-system-headers -DHAVE_CONFIG_H | ||||||
|  |  | ||||||
|  | ######################### | ||||||
|  | # Build the libcurl library | ||||||
|  |  | ||||||
|  | include $(CLEAR_VARS) | ||||||
|  | include $(LOCAL_PATH)/lib/Makefile.inc | ||||||
|  | CURL_HEADERS := \ | ||||||
|  | 	curlbuild.h \ | ||||||
|  | 	curl.h \ | ||||||
|  | 	curlrules.h \ | ||||||
|  | 	curlver.h \ | ||||||
|  | 	easy.h \ | ||||||
|  | 	mprintf.h \ | ||||||
|  | 	multi.h \ | ||||||
|  | 	stdcheaders.h \ | ||||||
|  | 	typecheck-gcc.h \ | ||||||
|  | 	types.h | ||||||
|  |  | ||||||
|  | LOCAL_SRC_FILES := $(addprefix lib/,$(CSOURCES)) | ||||||
|  | LOCAL_C_INCLUDES += $(LOCAL_PATH)/include/ | ||||||
|  | LOCAL_CFLAGS += $(common_CFLAGS) | ||||||
|  |  | ||||||
|  | LOCAL_COPY_HEADERS_TO := libcurl/curl | ||||||
|  | LOCAL_COPY_HEADERS := $(addprefix include/curl/,$(CURL_HEADERS)) | ||||||
|  |  | ||||||
|  | LOCAL_MODULE:= libcurl | ||||||
|  |  | ||||||
|  | include $(BUILD_STATIC_LIBRARY) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | ######################### | ||||||
|  | # Build the curl binary | ||||||
|  |  | ||||||
|  | include $(CLEAR_VARS) | ||||||
|  | include $(LOCAL_PATH)/src/Makefile.inc | ||||||
|  | LOCAL_SRC_FILES := $(addprefix src/,$(CURL_SOURCES)) | ||||||
|  |  | ||||||
|  | LOCAL_MODULE := curl | ||||||
|  | LOCAL_STATIC_LIBRARIES := libcurl | ||||||
|  | LOCAL_SYSTEM_SHARED_LIBRARIES := libc | ||||||
|  |  | ||||||
|  | LOCAL_C_INCLUDES += $(LOCAL_PATH)/include $(LOCAL_PATH)/lib | ||||||
|  |  | ||||||
|  | # This will also need to include $(CURLX_ONES) in order to correctly build | ||||||
|  | # a dynamic library | ||||||
|  | LOCAL_CFLAGS += $(common_CFLAGS) | ||||||
|  |  | ||||||
|  | include $(BUILD_EXECUTABLE) | ||||||
|  |  | ||||||
							
								
								
									
										2
									
								
								CMake/CMakeConfigurableFile.in
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								CMake/CMakeConfigurableFile.in
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,2 @@ | |||||||
|  | @CMAKE_CONFIGURABLE_FILE_CONTENT@ | ||||||
|  |  | ||||||
							
								
								
									
										41
									
								
								CMake/CheckTypeSize.c.in
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								CMake/CheckTypeSize.c.in
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,41 @@ | |||||||
|  | #cmakedefine CHECK_TYPE_SIZE_TYPE @CHECK_TYPE_SIZE_TYPE@ | ||||||
|  | #ifdef CHECK_TYPE_SIZE_TYPE | ||||||
|  |  | ||||||
|  | @CHECK_TYPE_SIZE_PREINCLUDE@ | ||||||
|  | #ifdef HAVE_SYS_TYPES_H | ||||||
|  | #  include <sys/types.h> | ||||||
|  | #endif /* HAVE_SYS_TYPES_H */ | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #ifdef _WIN32 | ||||||
|  | #  include <winsock2.h> | ||||||
|  | #  include <ws2tcpip.h> | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #ifdef HAVE_STDINT_H | ||||||
|  | #  include <stdint.h> | ||||||
|  | #endif /* HAVE_STDINT_H */ | ||||||
|  |  | ||||||
|  | #ifdef HAVE_STDDEF_H | ||||||
|  | #  include <stddef.h> | ||||||
|  | #endif /* HAVE_STDDEF_H */ | ||||||
|  |  | ||||||
|  | @CHECK_TYPE_SIZE_PREMAIN@ | ||||||
|  |  | ||||||
|  | #ifdef __CLASSIC_C__ | ||||||
|  | int main(){ | ||||||
|  |   int ac; | ||||||
|  |   char*av[]; | ||||||
|  | #else | ||||||
|  | int main(int ac, char*av[]){ | ||||||
|  | #endif | ||||||
|  |   if(ac > 1000){return *av[0];} | ||||||
|  |   return sizeof(CHECK_TYPE_SIZE_TYPE); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | #else  /* CHECK_TYPE_SIZE_TYPE */ | ||||||
|  |  | ||||||
|  | #  error "CHECK_TYPE_SIZE_TYPE has to specify the type" | ||||||
|  |  | ||||||
|  | #endif /* CHECK_TYPE_SIZE_TYPE */ | ||||||
							
								
								
									
										56
									
								
								CMake/CheckTypeSize.cmake
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								CMake/CheckTypeSize.cmake
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,56 @@ | |||||||
|  | # - Check sizeof a type | ||||||
|  | #  CHECK_TYPE_SIZE(TYPE VARIABLE) | ||||||
|  | # Check if the type exists and determine size of type.  if the type | ||||||
|  | # exists, the size will be stored to the variable. | ||||||
|  | # | ||||||
|  | #  VARIABLE - variable to store size if the type exists. | ||||||
|  | #  HAVE_${VARIABLE} - does the variable exists or not | ||||||
|  |  | ||||||
|  | macro(CHECK_TYPE_SIZE TYPE VARIABLE) | ||||||
|  |   set(CMAKE_ALLOW_UNKNOWN_VARIABLE_READ_ACCESS 1) | ||||||
|  |   if(NOT DEFINED ${VARIABLE}) | ||||||
|  |     if("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$") | ||||||
|  |       set(CHECK_TYPE_SIZE_TYPE "${TYPE}") | ||||||
|  |       set(MACRO_CHECK_TYPE_SIZE_FLAGS  | ||||||
|  |         "${CMAKE_REQUIRED_FLAGS}") | ||||||
|  |       foreach(def HAVE_SYS_TYPES_H HAVE_STDINT_H HAVE_STDDEF_H) | ||||||
|  |         if("${def}") | ||||||
|  |           set(MACRO_CHECK_TYPE_SIZE_FLAGS  | ||||||
|  |             "${MACRO_CHECK_TYPE_SIZE_FLAGS} -D${def}") | ||||||
|  |         endif("${def}") | ||||||
|  |       endforeach(def) | ||||||
|  |       set(CHECK_TYPE_SIZE_PREMAIN) | ||||||
|  |       foreach(def ${CMAKE_EXTRA_INCLUDE_FILES}) | ||||||
|  |         set(CHECK_TYPE_SIZE_PREMAIN "${CHECK_TYPE_SIZE_PREMAIN}#include \"${def}\"\n") | ||||||
|  |       endforeach(def) | ||||||
|  |       configure_file( | ||||||
|  |         "${CMAKE_CURRENT_SOURCE_DIR}/CMake/CheckTypeSize.c.in" | ||||||
|  |         "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckTypeSize.c"  | ||||||
|  |         IMMEDIATE @ONLY) | ||||||
|  |       file(READ  | ||||||
|  |         "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckTypeSize.c" | ||||||
|  |         CHECK_TYPE_SIZE_FILE_CONTENT) | ||||||
|  |       message(STATUS "Check size of ${TYPE}") | ||||||
|  |       if(CMAKE_REQUIRED_LIBRARIES) | ||||||
|  |         set(CHECK_TYPE_SIZE_ADD_LIBRARIES  | ||||||
|  |           "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") | ||||||
|  |       endif(CMAKE_REQUIRED_LIBRARIES) | ||||||
|  |       try_run(${VARIABLE} HAVE_${VARIABLE} | ||||||
|  |         ${CMAKE_BINARY_DIR} | ||||||
|  |         "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckTypeSize.c" | ||||||
|  |         CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_TYPE_SIZE_FLAGS} | ||||||
|  |         "${CHECK_TYPE_SIZE_ADD_LIBRARIES}" | ||||||
|  |         OUTPUT_VARIABLE OUTPUT) | ||||||
|  |       if(HAVE_${VARIABLE}) | ||||||
|  |         message(STATUS "Check size of ${TYPE} - done") | ||||||
|  |         file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log  | ||||||
|  |           "Determining size of ${TYPE} passed with the following output:\n${OUTPUT}\n\n") | ||||||
|  |       else(HAVE_${VARIABLE}) | ||||||
|  |         message(STATUS "Check size of ${TYPE} - failed") | ||||||
|  |         file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log  | ||||||
|  |           "Determining size of ${TYPE} failed with the following output:\n${OUTPUT}\nCheckTypeSize.c:\n${CHECK_TYPE_SIZE_FILE_CONTENT}\n\n") | ||||||
|  |       endif(HAVE_${VARIABLE}) | ||||||
|  |     endif("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$") | ||||||
|  |   endif(NOT DEFINED ${VARIABLE}) | ||||||
|  |   set(CMAKE_ALLOW_UNKNOWN_VARIABLE_READ_ACCESS ) | ||||||
|  | endmacro(CHECK_TYPE_SIZE) | ||||||
							
								
								
									
										75
									
								
								CMake/CurlCheckCSourceCompiles.cmake
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										75
									
								
								CMake/CurlCheckCSourceCompiles.cmake
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,75 @@ | |||||||
|  | # - Check if the source code provided in the SOURCE argument compiles. | ||||||
|  | # CURL_CHECK_C_SOURCE_COMPILES(SOURCE VAR) | ||||||
|  | # - macro which checks if the source code compiles | ||||||
|  | #  SOURCE   - source code to try to compile | ||||||
|  | #  VAR      - variable to store whether the source code compiled | ||||||
|  | # | ||||||
|  | # The following variables may be set before calling this macro to | ||||||
|  | # modify the way the check is run: | ||||||
|  | # | ||||||
|  | #  CMAKE_REQUIRED_FLAGS = string of compile command line flags | ||||||
|  | #  CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) | ||||||
|  | #  CMAKE_REQUIRED_INCLUDES = list of include directories | ||||||
|  | #  CMAKE_REQUIRED_LIBRARIES = list of libraries to link | ||||||
|  |  | ||||||
|  | macro(CURL_CHECK_C_SOURCE_COMPILES SOURCE VAR) | ||||||
|  |   if("${VAR}" MATCHES "^${VAR}$" OR "${VAR}" MATCHES "UNKNOWN") | ||||||
|  |     set(message "${VAR}") | ||||||
|  |     # If the number of arguments is greater than 2 (SOURCE VAR) | ||||||
|  |     if(${ARGC} GREATER 2) | ||||||
|  |       # then add the third argument as a message | ||||||
|  |       set(message "${ARGV2} (${VAR})") | ||||||
|  |     endif(${ARGC} GREATER 2) | ||||||
|  |     set(MACRO_CHECK_FUNCTION_DEFINITIONS | ||||||
|  |       "-D${VAR} ${CMAKE_REQUIRED_FLAGS}") | ||||||
|  |     if(CMAKE_REQUIRED_LIBRARIES) | ||||||
|  |       set(CURL_CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES | ||||||
|  |         "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") | ||||||
|  |     else(CMAKE_REQUIRED_LIBRARIES) | ||||||
|  |       set(CURL_CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES) | ||||||
|  |     endif(CMAKE_REQUIRED_LIBRARIES) | ||||||
|  |     if(CMAKE_REQUIRED_INCLUDES) | ||||||
|  |       set(CURL_CHECK_C_SOURCE_COMPILES_ADD_INCLUDES | ||||||
|  |         "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") | ||||||
|  |     else(CMAKE_REQUIRED_INCLUDES) | ||||||
|  |       set(CURL_CHECK_C_SOURCE_COMPILES_ADD_INCLUDES) | ||||||
|  |     endif(CMAKE_REQUIRED_INCLUDES) | ||||||
|  |     set(src "") | ||||||
|  |     foreach(def ${EXTRA_DEFINES}) | ||||||
|  |       set(src "${src}#define ${def} 1\n") | ||||||
|  |     endforeach(def) | ||||||
|  |     foreach(inc ${HEADER_INCLUDES}) | ||||||
|  |       set(src "${src}#include <${inc}>\n") | ||||||
|  |     endforeach(inc) | ||||||
|  |  | ||||||
|  |     set(src "${src}\nint main() { ${SOURCE} ; return 0; }") | ||||||
|  |     set(CMAKE_CONFIGURABLE_FILE_CONTENT "${src}") | ||||||
|  |     configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMake/CMakeConfigurableFile.in | ||||||
|  |       "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c" | ||||||
|  |       IMMEDIATE) | ||||||
|  |     message(STATUS "Performing Test ${message}") | ||||||
|  |     try_compile(${VAR} | ||||||
|  |       ${CMAKE_BINARY_DIR} | ||||||
|  |       ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c | ||||||
|  |       COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} | ||||||
|  |       CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} | ||||||
|  |       "${CURL_CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES}" | ||||||
|  |       "${CURL_CHECK_C_SOURCE_COMPILES_ADD_INCLUDES}" | ||||||
|  |       OUTPUT_VARIABLE OUTPUT) | ||||||
|  |     if(${VAR}) | ||||||
|  |       set(${VAR} 1 CACHE INTERNAL "Test ${message}") | ||||||
|  |       message(STATUS "Performing Test ${message} - Success") | ||||||
|  |       file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log | ||||||
|  |         "Performing C SOURCE FILE Test ${message} succeded with the following output:\n" | ||||||
|  |         "${OUTPUT}\n" | ||||||
|  |         "Source file was:\n${src}\n") | ||||||
|  |     else(${VAR}) | ||||||
|  |       message(STATUS "Performing Test ${message} - Failed") | ||||||
|  |       set(${VAR} "" CACHE INTERNAL "Test ${message}") | ||||||
|  |       file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log | ||||||
|  |         "Performing C SOURCE FILE Test ${message} failed with the following output:\n" | ||||||
|  |         "${OUTPUT}\n" | ||||||
|  |         "Source file was:\n${src}\n") | ||||||
|  |     endif(${VAR}) | ||||||
|  |   endif("${VAR}" MATCHES "^${VAR}$" OR "${VAR}" MATCHES "UNKNOWN") | ||||||
|  | endmacro(CURL_CHECK_C_SOURCE_COMPILES) | ||||||
							
								
								
									
										83
									
								
								CMake/CurlCheckCSourceRuns.cmake
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										83
									
								
								CMake/CurlCheckCSourceRuns.cmake
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,83 @@ | |||||||
|  | # - Check if the source code provided in the SOURCE argument compiles and runs. | ||||||
|  | # CURL_CHECK_C_SOURCE_RUNS(SOURCE VAR) | ||||||
|  | # - macro which checks if the source code runs | ||||||
|  | #  SOURCE   - source code to try to compile | ||||||
|  | #  VAR - variable to store size if the type exists. | ||||||
|  | # | ||||||
|  | # The following variables may be set before calling this macro to | ||||||
|  | # modify the way the check is run: | ||||||
|  | # | ||||||
|  | #  CMAKE_REQUIRED_FLAGS = string of compile command line flags | ||||||
|  | #  CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) | ||||||
|  | #  CMAKE_REQUIRED_INCLUDES = list of include directories | ||||||
|  | #  CMAKE_REQUIRED_LIBRARIES = list of libraries to link | ||||||
|  |  | ||||||
|  | macro(CURL_CHECK_C_SOURCE_RUNS SOURCE VAR) | ||||||
|  |   if("${VAR}" MATCHES "^${VAR}$" OR "${VAR}" MATCHES "UNKNOWN") | ||||||
|  |     set(message "${VAR}") | ||||||
|  |     # If the number of arguments is greater than 2 (SOURCE VAR) | ||||||
|  |     if(${ARGC} GREATER 2) | ||||||
|  |       # then add the third argument as a message | ||||||
|  |       set(message "${ARGV2} (${VAR})") | ||||||
|  |     endif(${ARGC} GREATER 2) | ||||||
|  |     set(MACRO_CHECK_FUNCTION_DEFINITIONS | ||||||
|  |       "-D${VAR} ${CMAKE_REQUIRED_FLAGS}") | ||||||
|  |     if(CMAKE_REQUIRED_LIBRARIES) | ||||||
|  |       set(CURL_CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES | ||||||
|  |         "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") | ||||||
|  |     else(CMAKE_REQUIRED_LIBRARIES) | ||||||
|  |       set(CURL_CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES) | ||||||
|  |     endif(CMAKE_REQUIRED_LIBRARIES) | ||||||
|  |     if(CMAKE_REQUIRED_INCLUDES) | ||||||
|  |       set(CURL_CHECK_C_SOURCE_COMPILES_ADD_INCLUDES | ||||||
|  |         "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") | ||||||
|  |     else(CMAKE_REQUIRED_INCLUDES) | ||||||
|  |       set(CURL_CHECK_C_SOURCE_COMPILES_ADD_INCLUDES) | ||||||
|  |     endif(CMAKE_REQUIRED_INCLUDES) | ||||||
|  |     set(src "") | ||||||
|  |     foreach(def ${EXTRA_DEFINES}) | ||||||
|  |       set(src "${src}#define ${def} 1\n") | ||||||
|  |     endforeach(def) | ||||||
|  |     foreach(inc ${HEADER_INCLUDES}) | ||||||
|  |       set(src "${src}#include <${inc}>\n") | ||||||
|  |     endforeach(inc) | ||||||
|  |  | ||||||
|  |     set(src "${src}\nint main() { ${SOURCE} ; return 0; }") | ||||||
|  |     set(CMAKE_CONFIGURABLE_FILE_CONTENT "${src}") | ||||||
|  |     configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMake/CMakeConfigurableFile.in | ||||||
|  |       "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c" | ||||||
|  |       IMMEDIATE) | ||||||
|  |     message(STATUS "Performing Test ${message}") | ||||||
|  |     try_run(${VAR} ${VAR}_COMPILED | ||||||
|  |       ${CMAKE_BINARY_DIR} | ||||||
|  |       ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c | ||||||
|  |       COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} | ||||||
|  |       CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} | ||||||
|  |       "${CURL_CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES}" | ||||||
|  |       "${CURL_CHECK_C_SOURCE_COMPILES_ADD_INCLUDES}" | ||||||
|  |       OUTPUT_VARIABLE OUTPUT) | ||||||
|  |     # if it did not compile make the return value fail code of 1 | ||||||
|  |     if(NOT ${VAR}_COMPILED) | ||||||
|  |       set(${VAR} 1) | ||||||
|  |     endif(NOT ${VAR}_COMPILED) | ||||||
|  |     # if the return value was 0 then it worked | ||||||
|  |     set(result_var ${${VAR}}) | ||||||
|  |     if("${result_var}" EQUAL 0) | ||||||
|  |       set(${VAR} 1 CACHE INTERNAL "Test ${message}") | ||||||
|  |       message(STATUS "Performing Test ${message} - Success") | ||||||
|  |       file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log | ||||||
|  |         "Performing C SOURCE FILE Test ${message} succeded with the following output:\n" | ||||||
|  |         "${OUTPUT}\n" | ||||||
|  |         "Return value: ${${VAR}}\n" | ||||||
|  |         "Source file was:\n${src}\n") | ||||||
|  |     else("${result_var}" EQUAL 0) | ||||||
|  |       message(STATUS "Performing Test ${message} - Failed") | ||||||
|  |       set(${VAR} "" CACHE INTERNAL "Test ${message}") | ||||||
|  |       file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log | ||||||
|  |         "Performing C SOURCE FILE Test ${message} failed with the following output:\n" | ||||||
|  |         "${OUTPUT}\n" | ||||||
|  |         "Return value: ${result_var}\n" | ||||||
|  |         "Source file was:\n${src}\n") | ||||||
|  |     endif("${result_var}" EQUAL 0) | ||||||
|  |   endif("${VAR}" MATCHES "^${VAR}$" OR "${VAR}" MATCHES "UNKNOWN") | ||||||
|  | endmacro(CURL_CHECK_C_SOURCE_RUNS) | ||||||
							
								
								
									
										690
									
								
								CMake/CurlTests.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										690
									
								
								CMake/CurlTests.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,690 @@ | |||||||
|  | #ifdef TIME_WITH_SYS_TIME | ||||||
|  | /* Time with sys/time test */ | ||||||
|  |   | ||||||
|  | #include <sys/types.h> | ||||||
|  | #include <sys/time.h> | ||||||
|  | #include <time.h> | ||||||
|  |  | ||||||
|  | int | ||||||
|  | main () | ||||||
|  | { | ||||||
|  | if ((struct tm *) 0) | ||||||
|  | return 0; | ||||||
|  |   ; | ||||||
|  |   return 0; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #ifdef HAVE_FCNTL_O_NONBLOCK | ||||||
|  |  | ||||||
|  | /* headers for FCNTL_O_NONBLOCK test */ | ||||||
|  | #include <sys/types.h> | ||||||
|  | #include <unistd.h> | ||||||
|  | #include <fcntl.h> | ||||||
|  | /* */ | ||||||
|  | #if defined(sun) || defined(__sun__) || \ | ||||||
|  |     defined(__SUNPRO_C) || defined(__SUNPRO_CC) | ||||||
|  | # if defined(__SVR4) || defined(__srv4__) | ||||||
|  | #  define PLATFORM_SOLARIS | ||||||
|  | # else | ||||||
|  | #  define PLATFORM_SUNOS4 | ||||||
|  | # endif | ||||||
|  | #endif | ||||||
|  | #if (defined(_AIX) || defined(__xlC__)) && !defined(_AIX41) | ||||||
|  | # define PLATFORM_AIX_V3 | ||||||
|  | #endif | ||||||
|  | /* */ | ||||||
|  | #if defined(PLATFORM_SUNOS4) || defined(PLATFORM_AIX_V3) || defined(__BEOS__) | ||||||
|  | #error "O_NONBLOCK does not work on this platform" | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | int | ||||||
|  | main () | ||||||
|  | { | ||||||
|  |       /* O_NONBLOCK source test */ | ||||||
|  |       int flags = 0; | ||||||
|  |       if(0 != fcntl(0, F_SETFL, flags | O_NONBLOCK)) | ||||||
|  |           return 1; | ||||||
|  |       return 0; | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #ifdef HAVE_GETHOSTBYADDR_R_5 | ||||||
|  | #include <sys/types.h> | ||||||
|  | #include <netdb.h> | ||||||
|  | int | ||||||
|  | main () | ||||||
|  | { | ||||||
|  |  | ||||||
|  | char * address; | ||||||
|  | int length; | ||||||
|  | int type; | ||||||
|  | struct hostent h; | ||||||
|  | struct hostent_data hdata; | ||||||
|  | int rc; | ||||||
|  | #ifndef gethostbyaddr_r | ||||||
|  |   (void)gethostbyaddr_r; | ||||||
|  | #endif | ||||||
|  | rc = gethostbyaddr_r(address, length, type, &h, &hdata); | ||||||
|  |   ; | ||||||
|  |   return 0; | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  | #ifdef HAVE_GETHOSTBYADDR_R_5_REENTRANT | ||||||
|  | #define _REENTRANT | ||||||
|  | #include <sys/types.h> | ||||||
|  | #include <netdb.h> | ||||||
|  | int | ||||||
|  | main () | ||||||
|  | { | ||||||
|  |  | ||||||
|  | char * address; | ||||||
|  | int length;q | ||||||
|  | int type; | ||||||
|  | struct hostent h; | ||||||
|  | struct hostent_data hdata; | ||||||
|  | int rc; | ||||||
|  | #ifndef gethostbyaddr_r | ||||||
|  |   (void)gethostbyaddr_r; | ||||||
|  | #endif | ||||||
|  | rc = gethostbyaddr_r(address, length, type, &h, &hdata); | ||||||
|  |   ; | ||||||
|  |   return 0; | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  | #ifdef HAVE_GETHOSTBYADDR_R_7 | ||||||
|  | #include <sys/types.h> | ||||||
|  | #include <netdb.h> | ||||||
|  | int | ||||||
|  | main () | ||||||
|  | { | ||||||
|  |  | ||||||
|  | char * address; | ||||||
|  | int length; | ||||||
|  | int type; | ||||||
|  | struct hostent h; | ||||||
|  | char buffer[8192]; | ||||||
|  | int h_errnop; | ||||||
|  | struct hostent * hp; | ||||||
|  |  | ||||||
|  | #ifndef gethostbyaddr_r | ||||||
|  |   (void)gethostbyaddr_r; | ||||||
|  | #endif | ||||||
|  | hp = gethostbyaddr_r(address, length, type, &h, | ||||||
|  |                      buffer, 8192, &h_errnop); | ||||||
|  |   ; | ||||||
|  |   return 0; | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  | #ifdef HAVE_GETHOSTBYADDR_R_7_REENTRANT | ||||||
|  | #define _REENTRANT | ||||||
|  | #include <sys/types.h> | ||||||
|  | #include <netdb.h> | ||||||
|  | int | ||||||
|  | main () | ||||||
|  | { | ||||||
|  |  | ||||||
|  | char * address; | ||||||
|  | int length; | ||||||
|  | int type; | ||||||
|  | struct hostent h; | ||||||
|  | char buffer[8192]; | ||||||
|  | int h_errnop; | ||||||
|  | struct hostent * hp; | ||||||
|  |  | ||||||
|  | #ifndef gethostbyaddr_r | ||||||
|  |   (void)gethostbyaddr_r; | ||||||
|  | #endif | ||||||
|  | hp = gethostbyaddr_r(address, length, type, &h, | ||||||
|  |                      buffer, 8192, &h_errnop); | ||||||
|  |   ; | ||||||
|  |   return 0; | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  | #ifdef HAVE_GETHOSTBYADDR_R_8 | ||||||
|  | #include <sys/types.h> | ||||||
|  | #include <netdb.h> | ||||||
|  | int | ||||||
|  | main () | ||||||
|  | { | ||||||
|  |  | ||||||
|  | char * address; | ||||||
|  | int length; | ||||||
|  | int type; | ||||||
|  | struct hostent h; | ||||||
|  | char buffer[8192]; | ||||||
|  | int h_errnop; | ||||||
|  | struct hostent * hp; | ||||||
|  | int rc; | ||||||
|  |  | ||||||
|  | #ifndef gethostbyaddr_r | ||||||
|  |   (void)gethostbyaddr_r; | ||||||
|  | #endif | ||||||
|  | rc = gethostbyaddr_r(address, length, type, &h, | ||||||
|  |                      buffer, 8192, &hp, &h_errnop); | ||||||
|  |   ; | ||||||
|  |   return 0; | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  | #ifdef HAVE_GETHOSTBYADDR_R_8_REENTRANT | ||||||
|  | #define _REENTRANT | ||||||
|  | #include <sys/types.h> | ||||||
|  | #include <netdb.h> | ||||||
|  | int | ||||||
|  | main () | ||||||
|  | { | ||||||
|  |  | ||||||
|  | char * address; | ||||||
|  | int length; | ||||||
|  | int type; | ||||||
|  | struct hostent h; | ||||||
|  | char buffer[8192]; | ||||||
|  | int h_errnop; | ||||||
|  | struct hostent * hp; | ||||||
|  | int rc; | ||||||
|  |  | ||||||
|  | #ifndef gethostbyaddr_r | ||||||
|  |   (void)gethostbyaddr_r; | ||||||
|  | #endif | ||||||
|  | rc = gethostbyaddr_r(address, length, type, &h, | ||||||
|  |                      buffer, 8192, &hp, &h_errnop); | ||||||
|  |   ; | ||||||
|  |   return 0; | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  | #ifdef HAVE_GETHOSTBYNAME_R_3 | ||||||
|  | #include <string.h> | ||||||
|  | #include <sys/types.h> | ||||||
|  | #include <netdb.h> | ||||||
|  | #undef NULL | ||||||
|  | #define NULL (void *)0 | ||||||
|  |  | ||||||
|  | int | ||||||
|  | main () | ||||||
|  | { | ||||||
|  |  | ||||||
|  | struct hostent_data data; | ||||||
|  | #ifndef gethostbyname_r | ||||||
|  |   (void)gethostbyname_r; | ||||||
|  | #endif | ||||||
|  | gethostbyname_r(NULL, NULL, NULL); | ||||||
|  |   ; | ||||||
|  |   return 0; | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  | #ifdef HAVE_GETHOSTBYNAME_R_3_REENTRANT | ||||||
|  | #define _REENTRANT | ||||||
|  | #include <string.h> | ||||||
|  | #include <sys/types.h> | ||||||
|  | #include <netdb.h> | ||||||
|  | #undef NULL | ||||||
|  | #define NULL (void *)0 | ||||||
|  |  | ||||||
|  | int | ||||||
|  | main () | ||||||
|  | { | ||||||
|  |  | ||||||
|  | struct hostent_data data; | ||||||
|  | #ifndef gethostbyname_r | ||||||
|  |   (void)gethostbyname_r; | ||||||
|  | #endif | ||||||
|  | gethostbyname_r(NULL, NULL, NULL); | ||||||
|  |   ; | ||||||
|  |   return 0; | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  | #ifdef HAVE_GETHOSTBYNAME_R_5 | ||||||
|  | #include <sys/types.h> | ||||||
|  | #include <netinet/in.h> | ||||||
|  | #include <netdb.h> | ||||||
|  | #undef NULL | ||||||
|  | #define NULL (void *)0 | ||||||
|  |  | ||||||
|  | int | ||||||
|  | main () | ||||||
|  | { | ||||||
|  | #ifndef gethostbyname_r | ||||||
|  |   (void)gethostbyname_r; | ||||||
|  | #endif | ||||||
|  | gethostbyname_r(NULL, NULL, NULL, 0, NULL); | ||||||
|  |   ; | ||||||
|  |   return 0; | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  | #ifdef HAVE_GETHOSTBYNAME_R_5_REENTRANT | ||||||
|  | #define _REENTRANT | ||||||
|  | #include <sys/types.h> | ||||||
|  | #include <netdb.h> | ||||||
|  | #undef NULL | ||||||
|  | #define NULL (void *)0 | ||||||
|  |  | ||||||
|  | int | ||||||
|  | main () | ||||||
|  | { | ||||||
|  |  | ||||||
|  | #ifndef gethostbyname_r | ||||||
|  |   (void)gethostbyname_r; | ||||||
|  | #endif | ||||||
|  | gethostbyname_r(NULL, NULL, NULL, 0, NULL); | ||||||
|  |   ; | ||||||
|  |   return 0; | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  | #ifdef HAVE_GETHOSTBYNAME_R_6 | ||||||
|  | #include <sys/types.h> | ||||||
|  | #include <netdb.h> | ||||||
|  | #undef NULL | ||||||
|  | #define NULL (void *)0 | ||||||
|  |  | ||||||
|  | int | ||||||
|  | main () | ||||||
|  | { | ||||||
|  |  | ||||||
|  | #ifndef gethostbyname_r | ||||||
|  |   (void)gethostbyname_r; | ||||||
|  | #endif | ||||||
|  | gethostbyname_r(NULL, NULL, NULL, 0, NULL, NULL); | ||||||
|  |   ; | ||||||
|  |   return 0; | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  | #ifdef HAVE_GETHOSTBYNAME_R_6_REENTRANT | ||||||
|  | #define _REENTRANT | ||||||
|  | #include <sys/types.h> | ||||||
|  | #include <netdb.h> | ||||||
|  | #undef NULL | ||||||
|  | #define NULL (void *)0 | ||||||
|  |  | ||||||
|  | int | ||||||
|  | main () | ||||||
|  | { | ||||||
|  |  | ||||||
|  | #ifndef gethostbyname_r | ||||||
|  |   (void)gethostbyname_r; | ||||||
|  | #endif | ||||||
|  | gethostbyname_r(NULL, NULL, NULL, 0, NULL, NULL); | ||||||
|  |   ; | ||||||
|  |   return 0; | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  | #ifdef HAVE_SOCKLEN_T | ||||||
|  | #ifdef _WIN32 | ||||||
|  | #include <ws2tcpip.h> | ||||||
|  | #else | ||||||
|  | #include <sys/types.h> | ||||||
|  | #include <sys/socket.h> | ||||||
|  | #endif | ||||||
|  | int | ||||||
|  | main () | ||||||
|  | { | ||||||
|  | if ((socklen_t *) 0) | ||||||
|  |   return 0; | ||||||
|  | if (sizeof (socklen_t)) | ||||||
|  |   return 0; | ||||||
|  |   ; | ||||||
|  |   return 0; | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  | #ifdef HAVE_IN_ADDR_T | ||||||
|  | #include <sys/types.h> | ||||||
|  | #include <sys/socket.h> | ||||||
|  | #include <arpa/inet.h> | ||||||
|  |  | ||||||
|  | int | ||||||
|  | main () | ||||||
|  | { | ||||||
|  | if ((in_addr_t *) 0) | ||||||
|  |   return 0; | ||||||
|  | if (sizeof (in_addr_t)) | ||||||
|  |   return 0; | ||||||
|  |   ; | ||||||
|  |   return 0; | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #ifdef HAVE_BOOL_T | ||||||
|  | #ifdef HAVE_SYS_TYPES_H | ||||||
|  | #include <sys/types.h> | ||||||
|  | #endif | ||||||
|  | #ifdef HAVE_STDBOOL_H | ||||||
|  | #include <stdbool.h> | ||||||
|  | #endif | ||||||
|  | int | ||||||
|  | main () | ||||||
|  | { | ||||||
|  | if (sizeof (bool *) ) | ||||||
|  |   return 0; | ||||||
|  |   ; | ||||||
|  |   return 0; | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #ifdef STDC_HEADERS | ||||||
|  | #include <stdlib.h> | ||||||
|  | #include <stdarg.h> | ||||||
|  | #include <string.h> | ||||||
|  | #include <float.h> | ||||||
|  | int main() { return 0; } | ||||||
|  | #endif | ||||||
|  | #ifdef RETSIGTYPE_TEST | ||||||
|  | #include <sys/types.h> | ||||||
|  | #include <signal.h> | ||||||
|  | #ifdef signal | ||||||
|  | # undef signal | ||||||
|  | #endif | ||||||
|  | #ifdef __cplusplus | ||||||
|  | extern "C" void (*signal (int, void (*)(int)))(int); | ||||||
|  | #else | ||||||
|  | void (*signal ()) (); | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | int | ||||||
|  | main () | ||||||
|  | { | ||||||
|  |   return 0; | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  | #ifdef HAVE_INET_NTOA_R_DECL | ||||||
|  | #include <arpa/inet.h> | ||||||
|  |  | ||||||
|  | typedef void (*func_type)(); | ||||||
|  |  | ||||||
|  | int main() | ||||||
|  | { | ||||||
|  | #ifndef inet_ntoa_r | ||||||
|  |   func_type func; | ||||||
|  |   func = (func_type)inet_ntoa_r; | ||||||
|  | #endif | ||||||
|  |   return 0; | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  | #ifdef HAVE_INET_NTOA_R_DECL_REENTRANT | ||||||
|  | #define _REENTRANT | ||||||
|  | #include <arpa/inet.h> | ||||||
|  |  | ||||||
|  | typedef void (*func_type)(); | ||||||
|  |  | ||||||
|  | int main() | ||||||
|  | { | ||||||
|  | #ifndef inet_ntoa_r | ||||||
|  |   func_type func; | ||||||
|  |   func = (func_type)&inet_ntoa_r; | ||||||
|  | #endif | ||||||
|  |   return 0; | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  | #ifdef HAVE_GETADDRINFO | ||||||
|  | #include <netdb.h> | ||||||
|  | #include <sys/types.h> | ||||||
|  | #include <sys/socket.h> | ||||||
|  |  | ||||||
|  | int main(void) { | ||||||
|  |     struct addrinfo hints, *ai; | ||||||
|  |     int error; | ||||||
|  |  | ||||||
|  |     memset(&hints, 0, sizeof(hints)); | ||||||
|  |     hints.ai_family = AF_UNSPEC; | ||||||
|  |     hints.ai_socktype = SOCK_STREAM; | ||||||
|  | #ifndef getaddrinfo | ||||||
|  |     (void)getaddrinfo; | ||||||
|  | #endif | ||||||
|  |     error = getaddrinfo("127.0.0.1", "8080", &hints, &ai); | ||||||
|  |     if (error) { | ||||||
|  |         return 1; | ||||||
|  |     } | ||||||
|  |     return 0; | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  | #ifdef HAVE_FILE_OFFSET_BITS | ||||||
|  | #ifdef _FILE_OFFSET_BITS | ||||||
|  | #undef _FILE_OFFSET_BITS | ||||||
|  | #endif | ||||||
|  | #define _FILE_OFFSET_BITS 64 | ||||||
|  | #include <sys/types.h> | ||||||
|  |  /* Check that off_t can represent 2**63 - 1 correctly. | ||||||
|  |     We can't simply define LARGE_OFF_T to be 9223372036854775807, | ||||||
|  |     since some C++ compilers masquerading as C compilers | ||||||
|  |     incorrectly reject 9223372036854775807.  */ | ||||||
|  | #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) | ||||||
|  |   int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 | ||||||
|  |                        && LARGE_OFF_T % 2147483647 == 1) | ||||||
|  |                       ? 1 : -1]; | ||||||
|  | int main () { ; return 0; } | ||||||
|  | #endif | ||||||
|  | #ifdef HAVE_IOCTLSOCKET | ||||||
|  | /* includes start */ | ||||||
|  | #ifdef HAVE_WINDOWS_H | ||||||
|  | #  ifndef WIN32_LEAN_AND_MEAN | ||||||
|  | #    define WIN32_LEAN_AND_MEAN | ||||||
|  | #  endif | ||||||
|  | #  include <windows.h> | ||||||
|  | #  ifdef HAVE_WINSOCK2_H | ||||||
|  | #    include <winsock2.h> | ||||||
|  | #  else | ||||||
|  | #    ifdef HAVE_WINSOCK_H | ||||||
|  | #      include <winsock.h> | ||||||
|  | #    endif | ||||||
|  | #  endif | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | int | ||||||
|  | main () | ||||||
|  | { | ||||||
|  |  | ||||||
|  | /* ioctlsocket source code */ | ||||||
|  |  int socket; | ||||||
|  |  unsigned long flags = ioctlsocket(socket, FIONBIO, &flags); | ||||||
|  |  | ||||||
|  |   ; | ||||||
|  |   return 0; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | #endif | ||||||
|  | #ifdef HAVE_IOCTLSOCKET_CAMEL | ||||||
|  | /* includes start */ | ||||||
|  | #ifdef HAVE_WINDOWS_H | ||||||
|  | #  ifndef WIN32_LEAN_AND_MEAN | ||||||
|  | #    define WIN32_LEAN_AND_MEAN | ||||||
|  | #  endif | ||||||
|  | #  include <windows.h> | ||||||
|  | #  ifdef HAVE_WINSOCK2_H | ||||||
|  | #    include <winsock2.h> | ||||||
|  | #  else | ||||||
|  | #    ifdef HAVE_WINSOCK_H | ||||||
|  | #      include <winsock.h> | ||||||
|  | #    endif | ||||||
|  | #  endif | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | int | ||||||
|  | main () | ||||||
|  | { | ||||||
|  |  | ||||||
|  | /* IoctlSocket source code */ | ||||||
|  |     if(0 != IoctlSocket(0, 0, 0)) | ||||||
|  | 	return 1; | ||||||
|  |   ; | ||||||
|  |   return 0; | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  | #ifdef HAVE_IOCTLSOCKET_CAMEL_FIONBIO | ||||||
|  | /* includes start */ | ||||||
|  | #ifdef HAVE_WINDOWS_H | ||||||
|  | #  ifndef WIN32_LEAN_AND_MEAN | ||||||
|  | #    define WIN32_LEAN_AND_MEAN | ||||||
|  | #  endif | ||||||
|  | #  include <windows.h> | ||||||
|  | #  ifdef HAVE_WINSOCK2_H | ||||||
|  | #    include <winsock2.h> | ||||||
|  | #  else | ||||||
|  | #    ifdef HAVE_WINSOCK_H | ||||||
|  | #      include <winsock.h> | ||||||
|  | #    endif | ||||||
|  | #  endif | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | int | ||||||
|  | main () | ||||||
|  | { | ||||||
|  |  | ||||||
|  | /* IoctlSocket source code */ | ||||||
|  |         long flags = 0; | ||||||
|  |         if(0 != ioctlsocket(0, FIONBIO, &flags)) | ||||||
|  |           return 1; | ||||||
|  |   ; | ||||||
|  |   return 0; | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  | #ifdef HAVE_IOCTLSOCKET_FIONBIO | ||||||
|  | /* includes start */ | ||||||
|  | #ifdef HAVE_WINDOWS_H | ||||||
|  | #  ifndef WIN32_LEAN_AND_MEAN | ||||||
|  | #    define WIN32_LEAN_AND_MEAN | ||||||
|  | #  endif | ||||||
|  | #  include <windows.h> | ||||||
|  | #  ifdef HAVE_WINSOCK2_H | ||||||
|  | #    include <winsock2.h> | ||||||
|  | #  else | ||||||
|  | #    ifdef HAVE_WINSOCK_H | ||||||
|  | #      include <winsock.h> | ||||||
|  | #    endif | ||||||
|  | #  endif | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | int | ||||||
|  | main () | ||||||
|  | { | ||||||
|  |  | ||||||
|  |         int flags = 0; | ||||||
|  |         if(0 != ioctlsocket(0, FIONBIO, &flags)) | ||||||
|  |           return 1; | ||||||
|  |  | ||||||
|  |   ; | ||||||
|  |   return 0; | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  | #ifdef HAVE_IOCTL_FIONBIO | ||||||
|  | /* headers for FIONBIO test */ | ||||||
|  | /* includes start */ | ||||||
|  | #ifdef HAVE_SYS_TYPES_H | ||||||
|  | #  include <sys/types.h> | ||||||
|  | #endif | ||||||
|  | #ifdef HAVE_UNISTD_H | ||||||
|  | #  include <unistd.h> | ||||||
|  | #endif | ||||||
|  | #ifdef HAVE_SYS_SOCKET_H | ||||||
|  | #  include <sys/socket.h> | ||||||
|  | #endif | ||||||
|  | #ifdef HAVE_SYS_IOCTL_H | ||||||
|  | #  include <sys/ioctl.h> | ||||||
|  | #endif | ||||||
|  | #ifdef HAVE_STROPTS_H | ||||||
|  | #  include <stropts.h> | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | int | ||||||
|  | main () | ||||||
|  | { | ||||||
|  |  | ||||||
|  |         int flags = 0; | ||||||
|  |         if(0 != ioctl(0, FIONBIO, &flags)) | ||||||
|  |           return 1; | ||||||
|  |  | ||||||
|  |   ; | ||||||
|  |   return 0; | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  | #ifdef HAVE_IOCTL_SIOCGIFADDR | ||||||
|  | /* headers for FIONBIO test */ | ||||||
|  | /* includes start */ | ||||||
|  | #ifdef HAVE_SYS_TYPES_H | ||||||
|  | #  include <sys/types.h> | ||||||
|  | #endif | ||||||
|  | #ifdef HAVE_UNISTD_H | ||||||
|  | #  include <unistd.h> | ||||||
|  | #endif | ||||||
|  | #ifdef HAVE_SYS_SOCKET_H | ||||||
|  | #  include <sys/socket.h> | ||||||
|  | #endif | ||||||
|  | #ifdef HAVE_SYS_IOCTL_H | ||||||
|  | #  include <sys/ioctl.h> | ||||||
|  | #endif | ||||||
|  | #ifdef HAVE_STROPTS_H | ||||||
|  | #  include <stropts.h> | ||||||
|  | #endif | ||||||
|  | #include <net/if.h> | ||||||
|  |  | ||||||
|  | int | ||||||
|  | main () | ||||||
|  | { | ||||||
|  |         struct ifreq ifr; | ||||||
|  |         if(0 != ioctl(0, SIOCGIFADDR, &ifr)) | ||||||
|  |           return 1; | ||||||
|  |  | ||||||
|  |   ; | ||||||
|  |   return 0; | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  | #ifdef HAVE_SETSOCKOPT_SO_NONBLOCK | ||||||
|  | /* includes start */ | ||||||
|  | #ifdef HAVE_WINDOWS_H | ||||||
|  | #  ifndef WIN32_LEAN_AND_MEAN | ||||||
|  | #    define WIN32_LEAN_AND_MEAN | ||||||
|  | #  endif | ||||||
|  | #  include <windows.h> | ||||||
|  | #  ifdef HAVE_WINSOCK2_H | ||||||
|  | #    include <winsock2.h> | ||||||
|  | #  else | ||||||
|  | #    ifdef HAVE_WINSOCK_H | ||||||
|  | #      include <winsock.h> | ||||||
|  | #    endif | ||||||
|  | #  endif | ||||||
|  | #endif | ||||||
|  | /* includes start */ | ||||||
|  | #ifdef HAVE_SYS_TYPES_H | ||||||
|  | #  include <sys/types.h> | ||||||
|  | #endif | ||||||
|  | #ifdef HAVE_SYS_SOCKET_H | ||||||
|  | #  include <sys/socket.h> | ||||||
|  | #endif | ||||||
|  | /* includes end */ | ||||||
|  |  | ||||||
|  | int | ||||||
|  | main () | ||||||
|  | { | ||||||
|  |         if(0 != setsockopt(0, SOL_SOCKET, SO_NONBLOCK, 0, 0)) | ||||||
|  |           return 1; | ||||||
|  |   ; | ||||||
|  |   return 0; | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  | #ifdef HAVE_GLIBC_STRERROR_R | ||||||
|  | #include <string.h> | ||||||
|  | #include <errno.h> | ||||||
|  | int | ||||||
|  | main () { | ||||||
|  |   char buffer[1024]; /* big enough to play with */ | ||||||
|  |   char *string = | ||||||
|  |     strerror_r(EACCES, buffer, sizeof(buffer)); | ||||||
|  |     /* this should've returned a string */ | ||||||
|  |     if(!string || !string[0]) | ||||||
|  |       return 99; | ||||||
|  |     return 0; | ||||||
|  | } | ||||||
|  | #endif | ||||||
|  | #ifdef HAVE_POSIX_STRERROR_R | ||||||
|  | #include <string.h> | ||||||
|  | #include <errno.h> | ||||||
|  | int | ||||||
|  | main () { | ||||||
|  |   char buffer[1024]; /* big enough to play with */ | ||||||
|  |   int error = | ||||||
|  |     strerror_r(EACCES, buffer, sizeof(buffer)); | ||||||
|  |     /* This should've returned zero, and written an error string in the | ||||||
|  |        buffer.*/ | ||||||
|  |     if(!buffer[0] || error) | ||||||
|  |       return 99; | ||||||
|  |     return 0; | ||||||
|  | } | ||||||
|  | #endif | ||||||
							
								
								
									
										42
									
								
								CMake/FindCARES.cmake
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										42
									
								
								CMake/FindCARES.cmake
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,42 @@ | |||||||
|  | # - Find c-ares | ||||||
|  | # Find the c-ares includes and library | ||||||
|  | # This module defines | ||||||
|  | #  CARES_INCLUDE_DIR, where to find ares.h, etc. | ||||||
|  | #  CARES_LIBRARIES, the libraries needed to use c-ares. | ||||||
|  | #  CARES_FOUND, If false, do not try to use c-ares. | ||||||
|  | # also defined, but not for general use are | ||||||
|  | # CARES_LIBRARY, where to find the c-ares library. | ||||||
|  | 	 | ||||||
|  | FIND_PATH(CARES_INCLUDE_DIR ares.h | ||||||
|  |   /usr/local/include | ||||||
|  |   /usr/include | ||||||
|  |   ) | ||||||
|  |  	 | ||||||
|  | SET(CARES_NAMES ${CARES_NAMES} cares) | ||||||
|  | FIND_LIBRARY(CARES_LIBRARY | ||||||
|  |   NAMES ${CARES_NAMES} | ||||||
|  |   PATHS /usr/lib /usr/local/lib | ||||||
|  |   ) | ||||||
|  |  | ||||||
|  | IF (CARES_LIBRARY AND CARES_INCLUDE_DIR) | ||||||
|  |   SET(CARES_LIBRARIES ${CARES_LIBRARY}) | ||||||
|  |   SET(CARES_FOUND "YES") | ||||||
|  | ELSE (CARES_LIBRARY AND CARES_INCLUDE_DIR) | ||||||
|  |   SET(CARES_FOUND "NO") | ||||||
|  | ENDIF (CARES_LIBRARY AND CARES_INCLUDE_DIR) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | IF (CARES_FOUND) | ||||||
|  |   IF (NOT CARES_FIND_QUIETLY) | ||||||
|  |     MESSAGE(STATUS "Found c-ares: ${CARES_LIBRARIES}") | ||||||
|  |   ENDIF (NOT CARES_FIND_QUIETLY) | ||||||
|  | ELSE (CARES_FOUND) | ||||||
|  |   IF (CARES_FIND_REQUIRED) | ||||||
|  |     MESSAGE(FATAL_ERROR "Could not find c-ares library") | ||||||
|  |   ENDIF (CARES_FIND_REQUIRED) | ||||||
|  | ENDIF (CARES_FOUND) | ||||||
|  |  | ||||||
|  | MARK_AS_ADVANCED( | ||||||
|  |   CARES_LIBRARY | ||||||
|  |   CARES_INCLUDE_DIR | ||||||
|  |   ) | ||||||
							
								
								
									
										19
									
								
								CMake/FindOpenSSL.cmake
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								CMake/FindOpenSSL.cmake
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,19 @@ | |||||||
|  | # Extension of the standard FindOpenSSL.cmake | ||||||
|  | # Adds OPENSSL_INCLUDE_DIRS and libeay32 | ||||||
|  | include("${CMAKE_ROOT}/Modules/FindOpenSSL.cmake") | ||||||
|  |  | ||||||
|  | # Bill Hoffman told that libeay32 is necessary for him: | ||||||
|  | find_library(SSL_LIBEAY NAMES libeay32) | ||||||
|  |  | ||||||
|  | if(OPENSSL_FOUND) | ||||||
|  |   if(SSL_LIBEAY) | ||||||
|  |     list(APPEND OPENSSL_LIBRARIES ${SSL_LIBEAY}) | ||||||
|  |   else() | ||||||
|  |     set(OPENSSL_FOUND FALSE) | ||||||
|  |   endif() | ||||||
|  | endif() | ||||||
|  |  | ||||||
|  |  | ||||||
|  | if(OPENSSL_FOUND) | ||||||
|  |   set(OPENSSL_INCLUDE_DIRS ${OPENSSL_INCLUDE_DIR}) | ||||||
|  | endif() | ||||||
							
								
								
									
										8
									
								
								CMake/FindZLIB.cmake
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								CMake/FindZLIB.cmake
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | |||||||
|  | # Locate zlib | ||||||
|  | include("${CMAKE_ROOT}/Modules/FindZLIB.cmake") | ||||||
|  |  | ||||||
|  | find_library(ZLIB_LIBRARY_DEBUG NAMES zd zlibd zdlld zlib1d ) | ||||||
|  |  | ||||||
|  | if(ZLIB_FOUND AND ZLIB_LIBRARY_DEBUG) | ||||||
|  |   set( ZLIB_LIBRARIES optimized "${ZLIB_LIBRARY}" debug ${ZLIB_LIBRARY_DEBUG}) | ||||||
|  | endif() | ||||||
							
								
								
									
										250
									
								
								CMake/OtherTests.cmake
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										250
									
								
								CMake/OtherTests.cmake
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,250 @@ | |||||||
|  | include(CurlCheckCSourceCompiles) | ||||||
|  | set(EXTRA_DEFINES "__unused1\n#undef inline\n#define __unused2") | ||||||
|  | set(HEADER_INCLUDES) | ||||||
|  | set(headers_hack) | ||||||
|  |  | ||||||
|  | macro(add_header_include check header) | ||||||
|  |   if(${check}) | ||||||
|  |     set(headers_hack | ||||||
|  |       "${headers_hack}\n#include <${header}>") | ||||||
|  |     #SET(HEADER_INCLUDES | ||||||
|  |     #  ${HEADER_INCLUDES} | ||||||
|  |     #  "${header}") | ||||||
|  |   endif(${check}) | ||||||
|  | endmacro(add_header_include) | ||||||
|  |  | ||||||
|  | set(signature_call_conv) | ||||||
|  | if(HAVE_WINDOWS_H) | ||||||
|  |   add_header_include(HAVE_WINDOWS_H "windows.h") | ||||||
|  |   add_header_include(HAVE_WINSOCK2_H "winsock2.h") | ||||||
|  |   add_header_include(HAVE_WINSOCK_H "winsock.h") | ||||||
|  |   set(EXTRA_DEFINES ${EXTRA_DEFINES} | ||||||
|  |     "__unused7\n#ifndef WIN32_LEAN_AND_MEAN\n#define WIN32_LEAN_AND_MEAN\n#endif\n#define __unused3") | ||||||
|  |   set(signature_call_conv "PASCAL") | ||||||
|  | else(HAVE_WINDOWS_H) | ||||||
|  |   add_header_include(HAVE_SYS_TYPES_H "sys/types.h") | ||||||
|  |   add_header_include(HAVE_SYS_SOCKET_H "sys/socket.h") | ||||||
|  | endif(HAVE_WINDOWS_H) | ||||||
|  |  | ||||||
|  | set(EXTRA_DEFINES_BACKUP "${EXTRA_DEFINES}") | ||||||
|  | set(EXTRA_DEFINES "${EXTRA_DEFINES_BACKUP}\n${headers_hack}\n${extern_line}\n#define __unused5") | ||||||
|  | curl_check_c_source_compiles("recv(0, 0, 0, 0)" curl_cv_recv) | ||||||
|  | if(curl_cv_recv) | ||||||
|  |   #    AC_CACHE_CHECK([types of arguments and return type for recv], | ||||||
|  |   #[curl_cv_func_recv_args], [ | ||||||
|  |   #SET(curl_cv_func_recv_args "unknown") | ||||||
|  |   #for recv_retv in 'int' 'ssize_t'; do | ||||||
|  |   if(NOT DEFINED curl_cv_func_recv_args OR "${curl_cv_func_recv_args}" STREQUAL "unknown") | ||||||
|  |     foreach(recv_retv "int" "ssize_t" ) | ||||||
|  |       foreach(recv_arg1 "int" "ssize_t" "SOCKET") | ||||||
|  |         foreach(recv_arg2 "void *" "char *") | ||||||
|  |           foreach(recv_arg3 "size_t" "int" "socklen_t" "unsigned int") | ||||||
|  |             foreach(recv_arg4 "int" "unsigned int") | ||||||
|  |               if(NOT curl_cv_func_recv_done) | ||||||
|  |                 set(curl_cv_func_recv_test "UNKNOWN") | ||||||
|  |                 set(extern_line "extern ${recv_retv} ${signature_call_conv} recv(${recv_arg1}, ${recv_arg2}, ${recv_arg3}, ${recv_arg4})\;") | ||||||
|  |                 set(EXTRA_DEFINES "${EXTRA_DEFINES_BACKUP}\n${headers_hack}\n${extern_line}\n#define __unused5") | ||||||
|  |                 curl_check_c_source_compiles(" | ||||||
|  |                     ${recv_arg1} s=0; | ||||||
|  |                     ${recv_arg2} buf=0; | ||||||
|  |                     ${recv_arg3} len=0; | ||||||
|  |                     ${recv_arg4} flags=0; | ||||||
|  |                     ${recv_retv} res = recv(s, buf, len, flags)" | ||||||
|  |                   curl_cv_func_recv_test | ||||||
|  |                   "${recv_retv} recv(${recv_arg1}, ${recv_arg2}, ${recv_arg3}, ${recv_arg4})") | ||||||
|  |                 if(curl_cv_func_recv_test) | ||||||
|  |                   set(curl_cv_func_recv_args | ||||||
|  |                     "${recv_arg1},${recv_arg2},${recv_arg3},${recv_arg4},${recv_retv}") | ||||||
|  |                   set(RECV_TYPE_ARG1 "${recv_arg1}") | ||||||
|  |                   set(RECV_TYPE_ARG2 "${recv_arg2}") | ||||||
|  |                   set(RECV_TYPE_ARG3 "${recv_arg3}") | ||||||
|  |                   set(RECV_TYPE_ARG4 "${recv_arg4}") | ||||||
|  |                   set(RECV_TYPE_RETV "${recv_retv}") | ||||||
|  |                   set(HAVE_RECV 1) | ||||||
|  |                   set(curl_cv_func_recv_done 1) | ||||||
|  |                 endif(curl_cv_func_recv_test) | ||||||
|  |               endif(NOT curl_cv_func_recv_done) | ||||||
|  |             endforeach(recv_arg4) | ||||||
|  |           endforeach(recv_arg3) | ||||||
|  |         endforeach(recv_arg2) | ||||||
|  |       endforeach(recv_arg1) | ||||||
|  |     endforeach(recv_retv)  | ||||||
|  |   else(NOT DEFINED curl_cv_func_recv_args OR "${curl_cv_func_recv_args}" STREQUAL "unknown") | ||||||
|  |     string(REGEX REPLACE "^([^,]*),[^,]*,[^,]*,[^,]*,[^,]*$" "\\1" RECV_TYPE_ARG1 "${curl_cv_func_recv_args}") | ||||||
|  |     string(REGEX REPLACE "^[^,]*,([^,]*),[^,]*,[^,]*,[^,]*$" "\\1" RECV_TYPE_ARG2 "${curl_cv_func_recv_args}") | ||||||
|  |     string(REGEX REPLACE "^[^,]*,[^,]*,([^,]*),[^,]*,[^,]*$" "\\1" RECV_TYPE_ARG3 "${curl_cv_func_recv_args}") | ||||||
|  |     string(REGEX REPLACE "^[^,]*,[^,]*,[^,]*,([^,]*),[^,]*$" "\\1" RECV_TYPE_ARG4 "${curl_cv_func_recv_args}") | ||||||
|  |     string(REGEX REPLACE "^[^,]*,[^,]*,[^,]*,[^,]*,([^,]*)$" "\\1" RECV_TYPE_RETV "${curl_cv_func_recv_args}") | ||||||
|  |     #MESSAGE("RECV_TYPE_ARG1 ${RECV_TYPE_ARG1}") | ||||||
|  |     #MESSAGE("RECV_TYPE_ARG2 ${RECV_TYPE_ARG2}") | ||||||
|  |     #MESSAGE("RECV_TYPE_ARG3 ${RECV_TYPE_ARG3}") | ||||||
|  |     #MESSAGE("RECV_TYPE_ARG4 ${RECV_TYPE_ARG4}") | ||||||
|  |     #MESSAGE("RECV_TYPE_RETV ${RECV_TYPE_RETV}") | ||||||
|  |   endif(NOT DEFINED curl_cv_func_recv_args OR "${curl_cv_func_recv_args}" STREQUAL "unknown") | ||||||
|  |    | ||||||
|  |   if("${curl_cv_func_recv_args}" STREQUAL "unknown") | ||||||
|  |     message(FATAL_ERROR "Cannot find proper types to use for recv args") | ||||||
|  |   endif("${curl_cv_func_recv_args}" STREQUAL "unknown") | ||||||
|  | else(curl_cv_recv) | ||||||
|  |   message(FATAL_ERROR "Unable to link function recv") | ||||||
|  | endif(curl_cv_recv) | ||||||
|  | set(curl_cv_func_recv_args "${curl_cv_func_recv_args}" CACHE INTERNAL "Arguments for recv") | ||||||
|  | set(HAVE_RECV 1) | ||||||
|  |  | ||||||
|  | curl_check_c_source_compiles("send(0, 0, 0, 0)" curl_cv_send) | ||||||
|  | if(curl_cv_send) | ||||||
|  |   #    AC_CACHE_CHECK([types of arguments and return type for send], | ||||||
|  |   #[curl_cv_func_send_args], [ | ||||||
|  |   #SET(curl_cv_func_send_args "unknown") | ||||||
|  |   #for send_retv in 'int' 'ssize_t'; do | ||||||
|  |   if(NOT DEFINED curl_cv_func_send_args OR "${curl_cv_func_send_args}" STREQUAL "unknown") | ||||||
|  |     foreach(send_retv "int" "ssize_t" ) | ||||||
|  |       foreach(send_arg1 "int" "ssize_t" "SOCKET") | ||||||
|  |         foreach(send_arg2 "const void *" "void *" "char *" "const char *") | ||||||
|  |           foreach(send_arg3 "size_t" "int" "socklen_t" "unsigned int") | ||||||
|  |             foreach(send_arg4 "int" "unsigned int") | ||||||
|  |               if(NOT curl_cv_func_send_done) | ||||||
|  |                 set(curl_cv_func_send_test "UNKNOWN") | ||||||
|  |                 set(extern_line "extern ${send_retv} ${signature_call_conv} send(${send_arg1}, ${send_arg2}, ${send_arg3}, ${send_arg4})\;") | ||||||
|  |                 set(EXTRA_DEFINES "${EXTRA_DEFINES_BACKUP}\n${headers_hack}\n${extern_line}\n#define __unused5") | ||||||
|  |                 curl_check_c_source_compiles(" | ||||||
|  |                     ${send_arg1} s=0; | ||||||
|  |                     ${send_arg2} buf=0; | ||||||
|  |                     ${send_arg3} len=0; | ||||||
|  |                     ${send_arg4} flags=0; | ||||||
|  |                     ${send_retv} res = send(s, buf, len, flags)" | ||||||
|  |                   curl_cv_func_send_test | ||||||
|  |                   "${send_retv} send(${send_arg1}, ${send_arg2}, ${send_arg3}, ${send_arg4})") | ||||||
|  |                 if(curl_cv_func_send_test) | ||||||
|  |                   #MESSAGE("Found arguments: ${curl_cv_func_send_test}") | ||||||
|  |                   string(REGEX REPLACE "(const) .*" "\\1" send_qual_arg2 "${send_arg2}") | ||||||
|  |                   string(REGEX REPLACE "const (.*)" "\\1" send_arg2 "${send_arg2}") | ||||||
|  |                   set(curl_cv_func_send_args | ||||||
|  |                     "${send_arg1},${send_arg2},${send_arg3},${send_arg4},${send_retv},${send_qual_arg2}") | ||||||
|  |                   set(SEND_TYPE_ARG1 "${send_arg1}") | ||||||
|  |                   set(SEND_TYPE_ARG2 "${send_arg2}") | ||||||
|  |                   set(SEND_TYPE_ARG3 "${send_arg3}") | ||||||
|  |                   set(SEND_TYPE_ARG4 "${send_arg4}") | ||||||
|  |                   set(SEND_TYPE_RETV "${send_retv}") | ||||||
|  |                   set(HAVE_SEND 1) | ||||||
|  |                   set(curl_cv_func_send_done 1) | ||||||
|  |                 endif(curl_cv_func_send_test) | ||||||
|  |               endif(NOT curl_cv_func_send_done) | ||||||
|  |             endforeach(send_arg4) | ||||||
|  |           endforeach(send_arg3) | ||||||
|  |         endforeach(send_arg2) | ||||||
|  |       endforeach(send_arg1) | ||||||
|  |     endforeach(send_retv)  | ||||||
|  |   else(NOT DEFINED curl_cv_func_send_args OR "${curl_cv_func_send_args}" STREQUAL "unknown") | ||||||
|  |     string(REGEX REPLACE "^([^,]*),[^,]*,[^,]*,[^,]*,[^,]*,[^,]*$" "\\1" SEND_TYPE_ARG1 "${curl_cv_func_send_args}") | ||||||
|  |     string(REGEX REPLACE "^[^,]*,([^,]*),[^,]*,[^,]*,[^,]*,[^,]*$" "\\1" SEND_TYPE_ARG2 "${curl_cv_func_send_args}") | ||||||
|  |     string(REGEX REPLACE "^[^,]*,[^,]*,([^,]*),[^,]*,[^,]*,[^,]*$" "\\1" SEND_TYPE_ARG3 "${curl_cv_func_send_args}") | ||||||
|  |     string(REGEX REPLACE "^[^,]*,[^,]*,[^,]*,([^,]*),[^,]*,[^,]*$" "\\1" SEND_TYPE_ARG4 "${curl_cv_func_send_args}") | ||||||
|  |     string(REGEX REPLACE "^[^,]*,[^,]*,[^,]*,[^,]*,([^,]*),[^,]*$" "\\1" SEND_TYPE_RETV "${curl_cv_func_send_args}") | ||||||
|  |     string(REGEX REPLACE "^[^,]*,[^,]*,[^,]*,[^,]*,[^,]*,([^,]*)$" "\\1" SEND_QUAL_ARG2 "${curl_cv_func_send_args}") | ||||||
|  |     #MESSAGE("SEND_TYPE_ARG1 ${SEND_TYPE_ARG1}") | ||||||
|  |     #MESSAGE("SEND_TYPE_ARG2 ${SEND_TYPE_ARG2}") | ||||||
|  |     #MESSAGE("SEND_TYPE_ARG3 ${SEND_TYPE_ARG3}") | ||||||
|  |     #MESSAGE("SEND_TYPE_ARG4 ${SEND_TYPE_ARG4}") | ||||||
|  |     #MESSAGE("SEND_TYPE_RETV ${SEND_TYPE_RETV}") | ||||||
|  |     #MESSAGE("SEND_QUAL_ARG2 ${SEND_QUAL_ARG2}") | ||||||
|  |   endif(NOT DEFINED curl_cv_func_send_args OR "${curl_cv_func_send_args}" STREQUAL "unknown") | ||||||
|  |    | ||||||
|  |   if("${curl_cv_func_send_args}" STREQUAL "unknown") | ||||||
|  |     message(FATAL_ERROR "Cannot find proper types to use for send args") | ||||||
|  |   endif("${curl_cv_func_send_args}" STREQUAL "unknown") | ||||||
|  |   set(SEND_QUAL_ARG2 "const") | ||||||
|  | else(curl_cv_send) | ||||||
|  |   message(FATAL_ERROR "Unable to link function send") | ||||||
|  | endif(curl_cv_send) | ||||||
|  | set(curl_cv_func_send_args "${curl_cv_func_send_args}" CACHE INTERNAL "Arguments for send") | ||||||
|  | set(HAVE_SEND 1) | ||||||
|  |  | ||||||
|  | set(EXTRA_DEFINES "${EXTRA_DEFINES}\n${headers_hack}\n#define __unused5") | ||||||
|  | curl_check_c_source_compiles("int flag = MSG_NOSIGNAL" HAVE_MSG_NOSIGNAL) | ||||||
|  |  | ||||||
|  | set(EXTRA_DEFINES "__unused1\n#undef inline\n#define __unused2") | ||||||
|  | set(HEADER_INCLUDES) | ||||||
|  | set(headers_hack) | ||||||
|  |  | ||||||
|  | macro(add_header_include check header) | ||||||
|  |   if(${check}) | ||||||
|  |     set(headers_hack | ||||||
|  |       "${headers_hack}\n#include <${header}>") | ||||||
|  |     #SET(HEADER_INCLUDES | ||||||
|  |     #  ${HEADER_INCLUDES} | ||||||
|  |     #  "${header}") | ||||||
|  |   endif(${check}) | ||||||
|  | endmacro(add_header_include header) | ||||||
|  |  | ||||||
|  | if(HAVE_WINDOWS_H) | ||||||
|  |   set(EXTRA_DEFINES ${EXTRA_DEFINES} | ||||||
|  |     "__unused7\n#ifndef WIN32_LEAN_AND_MEAN\n#define WIN32_LEAN_AND_MEAN\n#endif\n#define __unused3") | ||||||
|  |   add_header_include(HAVE_WINDOWS_H "windows.h") | ||||||
|  |   add_header_include(HAVE_WINSOCK2_H "winsock2.h") | ||||||
|  |   add_header_include(HAVE_WINSOCK_H "winsock.h") | ||||||
|  | else(HAVE_WINDOWS_H) | ||||||
|  |   add_header_include(HAVE_SYS_TYPES_H "sys/types.h") | ||||||
|  |   add_header_include(HAVE_SYS_TIME_H "sys/time.h") | ||||||
|  |   add_header_include(TIME_WITH_SYS_TIME "time.h") | ||||||
|  |   add_header_include(HAVE_TIME_H "time.h") | ||||||
|  | endif(HAVE_WINDOWS_H) | ||||||
|  | set(EXTRA_DEFINES "${EXTRA_DEFINES}\n${headers_hack}\n#define __unused5") | ||||||
|  | curl_check_c_source_compiles("struct timeval ts;\nts.tv_sec  = 0;\nts.tv_usec = 0" HAVE_STRUCT_TIMEVAL) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | include(CurlCheckCSourceRuns) | ||||||
|  | set(EXTRA_DEFINES) | ||||||
|  | set(HEADER_INCLUDES) | ||||||
|  | if(HAVE_SYS_POLL_H) | ||||||
|  |   set(HEADER_INCLUDES "sys/poll.h") | ||||||
|  | endif(HAVE_SYS_POLL_H) | ||||||
|  | curl_check_c_source_runs("return poll((void *)0, 0, 10 /*ms*/)" HAVE_POLL_FINE) | ||||||
|  |  | ||||||
|  | set(HAVE_SIG_ATOMIC_T 1) | ||||||
|  | set(EXTRA_DEFINES) | ||||||
|  | set(HEADER_INCLUDES) | ||||||
|  | if(HAVE_SIGNAL_H) | ||||||
|  |   set(HEADER_INCLUDES "signal.h") | ||||||
|  |   set(CMAKE_EXTRA_INCLUDE_FILES "signal.h") | ||||||
|  | endif(HAVE_SIGNAL_H) | ||||||
|  | check_type_size("sig_atomic_t" SIZEOF_SIG_ATOMIC_T) | ||||||
|  | if(HAVE_SIZEOF_SIG_ATOMIC_T) | ||||||
|  |   curl_check_c_source_compiles("static volatile sig_atomic_t dummy = 0" HAVE_SIG_ATOMIC_T_NOT_VOLATILE) | ||||||
|  |   if(NOT HAVE_SIG_ATOMIC_T_NOT_VOLATILE) | ||||||
|  |     set(HAVE_SIG_ATOMIC_T_VOLATILE 1) | ||||||
|  |   endif(NOT HAVE_SIG_ATOMIC_T_NOT_VOLATILE) | ||||||
|  | endif(HAVE_SIZEOF_SIG_ATOMIC_T) | ||||||
|  |  | ||||||
|  | set(CHECK_TYPE_SIZE_PREINCLUDE | ||||||
|  |   "#undef inline") | ||||||
|  |  | ||||||
|  | if(HAVE_WINDOWS_H) | ||||||
|  |   set(CHECK_TYPE_SIZE_PREINCLUDE "${CHECK_TYPE_SIZE_PREINCLUDE} | ||||||
|  |   #ifndef WIN32_LEAN_AND_MEAN | ||||||
|  |   #define WIN32_LEAN_AND_MEAN | ||||||
|  |   #endif | ||||||
|  |   #include <windows.h>") | ||||||
|  |   if(HAVE_WINSOCK2_H) | ||||||
|  |     set(CHECK_TYPE_SIZE_PREINCLUDE "${CHECK_TYPE_SIZE_PREINCLUDE}\n#include <winsock2.h>") | ||||||
|  |   endif(HAVE_WINSOCK2_H) | ||||||
|  | else(HAVE_WINDOWS_H) | ||||||
|  |   if(HAVE_SYS_SOCKET_H) | ||||||
|  |     set(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES} | ||||||
|  |       "sys/socket.h") | ||||||
|  |   endif(HAVE_SYS_SOCKET_H) | ||||||
|  |   if(HAVE_NETINET_IN_H) | ||||||
|  |     set(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES} | ||||||
|  |       "netinet/in.h") | ||||||
|  |   endif(HAVE_NETINET_IN_H) | ||||||
|  |   if(HAVE_ARPA_INET_H) | ||||||
|  |     set(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES} | ||||||
|  |       "arpa/inet.h") | ||||||
|  |   endif(HAVE_ARPA_INET_H) | ||||||
|  | endif(HAVE_WINDOWS_H) | ||||||
|  |  | ||||||
|  | check_type_size("struct sockaddr_storage" SIZEOF_STRUCT_SOCKADDR_STORAGE) | ||||||
|  | if(HAVE_SIZEOF_STRUCT_SOCKADDR_STORAGE) | ||||||
|  |   set(HAVE_STRUCT_SOCKADDR_STORAGE 1) | ||||||
|  | endif(HAVE_SIZEOF_STRUCT_SOCKADDR_STORAGE) | ||||||
|  |  | ||||||
							
								
								
									
										121
									
								
								CMake/Platforms/WindowsCache.cmake
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										121
									
								
								CMake/Platforms/WindowsCache.cmake
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,121 @@ | |||||||
|  | if(NOT UNIX) | ||||||
|  |   if(WIN32) | ||||||
|  |     set(HAVE_LIBDL 0) | ||||||
|  |     set(HAVE_LIBUCB 0) | ||||||
|  |     set(HAVE_LIBSOCKET 0) | ||||||
|  |     set(NOT_NEED_LIBNSL 0) | ||||||
|  |     set(HAVE_LIBNSL 0) | ||||||
|  |     set(HAVE_LIBZ 0) | ||||||
|  |     set(HAVE_LIBCRYPTO 0) | ||||||
|  |  | ||||||
|  |     set(HAVE_DLOPEN 0) | ||||||
|  |  | ||||||
|  |     set(HAVE_ALLOCA_H 0) | ||||||
|  |     set(HAVE_ARPA_INET_H 0) | ||||||
|  |     set(HAVE_DLFCN_H 0) | ||||||
|  |     set(HAVE_FCNTL_H 1) | ||||||
|  |     set(HAVE_FEATURES_H 0) | ||||||
|  |     set(HAVE_INTTYPES_H 0) | ||||||
|  |     set(HAVE_IO_H 1) | ||||||
|  |     set(HAVE_MALLOC_H 1) | ||||||
|  |     set(HAVE_MEMORY_H 1) | ||||||
|  |     set(HAVE_NETDB_H 0) | ||||||
|  |     set(HAVE_NETINET_IF_ETHER_H 0) | ||||||
|  |     set(HAVE_NETINET_IN_H 0) | ||||||
|  |     set(HAVE_NET_IF_H 0) | ||||||
|  |     set(HAVE_PROCESS_H 1) | ||||||
|  |     set(HAVE_PWD_H 0) | ||||||
|  |     set(HAVE_SETJMP_H 1) | ||||||
|  |     set(HAVE_SGTTY_H 0) | ||||||
|  |     set(HAVE_SIGNAL_H 1) | ||||||
|  |     set(HAVE_SOCKIO_H 0) | ||||||
|  |     set(HAVE_STDINT_H 0) | ||||||
|  |     set(HAVE_STDLIB_H 1) | ||||||
|  |     set(HAVE_STRINGS_H 0) | ||||||
|  |     set(HAVE_STRING_H 1) | ||||||
|  |     set(HAVE_SYS_PARAM_H 0) | ||||||
|  |     set(HAVE_SYS_POLL_H 0) | ||||||
|  |     set(HAVE_SYS_SELECT_H 0) | ||||||
|  |     set(HAVE_SYS_SOCKET_H 0) | ||||||
|  |     set(HAVE_SYS_SOCKIO_H 0) | ||||||
|  |     set(HAVE_SYS_STAT_H 1) | ||||||
|  |     set(HAVE_SYS_TIME_H 0) | ||||||
|  |     set(HAVE_SYS_TYPES_H 1) | ||||||
|  |     set(HAVE_SYS_UTIME_H 1) | ||||||
|  |     set(HAVE_TERMIOS_H 0) | ||||||
|  |     set(HAVE_TERMIO_H 0) | ||||||
|  |     set(HAVE_TIME_H 1) | ||||||
|  |     set(HAVE_UNISTD_H 0) | ||||||
|  |     set(HAVE_UTIME_H 0) | ||||||
|  |     set(HAVE_X509_H 0) | ||||||
|  |     set(HAVE_ZLIB_H 0) | ||||||
|  |  | ||||||
|  |     set(HAVE_SIZEOF_LONG_DOUBLE 1) | ||||||
|  |     set(SIZEOF_LONG_DOUBLE 8) | ||||||
|  |  | ||||||
|  |     set(HAVE_SOCKET 1) | ||||||
|  |     set(HAVE_POLL 0) | ||||||
|  |     set(HAVE_SELECT 1) | ||||||
|  |     set(HAVE_STRDUP 1) | ||||||
|  |     set(HAVE_STRSTR 1) | ||||||
|  |     set(HAVE_STRTOK_R 0) | ||||||
|  |     set(HAVE_STRFTIME 1) | ||||||
|  |     set(HAVE_UNAME 0) | ||||||
|  |     set(HAVE_STRCASECMP 0) | ||||||
|  |     set(HAVE_STRICMP 1) | ||||||
|  |     set(HAVE_STRCMPI 1) | ||||||
|  |     set(HAVE_GETHOSTBYADDR 1) | ||||||
|  |     set(HAVE_GETTIMEOFDAY 0) | ||||||
|  |     set(HAVE_INET_ADDR 1) | ||||||
|  |     set(HAVE_INET_NTOA 1) | ||||||
|  |     set(HAVE_INET_NTOA_R 0) | ||||||
|  |     set(HAVE_TCGETATTR 0) | ||||||
|  |     set(HAVE_TCSETATTR 0) | ||||||
|  |     set(HAVE_PERROR 1) | ||||||
|  |     set(HAVE_CLOSESOCKET 1) | ||||||
|  |     set(HAVE_SETVBUF 0) | ||||||
|  |     set(HAVE_SIGSETJMP 0) | ||||||
|  |     set(HAVE_GETPASS_R 0) | ||||||
|  |     set(HAVE_STRLCAT 0) | ||||||
|  |     set(HAVE_GETPWUID 0) | ||||||
|  |     set(HAVE_GETEUID 0) | ||||||
|  |     set(HAVE_UTIME 1) | ||||||
|  |     set(HAVE_RAND_EGD 0) | ||||||
|  |     set(HAVE_RAND_SCREEN 0) | ||||||
|  |     set(HAVE_RAND_STATUS 0) | ||||||
|  |     set(HAVE_GMTIME_R 0) | ||||||
|  |     set(HAVE_LOCALTIME_R 0) | ||||||
|  |     set(HAVE_GETHOSTBYADDR_R 0) | ||||||
|  |     set(HAVE_GETHOSTBYNAME_R 0) | ||||||
|  |     set(HAVE_SIGNAL_FUNC 1) | ||||||
|  |     set(HAVE_SIGNAL_MACRO 0) | ||||||
|  |  | ||||||
|  |     set(HAVE_GETHOSTBYADDR_R_5 0) | ||||||
|  |     set(HAVE_GETHOSTBYADDR_R_5_REENTRANT 0) | ||||||
|  |     set(HAVE_GETHOSTBYADDR_R_7 0) | ||||||
|  |     set(HAVE_GETHOSTBYADDR_R_7_REENTRANT 0) | ||||||
|  |     set(HAVE_GETHOSTBYADDR_R_8 0) | ||||||
|  |     set(HAVE_GETHOSTBYADDR_R_8_REENTRANT 0) | ||||||
|  |     set(HAVE_GETHOSTBYNAME_R_3 0) | ||||||
|  |     set(HAVE_GETHOSTBYNAME_R_3_REENTRANT 0) | ||||||
|  |     set(HAVE_GETHOSTBYNAME_R_5 0) | ||||||
|  |     set(HAVE_GETHOSTBYNAME_R_5_REENTRANT 0) | ||||||
|  |     set(HAVE_GETHOSTBYNAME_R_6 0) | ||||||
|  |     set(HAVE_GETHOSTBYNAME_R_6_REENTRANT 0) | ||||||
|  |  | ||||||
|  |     set(TIME_WITH_SYS_TIME 0) | ||||||
|  |     set(HAVE_O_NONBLOCK 0) | ||||||
|  |     set(HAVE_IN_ADDR_T 0) | ||||||
|  |     set(HAVE_INET_NTOA_R_DECL 0) | ||||||
|  |     set(HAVE_INET_NTOA_R_DECL_REENTRANT 0) | ||||||
|  |     set(HAVE_GETADDRINFO 0) | ||||||
|  |     set(STDC_HEADERS 1) | ||||||
|  |     set(RETSIGTYPE_TEST 1) | ||||||
|  |  | ||||||
|  |     set(HAVE_SIGACTION 0) | ||||||
|  |     set(HAVE_MACRO_SIGSETJMP 0) | ||||||
|  |   else(WIN32) | ||||||
|  |     message("This file should be included on Windows platform only") | ||||||
|  |   endif(WIN32) | ||||||
|  | endif(NOT UNIX) | ||||||
|  |  | ||||||
							
								
								
									
										31
									
								
								CMake/Utilities.cmake
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								CMake/Utilities.cmake
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,31 @@ | |||||||
|  | # File containing various utilities | ||||||
|  |  | ||||||
|  | # Converts a CMake list to a string containing elements separated by spaces | ||||||
|  | function(TO_LIST_SPACES _LIST_NAME OUTPUT_VAR) | ||||||
|  |   set(NEW_LIST_SPACE) | ||||||
|  |   foreach(ITEM ${${_LIST_NAME}}) | ||||||
|  |     set(NEW_LIST_SPACE "${NEW_LIST_SPACE} ${ITEM}") | ||||||
|  |   endforeach() | ||||||
|  |   string(STRIP ${NEW_LIST_SPACE} NEW_LIST_SPACE) | ||||||
|  |   set(${OUTPUT_VAR} "${NEW_LIST_SPACE}" PARENT_SCOPE) | ||||||
|  | endfunction() | ||||||
|  |  | ||||||
|  | # Appends a lis of item to a string which is a space-separated list, if they don't already exist. | ||||||
|  | function(LIST_SPACES_APPEND_ONCE LIST_NAME) | ||||||
|  |   string(REPLACE " " ";" _LIST ${${LIST_NAME}}) | ||||||
|  |   list(APPEND _LIST ${ARGN}) | ||||||
|  |   list(REMOVE_DUPLICATES _LIST) | ||||||
|  |   to_list_spaces(_LIST NEW_LIST_SPACE) | ||||||
|  |   set(${LIST_NAME} "${NEW_LIST_SPACE}" PARENT_SCOPE) | ||||||
|  | endfunction() | ||||||
|  |  | ||||||
|  | # Convinience function that does the same as LIST(FIND ...) but with a TRUE/FALSE return value. | ||||||
|  | # Ex: IN_STR_LIST(MY_LIST "Searched item" WAS_FOUND) | ||||||
|  | function(IN_STR_LIST LIST_NAME ITEM_SEARCHED RETVAL) | ||||||
|  |   list(FIND ${LIST_NAME} ${ITEM_SEARCHED} FIND_POS) | ||||||
|  |   if(${FIND_POS} EQUAL -1) | ||||||
|  |     set(${RETVAL} FALSE PARENT_SCOPE) | ||||||
|  |   else() | ||||||
|  |     set(${RETVAL} TRUE PARENT_SCOPE) | ||||||
|  |   endif() | ||||||
|  | endfunction() | ||||||
							
								
								
									
										884
									
								
								CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										884
									
								
								CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,884 @@ | |||||||
|  | # cURL/libcurl CMake script | ||||||
|  | # by Tetetest and Sukender (Benoit Neil) | ||||||
|  |  | ||||||
|  | # TODO: | ||||||
|  | # The output .so file lacks the soname number which we currently have within the lib/Makefile.am file | ||||||
|  | # Add full (4 or 5 libs) SSL support | ||||||
|  | # Add INSTALL target (EXTRA_DIST variables in Makefile.am may be moved to Makefile.inc so that CMake/CPack is aware of what's to include). | ||||||
|  | # Add CTests(?) | ||||||
|  | # Check on all possible platforms | ||||||
|  | # Test with as many configurations possible (With or without any option) | ||||||
|  | # Create scripts that help keeping the CMake build system up to date (to reduce maintenance). According to Tetetest: | ||||||
|  | #  - lists of headers that 'configure' checks for; | ||||||
|  | #  - curl-specific tests (the ones that are in m4/curl-*.m4 files); | ||||||
|  | #  - (most obvious thing:) curl version numbers. | ||||||
|  | # Add documentation subproject | ||||||
|  | # | ||||||
|  | # To check: | ||||||
|  | # (From Daniel Stenberg) The cmake build selected to run gcc with -fPIC on my box while the plain configure script did not. | ||||||
|  | # (From Daniel Stenberg) The gcc command line use neither -g nor any -O options. As a developer, I also treasure our configure scripts's --enable-debug option that sets a long range of "picky" compiler options. | ||||||
|  | cmake_minimum_required(VERSION 2.6.2 FATAL_ERROR) | ||||||
|  | set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake;${CMAKE_MODULE_PATH}") | ||||||
|  | include(Utilities) | ||||||
|  |  | ||||||
|  | project( CURL C ) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | file (READ ${CURL_SOURCE_DIR}/include/curl/curlver.h CURL_VERSION_H_CONTENTS) | ||||||
|  | string (REGEX MATCH "LIBCURL_VERSION_MAJOR[ \t]+([0-9]+)"  | ||||||
|  |   LIBCURL_VERSION_MJ ${CURL_VERSION_H_CONTENTS}) | ||||||
|  | string (REGEX MATCH "([0-9]+)"  | ||||||
|  |   LIBCURL_VERSION_MJ ${LIBCURL_VERSION_MJ}) | ||||||
|  | string (REGEX MATCH  | ||||||
|  |   "LIBCURL_VERSION_MINOR[ \t]+([0-9]+)" | ||||||
|  |   LIBCURL_VERSION_MI ${CURL_VERSION_H_CONTENTS}) | ||||||
|  | string (REGEX MATCH "([0-9]+)" LIBCURL_VERSION_MI ${LIBCURL_VERSION_MI}) | ||||||
|  | string (REGEX MATCH  | ||||||
|  |   "LIBCURL_VERSION_PATCH[ \t]+([0-9]+)"  | ||||||
|  |   LIBCURL_VERSION_PT ${CURL_VERSION_H_CONTENTS}) | ||||||
|  | string (REGEX MATCH "([0-9]+)" LIBCURL_VERSION_PT ${LIBCURL_VERSION_PT}) | ||||||
|  | set (CURL_MAJOR_VERSION ${LIBCURL_VERSION_MJ}) | ||||||
|  | set (CURL_MINOR_VERSION ${LIBCURL_VERSION_MI}) | ||||||
|  | set (CURL_PATCH_VERSION ${LIBCURL_VERSION_PT}) | ||||||
|  |  | ||||||
|  | include_regular_expression("^.*$")    # Sukender: Is it necessary? | ||||||
|  |  | ||||||
|  | # Setup package meta-data | ||||||
|  | # SET(PACKAGE "curl") | ||||||
|  | set(CURL_VERSION ${CURL_MAJOR_VERSION}.${CURL_MINOR_VERSION}.${CURL_PATCH_VERSION}) | ||||||
|  | message(STATUS "curl version=[${CURL_VERSION}]") | ||||||
|  | # SET(PACKAGE_TARNAME "curl") | ||||||
|  | # SET(PACKAGE_NAME "curl") | ||||||
|  | # SET(PACKAGE_VERSION "-") | ||||||
|  | # SET(PACKAGE_STRING "curl-") | ||||||
|  | # SET(PACKAGE_BUGREPORT "a suitable curl mailing list => http://curl.haxx.se/mail/") | ||||||
|  | set(OPERATING_SYSTEM "${CMAKE_SYSTEM_NAME}") | ||||||
|  | set(OS "\"${CMAKE_SYSTEM_NAME}\"") | ||||||
|  |  | ||||||
|  | # Make the base headers visible to everything | ||||||
|  | # IF(NOT ${PROJECT_BINARY_DIR} EQUAL ${PROJECT_SOURCE_DIR}) | ||||||
|  | # INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR}/include) | ||||||
|  | # ENDIF() | ||||||
|  | include_directories( ${CURL_SOURCE_DIR}/include ) | ||||||
|  |  | ||||||
|  | if(WIN32) | ||||||
|  |   set(NATIVE_WINDOWS ON) | ||||||
|  | endif() | ||||||
|  |  | ||||||
|  | option(BUILD_CURL_EXE "Set to ON to build cURL executable." ON) | ||||||
|  | option(BUILD_CURL_TESTS "Set to ON to build cURL tests." ON) | ||||||
|  | option(CURL_STATICLIB "Set to ON to build libcurl with static linking." OFF) | ||||||
|  | option(CURL_USE_ARES "Set to ON to enable c-ares support" OFF) | ||||||
|  | # initialize CURL_LIBS | ||||||
|  | set(CURL_LIBS "") | ||||||
|  |  | ||||||
|  | if(CURL_USE_ARES) | ||||||
|  |   set(USE_ARES ${CURL_USE_ARES}) | ||||||
|  |   find_package(CARES REQUIRED)  | ||||||
|  |   list(APPEND CURL_LIBS ${CARES_LIBRARY} ) | ||||||
|  |   set(CURL_LIBS ${CURL_LIBS} ${CARES_LIBRARY}) | ||||||
|  | endif() | ||||||
|  |  | ||||||
|  | option(BUILD_DASHBOARD_REPORTS "Set to ON to activate reporting of cURL builds here http://www.cdash.org/CDashPublic/index.php?project=CURL" OFF) | ||||||
|  | if(BUILD_DASHBOARD_REPORTS) | ||||||
|  |   #INCLUDE(Dart) | ||||||
|  |   include(CTest) | ||||||
|  | endif(BUILD_DASHBOARD_REPORTS) | ||||||
|  |  | ||||||
|  | if(MSVC) | ||||||
|  |   option(BUILD_RELEASE_DEBUG_DIRS "Set OFF to build each configuration to a separate directory" OFF) | ||||||
|  |   mark_as_advanced(BUILD_RELEASE_DEBUG_DIRS) | ||||||
|  | endif() | ||||||
|  |  | ||||||
|  | option(CURL_HIDDEN_SYMBOLS "Set to ON to hide libcurl internal symbols (=hide all symbols that aren't officially external)." ON) | ||||||
|  | mark_as_advanced(CURL_HIDDEN_SYMBOLS) | ||||||
|  |  | ||||||
|  | # IF(WIN32) | ||||||
|  | # OPTION(CURL_WINDOWS_SSPI "Use windows libraries to allow NTLM authentication without openssl" ON) | ||||||
|  | # MARK_AS_ADVANCED(CURL_WINDOWS_SSPI) | ||||||
|  | # ENDIF() | ||||||
|  |  | ||||||
|  | option(HTTP_ONLY "disables all protocols except HTTP (This overrides all CURL_DISABLE_* options)" OFF) | ||||||
|  | mark_as_advanced(HTTP_ONLY) | ||||||
|  | option(CURL_DISABLE_FTP "disables FTP" OFF) | ||||||
|  | mark_as_advanced(CURL_DISABLE_FTP) | ||||||
|  | option(CURL_DISABLE_LDAP "disables LDAP" OFF) | ||||||
|  | mark_as_advanced(CURL_DISABLE_LDAP) | ||||||
|  | option(CURL_DISABLE_TELNET "disables Telnet" OFF) | ||||||
|  | mark_as_advanced(CURL_DISABLE_TELNET) | ||||||
|  | option(CURL_DISABLE_DICT "disables DICT" OFF) | ||||||
|  | mark_as_advanced(CURL_DISABLE_DICT) | ||||||
|  | option(CURL_DISABLE_FILE "disables FILE" OFF) | ||||||
|  | mark_as_advanced(CURL_DISABLE_FILE) | ||||||
|  | option(CURL_DISABLE_TFTP "disables TFTP" OFF) | ||||||
|  | mark_as_advanced(CURL_DISABLE_TFTP) | ||||||
|  | option(CURL_DISABLE_HTTP "disables HTTP" OFF) | ||||||
|  | mark_as_advanced(CURL_DISABLE_HTTP) | ||||||
|  |  | ||||||
|  | option(CURL_DISABLE_LDAPS "to disable LDAPS" OFF) | ||||||
|  | mark_as_advanced(CURL_DISABLE_LDAPS) | ||||||
|  | if(WIN32) | ||||||
|  |   set(CURL_DEFAULT_DISABLE_LDAP OFF) | ||||||
|  |   # some windows compilers do not have wldap32  | ||||||
|  |   if( NOT HAVE_WLDAP32) | ||||||
|  |     set(CURL_DISABLE_LDAP ON CACHE BOOL "" FORCE) | ||||||
|  |     message(STATUS "wldap32 not found CURL_DISABLE_LDAP set ON") | ||||||
|  |     option(CURL_LDAP_WIN "Use W$ LDAP implementation" OFF) | ||||||
|  |   else() | ||||||
|  |     option(CURL_LDAP_WIN "Use W$ LDAP implementation" ON) | ||||||
|  |   endif() | ||||||
|  |   mark_as_advanced(CURL_LDAP_WIN) | ||||||
|  |   set(CURL_LDAP_HYBRID OFF) | ||||||
|  | else() | ||||||
|  |   option(CURL_LDAP_HYBRID "W$ LDAP with non-W$ compiler" OFF) | ||||||
|  |   mark_as_advanced(CURL_LDAP_HYBRID) | ||||||
|  |   set(CURL_LDAP_WIN OFF) | ||||||
|  | endif() | ||||||
|  |  | ||||||
|  | if(HTTP_ONLY) | ||||||
|  |   set(CURL_DISABLE_FTP ON) | ||||||
|  |   set(CURL_DISABLE_LDAP ON) | ||||||
|  |   set(CURL_DISABLE_TELNET ON) | ||||||
|  |   set(CURL_DISABLE_DICT ON) | ||||||
|  |   set(CURL_DISABLE_FILE ON) | ||||||
|  |   set(CURL_DISABLE_TFTP ON) | ||||||
|  | endif() | ||||||
|  |  | ||||||
|  | option(CURL_DISABLE_COOKIES "to disable cookies support" OFF) | ||||||
|  | mark_as_advanced(CURL_DISABLE_COOKIES) | ||||||
|  |  | ||||||
|  | option(CURL_DISABLE_CRYPTO_AUTH "to disable cryptographic authentication" OFF) | ||||||
|  | mark_as_advanced(CURL_DISABLE_CRYPTO_AUTH) | ||||||
|  | option(CURL_DISABLE_VERBOSE_STRINGS "to disable verbose strings" OFF) | ||||||
|  | mark_as_advanced(CURL_DISABLE_VERBOSE_STRINGS) | ||||||
|  | option(DISABLED_THREADSAFE "Set to explicitly specify we don't want to use thread-safe functions" OFF) | ||||||
|  | mark_as_advanced(DISABLED_THREADSAFE) | ||||||
|  | option(ENABLE_IPV6 "Define if you want to enable IPv6 support" OFF) | ||||||
|  | mark_as_advanced(ENABLE_IPV6) | ||||||
|  |  | ||||||
|  | if(WIN32) | ||||||
|  |   list_spaces_append_once(CMAKE_C_STANDARD_LIBRARIES wsock32.lib ws2_32.lib)  # bufferoverflowu.lib | ||||||
|  |   if(CURL_DISABLE_LDAP) | ||||||
|  |     # Remove wldap32.lib from space-separated list | ||||||
|  |     string(REPLACE " " ";" _LIST ${CMAKE_C_STANDARD_LIBRARIES}) | ||||||
|  |     list(REMOVE_ITEM _LIST "wldap32.lib") | ||||||
|  |     to_list_spaces(_LIST CMAKE_C_STANDARD_LIBRARIES) | ||||||
|  |   else() | ||||||
|  |     # Append wldap32.lib | ||||||
|  |     list_spaces_append_once(CMAKE_C_STANDARD_LIBRARIES wldap32.lib) | ||||||
|  |   endif() | ||||||
|  |   set(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES}"   CACHE STRING "" FORCE) | ||||||
|  | endif() | ||||||
|  |  | ||||||
|  |  | ||||||
|  | # We need ansi c-flags, especially on HP | ||||||
|  | set(CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS}") | ||||||
|  | set(CMAKE_REQUIRED_FLAGS ${CMAKE_ANSI_CFLAGS}) | ||||||
|  |  | ||||||
|  | # Disable warnings on Borland to avoid changing 3rd party code. | ||||||
|  | if(BORLAND) | ||||||
|  |   set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w-") | ||||||
|  | endif(BORLAND) | ||||||
|  |  | ||||||
|  | # If we are on AIX, do the _ALL_SOURCE magic | ||||||
|  | if(${CMAKE_SYSTEM_NAME} MATCHES AIX) | ||||||
|  |   set(_ALL_SOURCE 1) | ||||||
|  | endif(${CMAKE_SYSTEM_NAME} MATCHES AIX) | ||||||
|  |  | ||||||
|  | # Include all the necessary files for macros | ||||||
|  | include (CheckFunctionExists) | ||||||
|  | include (CheckIncludeFile) | ||||||
|  | include (CheckIncludeFiles) | ||||||
|  | include (CheckLibraryExists) | ||||||
|  | include (CheckSymbolExists) | ||||||
|  | # if crosscompiling is on, the CHECK_TYPE_SIZE macro coming with cmake uses | ||||||
|  | # TRY_COMPILE instead of TRY_RUN which makes crosscompiling easier, Alex | ||||||
|  | if(CMAKE_CROSSCOMPILING)   | ||||||
|  |   include ("${CMAKE_MODULE_PATH}/CheckTypeSize.cmake") | ||||||
|  | else(CMAKE_CROSSCOMPILING) | ||||||
|  |   include (CheckTypeSize) | ||||||
|  | endif(CMAKE_CROSSCOMPILING) | ||||||
|  |  | ||||||
|  | # On windows preload settings | ||||||
|  | if(WIN32) | ||||||
|  |   include(${CMAKE_CURRENT_SOURCE_DIR}/CMake/Platforms/WindowsCache.cmake) | ||||||
|  | endif(WIN32) | ||||||
|  |  | ||||||
|  | # This macro checks if the symbol exists in the library and if it | ||||||
|  | # does, it appends library to the list. | ||||||
|  | macro(CHECK_LIBRARY_EXISTS_CONCAT LIBRARY SYMBOL VARIABLE) | ||||||
|  |   check_library_exists("${LIBRARY};${CURL_LIBS}" ${SYMBOL} ""  | ||||||
|  |     ${VARIABLE}) | ||||||
|  |   if(${VARIABLE}) | ||||||
|  |     set(CURL_LIBS ${CURL_LIBS} ${LIBRARY}) | ||||||
|  |   endif(${VARIABLE}) | ||||||
|  | endmacro(CHECK_LIBRARY_EXISTS_CONCAT) | ||||||
|  |  | ||||||
|  | # Check for all needed libraries | ||||||
|  | check_library_exists_concat("dl"     dlopen       HAVE_LIBDL) | ||||||
|  | #CHECK_LIBRARY_EXISTS_CONCAT("ucb"    gethostname  HAVE_LIBUCB) | ||||||
|  | check_library_exists_concat("socket" connect      HAVE_LIBSOCKET) | ||||||
|  | check_library_exists("c" gethostbyname "" NOT_NEED_LIBNSL) | ||||||
|  |  | ||||||
|  | # Yellowtab Zeta needs different libraries than BeOS 5. | ||||||
|  | if(BEOS) | ||||||
|  |   set(NOT_NEED_LIBNSL 1) | ||||||
|  |   check_library_exists_concat("bind" gethostbyname HAVE_LIBBIND) | ||||||
|  |   check_library_exists_concat("bnetapi" closesocket HAVE_LIBBNETAPI) | ||||||
|  | endif(BEOS) | ||||||
|  |  | ||||||
|  | if(NOT NOT_NEED_LIBNSL) | ||||||
|  |   check_library_exists_concat("nsl"    gethostbyname  HAVE_LIBNSL) | ||||||
|  | endif(NOT NOT_NEED_LIBNSL) | ||||||
|  |  | ||||||
|  | check_library_exists_concat("ws2_32" getch        HAVE_LIBWS2_32) | ||||||
|  | check_library_exists_concat("winmm"  getch        HAVE_LIBWINMM) | ||||||
|  | check_library_exists("wldap32" cldap_open "" HAVE_WLDAP32) | ||||||
|  |  | ||||||
|  | # IF(NOT CURL_SPECIAL_LIBZ) | ||||||
|  | #  CHECK_LIBRARY_EXISTS_CONCAT("z"      inflateEnd   HAVE_LIBZ) | ||||||
|  | # ENDIF(NOT CURL_SPECIAL_LIBZ) | ||||||
|  |  | ||||||
|  | option(CMAKE_USE_OPENSSL "Use OpenSSL code. Experimental" ON) | ||||||
|  | mark_as_advanced(CMAKE_USE_OPENSSL) | ||||||
|  | if(CMAKE_USE_OPENSSL) | ||||||
|  |   if(WIN32) | ||||||
|  |     find_package(OpenSSL) | ||||||
|  |     if(OPENSSL_FOUND) | ||||||
|  |       set(USE_SSLEAY TRUE) | ||||||
|  |       set(USE_OPENSSL TRUE) | ||||||
|  |       list(APPEND CURL_LIBS ${OPENSSL_LIBRARIES} ) | ||||||
|  |     endif() | ||||||
|  |     #FIND_LIBRARY(LIBEAY NAMES libeay32) | ||||||
|  |     #LIST(APPEND CURL_LIBS ${LIBEAY} ) | ||||||
|  |   else(WIN32) | ||||||
|  |     check_library_exists_concat("crypto" CRYPTO_lock  HAVE_LIBCRYPTO) | ||||||
|  |     check_library_exists_concat("ssl"    SSL_connect  HAVE_LIBSSL) | ||||||
|  |   endif(WIN32) | ||||||
|  | endif(CMAKE_USE_OPENSSL) | ||||||
|  |  | ||||||
|  | # Check for idn | ||||||
|  | check_library_exists_concat("idn" idna_to_ascii_lz HAVE_LIBIDN) | ||||||
|  |  | ||||||
|  | # Check for LDAP | ||||||
|  | check_library_exists_concat("ldap" ldap_init HAVE_LIBLDAP) | ||||||
|  | # if(NOT HAVE_LIBLDAP) | ||||||
|  | # SET(CURL_DISABLE_LDAP ON) | ||||||
|  | # endif(NOT HAVE_LIBLDAP) | ||||||
|  |  | ||||||
|  | # Check for symbol dlopen (same as HAVE_LIBDL) | ||||||
|  | check_library_exists("${CURL_LIBS}" dlopen "" HAVE_DLOPEN) | ||||||
|  |  | ||||||
|  | # For other tests to use the same libraries | ||||||
|  | set(CMAKE_REQUIRED_LIBRARIES ${CURL_LIBS}) | ||||||
|  |  | ||||||
|  | option(CURL_ZLIB "Set to ON to enable building cURL with zlib support." ON) | ||||||
|  | set(HAVE_LIBZ OFF) | ||||||
|  | set(HAVE_ZLIB_H OFF) | ||||||
|  | set(HAVE_ZLIB OFF) | ||||||
|  | if(CURL_ZLIB)  # AND CURL_CONFIG_HAS_BEEN_RUN_BEFORE | ||||||
|  |   find_package(ZLIB QUIET) | ||||||
|  |   if(ZLIB_FOUND) | ||||||
|  |     set(HAVE_ZLIB_H ON) | ||||||
|  |     set(HAVE_ZLIB ON) | ||||||
|  |     set(HAVE_LIBZ ON) | ||||||
|  |   endif() | ||||||
|  | endif() | ||||||
|  |  | ||||||
|  | # If we have features.h, then do the _BSD_SOURCE magic | ||||||
|  | check_include_file("features.h"       HAVE_FEATURES_H) | ||||||
|  |  | ||||||
|  | # Check if header file exists and add it to the list. | ||||||
|  | macro(CHECK_INCLUDE_FILE_CONCAT FILE VARIABLE) | ||||||
|  |   check_include_files("${CURL_INCLUDES};${FILE}" ${VARIABLE}) | ||||||
|  |   if(${VARIABLE}) | ||||||
|  |     set(CURL_INCLUDES ${CURL_INCLUDES} ${FILE}) | ||||||
|  |     set(CURL_TEST_DEFINES "${CURL_TEST_DEFINES} -D${VARIABLE}") | ||||||
|  |   endif(${VARIABLE}) | ||||||
|  | endmacro(CHECK_INCLUDE_FILE_CONCAT) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | # Check for header files | ||||||
|  | if(NOT UNIX) | ||||||
|  |   check_include_file_concat("ws2tcpip.h"     HAVE_WS2TCPIP_H) | ||||||
|  |   check_include_file_concat("winsock2.h"     HAVE_WINSOCK2_H) | ||||||
|  | endif(NOT UNIX) | ||||||
|  | check_include_file_concat("stdio.h"          HAVE_STDIO_H) | ||||||
|  | if(NOT UNIX) | ||||||
|  |   check_include_file_concat("windows.h"      HAVE_WINDOWS_H) | ||||||
|  |   check_include_file_concat("winsock.h"      HAVE_WINSOCK_H) | ||||||
|  | endif(NOT UNIX) | ||||||
|  |  | ||||||
|  | check_include_file_concat("inttypes.h"       HAVE_INTTYPES_H) | ||||||
|  | check_include_file_concat("sys/filio.h"      HAVE_SYS_FILIO_H) | ||||||
|  | check_include_file_concat("sys/ioctl.h"      HAVE_SYS_IOCTL_H) | ||||||
|  | check_include_file_concat("sys/param.h"      HAVE_SYS_PARAM_H) | ||||||
|  | check_include_file_concat("sys/poll.h"       HAVE_SYS_POLL_H) | ||||||
|  | check_include_file_concat("sys/resource.h"   HAVE_SYS_RESOURCE_H) | ||||||
|  | check_include_file_concat("sys/select.h"     HAVE_SYS_SELECT_H) | ||||||
|  | check_include_file_concat("sys/socket.h"     HAVE_SYS_SOCKET_H) | ||||||
|  | check_include_file_concat("sys/sockio.h"     HAVE_SYS_SOCKIO_H) | ||||||
|  | check_include_file_concat("sys/stat.h"       HAVE_SYS_STAT_H) | ||||||
|  | check_include_file_concat("sys/time.h"       HAVE_SYS_TIME_H) | ||||||
|  | check_include_file_concat("sys/types.h"      HAVE_SYS_TYPES_H) | ||||||
|  | check_include_file_concat("sys/uio.h"        HAVE_SYS_UIO_H) | ||||||
|  | check_include_file_concat("sys/un.h"         HAVE_SYS_UN_H) | ||||||
|  | check_include_file_concat("sys/utime.h"      HAVE_SYS_UTIME_H) | ||||||
|  | check_include_file_concat("alloca.h"         HAVE_ALLOCA_H) | ||||||
|  | check_include_file_concat("arpa/inet.h"      HAVE_ARPA_INET_H) | ||||||
|  | check_include_file_concat("arpa/tftp.h"      HAVE_ARPA_TFTP_H) | ||||||
|  | check_include_file_concat("assert.h"         HAVE_ASSERT_H) | ||||||
|  | check_include_file_concat("crypto.h"         HAVE_CRYPTO_H) | ||||||
|  | check_include_file_concat("des.h"            HAVE_DES_H) | ||||||
|  | check_include_file_concat("err.h"            HAVE_ERR_H) | ||||||
|  | check_include_file_concat("errno.h"          HAVE_ERRNO_H) | ||||||
|  | check_include_file_concat("fcntl.h"          HAVE_FCNTL_H) | ||||||
|  | check_include_file_concat("gssapi/gssapi.h"  HAVE_GSSAPI_GSSAPI_H) | ||||||
|  | check_include_file_concat("gssapi/gssapi_generic.h" HAVE_GSSAPI_GSSAPI_GENERIC_H) | ||||||
|  | check_include_file_concat("gssapi/gssapi_krb5.h" HAVE_GSSAPI_GSSAPI_KRB5_H) | ||||||
|  | check_include_file_concat("idn-free.h"       HAVE_IDN_FREE_H) | ||||||
|  | check_include_file_concat("ifaddrs.h"        HAVE_IFADDRS_H) | ||||||
|  | check_include_file_concat("io.h"             HAVE_IO_H) | ||||||
|  | check_include_file_concat("krb.h"            HAVE_KRB_H) | ||||||
|  | check_include_file_concat("libgen.h"         HAVE_LIBGEN_H) | ||||||
|  | check_include_file_concat("libssh2.h"        HAVE_LIBSSH2_H) | ||||||
|  | check_include_file_concat("limits.h"         HAVE_LIMITS_H) | ||||||
|  | check_include_file_concat("locale.h"         HAVE_LOCALE_H) | ||||||
|  | check_include_file_concat("net/if.h"         HAVE_NET_IF_H) | ||||||
|  | check_include_file_concat("netdb.h"          HAVE_NETDB_H) | ||||||
|  | check_include_file_concat("netinet/in.h"     HAVE_NETINET_IN_H) | ||||||
|  | check_include_file_concat("netinet/tcp.h"    HAVE_NETINET_TCP_H) | ||||||
|  | check_include_file_concat("openssl/crypto.h" HAVE_OPENSSL_CRYPTO_H) | ||||||
|  | check_include_file_concat("openssl/engine.h" HAVE_OPENSSL_ENGINE_H) | ||||||
|  | check_include_file_concat("openssl/err.h"    HAVE_OPENSSL_ERR_H) | ||||||
|  | check_include_file_concat("openssl/pem.h"    HAVE_OPENSSL_PEM_H) | ||||||
|  | check_include_file_concat("openssl/pkcs12.h" HAVE_OPENSSL_PKCS12_H) | ||||||
|  | check_include_file_concat("openssl/rsa.h"    HAVE_OPENSSL_RSA_H) | ||||||
|  | check_include_file_concat("openssl/ssl.h"    HAVE_OPENSSL_SSL_H) | ||||||
|  | check_include_file_concat("openssl/x509.h"   HAVE_OPENSSL_X509_H) | ||||||
|  | check_include_file_concat("pem.h"            HAVE_PEM_H) | ||||||
|  | check_include_file_concat("poll.h"           HAVE_POLL_H) | ||||||
|  | check_include_file_concat("pwd.h"            HAVE_PWD_H) | ||||||
|  | check_include_file_concat("rsa.h"            HAVE_RSA_H) | ||||||
|  | check_include_file_concat("setjmp.h"         HAVE_SETJMP_H) | ||||||
|  | check_include_file_concat("sgtty.h"          HAVE_SGTTY_H) | ||||||
|  | check_include_file_concat("signal.h"         HAVE_SIGNAL_H) | ||||||
|  | check_include_file_concat("ssl.h"            HAVE_SSL_H) | ||||||
|  | check_include_file_concat("stdbool.h"        HAVE_STDBOOL_H) | ||||||
|  | check_include_file_concat("stdint.h"         HAVE_STDINT_H) | ||||||
|  | check_include_file_concat("stdio.h"          HAVE_STDIO_H) | ||||||
|  | check_include_file_concat("stdlib.h"         HAVE_STDLIB_H) | ||||||
|  | check_include_file_concat("string.h"         HAVE_STRING_H) | ||||||
|  | check_include_file_concat("strings.h"        HAVE_STRINGS_H) | ||||||
|  | check_include_file_concat("stropts.h"        HAVE_STROPTS_H) | ||||||
|  | check_include_file_concat("termio.h"         HAVE_TERMIO_H) | ||||||
|  | check_include_file_concat("termios.h"        HAVE_TERMIOS_H) | ||||||
|  | check_include_file_concat("time.h"           HAVE_TIME_H) | ||||||
|  | check_include_file_concat("tld.h"            HAVE_TLD_H) | ||||||
|  | check_include_file_concat("unistd.h"         HAVE_UNISTD_H) | ||||||
|  | check_include_file_concat("utime.h"          HAVE_UTIME_H) | ||||||
|  | check_include_file_concat("x509.h"           HAVE_X509_H) | ||||||
|  |  | ||||||
|  | check_include_file_concat("process.h"        HAVE_PROCESS_H) | ||||||
|  | check_include_file_concat("stddef.h"         HAVE_STDDEF_H) | ||||||
|  | check_include_file_concat("dlfcn.h"          HAVE_DLFCN_H) | ||||||
|  | check_include_file_concat("malloc.h"         HAVE_MALLOC_H) | ||||||
|  | check_include_file_concat("memory.h"         HAVE_MEMORY_H) | ||||||
|  | check_include_file_concat("ldap.h"           HAVE_LDAP_H) | ||||||
|  | check_include_file_concat("netinet/if_ether.h" HAVE_NETINET_IF_ETHER_H) | ||||||
|  | check_include_file_concat("stdint.h"        HAVE_STDINT_H) | ||||||
|  | check_include_file_concat("sockio.h"        HAVE_SOCKIO_H) | ||||||
|  | check_include_file_concat("sys/utsname.h"   HAVE_SYS_UTSNAME_H) | ||||||
|  | check_include_file_concat("idna.h"          HAVE_IDNA_H) | ||||||
|  |  | ||||||
|  | if(CMAKE_USE_OPENSSL) | ||||||
|  |   check_include_file_concat("openssl/rand.h"   HAVE_OPENSSL_RAND_H) | ||||||
|  | endif(CMAKE_USE_OPENSSL) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | check_type_size(size_t  SIZEOF_SIZE_T) | ||||||
|  | check_type_size(ssize_t  SIZEOF_SSIZE_T) | ||||||
|  | check_type_size("long long"  SIZEOF_LONG_LONG) | ||||||
|  | check_type_size("long"  SIZEOF_LONG) | ||||||
|  | check_type_size("int"  SIZEOF_INT) | ||||||
|  | check_type_size("__int64"  SIZEOF___INT64) | ||||||
|  | check_type_size("long double"  SIZEOF_LONG_DOUBLE) | ||||||
|  | check_type_size("time_t"  SIZEOF_TIME_T) | ||||||
|  | if(NOT HAVE_SIZEOF_SSIZE_T) | ||||||
|  |   if(SIZEOF_LONG EQUAL SIZEOF_SIZE_T) | ||||||
|  |     set(ssize_t long) | ||||||
|  |   endif(SIZEOF_LONG EQUAL SIZEOF_SIZE_T) | ||||||
|  |   if(NOT ssize_t AND SIZEOF___INT64 EQUAL SIZEOF_SIZE_T) | ||||||
|  |     set(ssize_t __int64) | ||||||
|  |   endif(NOT ssize_t AND SIZEOF___INT64 EQUAL SIZEOF_SIZE_T) | ||||||
|  | endif(NOT HAVE_SIZEOF_SSIZE_T) | ||||||
|  |  | ||||||
|  | # Different sizeofs, etc. | ||||||
|  |  | ||||||
|  | #    define CURL_SIZEOF_LONG        4 | ||||||
|  | #    define CURL_TYPEOF_CURL_OFF_T  long long | ||||||
|  | #    define CURL_FORMAT_CURL_OFF_T  "lld" | ||||||
|  | #    define CURL_FORMAT_CURL_OFF_TU "llu" | ||||||
|  | #    define CURL_FORMAT_OFF_T       "%lld" | ||||||
|  | #    define CURL_SIZEOF_CURL_OFF_T  8 | ||||||
|  | #    define CURL_SUFFIX_CURL_OFF_T  LL | ||||||
|  | #    define CURL_SUFFIX_CURL_OFF_TU ULL | ||||||
|  |  | ||||||
|  | set(CURL_SIZEOF_LONG ${SIZEOF_LONG}) | ||||||
|  |  | ||||||
|  | if(SIZEOF_LONG EQUAL 8) | ||||||
|  |   set(CURL_TYPEOF_CURL_OFF_T long) | ||||||
|  |   set(CURL_SIZEOF_CURL_OFF_T 8) | ||||||
|  |   set(CURL_FORMAT_CURL_OFF_T "ld") | ||||||
|  |   set(CURL_FORMAT_CURL_OFF_TU "lu") | ||||||
|  |   set(CURL_FORMAT_OFF_T "%ld") | ||||||
|  |   set(CURL_SUFFIX_CURL_OFF_T L) | ||||||
|  |   set(CURL_SUFFIX_CURL_OFF_TU LU) | ||||||
|  | endif(SIZEOF_LONG EQUAL 8) | ||||||
|  |  | ||||||
|  | if(SIZEOF_LONG_LONG EQUAL 8) | ||||||
|  |   set(CURL_TYPEOF_CURL_OFF_T "long long") | ||||||
|  |   set(CURL_SIZEOF_CURL_OFF_T 8) | ||||||
|  |   set(CURL_FORMAT_CURL_OFF_T "lld") | ||||||
|  |   set(CURL_FORMAT_CURL_OFF_TU "llu") | ||||||
|  |   set(CURL_FORMAT_OFF_T "%lld") | ||||||
|  |   set(CURL_SUFFIX_CURL_OFF_T LL) | ||||||
|  |   set(CURL_SUFFIX_CURL_OFF_TU LLU) | ||||||
|  | endif(SIZEOF_LONG_LONG EQUAL 8) | ||||||
|  |  | ||||||
|  | if(NOT CURL_TYPEOF_CURL_OFF_T) | ||||||
|  |   set(CURL_TYPEOF_CURL_OFF_T ${ssize_t}) | ||||||
|  |   set(CURL_SIZEOF_CURL_OFF_T ${SIZEOF_SSIZE_T}) | ||||||
|  |   # TODO: need adjustment here. | ||||||
|  |   set(CURL_FORMAT_CURL_OFF_T "ld") | ||||||
|  |   set(CURL_FORMAT_CURL_OFF_TU "lu") | ||||||
|  |   set(CURL_FORMAT_OFF_T "%ld") | ||||||
|  |   set(CURL_SUFFIX_CURL_OFF_T L) | ||||||
|  |   set(CURL_SUFFIX_CURL_OFF_TU LU) | ||||||
|  | endif(NOT CURL_TYPEOF_CURL_OFF_T) | ||||||
|  |  | ||||||
|  | if(HAVE_SIZEOF_LONG_LONG) | ||||||
|  |   set(HAVE_LONGLONG 1) | ||||||
|  |   set(HAVE_LL 1) | ||||||
|  | endif(HAVE_SIZEOF_LONG_LONG) | ||||||
|  |  | ||||||
|  | find_file(RANDOM_FILE urandom /dev) | ||||||
|  | mark_as_advanced(RANDOM_FILE) | ||||||
|  |  | ||||||
|  | # Check for some functions that are used | ||||||
|  | check_symbol_exists(basename      "${CURL_INCLUDES}" HAVE_BASENAME) | ||||||
|  | check_symbol_exists(socket        "${CURL_INCLUDES}" HAVE_SOCKET) | ||||||
|  | check_symbol_exists(poll          "${CURL_INCLUDES}" HAVE_POLL) | ||||||
|  | check_symbol_exists(select        "${CURL_INCLUDES}" HAVE_SELECT) | ||||||
|  | check_symbol_exists(strdup        "${CURL_INCLUDES}" HAVE_STRDUP) | ||||||
|  | check_symbol_exists(strstr        "${CURL_INCLUDES}" HAVE_STRSTR) | ||||||
|  | check_symbol_exists(strtok_r      "${CURL_INCLUDES}" HAVE_STRTOK_R) | ||||||
|  | check_symbol_exists(strftime      "${CURL_INCLUDES}" HAVE_STRFTIME) | ||||||
|  | check_symbol_exists(uname         "${CURL_INCLUDES}" HAVE_UNAME) | ||||||
|  | check_symbol_exists(strcasecmp    "${CURL_INCLUDES}" HAVE_STRCASECMP) | ||||||
|  | check_symbol_exists(stricmp       "${CURL_INCLUDES}" HAVE_STRICMP) | ||||||
|  | check_symbol_exists(strcmpi       "${CURL_INCLUDES}" HAVE_STRCMPI) | ||||||
|  | check_symbol_exists(strncmpi      "${CURL_INCLUDES}" HAVE_STRNCMPI) | ||||||
|  | check_symbol_exists(alarm         "${CURL_INCLUDES}" HAVE_ALARM) | ||||||
|  | if(NOT HAVE_STRNCMPI) | ||||||
|  |   set(HAVE_STRCMPI) | ||||||
|  | endif(NOT HAVE_STRNCMPI) | ||||||
|  | check_symbol_exists(gethostbyaddr "${CURL_INCLUDES}" HAVE_GETHOSTBYADDR) | ||||||
|  | check_symbol_exists(gethostbyaddr_r "${CURL_INCLUDES}" HAVE_GETHOSTBYADDR_R) | ||||||
|  | check_symbol_exists(gettimeofday  "${CURL_INCLUDES}" HAVE_GETTIMEOFDAY) | ||||||
|  | check_symbol_exists(inet_addr     "${CURL_INCLUDES}" HAVE_INET_ADDR) | ||||||
|  | check_symbol_exists(inet_ntoa     "${CURL_INCLUDES}" HAVE_INET_NTOA) | ||||||
|  | check_symbol_exists(inet_ntoa_r   "${CURL_INCLUDES}" HAVE_INET_NTOA_R) | ||||||
|  | check_symbol_exists(tcsetattr     "${CURL_INCLUDES}" HAVE_TCSETATTR) | ||||||
|  | check_symbol_exists(tcgetattr     "${CURL_INCLUDES}" HAVE_TCGETATTR) | ||||||
|  | check_symbol_exists(perror        "${CURL_INCLUDES}" HAVE_PERROR) | ||||||
|  | check_symbol_exists(closesocket   "${CURL_INCLUDES}" HAVE_CLOSESOCKET) | ||||||
|  | check_symbol_exists(setvbuf       "${CURL_INCLUDES}" HAVE_SETVBUF) | ||||||
|  | check_symbol_exists(sigsetjmp     "${CURL_INCLUDES}" HAVE_SIGSETJMP) | ||||||
|  | check_symbol_exists(getpass_r     "${CURL_INCLUDES}" HAVE_GETPASS_R) | ||||||
|  | check_symbol_exists(strlcat       "${CURL_INCLUDES}" HAVE_STRLCAT) | ||||||
|  | check_symbol_exists(getpwuid      "${CURL_INCLUDES}" HAVE_GETPWUID) | ||||||
|  | check_symbol_exists(geteuid       "${CURL_INCLUDES}" HAVE_GETEUID) | ||||||
|  | check_symbol_exists(utime         "${CURL_INCLUDES}" HAVE_UTIME) | ||||||
|  | if(CMAKE_USE_OPENSSL) | ||||||
|  |   check_symbol_exists(RAND_status   "${CURL_INCLUDES}" HAVE_RAND_STATUS) | ||||||
|  |   check_symbol_exists(RAND_screen   "${CURL_INCLUDES}" HAVE_RAND_SCREEN) | ||||||
|  |   check_symbol_exists(RAND_egd      "${CURL_INCLUDES}" HAVE_RAND_EGD) | ||||||
|  |   check_symbol_exists(CRYPTO_cleanup_all_ex_data "${CURL_INCLUDES}"  | ||||||
|  |     HAVE_CRYPTO_CLEANUP_ALL_EX_DATA) | ||||||
|  |   if(HAVE_LIBCRYPTO AND HAVE_LIBSSL) | ||||||
|  |     set(USE_OPENSSL 1) | ||||||
|  |     set(USE_SSLEAY 1) | ||||||
|  |   endif(HAVE_LIBCRYPTO AND HAVE_LIBSSL) | ||||||
|  | endif(CMAKE_USE_OPENSSL) | ||||||
|  | check_symbol_exists(gmtime_r      "${CURL_INCLUDES}" HAVE_GMTIME_R) | ||||||
|  | check_symbol_exists(localtime_r   "${CURL_INCLUDES}" HAVE_LOCALTIME_R) | ||||||
|  |  | ||||||
|  | check_symbol_exists(gethostbyname   "${CURL_INCLUDES}" HAVE_GETHOSTBYNAME) | ||||||
|  | check_symbol_exists(gethostbyname_r "${CURL_INCLUDES}" HAVE_GETHOSTBYNAME_R) | ||||||
|  |  | ||||||
|  | check_symbol_exists(signal        "${CURL_INCLUDES}" HAVE_SIGNAL_FUNC) | ||||||
|  | check_symbol_exists(SIGALRM       "${CURL_INCLUDES}" HAVE_SIGNAL_MACRO) | ||||||
|  | if(HAVE_SIGNAL_FUNC AND HAVE_SIGNAL_MACRO) | ||||||
|  |   set(HAVE_SIGNAL 1) | ||||||
|  | endif(HAVE_SIGNAL_FUNC AND HAVE_SIGNAL_MACRO) | ||||||
|  | check_symbol_exists(uname          "${CURL_INCLUDES}" HAVE_UNAME) | ||||||
|  | check_symbol_exists(strtoll        "${CURL_INCLUDES}" HAVE_STRTOLL) | ||||||
|  | check_symbol_exists(_strtoi64      "${CURL_INCLUDES}" HAVE__STRTOI64) | ||||||
|  | check_symbol_exists(strerror_r     "${CURL_INCLUDES}" HAVE_STRERROR_R) | ||||||
|  | check_symbol_exists(siginterrupt   "${CURL_INCLUDES}" HAVE_SIGINTERRUPT) | ||||||
|  | check_symbol_exists(perror         "${CURL_INCLUDES}" HAVE_PERROR) | ||||||
|  | check_symbol_exists(fork           "${CURL_INCLUDES}" HAVE_FORK) | ||||||
|  | check_symbol_exists(freeaddrinfo   "${CURL_INCLUDES}" HAVE_FREEADDRINFO) | ||||||
|  | check_symbol_exists(freeifaddrs    "${CURL_INCLUDES}" HAVE_FREEIFADDRS) | ||||||
|  | check_symbol_exists(pipe           "${CURL_INCLUDES}" HAVE_PIPE) | ||||||
|  | check_symbol_exists(ftruncate      "${CURL_INCLUDES}" HAVE_FTRUNCATE) | ||||||
|  | check_symbol_exists(getprotobyname "${CURL_INCLUDES}" HAVE_GETPROTOBYNAME) | ||||||
|  | check_symbol_exists(getrlimit      "${CURL_INCLUDES}" HAVE_GETRLIMIT) | ||||||
|  | check_symbol_exists(idn_free       "${CURL_INCLUDES}" HAVE_IDN_FREE) | ||||||
|  | check_symbol_exists(idna_strerror  "${CURL_INCLUDES}" HAVE_IDNA_STRERROR) | ||||||
|  | check_symbol_exists(tld_strerror   "${CURL_INCLUDES}" HAVE_TLD_STRERROR) | ||||||
|  | check_symbol_exists(setlocale      "${CURL_INCLUDES}" HAVE_SETLOCALE) | ||||||
|  | check_symbol_exists(setrlimit      "${CURL_INCLUDES}" HAVE_SETRLIMIT) | ||||||
|  | check_symbol_exists(fcntl          "${CURL_INCLUDES}" HAVE_FCNTL) | ||||||
|  | check_symbol_exists(ioctl          "${CURL_INCLUDES}" HAVE_IOCTL) | ||||||
|  | check_symbol_exists(setsockopt     "${CURL_INCLUDES}" HAVE_SETSOCKOPT) | ||||||
|  |  | ||||||
|  | # symbol exists in win32, but function does not. | ||||||
|  | check_function_exists(inet_pton HAVE_INET_PTON) | ||||||
|  |  | ||||||
|  | # sigaction and sigsetjmp are special. Use special mechanism for | ||||||
|  | # detecting those, but only if previous attempt failed. | ||||||
|  | if(HAVE_SIGNAL_H) | ||||||
|  |   check_symbol_exists(sigaction "signal.h" HAVE_SIGACTION) | ||||||
|  | endif(HAVE_SIGNAL_H) | ||||||
|  |  | ||||||
|  | if(NOT HAVE_SIGSETJMP) | ||||||
|  |   if(HAVE_SETJMP_H) | ||||||
|  |     check_symbol_exists(sigsetjmp "setjmp.h" HAVE_MACRO_SIGSETJMP) | ||||||
|  |     if(HAVE_MACRO_SIGSETJMP) | ||||||
|  |       set(HAVE_SIGSETJMP 1) | ||||||
|  |     endif(HAVE_MACRO_SIGSETJMP) | ||||||
|  |   endif(HAVE_SETJMP_H) | ||||||
|  | endif(NOT HAVE_SIGSETJMP) | ||||||
|  |  | ||||||
|  | # If there is no stricmp(), do not allow LDAP to parse URLs | ||||||
|  | if(NOT HAVE_STRICMP) | ||||||
|  |   set(HAVE_LDAP_URL_PARSE 1) | ||||||
|  | endif(NOT HAVE_STRICMP) | ||||||
|  |  | ||||||
|  | # For other curl specific tests, use this macro. | ||||||
|  | macro(CURL_INTERNAL_TEST CURL_TEST) | ||||||
|  |   if("${CURL_TEST}" MATCHES "^${CURL_TEST}$") | ||||||
|  |     set(MACRO_CHECK_FUNCTION_DEFINITIONS  | ||||||
|  |       "-D${CURL_TEST} ${CURL_TEST_DEFINES} ${CMAKE_REQUIRED_FLAGS}") | ||||||
|  |     if(CMAKE_REQUIRED_LIBRARIES) | ||||||
|  |       set(CURL_TEST_ADD_LIBRARIES | ||||||
|  |         "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") | ||||||
|  |     endif(CMAKE_REQUIRED_LIBRARIES) | ||||||
|  |  | ||||||
|  |     message(STATUS "Performing Curl Test ${CURL_TEST}") | ||||||
|  |     try_compile(${CURL_TEST} | ||||||
|  |       ${CMAKE_BINARY_DIR} | ||||||
|  |       ${CMAKE_CURRENT_SOURCE_DIR}/CMake/CurlTests.c | ||||||
|  |       CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} | ||||||
|  |       "${CURL_TEST_ADD_LIBRARIES}" | ||||||
|  |       OUTPUT_VARIABLE OUTPUT) | ||||||
|  |     if(${CURL_TEST}) | ||||||
|  |       set(${CURL_TEST} 1 CACHE INTERNAL "Curl test ${FUNCTION}") | ||||||
|  |       message(STATUS "Performing Curl Test ${CURL_TEST} - Success") | ||||||
|  |       file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log  | ||||||
|  |         "Performing Curl Test ${CURL_TEST} passed with the following output:\n" | ||||||
|  |         "${OUTPUT}\n") | ||||||
|  |     else(${CURL_TEST}) | ||||||
|  |       message(STATUS "Performing Curl Test ${CURL_TEST} - Failed") | ||||||
|  |       set(${CURL_TEST} "" CACHE INTERNAL "Curl test ${FUNCTION}") | ||||||
|  |       file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log  | ||||||
|  |         "Performing Curl Test ${CURL_TEST} failed with the following output:\n" | ||||||
|  |         "${OUTPUT}\n") | ||||||
|  |     endif(${CURL_TEST}) | ||||||
|  |   endif("${CURL_TEST}" MATCHES "^${CURL_TEST}$") | ||||||
|  | endmacro(CURL_INTERNAL_TEST)  | ||||||
|  |  | ||||||
|  | macro(CURL_INTERNAL_TEST_RUN CURL_TEST) | ||||||
|  |   if("${CURL_TEST}_COMPILE" MATCHES "^${CURL_TEST}_COMPILE$") | ||||||
|  |     set(MACRO_CHECK_FUNCTION_DEFINITIONS  | ||||||
|  |       "-D${CURL_TEST} ${CMAKE_REQUIRED_FLAGS}") | ||||||
|  |     if(CMAKE_REQUIRED_LIBRARIES) | ||||||
|  |       set(CURL_TEST_ADD_LIBRARIES | ||||||
|  |         "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") | ||||||
|  |     endif(CMAKE_REQUIRED_LIBRARIES) | ||||||
|  |  | ||||||
|  |     message(STATUS "Performing Curl Test ${CURL_TEST}") | ||||||
|  |     try_run(${CURL_TEST} ${CURL_TEST}_COMPILE | ||||||
|  |       ${CMAKE_BINARY_DIR} | ||||||
|  |       ${CMAKE_CURRENT_SOURCE_DIR}/CMake/CurlTests.c | ||||||
|  |       CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} | ||||||
|  |       "${CURL_TEST_ADD_LIBRARIES}" | ||||||
|  |       OUTPUT_VARIABLE OUTPUT) | ||||||
|  |     if(${CURL_TEST}_COMPILE AND NOT ${CURL_TEST}) | ||||||
|  |       set(${CURL_TEST} 1 CACHE INTERNAL "Curl test ${FUNCTION}") | ||||||
|  |       message(STATUS "Performing Curl Test ${CURL_TEST} - Success") | ||||||
|  |     else(${CURL_TEST}_COMPILE AND NOT ${CURL_TEST}) | ||||||
|  |       message(STATUS "Performing Curl Test ${CURL_TEST} - Failed") | ||||||
|  |       set(${CURL_TEST} "" CACHE INTERNAL "Curl test ${FUNCTION}") | ||||||
|  |       file(APPEND "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log" | ||||||
|  |         "Performing Curl Test ${CURL_TEST} failed with the following output:\n" | ||||||
|  |         "${OUTPUT}") | ||||||
|  |       if(${CURL_TEST}_COMPILE) | ||||||
|  |         file(APPEND  | ||||||
|  |           "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log"  | ||||||
|  |           "There was a problem running this test\n") | ||||||
|  |       endif(${CURL_TEST}_COMPILE) | ||||||
|  |       file(APPEND "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log"  | ||||||
|  |         "\n\n") | ||||||
|  |     endif(${CURL_TEST}_COMPILE AND NOT ${CURL_TEST}) | ||||||
|  |   endif("${CURL_TEST}_COMPILE" MATCHES "^${CURL_TEST}_COMPILE$") | ||||||
|  | endmacro(CURL_INTERNAL_TEST_RUN)  | ||||||
|  |  | ||||||
|  | # Do curl specific tests | ||||||
|  | foreach(CURL_TEST  | ||||||
|  |     HAVE_FCNTL_O_NONBLOCK | ||||||
|  |     HAVE_IOCTLSOCKET | ||||||
|  |     HAVE_IOCTLSOCKET_CAMEL | ||||||
|  |     HAVE_IOCTLSOCKET_CAMEL_FIONBIO | ||||||
|  |     HAVE_IOCTLSOCKET_FIONBIO | ||||||
|  |     HAVE_IOCTL_FIONBIO | ||||||
|  |     HAVE_IOCTL_SIOCGIFADDR | ||||||
|  |     HAVE_SETSOCKOPT_SO_NONBLOCK | ||||||
|  |     HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID | ||||||
|  |     TIME_WITH_SYS_TIME | ||||||
|  |     HAVE_O_NONBLOCK | ||||||
|  |     HAVE_GETHOSTBYADDR_R_5 | ||||||
|  |     HAVE_GETHOSTBYADDR_R_7 | ||||||
|  |     HAVE_GETHOSTBYADDR_R_8 | ||||||
|  |     HAVE_GETHOSTBYADDR_R_5_REENTRANT | ||||||
|  |     HAVE_GETHOSTBYADDR_R_7_REENTRANT | ||||||
|  |     HAVE_GETHOSTBYADDR_R_8_REENTRANT | ||||||
|  |     HAVE_GETHOSTBYNAME_R_3 | ||||||
|  |     HAVE_GETHOSTBYNAME_R_5 | ||||||
|  |     HAVE_GETHOSTBYNAME_R_6 | ||||||
|  |     HAVE_GETHOSTBYNAME_R_3_REENTRANT | ||||||
|  |     HAVE_GETHOSTBYNAME_R_5_REENTRANT | ||||||
|  |     HAVE_GETHOSTBYNAME_R_6_REENTRANT | ||||||
|  |     HAVE_SOCKLEN_T | ||||||
|  |     HAVE_IN_ADDR_T | ||||||
|  |     HAVE_BOOL_T | ||||||
|  |     STDC_HEADERS | ||||||
|  |     RETSIGTYPE_TEST | ||||||
|  |     HAVE_INET_NTOA_R_DECL | ||||||
|  |     HAVE_INET_NTOA_R_DECL_REENTRANT | ||||||
|  |     HAVE_GETADDRINFO | ||||||
|  |     HAVE_FILE_OFFSET_BITS | ||||||
|  |     ) | ||||||
|  |   curl_internal_test(${CURL_TEST}) | ||||||
|  | endforeach(CURL_TEST) | ||||||
|  | if(HAVE_FILE_OFFSET_BITS) | ||||||
|  |   set(_FILE_OFFSET_BITS 64) | ||||||
|  | endif(HAVE_FILE_OFFSET_BITS) | ||||||
|  | foreach(CURL_TEST  | ||||||
|  |     HAVE_GLIBC_STRERROR_R | ||||||
|  |     HAVE_POSIX_STRERROR_R | ||||||
|  |     ) | ||||||
|  |   curl_internal_test_run(${CURL_TEST}) | ||||||
|  | endforeach(CURL_TEST) | ||||||
|  |  | ||||||
|  | # Check for reentrant | ||||||
|  | foreach(CURL_TEST | ||||||
|  |     HAVE_GETHOSTBYADDR_R_5 | ||||||
|  |     HAVE_GETHOSTBYADDR_R_7 | ||||||
|  |     HAVE_GETHOSTBYADDR_R_8 | ||||||
|  |     HAVE_GETHOSTBYNAME_R_3 | ||||||
|  |     HAVE_GETHOSTBYNAME_R_5 | ||||||
|  |     HAVE_GETHOSTBYNAME_R_6 | ||||||
|  |     HAVE_INET_NTOA_R_DECL_REENTRANT) | ||||||
|  |   if(NOT ${CURL_TEST}) | ||||||
|  |     if(${CURL_TEST}_REENTRANT) | ||||||
|  |       set(NEED_REENTRANT 1) | ||||||
|  |     endif(${CURL_TEST}_REENTRANT) | ||||||
|  |   endif(NOT ${CURL_TEST}) | ||||||
|  | endforeach(CURL_TEST) | ||||||
|  |  | ||||||
|  | if(NEED_REENTRANT) | ||||||
|  |   foreach(CURL_TEST | ||||||
|  |       HAVE_GETHOSTBYADDR_R_5 | ||||||
|  |       HAVE_GETHOSTBYADDR_R_7 | ||||||
|  |       HAVE_GETHOSTBYADDR_R_8 | ||||||
|  |       HAVE_GETHOSTBYNAME_R_3 | ||||||
|  |       HAVE_GETHOSTBYNAME_R_5 | ||||||
|  |       HAVE_GETHOSTBYNAME_R_6) | ||||||
|  |     set(${CURL_TEST} 0) | ||||||
|  |     if(${CURL_TEST}_REENTRANT) | ||||||
|  |       set(${CURL_TEST} 1) | ||||||
|  |     endif(${CURL_TEST}_REENTRANT) | ||||||
|  |   endforeach(CURL_TEST) | ||||||
|  | endif(NEED_REENTRANT) | ||||||
|  |  | ||||||
|  | if(HAVE_INET_NTOA_R_DECL_REENTRANT) | ||||||
|  |   set(HAVE_INET_NTOA_R_DECL 1) | ||||||
|  |   set(NEED_REENTRANT 1) | ||||||
|  | endif(HAVE_INET_NTOA_R_DECL_REENTRANT) | ||||||
|  |  | ||||||
|  | # Some other minor tests | ||||||
|  |  | ||||||
|  | if(NOT HAVE_IN_ADDR_T) | ||||||
|  |   set(in_addr_t "unsigned long") | ||||||
|  | endif(NOT HAVE_IN_ADDR_T) | ||||||
|  |  | ||||||
|  | # Fix libz / zlib.h | ||||||
|  |  | ||||||
|  | if(NOT CURL_SPECIAL_LIBZ) | ||||||
|  |   if(NOT HAVE_LIBZ) | ||||||
|  |     set(HAVE_ZLIB_H 0) | ||||||
|  |   endif(NOT HAVE_LIBZ) | ||||||
|  |  | ||||||
|  |   if(NOT HAVE_ZLIB_H) | ||||||
|  |     set(HAVE_LIBZ 0) | ||||||
|  |   endif(NOT HAVE_ZLIB_H) | ||||||
|  | endif(NOT CURL_SPECIAL_LIBZ) | ||||||
|  |  | ||||||
|  | if(_FILE_OFFSET_BITS) | ||||||
|  |   set(_FILE_OFFSET_BITS 64) | ||||||
|  | endif(_FILE_OFFSET_BITS) | ||||||
|  | set(CMAKE_REQUIRED_FLAGS "-D_FILE_OFFSET_BITS=64") | ||||||
|  | set(CMAKE_EXTRA_INCLUDE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/curl/curl.h") | ||||||
|  | check_type_size("curl_off_t" SIZEOF_CURL_OFF_T) | ||||||
|  | set(CMAKE_EXTRA_INCLUDE_FILES) | ||||||
|  | set(CMAKE_REQUIRED_FLAGS) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | # Check for nonblocking | ||||||
|  | set(HAVE_DISABLED_NONBLOCKING 1) | ||||||
|  | if(HAVE_FIONBIO OR  | ||||||
|  |     HAVE_IOCTLSOCKET OR | ||||||
|  |     HAVE_IOCTLSOCKET_CASE OR | ||||||
|  |     HAVE_O_NONBLOCK) | ||||||
|  |   set(HAVE_DISABLED_NONBLOCKING) | ||||||
|  | endif(HAVE_FIONBIO OR  | ||||||
|  |   HAVE_IOCTLSOCKET OR | ||||||
|  |   HAVE_IOCTLSOCKET_CASE OR | ||||||
|  |   HAVE_O_NONBLOCK) | ||||||
|  |  | ||||||
|  | if(RETSIGTYPE_TEST) | ||||||
|  |   set(RETSIGTYPE void) | ||||||
|  | else(RETSIGTYPE_TEST) | ||||||
|  |   set(RETSIGTYPE int) | ||||||
|  | endif(RETSIGTYPE_TEST) | ||||||
|  |  | ||||||
|  | if(CMAKE_COMPILER_IS_GNUCC AND APPLE) | ||||||
|  |   include(CheckCCompilerFlag) | ||||||
|  |   check_c_compiler_flag(-Wno-long-double HAVE_C_FLAG_Wno_long_double) | ||||||
|  |   if(HAVE_C_FLAG_Wno_long_double) | ||||||
|  |     # The Mac version of GCC warns about use of long double.  Disable it. | ||||||
|  |     get_source_file_property(MPRINTF_COMPILE_FLAGS mprintf.c COMPILE_FLAGS) | ||||||
|  |     if(MPRINTF_COMPILE_FLAGS) | ||||||
|  |       set(MPRINTF_COMPILE_FLAGS "${MPRINTF_COMPILE_FLAGS} -Wno-long-double") | ||||||
|  |     else(MPRINTF_COMPILE_FLAGS) | ||||||
|  |       set(MPRINTF_COMPILE_FLAGS "-Wno-long-double") | ||||||
|  |     endif(MPRINTF_COMPILE_FLAGS) | ||||||
|  |     set_source_files_properties(mprintf.c PROPERTIES | ||||||
|  |       COMPILE_FLAGS ${MPRINTF_COMPILE_FLAGS}) | ||||||
|  |   endif(HAVE_C_FLAG_Wno_long_double) | ||||||
|  | endif(CMAKE_COMPILER_IS_GNUCC AND APPLE) | ||||||
|  |  | ||||||
|  | if(HAVE_SOCKLEN_T) | ||||||
|  |   set(CURL_TYPEOF_CURL_SOCKLEN_T "socklen_t") | ||||||
|  |   check_type_size("socklen_t" CURL_SIZEOF_CURL_SOCKLEN_T) | ||||||
|  | else() | ||||||
|  |   set(CURL_TYPEOF_CURL_SOCKLEN_T int) | ||||||
|  |   set(CURL_SIZEOF_CURL_SOCKLEN_T ${SIZEOF_INT}) | ||||||
|  | endif() | ||||||
|  |  | ||||||
|  | include(CMake/OtherTests.cmake) | ||||||
|  |  | ||||||
|  | add_definitions(-DHAVE_CONFIG_H) | ||||||
|  |  | ||||||
|  | # For windows, do not allow the compiler to use default target (Vista). | ||||||
|  | if(WIN32) | ||||||
|  |   add_definitions(-D_WIN32_WINNT=0x0501) | ||||||
|  | endif(WIN32) | ||||||
|  |  | ||||||
|  | if(MSVC) | ||||||
|  |   add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE) | ||||||
|  | endif(MSVC) | ||||||
|  |  | ||||||
|  | # Sets up the dependencies (zlib, OpenSSL, etc.) of a cURL subproject according to options. | ||||||
|  | # TODO This is far to be complete! | ||||||
|  | function(SETUP_CURL_DEPENDENCIES TARGET_NAME) | ||||||
|  |   if(CURL_ZLIB AND ZLIB_FOUND) | ||||||
|  |     include_directories(${ZLIB_INCLUDE_DIR}) | ||||||
|  |   endif() | ||||||
|  |   if(CURL_ZLIB AND ZLIB_FOUND) | ||||||
|  |     target_link_libraries(${TARGET_NAME} ${ZLIB_LIBRARIES}) | ||||||
|  |     #ADD_DEFINITIONS( -DHAVE_ZLIB_H -DHAVE_ZLIB -DHAVE_LIBZ ) | ||||||
|  |   endif() | ||||||
|  |  | ||||||
|  |   if(CMAKE_USE_OPENSSL AND OPENSSL_FOUND) | ||||||
|  |     include_directories(${OPENSSL_INCLUDE_DIR}) | ||||||
|  |   endif() | ||||||
|  |   if(CMAKE_USE_OPENSSL AND CURL_CONFIG_HAS_BEEN_RUN_BEFORE) | ||||||
|  |     target_link_libraries(${TARGET_NAME} ${OPENSSL_LIBRARIES}) | ||||||
|  |     #ADD_DEFINITIONS( -DUSE_SSLEAY ) | ||||||
|  |   endif() | ||||||
|  | endfunction() | ||||||
|  |  | ||||||
|  | # Ugly (but functional) way to include "Makefile.inc" by transforming it (= regenerate it). | ||||||
|  | function(TRANSFORM_MAKEFILE_INC INPUT_FILE OUTPUT_FILE) | ||||||
|  |   file(READ ${INPUT_FILE} MAKEFILE_INC_TEXT) | ||||||
|  |   string(REPLACE "$(top_srcdir)"   "\${CURL_SOURCE_DIR}" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT}) | ||||||
|  |   string(REPLACE "$(top_builddir)" "\${CURL_BINARY_DIR}" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT}) | ||||||
|  |  | ||||||
|  |   string(REGEX REPLACE "\\\\\n" "<22>!<21>" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT}) | ||||||
|  |   string(REGEX REPLACE "([a-zA-Z_][a-zA-Z0-9_]*)[\t ]*=[\t ]*([^\n]*\n)" "SET(\\1 \\2)\n" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT}) | ||||||
|  |   string(REPLACE "<22>!<21>" "\n" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT}) | ||||||
|  |  | ||||||
|  |   string(REGEX REPLACE "\\$\\(([a-zA-Z_][a-zA-Z0-9_]*)\\)" "\${\\1}" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})    # Replace $() with ${} | ||||||
|  |   string(REGEX REPLACE "@([a-zA-Z_][a-zA-Z0-9_]*)@" "\${\\1}" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})    # Replace @@ with ${}, even if that may not be read by CMake scripts. | ||||||
|  |   file(WRITE ${OUTPUT_FILE} ${MAKEFILE_INC_TEXT}) | ||||||
|  |  | ||||||
|  |   ### BUGGY METHOD 1 | ||||||
|  |   # FILE(STRINGS Makefile.inc MAKEFILE_INC_TEXT) | ||||||
|  |   # STRING(REPLACE "# ./lib/Makefile.inc" "" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT}) | ||||||
|  |   # STRING(REPLACE "  " " " MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})    # Replace tabs with spaces | ||||||
|  |  | ||||||
|  |   # #STRING(REGEX MATCH "CSOURCES *=" AAA ${MAKEFILE_INC_TEXT}) | ||||||
|  |   # #MESSAGE(STATUS ${AAA}) | ||||||
|  |  | ||||||
|  |   # STRING(REPLACE "CSOURCES =" "" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT}) | ||||||
|  |   # STRING(REPLACE "HHEADERS =" "" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT}) | ||||||
|  |  | ||||||
|  |   # STRING(REGEX REPLACE "[^ ]+\\.c" "" ${HEADERS_VAR} ${MAKEFILE_INC_TEXT})    # Remove source files and store into headers var | ||||||
|  |   # STRING(REGEX REPLACE "  +" " " ${HEADERS_VAR} ${${HEADERS_VAR}}) | ||||||
|  |   # STRING(REGEX REPLACE " " ";" ${HEADERS_VAR} ${${HEADERS_VAR}}) | ||||||
|  |  | ||||||
|  |   # STRING(REGEX REPLACE "[^ ]+\\.h" "" ${SOURCES_VAR} ${MAKEFILE_INC_TEXT})    # Remove headers and store into source files var | ||||||
|  |   # STRING(REGEX REPLACE "  +" " " ${SOURCES_VAR} ${${SOURCES_VAR}}) | ||||||
|  |   # STRING(REGEX REPLACE " " ";" ${SOURCES_VAR} ${${SOURCES_VAR}}) | ||||||
|  |  | ||||||
|  |   # SET(${HEADERS_VAR} ${${HEADERS_VAR}} PARENT_SCOPE) | ||||||
|  |   # SET(${SOURCES_VAR} ${${SOURCES_VAR}} PARENT_SCOPE) | ||||||
|  |  | ||||||
|  |   ### BUGGY METHOD 2 | ||||||
|  |   # FILE(READ Makefile.inc MAKEFILE_INC_TEXT) | ||||||
|  |   # #STRING(REPLACE "\t" " " MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})    # Replace tabs with spaces | ||||||
|  |   # #STRING(REGEX REPLACE "\n+" "\n" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})    # Remove empty lines (allow a simplification in the script) | ||||||
|  |   # STRING(REGEX REPLACE "([A-Z]+)[\t ]*=[\t ]*" "SET(\\1 " MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT}) | ||||||
|  |   # #STRING(REGEX REPLACE "^(.*)[\t ]*[^\\]$" ")" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT}) | ||||||
|  |   # STRING(REGEX REPLACE "([^\\])\n" "\\1)\n" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT}) | ||||||
|  |   # # STRING(REGEX REPLACE "CSOURCES *=" "SET(libCurl_SRCS " MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT}) | ||||||
|  |   # # STRING(REGEX REPLACE "HHEADERS *=" "SET(libCurl_HEADERS " MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT}) | ||||||
|  |   # FILE(WRITE Makefile.inc.cmake ${MAKEFILE_INC_TEXT}) | ||||||
|  | endfunction() | ||||||
|  |  | ||||||
|  | add_subdirectory(lib) | ||||||
|  | if(BUILD_CURL_EXE) | ||||||
|  |   add_subdirectory(src) | ||||||
|  | endif() | ||||||
|  | if(BUILD_CURL_TESTS) | ||||||
|  |   add_subdirectory(tests) | ||||||
|  | endif() | ||||||
|  |  | ||||||
|  | # This needs to be run very last so other parts of the scripts can take advantage of this. | ||||||
|  | if(NOT CURL_CONFIG_HAS_BEEN_RUN_BEFORE) | ||||||
|  |   set(CURL_CONFIG_HAS_BEEN_RUN_BEFORE 1 CACHE INTERNAL "Flag to track whether this is the first time running CMake or if CMake has been configured before") | ||||||
|  | endif() | ||||||
							
								
								
									
										13
									
								
								CTestConfig.cmake
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								CTestConfig.cmake
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,13 @@ | |||||||
|  | ## This file should be placed in the root directory of your project. | ||||||
|  | ## Then modify the CMakeLists.txt file in the root directory of your | ||||||
|  | ## project to incorporate the testing dashboard. | ||||||
|  | ## # The following are required to uses Dart and the Cdash dashboard | ||||||
|  | ##   ENABLE_TESTING() | ||||||
|  | ##   INCLUDE(Dart) | ||||||
|  | set(CTEST_PROJECT_NAME "CURL") | ||||||
|  | set(CTEST_NIGHTLY_START_TIME "00:00:00 EST") | ||||||
|  |  | ||||||
|  | set(CTEST_DROP_METHOD "http") | ||||||
|  | set(CTEST_DROP_SITE "my.cdash.org") | ||||||
|  | set(CTEST_DROP_LOCATION "/submit.php?project=CURL") | ||||||
|  | set(CTEST_DROP_SITE_CDASH TRUE) | ||||||
| @@ -1,49 +1,78 @@ | |||||||
| #!/bin/bash | #!/bin/bash | ||||||
| # This script performs all of the steps needed to build a 32 bit  | # This script performs all of the steps needed to build a  | ||||||
| # universal binary libcurl.framework for Mac OS X 10.4 or greater. | # universal binary libcurl.framework for Mac OS X 10.4 or greater. | ||||||
|  |  | ||||||
| VERSION=`/usr/bin/sed -ne 's/^#define LIBCURL_VERSION "\(.*\)"/\1/p' include/curl/curlver.h` | VERSION=`/usr/bin/sed -ne 's/^#define LIBCURL_VERSION "\(.*\)"/\1/p' include/curl/curlver.h` | ||||||
|  |  | ||||||
| SDK='/Developer/SDKs/MacOSX10.4u.sdk' | SDK32='/Developer/SDKs/MacOSX10.4u.sdk' | ||||||
|  |  | ||||||
| MINVER='-mmacosx-version-min=10.4' | MINVER32='-mmacosx-version-min=10.4' | ||||||
|  |  | ||||||
| ARCHES='-arch ppc -arch i386' | ARCHES32='-arch ppc -arch i386' | ||||||
|  |  | ||||||
| # Use these values instead to produce a 64 bit framework that only works on 10.5. | SDK64='/Developer/SDKs/MacOSX10.5.sdk' | ||||||
| # You can't currently build a combined 32/64 framework. |  | ||||||
| #SDK='/Developer/SDKs/MacOSX10.5.sdk' |  | ||||||
| # |  | ||||||
| #MINVER='-mmacosx-version-min=10.5' |  | ||||||
| # |  | ||||||
| #ARCHES='-arch ppc64 -arch x86_64' |  | ||||||
|  |  | ||||||
|  | MINVER64='-mmacosx-version-min=10.5' | ||||||
|  |  | ||||||
| if test -d $SDK; then | ARCHES64='-arch ppc64 -arch x86_64' | ||||||
|   echo "Configuring libcurl for 32 bit universal framework..." |  | ||||||
|  | if test -d $SDK32; then | ||||||
|  |   echo "----Configuring libcurl for 32 bit universal framework..." | ||||||
|   ./configure --disable-dependency-tracking --disable-static --with-gssapi \ |   ./configure --disable-dependency-tracking --disable-static --with-gssapi \ | ||||||
|     CFLAGS="-isysroot $SDK $ARCHES $MINVER" \ |     CFLAGS="-Os -isysroot $SDK32 $ARCHES32 $MINVER32" \ | ||||||
|     LDFLAGS="-Wl,-syslibroot,$SDK $ARCHES $MINVER -Wl,-headerpad_max_install_names" |     LDFLAGS="-Wl,-syslibroot,$SDK32 $ARCHES32 $MINVER32 -Wl,-headerpad_max_install_names" \ | ||||||
|  |     CC=$CC | ||||||
|    |    | ||||||
|   echo "Building libcurl..." |   echo "----Building 32 bit libcurl..." | ||||||
|   make |   make | ||||||
|    |    | ||||||
|   echo "Creating framework..." |   echo "----Creating 32 bit framework..." | ||||||
|   rm -r libcurl.framework |   rm -r libcurl.framework | ||||||
|   mkdir -p libcurl.framework/Versions/A/Resources |   mkdir -p libcurl.framework/Versions/A/Resources | ||||||
|   cp lib/.libs/libcurl.dylib libcurl.framework/Versions/A/libcurl |   cp lib/.libs/libcurl.dylib libcurl.framework/Versions/A/libcurl | ||||||
|   install_name_tool -id @executable_path/../Frameworks/libcurl.framework/Versions/A/libcurl libcurl.framework/Versions/A/libcurl |   install_name_tool -id @executable_path/../Frameworks/libcurl.framework/Versions/A/libcurl libcurl.framework/Versions/A/libcurl | ||||||
|   /usr/bin/sed -e "s/7\.12\.3/$VERSION/" lib/libcurl.plist >libcurl.framework/Versions/A/Resources/Info.plist |   /usr/bin/sed -e "s/7\.12\.3/$VERSION/" lib/libcurl.plist >libcurl.framework/Versions/A/Resources/Info.plist | ||||||
|   mkdir -p libcurl.framework/Versions/A/Headers |   mkdir -p libcurl.framework/Versions/A/Headers/curl | ||||||
|   cp include/curl/*.h libcurl.framework/Versions/A/Headers |   cp include/curl/*.h libcurl.framework/Versions/A/Headers/curl | ||||||
|   cd libcurl.framework |   pushd libcurl.framework | ||||||
|   ln -fs Versions/A/libcurl libcurl |   ln -fs Versions/A/libcurl libcurl | ||||||
|   ln -fs Versions/A/Resources Resources |   ln -fs Versions/A/Resources Resources | ||||||
|   ln -fs Versions/A/Headers Headers |   ln -fs Versions/A/Headers Headers | ||||||
|   cd Versions |   cd Versions | ||||||
|   ln -fs A Current |   ln -fs A Current | ||||||
|    |    | ||||||
|  |   if test -d $SDK64; then | ||||||
|  |     popd | ||||||
|  |     make clean | ||||||
|  |     echo "----Configuring libcurl for 64 bit universal framework..." | ||||||
|  |     ./configure --disable-dependency-tracking --disable-static --with-gssapi \ | ||||||
|  |       CFLAGS="-Os -isysroot $SDK64 $ARCHES64 $MINVER64" \ | ||||||
|  |       LDFLAGS="-Wl,-syslibroot,$SDK64 $ARCHES64 $MINVER64 -Wl,-headerpad_max_install_names" \ | ||||||
|  |       CC=$CC | ||||||
|  |    | ||||||
|  |     echo "----Building 64 bit libcurl..." | ||||||
|  |     make | ||||||
|  |    | ||||||
|  |     echo "----Appending 64 bit framework to 32 bit framework..." | ||||||
|  |     cp lib/.libs/libcurl.dylib libcurl.framework/Versions/A/libcurl64 | ||||||
|  |     install_name_tool -id @executable_path/../Frameworks/libcurl.framework/Versions/A/libcurl libcurl.framework/Versions/A/libcurl64 | ||||||
|  |     cp libcurl.framework/Versions/A/libcurl libcurl.framework/Versions/A/libcurl32 | ||||||
|  |     lipo libcurl.framework/Versions/A/libcurl32 libcurl.framework/Versions/A/libcurl64 -create -output libcurl.framework/Versions/A/libcurl | ||||||
|  |     rm libcurl.framework/Versions/A/libcurl32 libcurl.framework/Versions/A/libcurl64 | ||||||
|  |     cp libcurl.framework/Versions/A/Headers/curl/curlbuild.h libcurl.framework/Versions/A/Headers/curl/curlbuild32.h | ||||||
|  |     cp include/curl/curlbuild.h libcurl.framework/Versions/A/Headers/curl/curlbuild64.h | ||||||
|  |     cat >libcurl.framework/Versions/A/Headers/curl/curlbuild.h <<EOF | ||||||
|  | #ifdef __LP64__ | ||||||
|  | #include "curl/curlbuild64.h" | ||||||
|  | #else | ||||||
|  | #include "curl/curlbuild32.h" | ||||||
|  | #endif | ||||||
|  | EOF | ||||||
|  |   fi | ||||||
|  |    | ||||||
|  |   lipo -info libcurl.framework/Versions/A/libcurl | ||||||
|   echo "libcurl.framework is built and can now be included in other projects." |   echo "libcurl.framework is built and can now be included in other projects." | ||||||
|  |   echo "Copy libcurl.framework to your bundle's Contents/Frameworks folder, ~/Library/Frameworks or /Library/Frameworks." | ||||||
| else | else | ||||||
|   echo "Building libcurl.framework requires Mac OS X 10.4 or later with the MacOSX10.4u SDK installed." |   echo "Building libcurl.framework requires Mac OS X 10.4 or later with the MacOSX10.4u SDK installed." | ||||||
| fi | fi | ||||||
|   | |||||||
							
								
								
									
										14
									
								
								Makefile.am
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								Makefile.am
									
									
									
									
									
								
							| @@ -25,9 +25,15 @@ AUTOMAKE_OPTIONS = foreign | |||||||
|  |  | ||||||
| ACLOCAL_AMFLAGS = -I m4 | ACLOCAL_AMFLAGS = -I m4 | ||||||
|  |  | ||||||
| EXTRA_DIST = CHANGES COPYING maketgz Makefile.dist curl-config.in \ | CMAKE_DIST = CMakeLists.txt CMake/CheckTypeSize.c.in CMake/CheckTypeSize.cmake \ | ||||||
|  curl-style.el sample.emacs RELEASE-NOTES buildconf buildconf.bat 	 \ | CMake/CMakeConfigurableFile.in CMake/CurlCheckCSourceCompiles.cmake	       \ | ||||||
|  libcurl.pc.in vc6curl.dsw MacOSX-Framework | CMake/CurlCheckCSourceRuns.cmake CMake/CurlTests.c CMake/FindOpenSSL.cmake     \ | ||||||
|  | CMake/FindZLIB.cmake CMake/OtherTests.cmake CMake/Platforms/WindowsCache.cmake \ | ||||||
|  | CMake/Utilities.cmake include/curl/curlbuild.h.cmake | ||||||
|  |  | ||||||
|  | EXTRA_DIST = CHANGES COPYING maketgz Makefile.dist curl-config.in	\ | ||||||
|  |  curl-style.el sample.emacs RELEASE-NOTES buildconf 	\ | ||||||
|  |  libcurl.pc.in vc6curl.dsw MacOSX-Framework Android.mk $(CMAKE_DIST) | ||||||
|  |  | ||||||
| bin_SCRIPTS = curl-config | bin_SCRIPTS = curl-config | ||||||
|  |  | ||||||
| @@ -40,7 +46,7 @@ pkgconfig_DATA = libcurl.pc | |||||||
| dist-hook: | dist-hook: | ||||||
| 	rm -rf $(top_builddir)/tests/log | 	rm -rf $(top_builddir)/tests/log | ||||||
| 	find $(distdir) -name "*.dist" -exec rm {} \; | 	find $(distdir) -name "*.dist" -exec rm {} \; | ||||||
| 	(distit=`find $(srcdir) -name "*.dist"`; \ | 	(distit=`find $(srcdir) -name "*.dist" | grep -v ./ares/`; \ | ||||||
| 	for file in $$distit; do \ | 	for file in $$distit; do \ | ||||||
| 	  strip=`echo $$file | sed -e s/^$(srcdir)// -e s/\.dist//`; \ | 	  strip=`echo $$file | sed -e s/^$(srcdir)// -e s/\.dist//`; \ | ||||||
| 	  cp $$file $(distdir)$$strip; \ | 	  cp $$file $(distdir)$$strip; \ | ||||||
|   | |||||||
| @@ -130,9 +130,9 @@ vc: | |||||||
|  |  | ||||||
| vc-x64: | vc-x64: | ||||||
| 	cd lib | 	cd lib | ||||||
| 	MACHINE=x64 nmake /f Makefile.$(VC) cfg=release | 	nmake /f Makefile.$(VC) MACHINE=x64 cfg=release | ||||||
| 	cd ..\src | 	cd ..\src | ||||||
| 	MACHINE=x64 nmake /f Makefile.$(VC) | 	nmake /f Makefile.$(VC) MACHINE=x64 cfg=release | ||||||
|  |  | ||||||
| vc-zlib: | vc-zlib: | ||||||
| 	cd lib | 	cd lib | ||||||
| @@ -152,6 +152,12 @@ vc-ssl-zlib: | |||||||
| 	cd ..\src | 	cd ..\src | ||||||
| 	nmake /f Makefile.$(VC) cfg=release-ssl-zlib | 	nmake /f Makefile.$(VC) cfg=release-ssl-zlib | ||||||
|  |  | ||||||
|  | vc-x64-ssl-zlib: | ||||||
|  | 	cd lib | ||||||
|  | 	nmake /f Makefile.$(VC) MACHINE=x64 cfg=release-ssl-zlib | ||||||
|  | 	cd ..\src | ||||||
|  | 	nmake /f Makefile.$(VC) MACHINE=x64 cfg=release-ssl-zlib | ||||||
|  |  | ||||||
| vc-ssl-dll: | vc-ssl-dll: | ||||||
| 	cd lib | 	cd lib | ||||||
| 	nmake /f Makefile.$(VC) cfg=release-ssl-dll | 	nmake /f Makefile.$(VC) cfg=release-ssl-dll | ||||||
|   | |||||||
| @@ -1,57 +1,51 @@ | |||||||
| Curl and libcurl 7.19.4 | Curl and libcurl 7.19.7 | ||||||
|  |  | ||||||
|  Public curl releases:         110 |  Public curl releases:         113 | ||||||
|  Command line options:         132 |  Command line options:         132 | ||||||
|  curl_easy_setopt() options:   163 |  curl_easy_setopt() options:   163 | ||||||
|  Public functions in libcurl:  58 |  Public functions in libcurl:  58 | ||||||
|  Known libcurl bindings:       38 |  Known libcurl bindings:       38 | ||||||
|  Contributors:                 700 |  Contributors:                 732 | ||||||
|  |  | ||||||
| This release includes the following security-related fix: |  | ||||||
|  |  | ||||||
|  o CVE-2009-0037 with the curl advisory here: |  | ||||||
|    http://curl.haxx.se/docs/adv_20090303.html |  | ||||||
|  |  | ||||||
| This release includes the following changes: | This release includes the following changes: | ||||||
|  |  | ||||||
|  o Added CURLOPT_NOPROXY and the corresponding --noproxy |  o -T. is now for non-blocking uploading from stdin | ||||||
|  o the OpenSSL-specific code disables TICKET (rfc5077) which is enabled by |  o SYST handling on FTP for OS/400 FTP server cases | ||||||
|    default in openssl 0.9.8j |  o libcurl refuses to read a single HTTP header longer than 100K | ||||||
|  o Added CURLOPT_TFTP_BLKSIZE |  o added the --crlfile option to curl | ||||||
|  o Added CURLOPT_SOCKS5_GSSAPI_SERVICE and CURLOPT_SOCKS5_GSSAPI_NEC - with |  | ||||||
|    the corresponding curl options --socks5-gssapi-service and |  | ||||||
|    --socks5-gssapi-nec |  | ||||||
|  o Improved IPv6 support when built with with c-ares >= 1.6.1 |  | ||||||
|  o Added CURLPROXY_HTTP_1_0 and --proxy1.0 |  | ||||||
|  o Added docs/libcurl/symbols-in-versions |  | ||||||
|  o Added CURLINFO_CONDITION_UNMET |  | ||||||
|  o Added support for Digest and NTLM authentication using GnuTLS |  | ||||||
|  o CURLOPT_FTP_CREATE_MISSING_DIRS can now be set to 2 to retry the CWD even |  | ||||||
|    when MKD fails |  | ||||||
|  o GnuTLS initing moved to curl_global_init() |  | ||||||
|  o Added CURLOPT_REDIR_PROTOCOLS and CURLOPT_PROTOCOLS |  | ||||||
|  |  | ||||||
| This release includes the following bugfixes: | This release includes the following bugfixes: | ||||||
|  |  | ||||||
|  o missing ssh.obj in VS makefiles |  o The windows makefiles work again | ||||||
|  o FTP ;type=i URLs now work with CURLOPT_PROXY_TRANSFER_MODE in Turkish |  o libcurl-NSS acknowledges verifyhost | ||||||
|    locale  |  o SIGSEGV when pipelined pipe unexpectedly breaks | ||||||
|  o realms with quoted quotation marks in HTTP Digest headers |  o data corruption issue with re-connected transfers | ||||||
|  o VC9 makefiles are now really included |  o use after free if we're completed but easy_conn not NULL (pipelined) | ||||||
|  o multi interface memory leak with CURLMOPT_MAXCONNECTS set |  o missing strdup() return code check | ||||||
|  o CURLINFO_CONTENT_LENGTH_DOWNLOAD size from file:// "transfers" with |  o CURLOPT_PROXY_TRANSFER_MODE could pass along wrong syntax | ||||||
|    CURLOPT_NOBODY set true |  o configure --with-gnutls=PATH fixed | ||||||
|  o memory leak on some libz errors for content encodings |  o ftp response reader bug on failed control connections | ||||||
|  o NSS-enabled build is repaired |  o improved NSS error message on failed host name verifications | ||||||
|  o superfluous wait in SFTP downloads removed |  o ftp NOBODY on re-used connection hang | ||||||
|  o FTP with the multi interface no longer kills the control connection as |  o configure uses pkg-config for cross-compiles as well | ||||||
|    easily on transfer failures |  o improved NSS detection in configure | ||||||
|  o compilation halting when using VS2008 to build a Windows 2000 target |  o cookie expiry date at 1970-jan-1 00:00:00 | ||||||
|  o ease creation of libcurl Mac OS X Framework |  o libcurl-OpenSSL failed to verify some certs with Subject Alternative Name | ||||||
|  o CURLINFO_CONTENT_LENGTH_DOWNLOAD and CURLINFO_CONTENT_LENGTH_UPLOAD are -1 |  o libcurl-OpenSSL can load CRL files with more than one certificate inside | ||||||
|    if unknown |  o received cookies without explicit path got saved wrong if the URL had a | ||||||
|  o Negotiate proxy authentication |    query part | ||||||
|  o CURLOPT_INTERFACE and CURLOPT_LOCALPORT used together |  o don't shrink SO_SNDBUF on windows for those who have it set large already | ||||||
|  |  o connect next bug | ||||||
|  |  o invalid file name characters handling on Windows | ||||||
|  |  o double close() on the primary socket with libcurl-NSS | ||||||
|  |  o GSS negotiate infinite loop on bad credentials | ||||||
|  |  o memory leak in SCP/SFTP connections | ||||||
|  |  o use pkg-config to find out libssh2 installation details in configure | ||||||
|  |  o unparsable cookie expire dates make cookies get treated as session coookies | ||||||
|  |  o POST with Digest authentication and "Transfer-Encoding: chunked" | ||||||
|  |  o SCP connection re-use with wrong auth | ||||||
|  |  o CURLINFO_CONTENT_LENGTH_DOWNLOAD for 0 bytes transfers | ||||||
|  |  o CURLINFO_SIZE_DOWNLOAD for ldap transfers (-w size_download) | ||||||
|  |  | ||||||
| This release includes the following known bugs: | This release includes the following known bugs: | ||||||
|  |  | ||||||
| @@ -60,11 +54,11 @@ This release includes the following known bugs: | |||||||
| This release would not have looked like this without help, code, reports and | This release would not have looked like this without help, code, reports and | ||||||
| advice from friends like these: | advice from friends like these: | ||||||
|  |  | ||||||
|  Lisa Xu, Daniel Fandrich, Craig A West, Alexey Borzov, Sharad Gupta, |  Karl Moerder, Kamil Dudka, Krister Johansen, Andre Guibert de Bruet, | ||||||
|  Peter Sylvester, Chad Monroe, Markus Moeller, Yang Tse, Scott Cantor, |  Michal Marek, Eric Wong, Guenter Knauf, Peter Sylvester, Daniel Johnson, | ||||||
|  Patrick Scott, Hidemoto Nakada, Jocelyn Jaubert, Andre Guibert de Bruet, |  Claes Jakobsson, Sven Anders, Chris Mumford, John P. McCaskey, | ||||||
|  Kamil Dudka, Patrik Thunstrom, Linus Nielsen Feltzing, Mark Incley, |  Constantine Sapuntzakis, Michael Stillwell, Tom Mueller, Dan Fandrich, | ||||||
|  Daniel Johnson, James Cheng, Brian J. Murrell, Senthil Raja Velu, |  Kevin Baughman, John Dennis, Ray Dassen, Johan van Selst, Dima Barsky, | ||||||
|  Markus Koetter, David Kierznowski, Michal Marek |  Liza Alenchery, Gabriel Kuri, Stan van de Burgt, Didier Brisebourg | ||||||
|  |  | ||||||
|         Thanks! (and sorry if I forgot to mention someone) |         Thanks! (and sorry if I forgot to mention someone) | ||||||
|   | |||||||
							
								
								
									
										23
									
								
								TODO-RELEASE
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								TODO-RELEASE
									
									
									
									
									
								
							| @@ -1,11 +1,22 @@ | |||||||
| To be addressed in 7.19.5 (planned release: May 2009) | To be addressed in 7.19.8 (planned release: January 2010) | ||||||
| ========================= | ========================= | ||||||
|  |  | ||||||
| 216 - Markus Moeller's "proxy question" to reverse lookup SOCKS proxys and more | 244 - patch for [out] parameters | ||||||
|  |       http://curl.haxx.se/mail/lib-2009-06/0342.html | ||||||
|  |  | ||||||
| 215 - Patch for Metalink Support (for the curl tool) | 245 - HTTP version getinfo | ||||||
|  |       http://curl.haxx.se/mail/lib-2009-06/0312.html | ||||||
|  |  | ||||||
| 220 - Take advantage of libssh2_version() that's been added for the upcoming | 247 - Using CURLINFO_ERROR in Curl_failf | ||||||
|       1.1, to extract the run-time version number properly. |       http://curl.haxx.se/mail/lib-2009-06/0065.html | ||||||
|  |  | ||||||
|  | 253 - add option to disable SNI for TLS handshakes | ||||||
|  |  | ||||||
|  | 257 - bug #2891595  DNS cache | ||||||
|  |  | ||||||
|  | 258 - bug #2891591  Curl_dns_entry | ||||||
|  |  | ||||||
|  | 259 - Avoding connection re-use when using CURLOPT_HTTPPROXYTUNNEL | ||||||
|  |  | ||||||
|  | 260 - | ||||||
|  |  | ||||||
| 221 -  |  | ||||||
|   | |||||||
							
								
								
									
										535
									
								
								acinclude.m4
									
									
									
									
									
								
							
							
						
						
									
										535
									
								
								acinclude.m4
									
									
									
									
									
								
							| @@ -22,53 +22,6 @@ | |||||||
| #*************************************************************************** | #*************************************************************************** | ||||||
|  |  | ||||||
|  |  | ||||||
| dnl CURL_CHECK_COMPILER_HALT_ON_ERROR |  | ||||||
| dnl ------------------------------------------------- |  | ||||||
| dnl Verifies if the compiler actually halts after the |  | ||||||
| dnl compilation phase without generating any object |  | ||||||
| dnl code file, when the source compiles with errors. |  | ||||||
|  |  | ||||||
| AC_DEFUN([CURL_CHECK_COMPILER_HALT_ON_ERROR], [ |  | ||||||
|   AC_MSG_CHECKING([if compiler halts on compilation errors]) |  | ||||||
|   AC_COMPILE_IFELSE([ |  | ||||||
|     AC_LANG_PROGRAM([[ |  | ||||||
|     ]],[[ |  | ||||||
|       force compilation error |  | ||||||
|     ]]) |  | ||||||
|   ],[ |  | ||||||
|     AC_MSG_RESULT([no]) |  | ||||||
|     AC_MSG_ERROR([compiler does not halt on compilation errors.]) |  | ||||||
|   ],[ |  | ||||||
|     AC_MSG_RESULT([yes]) |  | ||||||
|   ]) |  | ||||||
| ]) |  | ||||||
|  |  | ||||||
|  |  | ||||||
| dnl CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE |  | ||||||
| dnl ------------------------------------------------- |  | ||||||
| dnl Verifies if the compiler actually halts after the |  | ||||||
| dnl compilation phase without generating any object |  | ||||||
| dnl code file, when the source code tries to define a |  | ||||||
| dnl type for a constant array with negative dimension. |  | ||||||
|  |  | ||||||
| AC_DEFUN([CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE], [ |  | ||||||
|   AC_REQUIRE([CURL_CHECK_COMPILER_HALT_ON_ERROR])dnl |  | ||||||
|   AC_MSG_CHECKING([if compiler halts on negative sized arrays]) |  | ||||||
|   AC_COMPILE_IFELSE([ |  | ||||||
|     AC_LANG_PROGRAM([[ |  | ||||||
|       typedef char bad_t[sizeof(char) == sizeof(int) ? -1 : -1 ]; |  | ||||||
|     ]],[[ |  | ||||||
|       bad_t dummy; |  | ||||||
|     ]]) |  | ||||||
|   ],[ |  | ||||||
|     AC_MSG_RESULT([no]) |  | ||||||
|     AC_MSG_ERROR([compiler does not halt on negative sized arrays.]) |  | ||||||
|   ],[ |  | ||||||
|     AC_MSG_RESULT([yes]) |  | ||||||
|   ]) |  | ||||||
| ]) |  | ||||||
|  |  | ||||||
|  |  | ||||||
| dnl CURL_CHECK_DEF (SYMBOL, [INCLUDES], [SILENT]) | dnl CURL_CHECK_DEF (SYMBOL, [INCLUDES], [SILENT]) | ||||||
| dnl ------------------------------------------------- | dnl ------------------------------------------------- | ||||||
| dnl Use the C preprocessor to find out if the given object-style symbol | dnl Use the C preprocessor to find out if the given object-style symbol | ||||||
| @@ -118,6 +71,72 @@ CURL_DEF_TOKEN $1 | |||||||
| ]) | ]) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | dnl CURL_CHECK_DEF_CC (SYMBOL, [INCLUDES], [SILENT]) | ||||||
|  | dnl ------------------------------------------------- | ||||||
|  | dnl Use the C compiler to find out only if the given symbol is defined | ||||||
|  | dnl or not, this can not find out its expansion. This macro will not use | ||||||
|  | dnl default includes even if no INCLUDES argument is given. This macro | ||||||
|  | dnl will run silently when invoked with three arguments. | ||||||
|  |  | ||||||
|  | AC_DEFUN([CURL_CHECK_DEF_CC], [ | ||||||
|  |   AS_VAR_PUSHDEF([ac_HaveDef], [curl_cv_have_def_$1])dnl | ||||||
|  |   ifelse($3,,[AC_MSG_CHECKING([for compiler definition of $1])]) | ||||||
|  |   AC_COMPILE_IFELSE([ | ||||||
|  |     AC_LANG_SOURCE( | ||||||
|  | ifelse($2,,,[$2])[[ | ||||||
|  | int main (void) | ||||||
|  | { | ||||||
|  | #ifdef $1 | ||||||
|  |   return 0; | ||||||
|  | #else | ||||||
|  |   force compilation error | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  |     ]]) | ||||||
|  |   ],[ | ||||||
|  |     tst_symbol_defined="yes" | ||||||
|  |   ],[ | ||||||
|  |     tst_symbol_defined="no" | ||||||
|  |   ]) | ||||||
|  |   if test "$tst_symbol_defined" = "yes"; then | ||||||
|  |     AS_VAR_SET(ac_HaveDef, yes) | ||||||
|  |     ifelse($3,,[AC_MSG_RESULT([yes])]) | ||||||
|  |   else | ||||||
|  |     AS_VAR_SET(ac_HaveDef, no) | ||||||
|  |     ifelse($3,,[AC_MSG_RESULT([no])]) | ||||||
|  |   fi | ||||||
|  |   AS_VAR_POPDEF([ac_HaveDef])dnl | ||||||
|  | ]) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | dnl CURL_CHECK_LIB_XNET | ||||||
|  | dnl ------------------------------------------------- | ||||||
|  | dnl Verify if X/Open network library is required. | ||||||
|  |  | ||||||
|  | AC_DEFUN([CURL_CHECK_LIB_XNET], [ | ||||||
|  |   AC_MSG_CHECKING([if X/Open network library is required]) | ||||||
|  |   tst_lib_xnet_required="no" | ||||||
|  |   AC_COMPILE_IFELSE([ | ||||||
|  |     AC_LANG_SOURCE([[ | ||||||
|  | int main (void) | ||||||
|  | { | ||||||
|  | #if defined(__hpux) && defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 600) | ||||||
|  |   return 0; | ||||||
|  | #elif defined(__hpux) && defined(_XOPEN_SOURCE_EXTENDED) | ||||||
|  |   return 0; | ||||||
|  | #else | ||||||
|  |   force compilation error | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  |     ]]) | ||||||
|  |   ],[ | ||||||
|  |     tst_lib_xnet_required="yes" | ||||||
|  |     LIBS="$LIBS -lxnet" | ||||||
|  |   ]) | ||||||
|  |   AC_MSG_RESULT([$tst_lib_xnet_required]) | ||||||
|  | ]) | ||||||
|  |  | ||||||
|  |  | ||||||
| dnl CURL_CHECK_AIX_ALL_SOURCE | dnl CURL_CHECK_AIX_ALL_SOURCE | ||||||
| dnl ------------------------------------------------- | dnl ------------------------------------------------- | ||||||
| dnl Provides a replacement of traditional AC_AIX with | dnl Provides a replacement of traditional AC_AIX with | ||||||
| @@ -893,91 +912,55 @@ AC_DEFUN([CURL_CHECK_HEADER_MALLOC], [ | |||||||
| ]) | ]) | ||||||
|  |  | ||||||
|  |  | ||||||
| dnl CURL_CHECK_TYPE_SOCKLEN_T | dnl CURL_CHECK_HEADER_MEMORY | ||||||
| dnl ------------------------------------------------- | dnl ------------------------------------------------- | ||||||
| dnl Check for existing socklen_t type, and provide | dnl Check for compilable and valid memory.h header, | ||||||
| dnl an equivalent type if socklen_t not available | dnl and check if it is needed even with stdlib.h for | ||||||
|  | dnl memory related functions. | ||||||
|  |  | ||||||
| AC_DEFUN([CURL_CHECK_TYPE_SOCKLEN_T], [ | AC_DEFUN([CURL_CHECK_HEADER_MEMORY], [ | ||||||
|   AC_REQUIRE([CURL_CHECK_HEADER_WS2TCPIP])dnl |   AC_CACHE_CHECK([for memory.h], [ac_cv_header_memory_h], [ | ||||||
|   AC_CHECK_TYPE([socklen_t], ,[ |     AC_COMPILE_IFELSE([ | ||||||
|     dnl socklen_t not available |       AC_LANG_PROGRAM([[ | ||||||
|     AC_CACHE_CHECK([for socklen_t equivalent], | #include <memory.h> | ||||||
|       [curl_cv_socklen_t_equiv], [ |       ]],[[ | ||||||
|       curl_cv_socklen_t_equiv="unknown" |         void *p = malloc(10); | ||||||
|       for arg1 in 'int' 'SOCKET'; do |         void *q = calloc(10,10); | ||||||
|         for arg2 in "struct sockaddr" void; do |         free(p); | ||||||
|           for t in int size_t unsigned long "unsigned long"; do |         free(q); | ||||||
|             if test "$curl_cv_socklen_t_equiv" = "unknown"; then |       ]]) | ||||||
|               AC_COMPILE_IFELSE([ |     ],[ | ||||||
|                 AC_LANG_PROGRAM([[ |       ac_cv_header_memory_h="yes" | ||||||
| #undef inline |     ],[ | ||||||
| #ifdef HAVE_WINDOWS_H |       ac_cv_header_memory_h="no" | ||||||
| #ifndef WIN32_LEAN_AND_MEAN |  | ||||||
| #define WIN32_LEAN_AND_MEAN |  | ||||||
| #endif |  | ||||||
| #include <windows.h> |  | ||||||
| #ifdef HAVE_WINSOCK2_H |  | ||||||
| #include <winsock2.h> |  | ||||||
| #else |  | ||||||
| #ifdef HAVE_WINSOCK_H |  | ||||||
| #include <winsock.h> |  | ||||||
| #endif |  | ||||||
| #endif |  | ||||||
| #define GETPEERNCALLCONV PASCAL |  | ||||||
| #else |  | ||||||
| #ifdef HAVE_SYS_TYPES_H |  | ||||||
| #include <sys/types.h> |  | ||||||
| #endif |  | ||||||
| #ifdef HAVE_SYS_SOCKET_H |  | ||||||
| #include <sys/socket.h> |  | ||||||
| #endif |  | ||||||
| #define GETPEERNCALLCONV |  | ||||||
| #endif |  | ||||||
|                   extern int GETPEERNCALLCONV getpeername($arg1, $arg2 *, $t *); |  | ||||||
|                 ]],[[ |  | ||||||
|                   $t len=0; |  | ||||||
|                   getpeername(0,0,&len); |  | ||||||
|                 ]]) |  | ||||||
|               ],[ |  | ||||||
|                 curl_cv_socklen_t_equiv="$t" |  | ||||||
|               ]) |  | ||||||
|             fi |  | ||||||
|           done |  | ||||||
|         done |  | ||||||
|       done |  | ||||||
|     ]) |     ]) | ||||||
|     case "$curl_cv_socklen_t_equiv" in |   ]) | ||||||
|       unknown) |   if test "$ac_cv_header_memory_h" = "yes"; then | ||||||
|         AC_MSG_ERROR([Cannot find a type to use in place of socklen_t]) |     AC_DEFINE_UNQUOTED(HAVE_MEMORY_H, 1, | ||||||
|         ;; |       [Define to 1 if you have the memory.h header file.]) | ||||||
|       *) |     # | ||||||
|         AC_DEFINE_UNQUOTED(socklen_t, $curl_cv_socklen_t_equiv, |     AC_COMPILE_IFELSE([ | ||||||
|           [Type to use in place of socklen_t when system does not provide it.]) |       AC_LANG_PROGRAM([[ | ||||||
|  | #include <stdlib.h> | ||||||
|  |       ]],[[ | ||||||
|  |         void *p = malloc(10); | ||||||
|  |         void *q = calloc(10,10); | ||||||
|  |         free(p); | ||||||
|  |         free(q); | ||||||
|  |       ]]) | ||||||
|  |     ],[ | ||||||
|  |       curl_cv_need_header_memory_h="no" | ||||||
|  |     ],[ | ||||||
|  |       curl_cv_need_header_memory_h="yes" | ||||||
|  |     ]) | ||||||
|  |     # | ||||||
|  |     case "$curl_cv_need_header_memory_h" in | ||||||
|  |       yes) | ||||||
|  |         AC_DEFINE_UNQUOTED(NEED_MEMORY_H, 1, | ||||||
|  |           [Define to 1 if you need the memory.h header file even with stdlib.h]) | ||||||
|         ;; |         ;; | ||||||
|     esac |     esac | ||||||
|   ],[ |   fi | ||||||
| #undef inline |  | ||||||
| #ifdef HAVE_WINDOWS_H |  | ||||||
| #ifndef WIN32_LEAN_AND_MEAN |  | ||||||
| #define WIN32_LEAN_AND_MEAN |  | ||||||
| #endif |  | ||||||
| #include <windows.h> |  | ||||||
| #ifdef HAVE_WINSOCK2_H |  | ||||||
| #include <winsock2.h> |  | ||||||
| #ifdef HAVE_WS2TCPIP_H |  | ||||||
| #include <ws2tcpip.h> |  | ||||||
| #endif |  | ||||||
| #endif |  | ||||||
| #else |  | ||||||
| #ifdef HAVE_SYS_TYPES_H |  | ||||||
| #include <sys/types.h> |  | ||||||
| #endif |  | ||||||
| #ifdef HAVE_SYS_SOCKET_H |  | ||||||
| #include <sys/socket.h> |  | ||||||
| #endif |  | ||||||
| #endif |  | ||||||
|   ]) |  | ||||||
| ]) | ]) | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -994,7 +977,6 @@ dnl argument in GETNAMEINFO_QUAL_ARG1. | |||||||
|  |  | ||||||
| AC_DEFUN([CURL_CHECK_FUNC_GETNAMEINFO], [ | AC_DEFUN([CURL_CHECK_FUNC_GETNAMEINFO], [ | ||||||
|   AC_REQUIRE([CURL_CHECK_HEADER_WS2TCPIP])dnl |   AC_REQUIRE([CURL_CHECK_HEADER_WS2TCPIP])dnl | ||||||
|   AC_REQUIRE([CURL_CHECK_TYPE_SOCKLEN_T])dnl |  | ||||||
|   AC_CHECK_HEADERS(sys/types.h sys/socket.h netdb.h) |   AC_CHECK_HEADERS(sys/types.h sys/socket.h netdb.h) | ||||||
|   # |   # | ||||||
|   AC_MSG_CHECKING([for getnameinfo]) |   AC_MSG_CHECKING([for getnameinfo]) | ||||||
| @@ -1870,7 +1852,7 @@ AC_DEFUN([CURL_CHECK_STRUCT_TIMEVAL], [ | |||||||
|   AC_REQUIRE([AC_HEADER_TIME])dnl |   AC_REQUIRE([AC_HEADER_TIME])dnl | ||||||
|   AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl |   AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl | ||||||
|   AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl |   AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl | ||||||
|   AC_CHECK_HEADERS(sys/types.h sys/time.h time.h) |   AC_CHECK_HEADERS(sys/types.h sys/time.h time.h sys/socket.h) | ||||||
|   AC_CACHE_CHECK([for struct timeval], [ac_cv_struct_timeval], [ |   AC_CACHE_CHECK([for struct timeval], [ac_cv_struct_timeval], [ | ||||||
|     AC_COMPILE_IFELSE([ |     AC_COMPILE_IFELSE([ | ||||||
|       AC_LANG_PROGRAM([[ |       AC_LANG_PROGRAM([[ | ||||||
| @@ -1900,6 +1882,9 @@ AC_DEFUN([CURL_CHECK_STRUCT_TIMEVAL], [ | |||||||
| #ifdef HAVE_TIME_H | #ifdef HAVE_TIME_H | ||||||
| #include <time.h> | #include <time.h> | ||||||
| #endif | #endif | ||||||
|  | #endif | ||||||
|  | #ifdef HAVE_SYS_SOCKET_H | ||||||
|  | #include <sys/socket.h> | ||||||
| #endif | #endif | ||||||
|       ]],[[ |       ]],[[ | ||||||
|         struct timeval ts; |         struct timeval ts; | ||||||
| @@ -2217,6 +2202,214 @@ AC_DEFUN([CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC], [ | |||||||
| ]) | ]) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | dnl CURL_CHECK_LIBS_CONNECT | ||||||
|  | dnl ------------------------------------------------- | ||||||
|  | dnl Verify if network connect function is already available | ||||||
|  | dnl using current libraries or if another one is required. | ||||||
|  |  | ||||||
|  | AC_DEFUN([CURL_CHECK_LIBS_CONNECT], [ | ||||||
|  |   AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl | ||||||
|  |   AC_MSG_CHECKING([for connect in libraries]) | ||||||
|  |   tst_connect_save_LIBS="$LIBS" | ||||||
|  |   tst_connect_need_LIBS="unknown" | ||||||
|  |   for tst_lib in '' '-lsocket' ; do | ||||||
|  |     if test "$tst_connect_need_LIBS" = "unknown"; then | ||||||
|  |       LIBS="$tst_lib $tst_connect_save_LIBS" | ||||||
|  |       AC_LINK_IFELSE([ | ||||||
|  |         AC_LANG_PROGRAM([[ | ||||||
|  |           $curl_includes_winsock2 | ||||||
|  |           #ifndef HAVE_WINDOWS_H | ||||||
|  |             int connect(int, void*, int); | ||||||
|  |           #endif | ||||||
|  |         ]],[[ | ||||||
|  |           if(0 != connect(0, 0, 0)) | ||||||
|  |             return 1; | ||||||
|  |         ]]) | ||||||
|  |       ],[ | ||||||
|  |         tst_connect_need_LIBS="$tst_lib" | ||||||
|  |       ]) | ||||||
|  |     fi | ||||||
|  |   done | ||||||
|  |   LIBS="$tst_connect_save_LIBS" | ||||||
|  |   # | ||||||
|  |   case X-"$tst_connect_need_LIBS" in | ||||||
|  |     X-unknown) | ||||||
|  |       AC_MSG_RESULT([cannot find connect]) | ||||||
|  |       AC_MSG_ERROR([cannot find connect function in libraries.]) | ||||||
|  |       ;; | ||||||
|  |     X-) | ||||||
|  |       AC_MSG_RESULT([yes]) | ||||||
|  |       ;; | ||||||
|  |     *) | ||||||
|  |       AC_MSG_RESULT([$tst_connect_need_LIBS]) | ||||||
|  |       LIBS="$tst_connect_need_LIBS $tst_connect_save_LIBS" | ||||||
|  |       ;; | ||||||
|  |   esac | ||||||
|  | ]) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | dnl CURL_DEFINE_UNQUOTED (VARIABLE, [VALUE]) | ||||||
|  | dnl ------------------------------------------------- | ||||||
|  | dnl Like AC_DEFINE_UNQUOTED this macro will define a C preprocessor | ||||||
|  | dnl symbol that can be further used in custom template configuration | ||||||
|  | dnl files. This macro, unlike AC_DEFINE_UNQUOTED, does not use a third | ||||||
|  | dnl argument for the description. Symbol definitions done with this | ||||||
|  | dnl macro are intended to be exclusively used in handcrafted *.h.in | ||||||
|  | dnl template files. Contrary to what AC_DEFINE_UNQUOTED does, this one | ||||||
|  | dnl prevents autoheader generation and insertion of symbol template | ||||||
|  | dnl stub and definition into the first configuration header file. Do | ||||||
|  | dnl not use this macro as a replacement for AC_DEFINE_UNQUOTED, each | ||||||
|  | dnl one serves different functional needs. | ||||||
|  |  | ||||||
|  | AC_DEFUN([CURL_DEFINE_UNQUOTED], [ | ||||||
|  | cat >>confdefs.h <<_EOF | ||||||
|  | [@%:@define] $1 ifelse($#, 2, [$2], 1) | ||||||
|  | _EOF | ||||||
|  | ]) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | dnl CURL_CONFIGURE_LONG | ||||||
|  | dnl ------------------------------------------------- | ||||||
|  | dnl Find out the size of long as reported by sizeof() and define | ||||||
|  | dnl CURL_SIZEOF_LONG as appropriate to be used in template file | ||||||
|  | dnl include/curl/curlbuild.h.in to properly configure the library. | ||||||
|  | dnl The size of long is a build time characteristic and as such | ||||||
|  | dnl must be recorded in curlbuild.h | ||||||
|  |  | ||||||
|  | AC_DEFUN([CURL_CONFIGURE_LONG], [ | ||||||
|  |   if test -z "$ac_cv_sizeof_long" || | ||||||
|  |     test "$ac_cv_sizeof_long" -eq "0"; then | ||||||
|  |     AC_MSG_ERROR([cannot find out size of long.]) | ||||||
|  |   fi | ||||||
|  |   CURL_DEFINE_UNQUOTED([CURL_SIZEOF_LONG], [$ac_cv_sizeof_long]) | ||||||
|  | ]) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | dnl CURL_CONFIGURE_CURL_SOCKLEN_T | ||||||
|  | dnl ------------------------------------------------- | ||||||
|  | dnl Find out suitable curl_socklen_t data type definition and size, making | ||||||
|  | dnl appropriate definitions for template file include/curl/curlbuild.h.in | ||||||
|  | dnl to properly configure and use the library. | ||||||
|  | dnl | ||||||
|  | dnl The need for the curl_socklen_t definition arises mainly to properly | ||||||
|  | dnl interface HP-UX systems which on one hand have a typedef'ed socklen_t | ||||||
|  | dnl data type which is 32 or 64-Bit wide depending on the data model being | ||||||
|  | dnl used, and that on the other hand is only actually used when interfacing | ||||||
|  | dnl the X/Open sockets provided in the xnet library. | ||||||
|  |  | ||||||
|  | AC_DEFUN([CURL_CONFIGURE_CURL_SOCKLEN_T], [ | ||||||
|  |   AC_REQUIRE([CURL_INCLUDES_WS2TCPIP])dnl | ||||||
|  |   AC_REQUIRE([CURL_INCLUDES_SYS_SOCKET])dnl | ||||||
|  |   AC_REQUIRE([CURL_PREPROCESS_CALLCONV])dnl | ||||||
|  |   # | ||||||
|  |   AC_MSG_CHECKING([for curl_socklen_t data type]) | ||||||
|  |   curl_typeof_curl_socklen_t="unknown" | ||||||
|  |   for arg1 in int SOCKET; do | ||||||
|  |     for arg2 in 'struct sockaddr' void; do | ||||||
|  |       for t in socklen_t int size_t 'unsigned int' long 'unsigned long' void; do | ||||||
|  |         if test "$curl_typeof_curl_socklen_t" = "unknown"; then | ||||||
|  |           AC_COMPILE_IFELSE([ | ||||||
|  |             AC_LANG_PROGRAM([[ | ||||||
|  |               $curl_includes_ws2tcpip | ||||||
|  |               $curl_includes_sys_socket | ||||||
|  |               $curl_preprocess_callconv | ||||||
|  |               extern int FUNCALLCONV getpeername($arg1, $arg2 *, $t *); | ||||||
|  |             ]],[[ | ||||||
|  |               $t *lenptr = 0; | ||||||
|  |               if(0 != getpeername(0, 0, lenptr)) | ||||||
|  |                 return 1; | ||||||
|  |             ]]) | ||||||
|  |           ],[ | ||||||
|  |             curl_typeof_curl_socklen_t="$t" | ||||||
|  |           ]) | ||||||
|  |         fi | ||||||
|  |       done | ||||||
|  |     done | ||||||
|  |   done | ||||||
|  |   for t in socklen_t int; do | ||||||
|  |     if test "$curl_typeof_curl_socklen_t" = "void"; then | ||||||
|  |       AC_COMPILE_IFELSE([ | ||||||
|  |         AC_LANG_PROGRAM([[ | ||||||
|  |           $curl_includes_sys_socket | ||||||
|  |           typedef $t curl_socklen_t; | ||||||
|  |         ]],[[ | ||||||
|  |           curl_socklen_t dummy; | ||||||
|  |         ]]) | ||||||
|  |       ],[ | ||||||
|  |         curl_typeof_curl_socklen_t="$t" | ||||||
|  |       ]) | ||||||
|  |     fi | ||||||
|  |   done | ||||||
|  |   AC_MSG_RESULT([$curl_typeof_curl_socklen_t]) | ||||||
|  |   if test "$curl_typeof_curl_socklen_t" = "void" || | ||||||
|  |     test "$curl_typeof_curl_socklen_t" = "unknown"; then | ||||||
|  |     AC_MSG_ERROR([cannot find data type for curl_socklen_t.]) | ||||||
|  |   fi | ||||||
|  |   # | ||||||
|  |   AC_MSG_CHECKING([size of curl_socklen_t]) | ||||||
|  |   curl_sizeof_curl_socklen_t="unknown" | ||||||
|  |   curl_pull_headers_socklen_t="unknown" | ||||||
|  |   if test "$ac_cv_header_ws2tcpip_h" = "yes"; then | ||||||
|  |     tst_pull_header_checks='none ws2tcpip' | ||||||
|  |     tst_size_checks='4' | ||||||
|  |   else | ||||||
|  |     tst_pull_header_checks='none systypes syssocket' | ||||||
|  |     tst_size_checks='4 8 2' | ||||||
|  |   fi | ||||||
|  |   for tst_size in $tst_size_checks; do | ||||||
|  |     for tst_pull_headers in $tst_pull_header_checks; do | ||||||
|  |       if test "$curl_sizeof_curl_socklen_t" = "unknown"; then | ||||||
|  |         case $tst_pull_headers in | ||||||
|  |           ws2tcpip) | ||||||
|  |             tmp_includes="$curl_includes_ws2tcpip" | ||||||
|  |             ;; | ||||||
|  |           systypes) | ||||||
|  |             tmp_includes="$curl_includes_sys_types" | ||||||
|  |             ;; | ||||||
|  |           syssocket) | ||||||
|  |             tmp_includes="$curl_includes_sys_socket" | ||||||
|  |             ;; | ||||||
|  |           *) | ||||||
|  |             tmp_includes="" | ||||||
|  |             ;; | ||||||
|  |         esac | ||||||
|  |         AC_COMPILE_IFELSE([ | ||||||
|  |           AC_LANG_PROGRAM([[ | ||||||
|  |             $tmp_includes | ||||||
|  |             typedef $curl_typeof_curl_socklen_t curl_socklen_t; | ||||||
|  |             typedef char dummy_arr[sizeof(curl_socklen_t) == $tst_size ? 1 : -1]; | ||||||
|  |           ]],[[ | ||||||
|  |             curl_socklen_t dummy; | ||||||
|  |           ]]) | ||||||
|  |         ],[ | ||||||
|  |           curl_sizeof_curl_socklen_t="$tst_size" | ||||||
|  |           curl_pull_headers_socklen_t="$tst_pull_headers" | ||||||
|  |         ]) | ||||||
|  |       fi | ||||||
|  |     done | ||||||
|  |   done | ||||||
|  |   AC_MSG_RESULT([$curl_sizeof_curl_socklen_t]) | ||||||
|  |   if test "$curl_sizeof_curl_socklen_t" = "unknown"; then | ||||||
|  |     AC_MSG_ERROR([cannot find out size of curl_socklen_t.]) | ||||||
|  |   fi | ||||||
|  |   # | ||||||
|  |   case $curl_pull_headers_socklen_t in | ||||||
|  |     ws2tcpip) | ||||||
|  |       CURL_DEFINE_UNQUOTED([CURL_PULL_WS2TCPIP_H]) | ||||||
|  |       ;; | ||||||
|  |     systypes) | ||||||
|  |       CURL_DEFINE_UNQUOTED([CURL_PULL_SYS_TYPES_H]) | ||||||
|  |       ;; | ||||||
|  |     syssocket) | ||||||
|  |       CURL_DEFINE_UNQUOTED([CURL_PULL_SYS_TYPES_H]) | ||||||
|  |       CURL_DEFINE_UNQUOTED([CURL_PULL_SYS_SOCKET_H]) | ||||||
|  |       ;; | ||||||
|  |   esac | ||||||
|  |   CURL_DEFINE_UNQUOTED([CURL_TYPEOF_CURL_SOCKLEN_T], [$curl_typeof_curl_socklen_t]) | ||||||
|  |   CURL_DEFINE_UNQUOTED([CURL_SIZEOF_CURL_SOCKLEN_T], [$curl_sizeof_curl_socklen_t]) | ||||||
|  | ]) | ||||||
|  |  | ||||||
|  |  | ||||||
| dnl CURL_CHECK_FUNC_SELECT | dnl CURL_CHECK_FUNC_SELECT | ||||||
| dnl ------------------------------------------------- | dnl ------------------------------------------------- | ||||||
| dnl Test if the socket select() function is available, | dnl Test if the socket select() function is available, | ||||||
| @@ -2640,67 +2833,6 @@ AC_HELP_STRING([--without-ca-path], [Don't use a default CA path]), | |||||||
| ]) | ]) | ||||||
|  |  | ||||||
|  |  | ||||||
| dnl CURL_DEFINE_UNQUOTED (VARIABLE, [VALUE]) |  | ||||||
| dnl ------------------------------------------------- |  | ||||||
| dnl Like AC_DEFINE_UNQUOTED this macro will define a C preprocessor |  | ||||||
| dnl symbol that can be further used in custom template configuration |  | ||||||
| dnl files. This macro, unlike AC_DEFINE_UNQUOTED, does not use a third |  | ||||||
| dnl argument for the description. Symbol definitions done with this |  | ||||||
| dnl macro are intended to be exclusively used in handcrafted *.h.in |  | ||||||
| dnl template files. Contrary to what AC_DEFINE_UNQUOTED does, this one |  | ||||||
| dnl prevents autoheader generation and insertion of symbol template |  | ||||||
| dnl stub and definition into the first configuration header file. Do |  | ||||||
| dnl not use this macro as a replacement for AC_DEFINE_UNQUOTED, each |  | ||||||
| dnl one serves different functional needs. |  | ||||||
|  |  | ||||||
| AC_DEFUN([CURL_DEFINE_UNQUOTED], [ |  | ||||||
| cat >>confdefs.h <<_EOF |  | ||||||
| [@%:@define] $1 ifelse($#, 2, [$2], 1) |  | ||||||
| _EOF |  | ||||||
| ]) |  | ||||||
|  |  | ||||||
|  |  | ||||||
| dnl CURL_INCLUDES_INTTYPES |  | ||||||
| dnl ------------------------------------------------- |  | ||||||
| dnl Set up variable with list of headers that must be |  | ||||||
| dnl included when inttypes.h is to be included. |  | ||||||
|  |  | ||||||
| AC_DEFUN([CURL_INCLUDES_INTTYPES], [ |  | ||||||
| curl_includes_inttypes="\ |  | ||||||
| /* includes start */ |  | ||||||
| #ifdef HAVE_SYS_TYPES_H |  | ||||||
| # include <sys/types.h> |  | ||||||
| #endif |  | ||||||
| #ifdef HAVE_STDINT_H |  | ||||||
| # include <stdint.h> |  | ||||||
| #endif |  | ||||||
| #ifdef HAVE_INTTYPES_H |  | ||||||
| # include <inttypes.h> |  | ||||||
| #endif |  | ||||||
| /* includes end */" |  | ||||||
|   AC_CHECK_HEADERS( |  | ||||||
|     sys/types.h stdint.h inttypes.h, |  | ||||||
|     [], [], [$curl_includes_inttypes]) |  | ||||||
| ]) |  | ||||||
|  |  | ||||||
|  |  | ||||||
| dnl CURL_CONFIGURE_LONG |  | ||||||
| dnl ------------------------------------------------- |  | ||||||
| dnl Find out the size of long as reported by sizeof() and define |  | ||||||
| dnl CURL_SIZEOF_LONG as appropriate to be used in template file |  | ||||||
| dnl include/curl/curlbuild.h.in to properly configure the library. |  | ||||||
| dnl The size of long is a build time characteristic and as such |  | ||||||
| dnl must be recorded in curlbuild.h |  | ||||||
|  |  | ||||||
| AC_DEFUN([CURL_CONFIGURE_LONG], [ |  | ||||||
|   if test -z "$ac_cv_sizeof_long" || |  | ||||||
|     test "$ac_cv_sizeof_long" -eq "0"; then |  | ||||||
|     AC_MSG_ERROR([cannot find out size of long.]) |  | ||||||
|   fi |  | ||||||
|   CURL_DEFINE_UNQUOTED([CURL_SIZEOF_LONG], [$ac_cv_sizeof_long]) |  | ||||||
| ]) |  | ||||||
|  |  | ||||||
|  |  | ||||||
| dnl DO_CURL_OFF_T_CHECK (TYPE, SIZE) | dnl DO_CURL_OFF_T_CHECK (TYPE, SIZE) | ||||||
| dnl ------------------------------------------------- | dnl ------------------------------------------------- | ||||||
| dnl Internal macro for CURL_CONFIGURE_CURL_OFF_T | dnl Internal macro for CURL_CONFIGURE_CURL_OFF_T | ||||||
| @@ -3063,14 +3195,23 @@ dnl ------------------------ | |||||||
| dnl search for the pkg-config tool (if not cross-compiling). Set the PKGCONFIG | dnl search for the pkg-config tool (if not cross-compiling). Set the PKGCONFIG | ||||||
| dnl variable to hold the path to it, or 'no' if not found/present. | dnl variable to hold the path to it, or 'no' if not found/present. | ||||||
| dnl | dnl | ||||||
| dnl If pkg-config is present, check that it has info about the $module or return | dnl If pkg-config is present, check that it has info about the $module or | ||||||
| dnl "no" anyway! | dnl return "no" anyway! | ||||||
| dnl | dnl | ||||||
|  |  | ||||||
| AC_DEFUN([CURL_CHECK_PKGCONFIG], [ | AC_DEFUN([CURL_CHECK_PKGCONFIG], [ | ||||||
|   if test x$cross_compiling != xyes; then |  | ||||||
|     dnl only do pkg-config magic when not cross-compiling |     PKGCONFIG="no" | ||||||
|     AC_PATH_PROG( PKGCONFIG, pkg-config, no, $PATH:/usr/bin:/usr/local/bin) |  | ||||||
|  |     if test x$cross_compiling = xyes; then | ||||||
|  |       dnl see if there's a pkg-specific for this host setup | ||||||
|  |       AC_PATH_PROG( PKGCONFIG, ${host}-pkg-config, no, | ||||||
|  |                     $PATH:/usr/bin:/usr/local/bin) | ||||||
|  |     fi | ||||||
|  |  | ||||||
|  |     if test x$PKGCONFIG = xno; then | ||||||
|  |       AC_PATH_PROG( PKGCONFIG, pkg-config, no, $PATH:/usr/bin:/usr/local/bin) | ||||||
|  |     fi | ||||||
|  |  | ||||||
|     if test x$PKGCONFIG != xno; then |     if test x$PKGCONFIG != xno; then | ||||||
|       AC_MSG_CHECKING([for $1 options with pkg-config]) |       AC_MSG_CHECKING([for $1 options with pkg-config]) | ||||||
| @@ -3085,8 +3226,4 @@ AC_DEFUN([CURL_CHECK_PKGCONFIG], [ | |||||||
|         AC_MSG_RESULT([found]) |         AC_MSG_RESULT([found]) | ||||||
|       fi |       fi | ||||||
|     fi |     fi | ||||||
|  |  | ||||||
|   else |  | ||||||
|     PKGCONFIG="no" |  | ||||||
|   fi |  | ||||||
| ]) | ]) | ||||||
|   | |||||||
| @@ -1,24 +1,33 @@ | |||||||
| configure | *.html | ||||||
| autom4te.cache | *.lo | ||||||
|  | *.pdf | ||||||
|  | .deps | ||||||
|  | .libs | ||||||
| Makefile | Makefile | ||||||
|  | Makefile.in | ||||||
|  | aclocal.m4 | ||||||
|  | acountry | ||||||
| adig | adig | ||||||
| ahost | ahost | ||||||
| config.log | ares_build.h | ||||||
| config.status | ares_config.h | ||||||
| aclocal.m4 | ares_config.h.in | ||||||
| .deps | ares_version.h.dist | ||||||
| Makefile.in | autom4te.cache | ||||||
|  | compile | ||||||
| config.guess | config.guess | ||||||
| config.h | config.h | ||||||
| config.h.in | config.h.in | ||||||
|  | config.log | ||||||
|  | config.lt | ||||||
|  | config.status | ||||||
| config.sub | config.sub | ||||||
| libtool | configure | ||||||
| ltmain.sh |  | ||||||
| stamp-h1 |  | ||||||
| *.lo |  | ||||||
| .libs |  | ||||||
| depcomp | depcomp | ||||||
| libcares.la | libcares.la | ||||||
| missing |  | ||||||
| ares_version.h.dist |  | ||||||
| libcares.pc | libcares.pc | ||||||
|  | libtool | ||||||
|  | ltmain.sh | ||||||
|  | man3 | ||||||
|  | missing | ||||||
|  | stamp-h* | ||||||
|   | |||||||
							
								
								
									
										147
									
								
								ares/CHANGES
									
									
									
									
									
								
							
							
						
						
									
										147
									
								
								ares/CHANGES
									
									
									
									
									
								
							| @@ -1,5 +1,152 @@ | |||||||
|   Changelog for the c-ares project |   Changelog for the c-ares project | ||||||
|  |  | ||||||
|  | * November 2, 2009 (Yang Tse) | ||||||
|  | - Renamed c-ares setup.h to ares_setup.h | ||||||
|  |  | ||||||
|  | * October 31, 2009 (Yang Tse) | ||||||
|  | - Symbol hiding configure options are named now --enable-symbol-hiding | ||||||
|  |   and --disable-symbol-hiding in an attempt to make them less ambiguous. | ||||||
|  |  | ||||||
|  | * October 30, 2009 (Yang Tse) | ||||||
|  | - Many fixes for ares_parse_txt_reply() | ||||||
|  |  | ||||||
|  | * October 29, 2009 (Daniel Stenberg) | ||||||
|  | - Jakub Hrozek added ares_parse_txt_reply() for TXT parsing | ||||||
|  |  | ||||||
|  | * October 29, 2009 (Yang Tse) | ||||||
|  | - Updated MSVC 6.0 workspace and project files that allows building | ||||||
|  |   dynamic and static c-ares libraries in debug and release flavours. | ||||||
|  |   Additionally each of the three sample programs is built against | ||||||
|  |   each of the four possible c-ares libraries, generating all this | ||||||
|  |   a total number of 12 executables and 4 libraries. | ||||||
|  |  | ||||||
|  | * October 28, 2009 (Yang Tse) | ||||||
|  | - Initial step towards the ability to reduce c-ares exported symbols | ||||||
|  |   when built as a shared library based on the 'visibility' attribute | ||||||
|  |   for GNUC and Intel compilers and based on __global for Sun compilers, | ||||||
|  |   taking also in account __declspec function decoration for Win32 and | ||||||
|  |   Symbian DLL's. | ||||||
|  |  | ||||||
|  | * October 27, 2009 (Yang Tse) | ||||||
|  | - Fixed Pelles C Win32 target compilation issues. | ||||||
|  |  | ||||||
|  | * October 23, 2009 (Yang Tse) | ||||||
|  | - John Engelhart noticed an unreleased problem relative to a duplicate | ||||||
|  |   ARES_ECANCELLED error code value and missing error code description. | ||||||
|  |  | ||||||
|  | * October 7, 2009 (Yang Tse) | ||||||
|  | - Overhauled ares__get_hostent() Fixing out of bounds memory overwrite | ||||||
|  |   triggered with malformed /etc/hosts file. Improving parsing of /etc/hosts | ||||||
|  |   file. Validating requested address family. Ensuring that failures always | ||||||
|  |   return a NULL pointer. Adjusting header inclusions. | ||||||
|  |  | ||||||
|  | * October 6, 2009 (Yang Tse) | ||||||
|  | - Fix ssize_t redefinition errors on WIN64 reported by Alexey Simak. | ||||||
|  |  | ||||||
|  | * September 29, 2009 (Yang Tse) | ||||||
|  | - Make configure script also check if _REENTRANT definition is required to | ||||||
|  |   make errno available as a preprocessor macro. | ||||||
|  |  | ||||||
|  | * September 7, 2009 (Yang Tse) | ||||||
|  | - Add T_SRV portability check to ares_parse_srv_reply.c | ||||||
|  |  | ||||||
|  | * 4 Sep 2009 (Daniel Stenberg) | ||||||
|  | - Jakub Hrozek added ares_parse_srv_reply() for SRV parsing | ||||||
|  |  | ||||||
|  | * 3 Aug 2009 (Daniel Stenberg) | ||||||
|  | - Joshua Kwan fixed the init routine to fill in the defaults for stuff that | ||||||
|  |   fails to get inited by other means. This fixes a case of when the c-ares | ||||||
|  |   init fails when internet access is fone. | ||||||
|  |  | ||||||
|  | - Timo Teras changed the reason code used in the resolve callback done when | ||||||
|  |   ares_cancel() is used, to be ARES_ECANCELLED instead of ARES_ETIMEOUT to | ||||||
|  |   better allow the callback to know what's happening. | ||||||
|  |  | ||||||
|  | * 14 Jul 2009 (Guenter Knauf) | ||||||
|  | - renamed generated config.h to ares_config.h to avoid any future clashes | ||||||
|  |   with config.h from other projects. | ||||||
|  |  | ||||||
|  | * June 20 2009 (Yang Tse) | ||||||
|  | - Refactor how libraries are checked for connect() function in configure | ||||||
|  |   script and check for connect() as it is done for other functions. | ||||||
|  |  | ||||||
|  | * June 19 2009 (Yang Tse) | ||||||
|  | - Make sclose() function-like macro definition used to close a socket, | ||||||
|  |   now solely based on HAVE_CLOSESOCKET and HAVE_CLOSESOCKET_CAMEL | ||||||
|  |   config file preprocessor definitions | ||||||
|  |  | ||||||
|  | * June 18 2009 (Yang Tse) | ||||||
|  | - Add CloseSocket camel case function check for configure script. | ||||||
|  |  | ||||||
|  | * June 17 2009 (Yang Tse) | ||||||
|  | - Check for socket() and closesocket() as it is done for other functions | ||||||
|  |   in configure script. | ||||||
|  |  | ||||||
|  | * June 11 2009 (Yang Tse) | ||||||
|  | - Modified buildconf so that when automake runs it copies missing files | ||||||
|  |   instead of symlinking them. | ||||||
|  |  | ||||||
|  | * June 8 2009 (Yang Tse) | ||||||
|  | - Removed buildconf.bat from release and daily snapshot archives. This | ||||||
|  |   file is only for CVS tree checkout builds. | ||||||
|  |  | ||||||
|  | * May 26 2009 (Yang Tse) | ||||||
|  | - Added --enable-curldebug configure option to enable and disable building | ||||||
|  |   with the low-level curl debug memory tracking 'feature' to allow decoupled | ||||||
|  |   setting from --enable-debug, allowing again to build c-ares independently | ||||||
|  |   out of the CVS tree. | ||||||
|  |  | ||||||
|  |   For the c-ares library option --enable-debug enables debug build features | ||||||
|  |   which are _not_ related with memory tracking. For the c-ares library when | ||||||
|  |   --enable-debug is given it does not enable the memory tracking feature. If | ||||||
|  |   you wish to enable the curl debug memory tracking you must use configure | ||||||
|  |   option --enable-curldebug explicitily to do so. | ||||||
|  |  | ||||||
|  |   Internally, definition of preprocessor symbol DEBUGBUILD restricts code | ||||||
|  |   which is only compiled for debug enabled builds. And symbol CURLDEBUG is | ||||||
|  |   used to differentiate code which is _only_ used for memory tracking. | ||||||
|  |  | ||||||
|  |   Make ares_init(), ares_dup() and ares_init_options() fail returning | ||||||
|  |   ARES_ENOTINITIALIZED if library initialization has not been performed | ||||||
|  |   calling ares_library_init(). | ||||||
|  |  | ||||||
|  | * May 20 2009 (Yang Tse) | ||||||
|  | - Added ares_library_init() and ares_library_cleanup() man pages. | ||||||
|  |  | ||||||
|  | * May 19 2009 (Yang Tse) | ||||||
|  | - Introduced ares_library_init() and ares_library_cleanup() functions. | ||||||
|  |  | ||||||
|  |   This is an API and ABI break for Win32/64 systems. Non-Win32/64 build targets | ||||||
|  |   using c-ares 1.6.1 can still survive without calling these functions. Read all | ||||||
|  |   the details on ares_library_init(3) and ares_library_cleanup(3) man pages that | ||||||
|  |   are included. | ||||||
|  |  | ||||||
|  |   curl/libcurl 7.19.5 is fully compatible with c-ares 1.6.1 on all systems. | ||||||
|  |  | ||||||
|  |   In order to use c-ares 1.6.1 with curl/libcurl on Win32/64 systems it is | ||||||
|  |   required that curl/libcurl is 7.19.5 or newer. In other words, it is not | ||||||
|  |   possible on Win32/64 to use c-ares 1.6.1 with a curl/libcurl version less | ||||||
|  |   than 7.19.5 | ||||||
|  |  | ||||||
|  | * May 11 2009 (Daniel Stenberg) | ||||||
|  | - Gregor Jasny made c-ares link with libtool 's -export-symbols-regex option to | ||||||
|  |   only expose functions starting with ares_. | ||||||
|  |  | ||||||
|  | * May 7 2009 (Yang Tse) | ||||||
|  | - Fix an m4 overquoting triggering a spurious 'AS_TR_CPP' symbol definition | ||||||
|  |   attempt in generated config.h | ||||||
|  |  | ||||||
|  | * May 2 2009 (Yang Tse) | ||||||
|  | - Use a build-time configured ares_socklen_t data type instead of socklen_t. | ||||||
|  |  | ||||||
|  | * April 21 2009 (Yang Tse) | ||||||
|  | - Moved potential inclusion of system's malloc.h and memory.h header files to | ||||||
|  |   setup_once.h.  Inclusion of each header file is based on the definition of | ||||||
|  |   NEED_MALLOC_H and NEED_MEMORY_H respectively. | ||||||
|  |  | ||||||
|  | * March 11 2009 (Yang Tse) | ||||||
|  | - Japheth Cleaver fixed acountry.c replacing u_long with unsigned long. | ||||||
|  |  | ||||||
| * February 20 2009 (Yang Tse) | * February 20 2009 (Yang Tse) | ||||||
| - Do not halt compilation when using VS2008 to build a Windows 2000 target. | - Do not halt compilation when using VS2008 to build a Windows 2000 target. | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										7
									
								
								ares/CVS-INFO
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								ares/CVS-INFO
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,7 @@ | |||||||
|  |  | ||||||
|  | CVS-INFO | ||||||
|  |  | ||||||
|  | This file is only present in the CVS - never in release archives. It is used | ||||||
|  | as a sentinel file in buildconf.bat in order to differentiate a CVS checkout | ||||||
|  | from release and daily snapshot archives. | ||||||
|  |  | ||||||
| @@ -14,11 +14,17 @@ ACLOCAL_AMFLAGS = -I m4 | |||||||
| # libcurl, but we do this anyway for convenience. | # libcurl, but we do this anyway for convenience. | ||||||
| # | # | ||||||
| # $(top_builddir)/../include is for libcurl's generated curl/curlbuild.h file | # $(top_builddir)/../include is for libcurl's generated curl/curlbuild.h file | ||||||
| # $(top_builddir) is for c-ares's generated config.h file | # $(top_srcdir)/../include is for libcurl's external include files | ||||||
| # $(top_srcdir) is for c-ares's lib/setup.h and other "c-ares-private" files | # $(top_builddir)/../lib is for libcurl's generated lib/curl_config.h file | ||||||
|  | # $(top_srcdir)/../lib is for libcurl's lib/setup.h and other "private" files | ||||||
|  | # $(top_builddir) is for c-ares's generated ares_config.h file | ||||||
|  | # $(top_srcdir) is for c-ares's ares_setup.h and other "c-ares-private" files | ||||||
|  |  | ||||||
| if CURLDEBUG | if CURLDEBUG | ||||||
| INCLUDES = -I$(top_builddir)/../include \ | INCLUDES = -I$(top_builddir)/../include \ | ||||||
|  |            -I$(top_srcdir)/../include   \ | ||||||
|  |            -I$(top_builddir)/../lib     \ | ||||||
|  |            -I$(top_srcdir)/../lib       \ | ||||||
|            -I$(top_builddir)            \ |            -I$(top_builddir)            \ | ||||||
|            -I$(top_srcdir) |            -I$(top_srcdir) | ||||||
| else | else | ||||||
| @@ -30,10 +36,10 @@ lib_LTLIBRARIES = libcares.la | |||||||
|  |  | ||||||
| man_MANS = $(MANPAGES) | man_MANS = $(MANPAGES) | ||||||
|  |  | ||||||
| MSVCFILES = vc/vc.dsw vc/acountry/acountry.dsp vc/adig/adig.dsp \ | MSVCFILES = vc/vc6aws.dsw vc/acountry/vc6acountry.dsp vc/adig/vc6adig.dsp \ | ||||||
|  vc/ahost/ahost.dsp vc/areslib/areslib.dsp vc/areslib/areslib.dsw |  vc/ahost/vc6ahost.dsp vc/cares/vc6cares.dsp vc/cares/vc6cares.dsw | ||||||
|  |  | ||||||
| if DEBUGBUILD | if CURLDEBUG | ||||||
| PROGS = | PROGS = | ||||||
| else | else | ||||||
| PROGS = ahost adig acountry | PROGS = ahost adig acountry | ||||||
| @@ -46,7 +52,11 @@ noinst_PROGRAMS =$(PROGS) | |||||||
| EXTRA_DIST = AUTHORS CHANGES README.cares Makefile.inc Makefile.dj	   \ | EXTRA_DIST = AUTHORS CHANGES README.cares Makefile.inc Makefile.dj	   \ | ||||||
|  Makefile.m32 Makefile.netware Makefile.vc6 $(man_MANS) $(MSVCFILES)	   \ |  Makefile.m32 Makefile.netware Makefile.vc6 $(man_MANS) $(MSVCFILES)	   \ | ||||||
|  config-win32.h RELEASE-NOTES libcares.pc.in buildconf get_ver.awk maketgz \ |  config-win32.h RELEASE-NOTES libcares.pc.in buildconf get_ver.awk maketgz \ | ||||||
|  TODO |  TODO ares_build.h.in $(PDFPAGES) cares.rc | ||||||
|  |  | ||||||
|  | CLEANFILES = $(PDFPAGES) $(HTMLPAGES) | ||||||
|  |  | ||||||
|  | DISTCLEANFILES = ares_build.h | ||||||
|  |  | ||||||
| pkgconfigdir = $(libdir)/pkgconfig | pkgconfigdir = $(libdir)/pkgconfig | ||||||
| pkgconfig_DATA = libcares.pc | pkgconfig_DATA = libcares.pc | ||||||
| @@ -85,7 +95,6 @@ if NO_UNDEFINED | |||||||
| UNDEF = -no-undefined | UNDEF = -no-undefined | ||||||
| endif | endif | ||||||
|  |  | ||||||
|  |  | ||||||
| libcares_la_LDFLAGS = $(UNDEF) $(VER) | libcares_la_LDFLAGS = $(UNDEF) $(VER) | ||||||
|  |  | ||||||
| # Makefile.inc provides the CSOURCES and HHEADERS defines | # Makefile.inc provides the CSOURCES and HHEADERS defines | ||||||
| @@ -96,16 +105,56 @@ libcares_la_SOURCES = $(CSOURCES) $(HHEADERS) | |||||||
| # where to install the c-ares headers | # where to install the c-ares headers | ||||||
| libcares_ladir = $(includedir) | libcares_ladir = $(includedir) | ||||||
| # what headers to install on 'make install': | # what headers to install on 'make install': | ||||||
| libcares_la_HEADERS = ares.h ares_version.h ares_dns.h | libcares_la_HEADERS = ares.h ares_version.h ares_dns.h \ | ||||||
|  | 	ares_build.h ares_rules.h | ||||||
|  |  | ||||||
| ahost_SOURCES = ahost.c ares_getopt.c ares_getopt.h | ahost_SOURCES = ahost.c ares_getopt.c ares_getopt.h | ||||||
| ahost_LDADD = $(top_builddir)/$(lib_LTLIBRARIES) | ahost_LDADD = $(top_builddir)/libcares.la | ||||||
|  |  | ||||||
| adig_SOURCES = adig.c ares_getopt.c ares_getopt.h | adig_SOURCES = adig.c ares_getopt.c ares_getopt.h | ||||||
| adig_LDADD = $(top_builddir)/$(lib_LTLIBRARIES) | adig_LDADD = $(top_builddir)/libcares.la | ||||||
|  |  | ||||||
| acountry_SOURCES = acountry.c ares_getopt.c ares_getopt.h | acountry_SOURCES = acountry.c ares_getopt.c ares_getopt.h | ||||||
| acountry_LDADD = $(top_builddir)/$(lib_LTLIBRARIES) | acountry_LDADD = $(top_builddir)/libcares.la | ||||||
|  |  | ||||||
|  | SOURCEDMANDIR = man3 | ||||||
|  | SOURCEDMANPAGES = ares_init.3 | ||||||
|  |  | ||||||
|  | clean-local: clean-sourced-manpages | ||||||
|  |  | ||||||
|  | clean-sourced-manpages: | ||||||
|  | 	@srcdmandir='$(SOURCEDMANDIR)'; \ | ||||||
|  | 	echo "rm -rf $(top_builddir)/$$srcdmandir"; \ | ||||||
|  | 	rm -rf $(top_builddir)/$$srcdmandir | ||||||
|  |  | ||||||
|  | sourced-manpages: clean-sourced-manpages | ||||||
|  | 	@srcdmandir='$(SOURCEDMANDIR)'; \ | ||||||
|  | 	srcdmanfiles='$(SOURCEDMANPAGES)'; \ | ||||||
|  | 	mkdir $(top_builddir)/$$srcdmandir; \ | ||||||
|  | 	for file in $$srcdmanfiles; do \ | ||||||
|  | 	  if test -f $(top_srcdir)/$$file; then \ | ||||||
|  | 	    echo "cp $(top_srcdir)/$$file $(top_builddir)/$$srcdmandir/$$file"; \ | ||||||
|  | 	    cp $(top_srcdir)/$$file $(top_builddir)/$$srcdmandir/$$file; \ | ||||||
|  | 	  fi; \ | ||||||
|  | 	done | ||||||
|  |  | ||||||
|  | MAN2HTML = roffit --mandir=. < $< >$@ | ||||||
|  |  | ||||||
|  | SUFFIXES = .3 .html | ||||||
|  |  | ||||||
|  | html: sourced-manpages $(HTMLPAGES) | ||||||
|  |  | ||||||
|  | .3.html: | ||||||
|  | 	$(MAN2HTML) | ||||||
|  |  | ||||||
|  | pdf: sourced-manpages $(PDFPAGES) | ||||||
|  |  | ||||||
|  | .3.pdf: | ||||||
|  | 	@(foo=`echo $@ | sed -e 's/\.[0-9]$$//g'`; \ | ||||||
|  | 	groff -Tps -man $< >$$foo.ps; \ | ||||||
|  | 	ps2pdf $$foo.ps $@; \ | ||||||
|  | 	rm $$foo.ps; \ | ||||||
|  | 	echo "converted $< to $@") | ||||||
|  |  | ||||||
| # Make files named *.dist replace the file without .dist extension | # Make files named *.dist replace the file without .dist extension | ||||||
| dist-hook: | dist-hook: | ||||||
|   | |||||||
| @@ -1,39 +1,22 @@ | |||||||
| # | # | ||||||
| # c-ares Makefile for djgpp/gcc/Watt-32. | # c-ares Makefile for djgpp/gcc/Watt-32. | ||||||
| #   By Gisle Vanem <giva@bgnett.no> 2004. | #   By Gisle Vanem <gvanem@broadpark.no> 2004. | ||||||
| # | # | ||||||
| # $Id$ | # $Id$ | ||||||
|  |  | ||||||
|  |  | ||||||
| TOPDIR = .. | TOPDIR = .. | ||||||
|  |  | ||||||
| include ../packages/DOS/common.dj | DEPEND_PREREQ = ares_config.h | ||||||
|  |  | ||||||
|  | include ../packages/DOS/common.dj | ||||||
| include Makefile.inc | include Makefile.inc | ||||||
|  |  | ||||||
| CFLAGS += -DWATT32 -DHAVE_AF_INET6 -DHAVE_PF_INET6 -DHAVE_IOCTLSOCKET \ | CFLAGS += -DWATT32 -Dselect=select_s | ||||||
|           -DHAVE_IOCTLSOCKET_FIONBIO -DHAVE_STRUCT_IN6_ADDR \ |  | ||||||
|           -DHAVE_SOCKADDR_IN6_SIN6_SCOPE_ID -DHAVE_SYS_TIME_H \ |  | ||||||
|           -DHAVE_STRUCT_SOCKADDR_IN6 -DHAVE_STRUCT_ADDRINFO \ |  | ||||||
|           -DHAVE_ARPA_NAMESER_H -DHAVE_ARPA_INET_H -DHAVE_SYS_SOCKET_H \ |  | ||||||
|           -DHAVE_SYS_UIO_H -DHAVE_NETINET_IN_H -DHAVE_NETINET_TCP_H \ |  | ||||||
|           -DNS_INADDRSZ=4 -DHAVE_RECV -DHAVE_SEND -DHAVE_GETTIMEOFDAY \ |  | ||||||
|           -DSEND_TYPE_ARG1='int'   -DSEND_QUAL_ARG2='const' \ |  | ||||||
|           -DSEND_TYPE_ARG2='void*' -DSEND_TYPE_ARG3='int' \ |  | ||||||
|           -DSEND_TYPE_ARG4='int'   -DSEND_TYPE_RETV='int' \ |  | ||||||
|           -DRECV_TYPE_ARG1='int'   -DRECV_TYPE_ARG2='void*' \ |  | ||||||
|           -DRECV_TYPE_ARG3='int'   -DRECV_TYPE_ARG4='int' \ |  | ||||||
|           -DRECV_TYPE_RETV='int'   -DHAVE_STRUCT_TIMEVAL \ |  | ||||||
|           -Dselect=select_s        -Dsocklen_t=int -UHAVE_CONFIG_H \ |  | ||||||
|           -DRECVFROM_TYPE_ARG1='int' -DRECVFROM_TYPE_ARG2='void' \ |  | ||||||
|           -DRECVFROM_TYPE_ARG3='int' -DRECVFROM_TYPE_ARG4='int' \ |  | ||||||
|           -DRECVFROM_TYPE_ARG6='int' -DRECVFROM_TYPE_RETV='int' \ |  | ||||||
|           -DRECVFROM_TYPE_ARG5='struct sockaddr' -DHAVE_RECVFROM \ |  | ||||||
|           -DRECVFROM_TYPE_ARG2_IS_VOID -DHAVE_STRDUP -DHAVE_NETDB_H \ |  | ||||||
|           -DHAVE_STRCASECMP -DHAVE_STRNCASECMP -DHAVE_GETHOSTNAME |  | ||||||
|  |  | ||||||
| LDFLAGS = -s | LDFLAGS = -s | ||||||
|  |  | ||||||
| ifeq ($(USE_DEBUG),1) | ifeq ($(USE_CURLDEBUG),1) | ||||||
|   EX_LIBS  = ../lib/libcurl.a |   EX_LIBS  = ../lib/libcurl.a | ||||||
|   OBJ_HACK = $(OBJECTS) |   OBJ_HACK = $(OBJECTS) | ||||||
| else | else | ||||||
| @@ -56,12 +39,15 @@ EX_LIBS += $(WATT32_ROOT)/lib/libwatt.a | |||||||
|  |  | ||||||
| OBJECTS = $(addprefix $(OBJ_DIR)/, $(CSOURCES:.c=.o)) | OBJECTS = $(addprefix $(OBJ_DIR)/, $(CSOURCES:.c=.o)) | ||||||
|  |  | ||||||
| all: $(OBJ_DIR) libcares.a ahost.exe adig.exe acountry.exe | all: $(OBJ_DIR) ares_config.h libcares.a ahost.exe adig.exe acountry.exe | ||||||
| 	@echo Welcome to c-ares. | 	@echo Welcome to c-ares. | ||||||
|  |  | ||||||
| libcares.a: $(OBJECTS) | libcares.a: $(OBJECTS) | ||||||
| 	ar rs $@ $? | 	ar rs $@ $? | ||||||
|  |  | ||||||
|  | ares_config.h: config.dos | ||||||
|  | 	$(COPY) $^ $@ | ||||||
|  |  | ||||||
| ahost.exe: ahost.c $(OBJ_DIR)/ares_getopt.o $(OBJ_HACK) | ahost.exe: ahost.c $(OBJ_DIR)/ares_getopt.o $(OBJ_HACK) | ||||||
| 	$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^ $(EX_LIBS) | 	$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^ $(EX_LIBS) | ||||||
|  |  | ||||||
| @@ -71,12 +57,30 @@ adig.exe: adig.c $(OBJ_DIR)/ares_getopt.o $(OBJ_HACK) | |||||||
| acountry.exe: acountry.c $(OBJ_DIR)/ares_getopt.o $(OBJ_HACK) | acountry.exe: acountry.c $(OBJ_DIR)/ares_getopt.o $(OBJ_HACK) | ||||||
| 	$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^ $(EX_LIBS) | 	$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^ $(EX_LIBS) | ||||||
|  |  | ||||||
| clean: | # clean generated files | ||||||
| 	rm -f $(OBJECTS) libcares.a | # | ||||||
|  | genclean: | ||||||
|  | 	- $(DELETE) ares_config.h | ||||||
|  |  | ||||||
| vclean realclean: clean | # clean object files and subdir | ||||||
| 	rm -f ahost.exe adig.exe acountry.exe depend.dj | # | ||||||
| 	- rmdir $(OBJ_DIR) | objclean: genclean | ||||||
|  | 	- $(DELETE) $(OBJ_DIR)$(DS)*.o | ||||||
|  | 	- $(RMDIR) $(OBJ_DIR) | ||||||
|  |  | ||||||
|  | # clean without removing built library and programs | ||||||
|  | # | ||||||
|  | clean: objclean | ||||||
|  | 	- $(DELETE) depend.dj | ||||||
|  |  | ||||||
|  | # clean everything | ||||||
|  | # | ||||||
|  | realclean vclean: clean | ||||||
|  | 	- $(DELETE) libcares.a | ||||||
|  | 	- $(DELETE) acountry.exe | ||||||
|  | 	- $(DELETE) adig.exe | ||||||
|  | 	- $(DELETE) ahost.exe | ||||||
|  | 	- $(DELETE) libcares.a | ||||||
|  |  | ||||||
| -include depend.dj | -include depend.dj | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,23 +1,165 @@ | |||||||
| CSOURCES = ares_fds.c ares_getsock.c ares_process.c ares_free_hostent.c	\ |  | ||||||
| ares_query.c ares__close_sockets.c ares_free_string.c ares_search.c	\ |  | ||||||
| ares__get_hostent.c ares_gethostbyaddr.c ares_send.c ares__read_line.c	\ |  | ||||||
| ares_gethostbyname.c ares_strerror.c ares_cancel.c ares_init.c		\ |  | ||||||
| ares_timeout.c ares_destroy.c ares_mkquery.c ares_version.c		\ |  | ||||||
| ares_expand_name.c ares_parse_a_reply.c windows_port.c ares_strdup.c	\ |  | ||||||
| ares_expand_string.c ares_parse_ptr_reply.c ares_parse_aaaa_reply.c	\ |  | ||||||
| ares_getnameinfo.c inet_net_pton.c bitncmp.c inet_ntop.c ares_writev.c	\ |  | ||||||
| ares_parse_ns_reply.c ares_llist.c ares__timeval.c ares_strcasecmp.c |  | ||||||
|  |  | ||||||
| HHEADERS = ares.h ares_private.h setup.h ares_dns.h ares_version.h          \ | CSOURCES = ares__close_sockets.c	\ | ||||||
|  nameser.h inet_net_pton.h inet_ntop.h ares_ipv6.h bitncmp.h setup_once.h   \ |   ares__get_hostent.c			\ | ||||||
|  ares_llist.h ares_strdup.h ares_strcasecmp.h ares_writev.h |   ares__read_line.c			\ | ||||||
|  |   ares__timeval.c			\ | ||||||
|  |   ares_cancel.c				\ | ||||||
|  |   ares_destroy.c			\ | ||||||
|  |   ares_expand_name.c			\ | ||||||
|  |   ares_expand_string.c			\ | ||||||
|  |   ares_fds.c				\ | ||||||
|  |   ares_free_hostent.c			\ | ||||||
|  |   ares_free_string.c			\ | ||||||
|  |   ares_gethostbyaddr.c			\ | ||||||
|  |   ares_gethostbyname.c			\ | ||||||
|  |   ares_getnameinfo.c			\ | ||||||
|  |   ares_getsock.c			\ | ||||||
|  |   ares_init.c				\ | ||||||
|  |   ares_library_init.c			\ | ||||||
|  |   ares_llist.c				\ | ||||||
|  |   ares_mkquery.c			\ | ||||||
|  |   ares_parse_a_reply.c			\ | ||||||
|  |   ares_parse_aaaa_reply.c		\ | ||||||
|  |   ares_parse_ns_reply.c			\ | ||||||
|  |   ares_parse_ptr_reply.c		\ | ||||||
|  |   ares_parse_srv_reply.c		\ | ||||||
|  |   ares_parse_txt_reply.c		\ | ||||||
|  |   ares_process.c			\ | ||||||
|  |   ares_query.c				\ | ||||||
|  |   ares_search.c				\ | ||||||
|  |   ares_send.c				\ | ||||||
|  |   ares_strcasecmp.c			\ | ||||||
|  |   ares_strdup.c				\ | ||||||
|  |   ares_strerror.c			\ | ||||||
|  |   ares_timeout.c			\ | ||||||
|  |   ares_version.c			\ | ||||||
|  |   ares_writev.c				\ | ||||||
|  |   bitncmp.c				\ | ||||||
|  |   inet_net_pton.c			\ | ||||||
|  |   inet_ntop.c				\ | ||||||
|  |   windows_port.c | ||||||
|  |  | ||||||
|  | HHEADERS = ares.h			\ | ||||||
|  |   ares_build.h				\ | ||||||
|  |   ares_dns.h				\ | ||||||
|  |   ares_ipv6.h				\ | ||||||
|  |   ares_library_init.h			\ | ||||||
|  |   ares_llist.h				\ | ||||||
|  |   ares_private.h			\ | ||||||
|  |   ares_rules.h				\ | ||||||
|  |   ares_strcasecmp.h			\ | ||||||
|  |   ares_strdup.h				\ | ||||||
|  |   ares_version.h			\ | ||||||
|  |   ares_writev.h				\ | ||||||
|  |   bitncmp.h				\ | ||||||
|  |   inet_net_pton.h			\ | ||||||
|  |   inet_ntop.h				\ | ||||||
|  |   nameser.h				\ | ||||||
|  |   ares_setup.h				\ | ||||||
|  |   setup_once.h | ||||||
|  |  | ||||||
|  | MANPAGES = ares_cancel.3		\ | ||||||
|  |   ares_destroy.3			\ | ||||||
|  |   ares_destroy_options.3		\ | ||||||
|  |   ares_dup.3				\ | ||||||
|  |   ares_expand_name.3			\ | ||||||
|  |   ares_expand_string.3			\ | ||||||
|  |   ares_fds.3				\ | ||||||
|  |   ares_free_hostent.3			\ | ||||||
|  |   ares_free_string.3			\ | ||||||
|  |   ares_gethostbyaddr.3			\ | ||||||
|  |   ares_gethostbyname.3			\ | ||||||
|  |   ares_gethostbyname_file.3		\ | ||||||
|  |   ares_getnameinfo.3			\ | ||||||
|  |   ares_getsock.3			\ | ||||||
|  |   ares_init.3				\ | ||||||
|  |   ares_init_options.3			\ | ||||||
|  |   ares_library_cleanup.3		\ | ||||||
|  |   ares_library_init.3			\ | ||||||
|  |   ares_mkquery.3			\ | ||||||
|  |   ares_parse_a_reply.3			\ | ||||||
|  |   ares_parse_aaaa_reply.3		\ | ||||||
|  |   ares_parse_ns_reply.3			\ | ||||||
|  |   ares_parse_ptr_reply.3		\ | ||||||
|  |   ares_parse_srv_reply.3		\ | ||||||
|  |   ares_parse_txt_reply.3		\ | ||||||
|  |   ares_process.3			\ | ||||||
|  |   ares_query.3				\ | ||||||
|  |   ares_save_options.3			\ | ||||||
|  |   ares_search.3				\ | ||||||
|  |   ares_send.3				\ | ||||||
|  |   ares_set_socket_callback.3		\ | ||||||
|  |   ares_strerror.3			\ | ||||||
|  |   ares_timeout.3			\ | ||||||
|  |   ares_version.3 | ||||||
|  |  | ||||||
|  | HTMLPAGES = ares_cancel.html		\ | ||||||
|  |   ares_destroy.html			\ | ||||||
|  |   ares_destroy_options.html		\ | ||||||
|  |   ares_dup.html				\ | ||||||
|  |   ares_expand_name.html			\ | ||||||
|  |   ares_expand_string.html		\ | ||||||
|  |   ares_fds.html				\ | ||||||
|  |   ares_free_hostent.html		\ | ||||||
|  |   ares_free_string.html			\ | ||||||
|  |   ares_gethostbyaddr.html		\ | ||||||
|  |   ares_gethostbyname.html		\ | ||||||
|  |   ares_gethostbyname_file.html		\ | ||||||
|  |   ares_getnameinfo.html			\ | ||||||
|  |   ares_getsock.html			\ | ||||||
|  |   ares_init.html			\ | ||||||
|  |   ares_init_options.html		\ | ||||||
|  |   ares_library_cleanup.html		\ | ||||||
|  |   ares_library_init.html		\ | ||||||
|  |   ares_mkquery.html			\ | ||||||
|  |   ares_parse_a_reply.html		\ | ||||||
|  |   ares_parse_aaaa_reply.html		\ | ||||||
|  |   ares_parse_ns_reply.html		\ | ||||||
|  |   ares_parse_ptr_reply.html		\ | ||||||
|  |   ares_parse_srv_reply.html		\ | ||||||
|  |   ares_parse_txt_reply.html		\ | ||||||
|  |   ares_process.html			\ | ||||||
|  |   ares_query.html			\ | ||||||
|  |   ares_save_options.html		\ | ||||||
|  |   ares_search.html			\ | ||||||
|  |   ares_send.html			\ | ||||||
|  |   ares_set_socket_callback.html		\ | ||||||
|  |   ares_strerror.html			\ | ||||||
|  |   ares_timeout.html			\ | ||||||
|  |   ares_version.html | ||||||
|  |  | ||||||
|  | PDFPAGES = ares_cancel.pdf		\ | ||||||
|  |   ares_destroy.pdf			\ | ||||||
|  |   ares_destroy_options.pdf		\ | ||||||
|  |   ares_dup.pdf				\ | ||||||
|  |   ares_expand_name.pdf			\ | ||||||
|  |   ares_expand_string.pdf		\ | ||||||
|  |   ares_fds.pdf				\ | ||||||
|  |   ares_free_hostent.pdf			\ | ||||||
|  |   ares_free_string.pdf			\ | ||||||
|  |   ares_gethostbyaddr.pdf		\ | ||||||
|  |   ares_gethostbyname.pdf		\ | ||||||
|  |   ares_gethostbyname_file.pdf		\ | ||||||
|  |   ares_getnameinfo.pdf			\ | ||||||
|  |   ares_getsock.pdf			\ | ||||||
|  |   ares_init.pdf				\ | ||||||
|  |   ares_init_options.pdf			\ | ||||||
|  |   ares_library_cleanup.pdf		\ | ||||||
|  |   ares_library_init.pdf			\ | ||||||
|  |   ares_mkquery.pdf			\ | ||||||
|  |   ares_parse_a_reply.pdf		\ | ||||||
|  |   ares_parse_aaaa_reply.pdf		\ | ||||||
|  |   ares_parse_ns_reply.pdf		\ | ||||||
|  |   ares_parse_ptr_reply.pdf		\ | ||||||
|  |   ares_parse_srv_reply.pdf		\ | ||||||
|  |   ares_parse_txt_reply.pdf		\ | ||||||
|  |   ares_process.pdf			\ | ||||||
|  |   ares_query.pdf			\ | ||||||
|  |   ares_save_options.pdf			\ | ||||||
|  |   ares_search.pdf			\ | ||||||
|  |   ares_send.pdf				\ | ||||||
|  |   ares_set_socket_callback.pdf		\ | ||||||
|  |   ares_strerror.pdf			\ | ||||||
|  |   ares_timeout.pdf			\ | ||||||
|  |   ares_version.pdf | ||||||
|  |  | ||||||
| MANPAGES= ares_destroy.3 ares_expand_name.3 ares_expand_string.3 ares_fds.3 \ |  | ||||||
|  ares_free_hostent.3 ares_free_string.3 ares_gethostbyaddr.3		    \ |  | ||||||
|  ares_gethostbyname.3 ares_init.3 ares_init_options.3 ares_mkquery.3	    \ |  | ||||||
|  ares_parse_a_reply.3 ares_parse_ptr_reply.3 ares_process.3		    \ |  | ||||||
|  ares_query.3 ares_search.3 ares_send.3 ares_strerror.3 ares_timeout.3	    \ |  | ||||||
|  ares_version.3 ares_cancel.3 ares_parse_aaaa_reply.3 ares_getnameinfo.3    \ |  | ||||||
|  ares_getsock.3 ares_parse_ns_reply.3 ares_dup.3 \ |  | ||||||
|  ares_destroy_options.3 ares_save_options.3 ares_gethostbyname_file.3       \ |  | ||||||
|  ares_set_socket_callback.3 |  | ||||||
|   | |||||||
| @@ -40,7 +40,7 @@ tags: | |||||||
| %.exe: %.o ares_getopt.o $(LIB) | %.exe: %.o ares_getopt.o $(LIB) | ||||||
| 	$(LD) $(LDFLAGS) -o $@ $^ $(LIBS) | 	$(LD) $(LDFLAGS) -o $@ $^ $(LIBS) | ||||||
|  |  | ||||||
| $(OBJLIB): ares.h ares_dns.h ares_private.h | $(OBJLIB): ares.h ares_dns.h ares_private.h ares_build.h ares_rules.h | ||||||
|  |  | ||||||
| .c.o: | .c.o: | ||||||
| 	$(CC) $(CFLAGS) -c $< | 	$(CC) $(CFLAGS) -c $< | ||||||
| @@ -55,7 +55,8 @@ install: | |||||||
| 	${RANLIB} ${DESTDIR}${libdir}/$(LIB) | 	${RANLIB} ${DESTDIR}${libdir}/$(LIB) | ||||||
| 	chmod u-w ${DESTDIR}${libdir}/$(LIB) | 	chmod u-w ${DESTDIR}${libdir}/$(LIB) | ||||||
| 	${INSTALL} -m 444 ${srcdir}/ares.h ${DESTDIR}${includedir} | 	${INSTALL} -m 444 ${srcdir}/ares.h ${DESTDIR}${includedir} | ||||||
| 	${INSTALL} -m 444 ${srcdir}/ares_version.h ${DESTDIR}${includedir} | 	${INSTALL} -m 444 ${srcdir}/ares_build.h ${DESTDIR}${includedir} | ||||||
|  | 	${INSTALL} -m 444 ${srcdir}/ares_rules.h ${DESTDIR}${includedir} | ||||||
| 	(for man in $(MANPAGES); do \ | 	(for man in $(MANPAGES); do \ | ||||||
| 	   ${INSTALL} -m 444 ${srcdir}/$${man} ${DESTDIR}${mandir}/man3; \ | 	   ${INSTALL} -m 444 ${srcdir}/$${man} ${DESTDIR}${mandir}/man3; \ | ||||||
| 	done) | 	done) | ||||||
|   | |||||||
| @@ -160,7 +160,7 @@ lib: prebuild $(LTARGET) | |||||||
|  |  | ||||||
| nlm: prebuild $(TARGETS) | nlm: prebuild $(TARGETS) | ||||||
|  |  | ||||||
| prebuild: $(OBJDIR) $(OBJDIR)/version.inc config.h | prebuild: $(OBJDIR) ares_build.h $(OBJDIR)/version.inc ares_config.h | ||||||
|  |  | ||||||
| install: $(INSTDIR) all | install: $(INSTDIR) all | ||||||
| 	@$(CP) *.nlm $(INSTDIR) | 	@$(CP) *.nlm $(INSTDIR) | ||||||
| @@ -170,7 +170,7 @@ install: $(INSTDIR) all | |||||||
| 	@$(CP) ../RELEASE-NOTES $(INSTDIR) | 	@$(CP) ../RELEASE-NOTES $(INSTDIR) | ||||||
|  |  | ||||||
| clean: | clean: | ||||||
| 	-$(RM) $(LTARGET) $(TARGETS) config.h | 	-$(RM) $(LTARGET) $(TARGETS) ares_config.h | ||||||
| 	-$(RM) -r $(OBJDIR) | 	-$(RM) -r $(OBJDIR) | ||||||
| 	-$(RM) -r arpa | 	-$(RM) -r arpa | ||||||
|  |  | ||||||
| @@ -269,7 +269,7 @@ ifeq ($(LD),nlmconv) | |||||||
| 	@echo $(DL)output $(notdir $(@:.def=.nlm))$(DL) >> $@ | 	@echo $(DL)output $(notdir $(@:.def=.nlm))$(DL) >> $@ | ||||||
| endif | endif | ||||||
|  |  | ||||||
| config.h: Makefile.netware | ares_config.h: Makefile.netware | ||||||
| 	@echo Creating $@ | 	@echo Creating $@ | ||||||
| 	@echo $(DL)/* $@ for NetWare target.$(DL) > $@ | 	@echo $(DL)/* $@ for NetWare target.$(DL) > $@ | ||||||
| 	@echo $(DL)** Do not edit this file - it is created by make!$(DL) >> $@ | 	@echo $(DL)** Do not edit this file - it is created by make!$(DL) >> $@ | ||||||
| @@ -303,7 +303,6 @@ ifeq ($(LIBARCH),CLIB) | |||||||
| 	@echo $(DL)#define SEND_TYPE_ARG3 int$(DL) >> $@ | 	@echo $(DL)#define SEND_TYPE_ARG3 int$(DL) >> $@ | ||||||
| 	@echo $(DL)#define SEND_TYPE_ARG4 int$(DL) >> $@ | 	@echo $(DL)#define SEND_TYPE_ARG4 int$(DL) >> $@ | ||||||
| 	@echo $(DL)#define SEND_TYPE_RETV int$(DL) >> $@ | 	@echo $(DL)#define SEND_TYPE_RETV int$(DL) >> $@ | ||||||
| 	@echo $(DL)#define socklen_t int$(DL) >> $@ |  | ||||||
| else | else | ||||||
| 	@echo $(DL)#define OS "i586-pc-libc-NetWare"$(DL) >> $@ | 	@echo $(DL)#define OS "i586-pc-libc-NetWare"$(DL) >> $@ | ||||||
| 	@echo $(DL)#define HAVE_DLFCN_H 1$(DL) >> $@ | 	@echo $(DL)#define HAVE_DLFCN_H 1$(DL) >> $@ | ||||||
| @@ -311,7 +310,6 @@ else | |||||||
| 	@echo $(DL)#define HAVE_FTRUNCATE 1$(DL) >> $@ | 	@echo $(DL)#define HAVE_FTRUNCATE 1$(DL) >> $@ | ||||||
| 	@echo $(DL)#define HAVE_GETTIMEOFDAY 1$(DL) >> $@ | 	@echo $(DL)#define HAVE_GETTIMEOFDAY 1$(DL) >> $@ | ||||||
| 	@echo $(DL)#define HAVE_INTTYPES_H 1$(DL) >> $@ | 	@echo $(DL)#define HAVE_INTTYPES_H 1$(DL) >> $@ | ||||||
| 	@echo $(DL)#define HAVE_LIMITS_H 1$(DL) >> $@ |  | ||||||
| 	@echo $(DL)#define HAVE_LONGLONG 1$(DL) >> $@ | 	@echo $(DL)#define HAVE_LONGLONG 1$(DL) >> $@ | ||||||
| 	@echo $(DL)#define HAVE_STDINT_H 1$(DL) >> $@ | 	@echo $(DL)#define HAVE_STDINT_H 1$(DL) >> $@ | ||||||
| 	@echo $(DL)#define HAVE_STRCASECMP 1$(DL) >> $@ | 	@echo $(DL)#define HAVE_STRCASECMP 1$(DL) >> $@ | ||||||
| @@ -361,6 +359,7 @@ endif | |||||||
| 	@echo $(DL)#define HAVE_INET_ADDR 1$(DL) >> $@ | 	@echo $(DL)#define HAVE_INET_ADDR 1$(DL) >> $@ | ||||||
| 	@echo $(DL)#define HAVE_IOCTL 1$(DL) >> $@ | 	@echo $(DL)#define HAVE_IOCTL 1$(DL) >> $@ | ||||||
| 	@echo $(DL)#define HAVE_IOCTL_FIONBIO 1$(DL) >> $@ | 	@echo $(DL)#define HAVE_IOCTL_FIONBIO 1$(DL) >> $@ | ||||||
|  | 	@echo $(DL)#define HAVE_LIMITS_H 1$(DL) >> $@ | ||||||
| 	@echo $(DL)#define HAVE_LL 1$(DL) >> $@ | 	@echo $(DL)#define HAVE_LL 1$(DL) >> $@ | ||||||
| 	@echo $(DL)#define HAVE_LOCALTIME_R 1$(DL) >> $@ | 	@echo $(DL)#define HAVE_LOCALTIME_R 1$(DL) >> $@ | ||||||
| 	@echo $(DL)#define HAVE_MALLOC_H 1$(DL) >> $@ | 	@echo $(DL)#define HAVE_MALLOC_H 1$(DL) >> $@ | ||||||
| @@ -407,7 +406,24 @@ endif | |||||||
| 	@echo $(DL)#else$(DL) >> $@ | 	@echo $(DL)#else$(DL) >> $@ | ||||||
| 	@echo $(DL)#define HAVE_VARIADIC_MACROS_C99 1$(DL) >> $@ | 	@echo $(DL)#define HAVE_VARIADIC_MACROS_C99 1$(DL) >> $@ | ||||||
| 	@echo $(DL)#endif$(DL) >> $@ | 	@echo $(DL)#endif$(DL) >> $@ | ||||||
| ifdef OLD_NOVELLSDK |  | ||||||
| 	@echo $(DL)#define socklen_t int$(DL) >> $@ |  | ||||||
| endif |  | ||||||
|  |  | ||||||
|  | FORCE: ; | ||||||
|  |  | ||||||
|  | ares_build.h: Makefile.netware FORCE | ||||||
|  | 	@echo Creating $@ | ||||||
|  | 	@echo $(DL)/* $@ intended for NetWare target.$(DL) > $@ | ||||||
|  | 	@echo $(DL)** Do not edit this file - it is created by make!$(DL) >> $@ | ||||||
|  | 	@echo $(DL)** All your changes will be lost!!$(DL) >> $@ | ||||||
|  | 	@echo $(DL)*/$(DL) >> $@ | ||||||
|  | 	@echo $(DL)#ifndef __CARES_BUILD_H$(DL) >> $@ | ||||||
|  | 	@echo $(DL)#define __CARES_BUILD_H$(DL) >> $@ | ||||||
|  | ifeq ($(LIBARCH),CLIB) | ||||||
|  | 	@echo $(DL)#define CARES_TYPEOF_ARES_SOCKLEN_T int$(DL) >> $@ | ||||||
|  | 	@echo $(DL)#define CARES_SIZEOF_ARES_SOCKLEN_T 4$(DL) >> $@ | ||||||
|  | else | ||||||
|  | 	@echo $(DL)#define CARES_TYPEOF_ARES_SOCKLEN_T unsigned int$(DL) >> $@ | ||||||
|  | 	@echo $(DL)#define CARES_SIZEOF_ARES_SOCKLEN_T 4$(DL) >> $@ | ||||||
|  | endif | ||||||
|  | 	@echo $(DL)#define CARES_SIZEOF_LONG 4$(DL) >> $@ | ||||||
|  | 	@echo $(DL)typedef CARES_TYPEOF_ARES_SOCKLEN_T ares_socklen_t;$(DL) >> $@ | ||||||
|  | 	@echo $(DL)#endif /* __CARES_BUILD_H */$(DL) >> $@ | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| # $Id$ | # $Id$ | ||||||
| # | # | ||||||
| # C-ares makefile for MSVC6+ | # C-ares makefile for MSVC6+ | ||||||
| # G. Vanem <giva@bgnett.no>. | # G. Vanem <gvanem@broadpark.no>. | ||||||
| # | # | ||||||
|  |  | ||||||
| CFG_MODEL   = MD | CFG_MODEL   = MD | ||||||
| @@ -12,8 +12,8 @@ USE_WATT32  = 0 | |||||||
| # Configurations: | # Configurations: | ||||||
| #  -MD   - msvcrt.dll,  threads, release (normal) | #  -MD   - msvcrt.dll,  threads, release (normal) | ||||||
| #  -MDd  - msvcrtd.dll, threads, debug | #  -MDd  - msvcrtd.dll, threads, debug | ||||||
| #  -ML   - libc, no threads,     release | #  -ML   - libc, no threads,     release (not available on VC-2008+) | ||||||
| #  -MLd  - libc, no threads,     debug | #  -MLd  - libc, no threads,     debug   (not available on VC-2008+) | ||||||
| #  -MT   - libc, threads,        release | #  -MT   - libc, threads,        release | ||||||
| #  -MTd  - libc, threads,        debug | #  -MTd  - libc, threads,        debug | ||||||
|  |  | ||||||
| @@ -26,7 +26,7 @@ OBJ_DIR  = VC6_obj | |||||||
| DEF_FILE = cares.def | DEF_FILE = cares.def | ||||||
|  |  | ||||||
| !if "$(USE_WATT32)" == "1" | !if "$(USE_WATT32)" == "1" | ||||||
| CFLAGS  = $(CFLAGS) -UWIN32 -DWATT32 -D_USE_32BIT_TIME_T -I$(WATT_ROOT)\inc | CFLAGS  = $(CFLAGS) -UWIN32 -DWATT32 -I$(WATT_ROOT)\inc | ||||||
| EX_LIBS = $(WATT_ROOT)\lib\wattcpvc_imp.lib | EX_LIBS = $(WATT_ROOT)\lib\wattcpvc_imp.lib | ||||||
|  |  | ||||||
| !else | !else | ||||||
| @@ -35,7 +35,7 @@ EX_LIBS = advapi32.lib ws2_32.lib | |||||||
| !endif | !endif | ||||||
|  |  | ||||||
| !if "$(DEBUG_MODEL)" == "d" | !if "$(DEBUG_MODEL)" == "d" | ||||||
| CFLAGS  = $(CFLAGS) -D_DEBUG -GZ | CFLAGS  = $(CFLAGS) -DDEBUGBUILD -D_DEBUG -GZ | ||||||
| LDFLAGS = $(LDFLAGS) -debug -fixed:no | LDFLAGS = $(LDFLAGS) -debug -fixed:no | ||||||
|  |  | ||||||
| !else | !else | ||||||
| @@ -43,6 +43,8 @@ CFLAGS  = $(CFLAGS) -O2 -Og | |||||||
| LDFLAGS = $(LDFLAGS) -release | LDFLAGS = $(LDFLAGS) -release | ||||||
| !endif | !endif | ||||||
|  |  | ||||||
|  | CFLAGS  = $(CFLAGS) -I.\. | ||||||
|  |  | ||||||
| OBJECTS = $(OBJ_DIR)\ares_fds.obj              \ | OBJECTS = $(OBJ_DIR)\ares_fds.obj              \ | ||||||
|           $(OBJ_DIR)\ares_process.obj          \ |           $(OBJ_DIR)\ares_process.obj          \ | ||||||
|           $(OBJ_DIR)\ares_free_hostent.obj     \ |           $(OBJ_DIR)\ares_free_hostent.obj     \ | ||||||
| @@ -61,6 +63,7 @@ OBJECTS = $(OBJ_DIR)\ares_fds.obj              \ | |||||||
|           $(OBJ_DIR)\ares_strerror.obj         \ |           $(OBJ_DIR)\ares_strerror.obj         \ | ||||||
|           $(OBJ_DIR)\ares_cancel.obj           \ |           $(OBJ_DIR)\ares_cancel.obj           \ | ||||||
|           $(OBJ_DIR)\ares_init.obj             \ |           $(OBJ_DIR)\ares_init.obj             \ | ||||||
|  |           $(OBJ_DIR)\ares_library_init.obj     \ | ||||||
|           $(OBJ_DIR)\ares_llist.obj            \ |           $(OBJ_DIR)\ares_llist.obj            \ | ||||||
|           $(OBJ_DIR)\ares_timeout.obj          \ |           $(OBJ_DIR)\ares_timeout.obj          \ | ||||||
|           $(OBJ_DIR)\ares__timeval.obj         \ |           $(OBJ_DIR)\ares__timeval.obj         \ | ||||||
| @@ -71,6 +74,7 @@ OBJECTS = $(OBJ_DIR)\ares_fds.obj              \ | |||||||
|           $(OBJ_DIR)\ares_parse_a_reply.obj    \ |           $(OBJ_DIR)\ares_parse_a_reply.obj    \ | ||||||
|           $(OBJ_DIR)\ares_parse_aaaa_reply.obj \ |           $(OBJ_DIR)\ares_parse_aaaa_reply.obj \ | ||||||
|           $(OBJ_DIR)\ares_parse_ns_reply.obj   \ |           $(OBJ_DIR)\ares_parse_ns_reply.obj   \ | ||||||
|  |           $(OBJ_DIR)\ares_parse_srv_reply.obj  \ | ||||||
|           $(OBJ_DIR)\windows_port.obj          \ |           $(OBJ_DIR)\windows_port.obj          \ | ||||||
|           $(OBJ_DIR)\ares_expand_string.obj    \ |           $(OBJ_DIR)\ares_expand_string.obj    \ | ||||||
|           $(OBJ_DIR)\ares_parse_ptr_reply.obj  \ |           $(OBJ_DIR)\ares_parse_ptr_reply.obj  \ | ||||||
| @@ -108,6 +112,8 @@ $(DEF_FILE): $(OBJECTS) Makefile.VC6 | |||||||
|        @echo   ares_getsock           >> $@ |        @echo   ares_getsock           >> $@ | ||||||
|        @echo   ares_init              >> $@ |        @echo   ares_init              >> $@ | ||||||
|        @echo   ares_init_options      >> $@ |        @echo   ares_init_options      >> $@ | ||||||
|  |        @echo   ares_library_init      >> $@ | ||||||
|  |        @echo   ares_library_cleanup   >> $@ | ||||||
|        @echo   ares_mkquery           >> $@ |        @echo   ares_mkquery           >> $@ | ||||||
|        @echo   ares_parse_a_reply     >> $@ |        @echo   ares_parse_a_reply     >> $@ | ||||||
|        @echo   ares_parse_ptr_reply   >> $@ |        @echo   ares_parse_ptr_reply   >> $@ | ||||||
| @@ -153,102 +159,117 @@ vclean realclean: clean | |||||||
| # | # | ||||||
| # Copyright "gcc -MM .." | # Copyright "gcc -MM .." | ||||||
| # | # | ||||||
| $(OBJ_DIR)\ares_fds.obj: ares_fds.c setup.h setup_once.h ares.h ares_private.h \ | $(OBJ_DIR)\ares_fds.obj: ares_fds.c ares_setup.h setup_once.h ares.h ares_private.h \ | ||||||
|   ares_ipv6.h |   ares_ipv6.h ares_build.h ares_rules.h | ||||||
|  |  | ||||||
| $(OBJ_DIR)\ares_process.obj: ares_process.c setup.h setup_once.h nameser.h     \ | $(OBJ_DIR)\ares_process.obj: ares_process.c ares_setup.h setup_once.h nameser.h     \ | ||||||
|   ares.h ares_dns.h ares_private.h ares_ipv6.h |   ares.h ares_dns.h ares_private.h ares_ipv6.h ares_build.h ares_rules.h | ||||||
|  |  | ||||||
| $(OBJ_DIR)\ares_free_hostent.obj: ares_free_hostent.c setup.h setup_once.h     \ | $(OBJ_DIR)\ares_free_hostent.obj: ares_free_hostent.c ares_setup.h setup_once.h     \ | ||||||
|   ares.h ares_private.h ares_ipv6.h |   ares.h ares_private.h ares_ipv6.h ares_build.h ares_rules.h | ||||||
|  |  | ||||||
| $(OBJ_DIR)\ares_query.obj: ares_query.c setup.h setup_once.h nameser.h         \ | $(OBJ_DIR)\ares_query.obj: ares_query.c ares_setup.h setup_once.h nameser.h         \ | ||||||
|   ares.h ares_dns.h ares_private.h ares_ipv6.h |   ares.h ares_dns.h ares_private.h ares_ipv6.h ares_build.h ares_rules.h | ||||||
|  |  | ||||||
| $(OBJ_DIR)\ares__close_sockets.obj: ares__close_sockets.c setup.h setup_once.h \ | $(OBJ_DIR)\ares__close_sockets.obj: ares__close_sockets.c ares_setup.h setup_once.h \ | ||||||
|   ares.h ares_private.h ares_ipv6.h |   ares.h ares_private.h ares_ipv6.h ares_build.h ares_rules.h | ||||||
|  |  | ||||||
| $(OBJ_DIR)\ares_free_string.obj: ares_free_string.c setup.h setup_once.h ares.h | $(OBJ_DIR)\ares_free_string.obj: ares_free_string.c ares_setup.h setup_once.h       \ | ||||||
|  |   ares.h ares_build.h ares_rules.h | ||||||
|  |  | ||||||
| $(OBJ_DIR)\ares_search.obj: ares_search.c setup.h setup_once.h nameser.h       \ | $(OBJ_DIR)\ares_search.obj: ares_search.c ares_setup.h setup_once.h nameser.h       \ | ||||||
|   ares.h ares_private.h ares_ipv6.h |   ares.h ares_private.h ares_ipv6.h ares_build.h ares_rules.h | ||||||
|  |  | ||||||
| $(OBJ_DIR)\ares__get_hostent.obj: ares__get_hostent.c setup.h setup_once.h     \ | $(OBJ_DIR)\ares__get_hostent.obj: ares__get_hostent.c ares_setup.h setup_once.h     \ | ||||||
|   ares.h ares_private.h ares_ipv6.h inet_net_pton.h |   ares.h ares_private.h ares_ipv6.h inet_net_pton.h ares_build.h ares_rules.h | ||||||
|  |  | ||||||
| $(OBJ_DIR)\ares_gethostbyaddr.obj: ares_gethostbyaddr.c setup.h setup_once.h   \ | $(OBJ_DIR)\ares_gethostbyaddr.obj: ares_gethostbyaddr.c ares_setup.h setup_once.h   \ | ||||||
|   nameser.h ares.h ares_private.h ares_ipv6.h inet_net_pton.h |   nameser.h ares.h ares_private.h ares_ipv6.h inet_net_pton.h ares_build.h     \ | ||||||
|  |   ares_rules.h | ||||||
|  |  | ||||||
| $(OBJ_DIR)\ares_send.obj: ares_send.c setup.h setup_once.h nameser.h ares.h    \ | $(OBJ_DIR)\ares_send.obj: ares_send.c ares_setup.h setup_once.h nameser.h ares.h    \ | ||||||
|   ares_dns.h ares_private.h ares_ipv6.h |   ares_dns.h ares_private.h ares_ipv6.h ares_build.h ares_rules.h | ||||||
|  |  | ||||||
| $(OBJ_DIR)\ares__read_line.obj: ares__read_line.c setup.h setup_once.h ares.h  \ | $(OBJ_DIR)\ares__read_line.obj: ares__read_line.c ares_setup.h setup_once.h ares.h  \ | ||||||
|   ares_private.h ares_ipv6.h |   ares_private.h ares_ipv6.h ares_build.h ares_rules.h | ||||||
|  |  | ||||||
| $(OBJ_DIR)\ares_gethostbyname.obj: ares_gethostbyname.c setup.h setup_once.h   \ | $(OBJ_DIR)\ares_gethostbyname.obj: ares_gethostbyname.c ares_setup.h setup_once.h   \ | ||||||
|   nameser.h ares.h ares_private.h ares_ipv6.h inet_net_pton.h bitncmp.h |   nameser.h ares.h ares_private.h ares_ipv6.h inet_net_pton.h bitncmp.h        \ | ||||||
|  |   ares_build.h ares_rules.h | ||||||
|  |  | ||||||
| $(OBJ_DIR)\ares_strcasecmp.obj: ares_strcasecmp.c setup.h setup_once.h ares.h | $(OBJ_DIR)\ares_strcasecmp.obj: ares_strcasecmp.c ares_setup.h setup_once.h ares.h  \ | ||||||
|  |   ares_build.h ares_rules.h | ||||||
|  |  | ||||||
| $(OBJ_DIR)\ares_strerror.obj: ares_strerror.c setup.h setup_once.h ares.h | $(OBJ_DIR)\ares_strerror.obj: ares_strerror.c ares_setup.h setup_once.h ares.h      \ | ||||||
|  |   ares_build.h ares_rules.h | ||||||
|  |  | ||||||
| $(OBJ_DIR)\ares_cancel.obj: ares_cancel.c setup.h setup_once.h ares.h          \ | $(OBJ_DIR)\ares_cancel.obj: ares_cancel.c ares_setup.h setup_once.h ares.h          \ | ||||||
|   ares_private.h ares_ipv6.h |   ares_private.h ares_ipv6.h ares_build.h ares_rules.h | ||||||
|  |  | ||||||
| $(OBJ_DIR)\ares_init.obj: ares_init.c setup.h setup_once.h nameser.h ares.h    \ | $(OBJ_DIR)\ares_init.obj: ares_init.c ares_setup.h setup_once.h nameser.h ares.h    \ | ||||||
|   ares_private.h ares_ipv6.h inet_net_pton.h |   ares_private.h ares_ipv6.h inet_net_pton.h ares_build.h ares_rules.h         \ | ||||||
|  |   ares_library_init.h | ||||||
|  |  | ||||||
| $(OBJ_DIR)\ares_timeout.obj: ares_timeout.c setup.h setup_once.h ares.h        \ | $(OBJ_DIR)\ares_timeout.obj: ares_timeout.c ares_setup.h setup_once.h ares.h        \ | ||||||
|   ares_private.h ares_ipv6.h |   ares_private.h ares_ipv6.h ares_build.h ares_rules.h | ||||||
|  |  | ||||||
| $(OBJ_DIR)\ares__timeval.obj: ares__timeval.c setup.h setup_once.h ares.h      \ | $(OBJ_DIR)\ares__timeval.obj: ares__timeval.c ares_setup.h setup_once.h ares.h      \ | ||||||
|   ares_private.h ares_ipv6.h |   ares_private.h ares_ipv6.h ares_build.h ares_rules.h | ||||||
|  |  | ||||||
| $(OBJ_DIR)\ares_destroy.obj: ares_destroy.c setup.h setup_once.h ares.h        \ | $(OBJ_DIR)\ares_destroy.obj: ares_destroy.c ares_setup.h setup_once.h ares.h        \ | ||||||
|   ares_private.h ares_ipv6.h |   ares_private.h ares_ipv6.h ares_build.h ares_rules.h | ||||||
|  |  | ||||||
| $(OBJ_DIR)\ares_mkquery.obj: ares_mkquery.c setup.h setup_once.h nameser.h     \ | $(OBJ_DIR)\ares_mkquery.obj: ares_mkquery.c ares_setup.h setup_once.h nameser.h     \ | ||||||
|   ares.h ares_dns.h |   ares.h ares_dns.h ares_build.h ares_rules.h | ||||||
|  |  | ||||||
| $(OBJ_DIR)\ares_version.obj: ares_version.c setup.h setup_once.h ares_version.h | $(OBJ_DIR)\ares_version.obj: ares_version.c ares_setup.h setup_once.h ares.h        \ | ||||||
|  |   ares_version.h ares_build.h ares_rules.h | ||||||
|  |  | ||||||
| $(OBJ_DIR)\ares_expand_name.obj: ares_expand_name.c setup.h setup_once.h       \ | $(OBJ_DIR)\ares_expand_name.obj: ares_expand_name.c ares_setup.h setup_once.h       \ | ||||||
|   nameser.h ares.h ares_private.h ares_ipv6.h |   nameser.h ares.h ares_private.h ares_ipv6.h ares_build.h ares_rules.h | ||||||
|  |  | ||||||
| $(OBJ_DIR)\ares_parse_a_reply.obj: ares_parse_a_reply.c setup.h setup_once.h   \ | $(OBJ_DIR)\ares_parse_a_reply.obj: ares_parse_a_reply.c ares_setup.h setup_once.h   \ | ||||||
|   nameser.h ares.h ares_dns.h ares_private.h ares_ipv6.h |   nameser.h ares.h ares_dns.h ares_private.h ares_ipv6.h ares_build.h          \ | ||||||
|  |   ares_rules.h | ||||||
|  |  | ||||||
| $(OBJ_DIR)\windows_port.obj: windows_port.c setup.h setup_once.h nameser.h     \ | $(OBJ_DIR)\windows_port.obj: windows_port.c ares_setup.h setup_once.h nameser.h     \ | ||||||
|   ares.h ares_private.h ares_ipv6.h |   ares.h ares_private.h ares_ipv6.h ares_build.h ares_rules.h | ||||||
|  |  | ||||||
| $(OBJ_DIR)\ares_expand_string.obj: ares_expand_string.c setup.h setup_once.h   \ | $(OBJ_DIR)\ares_expand_string.obj: ares_expand_string.c ares_setup.h setup_once.h   \ | ||||||
|   nameser.h ares.h ares_private.h ares_ipv6.h |   nameser.h ares.h ares_private.h ares_ipv6.h ares_build.h ares_rules.h | ||||||
|  |  | ||||||
| $(OBJ_DIR)\ares_parse_ptr_reply.obj: ares_parse_ptr_reply.c setup.h            \ | $(OBJ_DIR)\ares_parse_ptr_reply.obj: ares_parse_ptr_reply.c ares_setup.h            \ | ||||||
|   setup_once.h nameser.h ares.h ares_dns.h ares_private.h ares_ipv6.h |   setup_once.h nameser.h ares.h ares_dns.h ares_private.h ares_ipv6.h          \ | ||||||
|  |   ares_build.h ares_rules.h | ||||||
|  |  | ||||||
| $(OBJ_DIR)\ares_parse_aaaa_reply.obj: ares_parse_aaaa_reply.c setup.h          \ | $(OBJ_DIR)\ares_parse_aaaa_reply.obj: ares_parse_aaaa_reply.c ares_setup.h          \ | ||||||
|   setup_once.h nameser.h ares.h ares_dns.h inet_net_pton.h ares_private.h      \ |   setup_once.h nameser.h ares.h ares_dns.h inet_net_pton.h ares_private.h      \ | ||||||
|   ares_ipv6.h |   ares_ipv6.h ares_build.h ares_rules.h | ||||||
|  |  | ||||||
| $(OBJ_DIR)\ares_parse_ns_reply.obj: ares_parse_ns_reply.c setup.h              \ | $(OBJ_DIR)\ares_parse_ns_reply.obj: ares_parse_ns_reply.c ares_setup.h              \ | ||||||
|   setup_once.h nameser.h ares.h ares_dns.h ares_private.h ares_ipv6.h |   setup_once.h nameser.h ares.h ares_dns.h ares_private.h ares_ipv6.h          \ | ||||||
|  |   ares_build.h ares_rules.h | ||||||
|  |  | ||||||
| $(OBJ_DIR)\ares_getnameinfo.obj: ares_getnameinfo.c setup.h setup_once.h       \ | $(OBJ_DIR)\ares_getnameinfo.obj: ares_getnameinfo.c ares_setup.h setup_once.h       \ | ||||||
|   nameser.h ares.h ares_private.h ares_ipv6.h inet_ntop.h |   nameser.h ares.h ares_private.h ares_ipv6.h inet_ntop.h ares_build.h         \ | ||||||
|  |   ares_rules.h | ||||||
|  |  | ||||||
| $(OBJ_DIR)\inet_net_pton.obj: inet_net_pton.c setup.h setup_once.h nameser.h   \ | $(OBJ_DIR)\inet_net_pton.obj: inet_net_pton.c ares_setup.h setup_once.h nameser.h   \ | ||||||
|   ares_ipv6.h inet_net_pton.h |   ares_ipv6.h inet_net_pton.h ares_build.h ares_rules.h | ||||||
|  |  | ||||||
| $(OBJ_DIR)\bitncmp.obj: bitncmp.c bitncmp.h | $(OBJ_DIR)\bitncmp.obj: bitncmp.c bitncmp.h ares_build.h ares_rules.h | ||||||
|  |  | ||||||
| $(OBJ_DIR)\inet_ntop.obj: inet_ntop.c setup.h setup_once.h nameser.h           \ | $(OBJ_DIR)\inet_ntop.obj: inet_ntop.c ares_setup.h setup_once.h nameser.h           \ | ||||||
|   ares_ipv6.h inet_ntop.h |   ares_ipv6.h inet_ntop.h ares_build.h ares_rules.h | ||||||
|  |  | ||||||
| $(OBJ_DIR)\ares_getopt.obj: ares_getopt.c ares_getopt.h | $(OBJ_DIR)\ares_getopt.obj: ares_getopt.c ares_getopt.h ares_build.h           \ | ||||||
|  |   ares_rules.h | ||||||
|  |  | ||||||
| $(OBJ_DIR)\ares_llist.obj: ares_llist.c setup.h setup_once.h ares.h            \ | $(OBJ_DIR)\ares_library_init.obj: ares_library_init.c ares_setup.h setup_once.h     \ | ||||||
|   ares_private.h ares_llist.h |   ares.h ares_private.h ares_library_init.h ares_build.h ares_rules.h | ||||||
|  |  | ||||||
| $(OBJ_DIR)\ares_writev.obj: ares_writev.c setup.h setup_once.h ares.h          \ | $(OBJ_DIR)\ares_llist.obj: ares_llist.c ares_setup.h setup_once.h ares.h            \ | ||||||
|   ares_writev.h |   ares_private.h ares_llist.h ares_build.h ares_rules.h | ||||||
|  |  | ||||||
|  | $(OBJ_DIR)\ares_writev.obj: ares_writev.c ares_setup.h setup_once.h ares.h          \ | ||||||
|  |   ares_writev.h ares_build.h ares_rules.h | ||||||
|   | |||||||
| @@ -23,3 +23,41 @@ original ares. | |||||||
| You'll find all c-ares details and news here: | You'll find all c-ares details and news here: | ||||||
|  |  | ||||||
|         http://c-ares.haxx.se/ |         http://c-ares.haxx.se/ | ||||||
|  |  | ||||||
|  |  | ||||||
|  | NOTES FOR C-ARES HACKERS | ||||||
|  |  | ||||||
|  | The following notes apply to c-ares version 1.6.1 and later. | ||||||
|  |  | ||||||
|  | * The distributed ares_build.h file is only intended to be used on systems | ||||||
|  |   which can not run the also distributed configure script. | ||||||
|  |  | ||||||
|  | * The distributed ares_build.h file is generated as a copy of ares_build.h.dist | ||||||
|  |   when the c-ares source code distribution archive file is originally created. | ||||||
|  |  | ||||||
|  | * If you check out from CVS on a non-configure platform, you must run the | ||||||
|  |   appropriate buildconf* script to set up ares_build.h and other local files | ||||||
|  |   before being able of compiling the library. | ||||||
|  |  | ||||||
|  | * On systems capable of running the configure script, the configure process | ||||||
|  |   will overwrite the distributed ares_build.h file with one that is suitable | ||||||
|  |   and specific to the library being configured and built, this new file is | ||||||
|  |   generated from the ares_build.h.in template file. | ||||||
|  |  | ||||||
|  | * If you intend to distribute an already compiled c-ares library you _MUST_ | ||||||
|  |   also distribute along with it the generated ares_build.h which has been | ||||||
|  |   used to compile it. Otherwise the library will be of no use for the users of | ||||||
|  |   the library that you have built. It is _your_ responsability to provide this | ||||||
|  |   file. No one at the c-ares project can know how you have built the library. | ||||||
|  |  | ||||||
|  | * File ares_build.h includes platform and configuration dependent info, | ||||||
|  |   and must not be modified by anyone. Configure script generates it for you. | ||||||
|  |  | ||||||
|  | * We cannot assume anything else but very basic compiler features being | ||||||
|  |   present. While c-ares requires an ANSI C compiler to build, some of the | ||||||
|  |   earlier ANSI compilers clearly can't deal with some preprocessor operators. | ||||||
|  |  | ||||||
|  | * Newlines must remain unix-style for older compilers' sake. | ||||||
|  |  | ||||||
|  | * Comments must be written in the old-style /* unnested C-fashion */ | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,19 +1,31 @@ | |||||||
| This is what's new and changed in the c-ares 1.6.1 release: | This is what's new and changed in the c-ares 1.7.0 release: | ||||||
|  |  | ||||||
| Changed: | Changed: | ||||||
|  |  | ||||||
|  o in6_addr is not used in ares.h anymore, but a private ares_in6_addr is |  o in6_addr is not used in ares.h anymore, but a private ares_in6_addr is | ||||||
|    instead declared and used |    instead declared and used | ||||||
|  p ares_gethostbyname() now supports 'AF_UNSPEC' as a family for resolving |  o ares_gethostbyname() now supports 'AF_UNSPEC' as a family for resolving | ||||||
|    either AF_INET6 or AF_INET |    either AF_INET6 or AF_INET | ||||||
|  |  o a build-time configured ares_socklen_t is now used instead of socklen_t | ||||||
|  |  o new ares_library_init() and ares_library_cleanup() functions | ||||||
|  |  o new --enable-curldebug configure option | ||||||
|  |  o ARES_ECANCELLED is now sent as reason for ares_cancel() | ||||||
|  |  o added ares_parse_srv_reply() | ||||||
|  |  o added ares_parse_txt_reply() | ||||||
|  |  o new --enable-symbol-hiding configure option | ||||||
|  |  | ||||||
| Fixed: | Fixed: | ||||||
|  |  | ||||||
|  o ares_parse_*_reply() functions now return ARES_EBADRESP instead of |  o ares_parse_*_reply() functions now return ARES_EBADRESP instead of | ||||||
|    ARES_EBADNAME if the name in the response failed to decode |    ARES_EBADNAME if the name in the response failed to decode | ||||||
|  |  o only expose/export symbols starting with 'ares_' | ||||||
|  |  o fix \Device\TCP handle leaks triggered by buggy iphlpapi.dll | ||||||
|  |  o init without internet gone no longer fails | ||||||
|  |  o out of bounds memory overwrite triggered with malformed /etc/hosts file | ||||||
|  |  | ||||||
| Thanks go to these friendly people for their efforts and contributions: | Thanks go to these friendly people for their efforts and contributions: | ||||||
|  |  | ||||||
|  Phil Blundell |  Phil Blundell, Japheth Cleaver, Yang Tse, Gregor Jasny, Joshua Kwan, | ||||||
|  |  Timo Teras, Jakub Hrozek, John Engelhart | ||||||
|  |  | ||||||
| Have fun! | Have fun! | ||||||
|   | |||||||
							
								
								
									
										10
									
								
								ares/TODO
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								ares/TODO
									
									
									
									
									
								
							| @@ -6,3 +6,13 @@ ares_gethostbyname | |||||||
| - When built to support IPv6, it needs to also support PF_UNSPEC or similar, | - When built to support IPv6, it needs to also support PF_UNSPEC or similar, | ||||||
|   so that an application can ask for any protocol and then c-ares would return |   so that an application can ask for any protocol and then c-ares would return | ||||||
|   all known resolves and not just explicitly IPv4 _or_ IPv6 resolves. |   all known resolves and not just explicitly IPv4 _or_ IPv6 resolves. | ||||||
|  |  | ||||||
|  | ares_process | ||||||
|  |  | ||||||
|  | - Upon next ABI breakage ares_process() should be changed to return 'int' | ||||||
|  |   and return ARES_ENOTINITIALIZED if ares_library_init() has not been called. | ||||||
|  |  | ||||||
|  | ares_process_fd | ||||||
|  |  | ||||||
|  | - Upon next ABI breakage ares_process_fd() should be changed to return | ||||||
|  |   'int' and return ARES_ENOTINITIALIZED if library has not been initialized. | ||||||
|   | |||||||
| @@ -1,52 +1,5 @@ | |||||||
|  |  | ||||||
|  |  | ||||||
| dnl CURL_CHECK_COMPILER_HALT_ON_ERROR |  | ||||||
| dnl ------------------------------------------------- |  | ||||||
| dnl Verifies if the compiler actually halts after the |  | ||||||
| dnl compilation phase without generating any object |  | ||||||
| dnl code file, when the source compiles with errors. |  | ||||||
|  |  | ||||||
| AC_DEFUN([CURL_CHECK_COMPILER_HALT_ON_ERROR], [ |  | ||||||
|   AC_MSG_CHECKING([if compiler halts on compilation errors]) |  | ||||||
|   AC_COMPILE_IFELSE([ |  | ||||||
|     AC_LANG_PROGRAM([[ |  | ||||||
|     ]],[[ |  | ||||||
|       force compilation error |  | ||||||
|     ]]) |  | ||||||
|   ],[ |  | ||||||
|     AC_MSG_RESULT([no]) |  | ||||||
|     AC_MSG_ERROR([compiler does not halt on compilation errors.]) |  | ||||||
|   ],[ |  | ||||||
|     AC_MSG_RESULT([yes]) |  | ||||||
|   ]) |  | ||||||
| ]) |  | ||||||
|  |  | ||||||
|  |  | ||||||
| dnl CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE |  | ||||||
| dnl ------------------------------------------------- |  | ||||||
| dnl Verifies if the compiler actually halts after the |  | ||||||
| dnl compilation phase without generating any object |  | ||||||
| dnl code file, when the source code tries to define a |  | ||||||
| dnl type for a constant array with negative dimension. |  | ||||||
|  |  | ||||||
| AC_DEFUN([CURL_CHECK_COMPILER_ARRAY_SIZE_NEGATIVE], [ |  | ||||||
|   AC_REQUIRE([CURL_CHECK_COMPILER_HALT_ON_ERROR])dnl |  | ||||||
|   AC_MSG_CHECKING([if compiler halts on negative sized arrays]) |  | ||||||
|   AC_COMPILE_IFELSE([ |  | ||||||
|     AC_LANG_PROGRAM([[ |  | ||||||
|       typedef char bad_t[sizeof(char) == sizeof(int) ? -1 : -1 ]; |  | ||||||
|     ]],[[ |  | ||||||
|       bad_t dummy; |  | ||||||
|     ]]) |  | ||||||
|   ],[ |  | ||||||
|     AC_MSG_RESULT([no]) |  | ||||||
|     AC_MSG_ERROR([compiler does not halt on negative sized arrays.]) |  | ||||||
|   ],[ |  | ||||||
|     AC_MSG_RESULT([yes]) |  | ||||||
|   ]) |  | ||||||
| ]) |  | ||||||
|  |  | ||||||
|  |  | ||||||
| dnl CURL_CHECK_DEF (SYMBOL, [INCLUDES], [SILENT]) | dnl CURL_CHECK_DEF (SYMBOL, [INCLUDES], [SILENT]) | ||||||
| dnl ------------------------------------------------- | dnl ------------------------------------------------- | ||||||
| dnl Use the C preprocessor to find out if the given object-style symbol | dnl Use the C preprocessor to find out if the given object-style symbol | ||||||
| @@ -96,6 +49,72 @@ CURL_DEF_TOKEN $1 | |||||||
| ]) | ]) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | dnl CURL_CHECK_DEF_CC (SYMBOL, [INCLUDES], [SILENT]) | ||||||
|  | dnl ------------------------------------------------- | ||||||
|  | dnl Use the C compiler to find out only if the given symbol is defined | ||||||
|  | dnl or not, this can not find out its expansion. This macro will not use | ||||||
|  | dnl default includes even if no INCLUDES argument is given. This macro | ||||||
|  | dnl will run silently when invoked with three arguments. | ||||||
|  |  | ||||||
|  | AC_DEFUN([CURL_CHECK_DEF_CC], [ | ||||||
|  |   AS_VAR_PUSHDEF([ac_HaveDef], [curl_cv_have_def_$1])dnl | ||||||
|  |   ifelse($3,,[AC_MSG_CHECKING([for compiler definition of $1])]) | ||||||
|  |   AC_COMPILE_IFELSE([ | ||||||
|  |     AC_LANG_SOURCE( | ||||||
|  | ifelse($2,,,[$2])[[ | ||||||
|  | int main (void) | ||||||
|  | { | ||||||
|  | #ifdef $1 | ||||||
|  |   return 0; | ||||||
|  | #else | ||||||
|  |   force compilation error | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  |     ]]) | ||||||
|  |   ],[ | ||||||
|  |     tst_symbol_defined="yes" | ||||||
|  |   ],[ | ||||||
|  |     tst_symbol_defined="no" | ||||||
|  |   ]) | ||||||
|  |   if test "$tst_symbol_defined" = "yes"; then | ||||||
|  |     AS_VAR_SET(ac_HaveDef, yes) | ||||||
|  |     ifelse($3,,[AC_MSG_RESULT([yes])]) | ||||||
|  |   else | ||||||
|  |     AS_VAR_SET(ac_HaveDef, no) | ||||||
|  |     ifelse($3,,[AC_MSG_RESULT([no])]) | ||||||
|  |   fi | ||||||
|  |   AS_VAR_POPDEF([ac_HaveDef])dnl | ||||||
|  | ]) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | dnl CARES_CHECK_LIB_XNET | ||||||
|  | dnl ------------------------------------------------- | ||||||
|  | dnl Verify if X/Open network library is required. | ||||||
|  |  | ||||||
|  | AC_DEFUN([CARES_CHECK_LIB_XNET], [ | ||||||
|  |   AC_MSG_CHECKING([if X/Open network library is required]) | ||||||
|  |   tst_lib_xnet_required="no" | ||||||
|  |   AC_COMPILE_IFELSE([ | ||||||
|  |     AC_LANG_SOURCE([[ | ||||||
|  | int main (void) | ||||||
|  | { | ||||||
|  | #if defined(__hpux) && defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 600) | ||||||
|  |   return 0; | ||||||
|  | #elif defined(__hpux) && defined(_XOPEN_SOURCE_EXTENDED) | ||||||
|  |   return 0; | ||||||
|  | #else | ||||||
|  |   force compilation error | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  |     ]]) | ||||||
|  |   ],[ | ||||||
|  |     tst_lib_xnet_required="yes" | ||||||
|  |     LIBS="$LIBS -lxnet" | ||||||
|  |   ]) | ||||||
|  |   AC_MSG_RESULT([$tst_lib_xnet_required]) | ||||||
|  | ]) | ||||||
|  |  | ||||||
|  |  | ||||||
| dnl CARES_CHECK_AIX_ALL_SOURCE | dnl CARES_CHECK_AIX_ALL_SOURCE | ||||||
| dnl ------------------------------------------------- | dnl ------------------------------------------------- | ||||||
| dnl Provides a replacement of traditional AC_AIX with | dnl Provides a replacement of traditional AC_AIX with | ||||||
| @@ -360,91 +379,55 @@ AC_DEFUN([CURL_CHECK_HEADER_MALLOC], [ | |||||||
| ]) | ]) | ||||||
|  |  | ||||||
|  |  | ||||||
| dnl CURL_CHECK_TYPE_SOCKLEN_T | dnl CURL_CHECK_HEADER_MEMORY | ||||||
| dnl ------------------------------------------------- | dnl ------------------------------------------------- | ||||||
| dnl Check for existing socklen_t type, and provide | dnl Check for compilable and valid memory.h header, | ||||||
| dnl an equivalent type if socklen_t not available | dnl and check if it is needed even with stdlib.h for | ||||||
|  | dnl memory related functions. | ||||||
|  |  | ||||||
| AC_DEFUN([CURL_CHECK_TYPE_SOCKLEN_T], [ | AC_DEFUN([CURL_CHECK_HEADER_MEMORY], [ | ||||||
|   AC_REQUIRE([CURL_CHECK_HEADER_WS2TCPIP])dnl |   AC_CACHE_CHECK([for memory.h], [ac_cv_header_memory_h], [ | ||||||
|   AC_CHECK_TYPE([socklen_t], ,[ |     AC_COMPILE_IFELSE([ | ||||||
|     dnl socklen_t not available |       AC_LANG_PROGRAM([[ | ||||||
|     AC_CACHE_CHECK([for socklen_t equivalent], | #include <memory.h> | ||||||
|       [curl_cv_socklen_t_equiv], [ |       ]],[[ | ||||||
|       curl_cv_socklen_t_equiv="unknown" |         void *p = malloc(10); | ||||||
|       for arg1 in 'int' 'SOCKET'; do |         void *q = calloc(10,10); | ||||||
|         for arg2 in "struct sockaddr" void; do |         free(p); | ||||||
|           for t in int size_t unsigned long "unsigned long"; do |         free(q); | ||||||
|             if test "$curl_cv_socklen_t_equiv" = "unknown"; then |       ]]) | ||||||
|               AC_COMPILE_IFELSE([ |     ],[ | ||||||
|                 AC_LANG_PROGRAM([[ |       ac_cv_header_memory_h="yes" | ||||||
| #undef inline |     ],[ | ||||||
| #ifdef HAVE_WINDOWS_H |       ac_cv_header_memory_h="no" | ||||||
| #ifndef WIN32_LEAN_AND_MEAN |  | ||||||
| #define WIN32_LEAN_AND_MEAN |  | ||||||
| #endif |  | ||||||
| #include <windows.h> |  | ||||||
| #ifdef HAVE_WINSOCK2_H |  | ||||||
| #include <winsock2.h> |  | ||||||
| #else |  | ||||||
| #ifdef HAVE_WINSOCK_H |  | ||||||
| #include <winsock.h> |  | ||||||
| #endif |  | ||||||
| #endif |  | ||||||
| #define GETPEERNCALLCONV PASCAL |  | ||||||
| #else |  | ||||||
| #ifdef HAVE_SYS_TYPES_H |  | ||||||
| #include <sys/types.h> |  | ||||||
| #endif |  | ||||||
| #ifdef HAVE_SYS_SOCKET_H |  | ||||||
| #include <sys/socket.h> |  | ||||||
| #endif |  | ||||||
| #define GETPEERNCALLCONV |  | ||||||
| #endif |  | ||||||
|                   extern int GETPEERNCALLCONV getpeername($arg1, $arg2 *, $t *); |  | ||||||
|                 ]],[[ |  | ||||||
|                   $t len=0; |  | ||||||
|                   getpeername(0,0,&len); |  | ||||||
|                 ]]) |  | ||||||
|               ],[ |  | ||||||
|                 curl_cv_socklen_t_equiv="$t" |  | ||||||
|               ]) |  | ||||||
|             fi |  | ||||||
|           done |  | ||||||
|         done |  | ||||||
|       done |  | ||||||
|     ]) |     ]) | ||||||
|     case "$curl_cv_socklen_t_equiv" in |   ]) | ||||||
|       unknown) |   if test "$ac_cv_header_memory_h" = "yes"; then | ||||||
|         AC_MSG_ERROR([Cannot find a type to use in place of socklen_t]) |     AC_DEFINE_UNQUOTED(HAVE_MEMORY_H, 1, | ||||||
|         ;; |       [Define to 1 if you have the memory.h header file.]) | ||||||
|       *) |     # | ||||||
|         AC_DEFINE_UNQUOTED(socklen_t, $curl_cv_socklen_t_equiv, |     AC_COMPILE_IFELSE([ | ||||||
|           [Type to use in place of socklen_t when system does not provide it.]) |       AC_LANG_PROGRAM([[ | ||||||
|  | #include <stdlib.h> | ||||||
|  |       ]],[[ | ||||||
|  |         void *p = malloc(10); | ||||||
|  |         void *q = calloc(10,10); | ||||||
|  |         free(p); | ||||||
|  |         free(q); | ||||||
|  |       ]]) | ||||||
|  |     ],[ | ||||||
|  |       curl_cv_need_header_memory_h="no" | ||||||
|  |     ],[ | ||||||
|  |       curl_cv_need_header_memory_h="yes" | ||||||
|  |     ]) | ||||||
|  |     # | ||||||
|  |     case "$curl_cv_need_header_memory_h" in | ||||||
|  |       yes) | ||||||
|  |         AC_DEFINE_UNQUOTED(NEED_MEMORY_H, 1, | ||||||
|  |           [Define to 1 if you need the memory.h header file even with stdlib.h]) | ||||||
|         ;; |         ;; | ||||||
|     esac |     esac | ||||||
|   ],[ |   fi | ||||||
| #undef inline |  | ||||||
| #ifdef HAVE_WINDOWS_H |  | ||||||
| #ifndef WIN32_LEAN_AND_MEAN |  | ||||||
| #define WIN32_LEAN_AND_MEAN |  | ||||||
| #endif |  | ||||||
| #include <windows.h> |  | ||||||
| #ifdef HAVE_WINSOCK2_H |  | ||||||
| #include <winsock2.h> |  | ||||||
| #ifdef HAVE_WS2TCPIP_H |  | ||||||
| #include <ws2tcpip.h> |  | ||||||
| #endif |  | ||||||
| #endif |  | ||||||
| #else |  | ||||||
| #ifdef HAVE_SYS_TYPES_H |  | ||||||
| #include <sys/types.h> |  | ||||||
| #endif |  | ||||||
| #ifdef HAVE_SYS_SOCKET_H |  | ||||||
| #include <sys/socket.h> |  | ||||||
| #endif |  | ||||||
| #endif |  | ||||||
|   ]) |  | ||||||
| ]) | ]) | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -461,7 +444,6 @@ dnl argument in GETNAMEINFO_QUAL_ARG1. | |||||||
|  |  | ||||||
| AC_DEFUN([CURL_CHECK_FUNC_GETNAMEINFO], [ | AC_DEFUN([CURL_CHECK_FUNC_GETNAMEINFO], [ | ||||||
|   AC_REQUIRE([CURL_CHECK_HEADER_WS2TCPIP])dnl |   AC_REQUIRE([CURL_CHECK_HEADER_WS2TCPIP])dnl | ||||||
|   AC_REQUIRE([CURL_CHECK_TYPE_SOCKLEN_T])dnl |  | ||||||
|   AC_CHECK_HEADERS(sys/types.h sys/socket.h netdb.h) |   AC_CHECK_HEADERS(sys/types.h sys/socket.h netdb.h) | ||||||
|   # |   # | ||||||
|   AC_MSG_CHECKING([for getnameinfo]) |   AC_MSG_CHECKING([for getnameinfo]) | ||||||
| @@ -1338,7 +1320,7 @@ AC_DEFUN([CURL_CHECK_STRUCT_TIMEVAL], [ | |||||||
|   AC_REQUIRE([AC_HEADER_TIME])dnl |   AC_REQUIRE([AC_HEADER_TIME])dnl | ||||||
|   AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl |   AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK])dnl | ||||||
|   AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl |   AC_REQUIRE([CURL_CHECK_HEADER_WINSOCK2])dnl | ||||||
|   AC_CHECK_HEADERS(sys/types.h sys/time.h time.h) |   AC_CHECK_HEADERS(sys/types.h sys/time.h time.h sys/socket.h) | ||||||
|   AC_CACHE_CHECK([for struct timeval], [ac_cv_struct_timeval], [ |   AC_CACHE_CHECK([for struct timeval], [ac_cv_struct_timeval], [ | ||||||
|     AC_COMPILE_IFELSE([ |     AC_COMPILE_IFELSE([ | ||||||
|       AC_LANG_PROGRAM([[ |       AC_LANG_PROGRAM([[ | ||||||
| @@ -1368,6 +1350,9 @@ AC_DEFUN([CURL_CHECK_STRUCT_TIMEVAL], [ | |||||||
| #ifdef HAVE_TIME_H | #ifdef HAVE_TIME_H | ||||||
| #include <time.h> | #include <time.h> | ||||||
| #endif | #endif | ||||||
|  | #endif | ||||||
|  | #ifdef HAVE_SYS_SOCKET_H | ||||||
|  | #include <sys/socket.h> | ||||||
| #endif | #endif | ||||||
|       ]],[[ |       ]],[[ | ||||||
|         struct timeval ts; |         struct timeval ts; | ||||||
| @@ -1685,6 +1670,214 @@ AC_DEFUN([CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC], [ | |||||||
| ]) | ]) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | dnl CARES_CHECK_LIBS_CONNECT | ||||||
|  | dnl ------------------------------------------------- | ||||||
|  | dnl Verify if network connect function is already available | ||||||
|  | dnl using current libraries or if another one is required. | ||||||
|  |  | ||||||
|  | AC_DEFUN([CARES_CHECK_LIBS_CONNECT], [ | ||||||
|  |   AC_REQUIRE([CARES_INCLUDES_WINSOCK2])dnl | ||||||
|  |   AC_MSG_CHECKING([for connect in libraries]) | ||||||
|  |   tst_connect_save_LIBS="$LIBS" | ||||||
|  |   tst_connect_need_LIBS="unknown" | ||||||
|  |   for tst_lib in '' '-lsocket' ; do | ||||||
|  |     if test "$tst_connect_need_LIBS" = "unknown"; then | ||||||
|  |       LIBS="$tst_lib $tst_connect_save_LIBS" | ||||||
|  |       AC_LINK_IFELSE([ | ||||||
|  |         AC_LANG_PROGRAM([[ | ||||||
|  |           $cares_includes_winsock2 | ||||||
|  |           #ifndef HAVE_WINDOWS_H | ||||||
|  |             int connect(int, void*, int); | ||||||
|  |           #endif | ||||||
|  |         ]],[[ | ||||||
|  |           if(0 != connect(0, 0, 0)) | ||||||
|  |             return 1; | ||||||
|  |         ]]) | ||||||
|  |       ],[ | ||||||
|  |         tst_connect_need_LIBS="$tst_lib" | ||||||
|  |       ]) | ||||||
|  |     fi | ||||||
|  |   done | ||||||
|  |   LIBS="$tst_connect_save_LIBS" | ||||||
|  |   # | ||||||
|  |   case X-"$tst_connect_need_LIBS" in | ||||||
|  |     X-unknown) | ||||||
|  |       AC_MSG_RESULT([cannot find connect]) | ||||||
|  |       AC_MSG_ERROR([cannot find connect function in libraries.]) | ||||||
|  |       ;; | ||||||
|  |     X-) | ||||||
|  |       AC_MSG_RESULT([yes]) | ||||||
|  |       ;; | ||||||
|  |     *) | ||||||
|  |       AC_MSG_RESULT([$tst_connect_need_LIBS]) | ||||||
|  |       LIBS="$tst_connect_need_LIBS $tst_connect_save_LIBS" | ||||||
|  |       ;; | ||||||
|  |   esac | ||||||
|  | ]) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | dnl CARES_DEFINE_UNQUOTED (VARIABLE, [VALUE]) | ||||||
|  | dnl ------------------------------------------------- | ||||||
|  | dnl Like AC_DEFINE_UNQUOTED this macro will define a C preprocessor | ||||||
|  | dnl symbol that can be further used in custom template configuration | ||||||
|  | dnl files. This macro, unlike AC_DEFINE_UNQUOTED, does not use a third | ||||||
|  | dnl argument for the description. Symbol definitions done with this | ||||||
|  | dnl macro are intended to be exclusively used in handcrafted *.h.in | ||||||
|  | dnl template files. Contrary to what AC_DEFINE_UNQUOTED does, this one | ||||||
|  | dnl prevents autoheader generation and insertion of symbol template | ||||||
|  | dnl stub and definition into the first configuration header file. Do | ||||||
|  | dnl not use this macro as a replacement for AC_DEFINE_UNQUOTED, each | ||||||
|  | dnl one serves different functional needs. | ||||||
|  |  | ||||||
|  | AC_DEFUN([CARES_DEFINE_UNQUOTED], [ | ||||||
|  | cat >>confdefs.h <<_EOF | ||||||
|  | [@%:@define] $1 ifelse($#, 2, [$2], 1) | ||||||
|  | _EOF | ||||||
|  | ]) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | dnl CARES_CONFIGURE_LONG | ||||||
|  | dnl ------------------------------------------------- | ||||||
|  | dnl Find out the size of long as reported by sizeof() and define | ||||||
|  | dnl CARES_SIZEOF_LONG as appropriate to be used in template file | ||||||
|  | dnl ares_build.h.in to properly configure the library. | ||||||
|  | dnl The size of long is a build time characteristic and as such | ||||||
|  | dnl must be recorded in ares_build.h | ||||||
|  |  | ||||||
|  | AC_DEFUN([CARES_CONFIGURE_LONG], [ | ||||||
|  |   if test -z "$ac_cv_sizeof_long" || | ||||||
|  |     test "$ac_cv_sizeof_long" -eq "0"; then | ||||||
|  |     AC_MSG_ERROR([cannot find out size of long.]) | ||||||
|  |   fi | ||||||
|  |   CARES_DEFINE_UNQUOTED([CARES_SIZEOF_LONG], [$ac_cv_sizeof_long]) | ||||||
|  | ]) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | dnl CARES_CONFIGURE_ARES_SOCKLEN_T | ||||||
|  | dnl ------------------------------------------------- | ||||||
|  | dnl Find out suitable ares_socklen_t data type definition and size, making | ||||||
|  | dnl appropriate definitions for template file ares_build.h.in | ||||||
|  | dnl to properly configure and use the library. | ||||||
|  | dnl | ||||||
|  | dnl The need for the ares_socklen_t definition arises mainly to properly | ||||||
|  | dnl interface HP-UX systems which on one hand have a typedef'ed socklen_t | ||||||
|  | dnl data type which is 32 or 64-Bit wide depending on the data model being | ||||||
|  | dnl used, and that on the other hand is only actually used when interfacing | ||||||
|  | dnl the X/Open sockets provided in the xnet library. | ||||||
|  |  | ||||||
|  | AC_DEFUN([CARES_CONFIGURE_ARES_SOCKLEN_T], [ | ||||||
|  |   AC_REQUIRE([CARES_INCLUDES_WS2TCPIP])dnl | ||||||
|  |   AC_REQUIRE([CARES_INCLUDES_SYS_SOCKET])dnl | ||||||
|  |   AC_REQUIRE([CARES_PREPROCESS_CALLCONV])dnl | ||||||
|  |   # | ||||||
|  |   AC_MSG_CHECKING([for ares_socklen_t data type]) | ||||||
|  |   cares_typeof_ares_socklen_t="unknown" | ||||||
|  |   for arg1 in int SOCKET; do | ||||||
|  |     for arg2 in 'struct sockaddr' void; do | ||||||
|  |       for t in socklen_t int size_t 'unsigned int' long 'unsigned long' void; do | ||||||
|  |         if test "$cares_typeof_ares_socklen_t" = "unknown"; then | ||||||
|  |           AC_COMPILE_IFELSE([ | ||||||
|  |             AC_LANG_PROGRAM([[ | ||||||
|  |               $cares_includes_ws2tcpip | ||||||
|  |               $cares_includes_sys_socket | ||||||
|  |               $cares_preprocess_callconv | ||||||
|  |               extern int FUNCALLCONV getpeername($arg1, $arg2 *, $t *); | ||||||
|  |             ]],[[ | ||||||
|  |               $t *lenptr = 0; | ||||||
|  |               if(0 != getpeername(0, 0, lenptr)) | ||||||
|  |                 return 1; | ||||||
|  |             ]]) | ||||||
|  |           ],[ | ||||||
|  |             cares_typeof_ares_socklen_t="$t" | ||||||
|  |           ]) | ||||||
|  |         fi | ||||||
|  |       done | ||||||
|  |     done | ||||||
|  |   done | ||||||
|  |   for t in socklen_t int; do | ||||||
|  |     if test "$cares_typeof_ares_socklen_t" = "void"; then | ||||||
|  |       AC_COMPILE_IFELSE([ | ||||||
|  |         AC_LANG_PROGRAM([[ | ||||||
|  |           $cares_includes_sys_socket | ||||||
|  |           typedef $t ares_socklen_t; | ||||||
|  |         ]],[[ | ||||||
|  |           ares_socklen_t dummy; | ||||||
|  |         ]]) | ||||||
|  |       ],[ | ||||||
|  |         cares_typeof_ares_socklen_t="$t" | ||||||
|  |       ]) | ||||||
|  |     fi | ||||||
|  |   done | ||||||
|  |   AC_MSG_RESULT([$cares_typeof_ares_socklen_t]) | ||||||
|  |   if test "$cares_typeof_ares_socklen_t" = "void" || | ||||||
|  |     test "$cares_typeof_ares_socklen_t" = "unknown"; then | ||||||
|  |     AC_MSG_ERROR([cannot find data type for ares_socklen_t.]) | ||||||
|  |   fi | ||||||
|  |   # | ||||||
|  |   AC_MSG_CHECKING([size of ares_socklen_t]) | ||||||
|  |   cares_sizeof_ares_socklen_t="unknown" | ||||||
|  |   cares_pull_headers_socklen_t="unknown" | ||||||
|  |   if test "$ac_cv_header_ws2tcpip_h" = "yes"; then | ||||||
|  |     tst_pull_header_checks='none ws2tcpip' | ||||||
|  |     tst_size_checks='4' | ||||||
|  |   else | ||||||
|  |     tst_pull_header_checks='none systypes syssocket' | ||||||
|  |     tst_size_checks='4 8 2' | ||||||
|  |   fi | ||||||
|  |   for tst_size in $tst_size_checks; do | ||||||
|  |     for tst_pull_headers in $tst_pull_header_checks; do | ||||||
|  |       if test "$cares_sizeof_ares_socklen_t" = "unknown"; then | ||||||
|  |         case $tst_pull_headers in | ||||||
|  |           ws2tcpip) | ||||||
|  |             tmp_includes="$cares_includes_ws2tcpip" | ||||||
|  |             ;; | ||||||
|  |           systypes) | ||||||
|  |             tmp_includes="$cares_includes_sys_types" | ||||||
|  |             ;; | ||||||
|  |           syssocket) | ||||||
|  |             tmp_includes="$cares_includes_sys_socket" | ||||||
|  |             ;; | ||||||
|  |           *) | ||||||
|  |             tmp_includes="" | ||||||
|  |             ;; | ||||||
|  |         esac | ||||||
|  |         AC_COMPILE_IFELSE([ | ||||||
|  |           AC_LANG_PROGRAM([[ | ||||||
|  |             $tmp_includes | ||||||
|  |             typedef $cares_typeof_ares_socklen_t ares_socklen_t; | ||||||
|  |             typedef char dummy_arr[sizeof(ares_socklen_t) == $tst_size ? 1 : -1]; | ||||||
|  |           ]],[[ | ||||||
|  |             ares_socklen_t dummy; | ||||||
|  |           ]]) | ||||||
|  |         ],[ | ||||||
|  |           cares_sizeof_ares_socklen_t="$tst_size" | ||||||
|  |           cares_pull_headers_socklen_t="$tst_pull_headers" | ||||||
|  |         ]) | ||||||
|  |       fi | ||||||
|  |     done | ||||||
|  |   done | ||||||
|  |   AC_MSG_RESULT([$cares_sizeof_ares_socklen_t]) | ||||||
|  |   if test "$cares_sizeof_ares_socklen_t" = "unknown"; then | ||||||
|  |     AC_MSG_ERROR([cannot find out size of ares_socklen_t.]) | ||||||
|  |   fi | ||||||
|  |   # | ||||||
|  |   case $cares_pull_headers_socklen_t in | ||||||
|  |     ws2tcpip) | ||||||
|  |       CARES_DEFINE_UNQUOTED([CARES_PULL_WS2TCPIP_H]) | ||||||
|  |       ;; | ||||||
|  |     systypes) | ||||||
|  |       CARES_DEFINE_UNQUOTED([CARES_PULL_SYS_TYPES_H]) | ||||||
|  |       ;; | ||||||
|  |     syssocket) | ||||||
|  |       CARES_DEFINE_UNQUOTED([CARES_PULL_SYS_TYPES_H]) | ||||||
|  |       CARES_DEFINE_UNQUOTED([CARES_PULL_SYS_SOCKET_H]) | ||||||
|  |       ;; | ||||||
|  |   esac | ||||||
|  |   CARES_DEFINE_UNQUOTED([CARES_TYPEOF_ARES_SOCKLEN_T], [$cares_typeof_ares_socklen_t]) | ||||||
|  |   CARES_DEFINE_UNQUOTED([CARES_SIZEOF_ARES_SOCKLEN_T], [$cares_sizeof_ares_socklen_t]) | ||||||
|  | ]) | ||||||
|  |  | ||||||
|  |  | ||||||
| dnl This macro determines if the specified struct exists in the specified file | dnl This macro determines if the specified struct exists in the specified file | ||||||
| dnl Syntax: | dnl Syntax: | ||||||
| dnl CARES_CHECK_STRUCT(headers, struct name, if found, [if not found]) | dnl CARES_CHECK_STRUCT(headers, struct name, if found, [if not found]) | ||||||
|   | |||||||
| @@ -10,8 +10,8 @@ | |||||||
|  *   CNAME = zz<CC>.countries.nerd.dk with address 127.0.x.y (ver 1) or |  *   CNAME = zz<CC>.countries.nerd.dk with address 127.0.x.y (ver 1) or | ||||||
|  *   CNAME = <a.b.c.d>.zz.countries.nerd.dk with address 127.0.x.y (ver 2) |  *   CNAME = <a.b.c.d>.zz.countries.nerd.dk with address 127.0.x.y (ver 2) | ||||||
|  * |  * | ||||||
|  * The 2 letter country code in <CC> and the ISO-3166 country |  * The 2 letter country code is in <CC> and the ISO-3166 country | ||||||
|  * number in x.y (number = x*256 + y). Version 2 of the protocol is missing |  * number is in x.y (number = x*256 + y). Version 2 of the protocol is missing | ||||||
|  * the <CC> number. |  * the <CC> number. | ||||||
|  * |  * | ||||||
|  * Ref: http://countries.nerd.dk/more.html |  * Ref: http://countries.nerd.dk/more.html | ||||||
| @@ -33,7 +33,7 @@ | |||||||
|  * without express or implied warranty. |  * without express or implied warranty. | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "setup.h" | #include "ares_setup.h" | ||||||
|  |  | ||||||
| #include <stdio.h> | #include <stdio.h> | ||||||
| #include <stdlib.h> | #include <stdlib.h> | ||||||
| @@ -116,6 +116,13 @@ int main(int argc, char **argv) | |||||||
|   WSAStartup(wVersionRequested, &wsaData); |   WSAStartup(wVersionRequested, &wsaData); | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  |   status = ares_library_init(ARES_LIB_INIT_ALL); | ||||||
|  |   if (status != ARES_SUCCESS) | ||||||
|  |     { | ||||||
|  |       fprintf(stderr, "ares_library_init: %s\n", ares_strerror(status)); | ||||||
|  |       return 1; | ||||||
|  |     } | ||||||
|  |  | ||||||
|   while ((ch = ares_getopt(argc, argv, "dvh?")) != -1) |   while ((ch = ares_getopt(argc, argv, "dvh?")) != -1) | ||||||
|     switch (ch) |     switch (ch) | ||||||
|       { |       { | ||||||
| @@ -178,6 +185,8 @@ int main(int argc, char **argv) | |||||||
|   wait_ares(channel); |   wait_ares(channel); | ||||||
|   ares_destroy(channel); |   ares_destroy(channel); | ||||||
|  |  | ||||||
|  |   ares_library_cleanup(); | ||||||
|  |  | ||||||
| #if defined(WIN32) && !defined(WATT32) | #if defined(WIN32) && !defined(WATT32) | ||||||
|   WSACleanup(); |   WSACleanup(); | ||||||
| #endif | #endif | ||||||
| @@ -547,7 +556,7 @@ static void find_country_from_cname(const char *cname, struct in_addr addr) | |||||||
|   const struct search_list *country; |   const struct search_list *country; | ||||||
|   char  ccode_A2[3], *ccopy, *dot_4; |   char  ccode_A2[3], *ccopy, *dot_4; | ||||||
|   int   cnumber, z0, z1, ver_1, ver_2; |   int   cnumber, z0, z1, ver_1, ver_2; | ||||||
|   u_long ip; |   unsigned long ip; | ||||||
|  |  | ||||||
|   ip = ntohl(addr.s_addr); |   ip = ntohl(addr.s_addr); | ||||||
|   z0 = tolower(cname[0]); |   z0 = tolower(cname[0]); | ||||||
| @@ -603,9 +612,14 @@ static void find_country_from_cname(const char *cname, struct in_addr addr) | |||||||
|     printf("Name for country-number %d not found.\n", cnumber); |     printf("Name for country-number %d not found.\n", cnumber); | ||||||
|   else |   else | ||||||
|     { |     { | ||||||
|       if (ver_1 && *(unsigned short*)&country->short_name != *(unsigned*)&ccode_A2) |       if (ver_1) | ||||||
|         printf("short-name mismatch; %s vs %s\n", country->short_name, ccode_A2); |         { | ||||||
|  |           if ((country->short_name[0] != ccode_A2[0]) || | ||||||
|  |               (country->short_name[1] != ccode_A2[1]) || | ||||||
|  |               (country->short_name[2] != ccode_A2[2])) | ||||||
|  |             printf("short-name mismatch; %s vs %s\n", | ||||||
|  |                    country->short_name, ccode_A2); | ||||||
|  |         } | ||||||
|       printf("%s (%s), number %d.\n", |       printf("%s (%s), number %d.\n", | ||||||
|              country->long_name, country->short_name, cnumber); |              country->long_name, country->short_name, cnumber); | ||||||
|     } |     } | ||||||
|   | |||||||
							
								
								
									
										53
									
								
								ares/adig.c
									
									
									
									
									
								
							
							
						
						
									
										53
									
								
								ares/adig.c
									
									
									
									
									
								
							| @@ -15,7 +15,7 @@ | |||||||
|  * without express or implied warranty. |  * without express or implied warranty. | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "setup.h" | #include "ares_setup.h" | ||||||
|  |  | ||||||
| #ifdef HAVE_SYS_SOCKET_H | #ifdef HAVE_SYS_SOCKET_H | ||||||
| #  include <sys/socket.h> | #  include <sys/socket.h> | ||||||
| @@ -84,6 +84,11 @@ | |||||||
| #define T_SRV 33 /* server selection */ | #define T_SRV 33 /* server selection */ | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  | /* AIX portability check */ | ||||||
|  | #ifndef T_NAPTR | ||||||
|  | #define T_NAPTR 35 /* naming authority pointer */ | ||||||
|  | #endif | ||||||
|  |  | ||||||
| struct nv { | struct nv { | ||||||
|   const char *name; |   const char *name; | ||||||
|   int value; |   int value; | ||||||
| @@ -187,6 +192,13 @@ int main(int argc, char **argv) | |||||||
|   WSAStartup(wVersionRequested, &wsaData); |   WSAStartup(wVersionRequested, &wsaData); | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  |   status = ares_library_init(ARES_LIB_INIT_ALL); | ||||||
|  |   if (status != ARES_SUCCESS) | ||||||
|  |     { | ||||||
|  |       fprintf(stderr, "ares_library_init: %s\n", ares_strerror(status)); | ||||||
|  |       return 1; | ||||||
|  |     } | ||||||
|  |  | ||||||
|   options.flags = ARES_FLAG_NOCHECKRESP; |   options.flags = ARES_FLAG_NOCHECKRESP; | ||||||
|   options.servers = NULL; |   options.servers = NULL; | ||||||
|   options.nservers = 0; |   options.nservers = 0; | ||||||
| @@ -207,9 +219,10 @@ int main(int argc, char **argv) | |||||||
|               if (strcmp(flags[i].name, optarg) == 0) |               if (strcmp(flags[i].name, optarg) == 0) | ||||||
|                 break; |                 break; | ||||||
|             } |             } | ||||||
|           if (i == nflags) |           if (i < nflags) | ||||||
|  |             options.flags |= flags[i].value; | ||||||
|  |           else | ||||||
|             usage(); |             usage(); | ||||||
|           options.flags |= flags[i].value; |  | ||||||
|           break; |           break; | ||||||
|  |  | ||||||
|         case 's': |         case 's': | ||||||
| @@ -244,9 +257,10 @@ int main(int argc, char **argv) | |||||||
|               if (strcasecmp(classes[i].name, optarg) == 0) |               if (strcasecmp(classes[i].name, optarg) == 0) | ||||||
|                 break; |                 break; | ||||||
|             } |             } | ||||||
|           if (i == nclasses) |           if (i < nclasses) | ||||||
|  |             dnsclass = classes[i].value; | ||||||
|  |           else | ||||||
|             usage(); |             usage(); | ||||||
|           dnsclass = classes[i].value; |  | ||||||
|           break; |           break; | ||||||
|  |  | ||||||
|         case 't': |         case 't': | ||||||
| @@ -256,9 +270,10 @@ int main(int argc, char **argv) | |||||||
|               if (strcasecmp(types[i].name, optarg) == 0) |               if (strcasecmp(types[i].name, optarg) == 0) | ||||||
|                 break; |                 break; | ||||||
|             } |             } | ||||||
|           if (i == ntypes) |           if (i < ntypes) | ||||||
|  |             type = types[i].value; | ||||||
|  |           else | ||||||
|             usage(); |             usage(); | ||||||
|           type = types[i].value; |  | ||||||
|           break; |           break; | ||||||
|  |  | ||||||
|         case 'T': |         case 'T': | ||||||
| @@ -325,6 +340,8 @@ int main(int argc, char **argv) | |||||||
|  |  | ||||||
|   ares_destroy(channel); |   ares_destroy(channel); | ||||||
|  |  | ||||||
|  |   ares_library_cleanup(); | ||||||
|  |  | ||||||
| #ifdef USE_WINSOCK | #ifdef USE_WINSOCK | ||||||
|   WSACleanup(); |   WSACleanup(); | ||||||
| #endif | #endif | ||||||
| @@ -534,12 +551,20 @@ static const unsigned char *display_rr(const unsigned char *aptr, | |||||||
|       len = *p; |       len = *p; | ||||||
|       if (p + len + 1 > aptr + dlen) |       if (p + len + 1 > aptr + dlen) | ||||||
|         return NULL; |         return NULL; | ||||||
|       printf("\t%.*s", (int)len, p + 1); |       status = ares_expand_string(p, abuf, alen, &name.as_uchar, &len); | ||||||
|       p += len + 1; |       if (status != ARES_SUCCESS) | ||||||
|  |         return NULL; | ||||||
|  |       printf("\t%s", name.as_char); | ||||||
|  |       ares_free_string(name.as_char); | ||||||
|  |       p += len; | ||||||
|       len = *p; |       len = *p; | ||||||
|       if (p + len + 1 > aptr + dlen) |       if (p + len + 1 > aptr + dlen) | ||||||
|         return NULL; |         return NULL; | ||||||
|       printf("\t%.*s", (int)len, p + 1); |       status = ares_expand_string(p, abuf, alen, &name.as_uchar, &len); | ||||||
|  |       if (status != ARES_SUCCESS) | ||||||
|  |         return NULL; | ||||||
|  |       printf("\t%s", name.as_char); | ||||||
|  |       ares_free_string(name.as_char); | ||||||
|       break; |       break; | ||||||
|  |  | ||||||
|     case T_MINFO: |     case T_MINFO: | ||||||
| @@ -606,8 +631,12 @@ static const unsigned char *display_rr(const unsigned char *aptr, | |||||||
|           len = *p; |           len = *p; | ||||||
|           if (p + len + 1 > aptr + dlen) |           if (p + len + 1 > aptr + dlen) | ||||||
|             return NULL; |             return NULL; | ||||||
|           printf("\t%.*s", (int)len, p + 1); |           status = ares_expand_string(p, abuf, alen, &name.as_uchar, &len); | ||||||
|           p += len + 1; |           if (status != ARES_SUCCESS) | ||||||
|  |             return NULL; | ||||||
|  |           printf("\t%s", name.as_char); | ||||||
|  |           ares_free_string(name.as_char); | ||||||
|  |           p += len; | ||||||
|         } |         } | ||||||
|       break; |       break; | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										12
									
								
								ares/ahost.c
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								ares/ahost.c
									
									
									
									
									
								
							| @@ -15,7 +15,7 @@ | |||||||
|  * without express or implied warranty. |  * without express or implied warranty. | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "setup.h" | #include "ares_setup.h" | ||||||
|  |  | ||||||
| #if !defined(WIN32) || defined(WATT32) | #if !defined(WIN32) || defined(WATT32) | ||||||
| #ifdef HAVE_SYS_TIME_H | #ifdef HAVE_SYS_TIME_H | ||||||
| @@ -42,6 +42,7 @@ | |||||||
| #include "inet_ntop.h" | #include "inet_ntop.h" | ||||||
| #include "inet_net_pton.h" | #include "inet_net_pton.h" | ||||||
| #include "ares_getopt.h" | #include "ares_getopt.h" | ||||||
|  | #include "ares_ipv6.h" | ||||||
|  |  | ||||||
| #ifndef HAVE_STRDUP | #ifndef HAVE_STRDUP | ||||||
| #  include "ares_strdup.h" | #  include "ares_strdup.h" | ||||||
| @@ -76,6 +77,13 @@ int main(int argc, char **argv) | |||||||
|   WSAStartup(wVersionRequested, &wsaData); |   WSAStartup(wVersionRequested, &wsaData); | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  |   status = ares_library_init(ARES_LIB_INIT_ALL); | ||||||
|  |   if (status != ARES_SUCCESS) | ||||||
|  |     { | ||||||
|  |       fprintf(stderr, "ares_library_init: %s\n", ares_strerror(status)); | ||||||
|  |       return 1; | ||||||
|  |     } | ||||||
|  |  | ||||||
|   while ((c = ares_getopt(argc,argv,"dt:h")) != -1) |   while ((c = ares_getopt(argc,argv,"dt:h")) != -1) | ||||||
|     { |     { | ||||||
|       switch (c) |       switch (c) | ||||||
| @@ -146,6 +154,8 @@ int main(int argc, char **argv) | |||||||
|  |  | ||||||
|   ares_destroy(channel); |   ares_destroy(channel); | ||||||
|  |  | ||||||
|  |   ares_library_cleanup(); | ||||||
|  |  | ||||||
| #ifdef USE_WINSOCK | #ifdef USE_WINSOCK | ||||||
|   WSACleanup(); |   WSACleanup(); | ||||||
| #endif | #endif | ||||||
|   | |||||||
							
								
								
									
										302
									
								
								ares/ares.h
									
									
									
									
									
								
							
							
						
						
									
										302
									
								
								ares/ares.h
									
									
									
									
									
								
							| @@ -1,6 +1,6 @@ | |||||||
| /* $Id$ */ | /* $Id$ */ | ||||||
|  |  | ||||||
| /* Copyright 1998 by the Massachusetts Institute of Technology. | /* Copyright 1998, 2009 by the Massachusetts Institute of Technology. | ||||||
|  * Copyright (C) 2007-2009 by Daniel Stenberg |  * Copyright (C) 2007-2009 by Daniel Stenberg | ||||||
|  * |  * | ||||||
|  * Permission to use, copy, modify, and distribute this |  * Permission to use, copy, modify, and distribute this | ||||||
| @@ -19,12 +19,17 @@ | |||||||
| #ifndef ARES__H | #ifndef ARES__H | ||||||
| #define ARES__H | #define ARES__H | ||||||
|  |  | ||||||
|  | #include "ares_version.h"  /* c-ares version defines   */ | ||||||
|  | #include "ares_build.h"    /* c-ares build definitions */ | ||||||
|  | #include "ares_rules.h"    /* c-ares rules enforcement */ | ||||||
|  |  | ||||||
| /* | /* | ||||||
|  * Define WIN32 when build target is Win32 API |  * Define WIN32 when build target is Win32 API | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) | #if (defined(_WIN32) || defined(__WIN32__)) && \ | ||||||
| #define WIN32 |    !defined(WIN32) && !defined(__SYMBIAN32__) | ||||||
|  | #  define WIN32 | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #include <sys/types.h> | #include <sys/types.h> | ||||||
| @@ -41,9 +46,9 @@ | |||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #if defined(WATT32) | #if defined(WATT32) | ||||||
|   #include <netinet/in.h> | #  include <netinet/in.h> | ||||||
|   #include <sys/socket.h> | #  include <sys/socket.h> | ||||||
|   #include <tcp.h> | #  include <tcp.h> | ||||||
| #elif defined(WIN32) | #elif defined(WIN32) | ||||||
| #  ifndef WIN32_LEAN_AND_MEAN | #  ifndef WIN32_LEAN_AND_MEAN | ||||||
| #    define WIN32_LEAN_AND_MEAN | #    define WIN32_LEAN_AND_MEAN | ||||||
| @@ -52,14 +57,37 @@ | |||||||
| #  include <winsock2.h> | #  include <winsock2.h> | ||||||
| #  include <ws2tcpip.h> | #  include <ws2tcpip.h> | ||||||
| #else | #else | ||||||
|   #include <sys/socket.h> | #  include <sys/socket.h> | ||||||
|   #include <netinet/in.h> | #  include <netinet/in.h> | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #ifdef  __cplusplus | #ifdef  __cplusplus | ||||||
| extern "C" { | extern "C" { | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  | /* | ||||||
|  | ** c-ares external API function linkage decorations. | ||||||
|  | */ | ||||||
|  |  | ||||||
|  | #if !defined(CARES_STATICLIB) && \ | ||||||
|  |    (defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__)) | ||||||
|  |    /* __declspec function decoration for Win32 and Symbian DLL's */ | ||||||
|  | #  if defined(CARES_BUILDING_LIBRARY) | ||||||
|  | #    define CARES_EXTERN  __declspec(dllexport) | ||||||
|  | #  else | ||||||
|  | #    define CARES_EXTERN  __declspec(dllimport) | ||||||
|  | #  endif | ||||||
|  | #else | ||||||
|  |    /* visibility function decoration for other cases */ | ||||||
|  | #  if !defined(CARES_SYMBOL_HIDING) || \ | ||||||
|  |      defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__) | ||||||
|  | #    define CARES_EXTERN | ||||||
|  | #  else | ||||||
|  | #    define CARES_EXTERN CARES_SYMBOL_SCOPE_EXTERN | ||||||
|  | #  endif | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  |  | ||||||
| #define ARES_SUCCESS            0 | #define ARES_SUCCESS            0 | ||||||
|  |  | ||||||
| /* Server error codes (ARES_ENODATA indicates no relevant answer) */ | /* Server error codes (ARES_ENODATA indicates no relevant answer) */ | ||||||
| @@ -90,6 +118,16 @@ extern "C" { | |||||||
| #define ARES_ENONAME            19 | #define ARES_ENONAME            19 | ||||||
| #define ARES_EBADHINTS          20 | #define ARES_EBADHINTS          20 | ||||||
|  |  | ||||||
|  | /* Uninitialized library error code */ | ||||||
|  | #define ARES_ENOTINITIALIZED    21          /* introduced in 1.6.1 */ | ||||||
|  |  | ||||||
|  | /* ares_library_init error codes */ | ||||||
|  | #define ARES_ELOADIPHLPAPI           22     /* introduced in 1.6.1 */ | ||||||
|  | #define ARES_EADDRGETNETWORKPARAMS   23     /* introduced in 1.6.1 */ | ||||||
|  |  | ||||||
|  | /* More error codes */ | ||||||
|  | #define ARES_ECANCELLED         24          /* introduced in 1.6.1 */ | ||||||
|  |  | ||||||
| /* Flag values */ | /* Flag values */ | ||||||
| #define ARES_FLAG_USEVC         (1 << 0) | #define ARES_FLAG_USEVC         (1 << 0) | ||||||
| #define ARES_FLAG_PRIMARY       (1 << 1) | #define ARES_FLAG_PRIMARY       (1 << 1) | ||||||
| @@ -158,6 +196,11 @@ extern "C" { | |||||||
| #define ARES_GETSOCK_WRITABLE(bits,num) (bits & (1 << ((num) + \ | #define ARES_GETSOCK_WRITABLE(bits,num) (bits & (1 << ((num) + \ | ||||||
|                                          ARES_GETSOCK_MAXNUM))) |                                          ARES_GETSOCK_MAXNUM))) | ||||||
|  |  | ||||||
|  | /* c-ares library initialization flag values */ | ||||||
|  | #define ARES_LIB_INIT_NONE   (0) | ||||||
|  | #define ARES_LIB_INIT_WIN32  (1 << 0) | ||||||
|  | #define ARES_LIB_INIT_ALL    (ARES_LIB_INIT_WIN32) | ||||||
|  |  | ||||||
|  |  | ||||||
| /* | /* | ||||||
|  * Typedef our socket type |  * Typedef our socket type | ||||||
| @@ -222,58 +265,143 @@ struct hostent; | |||||||
| struct timeval; | struct timeval; | ||||||
| struct sockaddr; | struct sockaddr; | ||||||
| struct ares_channeldata; | struct ares_channeldata; | ||||||
| typedef struct ares_channeldata *ares_channel; |  | ||||||
| typedef void (*ares_callback)(void *arg, int status, int timeouts, |  | ||||||
|                               unsigned char *abuf, int alen); |  | ||||||
| typedef void (*ares_host_callback)(void *arg, int status, int timeouts, |  | ||||||
|                                    struct hostent *hostent); |  | ||||||
| typedef void (*ares_nameinfo_callback)(void *arg, int status, int timeouts, |  | ||||||
|                                        char *node, char *service); |  | ||||||
| typedef int  (*ares_sock_create_callback)(ares_socket_t socket_fd, |  | ||||||
|                                           int type, void *data); |  | ||||||
|  |  | ||||||
| int ares_init(ares_channel *channelptr); | typedef struct ares_channeldata *ares_channel; | ||||||
| int ares_init_options(ares_channel *channelptr, struct ares_options *options, |  | ||||||
|                       int optmask); | typedef void (*ares_callback)(void *arg, | ||||||
| int ares_save_options(ares_channel channel, struct ares_options *options, |                               int status, | ||||||
|                       int *optmask); |                               int timeouts, | ||||||
| void ares_destroy_options(struct ares_options *options); |                               unsigned char *abuf, | ||||||
| int ares_dup(ares_channel *dest, ares_channel src); |                               int alen); | ||||||
| void ares_destroy(ares_channel channel); |  | ||||||
| void ares_cancel(ares_channel channel); | typedef void (*ares_host_callback)(void *arg, | ||||||
|  |                                    int status, | ||||||
|  |                                    int timeouts, | ||||||
|  |                                    struct hostent *hostent); | ||||||
|  |  | ||||||
|  | typedef void (*ares_nameinfo_callback)(void *arg, | ||||||
|  |                                        int status, | ||||||
|  |                                        int timeouts, | ||||||
|  |                                        char *node, | ||||||
|  |                                        char *service); | ||||||
|  |  | ||||||
|  | typedef int  (*ares_sock_create_callback)(ares_socket_t socket_fd, | ||||||
|  |                                           int type, | ||||||
|  |                                           void *data); | ||||||
|  |  | ||||||
|  | CARES_EXTERN int ares_library_init(int flags); | ||||||
|  |  | ||||||
|  | CARES_EXTERN void ares_library_cleanup(void); | ||||||
|  |  | ||||||
|  | CARES_EXTERN const char *ares_version(int *version); | ||||||
|  |  | ||||||
|  | CARES_EXTERN int ares_init(ares_channel *channelptr); | ||||||
|  |  | ||||||
|  | CARES_EXTERN int ares_init_options(ares_channel *channelptr, | ||||||
|  |                                    struct ares_options *options, | ||||||
|  |                                    int optmask); | ||||||
|  |  | ||||||
|  | CARES_EXTERN int ares_save_options(ares_channel channel, | ||||||
|  |                                    struct ares_options *options, | ||||||
|  |                                    int *optmask); | ||||||
|  |  | ||||||
|  | CARES_EXTERN void ares_destroy_options(struct ares_options *options); | ||||||
|  |  | ||||||
|  | CARES_EXTERN int ares_dup(ares_channel *dest, | ||||||
|  |                           ares_channel src); | ||||||
|  |  | ||||||
|  | CARES_EXTERN void ares_destroy(ares_channel channel); | ||||||
|  |  | ||||||
|  | CARES_EXTERN void ares_cancel(ares_channel channel); | ||||||
|  |  | ||||||
| void ares_set_socket_callback(ares_channel channel, | void ares_set_socket_callback(ares_channel channel, | ||||||
|                               ares_sock_create_callback callback, |                               ares_sock_create_callback callback, | ||||||
|                               void *user_data); |                               void *user_data); | ||||||
| void ares_send(ares_channel channel, const unsigned char *qbuf, int qlen, |  | ||||||
|                ares_callback callback, void *arg); |  | ||||||
| void ares_query(ares_channel channel, const char *name, int dnsclass, |  | ||||||
|                 int type, ares_callback callback, void *arg); |  | ||||||
| void ares_search(ares_channel channel, const char *name, int dnsclass, |  | ||||||
|                  int type, ares_callback callback, void *arg); |  | ||||||
| void ares_gethostbyname(ares_channel channel, const char *name, int family, |  | ||||||
|                         ares_host_callback callback, void *arg); |  | ||||||
| int ares_gethostbyname_file(ares_channel channel, const char *name, |  | ||||||
|                             int family, struct hostent **host); |  | ||||||
| void ares_gethostbyaddr(ares_channel channel, const void *addr, int addrlen, |  | ||||||
|                         int family, ares_host_callback callback, void *arg); |  | ||||||
| void ares_getnameinfo(ares_channel channel, const struct sockaddr *sa, |  | ||||||
|                       socklen_t salen, int flags, |  | ||||||
|                       ares_nameinfo_callback callback, |  | ||||||
|                       void *arg); |  | ||||||
| int ares_fds(ares_channel channel, fd_set *read_fds, fd_set *write_fds); |  | ||||||
| int ares_getsock(ares_channel channel, int *socks, int numsocks); |  | ||||||
| struct timeval *ares_timeout(ares_channel channel, struct timeval *maxtv, |  | ||||||
|                              struct timeval *tv); |  | ||||||
| void ares_process(ares_channel channel, fd_set *read_fds, fd_set *write_fds); |  | ||||||
| void ares_process_fd(ares_channel channel, ares_socket_t read_fd, |  | ||||||
|                      ares_socket_t write_fd); |  | ||||||
|  |  | ||||||
| int ares_mkquery(const char *name, int dnsclass, int type, unsigned short id, | CARES_EXTERN void ares_send(ares_channel channel, | ||||||
|                  int rd, unsigned char **buf, int *buflen); |                             const unsigned char *qbuf, | ||||||
| int ares_expand_name(const unsigned char *encoded, const unsigned char *abuf, |                             int qlen, | ||||||
|                      int alen, char **s, long *enclen); |                             ares_callback callback, | ||||||
| int ares_expand_string(const unsigned char *encoded, const unsigned char *abuf, |                             void *arg); | ||||||
|                      int alen, unsigned char **s, long *enclen); |  | ||||||
|  | CARES_EXTERN void ares_query(ares_channel channel, | ||||||
|  |                              const char *name, | ||||||
|  |                              int dnsclass, | ||||||
|  |                              int type, | ||||||
|  |                              ares_callback callback, | ||||||
|  |                              void *arg); | ||||||
|  |  | ||||||
|  | CARES_EXTERN void ares_search(ares_channel channel, | ||||||
|  |                               const char *name, | ||||||
|  |                               int dnsclass, | ||||||
|  |                               int type, | ||||||
|  |                               ares_callback callback, | ||||||
|  |                               void *arg); | ||||||
|  |  | ||||||
|  | CARES_EXTERN void ares_gethostbyname(ares_channel channel, | ||||||
|  |                                      const char *name, | ||||||
|  |                                      int family, | ||||||
|  |                                      ares_host_callback callback, | ||||||
|  |                                      void *arg); | ||||||
|  |  | ||||||
|  | CARES_EXTERN int ares_gethostbyname_file(ares_channel channel, | ||||||
|  |                                          const char *name, | ||||||
|  |                                          int family, | ||||||
|  |                                          struct hostent **host); | ||||||
|  |  | ||||||
|  | CARES_EXTERN void ares_gethostbyaddr(ares_channel channel, | ||||||
|  |                                      const void *addr, | ||||||
|  |                                      int addrlen, | ||||||
|  |                                      int family, | ||||||
|  |                                      ares_host_callback callback, | ||||||
|  |                                      void *arg); | ||||||
|  |  | ||||||
|  | CARES_EXTERN void ares_getnameinfo(ares_channel channel, | ||||||
|  |                                    const struct sockaddr *sa, | ||||||
|  |                                    ares_socklen_t salen, | ||||||
|  |                                    int flags, | ||||||
|  |                                    ares_nameinfo_callback callback, | ||||||
|  |                                    void *arg); | ||||||
|  |  | ||||||
|  | CARES_EXTERN int ares_fds(ares_channel channel, | ||||||
|  |                           fd_set *read_fds, | ||||||
|  |                           fd_set *write_fds); | ||||||
|  |  | ||||||
|  | CARES_EXTERN int ares_getsock(ares_channel channel, | ||||||
|  |                               int *socks, | ||||||
|  |                               int numsocks); | ||||||
|  |  | ||||||
|  | CARES_EXTERN struct timeval *ares_timeout(ares_channel channel, | ||||||
|  |                                           struct timeval *maxtv, | ||||||
|  |                                           struct timeval *tv); | ||||||
|  |  | ||||||
|  | CARES_EXTERN void ares_process(ares_channel channel, | ||||||
|  |                                fd_set *read_fds, | ||||||
|  |                                fd_set *write_fds); | ||||||
|  |  | ||||||
|  | CARES_EXTERN void ares_process_fd(ares_channel channel, | ||||||
|  |                                   ares_socket_t read_fd, | ||||||
|  |                                   ares_socket_t write_fd); | ||||||
|  |  | ||||||
|  | CARES_EXTERN int ares_mkquery(const char *name, | ||||||
|  |                               int dnsclass, | ||||||
|  |                               int type, | ||||||
|  |                               unsigned short id, | ||||||
|  |                               int rd, | ||||||
|  |                               unsigned char **buf, | ||||||
|  |                               int *buflen); | ||||||
|  |  | ||||||
|  | CARES_EXTERN int ares_expand_name(const unsigned char *encoded, | ||||||
|  |                                   const unsigned char *abuf, | ||||||
|  |                                   int alen, | ||||||
|  |                                   char **s, | ||||||
|  |                                   long *enclen); | ||||||
|  |  | ||||||
|  | CARES_EXTERN int ares_expand_string(const unsigned char *encoded, | ||||||
|  |                                     const unsigned char *abuf, | ||||||
|  |                                     int alen, | ||||||
|  |                                     unsigned char **s, | ||||||
|  |                                     long *enclen); | ||||||
|  |  | ||||||
| /* | /* | ||||||
|  * NOTE: before c-ares 1.6.1 we would most often use the system in6_addr |  * NOTE: before c-ares 1.6.1 we would most often use the system in6_addr | ||||||
| @@ -301,6 +429,18 @@ struct addr6ttl { | |||||||
|   int             ttl; |   int             ttl; | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | struct ares_srv_reply { | ||||||
|  |   unsigned short weight; | ||||||
|  |   unsigned short priority; | ||||||
|  |   unsigned short port; | ||||||
|  |   char *host; | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | struct ares_txt_reply { | ||||||
|  |   size_t         length;  /* length excludes null termination */ | ||||||
|  |   unsigned char *txt; | ||||||
|  | }; | ||||||
|  |  | ||||||
| /* | /* | ||||||
| ** Parse the buffer, starting at *abuf and of length alen bytes, previously | ** Parse the buffer, starting at *abuf and of length alen bytes, previously | ||||||
| ** obtained from an ares_search call.  Put the results in *host, if nonnull. | ** obtained from an ares_search call.  Put the results in *host, if nonnull. | ||||||
| @@ -308,19 +448,45 @@ struct addr6ttl { | |||||||
| ** their TTLs in that array, and set *naddrttls to the number of addresses | ** their TTLs in that array, and set *naddrttls to the number of addresses | ||||||
| ** so written. | ** so written. | ||||||
| */ | */ | ||||||
| int ares_parse_a_reply(const unsigned char *abuf, int alen, |  | ||||||
|                        struct hostent **host, | CARES_EXTERN int ares_parse_a_reply(const unsigned char *abuf, | ||||||
|                        struct addrttl *addrttls, int *naddrttls); |                                     int alen, | ||||||
| int ares_parse_aaaa_reply(const unsigned char *abuf, int alen, |                                     struct hostent **host, | ||||||
|                           struct hostent **host, |                                     struct addrttl *addrttls, | ||||||
|                           struct addr6ttl *addrttls, int *naddrttls); |                                     int *naddrttls); | ||||||
| int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr, |  | ||||||
|                          int addrlen, int family, struct hostent **host); | CARES_EXTERN int ares_parse_aaaa_reply(const unsigned char *abuf, | ||||||
| int ares_parse_ns_reply(const unsigned char *abuf, int alen, |                                        int alen, | ||||||
|                         struct hostent **host); |                                        struct hostent **host, | ||||||
| void ares_free_string(void *str); |                                        struct addr6ttl *addrttls, | ||||||
| void ares_free_hostent(struct hostent *host); |                                        int *naddrttls); | ||||||
| const char *ares_strerror(int code); |  | ||||||
|  | CARES_EXTERN int ares_parse_ptr_reply(const unsigned char *abuf, | ||||||
|  |                                       int alen, | ||||||
|  |                                       const void *addr, | ||||||
|  |                                       int addrlen, | ||||||
|  |                                       int family, | ||||||
|  |                                       struct hostent **host); | ||||||
|  |  | ||||||
|  | CARES_EXTERN int ares_parse_ns_reply(const unsigned char *abuf, | ||||||
|  |                                      int alen, | ||||||
|  |                                      struct hostent **host); | ||||||
|  |  | ||||||
|  | CARES_EXTERN int ares_parse_srv_reply(const unsigned char* abuf, | ||||||
|  |                                       int alen, | ||||||
|  |                                       struct ares_srv_reply** srv_out, | ||||||
|  |                                       int *nsrvreply); | ||||||
|  |  | ||||||
|  | CARES_EXTERN int ares_parse_txt_reply(const unsigned char* abuf, | ||||||
|  |                                       int alen, | ||||||
|  |                                       struct ares_txt_reply** txt_out, | ||||||
|  |                                       int *nsrvreply); | ||||||
|  |  | ||||||
|  | CARES_EXTERN void ares_free_string(void *str); | ||||||
|  |  | ||||||
|  | CARES_EXTERN void ares_free_hostent(struct hostent *host); | ||||||
|  |  | ||||||
|  | CARES_EXTERN const char *ares_strerror(int code); | ||||||
|  |  | ||||||
| #ifdef  __cplusplus | #ifdef  __cplusplus | ||||||
| } | } | ||||||
|   | |||||||
| @@ -15,7 +15,7 @@ | |||||||
|  * without express or implied warranty. |  * without express or implied warranty. | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "setup.h" | #include "ares_setup.h" | ||||||
|  |  | ||||||
| #include <stdlib.h> | #include <stdlib.h> | ||||||
| #ifdef HAVE_UNISTD_H | #ifdef HAVE_UNISTD_H | ||||||
| @@ -54,14 +54,14 @@ void ares__close_sockets(ares_channel channel, struct server_state *server) | |||||||
|   if (server->tcp_socket != ARES_SOCKET_BAD) |   if (server->tcp_socket != ARES_SOCKET_BAD) | ||||||
|     { |     { | ||||||
|       SOCK_STATE_CALLBACK(channel, server->tcp_socket, 0, 0); |       SOCK_STATE_CALLBACK(channel, server->tcp_socket, 0, 0); | ||||||
|       closesocket(server->tcp_socket); |       sclose(server->tcp_socket); | ||||||
|       server->tcp_socket = ARES_SOCKET_BAD; |       server->tcp_socket = ARES_SOCKET_BAD; | ||||||
|       server->tcp_connection_generation = ++channel->tcp_connection_generation; |       server->tcp_connection_generation = ++channel->tcp_connection_generation; | ||||||
|     } |     } | ||||||
|   if (server->udp_socket != ARES_SOCKET_BAD) |   if (server->udp_socket != ARES_SOCKET_BAD) | ||||||
|     { |     { | ||||||
|       SOCK_STATE_CALLBACK(channel, server->udp_socket, 0, 0); |       SOCK_STATE_CALLBACK(channel, server->udp_socket, 0, 0); | ||||||
|       closesocket(server->udp_socket); |       sclose(server->udp_socket); | ||||||
|       server->udp_socket = ARES_SOCKET_BAD; |       server->udp_socket = ARES_SOCKET_BAD; | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| /* $Id$ */ | /* $Id$ */ | ||||||
|  |  | ||||||
| /* Copyright 1998 by the Massachusetts Institute of Technology. | /* Copyright 1998, 2009 by the Massachusetts Institute of Technology. | ||||||
|  * |  * | ||||||
|  * Permission to use, copy, modify, and distribute this |  * Permission to use, copy, modify, and distribute this | ||||||
|  * software and its documentation for any purpose and without |  * software and its documentation for any purpose and without | ||||||
| @@ -15,27 +15,20 @@ | |||||||
|  * without express or implied warranty. |  * without express or implied warranty. | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "setup.h" | #include "ares_setup.h" | ||||||
|  |  | ||||||
| #if !defined(WIN32) || defined(WATT32) |  | ||||||
| #ifdef HAVE_SYS_SOCKET_H | #ifdef HAVE_SYS_SOCKET_H | ||||||
| #include <sys/socket.h> | #  include <sys/socket.h> | ||||||
| #endif | #endif | ||||||
| #ifdef HAVE_NETINET_IN_H | #ifdef HAVE_NETINET_IN_H | ||||||
| #include <netinet/in.h> | #  include <netinet/in.h> | ||||||
| #endif | #endif | ||||||
| #ifdef HAVE_NETDB_H | #ifdef HAVE_NETDB_H | ||||||
| #include <netdb.h> | #  include <netdb.h> | ||||||
| #endif | #endif | ||||||
| #ifdef HAVE_ARPA_INET_H | #ifdef HAVE_ARPA_INET_H | ||||||
| #include <arpa/inet.h> | #  include <arpa/inet.h> | ||||||
| #endif | #endif | ||||||
| #endif |  | ||||||
|  |  | ||||||
| #include <stdio.h> |  | ||||||
| #include <stdlib.h> |  | ||||||
| #include <string.h> |  | ||||||
| #include <ctype.h> |  | ||||||
|  |  | ||||||
| #include "ares.h" | #include "ares.h" | ||||||
| #include "inet_net_pton.h" | #include "inet_net_pton.h" | ||||||
| @@ -43,136 +36,204 @@ | |||||||
|  |  | ||||||
| int ares__get_hostent(FILE *fp, int family, struct hostent **host) | int ares__get_hostent(FILE *fp, int family, struct hostent **host) | ||||||
| { | { | ||||||
|   char *line = NULL, *p, *q, *canonical, **alias; |   char *line = NULL, *p, *q, **alias; | ||||||
|   int status, linesize, end_at_hostname, naliases; |   char *txtaddr, *txthost, *txtalias; | ||||||
|   struct in_addr addr; |   int status; | ||||||
|   struct in6_addr addr6; |   size_t addrlen, linesize, naliases; | ||||||
|   int addrlen = sizeof(struct in_addr); |   struct ares_addr addr; | ||||||
|   struct hostent *hostent = NULL; |   struct hostent *hostent = NULL; | ||||||
|  |  | ||||||
|  |   *host = NULL; /* Assume failure */ | ||||||
|  |  | ||||||
|  |   /* Validate family */ | ||||||
|  |   switch (family) { | ||||||
|  |     case AF_INET: | ||||||
|  |     case AF_INET6: | ||||||
|  |     case AF_UNSPEC: | ||||||
|  |       break; | ||||||
|  |     default: | ||||||
|  |       return ARES_EBADFAMILY; | ||||||
|  |   } | ||||||
|  |  | ||||||
|   while ((status = ares__read_line(fp, &line, &linesize)) == ARES_SUCCESS) |   while ((status = ares__read_line(fp, &line, &linesize)) == ARES_SUCCESS) | ||||||
|     { |     { | ||||||
|       /* Skip comment lines; terminate line at comment character. */ |  | ||||||
|       if (*line == '#' || !*line) |  | ||||||
|         continue; |  | ||||||
|       p = strchr(line, '#'); |  | ||||||
|       if (p) |  | ||||||
|         *p = 0; |  | ||||||
|  |  | ||||||
|       /* Get the address part. */ |       /* Trim line comment. */ | ||||||
|       p = line; |       p = line; | ||||||
|  |       while (*p && (*p != '#')) | ||||||
|  |         p++; | ||||||
|  |       *p = '\0'; | ||||||
|  |  | ||||||
|  |       /* Trim trailing whitespace. */ | ||||||
|  |       q = p - 1; | ||||||
|  |       while ((q >= line) && ISSPACE(*q)) | ||||||
|  |         q--; | ||||||
|  |       *++q = '\0'; | ||||||
|  |  | ||||||
|  |       /* Skip leading whitespace. */ | ||||||
|  |       p = line; | ||||||
|  |       while (*p && ISSPACE(*p)) | ||||||
|  |         p++; | ||||||
|  |       if (!*p) | ||||||
|  |         /* Ignore line if empty. */ | ||||||
|  |         continue; | ||||||
|  |  | ||||||
|  |       /* Pointer to start of IPv4 or IPv6 address part. */ | ||||||
|  |       txtaddr = p; | ||||||
|  |  | ||||||
|  |       /* Advance past address part. */ | ||||||
|       while (*p && !ISSPACE(*p)) |       while (*p && !ISSPACE(*p)) | ||||||
|         p++; |         p++; | ||||||
|       if (!*p) |       if (!*p) | ||||||
|         continue; |         /* Ignore line if reached end of line. */ | ||||||
|       *p = 0; |  | ||||||
|       addr.s_addr = inet_addr(line); |  | ||||||
|       if (addr.s_addr == INADDR_NONE) |  | ||||||
|       { |  | ||||||
|         /* It wasn't an AF_INET dotted address, then AF_UNSPEC and AF_INET6 |  | ||||||
|            families are subject for this further check */ |  | ||||||
|         if ((family != AF_INET) && |  | ||||||
|             (ares_inet_pton(AF_INET6, line, &addr6) > 0)) { |  | ||||||
|           addrlen = sizeof(struct in6_addr); |  | ||||||
|           family = AF_INET6; |  | ||||||
|         } |  | ||||||
|         else |  | ||||||
|           continue; |  | ||||||
|       } |  | ||||||
|       else if (family == AF_UNSPEC) |  | ||||||
|         family = AF_INET; /* now confirmed! */ |  | ||||||
|       else if (family != AF_INET) |  | ||||||
|         /* unknown, keep moving */ |  | ||||||
|         continue; |         continue; | ||||||
|  |  | ||||||
|       /* Get the canonical hostname. */ |       /* Null terminate address part. */ | ||||||
|  |       *p = '\0'; | ||||||
|  |  | ||||||
|  |       /* Advance to host name */ | ||||||
|       p++; |       p++; | ||||||
|       while (ISSPACE(*p)) |       while (*p && ISSPACE(*p)) | ||||||
|         p++; |         p++; | ||||||
|       if (!*p) |       if (!*p) | ||||||
|  |         /* Ignore line if reached end of line. */ | ||||||
|         continue; |         continue; | ||||||
|       q = p; |  | ||||||
|       while (*q && !ISSPACE(*q)) |  | ||||||
|         q++; |  | ||||||
|       end_at_hostname = (*q == 0); |  | ||||||
|       *q = 0; |  | ||||||
|       canonical = p; |  | ||||||
|  |  | ||||||
|       naliases = 0; |       /* Pointer to start of host name. */ | ||||||
|       if (!end_at_hostname) |       txthost = p; | ||||||
|  |  | ||||||
|  |       /* Advance past host name. */ | ||||||
|  |       while (*p && !ISSPACE(*p)) | ||||||
|  |         p++; | ||||||
|  |  | ||||||
|  |       /* Pointer to start of first alias. */ | ||||||
|  |       txtalias = NULL; | ||||||
|  |       if (*p) | ||||||
|         { |         { | ||||||
|           /* Count the aliases. */ |           q = p + 1; | ||||||
|           p = q + 1; |           while (*q && ISSPACE(*q)) | ||||||
|           while (ISSPACE(*p)) |             q++; | ||||||
|             p++; |           if (*q) | ||||||
|  |             txtalias = q; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |       /* Null terminate host name. */ | ||||||
|  |       *p = '\0'; | ||||||
|  |  | ||||||
|  |       /* find out number of aliases. */ | ||||||
|  |       naliases = 0; | ||||||
|  |       if (txtalias) | ||||||
|  |         { | ||||||
|  |           p = txtalias; | ||||||
|           while (*p) |           while (*p) | ||||||
|             { |             { | ||||||
|               while (*p && !ISSPACE(*p)) |               while (*p && !ISSPACE(*p)) | ||||||
|                 p++; |                 p++; | ||||||
|               while (ISSPACE(*p)) |               while (*p && ISSPACE(*p)) | ||||||
|                 p++; |                 p++; | ||||||
|               naliases++; |               naliases++; | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |  | ||||||
|       /* Allocate memory for the host structure. */ |       /* Convert address string to network address for the requested family. */ | ||||||
|  |       addrlen = 0; | ||||||
|  |       addr.family = AF_UNSPEC; | ||||||
|  |       addr.addrV4.s_addr = INADDR_NONE; | ||||||
|  |       if ((family == AF_INET) || (family == AF_UNSPEC)) | ||||||
|  |         { | ||||||
|  |           addr.addrV4.s_addr = inet_addr(txtaddr); | ||||||
|  |           if (addr.addrV4.s_addr != INADDR_NONE) | ||||||
|  |             { | ||||||
|  |               /* Actual network address family and length. */ | ||||||
|  |               addr.family = AF_INET; | ||||||
|  |               addrlen = sizeof(struct in_addr); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |       if ((family == AF_INET6) || ((family == AF_UNSPEC) && (!addrlen))) | ||||||
|  |         { | ||||||
|  |           if (ares_inet_pton(AF_INET6, txtaddr, &addr.addrV6) > 0) | ||||||
|  |             { | ||||||
|  |               /* Actual network address family and length. */ | ||||||
|  |               addr.family = AF_INET6; | ||||||
|  |               addrlen = sizeof(struct in6_addr); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |       if (!addrlen) | ||||||
|  |         /* Ignore line if invalid address string for the requested family. */ | ||||||
|  |         continue; | ||||||
|  |  | ||||||
|  |       /* | ||||||
|  |       ** Actual address family possible values are AF_INET and AF_INET6 only. | ||||||
|  |       */ | ||||||
|  |  | ||||||
|  |       /* Allocate memory for the hostent structure. */ | ||||||
|       hostent = malloc(sizeof(struct hostent)); |       hostent = malloc(sizeof(struct hostent)); | ||||||
|       if (!hostent) |       if (!hostent) | ||||||
|         break; |         break; | ||||||
|  |  | ||||||
|  |       /* Initialize fields for out of memory condition. */ | ||||||
|       hostent->h_aliases = NULL; |       hostent->h_aliases = NULL; | ||||||
|       hostent->h_addr_list = NULL; |       hostent->h_addr_list = NULL; | ||||||
|       hostent->h_name = strdup(canonical); |  | ||||||
|  |       /* Copy official host name. */ | ||||||
|  |       hostent->h_name = strdup(txthost); | ||||||
|       if (!hostent->h_name) |       if (!hostent->h_name) | ||||||
|         break; |         break; | ||||||
|  |  | ||||||
|  |       /* Copy network address. */ | ||||||
|       hostent->h_addr_list = malloc(2 * sizeof(char *)); |       hostent->h_addr_list = malloc(2 * sizeof(char *)); | ||||||
|       if (!hostent->h_addr_list) |       if (!hostent->h_addr_list) | ||||||
|         break; |         break; | ||||||
|  |       hostent->h_addr_list[1] = NULL; | ||||||
|       hostent->h_addr_list[0] = malloc(addrlen); |       hostent->h_addr_list[0] = malloc(addrlen); | ||||||
|       if (!hostent->h_addr_list[0]) |       if (!hostent->h_addr_list[0]) | ||||||
|         break; |         break; | ||||||
|  |       if (addr.family == AF_INET) | ||||||
|  |         memcpy(hostent->h_addr_list[0], &addr.addrV4, sizeof(struct in_addr)); | ||||||
|  |       else | ||||||
|  |         memcpy(hostent->h_addr_list[0], &addr.addrV6, sizeof(struct in6_addr)); | ||||||
|  |  | ||||||
|  |       /* Copy aliases. */ | ||||||
|       hostent->h_aliases = malloc((naliases + 1) * sizeof(char *)); |       hostent->h_aliases = malloc((naliases + 1) * sizeof(char *)); | ||||||
|       if (!hostent->h_aliases) |       if (!hostent->h_aliases) | ||||||
|         break; |         break; | ||||||
|  |       alias = hostent->h_aliases; | ||||||
|       /* Copy in aliases. */ |       while (naliases) | ||||||
|       naliases = 0; |         *(alias + naliases--) = NULL; | ||||||
|       if (!end_at_hostname) |       *alias = NULL; | ||||||
|  |       while (txtalias) | ||||||
|         { |         { | ||||||
|           p = canonical + strlen(canonical) + 1; |           p = txtalias; | ||||||
|           while (ISSPACE(*p)) |           while (*p && !ISSPACE(*p)) | ||||||
|             p++; |             p++; | ||||||
|           while (*p) |           q = p; | ||||||
|             { |           while (*q && ISSPACE(*q)) | ||||||
|               q = p; |             q++; | ||||||
|               while (*q && !ISSPACE(*q)) |           *p = '\0'; | ||||||
|                 q++; |           if ((*alias = strdup(txtalias)) == NULL) | ||||||
|               hostent->h_aliases[naliases] = malloc(q - p + 1); |  | ||||||
|               if (hostent->h_aliases[naliases] == NULL) |  | ||||||
|                 break; |  | ||||||
|               memcpy(hostent->h_aliases[naliases], p, q - p); |  | ||||||
|               hostent->h_aliases[naliases][q - p] = 0; |  | ||||||
|               p = q; |  | ||||||
|               while (ISSPACE(*p)) |  | ||||||
|                 p++; |  | ||||||
|               naliases++; |  | ||||||
|             } |  | ||||||
|           if (*p) |  | ||||||
|             break; |             break; | ||||||
|  |           alias++; | ||||||
|  |           txtalias = *q ? q : NULL; | ||||||
|         } |         } | ||||||
|       hostent->h_aliases[naliases] = NULL; |       if (txtalias) | ||||||
|  |         /* Alias memory allocation failure. */ | ||||||
|  |         break; | ||||||
|  |  | ||||||
|       hostent->h_addrtype = family; |       /* Copy actual network address family and length. */ | ||||||
|       hostent->h_length = addrlen; |       hostent->h_addrtype = addr.family; | ||||||
|       if (family == AF_INET) |       hostent->h_length = (int)addrlen; | ||||||
|         memcpy(hostent->h_addr_list[0], &addr, addrlen); |  | ||||||
|       else if (family == AF_INET6) |       /* Free line buffer. */ | ||||||
|         memcpy(hostent->h_addr_list[0], &addr6, addrlen); |  | ||||||
|       hostent->h_addr_list[1] = NULL; |  | ||||||
|       *host = hostent; |  | ||||||
|       free(line); |       free(line); | ||||||
|  |  | ||||||
|  |       /* Return hostent successfully */ | ||||||
|  |       *host = hostent; | ||||||
|       return ARES_SUCCESS; |       return ARES_SUCCESS; | ||||||
|  |  | ||||||
|     } |     } | ||||||
|   if(line) |  | ||||||
|  |   /* If allocated, free line buffer. */ | ||||||
|  |   if (line) | ||||||
|     free(line); |     free(line); | ||||||
|  |  | ||||||
|   if (status == ARES_SUCCESS) |   if (status == ARES_SUCCESS) | ||||||
| @@ -180,22 +241,22 @@ int ares__get_hostent(FILE *fp, int family, struct hostent **host) | |||||||
|       /* Memory allocation failure; clean up. */ |       /* Memory allocation failure; clean up. */ | ||||||
|       if (hostent) |       if (hostent) | ||||||
|         { |         { | ||||||
|           if(hostent->h_name) |           if (hostent->h_name) | ||||||
|             free((char *) hostent->h_name); |             free((char *) hostent->h_name); | ||||||
|           if (hostent->h_aliases) |           if (hostent->h_aliases) | ||||||
|             { |             { | ||||||
|               for (alias = hostent->h_aliases; *alias; alias++) |               for (alias = hostent->h_aliases; *alias; alias++) | ||||||
|                 free(*alias); |                 free(*alias); | ||||||
|  |               free(hostent->h_aliases); | ||||||
|  |             } | ||||||
|  |           if (hostent->h_addr_list) | ||||||
|  |             { | ||||||
|  |               if (hostent->h_addr_list[0]) | ||||||
|  |                 free(hostent->h_addr_list[0]); | ||||||
|  |               free(hostent->h_addr_list); | ||||||
|             } |             } | ||||||
|           if(hostent->h_aliases) |  | ||||||
|             free(hostent->h_aliases); |  | ||||||
|           if (hostent->h_addr_list && hostent->h_addr_list[0]) |  | ||||||
|             free(hostent->h_addr_list[0]); |  | ||||||
|           if(hostent->h_addr_list) |  | ||||||
|             free(hostent->h_addr_list); |  | ||||||
|           free(hostent); |           free(hostent); | ||||||
|         } |         } | ||||||
|       *host = NULL; |  | ||||||
|       return ARES_ENOMEM; |       return ARES_ENOMEM; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -15,7 +15,7 @@ | |||||||
|  * without express or implied warranty. |  * without express or implied warranty. | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "setup.h" | #include "ares_setup.h" | ||||||
| #include <stdio.h> | #include <stdio.h> | ||||||
| #include <stdlib.h> | #include <stdlib.h> | ||||||
| #include <string.h> | #include <string.h> | ||||||
| @@ -30,7 +30,7 @@ | |||||||
|  * appropriate.  The initial value of *buf should be NULL.  After the |  * appropriate.  The initial value of *buf should be NULL.  After the | ||||||
|  * calling routine is done reading lines, it should free *buf. |  * calling routine is done reading lines, it should free *buf. | ||||||
|  */ |  */ | ||||||
| int ares__read_line(FILE *fp, char **buf, int *bufsize) | int ares__read_line(FILE *fp, char **buf, size_t *bufsize) | ||||||
| { | { | ||||||
|   char *newbuf; |   char *newbuf; | ||||||
|   size_t offset = 0; |   size_t offset = 0; | ||||||
| @@ -46,7 +46,7 @@ int ares__read_line(FILE *fp, char **buf, int *bufsize) | |||||||
|  |  | ||||||
|   while (1) |   while (1) | ||||||
|     { |     { | ||||||
|       if (!fgets(*buf + offset, *bufsize - (int)offset, fp)) |       if (!fgets(*buf + offset, (int)(*bufsize - offset), fp)) | ||||||
|         return (offset != 0) ? 0 : (ferror(fp)) ? ARES_EFILE : ARES_EOF; |         return (offset != 0) ? 0 : (ferror(fp)) ? ARES_EFILE : ARES_EOF; | ||||||
|       len = offset + strlen(*buf + offset); |       len = offset + strlen(*buf + offset); | ||||||
|       if ((*buf)[len - 1] == '\n') |       if ((*buf)[len - 1] == '\n') | ||||||
|   | |||||||
| @@ -13,7 +13,7 @@ | |||||||
|  * without express or implied warranty. |  * without express or implied warranty. | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "setup.h" | #include "ares_setup.h" | ||||||
| #include "ares.h" | #include "ares.h" | ||||||
| #include "ares_private.h" | #include "ares_private.h" | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										253
									
								
								ares/ares_build.h.dist
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										253
									
								
								ares/ares_build.h.dist
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,253 @@ | |||||||
|  | #ifndef __CARES_BUILD_H | ||||||
|  | #define __CARES_BUILD_H | ||||||
|  |  | ||||||
|  | /* $Id$ */ | ||||||
|  |  | ||||||
|  | /* Copyright (C) 2009 by Daniel Stenberg et al | ||||||
|  |  * | ||||||
|  |  * Permission to use, copy, modify, and distribute this software and its | ||||||
|  |  * documentation for any purpose and without fee is hereby granted, provided | ||||||
|  |  * that the above copyright notice appear in all copies and that both that | ||||||
|  |  * copyright notice and this permission notice appear in supporting | ||||||
|  |  * documentation, and that the name of M.I.T. not be used in advertising or | ||||||
|  |  * publicity pertaining to distribution of the software without specific, | ||||||
|  |  * written prior permission.  M.I.T. makes no representations about the | ||||||
|  |  * suitability of this software for any purpose.  It is provided "as is" | ||||||
|  |  * without express or implied warranty. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | /* ================================================================ */ | ||||||
|  | /*               NOTES FOR CONFIGURE CAPABLE SYSTEMS                */ | ||||||
|  | /* ================================================================ */ | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * NOTE 1: | ||||||
|  |  * ------- | ||||||
|  |  * | ||||||
|  |  * See file ares_build.h.in, run configure, and forget that this file | ||||||
|  |  * exists it is only used for non-configure systems. | ||||||
|  |  * But you can keep reading if you want ;-) | ||||||
|  |  * | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | /* ================================================================ */ | ||||||
|  | /*                 NOTES FOR NON-CONFIGURE SYSTEMS                  */ | ||||||
|  | /* ================================================================ */ | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * NOTE 1: | ||||||
|  |  * ------- | ||||||
|  |  * | ||||||
|  |  * Nothing in this file is intended to be modified or adjusted by the | ||||||
|  |  * c-ares library user nor by the c-ares library builder. | ||||||
|  |  * | ||||||
|  |  * If you think that something actually needs to be changed, adjusted | ||||||
|  |  * or fixed in this file, then, report it on the c-ares development | ||||||
|  |  * mailing list: http://cool.haxx.se/mailman/listinfo/c-ares/ | ||||||
|  |  * | ||||||
|  |  * Try to keep one section per platform, compiler and architecture, | ||||||
|  |  * otherwise, if an existing section is reused for a different one and | ||||||
|  |  * later on the original is adjusted, probably the piggybacking one can | ||||||
|  |  * be adversely changed. | ||||||
|  |  * | ||||||
|  |  * In order to differentiate between platforms/compilers/architectures | ||||||
|  |  * use only compiler built in predefined preprocessor symbols. | ||||||
|  |  * | ||||||
|  |  * This header file shall only export symbols which are 'cares' or 'CARES' | ||||||
|  |  * prefixed, otherwise public name space would be polluted. | ||||||
|  |  * | ||||||
|  |  * NOTE 2: | ||||||
|  |  * ------- | ||||||
|  |  * | ||||||
|  |  * Right now you might be staring at file ares_build.h.dist or ares_build.h, | ||||||
|  |  * this is due to the following reason: file ares_build.h.dist is renamed | ||||||
|  |  * to ares_build.h when the c-ares source code distribution archive file is | ||||||
|  |  * created. | ||||||
|  |  * | ||||||
|  |  * File ares_build.h.dist is not included in the distribution archive. | ||||||
|  |  * File ares_build.h is not present in the CVS tree. | ||||||
|  |  * | ||||||
|  |  * The distributed ares_build.h file is only intended to be used on systems | ||||||
|  |  * which can not run the also distributed configure script. | ||||||
|  |  * | ||||||
|  |  * On systems capable of running the configure script, the configure process | ||||||
|  |  * will overwrite the distributed ares_build.h file with one that is suitable | ||||||
|  |  * and specific to the library being configured and built, which is generated | ||||||
|  |  * from the ares_build.h.in template file. | ||||||
|  |  * | ||||||
|  |  * If you check out from CVS on a non-configure platform, you must run the | ||||||
|  |  * appropriate buildconf* script to set up ares_build.h and other local files. | ||||||
|  |  * | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | /* ================================================================ */ | ||||||
|  | /*  DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE  */ | ||||||
|  | /* ================================================================ */ | ||||||
|  |  | ||||||
|  | #ifdef CARES_SIZEOF_LONG | ||||||
|  | #  error "CARES_SIZEOF_LONG shall not be defined except in ares_build.h" | ||||||
|  |    Error Compilation_aborted_CARES_SIZEOF_LONG_already_defined | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #ifdef CARES_TYPEOF_ARES_SOCKLEN_T | ||||||
|  | #  error "CARES_TYPEOF_ARES_SOCKLEN_T shall not be defined except in ares_build.h" | ||||||
|  |    Error Compilation_aborted_CARES_TYPEOF_ARES_SOCKLEN_T_already_defined | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #ifdef CARES_SIZEOF_ARES_SOCKLEN_T | ||||||
|  | #  error "CARES_SIZEOF_ARES_SOCKLEN_T shall not be defined except in ares_build.h" | ||||||
|  |    Error Compilation_aborted_CARES_SIZEOF_ARES_SOCKLEN_T_already_defined | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | /* ================================================================ */ | ||||||
|  | /*    EXTERNAL INTERFACE SETTINGS FOR NON-CONFIGURE SYSTEMS ONLY    */ | ||||||
|  | /* ================================================================ */ | ||||||
|  |  | ||||||
|  | #if defined(__DJGPP__) || defined(__GO32__) | ||||||
|  | #  define CARES_SIZEOF_LONG           4 | ||||||
|  | #  define CARES_TYPEOF_ARES_SOCKLEN_T int | ||||||
|  | #  define CARES_SIZEOF_ARES_SOCKLEN_T 4 | ||||||
|  |  | ||||||
|  | #elif defined(__SALFORDC__) | ||||||
|  | #  define CARES_SIZEOF_LONG           4 | ||||||
|  | #  define CARES_TYPEOF_ARES_SOCKLEN_T int | ||||||
|  | #  define CARES_SIZEOF_ARES_SOCKLEN_T 4 | ||||||
|  |  | ||||||
|  | #elif defined(__BORLANDC__) | ||||||
|  | #  define CARES_SIZEOF_LONG           4 | ||||||
|  | #  define CARES_TYPEOF_ARES_SOCKLEN_T int | ||||||
|  | #  define CARES_SIZEOF_ARES_SOCKLEN_T 4 | ||||||
|  |  | ||||||
|  | #elif defined(__TURBOC__) | ||||||
|  | #  define CARES_SIZEOF_LONG           4 | ||||||
|  | #  define CARES_TYPEOF_ARES_SOCKLEN_T int | ||||||
|  | #  define CARES_SIZEOF_ARES_SOCKLEN_T 4 | ||||||
|  |  | ||||||
|  | #elif defined(__WATCOMC__) | ||||||
|  | #  define CARES_SIZEOF_LONG           4 | ||||||
|  | #  define CARES_TYPEOF_ARES_SOCKLEN_T int | ||||||
|  | #  define CARES_SIZEOF_ARES_SOCKLEN_T 4 | ||||||
|  |  | ||||||
|  | #elif defined(__POCC__) | ||||||
|  | #  define CARES_SIZEOF_LONG           4 | ||||||
|  | #  define CARES_TYPEOF_ARES_SOCKLEN_T int | ||||||
|  | #  define CARES_SIZEOF_ARES_SOCKLEN_T 4 | ||||||
|  |  | ||||||
|  | #elif defined(__LCC__) | ||||||
|  | #  define CARES_SIZEOF_LONG           4 | ||||||
|  | #  define CARES_TYPEOF_ARES_SOCKLEN_T int | ||||||
|  | #  define CARES_SIZEOF_ARES_SOCKLEN_T 4 | ||||||
|  |  | ||||||
|  | #elif defined(__SYMBIAN32__) | ||||||
|  | #  define CARES_SIZEOF_LONG           4 | ||||||
|  | #  define CARES_TYPEOF_ARES_SOCKLEN_T unsigned int | ||||||
|  | #  define CARES_SIZEOF_ARES_SOCKLEN_T 4 | ||||||
|  |  | ||||||
|  | #elif defined(__MWERKS__) | ||||||
|  | #  define CARES_SIZEOF_LONG           4 | ||||||
|  | #  define CARES_TYPEOF_ARES_SOCKLEN_T int | ||||||
|  | #  define CARES_SIZEOF_ARES_SOCKLEN_T 4 | ||||||
|  |  | ||||||
|  | #elif defined(_WIN32_WCE) | ||||||
|  | #  define CARES_SIZEOF_LONG           4 | ||||||
|  | #  define CARES_TYPEOF_ARES_SOCKLEN_T int | ||||||
|  | #  define CARES_SIZEOF_ARES_SOCKLEN_T 4 | ||||||
|  |  | ||||||
|  | #elif defined(__MINGW32__) | ||||||
|  | #  define CARES_SIZEOF_LONG           4 | ||||||
|  | #  define CARES_TYPEOF_ARES_SOCKLEN_T int | ||||||
|  | #  define CARES_SIZEOF_ARES_SOCKLEN_T 4 | ||||||
|  |  | ||||||
|  | #elif defined(__VMS) | ||||||
|  | #  define CARES_SIZEOF_LONG           4 | ||||||
|  | #  define CARES_TYPEOF_ARES_SOCKLEN_T unsigned int | ||||||
|  | #  define CARES_SIZEOF_ARES_SOCKLEN_T 4 | ||||||
|  |  | ||||||
|  | #elif defined(__OS400__) | ||||||
|  | #  if defined(__ILEC400__) | ||||||
|  | #    define CARES_SIZEOF_LONG           4 | ||||||
|  | #    define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t | ||||||
|  | #    define CARES_SIZEOF_ARES_SOCKLEN_T 4 | ||||||
|  | #    define CARES_PULL_SYS_TYPES_H      1 | ||||||
|  | #    define CARES_PULL_SYS_SOCKET_H     1 | ||||||
|  | #  endif | ||||||
|  |  | ||||||
|  | #elif defined(__MVS__) | ||||||
|  | #  if defined(__IBMC__) || defined(__IBMCPP__) | ||||||
|  | #    if defined(_ILP32) | ||||||
|  | #      define CARES_SIZEOF_LONG           4 | ||||||
|  | #    elif defined(_LP64) | ||||||
|  | #      define CARES_SIZEOF_LONG           8 | ||||||
|  | #    endif | ||||||
|  | #    define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t | ||||||
|  | #    define CARES_SIZEOF_ARES_SOCKLEN_T 4 | ||||||
|  | #    define CARES_PULL_SYS_TYPES_H      1 | ||||||
|  | #    define CARES_PULL_SYS_SOCKET_H     1 | ||||||
|  | #  endif | ||||||
|  |  | ||||||
|  | #elif defined(__370__) | ||||||
|  | #  if defined(__IBMC__) || defined(__IBMCPP__) | ||||||
|  | #    if defined(_ILP32) | ||||||
|  | #      define CARES_SIZEOF_LONG           4 | ||||||
|  | #    elif defined(_LP64) | ||||||
|  | #      define CARES_SIZEOF_LONG           8 | ||||||
|  | #    endif | ||||||
|  | #    define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t | ||||||
|  | #    define CARES_SIZEOF_ARES_SOCKLEN_T 4 | ||||||
|  | #    define CARES_PULL_SYS_TYPES_H      1 | ||||||
|  | #    define CARES_PULL_SYS_SOCKET_H     1 | ||||||
|  | #  endif | ||||||
|  |  | ||||||
|  | #elif defined(TPF) | ||||||
|  | #  define CARES_SIZEOF_LONG           8 | ||||||
|  | #  define CARES_TYPEOF_ARES_SOCKLEN_T int | ||||||
|  | #  define CARES_SIZEOF_ARES_SOCKLEN_T 4 | ||||||
|  |  | ||||||
|  | /* ===================================== */ | ||||||
|  | /*    KEEP MSVC THE PENULTIMATE ENTRY    */ | ||||||
|  | /* ===================================== */ | ||||||
|  |  | ||||||
|  | #elif defined(_MSC_VER) | ||||||
|  | #  define CARES_SIZEOF_LONG           4 | ||||||
|  | #  define CARES_TYPEOF_ARES_SOCKLEN_T int | ||||||
|  | #  define CARES_SIZEOF_ARES_SOCKLEN_T 4 | ||||||
|  |  | ||||||
|  | /* ===================================== */ | ||||||
|  | /*    KEEP GENERIC GCC THE LAST ENTRY    */ | ||||||
|  | /* ===================================== */ | ||||||
|  |  | ||||||
|  | #elif defined(__GNUC__) | ||||||
|  | #  if defined(__i386__) || defined(__ppc__) | ||||||
|  | #    define CARES_SIZEOF_LONG           4 | ||||||
|  | #  elif defined(__x86_64__) || defined(__ppc64__) | ||||||
|  | #    define CARES_SIZEOF_LONG           8 | ||||||
|  | #  endif | ||||||
|  | #  define CARES_TYPEOF_ARES_SOCKLEN_T socklen_t | ||||||
|  | #  define CARES_SIZEOF_ARES_SOCKLEN_T 4 | ||||||
|  | #  define CARES_PULL_SYS_TYPES_H      1 | ||||||
|  | #  define CARES_PULL_SYS_SOCKET_H     1 | ||||||
|  |  | ||||||
|  | #else | ||||||
|  | #  error "Unknown non-configure build target!" | ||||||
|  |    Error Compilation_aborted_Unknown_non_configure_build_target | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | /* CARES_PULL_SYS_TYPES_H is defined above when inclusion of header file  */ | ||||||
|  | /* sys/types.h is required here to properly make type definitions below.  */ | ||||||
|  | #ifdef CARES_PULL_SYS_TYPES_H | ||||||
|  | #  include <sys/types.h> | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | /* CARES_PULL_SYS_SOCKET_H is defined above when inclusion of header file  */ | ||||||
|  | /* sys/socket.h is required here to properly make type definitions below.  */ | ||||||
|  | #ifdef CARES_PULL_SYS_SOCKET_H | ||||||
|  | #  include <sys/socket.h> | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | /* Data type definition of ares_socklen_t. */ | ||||||
|  |  | ||||||
|  | #ifdef CARES_TYPEOF_ARES_SOCKLEN_T | ||||||
|  |   typedef CARES_TYPEOF_ARES_SOCKLEN_T ares_socklen_t; | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #endif /* __CARES_BUILD_H */ | ||||||
							
								
								
									
										111
									
								
								ares/ares_build.h.in
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										111
									
								
								ares/ares_build.h.in
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,111 @@ | |||||||
|  | #ifndef __CARES_BUILD_H | ||||||
|  | #define __CARES_BUILD_H | ||||||
|  |  | ||||||
|  | /* $Id$ */ | ||||||
|  |  | ||||||
|  | /* Copyright (C) 2009 by Daniel Stenberg et al | ||||||
|  |  * | ||||||
|  |  * Permission to use, copy, modify, and distribute this software and its | ||||||
|  |  * documentation for any purpose and without fee is hereby granted, provided | ||||||
|  |  * that the above copyright notice appear in all copies and that both that | ||||||
|  |  * copyright notice and this permission notice appear in supporting | ||||||
|  |  * documentation, and that the name of M.I.T. not be used in advertising or | ||||||
|  |  * publicity pertaining to distribution of the software without specific, | ||||||
|  |  * written prior permission.  M.I.T. makes no representations about the | ||||||
|  |  * suitability of this software for any purpose.  It is provided "as is" | ||||||
|  |  * without express or implied warranty. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | /* ================================================================ */ | ||||||
|  | /*               NOTES FOR CONFIGURE CAPABLE SYSTEMS                */ | ||||||
|  | /* ================================================================ */ | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * NOTE 1: | ||||||
|  |  * ------- | ||||||
|  |  * | ||||||
|  |  * Nothing in this file is intended to be modified or adjusted by the | ||||||
|  |  * c-ares library user nor by the c-ares library builder. | ||||||
|  |  * | ||||||
|  |  * If you think that something actually needs to be changed, adjusted | ||||||
|  |  * or fixed in this file, then, report it on the c-ares development | ||||||
|  |  * mailing list: http://cool.haxx.se/mailman/listinfo/c-ares/ | ||||||
|  |  * | ||||||
|  |  * This header file shall only export symbols which are 'cares' or 'CARES' | ||||||
|  |  * prefixed, otherwise public name space would be polluted. | ||||||
|  |  * | ||||||
|  |  * NOTE 2: | ||||||
|  |  * ------- | ||||||
|  |  * | ||||||
|  |  * Right now you might be staring at file ares_build.h.in or ares_build.h, | ||||||
|  |  * this is due to the following reason: | ||||||
|  |  * | ||||||
|  |  * On systems capable of running the configure script, the configure process | ||||||
|  |  * will overwrite the distributed ares_build.h file with one that is suitable | ||||||
|  |  * and specific to the library being configured and built, which is generated | ||||||
|  |  * from the ares_build.h.in template file. | ||||||
|  |  * | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | /* ================================================================ */ | ||||||
|  | /*  DEFINITION OF THESE SYMBOLS SHALL NOT TAKE PLACE ANYWHERE ELSE  */ | ||||||
|  | /* ================================================================ */ | ||||||
|  |  | ||||||
|  | #ifdef CARES_SIZEOF_LONG | ||||||
|  | #  error "CARES_SIZEOF_LONG shall not be defined except in ares_build.h" | ||||||
|  |    Error Compilation_aborted_CARES_SIZEOF_LONG_already_defined | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #ifdef CARES_TYPEOF_ARES_SOCKLEN_T | ||||||
|  | #  error "CARES_TYPEOF_ARES_SOCKLEN_T shall not be defined except in ares_build.h" | ||||||
|  |    Error Compilation_aborted_CARES_TYPEOF_ARES_SOCKLEN_T_already_defined | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #ifdef CARES_SIZEOF_ARES_SOCKLEN_T | ||||||
|  | #  error "CARES_SIZEOF_ARES_SOCKLEN_T shall not be defined except in ares_build.h" | ||||||
|  |    Error Compilation_aborted_CARES_SIZEOF_ARES_SOCKLEN_T_already_defined | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | /* ================================================================ */ | ||||||
|  | /*  EXTERNAL INTERFACE SETTINGS FOR CONFIGURE CAPABLE SYSTEMS ONLY  */ | ||||||
|  | /* ================================================================ */ | ||||||
|  |  | ||||||
|  | /* Configure process defines this to 1 when it finds out that system  */ | ||||||
|  | /* header file ws2tcpip.h must be included by the external interface. */ | ||||||
|  | #undef CARES_PULL_WS2TCPIP_H | ||||||
|  | #ifdef CARES_PULL_WS2TCPIP_H | ||||||
|  | #  ifndef WIN32_LEAN_AND_MEAN | ||||||
|  | #    define WIN32_LEAN_AND_MEAN | ||||||
|  | #  endif | ||||||
|  | #  include <windows.h> | ||||||
|  | #  include <winsock2.h> | ||||||
|  | #  include <ws2tcpip.h> | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | /* Configure process defines this to 1 when it finds out that system   */ | ||||||
|  | /* header file sys/types.h must be included by the external interface. */ | ||||||
|  | #undef CARES_PULL_SYS_TYPES_H | ||||||
|  | #ifdef CARES_PULL_SYS_TYPES_H | ||||||
|  | #  include <sys/types.h> | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | /* Configure process defines this to 1 when it finds out that system    */ | ||||||
|  | /* header file sys/socket.h must be included by the external interface. */ | ||||||
|  | #undef CARES_PULL_SYS_SOCKET_H | ||||||
|  | #ifdef CARES_PULL_SYS_SOCKET_H | ||||||
|  | #  include <sys/socket.h> | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | /* The size of `long', as computed by sizeof. */ | ||||||
|  | #undef CARES_SIZEOF_LONG | ||||||
|  |  | ||||||
|  | /* Integral data type used for ares_socklen_t. */ | ||||||
|  | #undef CARES_TYPEOF_ARES_SOCKLEN_T | ||||||
|  |  | ||||||
|  | /* The size of `ares_socklen_t', as computed by sizeof. */ | ||||||
|  | #undef CARES_SIZEOF_ARES_SOCKLEN_T | ||||||
|  |  | ||||||
|  | /* Data type definition of ares_socklen_t. */ | ||||||
|  | typedef CARES_TYPEOF_ARES_SOCKLEN_T ares_socklen_t; | ||||||
|  |  | ||||||
|  | #endif /* __CARES_BUILD_H */ | ||||||
| @@ -27,7 +27,7 @@ ares_cancel \- Cancel a resolve | |||||||
| The \fBares_cancel\fP function cancels all lookups/requests made on the the | The \fBares_cancel\fP function cancels all lookups/requests made on the the | ||||||
| name service channel identified by \fIchannel\fP.  \fBares_cancel\fP invokes | name service channel identified by \fIchannel\fP.  \fBares_cancel\fP invokes | ||||||
| the callbacks for each pending query on the channel, passing a status of | the callbacks for each pending query on the channel, passing a status of | ||||||
| .BR ARES_ETIMEOUT . | .BR ARES_ECANCELLED . | ||||||
| These calls give the callbacks a chance to clean up any state which | These calls give the callbacks a chance to clean up any state which | ||||||
| might have been stored in their arguments. | might have been stored in their arguments. | ||||||
| .SH SEE ALSO | .SH SEE ALSO | ||||||
| @@ -35,5 +35,10 @@ might have been stored in their arguments. | |||||||
| .BR ares_destroy (3) | .BR ares_destroy (3) | ||||||
| .SH NOTES | .SH NOTES | ||||||
| This function was added in c-ares 1.2.0 | This function was added in c-ares 1.2.0 | ||||||
|  |  | ||||||
|  | c-ares 1.6.0 and earlier pass a status of | ||||||
|  | .BR ARES_ETIMEOUT | ||||||
|  | instead of | ||||||
|  | .BR ARES_ECANCELLED . | ||||||
| .SH AUTHOR | .SH AUTHOR | ||||||
| Dirk Manske | Dirk Manske | ||||||
|   | |||||||
| @@ -13,7 +13,7 @@ | |||||||
|  * without express or implied warranty. |  * without express or implied warranty. | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "setup.h" | #include "ares_setup.h" | ||||||
| #include <assert.h> | #include <assert.h> | ||||||
| #include <stdlib.h> | #include <stdlib.h> | ||||||
| #include "ares.h" | #include "ares.h" | ||||||
| @@ -36,7 +36,7 @@ void ares_cancel(ares_channel channel) | |||||||
|   { |   { | ||||||
|     query = list_node->data; |     query = list_node->data; | ||||||
|     list_node = list_node->next;  /* since we're deleting the query */ |     list_node = list_node->next;  /* since we're deleting the query */ | ||||||
|     query->callback(query->arg, ARES_ETIMEOUT, 0, NULL, 0); |     query->callback(query->arg, ARES_ECANCELLED, 0, NULL, 0); | ||||||
|     ares__free_query(query); |     ares__free_query(query); | ||||||
|   } |   } | ||||||
| #ifndef NDEBUG | #ifndef NDEBUG | ||||||
|   | |||||||
| @@ -15,7 +15,7 @@ | |||||||
|  * without express or implied warranty. |  * without express or implied warranty. | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "setup.h" | #include "ares_setup.h" | ||||||
| #include <assert.h> | #include <assert.h> | ||||||
| #include <stdlib.h> | #include <stdlib.h> | ||||||
| #include "ares.h" | #include "ares.h" | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| .\" $Id$ | .\" $Id$ | ||||||
| .\" | .\" | ||||||
| .\" Copyright (C) 2007-2008 by Daniel Stenberg | .\" Copyright (C) 2004-2009 by Daniel Stenberg | ||||||
| .\" | .\" | ||||||
| .\" Permission to use, copy, modify, and distribute this | .\" Permission to use, copy, modify, and distribute this | ||||||
| .\" software and its documentation for any purpose and without | .\" software and its documentation for any purpose and without | ||||||
| @@ -14,7 +14,7 @@ | |||||||
| .\" this software for any purpose.  It is provided "as is" | .\" this software for any purpose.  It is provided "as is" | ||||||
| .\" without express or implied warranty. | .\" without express or implied warranty. | ||||||
| .\" | .\" | ||||||
| .TH ARES_DUP 3 "2 Dec 2008" | .TH ARES_DUP 3 "26 May 2009" | ||||||
| .SH NAME | .SH NAME | ||||||
| ares_dup \- Duplicate a resolver channel | ares_dup \- Duplicate a resolver channel | ||||||
| .SH SYNOPSIS | .SH SYNOPSIS | ||||||
| @@ -35,7 +35,8 @@ with additional options set exactly as the \fIsource\fP channel has them | |||||||
| configured. | configured. | ||||||
| .SH SEE ALSO | .SH SEE ALSO | ||||||
| .BR ares_destroy(3), | .BR ares_destroy(3), | ||||||
| .BR ares_init(3) | .BR ares_init(3), | ||||||
|  | .BR ares_library_init(3) | ||||||
| .SH AVAILABILITY | .SH AVAILABILITY | ||||||
| ares_dup(3) was added in c-ares 1.6.0 | ares_dup(3) was added in c-ares 1.6.0 | ||||||
| .SH AUTHOR | .SH AUTHOR | ||||||
|   | |||||||
| @@ -15,7 +15,7 @@ | |||||||
|  * without express or implied warranty. |  * without express or implied warranty. | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "setup.h" | #include "ares_setup.h" | ||||||
|  |  | ||||||
| #ifdef HAVE_SYS_SOCKET_H | #ifdef HAVE_SYS_SOCKET_H | ||||||
| #  include <sys/socket.h> | #  include <sys/socket.h> | ||||||
| @@ -71,10 +71,10 @@ int ares_expand_name(const unsigned char *encoded, const unsigned char *abuf, | |||||||
|   const unsigned char *p; |   const unsigned char *p; | ||||||
|  |  | ||||||
|   len = name_length(encoded, abuf, alen); |   len = name_length(encoded, abuf, alen); | ||||||
|   if (len == -1) |   if (len < 0) | ||||||
|     return ARES_EBADNAME; |     return ARES_EBADNAME; | ||||||
|  |  | ||||||
|   *s = malloc(len + 1); |   *s = malloc(((size_t)len) + 1); | ||||||
|   if (!*s) |   if (!*s) | ||||||
|     return ARES_ENOMEM; |     return ARES_ENOMEM; | ||||||
|   q = *s; |   q = *s; | ||||||
|   | |||||||
| @@ -15,7 +15,7 @@ | |||||||
|  * without express or implied warranty. |  * without express or implied warranty. | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "setup.h" | #include "ares_setup.h" | ||||||
|  |  | ||||||
| #ifdef HAVE_SYS_SOCKET_H | #ifdef HAVE_SYS_SOCKET_H | ||||||
| #  include <sys/socket.h> | #  include <sys/socket.h> | ||||||
|   | |||||||
| @@ -15,7 +15,7 @@ | |||||||
|  * without express or implied warranty. |  * without express or implied warranty. | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "setup.h" | #include "ares_setup.h" | ||||||
|  |  | ||||||
| #ifdef HAVE_SYS_TIME_H | #ifdef HAVE_SYS_TIME_H | ||||||
| #include <sys/time.h> | #include <sys/time.h> | ||||||
|   | |||||||
| @@ -15,7 +15,7 @@ | |||||||
|  * without express or implied warranty. |  * without express or implied warranty. | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "setup.h" | #include "ares_setup.h" | ||||||
| #include <stdlib.h> | #include <stdlib.h> | ||||||
|  |  | ||||||
| #if !defined(WIN32) || defined(WATT32) | #if !defined(WIN32) || defined(WATT32) | ||||||
|   | |||||||
| @@ -15,7 +15,7 @@ | |||||||
|  * without express or implied warranty. |  * without express or implied warranty. | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "setup.h" | #include "ares_setup.h" | ||||||
| #include <stdlib.h> | #include <stdlib.h> | ||||||
| #include "ares.h" | #include "ares.h" | ||||||
| #include "ares_private.h" | #include "ares_private.h" | ||||||
|   | |||||||
| @@ -14,7 +14,7 @@ | |||||||
|  * this software for any purpose.  It is provided "as is" |  * this software for any purpose.  It is provided "as is" | ||||||
|  * without express or implied warranty. |  * without express or implied warranty. | ||||||
|  */ |  */ | ||||||
| #include "setup.h" | #include "ares_setup.h" | ||||||
|  |  | ||||||
| #ifdef HAVE_SYS_SOCKET_H | #ifdef HAVE_SYS_SOCKET_H | ||||||
| #  include <sys/socket.h> | #  include <sys/socket.h> | ||||||
| @@ -145,16 +145,23 @@ static void addr_callback(void *arg, int status, int timeouts, | |||||||
| { | { | ||||||
|   struct addr_query *aquery = (struct addr_query *) arg; |   struct addr_query *aquery = (struct addr_query *) arg; | ||||||
|   struct hostent *host; |   struct hostent *host; | ||||||
|  |   size_t addrlen; | ||||||
|  |  | ||||||
|   aquery->timeouts += timeouts; |   aquery->timeouts += timeouts; | ||||||
|   if (status == ARES_SUCCESS) |   if (status == ARES_SUCCESS) | ||||||
|     { |     { | ||||||
|       if (aquery->addr.family == AF_INET) |       if (aquery->addr.family == AF_INET) | ||||||
|         status = ares_parse_ptr_reply(abuf, alen, &aquery->addr.addrV4, |         { | ||||||
|                                       sizeof(struct in_addr), AF_INET, &host); |           addrlen = sizeof(struct in_addr); | ||||||
|  |           status = ares_parse_ptr_reply(abuf, alen, &aquery->addr.addrV4, | ||||||
|  |                                         (int)addrlen, AF_INET, &host); | ||||||
|  |         } | ||||||
|       else |       else | ||||||
|         status = ares_parse_ptr_reply(abuf, alen, &aquery->addr.addrV6, |         { | ||||||
|                                       sizeof(struct in6_addr), AF_INET6, &host); |           addrlen = sizeof(struct in6_addr); | ||||||
|  |           status = ares_parse_ptr_reply(abuf, alen, &aquery->addr.addrV6, | ||||||
|  |                                         (int)addrlen, AF_INET6, &host); | ||||||
|  |         } | ||||||
|       end_aquery(aquery, status, host); |       end_aquery(aquery, status, host); | ||||||
|     } |     } | ||||||
|   else if (status == ARES_EDESTRUCTION) |   else if (status == ARES_EDESTRUCTION) | ||||||
|   | |||||||
| @@ -15,7 +15,7 @@ | |||||||
|  * without express or implied warranty. |  * without express or implied warranty. | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "setup.h" | #include "ares_setup.h" | ||||||
|  |  | ||||||
| #ifdef HAVE_SYS_SOCKET_H | #ifdef HAVE_SYS_SOCKET_H | ||||||
| #  include <sys/socket.h> | #  include <sys/socket.h> | ||||||
| @@ -245,15 +245,16 @@ static int fake_hostent(const char *name, int family, ares_host_callback callbac | |||||||
|   struct in_addr in; |   struct in_addr in; | ||||||
|   struct in6_addr in6; |   struct in6_addr in6; | ||||||
|  |  | ||||||
|   if (family == AF_INET) |   if (family == AF_INET || family == AF_INET6) | ||||||
|     { |     { | ||||||
|       /* It only looks like an IP address if it's all numbers and dots. */ |       /* It only looks like an IP address if it's all numbers and dots. */ | ||||||
|       int numdots = 0; |       int numdots = 0, valid = 1; | ||||||
|       const char *p; |       const char *p; | ||||||
|       for (p = name; *p; p++) |       for (p = name; *p; p++) | ||||||
|         { |         { | ||||||
|           if (!ISDIGIT(*p) && *p != '.') { |           if (!ISDIGIT(*p) && *p != '.') { | ||||||
|             return 0; |             valid = 0; | ||||||
|  |             break; | ||||||
|           } else if (*p == '.') { |           } else if (*p == '.') { | ||||||
|             numdots++; |             numdots++; | ||||||
|           } |           } | ||||||
| @@ -262,12 +263,15 @@ static int fake_hostent(const char *name, int family, ares_host_callback callbac | |||||||
|       /* if we don't have 3 dots, it is illegal |       /* if we don't have 3 dots, it is illegal | ||||||
|        * (although inet_addr doesn't think so). |        * (although inet_addr doesn't think so). | ||||||
|        */ |        */ | ||||||
|       if (numdots != 3) |       if (numdots != 3 || !valid) | ||||||
|         result = 0; |         result = 0; | ||||||
|       else |       else | ||||||
|         result = ((in.s_addr = inet_addr(name)) == INADDR_NONE ? 0 : 1); |         result = ((in.s_addr = inet_addr(name)) == INADDR_NONE ? 0 : 1); | ||||||
|  |  | ||||||
|  |       if (result) | ||||||
|  |         family = AF_INET; | ||||||
|     } |     } | ||||||
|   else if (family == AF_INET6) |   if (family == AF_INET6) | ||||||
|     result = (ares_inet_pton(AF_INET6, name, &in6) < 1 ? 0 : 1); |     result = (ares_inet_pton(AF_INET6, name, &in6) < 1 ? 0 : 1); | ||||||
|  |  | ||||||
|   if (!result) |   if (!result) | ||||||
| @@ -275,12 +279,12 @@ static int fake_hostent(const char *name, int family, ares_host_callback callbac | |||||||
|  |  | ||||||
|   if (family == AF_INET) |   if (family == AF_INET) | ||||||
|     { |     { | ||||||
|       hostent.h_length = sizeof(struct in_addr); |       hostent.h_length = (int)sizeof(struct in_addr); | ||||||
|       addrs[0] = (char *)∈ |       addrs[0] = (char *)∈ | ||||||
|     } |     } | ||||||
|   else if (family == AF_INET6) |   else if (family == AF_INET6) | ||||||
|     { |     { | ||||||
|       hostent.h_length = sizeof(struct in6_addr); |       hostent.h_length = (int)sizeof(struct in6_addr); | ||||||
|       addrs[0] = (char *)&in6; |       addrs[0] = (char *)&in6; | ||||||
|     } |     } | ||||||
|   /* Duplicate the name, to avoid a constness violation. */ |   /* Duplicate the name, to avoid a constness violation. */ | ||||||
|   | |||||||
| @@ -1,150 +1,150 @@ | |||||||
| .\" $Id$ | .\" $Id$ | ||||||
| .\" | .\" | ||||||
| .\" Copyright 2005 by Dominick Meglio. | .\" Copyright 2005 by Dominick Meglio. | ||||||
| .\" | .\" | ||||||
| .\" Permission to use, copy, modify, and distribute this | .\" Permission to use, copy, modify, and distribute this | ||||||
| .\" software and its documentation for any purpose and without | .\" software and its documentation for any purpose and without | ||||||
| .\" fee is hereby granted, provided that the above copyright | .\" fee is hereby granted, provided that the above copyright | ||||||
| .\" notice appear in all copies and that both that copyright | .\" notice appear in all copies and that both that copyright | ||||||
| .\" notice and this permission notice appear in supporting | .\" notice and this permission notice appear in supporting | ||||||
| .\" documentation, and that the name of M.I.T. not be used in | .\" documentation, and that the name of M.I.T. not be used in | ||||||
| .\" advertising or publicity pertaining to distribution of the | .\" advertising or publicity pertaining to distribution of the | ||||||
| .\" software without specific, written prior permission. | .\" software without specific, written prior permission. | ||||||
| .\" M.I.T. makes no representations about the suitability of | .\" M.I.T. makes no representations about the suitability of | ||||||
| .\" this software for any purpose.  It is provided "as is" | .\" this software for any purpose.  It is provided "as is" | ||||||
| .\" without express or implied warranty. | .\" without express or implied warranty. | ||||||
| .\" | .\" | ||||||
| .TH ARES_GETNAMEINFO 3 "16 May 2005" | .TH ARES_GETNAMEINFO 3 "1 May 2009" | ||||||
| .SH NAME | .SH NAME | ||||||
| ares_getnameinfo \- Address-to-nodename translation in protocol-independent manner | ares_getnameinfo \- Address-to-nodename translation in protocol-independent manner | ||||||
| .SH SYNOPSIS | .SH SYNOPSIS | ||||||
| .nf | .nf | ||||||
| .B #include <ares.h> | .B #include <ares.h> | ||||||
| .PP | .PP | ||||||
| .B typedef void (*ares_nameinfo_callback)(void *\fIarg\fP, int \fIstatus\fP, | .B typedef void (*ares_nameinfo_callback)(void *\fIarg\fP, int \fIstatus\fP, | ||||||
| .B	int \fItimeouts\fP, char *\fInode\fP, char *\fIservice\fP) | .B	int \fItimeouts\fP, char *\fInode\fP, char *\fIservice\fP) | ||||||
| .PP | .PP | ||||||
| .B void ares_getnameinfo(ares_channel \fIchannel\fP, const struct sockaddr *\fIsa\fP, | .B void ares_getnameinfo(ares_channel \fIchannel\fP, const struct sockaddr *\fIsa\fP, | ||||||
| .B 	socklen_t \fIsalen\fP, int \fIflags\fP, ares_nameinfo_callback \fIcallback\fP, | .B 	ares_socklen_t \fIsalen\fP, int \fIflags\fP, ares_nameinfo_callback \fIcallback\fP, | ||||||
| .B 	void *\fIarg\fP) | .B 	void *\fIarg\fP) | ||||||
| .fi | .fi | ||||||
| .SH DESCRIPTION | .SH DESCRIPTION | ||||||
| The | The | ||||||
| .B ares_getnameinfo | .B ares_getnameinfo | ||||||
| function is defined for protocol-independent address translation. The function | function is defined for protocol-independent address translation. The function | ||||||
| is a combination of \fIares_gethostbyaddr(3)\fP and \fIgetservbyport(3)\fP. The function will | is a combination of \fIares_gethostbyaddr(3)\fP and \fIgetservbyport(3)\fP. The function will | ||||||
| translate the address either by executing a host query on the name service channel | translate the address either by executing a host query on the name service channel | ||||||
| identified by | identified by | ||||||
| .IR channel  | .IR channel  | ||||||
| or it will attempt to resolve it locally if possible. | or it will attempt to resolve it locally if possible. | ||||||
| The parameters | The parameters | ||||||
| .I sa | .I sa | ||||||
| and | and | ||||||
| .I len | .I len | ||||||
| give the address as a sockaddr structure, and | give the address as a sockaddr structure, and | ||||||
| .I flags | .I flags | ||||||
| gives the options that the function will use.  Valid flags are listed below: | gives the options that the function will use.  Valid flags are listed below: | ||||||
| .TP 19 | .TP 19 | ||||||
| .B ARES_NI_NOFQDN | .B ARES_NI_NOFQDN | ||||||
| Only the nodename portion of the FQDN is returned for local hosts. | Only the nodename portion of the FQDN is returned for local hosts. | ||||||
| .TP 19 | .TP 19 | ||||||
| .B ARES_NI_NUMERICHOST | .B ARES_NI_NUMERICHOST | ||||||
| The numeric form of the hostname is returned rather than the name. | The numeric form of the hostname is returned rather than the name. | ||||||
| .TP 19 | .TP 19 | ||||||
| .B ARES_NI_NAMEREQD | .B ARES_NI_NAMEREQD | ||||||
| An error is returned if the hostname cannot be found in the DNS. | An error is returned if the hostname cannot be found in the DNS. | ||||||
| .TP 19 | .TP 19 | ||||||
| .B ARES_NI_NUMERICSERV | .B ARES_NI_NUMERICSERV | ||||||
| The numeric form of the service is returned rather than the name. | The numeric form of the service is returned rather than the name. | ||||||
| .TP 19 | .TP 19 | ||||||
| .B ARES_NI_TCP | .B ARES_NI_TCP | ||||||
| The service name is to be looked up for the TCP protocol. | The service name is to be looked up for the TCP protocol. | ||||||
| .TP 19 | .TP 19 | ||||||
| .B ARES_NI_UDP | .B ARES_NI_UDP | ||||||
| The service name is to be looked up for the UDP protocol. | The service name is to be looked up for the UDP protocol. | ||||||
| .TP 19 | .TP 19 | ||||||
| .B ARES_NI_SCTP | .B ARES_NI_SCTP | ||||||
| The service name is to be looked up for the SCTP protocol. | The service name is to be looked up for the SCTP protocol. | ||||||
| .TP 19 | .TP 19 | ||||||
| .B ARES_NI_DCCP | .B ARES_NI_DCCP | ||||||
| The service name is to be looked up for the DCCP protocol. | The service name is to be looked up for the DCCP protocol. | ||||||
| .TP 19 | .TP 19 | ||||||
| .B ARES_NI_NUMERICSCOPE | .B ARES_NI_NUMERICSCOPE | ||||||
| The numeric form of the scope ID is returned rather than the name. | The numeric form of the scope ID is returned rather than the name. | ||||||
| .TP 19 | .TP 19 | ||||||
| .B ARES_NI_LOOKUPHOST | .B ARES_NI_LOOKUPHOST | ||||||
| A hostname lookup is being requested. | A hostname lookup is being requested. | ||||||
| .TP 19 | .TP 19 | ||||||
| .B ARES_NI_LOOKUPSERVICE | .B ARES_NI_LOOKUPSERVICE | ||||||
| A service name lookup is being requested. | A service name lookup is being requested. | ||||||
| .PP | .PP | ||||||
| When the query | When the query | ||||||
| is complete or has  | is complete or has  | ||||||
| failed, the ares library will invoke \fIcallback\fP.  Completion or failure of  | failed, the ares library will invoke \fIcallback\fP.  Completion or failure of  | ||||||
| the query may happen immediately, or may happen during a later call to | the query may happen immediately, or may happen during a later call to | ||||||
| \fIares_process(3)\fP, \fIares_destroy(3)\fP or \fIares_cancel(3)\fP. | \fIares_process(3)\fP, \fIares_destroy(3)\fP or \fIares_cancel(3)\fP. | ||||||
| .PP | .PP | ||||||
| The callback argument | The callback argument | ||||||
| .I arg | .I arg | ||||||
| is copied from the | is copied from the | ||||||
| .B ares_getnameinfo | .B ares_getnameinfo | ||||||
| argument | argument | ||||||
| .IR arg . | .IR arg . | ||||||
| The callback argument | The callback argument | ||||||
| .I status | .I status | ||||||
| indicates whether the query succeeded and, if not, how it failed.  It | indicates whether the query succeeded and, if not, how it failed.  It | ||||||
| may have any of the following values: | may have any of the following values: | ||||||
| .TP 19 | .TP 19 | ||||||
| .B ARES_SUCCESS | .B ARES_SUCCESS | ||||||
| The host lookup completed successfully. | The host lookup completed successfully. | ||||||
| .TP 19 | .TP 19 | ||||||
| .B ARES_ENOTIMP | .B ARES_ENOTIMP | ||||||
| The ares library does not know how to look up addresses of type | The ares library does not know how to look up addresses of type | ||||||
| .IR family . | .IR family . | ||||||
| .TP 19 | .TP 19 | ||||||
| .B ARES_ENOTFOUND | .B ARES_ENOTFOUND | ||||||
| The address | The address | ||||||
| .I addr | .I addr | ||||||
| was not found. | was not found. | ||||||
| .TP 19 | .TP 19 | ||||||
| .B ARES_ENOMEM | .B ARES_ENOMEM | ||||||
| Memory was exhausted. | Memory was exhausted. | ||||||
| .TP 19 | .TP 19 | ||||||
| .B ARES_EDESTRUCTION | .B ARES_EDESTRUCTION | ||||||
| The name service channel | The name service channel | ||||||
| .I channel | .I channel | ||||||
| is being destroyed; the query will not be completed. | is being destroyed; the query will not be completed. | ||||||
| .TP 19 | .TP 19 | ||||||
| .B ARES_EBADFLAGS | .B ARES_EBADFLAGS | ||||||
| The | The | ||||||
| .I flags | .I flags | ||||||
| parameter contains an illegal value. | parameter contains an illegal value. | ||||||
| .PP | .PP | ||||||
| The callback argument | The callback argument | ||||||
| .I timeouts | .I timeouts | ||||||
| reports how many times a query timed out during the execution of the | reports how many times a query timed out during the execution of the | ||||||
| given request. | given request. | ||||||
| .PP | .PP | ||||||
| On successful completion of the query, the callback argument | On successful completion of the query, the callback argument | ||||||
| .I node | .I node | ||||||
| contains a string representing the hostname (assuming  | contains a string representing the hostname (assuming  | ||||||
| .B ARES_NI_LOOKUPHOST | .B ARES_NI_LOOKUPHOST | ||||||
| was specified). Additionally,  | was specified). Additionally,  | ||||||
| .I service | .I service | ||||||
| contains a string representing the service name (assuming | contains a string representing the service name (assuming | ||||||
| .B ARES_NI_LOOKUPSERVICE | .B ARES_NI_LOOKUPSERVICE | ||||||
| was specified). | was specified). | ||||||
| If the query did not complete successfully, or one of the values | If the query did not complete successfully, or one of the values | ||||||
| was not requested,  | was not requested,  | ||||||
| .I node | .I node | ||||||
| or | or | ||||||
| .I service | .I service | ||||||
| will be  | will be  | ||||||
| .BR NULL . | .BR NULL . | ||||||
| .SH SEE ALSO | .SH SEE ALSO | ||||||
| .BR ares_process (3), | .BR ares_process (3), | ||||||
| .BR ares_getaddrinfo (3) | .BR ares_getaddrinfo (3) | ||||||
| .SH AUTHOR | .SH AUTHOR | ||||||
| Dominick Meglio | Dominick Meglio | ||||||
| .br | .br | ||||||
| Copyright 2005 by Dominick Meglio. | Copyright 2005 by Dominick Meglio. | ||||||
|   | |||||||
| @@ -14,7 +14,7 @@ | |||||||
|  * this software for any purpose.  It is provided "as is" |  * this software for any purpose.  It is provided "as is" | ||||||
|  * without express or implied warranty. |  * without express or implied warranty. | ||||||
|  */ |  */ | ||||||
| #include "setup.h" | #include "ares_setup.h" | ||||||
|  |  | ||||||
| #ifdef HAVE_GETSERVBYPORT_R | #ifdef HAVE_GETSERVBYPORT_R | ||||||
| #  if !defined(GETSERVBYPORT_R_ARGS) || \ | #  if !defined(GETSERVBYPORT_R_ARGS) || \ | ||||||
| @@ -92,18 +92,26 @@ static void append_scopeid(struct sockaddr_in6 *addr6, unsigned int scopeid, | |||||||
| #endif | #endif | ||||||
| static char *ares_striendstr(const char *s1, const char *s2); | static char *ares_striendstr(const char *s1, const char *s2); | ||||||
|  |  | ||||||
| void ares_getnameinfo(ares_channel channel, const struct sockaddr *sa, socklen_t salen, | void ares_getnameinfo(ares_channel channel, const struct sockaddr *sa, | ||||||
|  |                       ares_socklen_t salen, | ||||||
|                       int flags, ares_nameinfo_callback callback, void *arg) |                       int flags, ares_nameinfo_callback callback, void *arg) | ||||||
| { | { | ||||||
|   struct sockaddr_in *addr = NULL; |   struct sockaddr_in *addr = NULL; | ||||||
|   struct sockaddr_in6 *addr6 = NULL; |   struct sockaddr_in6 *addr6 = NULL; | ||||||
|   struct nameinfo_query *niquery; |   struct nameinfo_query *niquery; | ||||||
|  |   unsigned int port = 0; | ||||||
|  |  | ||||||
|   /* Verify the buffer size */ |   /* Verify the buffer size */ | ||||||
|   if (salen == sizeof(struct sockaddr_in)) |   if (salen == sizeof(struct sockaddr_in)) | ||||||
|     addr = (struct sockaddr_in *)sa; |     { | ||||||
|  |       addr = (struct sockaddr_in *)sa; | ||||||
|  |       port = addr->sin_port; | ||||||
|  |     } | ||||||
|   else if (salen == sizeof(struct sockaddr_in6)) |   else if (salen == sizeof(struct sockaddr_in6)) | ||||||
|     addr6 = (struct sockaddr_in6 *)sa; |     { | ||||||
|  |       addr6 = (struct sockaddr_in6 *)sa; | ||||||
|  |       port = addr6->sin6_port; | ||||||
|  |     } | ||||||
|   else |   else | ||||||
|     { |     { | ||||||
|       callback(arg, ARES_ENOTIMP, 0, NULL, NULL); |       callback(arg, ARES_ENOTIMP, 0, NULL, NULL); | ||||||
| @@ -118,12 +126,7 @@ void ares_getnameinfo(ares_channel channel, const struct sockaddr *sa, socklen_t | |||||||
|   if ((flags & ARES_NI_LOOKUPSERVICE) && !(flags & ARES_NI_LOOKUPHOST)) |   if ((flags & ARES_NI_LOOKUPSERVICE) && !(flags & ARES_NI_LOOKUPHOST)) | ||||||
|     { |     { | ||||||
|       char buf[33], *service; |       char buf[33], *service; | ||||||
|       unsigned int port = 0; |  | ||||||
|  |  | ||||||
|       if (salen == sizeof(struct sockaddr_in)) |  | ||||||
|         port = addr->sin_port; |  | ||||||
|       else |  | ||||||
|         port = addr6->sin6_port; |  | ||||||
|       service = lookup_service((unsigned short)(port & 0xffff), |       service = lookup_service((unsigned short)(port & 0xffff), | ||||||
|                                flags, buf, sizeof(buf)); |                                flags, buf, sizeof(buf)); | ||||||
|       callback(arg, ARES_SUCCESS, 0, NULL, service); |       callback(arg, ARES_SUCCESS, 0, NULL, service); | ||||||
| @@ -136,7 +139,6 @@ void ares_getnameinfo(ares_channel channel, const struct sockaddr *sa, socklen_t | |||||||
|      /* A numeric host can be handled without DNS */ |      /* A numeric host can be handled without DNS */ | ||||||
|      if ((flags & ARES_NI_NUMERICHOST)) |      if ((flags & ARES_NI_NUMERICHOST)) | ||||||
|       { |       { | ||||||
|         unsigned int port = 0; |  | ||||||
|         char ipbuf[IPBUFSIZ]; |         char ipbuf[IPBUFSIZ]; | ||||||
|         char srvbuf[33]; |         char srvbuf[33]; | ||||||
|         char *service = NULL; |         char *service = NULL; | ||||||
| @@ -153,7 +155,6 @@ void ares_getnameinfo(ares_channel channel, const struct sockaddr *sa, socklen_t | |||||||
|         if (salen == sizeof(struct sockaddr_in6)) |         if (salen == sizeof(struct sockaddr_in6)) | ||||||
|           { |           { | ||||||
|             ares_inet_ntop(AF_INET6, &addr6->sin6_addr, ipbuf, IPBUFSIZ); |             ares_inet_ntop(AF_INET6, &addr6->sin6_addr, ipbuf, IPBUFSIZ); | ||||||
|             port = addr6->sin6_port; |  | ||||||
|             /* If the system supports scope IDs, use it */ |             /* If the system supports scope IDs, use it */ | ||||||
| #ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID | #ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID | ||||||
|             append_scopeid(addr6, flags, ipbuf, sizeof(ipbuf)); |             append_scopeid(addr6, flags, ipbuf, sizeof(ipbuf)); | ||||||
| @@ -162,7 +163,6 @@ void ares_getnameinfo(ares_channel channel, const struct sockaddr *sa, socklen_t | |||||||
|         else |         else | ||||||
|           { |           { | ||||||
|             ares_inet_ntop(AF_INET, &addr->sin_addr, ipbuf, IPBUFSIZ); |             ares_inet_ntop(AF_INET, &addr->sin_addr, ipbuf, IPBUFSIZ); | ||||||
|             port = addr->sin_port; |  | ||||||
|           } |           } | ||||||
|         /* They also want a service */ |         /* They also want a service */ | ||||||
|         if (flags & ARES_NI_LOOKUPSERVICE) |         if (flags & ARES_NI_LOOKUPSERVICE) | ||||||
|   | |||||||
| @@ -13,7 +13,7 @@ | |||||||
|  * without express or implied warranty. |  * without express or implied warranty. | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "setup.h" | #include "ares_setup.h" | ||||||
|  |  | ||||||
| #ifdef HAVE_SYS_TIME_H | #ifdef HAVE_SYS_TIME_H | ||||||
| #include <sys/time.h> | #include <sys/time.h> | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| .\" $Id$ | .\" $Id$ | ||||||
| .\" | .\" | ||||||
| .\" Copyright 1998 by the Massachusetts Institute of Technology. | .\" Copyright 1998 by the Massachusetts Institute of Technology. | ||||||
| .\" Copyright (C) 2007-2008 by Daniel Stenberg | .\" Copyright (C) 2004-2009 by Daniel Stenberg | ||||||
| .\" | .\" | ||||||
| .\" Permission to use, copy, modify, and distribute this | .\" Permission to use, copy, modify, and distribute this | ||||||
| .\" software and its documentation for any purpose and without | .\" software and its documentation for any purpose and without | ||||||
| @@ -15,7 +15,7 @@ | |||||||
| .\" this software for any purpose.  It is provided "as is" | .\" this software for any purpose.  It is provided "as is" | ||||||
| .\" without express or implied warranty. | .\" without express or implied warranty. | ||||||
| .\" | .\" | ||||||
| .TH ARES_INIT 3 "13 May 2008" | .TH ARES_INIT 3 "26 May 2009" | ||||||
| .SH NAME | .SH NAME | ||||||
| ares_init, ares_init_options \- Initialize a resolver channel | ares_init, ares_init_options \- Initialize a resolver channel | ||||||
| .SH SYNOPSIS | .SH SYNOPSIS | ||||||
| @@ -184,10 +184,16 @@ A configuration file could not be read. | |||||||
| .TP 14 | .TP 14 | ||||||
| .B ARES_ENOMEM | .B ARES_ENOMEM | ||||||
| The process's available memory was exhausted. | The process's available memory was exhausted. | ||||||
|  | .TP 14 | ||||||
|  | .B ARES_ENOTINITIALIZED | ||||||
|  | c-ares library initialization not yet performed. | ||||||
| .SH SEE ALSO | .SH SEE ALSO | ||||||
| .BR ares_destroy(3), | .BR ares_destroy(3), | ||||||
| .BR ares_dup(3) | .BR ares_dup(3), | ||||||
|  | .BR ares_library_init(3) | ||||||
| .SH AUTHOR | .SH AUTHOR | ||||||
| Greg Hudson, MIT Information Systems | Greg Hudson, MIT Information Systems | ||||||
| .br | .br | ||||||
| Copyright 1998 by the Massachusetts Institute of Technology. | Copyright 1998 by the Massachusetts Institute of Technology. | ||||||
|  | .br | ||||||
|  | Copyright (C) 2004-2009 by Daniel Stenberg. | ||||||
|   | |||||||
							
								
								
									
										136
									
								
								ares/ares_init.c
									
									
									
									
									
								
							
							
						
						
									
										136
									
								
								ares/ares_init.c
									
									
									
									
									
								
							| @@ -1,7 +1,7 @@ | |||||||
| /* $Id$ */ | /* $Id$ */ | ||||||
|  |  | ||||||
| /* Copyright 1998 by the Massachusetts Institute of Technology. | /* Copyright 1998 by the Massachusetts Institute of Technology. | ||||||
|  * Copyright (C) 2007-2008 by Daniel Stenberg |  * Copyright (C) 2007-2009 by Daniel Stenberg | ||||||
|  * |  * | ||||||
|  * Permission to use, copy, modify, and distribute this |  * Permission to use, copy, modify, and distribute this | ||||||
|  * software and its documentation for any purpose and without |  * software and its documentation for any purpose and without | ||||||
| @@ -16,11 +16,10 @@ | |||||||
|  * without express or implied warranty. |  * without express or implied warranty. | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "setup.h" | #include "ares_setup.h" | ||||||
|  |  | ||||||
| #if defined(WIN32) && !defined(WATT32) | #if defined(WIN32) && !defined(WATT32) | ||||||
| #include <iphlpapi.h> | #include <iphlpapi.h> | ||||||
| #include <malloc.h> |  | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #ifdef HAVE_SYS_PARAM_H | #ifdef HAVE_SYS_PARAM_H | ||||||
| @@ -68,6 +67,7 @@ | |||||||
| #include <errno.h> | #include <errno.h> | ||||||
| #include "ares.h" | #include "ares.h" | ||||||
| #include "inet_net_pton.h" | #include "inet_net_pton.h" | ||||||
|  | #include "ares_library_init.h" | ||||||
| #include "ares_private.h" | #include "ares_private.h" | ||||||
|  |  | ||||||
| #ifdef WATT32 | #ifdef WATT32 | ||||||
| @@ -80,14 +80,16 @@ static int init_by_environment(ares_channel channel); | |||||||
| static int init_by_resolv_conf(ares_channel channel); | static int init_by_resolv_conf(ares_channel channel); | ||||||
| static int init_by_defaults(ares_channel channel); | static int init_by_defaults(ares_channel channel); | ||||||
|  |  | ||||||
|  | #ifndef WATT32 | ||||||
| static int config_nameserver(struct server_state **servers, int *nservers, | static int config_nameserver(struct server_state **servers, int *nservers, | ||||||
|                              char *str); |                              char *str); | ||||||
|  | #endif | ||||||
| static int set_search(ares_channel channel, const char *str); | static int set_search(ares_channel channel, const char *str); | ||||||
| static int set_options(ares_channel channel, const char *str); | static int set_options(ares_channel channel, const char *str); | ||||||
| static const char *try_option(const char *p, const char *q, const char *opt); | static const char *try_option(const char *p, const char *q, const char *opt); | ||||||
| static int init_id_key(rc4_key* key,int key_data_len); | static int init_id_key(rc4_key* key,int key_data_len); | ||||||
|  |  | ||||||
| #ifndef WIN32 | #if !defined(WIN32) && !defined(WATT32) | ||||||
| static int sortlist_alloc(struct apattern **sortlist, int *nsort, struct apattern *pat); | static int sortlist_alloc(struct apattern **sortlist, int *nsort, struct apattern *pat); | ||||||
| static int ip_addr(const char *s, int len, struct in_addr *addr); | static int ip_addr(const char *s, int len, struct in_addr *addr); | ||||||
| static void natural_mask(struct apattern *pat); | static void natural_mask(struct apattern *pat); | ||||||
| @@ -129,6 +131,9 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options, | |||||||
|     curl_memlimit(atoi(env)); |     curl_memlimit(atoi(env)); | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  |   if (ares_library_initialized() != ARES_SUCCESS) | ||||||
|  |     return ARES_ENOTINITIALIZED; | ||||||
|  |  | ||||||
|   channel = malloc(sizeof(struct ares_channeldata)); |   channel = malloc(sizeof(struct ares_channeldata)); | ||||||
|   if (!channel) { |   if (!channel) { | ||||||
|     *channelptr = NULL; |     *channelptr = NULL; | ||||||
| @@ -198,12 +203,15 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options, | |||||||
|       DEBUGF(fprintf(stderr, "Error: init_by_resolv_conf failed: %s\n", |       DEBUGF(fprintf(stderr, "Error: init_by_resolv_conf failed: %s\n", | ||||||
|                      ares_strerror(status))); |                      ares_strerror(status))); | ||||||
|   } |   } | ||||||
|   if (status == ARES_SUCCESS) { |  | ||||||
|     status = init_by_defaults(channel); |   /* | ||||||
|     if (status != ARES_SUCCESS) |    * No matter what failed or succeeded, seed defaults to provide | ||||||
|       DEBUGF(fprintf(stderr, "Error: init_by_defaults failed: %s\n", |    * useful behavior for things that we missed. | ||||||
|                      ares_strerror(status))); |    */ | ||||||
|   } |   status = init_by_defaults(channel); | ||||||
|  |   if (status != ARES_SUCCESS) | ||||||
|  |     DEBUGF(fprintf(stderr, "Error: init_by_defaults failed: %s\n", | ||||||
|  |                    ares_strerror(status))); | ||||||
|  |  | ||||||
|   /* Generate random key */ |   /* Generate random key */ | ||||||
|  |  | ||||||
| @@ -559,11 +567,8 @@ static int get_res_interfaces_nt(HKEY hKey, const char *subkey, char **obuf) | |||||||
|  |  | ||||||
| static int get_iphlpapi_dns_info (char *ret_buf, size_t ret_size) | static int get_iphlpapi_dns_info (char *ret_buf, size_t ret_size) | ||||||
| { | { | ||||||
|   FIXED_INFO    *fi   = alloca (sizeof(*fi)); |   FIXED_INFO    *fi, *newfi; | ||||||
|   DWORD          size = sizeof (*fi); |   DWORD          size = sizeof (*fi); | ||||||
|   typedef DWORD (WINAPI* get_net_param_func) (FIXED_INFO*, DWORD*); |  | ||||||
|   get_net_param_func fpGetNetworkParams;  /* available only on Win-98/2000+ */ |  | ||||||
|   HMODULE        handle; |  | ||||||
|   IP_ADDR_STRING *ipAddr; |   IP_ADDR_STRING *ipAddr; | ||||||
|   int            i, count = 0; |   int            i, count = 0; | ||||||
|   int            debug  = 0; |   int            debug  = 0; | ||||||
| @@ -572,23 +577,21 @@ static int get_iphlpapi_dns_info (char *ret_buf, size_t ret_size) | |||||||
|   char          *ret = ret_buf; |   char          *ret = ret_buf; | ||||||
|   HRESULT        res; |   HRESULT        res; | ||||||
|  |  | ||||||
|  |   fi = malloc(size); | ||||||
|   if (!fi) |   if (!fi) | ||||||
|      return (0); |      return 0; | ||||||
|  |  | ||||||
|   handle = LoadLibrary ("iphlpapi.dll"); |  | ||||||
|   if (!handle) |  | ||||||
|      return (0); |  | ||||||
|  |  | ||||||
|   fpGetNetworkParams = (get_net_param_func) GetProcAddress (handle, "GetNetworkParams"); |  | ||||||
|   if (!fpGetNetworkParams) |  | ||||||
|      goto quit; |  | ||||||
|  |  | ||||||
|   res = (*fpGetNetworkParams) (fi, &size); |   res = (*fpGetNetworkParams) (fi, &size); | ||||||
|   if ((res != ERROR_BUFFER_OVERFLOW) && (res != ERROR_SUCCESS)) |   if ((res != ERROR_BUFFER_OVERFLOW) && (res != ERROR_SUCCESS)) | ||||||
|      goto quit; |      goto quit; | ||||||
|  |  | ||||||
|   fi = alloca (size); |   newfi = realloc(fi, size); | ||||||
|   if (!fi || (*fpGetNetworkParams) (fi, &size) != ERROR_SUCCESS) |   if (!newfi) | ||||||
|  |      goto quit; | ||||||
|  |  | ||||||
|  |   fi = newfi; | ||||||
|  |   res = (*fpGetNetworkParams) (fi, &size); | ||||||
|  |   if (res != ERROR_SUCCESS) | ||||||
|      goto quit; |      goto quit; | ||||||
|  |  | ||||||
|   if (debug) |   if (debug) | ||||||
| @@ -621,20 +624,22 @@ static int get_iphlpapi_dns_info (char *ret_buf, size_t ret_size) | |||||||
|   } |   } | ||||||
|  |  | ||||||
| quit: | quit: | ||||||
|   if (handle) |   if (fi) | ||||||
|      FreeLibrary (handle); |      free(fi); | ||||||
|  |  | ||||||
|   if (debug && left <= ip_size) |   if (debug && left <= ip_size) | ||||||
|      printf ("Too many nameservers. Truncating to %d addressess", count); |      printf ("Too many nameservers. Truncating to %d addressess", count); | ||||||
|   if (ret > ret_buf) |   if (ret > ret_buf) | ||||||
|      ret[-1] = '\0'; |      ret[-1] = '\0'; | ||||||
|   return (count); |   return count; | ||||||
| } | } | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| static int init_by_resolv_conf(ares_channel channel) | static int init_by_resolv_conf(ares_channel channel) | ||||||
| { | { | ||||||
|  | #ifndef WATT32 | ||||||
|   char *line = NULL; |   char *line = NULL; | ||||||
|  | #endif | ||||||
|   int status = -1, nservers = 0, nsort = 0; |   int status = -1, nservers = 0, nsort = 0; | ||||||
|   struct server_state *servers = NULL; |   struct server_state *servers = NULL; | ||||||
|   struct apattern *sortlist = NULL; |   struct apattern *sortlist = NULL; | ||||||
| @@ -804,7 +809,7 @@ DhcpNameServer | |||||||
|   { |   { | ||||||
|     char *p; |     char *p; | ||||||
|     FILE *fp; |     FILE *fp; | ||||||
|     int linesize; |     size_t linesize; | ||||||
|     int error; |     int error; | ||||||
|  |  | ||||||
|     /* Don't read resolv.conf and friends if we don't have to */ |     /* Don't read resolv.conf and friends if we don't have to */ | ||||||
| @@ -970,6 +975,9 @@ static int init_by_defaults(ares_channel channel) | |||||||
| { | { | ||||||
|   char *hostname = NULL; |   char *hostname = NULL; | ||||||
|   int rc = ARES_SUCCESS; |   int rc = ARES_SUCCESS; | ||||||
|  | #ifdef HAVE_GETHOSTNAME | ||||||
|  |   char *dot; | ||||||
|  | #endif | ||||||
|  |  | ||||||
|   if (channel->flags == -1) |   if (channel->flags == -1) | ||||||
|     channel->flags = 0; |     channel->flags = 0; | ||||||
| @@ -1039,15 +1047,15 @@ static int init_by_defaults(ares_channel channel) | |||||||
|  |  | ||||||
|     } while(0); |     } while(0); | ||||||
|  |  | ||||||
|     if (strchr(hostname, '.'))  { |     dot = strchr(hostname, '.'); | ||||||
|  |     if (dot) { | ||||||
|       /* a dot was found */ |       /* a dot was found */ | ||||||
|  |  | ||||||
|       channel->domains = malloc(sizeof(char *)); |       channel->domains = malloc(sizeof(char *)); | ||||||
|       if (!channel->domains) { |       if (!channel->domains) { | ||||||
|         rc = ARES_ENOMEM; |         rc = ARES_ENOMEM; | ||||||
|         goto error; |         goto error; | ||||||
|       } |       } | ||||||
|       channel->domains[0] = strdup(strchr(hostname, '.') + 1); |       channel->domains[0] = strdup(dot + 1); | ||||||
|       if (!channel->domains[0]) { |       if (!channel->domains[0]) { | ||||||
|         rc = ARES_ENOMEM; |         rc = ARES_ENOMEM; | ||||||
|         goto error; |         goto error; | ||||||
| @@ -1087,7 +1095,7 @@ static int init_by_defaults(ares_channel channel) | |||||||
|   return rc; |   return rc; | ||||||
| } | } | ||||||
|  |  | ||||||
| #ifndef WIN32 | #if !defined(WIN32) && !defined(WATT32) | ||||||
| static int config_domain(ares_channel channel, char *str) | static int config_domain(ares_channel channel, char *str) | ||||||
| { | { | ||||||
|   char *q; |   char *q; | ||||||
| @@ -1127,9 +1135,9 @@ static int config_lookup(ares_channel channel, const char *str, | |||||||
|   channel->lookups = strdup(lookups); |   channel->lookups = strdup(lookups); | ||||||
|   return (channel->lookups) ? ARES_SUCCESS : ARES_ENOMEM; |   return (channel->lookups) ? ARES_SUCCESS : ARES_ENOMEM; | ||||||
| } | } | ||||||
|  | #endif  /* !WIN32 & !WATT32 */ | ||||||
|  |  | ||||||
| #endif | #ifndef WATT32 | ||||||
|  |  | ||||||
| static int config_nameserver(struct server_state **servers, int *nservers, | static int config_nameserver(struct server_state **servers, int *nservers, | ||||||
|                              char *str) |                              char *str) | ||||||
| { | { | ||||||
| @@ -1272,7 +1280,8 @@ static int config_sortlist(struct apattern **sortlist, int *nsort, | |||||||
|  |  | ||||||
|   return ARES_SUCCESS; |   return ARES_SUCCESS; | ||||||
| } | } | ||||||
| #endif | #endif  /* !WIN32 */ | ||||||
|  | #endif  /* !WATT32 */ | ||||||
|  |  | ||||||
| static int set_search(ares_channel channel, const char *str) | static int set_search(ares_channel channel, const char *str) | ||||||
| { | { | ||||||
| @@ -1364,29 +1373,39 @@ static int set_options(ares_channel channel, const char *str) | |||||||
|   return ARES_SUCCESS; |   return ARES_SUCCESS; | ||||||
| } | } | ||||||
|  |  | ||||||
| #ifndef WIN32 | static const char *try_option(const char *p, const char *q, const char *opt) | ||||||
|  | { | ||||||
|  |   size_t len = strlen(opt); | ||||||
|  |   return ((size_t)(q - p) >= len && !strncmp(p, opt, len)) ? &p[len] : NULL; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | #if !defined(WIN32) && !defined(WATT32) | ||||||
| static char *try_config(char *s, const char *opt) | static char *try_config(char *s, const char *opt) | ||||||
| { | { | ||||||
|   size_t len; |   size_t len; | ||||||
|   ssize_t i; |  | ||||||
|   ssize_t j; |  | ||||||
|   char *p; |   char *p; | ||||||
|  |   char *q; | ||||||
|  |  | ||||||
|   if (!s || !opt) |   if (!s || !opt) | ||||||
|     /* no line or no option */ |     /* no line or no option */ | ||||||
|     return NULL; |     return NULL; | ||||||
|  |  | ||||||
|   /* trim line comment */ |   /* trim line comment */ | ||||||
|   for (i = 0; s[i] && s[i] != '#'; ++i); |   p = s; | ||||||
|   s[i] = '\0'; |   while (*p && (*p != '#')) | ||||||
|  |     p++; | ||||||
|  |   *p = '\0'; | ||||||
|  |  | ||||||
|   /* trim trailing whitespace */ |   /* trim trailing whitespace */ | ||||||
|   for (j = i-1; j >= 0 && ISSPACE(s[j]); --j); |   q = p - 1; | ||||||
|   s[++j] = '\0'; |   while ((q >= s) && ISSPACE(*q)) | ||||||
|  |     q--; | ||||||
|  |   *++q = '\0'; | ||||||
|  |  | ||||||
|   /* skip leading whitespace */ |   /* skip leading whitespace */ | ||||||
|   for (i = 0; s[i] && ISSPACE(s[i]); ++i); |   p = s; | ||||||
|   p = &s[i]; |   while (*p && ISSPACE(*p)) | ||||||
|  |     p++; | ||||||
|  |  | ||||||
|   if (!*p) |   if (!*p) | ||||||
|     /* empty line */ |     /* empty line */ | ||||||
| @@ -1423,15 +1442,7 @@ static char *try_config(char *s, const char *opt) | |||||||
|   /* return pointer to option value */ |   /* return pointer to option value */ | ||||||
|   return p; |   return p; | ||||||
| } | } | ||||||
| #endif |  | ||||||
|  |  | ||||||
| static const char *try_option(const char *p, const char *q, const char *opt) |  | ||||||
| { |  | ||||||
|   size_t len = strlen(opt); |  | ||||||
|   return ((size_t)(q - p) >= len && !strncmp(p, opt, len)) ? &p[len] : NULL; |  | ||||||
| } |  | ||||||
|  |  | ||||||
| #ifndef WIN32 |  | ||||||
| static int sortlist_alloc(struct apattern **sortlist, int *nsort, | static int sortlist_alloc(struct apattern **sortlist, int *nsort, | ||||||
|                           struct apattern *pat) |                           struct apattern *pat) | ||||||
| { | { | ||||||
| @@ -1477,7 +1488,8 @@ static void natural_mask(struct apattern *pat) | |||||||
|   else |   else | ||||||
|     pat->mask.addr4.s_addr = htonl(IN_CLASSC_NET); |     pat->mask.addr4.s_addr = htonl(IN_CLASSC_NET); | ||||||
| } | } | ||||||
| #endif | #endif /* !WIN32 && !WATT32 */ | ||||||
|  |  | ||||||
| /* initialize an rc4 key. If possible a cryptographically secure random key | /* initialize an rc4 key. If possible a cryptographically secure random key | ||||||
|    is generated using a suitable function (for example win32's RtlGenRandom as |    is generated using a suitable function (for example win32's RtlGenRandom as | ||||||
|    described in |    described in | ||||||
| @@ -1490,15 +1502,13 @@ static void randomize_key(unsigned char* key,int key_data_len) | |||||||
|   int randomized = 0; |   int randomized = 0; | ||||||
|   int counter=0; |   int counter=0; | ||||||
| #ifdef WIN32 | #ifdef WIN32 | ||||||
|   HMODULE lib=LoadLibrary("ADVAPI32.DLL"); |   BOOLEAN res; | ||||||
|   if (lib) { |   if (fpSystemFunction036) | ||||||
|     BOOLEAN (APIENTRY *pfn)(void*, ULONG) = |     { | ||||||
|       (BOOLEAN (APIENTRY *)(void*,ULONG))GetProcAddress(lib,"SystemFunction036"); |       res = (*fpSystemFunction036) (key, key_data_len); | ||||||
|     if (pfn && pfn(key,key_data_len) ) |       if (res) | ||||||
|       randomized = 1; |         randomized = 1; | ||||||
|  |     } | ||||||
|     FreeLibrary(lib); |  | ||||||
|   } |  | ||||||
| #else /* !WIN32 */ | #else /* !WIN32 */ | ||||||
| #ifdef RANDOM_FILE | #ifdef RANDOM_FILE | ||||||
|   FILE *f = fopen(RANDOM_FILE, "rb"); |   FILE *f = fopen(RANDOM_FILE, "rb"); | ||||||
|   | |||||||
| @@ -49,7 +49,7 @@ struct addrinfo | |||||||
|   int              ai_family; |   int              ai_family; | ||||||
|   int              ai_socktype; |   int              ai_socktype; | ||||||
|   int              ai_protocol; |   int              ai_protocol; | ||||||
|   socklen_t        ai_addrlen;   /* Follow rfc3493 struct addrinfo */ |   ares_socklen_t   ai_addrlen;   /* Follow rfc3493 struct addrinfo */ | ||||||
|   char            *ai_canonname; |   char            *ai_canonname; | ||||||
|   struct sockaddr *ai_addr; |   struct sockaddr *ai_addr; | ||||||
|   struct addrinfo *ai_next; |   struct addrinfo *ai_next; | ||||||
|   | |||||||
							
								
								
									
										74
									
								
								ares/ares_library_cleanup.3
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										74
									
								
								ares/ares_library_cleanup.3
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,74 @@ | |||||||
|  | .\" $Id$ | ||||||
|  | .\" | ||||||
|  | .\" Copyright 1998 by the Massachusetts Institute of Technology. | ||||||
|  | .\" Copyright (C) 2004-2009 by Daniel Stenberg | ||||||
|  | .\" | ||||||
|  | .\" Permission to use, copy, modify, and distribute this | ||||||
|  | .\" software and its documentation for any purpose and without | ||||||
|  | .\" fee is hereby granted, provided that the above copyright | ||||||
|  | .\" notice appear in all copies and that both that copyright | ||||||
|  | .\" notice and this permission notice appear in supporting | ||||||
|  | .\" documentation, and that the name of M.I.T. not be used in | ||||||
|  | .\" advertising or publicity pertaining to distribution of the | ||||||
|  | .\" software without specific, written prior permission. | ||||||
|  | .\" M.I.T. makes no representations about the suitability of | ||||||
|  | .\" this software for any purpose.  It is provided "as is" | ||||||
|  | .\" without express or implied warranty. | ||||||
|  | .\" | ||||||
|  | .TH ARES_LIBRARY_CLEANUP 3 "19 May 2009" | ||||||
|  | .SH NAME | ||||||
|  | ares_library_cleanup \- c-ares library deinitialization | ||||||
|  | .SH SYNOPSIS | ||||||
|  | .nf | ||||||
|  | .B #include <ares.h> | ||||||
|  | .PP | ||||||
|  | .B void ares_library_cleanup(void) | ||||||
|  | .PP | ||||||
|  | .B cc file.c -lcares | ||||||
|  | .fi | ||||||
|  | .SH DESCRIPTION | ||||||
|  | .PP | ||||||
|  | The | ||||||
|  | .B ares_library_cleanup | ||||||
|  | function uninitializes the c-ares library, freeing all resources | ||||||
|  | previously aquired by \fIares_library_init(3)\fP when the library | ||||||
|  | was initialized. | ||||||
|  | .PP | ||||||
|  | This function must be called when the program using c-ares will | ||||||
|  | no longer need any c-ares function. Once the program has called | ||||||
|  | \fIares_library_cleanup(3)\fP it shall not make any further call to any | ||||||
|  | c-ares function. | ||||||
|  | .PP | ||||||
|  | This function does not cancel any pending c-ares lookups or requests | ||||||
|  | previously done. Program  must use \fIares_cancel(3)\fP for this purpose. | ||||||
|  | .PP | ||||||
|  | .B This function is not thread safe. | ||||||
|  | You have to call it once the program is about to terminate, but this call must | ||||||
|  | be done once the program has terminated every single thread that it could have | ||||||
|  | initiated. This is required to avoid potential race conditions in library | ||||||
|  | deinitialization, and also due to the fact that \fIares_library_cleanup(3)\fP | ||||||
|  | might call functions from other libraries that are thread unsafe, and could | ||||||
|  | conflict with any other thread that is already using these other libraries. | ||||||
|  | .PP | ||||||
|  | Win32/64 application DLLs shall not call \fIares_library_cleanup(3)\fP from | ||||||
|  | the DllMain function. Doing so will produce deadlocks and other problems. | ||||||
|  | .SH AVAILABILITY | ||||||
|  | This function was first introduced in c-ares version 1.6.1 along with the | ||||||
|  | definition of preprocessor symbol \fICARES_HAVE_ARES_LIBRARY_CLEANUP\fP as an | ||||||
|  | indication of the availability of this function. | ||||||
|  | .PP | ||||||
|  | Since the introduction of this function, it is absolutely mandatory to call it | ||||||
|  | for any Win32/64 program using c-ares. | ||||||
|  | .PP | ||||||
|  | Non-Win32/64 systems can still use c-ares version 1.6.1 without calling | ||||||
|  | \fIares_library_cleanup(3)\fP due to the fact that it is nearly a do-nothing | ||||||
|  | function on non-Win32/64 platforms. | ||||||
|  | .SH SEE ALSO | ||||||
|  | .BR ares_library_init(3), | ||||||
|  | .BR ares_cancel(3) | ||||||
|  | .SH AUTHOR | ||||||
|  | Yang Tse | ||||||
|  | .PP | ||||||
|  | Copyright 1998 by the Massachusetts Institute of Technology. | ||||||
|  | .br | ||||||
|  | Copyright (C) 2004-2009 by Daniel Stenberg. | ||||||
							
								
								
									
										97
									
								
								ares/ares_library_init.3
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										97
									
								
								ares/ares_library_init.3
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,97 @@ | |||||||
|  | .\" $Id$ | ||||||
|  | .\" | ||||||
|  | .\" Copyright 1998 by the Massachusetts Institute of Technology. | ||||||
|  | .\" Copyright (C) 2004-2009 by Daniel Stenberg | ||||||
|  | .\" | ||||||
|  | .\" Permission to use, copy, modify, and distribute this | ||||||
|  | .\" software and its documentation for any purpose and without | ||||||
|  | .\" fee is hereby granted, provided that the above copyright | ||||||
|  | .\" notice appear in all copies and that both that copyright | ||||||
|  | .\" notice and this permission notice appear in supporting | ||||||
|  | .\" documentation, and that the name of M.I.T. not be used in | ||||||
|  | .\" advertising or publicity pertaining to distribution of the | ||||||
|  | .\" software without specific, written prior permission. | ||||||
|  | .\" M.I.T. makes no representations about the suitability of | ||||||
|  | .\" this software for any purpose.  It is provided "as is" | ||||||
|  | .\" without express or implied warranty. | ||||||
|  | .\" | ||||||
|  | .TH ARES_LIBRARY_INIT 3 "19 May 2009" | ||||||
|  | .SH NAME | ||||||
|  | ares_library_init \- c-ares library initialization | ||||||
|  | .SH SYNOPSIS | ||||||
|  | .nf | ||||||
|  | .B #include <ares.h> | ||||||
|  | .PP | ||||||
|  | .B int ares_library_init(int \fIflags\fP) | ||||||
|  | .PP | ||||||
|  | .B cc file.c -lcares | ||||||
|  | .fi | ||||||
|  | .SH DESCRIPTION | ||||||
|  | .PP | ||||||
|  | The | ||||||
|  | .B ares_library_init | ||||||
|  | function performs initializations internally required by the c-ares | ||||||
|  | library that must take place before any other function provided by | ||||||
|  | c-ares can be used in a program. | ||||||
|  | .PP | ||||||
|  | This function must be called one time within the life of a program, | ||||||
|  | before the program actually executes any other c-ares library function. | ||||||
|  | Initializations done by this function remain effective until a | ||||||
|  | call to \fIares_library_cleanup(3)\fP is performed. | ||||||
|  | .PP | ||||||
|  | Successive calls to this function do nothing, only the first call done | ||||||
|  | when c-ares is in an uninitialized state is actually effective. | ||||||
|  | .PP | ||||||
|  | The | ||||||
|  | .I flags | ||||||
|  | parameter is a bit pattern that tells c-ares exactly which features | ||||||
|  | should be initialized, as described below. Set the desired bits by | ||||||
|  | ORing the values together. In normal operation you should specify | ||||||
|  | \fIARES_LIB_INIT_ALL\fP. Don't use any other value unless you are | ||||||
|  | familiar with it and trying to control some internal c-ares feature. | ||||||
|  | .PP | ||||||
|  | .B This function is not thread safe. | ||||||
|  | You have to call it once the program has started, but this call must be done | ||||||
|  | before the program starts any other thread. This is required to avoid | ||||||
|  | potential race conditions in library initialization, and also due to the fact | ||||||
|  | that \fIares_library_init(3)\fP might call functions from other libraries that | ||||||
|  | are thread unsafe, and could conflict with any other thread that is already | ||||||
|  | using these other libraries. | ||||||
|  | .PP | ||||||
|  | Win32/64 application DLLs shall not call \fIares_library_init(3)\fP from the | ||||||
|  | DllMain function. Doing so will produce deadlocks and other problems. | ||||||
|  | .SH FLAGS | ||||||
|  | .TP 5 | ||||||
|  | .B ARES_LIB_INIT_ALL | ||||||
|  | Initialize everything possible. This sets all known bits. | ||||||
|  | .TP | ||||||
|  | .B ARES_LIB_INIT_WIN32 | ||||||
|  | Initialize Win32/64 specific libraries. | ||||||
|  | .TP | ||||||
|  | .B ARES_LIB_INIT_NONE | ||||||
|  | Initialize nothing extra. This sets no bit. | ||||||
|  | .SH RETURN VALUE | ||||||
|  | Upon successful completion, ares_library_init() will return 0.  Otherwise, a | ||||||
|  | non-zero error number will be returned to indicate the error. Except for | ||||||
|  | \fIares_strerror(3)\fP, you shall not call any other c-ares function upon | ||||||
|  | \fIares_library_init(3)\fP failure. | ||||||
|  | .SH AVAILABILITY | ||||||
|  | This function was first introduced in c-ares version 1.6.1 along with the | ||||||
|  | definition of preprocessor symbol \fICARES_HAVE_ARES_LIBRARY_INIT\fP as an | ||||||
|  | indication of the availability of this function. | ||||||
|  | .PP | ||||||
|  | Since the introduction of this function it is absolutely mandatory to | ||||||
|  | call it for any Win32/64 program using c-ares. | ||||||
|  | .PP | ||||||
|  | Non-Win32/64 systems can still use c-ares version 1.6.1 without calling | ||||||
|  | \fIares_library_init(3)\fP due to the fact that it is nearly a do-nothing | ||||||
|  | function on non-Win32/64 platforms at this point. | ||||||
|  | .SH SEE ALSO | ||||||
|  | .BR ares_library_cleanup(3), | ||||||
|  | .BR ares_strerror(3) | ||||||
|  | .SH AUTHOR | ||||||
|  | Yang Tse | ||||||
|  | .PP | ||||||
|  | Copyright 1998 by the Massachusetts Institute of Technology. | ||||||
|  | .br | ||||||
|  | Copyright (C) 2004-2009 by Daniel Stenberg. | ||||||
							
								
								
									
										133
									
								
								ares/ares_library_init.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										133
									
								
								ares/ares_library_init.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,133 @@ | |||||||
|  | /* $Id$ */ | ||||||
|  |  | ||||||
|  | /* Copyright 1998 by the Massachusetts Institute of Technology. | ||||||
|  |  * Copyright (C) 2004-2009 by Daniel Stenberg | ||||||
|  |  * | ||||||
|  |  * Permission to use, copy, modify, and distribute this | ||||||
|  |  * software and its documentation for any purpose and without | ||||||
|  |  * fee is hereby granted, provided that the above copyright | ||||||
|  |  * notice appear in all copies and that both that copyright | ||||||
|  |  * notice and this permission notice appear in supporting | ||||||
|  |  * documentation, and that the name of M.I.T. not be used in | ||||||
|  |  * advertising or publicity pertaining to distribution of the | ||||||
|  |  * software without specific, written prior permission. | ||||||
|  |  * M.I.T. makes no representations about the suitability of | ||||||
|  |  * this software for any purpose.  It is provided "as is" | ||||||
|  |  * without express or implied warranty. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | #include "ares_setup.h" | ||||||
|  |  | ||||||
|  | #include "ares.h" | ||||||
|  | #include "ares_library_init.h" | ||||||
|  | #include "ares_private.h" | ||||||
|  |  | ||||||
|  | /* library-private global and unique instance vars */ | ||||||
|  |  | ||||||
|  | #ifdef WIN32 | ||||||
|  | fpGetNetworkParams_t fpGetNetworkParams = ZERO_NULL; | ||||||
|  | fpSystemFunction036_t fpSystemFunction036 = ZERO_NULL; | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | /* library-private global vars with source visibility restricted to this file */ | ||||||
|  |  | ||||||
|  | static unsigned int ares_initialized; | ||||||
|  | static int          ares_init_flags; | ||||||
|  |  | ||||||
|  | #ifdef WIN32 | ||||||
|  | static HMODULE hnd_iphlpapi; | ||||||
|  | static HMODULE hnd_advapi32; | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  |  | ||||||
|  | static int ares_win32_init(void) | ||||||
|  | { | ||||||
|  | #ifdef WIN32 | ||||||
|  |  | ||||||
|  |   hnd_iphlpapi = 0; | ||||||
|  |   hnd_iphlpapi = LoadLibrary("iphlpapi.dll"); | ||||||
|  |   if (!hnd_iphlpapi) | ||||||
|  |     return ARES_ELOADIPHLPAPI; | ||||||
|  |  | ||||||
|  |   fpGetNetworkParams = (fpGetNetworkParams_t) | ||||||
|  |     GetProcAddress(hnd_iphlpapi, "GetNetworkParams"); | ||||||
|  |   if (!fpGetNetworkParams) | ||||||
|  |     { | ||||||
|  |       FreeLibrary(hnd_iphlpapi); | ||||||
|  |       return ARES_EADDRGETNETWORKPARAMS; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |   /* | ||||||
|  |    * When advapi32.dll is unavailable or advapi32.dll has no SystemFunction036, | ||||||
|  |    * also known as RtlGenRandom, which is the case for Windows versions prior | ||||||
|  |    * to WinXP then c-ares uses portable rand() function. Then don't error here. | ||||||
|  |    */ | ||||||
|  |  | ||||||
|  |   hnd_advapi32 = 0; | ||||||
|  |   hnd_advapi32 = LoadLibrary("advapi32.dll"); | ||||||
|  |   if (hnd_advapi32) | ||||||
|  |     { | ||||||
|  |       fpSystemFunction036 = (fpSystemFunction036_t) | ||||||
|  |         GetProcAddress(hnd_advapi32, "SystemFunction036"); | ||||||
|  |     } | ||||||
|  |  | ||||||
|  | #endif | ||||||
|  |   return ARES_SUCCESS; | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | static void ares_win32_cleanup(void) | ||||||
|  | { | ||||||
|  | #ifdef WIN32 | ||||||
|  |   if (hnd_advapi32) | ||||||
|  |     FreeLibrary(hnd_advapi32); | ||||||
|  |   if (hnd_iphlpapi) | ||||||
|  |     FreeLibrary(hnd_iphlpapi); | ||||||
|  | #endif | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | int ares_library_init(int flags) | ||||||
|  | { | ||||||
|  |   int res; | ||||||
|  |  | ||||||
|  |   if (ares_initialized) | ||||||
|  |     return ARES_SUCCESS; | ||||||
|  |   ares_initialized++; | ||||||
|  |  | ||||||
|  |   if (flags & ARES_LIB_INIT_WIN32) | ||||||
|  |     { | ||||||
|  |       res = ares_win32_init(); | ||||||
|  |       if (res != ARES_SUCCESS) | ||||||
|  |         return res; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |   ares_init_flags = flags; | ||||||
|  |  | ||||||
|  |   return ARES_SUCCESS; | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | void ares_library_cleanup(void) | ||||||
|  | { | ||||||
|  |   if (!ares_initialized) | ||||||
|  |     return; | ||||||
|  |   ares_initialized--; | ||||||
|  |  | ||||||
|  |   if (ares_init_flags & ARES_LIB_INIT_WIN32) | ||||||
|  |     ares_win32_cleanup(); | ||||||
|  |  | ||||||
|  |   ares_init_flags = ARES_LIB_INIT_NONE; | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | int ares_library_initialized(void) | ||||||
|  | { | ||||||
|  | #ifdef WIN32 | ||||||
|  |   if (!ares_initialized) | ||||||
|  |     return ARES_ENOTINITIALIZED; | ||||||
|  | #endif | ||||||
|  |   return ARES_SUCCESS; | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
							
								
								
									
										40
									
								
								ares/ares_library_init.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								ares/ares_library_init.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,40 @@ | |||||||
|  | #ifndef HEADER_CARES_LIBRARY_INIT_H | ||||||
|  | #define HEADER_CARES_LIBRARY_INIT_H | ||||||
|  |  | ||||||
|  | /* $Id$ */ | ||||||
|  |  | ||||||
|  | /* Copyright 1998 by the Massachusetts Institute of Technology. | ||||||
|  |  * Copyright (C) 2004-2009 by Daniel Stenberg | ||||||
|  |  * | ||||||
|  |  * Permission to use, copy, modify, and distribute this | ||||||
|  |  * software and its documentation for any purpose and without | ||||||
|  |  * fee is hereby granted, provided that the above copyright | ||||||
|  |  * notice appear in all copies and that both that copyright | ||||||
|  |  * notice and this permission notice appear in supporting | ||||||
|  |  * documentation, and that the name of M.I.T. not be used in | ||||||
|  |  * advertising or publicity pertaining to distribution of the | ||||||
|  |  * software without specific, written prior permission. | ||||||
|  |  * M.I.T. makes no representations about the suitability of | ||||||
|  |  * this software for any purpose.  It is provided "as is" | ||||||
|  |  * without express or implied warranty. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | #include "ares_setup.h" | ||||||
|  |  | ||||||
|  | #ifdef WIN32 | ||||||
|  |  | ||||||
|  | #include <iphlpapi.h> | ||||||
|  |  | ||||||
|  | typedef DWORD (WINAPI *fpGetNetworkParams_t) (FIXED_INFO*, DWORD*); | ||||||
|  | typedef BOOLEAN (APIENTRY *fpSystemFunction036_t) (void*, ULONG); | ||||||
|  |  | ||||||
|  | /* Forward-declaration of variables defined in ares_library_init.c */ | ||||||
|  | /* that are global and unique instances for whole c-ares library.  */ | ||||||
|  |  | ||||||
|  | extern fpGetNetworkParams_t fpGetNetworkParams; | ||||||
|  | extern fpSystemFunction036_t fpSystemFunction036; | ||||||
|  |  | ||||||
|  | #endif /* WIN32 */ | ||||||
|  |  | ||||||
|  | #endif /* HEADER_CARES_LIBRARY_INIT_H */ | ||||||
|  |  | ||||||
| @@ -15,7 +15,7 @@ | |||||||
|  * without express or implied warranty. |  * without express or implied warranty. | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "setup.h" | #include "ares_setup.h" | ||||||
|  |  | ||||||
| #include "ares.h" | #include "ares.h" | ||||||
| #include "ares_private.h" | #include "ares_private.h" | ||||||
|   | |||||||
| @@ -15,7 +15,7 @@ | |||||||
|  * without express or implied warranty. |  * without express or implied warranty. | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "setup.h" | #include "ares_setup.h" | ||||||
|  |  | ||||||
| #ifdef HAVE_SYS_SOCKET_H | #ifdef HAVE_SYS_SOCKET_H | ||||||
| #  include <sys/socket.h> | #  include <sys/socket.h> | ||||||
|   | |||||||
| @@ -16,7 +16,7 @@ | |||||||
| .\" | .\" | ||||||
| .TH ARES_PARSE_A_REPLY 3 "25 July 1998" | .TH ARES_PARSE_A_REPLY 3 "25 July 1998" | ||||||
| .SH NAME | .SH NAME | ||||||
| ares_parse_a_reply \- Parse a reply to a DNS query of type A into a hostent | ares_parse_a_reply \- Parse a reply to a DNS query of type A | ||||||
| .SH SYNOPSIS | .SH SYNOPSIS | ||||||
| .nf | .nf | ||||||
| .B #include <ares.h> | .B #include <ares.h> | ||||||
|   | |||||||
| @@ -15,7 +15,7 @@ | |||||||
|  * without express or implied warranty. |  * without express or implied warranty. | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "setup.h" | #include "ares_setup.h" | ||||||
|  |  | ||||||
| #ifdef HAVE_SYS_SOCKET_H | #ifdef HAVE_SYS_SOCKET_H | ||||||
| #  include <sys/socket.h> | #  include <sys/socket.h> | ||||||
| @@ -44,7 +44,10 @@ | |||||||
|  |  | ||||||
| #include <stdlib.h> | #include <stdlib.h> | ||||||
| #include <string.h> | #include <string.h> | ||||||
| #include <limits.h> | #ifdef HAVE_LIMITS_H | ||||||
|  | #  include <limits.h> | ||||||
|  | #endif | ||||||
|  |  | ||||||
| #include "ares.h" | #include "ares.h" | ||||||
| #include "ares_dns.h" | #include "ares_dns.h" | ||||||
| #include "ares_private.h" | #include "ares_private.h" | ||||||
|   | |||||||
| @@ -16,7 +16,7 @@ | |||||||
| .\" | .\" | ||||||
| .TH ARES_PARSE_AAAA_REPLY 3 "10 March 2005" | .TH ARES_PARSE_AAAA_REPLY 3 "10 March 2005" | ||||||
| .SH NAME | .SH NAME | ||||||
| ares_parse_aaaa_reply \- Parse a reply to a DNS query of type AAAA into a hostent | ares_parse_aaaa_reply \- Parse a reply to a DNS query of type AAAA | ||||||
| .SH SYNOPSIS | .SH SYNOPSIS | ||||||
| .nf | .nf | ||||||
| .B #include <ares.h> | .B #include <ares.h> | ||||||
|   | |||||||
| @@ -1,6 +1,7 @@ | |||||||
| /* $Id$ */ | /* $Id$ */ | ||||||
|  |  | ||||||
| /* Copyright 2005 Dominick Meglio | /* Copyright 1998 by the Massachusetts Institute of Technology. | ||||||
|  |  * Copyright 2005 Dominick Meglio | ||||||
|  * |  * | ||||||
|  * Permission to use, copy, modify, and distribute this |  * Permission to use, copy, modify, and distribute this | ||||||
|  * software and its documentation for any purpose and without |  * software and its documentation for any purpose and without | ||||||
| @@ -15,7 +16,7 @@ | |||||||
|  * without express or implied warranty. |  * without express or implied warranty. | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "setup.h" | #include "ares_setup.h" | ||||||
|  |  | ||||||
| #ifdef HAVE_SYS_SOCKET_H | #ifdef HAVE_SYS_SOCKET_H | ||||||
| #  include <sys/socket.h> | #  include <sys/socket.h> | ||||||
| @@ -44,7 +45,10 @@ | |||||||
|  |  | ||||||
| #include <stdlib.h> | #include <stdlib.h> | ||||||
| #include <string.h> | #include <string.h> | ||||||
| #include <limits.h> | #ifdef HAVE_LIMITS_H | ||||||
|  | #  include <limits.h> | ||||||
|  | #endif | ||||||
|  |  | ||||||
| #include "ares.h" | #include "ares.h" | ||||||
| #include "ares_dns.h" | #include "ares_dns.h" | ||||||
| #include "inet_net_pton.h" | #include "inet_net_pton.h" | ||||||
|   | |||||||
| @@ -1,13 +1,15 @@ | |||||||
|  | /* $Id */ | ||||||
|  |  | ||||||
| /* Copyright 1998 by the Massachusetts Institute of Technology. | /* Copyright 1998 by the Massachusetts Institute of Technology. | ||||||
|  * |  * | ||||||
| * Permission to use, copy, modify, and distribute this |  * Permission to use, copy, modify, and distribute this | ||||||
|  * software and its documentation for any purpose and without |  * software and its documentation for any purpose and without | ||||||
| * fee is hereby granted, provided that the above copyright |  * fee is hereby granted, provided that the above copyright | ||||||
|  * notice appear in all copies and that both that copyright |  * notice appear in all copies and that both that copyright | ||||||
|  * notice and this permission notice appear in supporting |  * notice and this permission notice appear in supporting | ||||||
| * documentation, and that the name of M.I.T. not be used in |  * documentation, and that the name of M.I.T. not be used in | ||||||
|  * advertising or publicity pertaining to distribution of the |  * advertising or publicity pertaining to distribution of the | ||||||
| * software without specific, written prior permission. |  * software without specific, written prior permission. | ||||||
|  * M.I.T. makes no representations about the suitability of |  * M.I.T. makes no representations about the suitability of | ||||||
|  * this software for any purpose.  It is provided "as is" |  * this software for any purpose.  It is provided "as is" | ||||||
|  * without express or implied warranty. |  * without express or implied warranty. | ||||||
| @@ -18,7 +20,7 @@ | |||||||
|  *      on behalf of AVIRA Gmbh - http://www.avira.com |  *      on behalf of AVIRA Gmbh - http://www.avira.com | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "setup.h" | #include "ares_setup.h" | ||||||
|  |  | ||||||
| #ifdef HAVE_SYS_SOCKET_H | #ifdef HAVE_SYS_SOCKET_H | ||||||
| #  include <sys/socket.h> | #  include <sys/socket.h> | ||||||
|   | |||||||
| @@ -15,7 +15,7 @@ | |||||||
|  * without express or implied warranty. |  * without express or implied warranty. | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "setup.h" | #include "ares_setup.h" | ||||||
|  |  | ||||||
| #ifdef HAVE_SYS_SOCKET_H | #ifdef HAVE_SYS_SOCKET_H | ||||||
| #  include <sys/socket.h> | #  include <sys/socket.h> | ||||||
|   | |||||||
							
								
								
									
										77
									
								
								ares/ares_parse_srv_reply.3
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										77
									
								
								ares/ares_parse_srv_reply.3
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,77 @@ | |||||||
|  | .\" | ||||||
|  | .\" Copyright 1998 by the Massachusetts Institute of Technology. | ||||||
|  | .\" | ||||||
|  | .\" Permission to use, copy, modify, and distribute this | ||||||
|  | .\" software and its documentation for any purpose and without | ||||||
|  | .\" fee is hereby granted, provided that the above copyright | ||||||
|  | .\" notice appear in all copies and that both that copyright | ||||||
|  | .\" notice and this permission notice appear in supporting | ||||||
|  | .\" documentation, and that the name of M.I.T. not be used in | ||||||
|  | .\" advertising or publicity pertaining to distribution of the | ||||||
|  | .\" software without specific, written prior permission. | ||||||
|  | .\" M.I.T. makes no representations about the suitability of | ||||||
|  | .\" this software for any purpose.  It is provided "as is" | ||||||
|  | .\" without express or implied warranty. | ||||||
|  | .\" | ||||||
|  | .TH ARES_PARSE_SRV_REPLY 3 "4 August 2009" | ||||||
|  | .SH NAME | ||||||
|  | ares_parse_srv_reply \- Parse a reply to a DNS query of type SRV | ||||||
|  | .SH SYNOPSIS | ||||||
|  | .nf | ||||||
|  | .B #include <ares.h> | ||||||
|  | .PP | ||||||
|  | .B int ares_parse_srv_reply(const unsigned char* \fIabuf\fP, int \fIalen\fP, | ||||||
|  | .B                          struct ares_srv_reply** \fIsrv_out\fP, int *\fInsrvreply\fP); | ||||||
|  | .fi | ||||||
|  | .SH DESCRIPTION | ||||||
|  | The | ||||||
|  | .B ares_parse_srv_reply | ||||||
|  | function parses the response to a query of type SRV into a | ||||||
|  | .I struct ares_srv_reply  | ||||||
|  | The parameters | ||||||
|  | .I abuf | ||||||
|  | and | ||||||
|  | .I alen | ||||||
|  | give the contents of the response.  The result is stored in allocated | ||||||
|  | memory and a pointer to it stored into the variable pointed to by | ||||||
|  | .IR srv_out . | ||||||
|  | The number of responses is stored into the variable pointed to by | ||||||
|  | .IR nsrvreply . | ||||||
|  | It is the caller's responsibility to free the resulting | ||||||
|  | .IR srv_out | ||||||
|  | structure when it is no longer needed. | ||||||
|  | .PP | ||||||
|  | The structure  | ||||||
|  | .I ares_srv_reply | ||||||
|  | contains the following fields: | ||||||
|  | .sp | ||||||
|  | .in +4n | ||||||
|  | .nf | ||||||
|  | struct ares_srv_reply { | ||||||
|  |     unsigned short weight; | ||||||
|  |     unsigned short priority; | ||||||
|  |     unsigned short port; | ||||||
|  |     char *host; | ||||||
|  | }; | ||||||
|  | .fi | ||||||
|  | .in | ||||||
|  | .PP | ||||||
|  | .SH RETURN VALUES | ||||||
|  | .B ares_parse_srv_reply | ||||||
|  | can return any of the following values: | ||||||
|  | .TP 15 | ||||||
|  | .B ARES_SUCCESS | ||||||
|  | The response was successfully parsed. | ||||||
|  | .TP 15 | ||||||
|  | .B ARES_EBADRESP | ||||||
|  | The response was malformatted. | ||||||
|  | .TP 15 | ||||||
|  | .B ARES_ENODATA | ||||||
|  | The response did not contain an answer to the query. | ||||||
|  | .TP 15 | ||||||
|  | .B ARES_ENOMEM | ||||||
|  | Memory was exhausted. | ||||||
|  | .SH SEE ALSO | ||||||
|  | .BR ares_query (3) | ||||||
|  | .SH AUTHOR | ||||||
|  | Written by Jakub Hrozek <jhrozek@redhat.com>, on behalf of Red Hat, Inc http://www.redhat.com | ||||||
							
								
								
									
										173
									
								
								ares/ares_parse_srv_reply.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										173
									
								
								ares/ares_parse_srv_reply.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,173 @@ | |||||||
|  | /* Id$ */ | ||||||
|  |  | ||||||
|  | /* Copyright 1998 by the Massachusetts Institute of Technology. | ||||||
|  |  * | ||||||
|  |  * Permission to use, copy, modify, and distribute this | ||||||
|  |  * software and its documentation for any purpose and without | ||||||
|  |  * fee is hereby granted, provided that the above copyright | ||||||
|  |  * notice appear in all copies and that both that copyright | ||||||
|  |  * notice and this permission notice appear in supporting | ||||||
|  |  * documentation, and that the name of M.I.T. not be used in | ||||||
|  |  * advertising or publicity pertaining to distribution of the | ||||||
|  |  * software without specific, written prior permission. | ||||||
|  |  * M.I.T. makes no representations about the suitability of | ||||||
|  |  * this software for any purpose.  It is provided "as is" | ||||||
|  |  * without express or implied warranty. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * ares_parse_srv_reply created by Jakub Hrozek <jhrozek@redhat.com> | ||||||
|  |  *      on behalf of Red Hat - http://www.redhat.com | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | #include "ares_setup.h" | ||||||
|  |  | ||||||
|  | #ifdef HAVE_SYS_SOCKET_H | ||||||
|  | #  include <sys/socket.h> | ||||||
|  | #endif | ||||||
|  | #ifdef HAVE_NETINET_IN_H | ||||||
|  | #  include <netinet/in.h> | ||||||
|  | #endif | ||||||
|  | #ifdef HAVE_NETDB_H | ||||||
|  | #  include <netdb.h> | ||||||
|  | #endif | ||||||
|  | #ifdef HAVE_ARPA_INET_H | ||||||
|  | #  include <arpa/inet.h> | ||||||
|  | #endif | ||||||
|  | #ifdef HAVE_ARPA_NAMESER_H | ||||||
|  | #  include <arpa/nameser.h> | ||||||
|  | #else | ||||||
|  | #  include "nameser.h" | ||||||
|  | #endif | ||||||
|  | #ifdef HAVE_ARPA_NAMESER_COMPAT_H | ||||||
|  | #  include <arpa/nameser_compat.h> | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #include <stdlib.h> | ||||||
|  | #include <string.h> | ||||||
|  | #include "ares.h" | ||||||
|  | #include "ares_dns.h" | ||||||
|  | #include "ares_private.h" | ||||||
|  |  | ||||||
|  | /* AIX portability check */ | ||||||
|  | #ifndef T_SRV | ||||||
|  | #  define T_SRV 33 /* server selection */ | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | int | ||||||
|  | ares_parse_srv_reply (const unsigned char *abuf, int alen, | ||||||
|  |                       struct ares_srv_reply **srv_out, int *nsrvreply) | ||||||
|  | { | ||||||
|  |   unsigned int qdcount, ancount; | ||||||
|  |   const unsigned char *aptr; | ||||||
|  |   int status, i, rr_type, rr_class, rr_len; | ||||||
|  |   long len; | ||||||
|  |   char *hostname = NULL, *rr_name = NULL; | ||||||
|  |   struct ares_srv_reply *srv = NULL; | ||||||
|  |  | ||||||
|  |   /* Set *srv_out to NULL for all failure cases. */ | ||||||
|  |   *srv_out = NULL; | ||||||
|  |  | ||||||
|  |   /* Same with *nsrvreply. */ | ||||||
|  |   *nsrvreply = 0; | ||||||
|  |  | ||||||
|  |   /* Give up if abuf doesn't have room for a header. */ | ||||||
|  |   if (alen < HFIXEDSZ) | ||||||
|  |     return ARES_EBADRESP; | ||||||
|  |  | ||||||
|  |   /* Fetch the question and answer count from the header. */ | ||||||
|  |   qdcount = DNS_HEADER_QDCOUNT (abuf); | ||||||
|  |   ancount = DNS_HEADER_ANCOUNT (abuf); | ||||||
|  |   if (qdcount != 1) | ||||||
|  |     return ARES_EBADRESP; | ||||||
|  |   if (ancount == 0) | ||||||
|  |     return ARES_ENODATA; | ||||||
|  |  | ||||||
|  |   /* Expand the name from the question, and skip past the question. */ | ||||||
|  |   aptr = abuf + HFIXEDSZ; | ||||||
|  |   status = ares_expand_name (aptr, abuf, alen, &hostname, &len); | ||||||
|  |   if (status != ARES_SUCCESS) | ||||||
|  |     return status; | ||||||
|  |  | ||||||
|  |   if (aptr + len + QFIXEDSZ > abuf + alen) | ||||||
|  |     { | ||||||
|  |       free (hostname); | ||||||
|  |       return ARES_EBADRESP; | ||||||
|  |     } | ||||||
|  |   aptr += len + QFIXEDSZ; | ||||||
|  |  | ||||||
|  |   /* Allocate ares_srv_reply array; ancount gives an upper bound */ | ||||||
|  |   srv = malloc ((ancount) * sizeof (struct ares_srv_reply)); | ||||||
|  |   if (!srv) | ||||||
|  |     { | ||||||
|  |       free (hostname); | ||||||
|  |       return ARES_ENOMEM; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |   /* Examine each answer resource record (RR) in turn. */ | ||||||
|  |   for (i = 0; i < (int) ancount; i++) | ||||||
|  |     { | ||||||
|  |       /* Decode the RR up to the data field. */ | ||||||
|  |       status = ares_expand_name (aptr, abuf, alen, &rr_name, &len); | ||||||
|  |       if (status != ARES_SUCCESS) | ||||||
|  |         { | ||||||
|  |           break; | ||||||
|  |         } | ||||||
|  |       aptr += len; | ||||||
|  |       if (aptr + RRFIXEDSZ > abuf + alen) | ||||||
|  |         { | ||||||
|  |           status = ARES_EBADRESP; | ||||||
|  |           break; | ||||||
|  |         } | ||||||
|  |       rr_type = DNS_RR_TYPE (aptr); | ||||||
|  |       rr_class = DNS_RR_CLASS (aptr); | ||||||
|  |       rr_len = DNS_RR_LEN (aptr); | ||||||
|  |       aptr += RRFIXEDSZ; | ||||||
|  |  | ||||||
|  |       /* Check if we are really looking at a SRV record */ | ||||||
|  |       if (rr_class == C_IN && rr_type == T_SRV) | ||||||
|  |         { | ||||||
|  |           /* parse the SRV record itself */ | ||||||
|  |           if (rr_len < 6) | ||||||
|  |             { | ||||||
|  |               status = ARES_EBADRESP; | ||||||
|  |               break; | ||||||
|  |             } | ||||||
|  |  | ||||||
|  |           srv[i].priority = ntohs (*((unsigned short *)aptr)); | ||||||
|  |           aptr += sizeof(unsigned short); | ||||||
|  |           srv[i].weight = ntohs (*((unsigned short *)aptr)); | ||||||
|  |           aptr += sizeof(unsigned short); | ||||||
|  |           srv[i].port = ntohs (*((unsigned short *)aptr)); | ||||||
|  |           aptr += sizeof(unsigned short); | ||||||
|  |  | ||||||
|  |           status = ares_expand_name (aptr, abuf, alen, &srv[i].host, &len); | ||||||
|  |           if (status != ARES_SUCCESS) | ||||||
|  |             break; | ||||||
|  |  | ||||||
|  |           /* Move on to the next record */ | ||||||
|  |           aptr += len; | ||||||
|  |  | ||||||
|  |           /* Don't lose memory in the next iteration */ | ||||||
|  |           free (rr_name); | ||||||
|  |           rr_name = NULL; | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |   /* clean up on error */ | ||||||
|  |   if (status != ARES_SUCCESS) | ||||||
|  |     { | ||||||
|  |       free (srv); | ||||||
|  |       free (hostname); | ||||||
|  |       free (rr_name); | ||||||
|  |       return status; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |   /* everything looks fine, return the data */ | ||||||
|  |   *srv_out = srv; | ||||||
|  |   *nsrvreply = ancount; | ||||||
|  |  | ||||||
|  |   free (hostname); | ||||||
|  |   free (rr_name); | ||||||
|  |   return status; | ||||||
|  | } | ||||||
							
								
								
									
										76
									
								
								ares/ares_parse_txt_reply.3
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										76
									
								
								ares/ares_parse_txt_reply.3
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,76 @@ | |||||||
|  | .\" | ||||||
|  | .\" Copyright 1998 by the Massachusetts Institute of Technology. | ||||||
|  | .\" | ||||||
|  | .\" Permission to use, copy, modify, and distribute this | ||||||
|  | .\" software and its documentation for any purpose and without | ||||||
|  | .\" fee is hereby granted, provided that the above copyright | ||||||
|  | .\" notice appear in all copies and that both that copyright | ||||||
|  | .\" notice and this permission notice appear in supporting | ||||||
|  | .\" documentation, and that the name of M.I.T. not be used in | ||||||
|  | .\" advertising or publicity pertaining to distribution of the | ||||||
|  | .\" software without specific, written prior permission. | ||||||
|  | .\" M.I.T. makes no representations about the suitability of | ||||||
|  | .\" this software for any purpose.  It is provided "as is" | ||||||
|  | .\" without express or implied warranty. | ||||||
|  | .\" | ||||||
|  | .TH ARES_PARSE_TXT_REPLY 3 "27 October 2009" | ||||||
|  | .SH NAME | ||||||
|  | ares_parse_txt_reply \- Parse a reply to a DNS query of type TXT | ||||||
|  | .SH SYNOPSIS | ||||||
|  | .nf | ||||||
|  | .B #include <ares.h> | ||||||
|  | .PP | ||||||
|  | .B int ares_parse_txt_reply(const unsigned char* \fIabuf\fP, int \fIalen\fP, | ||||||
|  | .B                         struct ares_txt_reply **\fItxt_out\fP, int *\fIntxtreply\fP); | ||||||
|  | .fi | ||||||
|  | .SH DESCRIPTION | ||||||
|  | The | ||||||
|  | .B ares_parse_txt_reply | ||||||
|  | function parses the response to a query of type TXT into a | ||||||
|  | .I struct ares_txt_reply  | ||||||
|  | The parameters | ||||||
|  | .I abuf | ||||||
|  | and | ||||||
|  | .I alen | ||||||
|  | give the contents of the response.  The result is stored in allocated | ||||||
|  | memory and a pointer to it stored into the variable pointed to by | ||||||
|  | .IR txt_out . | ||||||
|  | The number of responses is stored into the variable pointed to by | ||||||
|  | .IR ntxtreply . | ||||||
|  | It is the caller's responsibility to free the resulting | ||||||
|  | .IR txt_out | ||||||
|  | structure when it is no longer needed. | ||||||
|  | .PP | ||||||
|  | The structure  | ||||||
|  | .I ares_txt_reply | ||||||
|  | contains the following fields: | ||||||
|  | .sp | ||||||
|  | .in +4n | ||||||
|  | .nf | ||||||
|  | struct ares_txt_reply { | ||||||
|  |   unsigned int  length; | ||||||
|  |   unsigned char *txt; | ||||||
|  | }; | ||||||
|  | .fi | ||||||
|  | .in | ||||||
|  | .PP | ||||||
|  | .SH RETURN VALUES | ||||||
|  | .B ares_parse_txt_reply | ||||||
|  | can return any of the following values: | ||||||
|  | .TP 15 | ||||||
|  | .B ARES_SUCCESS | ||||||
|  | The response was successfully parsed. | ||||||
|  | .TP 15 | ||||||
|  | .B ARES_EBADRESP | ||||||
|  | The response was malformatted. | ||||||
|  | .TP 15 | ||||||
|  | .B ARES_ENODATA | ||||||
|  | The response did not contain an answer to the query. | ||||||
|  | .TP 15 | ||||||
|  | .B ARES_ENOMEM | ||||||
|  | Memory was exhausted. | ||||||
|  | .SH SEE ALSO | ||||||
|  | .BR ares_query (3) | ||||||
|  | .SH AUTHOR | ||||||
|  | Written by Jakub Hrozek <jhrozek@redhat.com>, on behalf of Red Hat, Inc http://www.redhat.com | ||||||
|  |  | ||||||
							
								
								
									
										205
									
								
								ares/ares_parse_txt_reply.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										205
									
								
								ares/ares_parse_txt_reply.c
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,205 @@ | |||||||
|  | /* $Id$ */ | ||||||
|  |  | ||||||
|  | /* Copyright 1998 by the Massachusetts Institute of Technology. | ||||||
|  |  * Copyright (C) 2009 Jakub Hrozek <jhrozek@redhat.com> | ||||||
|  |  * Copyright (C) 2009 Yang Tse <yangsita@gmail.com> | ||||||
|  |  * | ||||||
|  |  * Permission to use, copy, modify, and distribute this | ||||||
|  |  * software and its documentation for any purpose and without | ||||||
|  |  * fee is hereby granted, provided that the above copyright | ||||||
|  |  * notice appear in all copies and that both that copyright | ||||||
|  |  * notice and this permission notice appear in supporting | ||||||
|  |  * documentation, and that the name of M.I.T. not be used in | ||||||
|  |  * advertising or publicity pertaining to distribution of the | ||||||
|  |  * software without specific, written prior permission. | ||||||
|  |  * M.I.T. makes no representations about the suitability of | ||||||
|  |  * this software for any purpose.  It is provided "as is" | ||||||
|  |  * without express or implied warranty. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | #include "ares_setup.h" | ||||||
|  |  | ||||||
|  | #ifdef HAVE_SYS_SOCKET_H | ||||||
|  | #  include <sys/socket.h> | ||||||
|  | #endif | ||||||
|  | #ifdef HAVE_NETINET_IN_H | ||||||
|  | #  include <netinet/in.h> | ||||||
|  | #endif | ||||||
|  | #ifdef HAVE_NETDB_H | ||||||
|  | #  include <netdb.h> | ||||||
|  | #endif | ||||||
|  | #ifdef HAVE_ARPA_INET_H | ||||||
|  | #  include <arpa/inet.h> | ||||||
|  | #endif | ||||||
|  | #ifdef HAVE_ARPA_NAMESER_H | ||||||
|  | #  include <arpa/nameser.h> | ||||||
|  | #else | ||||||
|  | #  include "nameser.h" | ||||||
|  | #endif | ||||||
|  | #ifdef HAVE_ARPA_NAMESER_COMPAT_H | ||||||
|  | #  include <arpa/nameser_compat.h> | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #ifdef HAVE_STRINGS_H | ||||||
|  | #  include <strings.h> | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #include <stdlib.h> | ||||||
|  | #include <string.h> | ||||||
|  |  | ||||||
|  | #include "ares.h" | ||||||
|  | #include "ares_dns.h" | ||||||
|  | #include "ares_private.h" | ||||||
|  |  | ||||||
|  | int | ||||||
|  | ares_parse_txt_reply (const unsigned char *abuf, int alen, | ||||||
|  |                       struct ares_txt_reply **txt_out, int *ntxtreply) | ||||||
|  | { | ||||||
|  |   size_t substr_len, str_len; | ||||||
|  |   unsigned int qdcount, ancount, i; | ||||||
|  |   const unsigned char *aptr; | ||||||
|  |   const unsigned char *strptr; | ||||||
|  |   int status, rr_type, rr_class, rr_len; | ||||||
|  |   long len; | ||||||
|  |   char *hostname = NULL, *rr_name = NULL; | ||||||
|  |   struct ares_txt_reply *txt = NULL; | ||||||
|  |  | ||||||
|  |   /* Set *txt_out to NULL for all failure cases. */ | ||||||
|  |   *txt_out = NULL; | ||||||
|  |  | ||||||
|  |   /* Same with *ntxtreply. */ | ||||||
|  |   *ntxtreply = 0; | ||||||
|  |  | ||||||
|  |   /* Give up if abuf doesn't have room for a header. */ | ||||||
|  |   if (alen < HFIXEDSZ) | ||||||
|  |     return ARES_EBADRESP; | ||||||
|  |  | ||||||
|  |   /* Fetch the question and answer count from the header. */ | ||||||
|  |   qdcount = DNS_HEADER_QDCOUNT (abuf); | ||||||
|  |   ancount = DNS_HEADER_ANCOUNT (abuf); | ||||||
|  |   if (qdcount != 1) | ||||||
|  |     return ARES_EBADRESP; | ||||||
|  |   if (ancount == 0) | ||||||
|  |     return ARES_ENODATA; | ||||||
|  |  | ||||||
|  |   /* Expand the name from the question, and skip past the question. */ | ||||||
|  |   aptr = abuf + HFIXEDSZ; | ||||||
|  |   status = ares_expand_name (aptr, abuf, alen, &hostname, &len); | ||||||
|  |   if (status != ARES_SUCCESS) | ||||||
|  |     return status; | ||||||
|  |  | ||||||
|  |   if (aptr + len + QFIXEDSZ > abuf + alen) | ||||||
|  |     { | ||||||
|  |       free (hostname); | ||||||
|  |       return ARES_EBADRESP; | ||||||
|  |     } | ||||||
|  |   aptr += len + QFIXEDSZ; | ||||||
|  |  | ||||||
|  |   /* Allocate ares_txt_reply array; ancount gives an upper bound */ | ||||||
|  |   txt = malloc ((ancount) * sizeof (struct ares_txt_reply)); | ||||||
|  |   if (!txt) | ||||||
|  |     { | ||||||
|  |       free (hostname); | ||||||
|  |       return ARES_ENOMEM; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |   /* Initialize ares_txt_reply array */ | ||||||
|  |   for (i = 0; i < ancount; i++) | ||||||
|  |     { | ||||||
|  |       txt[i].txt = NULL; | ||||||
|  |       txt[i].length = 0; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |   /* Examine each answer resource record (RR) in turn. */ | ||||||
|  |   for (i = 0; i < ancount; i++) | ||||||
|  |     { | ||||||
|  |       /* Decode the RR up to the data field. */ | ||||||
|  |       status = ares_expand_name (aptr, abuf, alen, &rr_name, &len); | ||||||
|  |       if (status != ARES_SUCCESS) | ||||||
|  |         { | ||||||
|  |           break; | ||||||
|  |         } | ||||||
|  |       aptr += len; | ||||||
|  |       if (aptr + RRFIXEDSZ > abuf + alen) | ||||||
|  |         { | ||||||
|  |           status = ARES_EBADRESP; | ||||||
|  |           break; | ||||||
|  |         } | ||||||
|  |       rr_type = DNS_RR_TYPE (aptr); | ||||||
|  |       rr_class = DNS_RR_CLASS (aptr); | ||||||
|  |       rr_len = DNS_RR_LEN (aptr); | ||||||
|  |       aptr += RRFIXEDSZ; | ||||||
|  |  | ||||||
|  |       /* Check if we are really looking at a TXT record */ | ||||||
|  |       if (rr_class == C_IN && rr_type == T_TXT) | ||||||
|  |         { | ||||||
|  |           /* | ||||||
|  |            * There may be multiple substrings in a single TXT record. Each | ||||||
|  |            * substring may be up to 255 characters in length, with a | ||||||
|  |            * "length byte" indicating the size of the substring payload. | ||||||
|  |            * RDATA contains both the length-bytes and payloads of all | ||||||
|  |            * substrings contained therein. | ||||||
|  |            */ | ||||||
|  |  | ||||||
|  |           /* Compute total length to allow a single memory allocation */ | ||||||
|  |           strptr = aptr; | ||||||
|  |           while (strptr < (aptr + rr_len)) | ||||||
|  |             { | ||||||
|  |               substr_len = (unsigned char)*strptr; | ||||||
|  |               txt[i].length += substr_len; | ||||||
|  |               strptr += substr_len + 1; | ||||||
|  |             } | ||||||
|  |  | ||||||
|  |           /* Including null byte */ | ||||||
|  |           txt[i].txt = malloc (txt[i].length + 1); | ||||||
|  |           if (txt[i].txt == NULL) | ||||||
|  |             { | ||||||
|  |               status = ARES_ENOMEM; | ||||||
|  |               break; | ||||||
|  |             } | ||||||
|  |  | ||||||
|  |           /* Step through the list of substrings, concatenating them */ | ||||||
|  |           str_len = 0; | ||||||
|  |           strptr = aptr; | ||||||
|  |           while (strptr < (aptr + rr_len)) | ||||||
|  |             { | ||||||
|  |               substr_len = (unsigned char)*strptr; | ||||||
|  |               strptr++; | ||||||
|  |               memcpy ((char *) txt[i].txt + str_len, strptr, substr_len); | ||||||
|  |               str_len += substr_len; | ||||||
|  |               strptr += substr_len; | ||||||
|  |             } | ||||||
|  |           /* Make sure we NULL-terminate */ | ||||||
|  |           txt[i].txt[txt[i].length] = '\0'; | ||||||
|  |  | ||||||
|  |           /* Move on to the next record */ | ||||||
|  |           aptr += rr_len; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |       /* Don't lose memory in the next iteration */ | ||||||
|  |       free (rr_name); | ||||||
|  |       rr_name = NULL; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |   if (hostname) | ||||||
|  |     free (hostname); | ||||||
|  |   if (rr_name) | ||||||
|  |     free (rr_name); | ||||||
|  |  | ||||||
|  |   /* clean up on error */ | ||||||
|  |   if (status != ARES_SUCCESS) | ||||||
|  |     { | ||||||
|  |     for (i = 0; i < ancount; i++) | ||||||
|  |       { | ||||||
|  |         if (txt[i].txt) | ||||||
|  |           free (txt[i].txt); | ||||||
|  |       } | ||||||
|  |       return status; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |   /* everything looks fine, return the data */ | ||||||
|  |   *txt_out = txt; | ||||||
|  |   *ntxtreply = ancount; | ||||||
|  |  | ||||||
|  |   return ARES_SUCCESS; | ||||||
|  | } | ||||||
| @@ -4,7 +4,7 @@ | |||||||
| /* $Id$ */ | /* $Id$ */ | ||||||
|  |  | ||||||
| /* Copyright 1998 by the Massachusetts Institute of Technology. | /* Copyright 1998 by the Massachusetts Institute of Technology. | ||||||
|  * Copyright (C) 2004-2008 by Daniel Stenberg |  * Copyright (C) 2004-2009 by Daniel Stenberg | ||||||
|  * |  * | ||||||
|  * Permission to use, copy, modify, and distribute this |  * Permission to use, copy, modify, and distribute this | ||||||
|  * software and its documentation for any purpose and without |  * software and its documentation for any purpose and without | ||||||
| @@ -32,16 +32,11 @@ | |||||||
|  |  | ||||||
| #if !defined(WIN32) || defined(WATT32) | #if !defined(WIN32) || defined(WATT32) | ||||||
| #include <netinet/in.h> | #include <netinet/in.h> | ||||||
| /* We define closesocket() here so that we can use this function all over |  | ||||||
|    the source code for closing sockets. */ |  | ||||||
| #define closesocket(x) close(x) |  | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #ifdef WATT32 | #ifdef WATT32 | ||||||
| #include <tcp.h> | #include <tcp.h> | ||||||
| #include <sys/ioctl.h> | #include <sys/ioctl.h> | ||||||
| #undef  closesocket |  | ||||||
| #define closesocket(s)    close_s(s) |  | ||||||
| #define writev(s,v,c)     writev_s(s,v,c) | #define writev(s,v,c)     writev_s(s,v,c) | ||||||
| #define HAVE_WRITEV 1 | #define HAVE_WRITEV 1 | ||||||
| #endif | #endif | ||||||
| @@ -310,12 +305,14 @@ int ares__timeadd(struct timeval *now, | |||||||
| /* return time offset between now and (future) check, in milliseconds */ | /* return time offset between now and (future) check, in milliseconds */ | ||||||
| long ares__timeoffset(struct timeval *now, | long ares__timeoffset(struct timeval *now, | ||||||
|                       struct timeval *check); |                       struct timeval *check); | ||||||
|  | /* returns ARES_SUCCESS if library has been initialized */ | ||||||
|  | int ares_library_initialized(void); | ||||||
| void ares__rc4(rc4_key* key,unsigned char *buffer_ptr, int buffer_len); | void ares__rc4(rc4_key* key,unsigned char *buffer_ptr, int buffer_len); | ||||||
| void ares__send_query(ares_channel channel, struct query *query, | void ares__send_query(ares_channel channel, struct query *query, | ||||||
|                       struct timeval *now); |                       struct timeval *now); | ||||||
| void ares__close_sockets(ares_channel channel, struct server_state *server); | void ares__close_sockets(ares_channel channel, struct server_state *server); | ||||||
| int ares__get_hostent(FILE *fp, int family, struct hostent **host); | int ares__get_hostent(FILE *fp, int family, struct hostent **host); | ||||||
| int ares__read_line(FILE *fp, char **buf, int *bufsize); | int ares__read_line(FILE *fp, char **buf, size_t *bufsize); | ||||||
| void ares__free_query(struct query *query); | void ares__free_query(struct query *query); | ||||||
| unsigned short ares__generate_new_id(rc4_key* key); | unsigned short ares__generate_new_id(rc4_key* key); | ||||||
| struct timeval ares__tvnow(void); | struct timeval ares__tvnow(void); | ||||||
| @@ -338,8 +335,8 @@ long ares__tvdiff(struct timeval t1, struct timeval t2); | |||||||
| #ifdef CURLDEBUG | #ifdef CURLDEBUG | ||||||
| /* This is low-level hard-hacking memory leak tracking and similar. Using the | /* This is low-level hard-hacking memory leak tracking and similar. Using the | ||||||
|    libcurl lowlevel code from within library is ugly and only works when |    libcurl lowlevel code from within library is ugly and only works when | ||||||
|    c-ares is built and linked with a similarly debug-build libcurl, but we do |    c-ares is built and linked with a similarly curldebug-enabled libcurl, | ||||||
|    this anyway for convenience. */ |    but we do this anyway for convenience. */ | ||||||
| #include "../lib/memdebug.h" | #include "../lib/memdebug.h" | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| /* $Id$ */ | /* $Id$ */ | ||||||
|  |  | ||||||
| /* Copyright 1998 by the Massachusetts Institute of Technology. | /* Copyright 1998 by the Massachusetts Institute of Technology. | ||||||
|  * Copyright (C) 2004-2008 by Daniel Stenberg |  * Copyright (C) 2004-2009 by Daniel Stenberg | ||||||
|  * |  * | ||||||
|  * Permission to use, copy, modify, and distribute this |  * Permission to use, copy, modify, and distribute this | ||||||
|  * software and its documentation for any purpose and without |  * software and its documentation for any purpose and without | ||||||
| @@ -16,7 +16,7 @@ | |||||||
|  * without express or implied warranty. |  * without express or implied warranty. | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "setup.h" | #include "ares_setup.h" | ||||||
|  |  | ||||||
| #ifdef HAVE_SYS_SOCKET_H | #ifdef HAVE_SYS_SOCKET_H | ||||||
| #  include <sys/socket.h> | #  include <sys/socket.h> | ||||||
| @@ -104,7 +104,7 @@ static void end_query(ares_channel channel, struct query *query, int status, | |||||||
| int ares__timedout(struct timeval *now, | int ares__timedout(struct timeval *now, | ||||||
|                    struct timeval *check) |                    struct timeval *check) | ||||||
| { | { | ||||||
|   int secs = (now->tv_sec - check->tv_sec); |   long secs = (now->tv_sec - check->tv_sec); | ||||||
|  |  | ||||||
|   if(secs > 0) |   if(secs > 0) | ||||||
|     return 1; /* yes, timed out */ |     return 1; /* yes, timed out */ | ||||||
| @@ -429,7 +429,7 @@ static void read_udp_packets(ares_channel channel, fd_set *read_fds, | |||||||
|   unsigned char buf[PACKETSZ + 1]; |   unsigned char buf[PACKETSZ + 1]; | ||||||
| #ifdef HAVE_RECVFROM | #ifdef HAVE_RECVFROM | ||||||
|   struct sockaddr_in from; |   struct sockaddr_in from; | ||||||
|   socklen_t fromlen; |   ares_socklen_t fromlen; | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|   if(!read_fds && (read_fd == ARES_SOCKET_BAD)) |   if(!read_fds && (read_fd == ARES_SOCKET_BAD)) | ||||||
| @@ -896,7 +896,7 @@ static int open_tcp_socket(ares_channel channel, struct server_state *server) | |||||||
|   /* Configure it. */ |   /* Configure it. */ | ||||||
|   if (configure_socket(s, channel) < 0) |   if (configure_socket(s, channel) < 0) | ||||||
|     { |     { | ||||||
|        closesocket(s); |        sclose(s); | ||||||
|        return -1; |        return -1; | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -911,7 +911,7 @@ static int open_tcp_socket(ares_channel channel, struct server_state *server) | |||||||
|   if (setsockopt(s, IPPROTO_TCP, TCP_NODELAY, |   if (setsockopt(s, IPPROTO_TCP, TCP_NODELAY, | ||||||
|                  (void *)&opt, sizeof(opt)) == -1) |                  (void *)&opt, sizeof(opt)) == -1) | ||||||
|     { |     { | ||||||
|        closesocket(s); |        sclose(s); | ||||||
|        return -1; |        return -1; | ||||||
|     } |     } | ||||||
| #endif | #endif | ||||||
| @@ -927,7 +927,7 @@ static int open_tcp_socket(ares_channel channel, struct server_state *server) | |||||||
|  |  | ||||||
|       if (err != EINPROGRESS && err != EWOULDBLOCK) |       if (err != EINPROGRESS && err != EWOULDBLOCK) | ||||||
|         { |         { | ||||||
|           closesocket(s); |           sclose(s); | ||||||
|           return -1; |           return -1; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| @@ -938,7 +938,7 @@ static int open_tcp_socket(ares_channel channel, struct server_state *server) | |||||||
|                                         channel->sock_create_cb_data); |                                         channel->sock_create_cb_data); | ||||||
|       if (err < 0) |       if (err < 0) | ||||||
|         { |         { | ||||||
|           closesocket(s); |           sclose(s); | ||||||
|           return err; |           return err; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| @@ -963,7 +963,7 @@ static int open_udp_socket(ares_channel channel, struct server_state *server) | |||||||
|   /* Set the socket non-blocking. */ |   /* Set the socket non-blocking. */ | ||||||
|   if (configure_socket(s, channel) < 0) |   if (configure_socket(s, channel) < 0) | ||||||
|     { |     { | ||||||
|        closesocket(s); |        sclose(s); | ||||||
|        return -1; |        return -1; | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -978,7 +978,7 @@ static int open_udp_socket(ares_channel channel, struct server_state *server) | |||||||
|  |  | ||||||
|       if (err != EINPROGRESS && err != EWOULDBLOCK) |       if (err != EINPROGRESS && err != EWOULDBLOCK) | ||||||
|         { |         { | ||||||
|           closesocket(s); |           sclose(s); | ||||||
|           return -1; |           return -1; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| @@ -989,7 +989,7 @@ static int open_udp_socket(ares_channel channel, struct server_state *server) | |||||||
|                                         channel->sock_create_cb_data); |                                         channel->sock_create_cb_data); | ||||||
|       if (err < 0) |       if (err < 0) | ||||||
|         { |         { | ||||||
|           closesocket(s); |           sclose(s); | ||||||
|           return err; |           return err; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -15,7 +15,7 @@ | |||||||
|  * without express or implied warranty. |  * without express or implied warranty. | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "setup.h" | #include "ares_setup.h" | ||||||
|  |  | ||||||
| #ifdef HAVE_SYS_SOCKET_H | #ifdef HAVE_SYS_SOCKET_H | ||||||
| #  include <sys/socket.h> | #  include <sys/socket.h> | ||||||
|   | |||||||
							
								
								
									
										145
									
								
								ares/ares_rules.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										145
									
								
								ares/ares_rules.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,145 @@ | |||||||
|  | #ifndef __CARES_RULES_H | ||||||
|  | #define __CARES_RULES_H | ||||||
|  |  | ||||||
|  | /* $Id$ */ | ||||||
|  |  | ||||||
|  | /* Copyright (C) 2009 by Daniel Stenberg et al | ||||||
|  |  * | ||||||
|  |  * Permission to use, copy, modify, and distribute this software and its | ||||||
|  |  * documentation for any purpose and without fee is hereby granted, provided | ||||||
|  |  * that the above copyright notice appear in all copies and that both that | ||||||
|  |  * copyright notice and this permission notice appear in supporting | ||||||
|  |  * documentation, and that the name of M.I.T. not be used in advertising or | ||||||
|  |  * publicity pertaining to distribution of the software without specific, | ||||||
|  |  * written prior permission.  M.I.T. makes no representations about the | ||||||
|  |  * suitability of this software for any purpose.  It is provided "as is" | ||||||
|  |  * without express or implied warranty. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | /* ================================================================ */ | ||||||
|  | /*                    COMPILE TIME SANITY CHECKS                    */ | ||||||
|  | /* ================================================================ */ | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * NOTE 1: | ||||||
|  |  * ------- | ||||||
|  |  * | ||||||
|  |  * All checks done in this file are intentionally placed in a public | ||||||
|  |  * header file which is pulled by ares.h when an application is | ||||||
|  |  * being built using an already built c-ares library. Additionally | ||||||
|  |  * this file is also included and used when building the library. | ||||||
|  |  * | ||||||
|  |  * If compilation fails on this file it is certainly sure that the | ||||||
|  |  * problem is elsewhere. It could be a problem in the ares_build.h | ||||||
|  |  * header file, or simply that you are using different compilation | ||||||
|  |  * settings than those used to build the library. | ||||||
|  |  * | ||||||
|  |  * Nothing in this file is intended to be modified or adjusted by the | ||||||
|  |  * c-ares library user nor by the c-ares library builder. | ||||||
|  |  * | ||||||
|  |  * Do not deactivate any check, these are done to make sure that the | ||||||
|  |  * library is properly built and used. | ||||||
|  |  * | ||||||
|  |  * You can find further help on the c-ares development mailing list: | ||||||
|  |  * http://cool.haxx.se/mailman/listinfo/c-ares/ | ||||||
|  |  * | ||||||
|  |  * NOTE 2 | ||||||
|  |  * ------ | ||||||
|  |  * | ||||||
|  |  * Some of the following compile time checks are based on the fact | ||||||
|  |  * that the dimension of a constant array can not be a negative one. | ||||||
|  |  * In this way if the compile time verification fails, the compilation | ||||||
|  |  * will fail issuing an error. The error description wording is compiler | ||||||
|  |  * dependent but it will be quite similar to one of the following: | ||||||
|  |  * | ||||||
|  |  *   "negative subscript or subscript is too large" | ||||||
|  |  *   "array must have at least one element" | ||||||
|  |  *   "-1 is an illegal array size" | ||||||
|  |  *   "size of array is negative" | ||||||
|  |  * | ||||||
|  |  * If you are building an application which tries to use an already | ||||||
|  |  * built c-ares library and you are getting this kind of errors on | ||||||
|  |  * this file, it is a clear indication that there is a mismatch between | ||||||
|  |  * how the library was built and how you are trying to use it for your | ||||||
|  |  * application. Your already compiled or binary library provider is the | ||||||
|  |  * only one who can give you the details you need to properly use it. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * Verify that some macros are actually defined. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | #ifndef CARES_SIZEOF_LONG | ||||||
|  | #  error "CARES_SIZEOF_LONG definition is missing!" | ||||||
|  |    Error Compilation_aborted_CARES_SIZEOF_LONG_is_missing | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #ifndef CARES_TYPEOF_ARES_SOCKLEN_T | ||||||
|  | #  error "CARES_TYPEOF_ARES_SOCKLEN_T definition is missing!" | ||||||
|  |    Error Compilation_aborted_CARES_TYPEOF_ARES_SOCKLEN_T_is_missing | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #ifndef CARES_SIZEOF_ARES_SOCKLEN_T | ||||||
|  | #  error "CARES_SIZEOF_ARES_SOCKLEN_T definition is missing!" | ||||||
|  |    Error Compilation_aborted_CARES_SIZEOF_ARES_SOCKLEN_T_is_missing | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * Macros private to this header file. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | #define CareschkszEQ(t, s) sizeof(t) == s ? 1 : -1 | ||||||
|  |  | ||||||
|  | #define CareschkszGE(t1, t2) sizeof(t1) >= sizeof(t2) ? 1 : -1 | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * Verify that the size previously defined and expected for long | ||||||
|  |  * is the same as the one reported by sizeof() at compile time. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | typedef char | ||||||
|  |   __cares_rule_01__ | ||||||
|  |     [CareschkszEQ(long, CARES_SIZEOF_LONG)]; | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * Verify that the size previously defined and expected for | ||||||
|  |  * ares_socklen_t is actually the the same as the one reported | ||||||
|  |  * by sizeof() at compile time. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | typedef char | ||||||
|  |   __cares_rule_02__ | ||||||
|  |     [CareschkszEQ(ares_socklen_t, CARES_SIZEOF_ARES_SOCKLEN_T)]; | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * Verify at compile time that the size of ares_socklen_t as reported | ||||||
|  |  * by sizeof() is greater or equal than the one reported for int for | ||||||
|  |  * the current compilation. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | typedef char | ||||||
|  |   __cares_rule_03__ | ||||||
|  |     [CareschkszGE(ares_socklen_t, int)]; | ||||||
|  |  | ||||||
|  | /* ================================================================ */ | ||||||
|  | /*          EXTERNALLY AND INTERNALLY VISIBLE DEFINITIONS           */ | ||||||
|  | /* ================================================================ */ | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * Get rid of macros private to this header file. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | #undef CareschkszEQ | ||||||
|  | #undef CareschkszGE | ||||||
|  |  | ||||||
|  | /* | ||||||
|  |  * Get rid of macros not intended to exist beyond this point. | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | #undef CARES_PULL_WS2TCPIP_H | ||||||
|  | #undef CARES_PULL_SYS_TYPES_H | ||||||
|  | #undef CARES_PULL_SYS_SOCKET_H | ||||||
|  |  | ||||||
|  | #undef CARES_TYPEOF_ARES_SOCKLEN_T | ||||||
|  |  | ||||||
|  | #endif /* __CARES_RULES_H */ | ||||||
| @@ -15,7 +15,7 @@ | |||||||
|  * without express or implied warranty. |  * without express or implied warranty. | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "setup.h" | #include "ares_setup.h" | ||||||
|  |  | ||||||
| #include <stdio.h> | #include <stdio.h> | ||||||
| #include <stdlib.h> | #include <stdlib.h> | ||||||
| @@ -238,7 +238,8 @@ static int single_domain(ares_channel channel, const char *name, char **s) | |||||||
|   const char *hostaliases; |   const char *hostaliases; | ||||||
|   FILE *fp; |   FILE *fp; | ||||||
|   char *line = NULL; |   char *line = NULL; | ||||||
|   int linesize, status; |   int status; | ||||||
|  |   size_t linesize; | ||||||
|   const char *p, *q; |   const char *p, *q; | ||||||
|   int error; |   int error; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -15,7 +15,7 @@ | |||||||
|  * without express or implied warranty. |  * without express or implied warranty. | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "setup.h" | #include "ares_setup.h" | ||||||
|  |  | ||||||
| #ifdef HAVE_SYS_SOCKET_H | #ifdef HAVE_SYS_SOCKET_H | ||||||
| #  include <sys/socket.h> | #  include <sys/socket.h> | ||||||
|   | |||||||
| @@ -1,9 +1,9 @@ | |||||||
| #ifndef __ARES_SETUP_H | #ifndef HEADER_CARES_SETUP_H | ||||||
| #define __ARES_SETUP_H | #define HEADER_CARES_SETUP_H | ||||||
| 
 | 
 | ||||||
| /* $Id$ */ | /* $Id$ */ | ||||||
| 
 | 
 | ||||||
| /* Copyright (C) 2004 - 2008 by Daniel Stenberg et al
 | /* Copyright (C) 2004 - 2009 by Daniel Stenberg et al
 | ||||||
|  * |  * | ||||||
|  * Permission to use, copy, modify, and distribute this software and its |  * Permission to use, copy, modify, and distribute this software and its | ||||||
|  * documentation for any purpose and without fee is hereby granted, provided |  * documentation for any purpose and without fee is hereby granted, provided | ||||||
| @@ -30,7 +30,7 @@ | |||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| #ifdef HAVE_CONFIG_H | #ifdef HAVE_CONFIG_H | ||||||
| #include "config.h" | #include "ares_config.h" | ||||||
| #else | #else | ||||||
| 
 | 
 | ||||||
| #ifdef WIN32 | #ifdef WIN32 | ||||||
| @@ -39,6 +39,15 @@ | |||||||
| 
 | 
 | ||||||
| #endif /* HAVE_CONFIG_H */ | #endif /* HAVE_CONFIG_H */ | ||||||
| 
 | 
 | ||||||
|  | /* ================================================================ */ | ||||||
|  | /* Definition of preprocessor macros/symbols which modify compiler  */ | ||||||
|  | /* behaviour or generated code characteristics must be done here,   */ | ||||||
|  | /* as appropriate, before any system header file is included. It is */ | ||||||
|  | /* also possible to have them defined in the config file included   */ | ||||||
|  | /* before this point. As a result of all this we frown inclusion of */ | ||||||
|  | /* system header files in our config files, avoid this at any cost. */ | ||||||
|  | /* ================================================================ */ | ||||||
|  | 
 | ||||||
| /*
 | /*
 | ||||||
|  * Tru64 needs _REENTRANT set for a few function prototypes and |  * Tru64 needs _REENTRANT set for a few function prototypes and | ||||||
|  * things to appear in the system header files. Unixware needs it |  * things to appear in the system header files. Unixware needs it | ||||||
| @@ -51,11 +60,34 @@ | |||||||
| #  endif | #  endif | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  | /* ================================================================ */ | ||||||
|  | /*  If you need to include a system header file for your platform,  */ | ||||||
|  | /*  please, do it beyond the point further indicated in this file.  */ | ||||||
|  | /* ================================================================ */ | ||||||
|  | 
 | ||||||
|  | /*
 | ||||||
|  |  * c-ares external interface definitions are also used internally, | ||||||
|  |  * and might also include required system header files to define them. | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | #include <ares_build.h> | ||||||
|  | 
 | ||||||
|  | /*
 | ||||||
|  |  * Compile time sanity checks must also be done when building the library. | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | #include <ares_rules.h> | ||||||
|  | 
 | ||||||
|  | /* ================================================================= */ | ||||||
|  | /* No system header file shall be included in this file before this  */ | ||||||
|  | /* point. The only allowed ones are those included from ares_build.h */ | ||||||
|  | /* ================================================================= */ | ||||||
|  | 
 | ||||||
| /*
 | /*
 | ||||||
|  * Include header files for windows builds before redefining anything. |  * Include header files for windows builds before redefining anything. | ||||||
|  * Use this preproessor block only to include or exclude windows.h, |  * Use this preproessor block only to include or exclude windows.h, | ||||||
|  * winsock2.h, ws2tcpip.h or winsock.h. Any other windows thing belongs |  * winsock2.h, ws2tcpip.h or winsock.h. Any other windows thing belongs | ||||||
|  * to any other further and independant block.  Under Cygwin things work |  * to any other further and independent block.  Under Cygwin things work | ||||||
|  * just as under linux (e.g. <sys/socket.h>) and the winsock headers should |  * just as under linux (e.g. <sys/socket.h>) and the winsock headers should | ||||||
|  * never be included when __CYGWIN__ is defined.  configure script takes |  * never be included when __CYGWIN__ is defined.  configure script takes | ||||||
|  * care of this, not defining HAVE_WINDOWS_H, HAVE_WINSOCK_H, HAVE_WINSOCK2_H, |  * care of this, not defining HAVE_WINDOWS_H, HAVE_WINSOCK_H, HAVE_WINSOCK2_H, | ||||||
| @@ -101,12 +133,6 @@ | |||||||
| 
 | 
 | ||||||
| #ifndef HAVE_CONFIG_H | #ifndef HAVE_CONFIG_H | ||||||
| 
 | 
 | ||||||
| #if defined(__DJGPP__) || (defined(__WATCOMC__) && (__WATCOMC__ >= 1240)) || \ |  | ||||||
|     defined(__POCC__) |  | ||||||
| #else |  | ||||||
| #define ssize_t int |  | ||||||
| #endif |  | ||||||
| 
 |  | ||||||
| #if !defined(HAVE_SYS_TIME_H) && !defined(_MSC_VER) && !defined(__WATCOMC__) | #if !defined(HAVE_SYS_TIME_H) && !defined(_MSC_VER) && !defined(__WATCOMC__) | ||||||
| #define HAVE_SYS_TIME_H | #define HAVE_SYS_TIME_H | ||||||
| #endif | #endif | ||||||
| @@ -121,8 +147,14 @@ | |||||||
| 
 | 
 | ||||||
| #endif /* HAVE_CONFIG_H */ | #endif /* HAVE_CONFIG_H */ | ||||||
| 
 | 
 | ||||||
|  | #ifdef __POCC__ | ||||||
|  | #  include <sys/types.h> | ||||||
|  | #  include <unistd.h> | ||||||
|  | #  define ESRCH 3 | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
| /*
 | /*
 | ||||||
|  * Recent autoconf versions define these symbols in config.h. We don't |  * Recent autoconf versions define these symbols in ares_config.h. We don't | ||||||
|  * want them (since they collide with the libcurl ones when we build |  * want them (since they collide with the libcurl ones when we build | ||||||
|  *  --enable-debug) so we undef them again here. |  *  --enable-debug) so we undef them again here. | ||||||
|  */ |  */ | ||||||
| @@ -152,4 +184,4 @@ | |||||||
| #include "setup_once.h" | #include "setup_once.h" | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| #endif /* __ARES_SETUP_H */ | #endif /* HEADER_CARES_SETUP_H */ | ||||||
| @@ -16,7 +16,7 @@ | |||||||
|  * without express or implied warranty. |  * without express or implied warranty. | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "setup.h" | #include "ares_setup.h" | ||||||
| #include "ares_strcasecmp.h" | #include "ares_strcasecmp.h" | ||||||
|  |  | ||||||
| #ifndef HAVE_STRCASECMP | #ifndef HAVE_STRCASECMP | ||||||
|   | |||||||
| @@ -18,7 +18,7 @@ | |||||||
|  * without express or implied warranty. |  * without express or implied warranty. | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "setup.h" | #include "ares_setup.h" | ||||||
|  |  | ||||||
| #ifndef HAVE_STRCASECMP | #ifndef HAVE_STRCASECMP | ||||||
| extern int ares_strcasecmp(const char *a, const char *b); | extern int ares_strcasecmp(const char *a, const char *b); | ||||||
|   | |||||||
| @@ -16,7 +16,7 @@ | |||||||
|  * without express or implied warranty. |  * without express or implied warranty. | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "setup.h" | #include "ares_setup.h" | ||||||
| #include "ares_strdup.h" | #include "ares_strdup.h" | ||||||
|  |  | ||||||
| #ifndef HAVE_STRDUP | #ifndef HAVE_STRDUP | ||||||
|   | |||||||
| @@ -18,7 +18,7 @@ | |||||||
|  * without express or implied warranty. |  * without express or implied warranty. | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "setup.h" | #include "ares_setup.h" | ||||||
|  |  | ||||||
| #ifndef HAVE_STRDUP | #ifndef HAVE_STRDUP | ||||||
| extern char *ares_strdup(const char *s1); | extern char *ares_strdup(const char *s1); | ||||||
|   | |||||||
| @@ -15,7 +15,7 @@ | |||||||
|  * without express or implied warranty. |  * without express or implied warranty. | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "setup.h" | #include "ares_setup.h" | ||||||
| #include <assert.h> | #include <assert.h> | ||||||
| #include "ares.h" | #include "ares.h" | ||||||
|  |  | ||||||
| @@ -43,7 +43,11 @@ const char *ares_strerror(int code) | |||||||
|     "Misformatted string", |     "Misformatted string", | ||||||
|     "Illegal flags specified", |     "Illegal flags specified", | ||||||
|     "Given hostname is not numeric", |     "Given hostname is not numeric", | ||||||
|     "Illegal hints flags specified" |     "Illegal hints flags specified", | ||||||
|  |     "c-ares library initialization not yet performed", | ||||||
|  |     "Error loading iphlpapi.dll", | ||||||
|  |     "Could not find GetNetworkParams function", | ||||||
|  |     "DNS query cancelled" | ||||||
|   }; |   }; | ||||||
|  |  | ||||||
|   if(code >= 0 && code < (int)(sizeof(errtext) / sizeof(*errtext))) |   if(code >= 0 && code < (int)(sizeof(errtext) / sizeof(*errtext))) | ||||||
|   | |||||||
| @@ -15,7 +15,7 @@ | |||||||
|  * without express or implied warranty. |  * without express or implied warranty. | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "setup.h" | #include "ares_setup.h" | ||||||
|  |  | ||||||
| #ifdef HAVE_SYS_TIME_H | #ifdef HAVE_SYS_TIME_H | ||||||
| #include <sys/time.h> | #include <sys/time.h> | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| /* $Id$ */ | /* $Id$ */ | ||||||
|  |  | ||||||
| #include "setup.h" | #include "ares_setup.h" | ||||||
| #include "ares_version.h" | #include "ares.h" | ||||||
|  |  | ||||||
| const char *ares_version(int *version) | const char *ares_version(int *version) | ||||||
| { | { | ||||||
|   | |||||||
| @@ -11,15 +11,12 @@ | |||||||
|                        (ARES_VERSION_PATCH)) |                        (ARES_VERSION_PATCH)) | ||||||
| #define ARES_VERSION_STR "1.6.1-CVS" | #define ARES_VERSION_STR "1.6.1-CVS" | ||||||
|  |  | ||||||
| #ifdef  __cplusplus | #if (ARES_VERSION >= 0x010601) | ||||||
| extern "C" { | #  define CARES_HAVE_ARES_LIBRARY_INIT 1 | ||||||
| #endif | #  define CARES_HAVE_ARES_LIBRARY_CLEANUP 1 | ||||||
|  | #else | ||||||
| const char *ares_version(int *version); | #  undef CARES_HAVE_ARES_LIBRARY_INIT | ||||||
|  | #  undef CARES_HAVE_ARES_LIBRARY_CLEANUP | ||||||
| #ifdef  __cplusplus |  | ||||||
| } |  | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|   | |||||||
| @@ -16,9 +16,12 @@ | |||||||
|  * without express or implied warranty. |  * without express or implied warranty. | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "setup.h" | #include "ares_setup.h" | ||||||
|  |  | ||||||
|  | #ifdef HAVE_LIMITS_H | ||||||
|  | #  include <limits.h> | ||||||
|  | #endif | ||||||
|  |  | ||||||
| #include <limits.h> |  | ||||||
| #include "ares.h" | #include "ares.h" | ||||||
| #include "ares_private.h" | #include "ares_private.h" | ||||||
|  |  | ||||||
|   | |||||||
| @@ -18,7 +18,7 @@ | |||||||
|  * without express or implied warranty. |  * without express or implied warranty. | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
| #include "setup.h" | #include "ares_setup.h" | ||||||
| #include "ares.h" | #include "ares.h" | ||||||
|  |  | ||||||
| #ifndef HAVE_WRITEV | #ifndef HAVE_WRITEV | ||||||
|   | |||||||
| @@ -19,7 +19,7 @@ | |||||||
|  |  | ||||||
| #ifndef HAVE_BITNCMP | #ifndef HAVE_BITNCMP | ||||||
|  |  | ||||||
| #include "setup.h" | #include "ares_setup.h" | ||||||
| #include "bitncmp.h" | #include "bitncmp.h" | ||||||
|  |  | ||||||
| /* | /* | ||||||
| @@ -41,7 +41,7 @@ ares_bitncmp(const void *l, const void *r, int n) { | |||||||
|  |  | ||||||
| 	b = n / 8; | 	b = n / 8; | ||||||
| 	x = memcmp(l, r, b); | 	x = memcmp(l, r, b); | ||||||
| 	if (x) | 	if (x || (n % 8) == 0) | ||||||
| 		return (x); | 		return (x); | ||||||
|  |  | ||||||
| 	lb = ((const unsigned char *)l)[b]; | 	lb = ((const unsigned char *)l)[b]; | ||||||
|   | |||||||
| @@ -42,4 +42,4 @@ ${libtoolize} --copy --automake --force | |||||||
| ${ACLOCAL:-aclocal} -I m4 $ACLOCAL_FLAGS | ${ACLOCAL:-aclocal} -I m4 $ACLOCAL_FLAGS | ||||||
| ${AUTOHEADER:-autoheader} | ${AUTOHEADER:-autoheader} | ||||||
| ${AUTOCONF:-autoconf} | ${AUTOCONF:-autoconf} | ||||||
| ${AUTOMAKE:-automake} --add-missing | ${AUTOMAKE:-automake} --add-missing --copy | ||||||
|   | |||||||
							
								
								
									
										21
									
								
								ares/buildconf.bat
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								ares/buildconf.bat
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,21 @@ | |||||||
|  | @echo off | ||||||
|  | REM | ||||||
|  | REM $Id$ | ||||||
|  | REM | ||||||
|  | REM This batch file must be used to set up a CVS tree to build on | ||||||
|  | REM systems where there is no autotools support (i.e. Microsoft). | ||||||
|  | REM | ||||||
|  | REM This file is not included nor needed for c-ares' release | ||||||
|  | REM archives, neither for c-ares' daily snapshot archives. | ||||||
|  |  | ||||||
|  | if exist CVS-INFO goto start_doing | ||||||
|  | ECHO ERROR: This file shall only be used with a c-ares CVS tree checkout. | ||||||
|  | goto end_all | ||||||
|  | :start_doing | ||||||
|  |  | ||||||
|  | if not exist ares_build.h.dist goto end_ares_build_h | ||||||
|  | copy /Y ares_build.h.dist ares_build.h | ||||||
|  | :end_ares_build_h | ||||||
|  |  | ||||||
|  | :end_all | ||||||
|  |  | ||||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user