Compare commits
1403 Commits
curl-7_19_
...
curl-7_21_
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8249b0522d | ||
|
|
a43201e578 | ||
|
|
3c2ee9c341 | ||
|
|
8d31d70114 | ||
|
|
9754b20adb | ||
|
|
17c1e3bcba | ||
|
|
6cf90c6a7b | ||
|
|
67d76dd520 | ||
|
|
8348dd96dd | ||
|
|
2596eb6d19 | ||
|
|
625932d398 | ||
|
|
37201e3c36 | ||
|
|
06869597c3 | ||
|
|
517f3a1b8f | ||
|
|
495d3e07d4 | ||
|
|
44e5e37f38 | ||
|
|
1d594772fd | ||
|
|
ff26895b5c | ||
|
|
d7134036b2 | ||
|
|
7115245f88 | ||
|
|
dc2157a087 | ||
|
|
5d5dd08e77 | ||
|
|
cfbdbf9783 | ||
|
|
b24e872502 | ||
|
|
50a1d5ee1c | ||
|
|
6ccbd1bee4 | ||
|
|
1267719735 | ||
|
|
c49e9683b8 | ||
|
|
6ea043a504 | ||
|
|
af4eae77ac | ||
|
|
7d342c723c | ||
|
|
5c2b6b2d3e | ||
|
|
11958ed331 | ||
|
|
15201da4ca | ||
|
|
59bad26bb2 | ||
|
|
f91d578674 | ||
|
|
9df8257301 | ||
|
|
992ceae386 | ||
|
|
364fd2f1ad | ||
|
|
1cbe66fbc8 | ||
|
|
f8cf037ecf | ||
|
|
6028fdb305 | ||
|
|
45456135d5 | ||
|
|
52beeb2c9f | ||
|
|
544f15af98 | ||
|
|
000ac0c975 | ||
|
|
fc308282ac | ||
|
|
e9f3513264 | ||
|
|
a1a5ba3d0a | ||
|
|
687df5c8c3 | ||
|
|
40253e32fe | ||
|
|
f97a7eb400 | ||
|
|
3cf658fc24 | ||
|
|
5247266df6 | ||
|
|
dfa6ee890d | ||
|
|
bd5df39a29 | ||
|
|
6f3dc2a726 | ||
|
|
b01fb30f9c | ||
|
|
f38e52071e | ||
|
|
811fcccfc9 | ||
|
|
b552ca223e | ||
|
|
a93522f68d | ||
|
|
425060fed1 | ||
|
|
fbee86a9e2 | ||
|
|
2f0c118577 | ||
|
|
53e47ca947 | ||
|
|
314117cbf1 | ||
|
|
d296dd4ee8 | ||
|
|
04eff9beb9 | ||
|
|
b5c3feda17 | ||
|
|
01c309e186 | ||
|
|
d873c820bd | ||
|
|
41cf1f4090 | ||
|
|
6ad0acb608 | ||
|
|
cfbb351e22 | ||
|
|
11f53b9a18 | ||
|
|
eb33f5d1f8 | ||
|
|
cef30e0924 | ||
|
|
a13128596c | ||
|
|
6d2ccfed48 | ||
|
|
7738b15977 | ||
|
|
0fa4b41c2b | ||
|
|
7d166b0ef6 | ||
|
|
affff47b3d | ||
|
|
d6981cb508 | ||
|
|
40ecd6c9b8 | ||
|
|
181b08babb | ||
|
|
7abf3b97fe | ||
|
|
4a1384a8b4 | ||
|
|
d76874a665 | ||
|
|
c8d42b2f1c | ||
|
|
84332b60b9 | ||
|
|
bc0699f226 | ||
|
|
157e6d4e7e | ||
|
|
d4e6404135 | ||
|
|
3992309285 | ||
|
|
241b704e1f | ||
|
|
1dbb9a0ba4 | ||
|
|
e7743aa7b4 | ||
|
|
915032ea02 | ||
|
|
e01cc7737c | ||
|
|
bd36927f18 | ||
|
|
0417d34533 | ||
|
|
a57611e308 | ||
|
|
12533bb184 | ||
|
|
9be951a415 | ||
|
|
7239538d9a | ||
|
|
18a9ee6bdf | ||
|
|
f3b77e5611 | ||
|
|
89924a897d | ||
|
|
bcefe839c7 | ||
|
|
458dd4550b | ||
|
|
f7ae7b3623 | ||
|
|
31dd8ab1d6 | ||
|
|
8da56e12c6 | ||
|
|
0a04078916 | ||
|
|
1182c8bdcd | ||
|
|
55d2460fc3 | ||
|
|
a89d7997b7 | ||
|
|
d8383220ec | ||
|
|
8e7ec794f5 | ||
|
|
bd5d478dd4 | ||
|
|
1b15b31c86 | ||
|
|
e6d85923c1 | ||
|
|
614bae813e | ||
|
|
bd6a695545 | ||
|
|
d63bdba097 | ||
|
|
43edcc4a2e | ||
|
|
01c2b397aa | ||
|
|
51a757c11b | ||
|
|
7a99672042 | ||
|
|
7eecfb536a | ||
|
|
a09814138a | ||
|
|
42432d67cc | ||
|
|
e91d167ff8 | ||
|
|
88af6fbf98 | ||
|
|
6b6fe2a4d5 | ||
|
|
54aca3c5ec | ||
|
|
0a9cf4365a | ||
|
|
343c4c7072 | ||
|
|
6a0d3233ff | ||
|
|
d3714b016d | ||
|
|
da6e992e1d | ||
|
|
bb60fe0c1a | ||
|
|
feecf63a96 | ||
|
|
cbdd1cbcde | ||
|
|
b3d7161642 | ||
|
|
3b47d231ac | ||
|
|
7977bc3dfa | ||
|
|
00fdafb0a1 | ||
|
|
f737e94164 | ||
|
|
a0dd9df9ab | ||
|
|
4724b9d966 | ||
|
|
8098d9417c | ||
|
|
605207a3a6 | ||
|
|
43d20d81a5 | ||
|
|
bc0f3dd15e | ||
|
|
475c19c42b | ||
|
|
c072bd4609 | ||
|
|
684830cb2a | ||
|
|
51248a9bdd | ||
|
|
3b24076c3b | ||
|
|
077125e4a2 | ||
|
|
df06182d86 | ||
|
|
d939e0f410 | ||
|
|
69d07feb14 | ||
|
|
1c4538610b | ||
|
|
2c72732ebf | ||
|
|
e1c2c9be1a | ||
|
|
89da532445 | ||
|
|
b38189c7b4 | ||
|
|
1bb04927f3 | ||
|
|
3fd01be648 | ||
|
|
5ae6db321f | ||
|
|
0546d448ce | ||
|
|
b4fa27ae4b | ||
|
|
12043e3c9c | ||
|
|
a324fa7b97 | ||
|
|
a9483b1f4a | ||
|
|
40f8aaedb7 | ||
|
|
374f48675b | ||
|
|
20ae9d4f71 | ||
|
|
35955179c6 | ||
|
|
b1c1b9bb76 | ||
|
|
123f80ae54 | ||
|
|
c54ab4dca7 | ||
|
|
233ec511db | ||
|
|
4b96e5c70f | ||
|
|
75743b009b | ||
|
|
01459828ef | ||
|
|
99179da4cc | ||
|
|
645bdd837a | ||
|
|
c03cbb38ad | ||
|
|
63661d8e83 | ||
|
|
4a0493f789 | ||
|
|
eadeb5bd9a | ||
|
|
9190e2876e | ||
|
|
b4f0e1291f | ||
|
|
dd8568739c | ||
|
|
97b497a75f | ||
|
|
d3c813e726 | ||
|
|
9e480973eb | ||
|
|
2e056353b0 | ||
|
|
606b933a4f | ||
|
|
d17709da31 | ||
|
|
0bb6deda72 | ||
|
|
0a29e2445c | ||
|
|
700335103e | ||
|
|
368fd5d27b | ||
|
|
81239edb89 | ||
|
|
22f3b01478 | ||
|
|
5f53c9d94a | ||
|
|
04cfef24a1 | ||
|
|
1d26151d5f | ||
|
|
aabd27d9aa | ||
|
|
dcc061543a | ||
|
|
2ffe834bff | ||
|
|
027ceb37a1 | ||
|
|
510836f80b | ||
|
|
e4af5d6efc | ||
|
|
43b816538f | ||
|
|
77cfeadfa6 | ||
|
|
ea521cf617 | ||
|
|
a82c5a39c4 | ||
|
|
7764795c06 | ||
|
|
d6706294e0 | ||
|
|
83305cbf9f | ||
|
|
76255cfdc9 | ||
|
|
ad6bc4d82e | ||
|
|
147609ca6e | ||
|
|
7871fbad4d | ||
|
|
46b9719bbb | ||
|
|
a1a98d5908 | ||
|
|
a799162bc7 | ||
|
|
d62ce21249 | ||
|
|
0825cd80a6 | ||
|
|
04cb15ae9d | ||
|
|
bc8fc9803f | ||
|
|
016ce4b1da | ||
|
|
3e759f4fb6 | ||
|
|
2e8b21833a | ||
|
|
54b0e87796 | ||
|
|
a784ed6065 | ||
|
|
d2621445f1 | ||
|
|
adaf87530d | ||
|
|
8914857092 | ||
|
|
aca0fff4e1 | ||
|
|
d64bd82bdc | ||
|
|
cb6647ce1c | ||
|
|
51427e1947 | ||
|
|
1de6b97a76 | ||
|
|
f09340de8b | ||
|
|
82b55efdba | ||
|
|
16f575ee6c | ||
|
|
38d2afcefb | ||
|
|
7f616eb513 | ||
|
|
fe818c8076 | ||
|
|
a7b9452a6b | ||
|
|
2c1b0624ac | ||
|
|
107146676e | ||
|
|
79dc74e84d | ||
|
|
6be508dcc2 | ||
|
|
82e9b78a38 | ||
|
|
07f45946b5 | ||
|
|
7fb7f24131 | ||
|
|
5b40c11c2f | ||
|
|
9d6a394c44 | ||
|
|
d7b82baf97 | ||
|
|
36e245658b | ||
|
|
d487ade72c | ||
|
|
71be565cf4 | ||
|
|
81512cc02b | ||
|
|
32236dad5e | ||
|
|
b30ce34d84 | ||
|
|
2164b6b463 | ||
|
|
7af5e3c39e | ||
|
|
42930155ab | ||
|
|
e5b3246d0a | ||
|
|
47dda4a1d4 | ||
|
|
a5b7e3205d | ||
|
|
dfce37da23 | ||
|
|
14bfcb96f5 | ||
|
|
87fbcb4494 | ||
|
|
4bfe07640c | ||
|
|
5d93525f30 | ||
|
|
b7848e4a72 | ||
|
|
99ec359b4d | ||
|
|
dfad8a6dad | ||
|
|
d841ab82b8 | ||
|
|
d6be52d80e | ||
|
|
c0111460b0 | ||
|
|
93981bb9b5 | ||
|
|
8f136288c5 | ||
|
|
9799dbebd6 | ||
|
|
b025ac16a6 | ||
|
|
5d43c75c66 | ||
|
|
15fa5dcfe6 | ||
|
|
516dfd1705 | ||
|
|
743bd81e64 | ||
|
|
520cee3fb7 | ||
|
|
fa7341143a | ||
|
|
313a5b05c2 | ||
|
|
01fc53e027 | ||
|
|
0a4ccce054 | ||
|
|
c2888604d7 | ||
|
|
6632d957e7 | ||
|
|
c5e539c312 | ||
|
|
0338994c6a | ||
|
|
2056ca9fea | ||
|
|
cca192e58f | ||
|
|
f3d4b17a9c | ||
|
|
5bd38b70dd | ||
|
|
44f1bef668 | ||
|
|
f38510f4b5 | ||
|
|
689b6929c3 | ||
|
|
68aae7f579 | ||
|
|
a76fa17681 | ||
|
|
72411118ec | ||
|
|
5a16df5e04 | ||
|
|
5a814f6f2c | ||
|
|
81219e8030 | ||
|
|
92b387f57a | ||
|
|
6432fafa1a | ||
|
|
9c7a9f8329 | ||
|
|
6ab2cae55e | ||
|
|
a8f85e778f | ||
|
|
f6b7471f40 | ||
|
|
32edba1999 | ||
|
|
5ccd7c1807 | ||
|
|
4f9b47de8c | ||
|
|
f9db721c1c | ||
|
|
cf9145973b | ||
|
|
d18fb4a129 | ||
|
|
26e3c74ab7 | ||
|
|
753b2a0086 | ||
|
|
7427acc472 | ||
|
|
02892e4fd8 | ||
|
|
10977f57de | ||
|
|
ef1ac363ee | ||
|
|
e6858e267b | ||
|
|
ff8711135e | ||
|
|
7425db3fab | ||
|
|
64ac64e783 | ||
|
|
e7e37a246a | ||
|
|
78b284014b | ||
|
|
9c049e109b | ||
|
|
49f3160d69 | ||
|
|
e78e584035 | ||
|
|
a681d46c1b | ||
|
|
1d265692b7 | ||
|
|
7b913444ec | ||
|
|
909fdc07bf | ||
|
|
8c6793d79a | ||
|
|
643ae2ca8b | ||
|
|
d1837ad90a | ||
|
|
fd10ed56d5 | ||
|
|
7e22d6332b | ||
|
|
3ec7543007 | ||
|
|
604a2bdac8 | ||
|
|
69ccc9f861 | ||
|
|
302507d5dc | ||
|
|
7784e3309d | ||
|
|
0eda142e90 | ||
|
|
e2bd52e553 | ||
|
|
d4fbf2c3f0 | ||
|
|
2b0c2ac49c | ||
|
|
7de44e0a42 | ||
|
|
05de2cf180 | ||
|
|
93e6b1cb7c | ||
|
|
5e1859014b | ||
|
|
e1c38791b7 | ||
|
|
ac8b2ef563 | ||
|
|
efcf372d86 | ||
|
|
675330b8df | ||
|
|
a1a66c7cd6 | ||
|
|
bed30bc6df | ||
|
|
d610519246 | ||
|
|
4f44717590 | ||
|
|
49d309866c | ||
|
|
481c61d060 | ||
|
|
ff438c994e | ||
|
|
5709a0dca2 | ||
|
|
05632d5db9 | ||
|
|
c245a8f92e | ||
|
|
d42f9329dc | ||
|
|
c869ae7447 | ||
|
|
9828b926ae | ||
|
|
8aa68b4cad | ||
|
|
1ac168e576 | ||
|
|
50b51161c9 | ||
|
|
661888c303 | ||
|
|
be28825b2d | ||
|
|
2309b4e330 | ||
|
|
dd0c31ce38 | ||
|
|
123c6d5c82 | ||
|
|
3f96b7827b | ||
|
|
4259d2df7d | ||
|
|
4b351d018e | ||
|
|
e32fe30d0c | ||
|
|
f5857a59bb | ||
|
|
7fd32ce73d | ||
|
|
2a94293efd | ||
|
|
b33ddd615a | ||
|
|
d4cd5411a6 | ||
|
|
6657f12fff | ||
|
|
3cd5b1cfb0 | ||
|
|
6572514ae5 | ||
|
|
abcea311e3 | ||
|
|
c8bfb9e58a | ||
|
|
9599837e63 | ||
|
|
1609685fc2 | ||
|
|
e1d6034977 | ||
|
|
3d3900f032 | ||
|
|
ad76d58e7f | ||
|
|
930742776a | ||
|
|
b40acd8009 | ||
|
|
19ca0c0fbe | ||
|
|
6728334edb | ||
|
|
749fd2f9e9 | ||
|
|
d9291eb4b8 | ||
|
|
8d6e8e00e1 | ||
|
|
12bb308cab | ||
|
|
733f794cb8 | ||
|
|
52cd332b95 | ||
|
|
3709ffc700 | ||
|
|
e37d1b1ee3 | ||
|
|
c7e647b88a | ||
|
|
5bb8bbed1e | ||
|
|
a09be6410f | ||
|
|
e262aaae2b | ||
|
|
a0c3edcc37 | ||
|
|
a24a67bd1e | ||
|
|
3036abb90c | ||
|
|
2e9eb1a2ac | ||
|
|
f5d8c0befc | ||
|
|
21f331ead2 | ||
|
|
f933747088 | ||
|
|
ce54bd113b | ||
|
|
f4551a9678 | ||
|
|
52f088ec1b | ||
|
|
a0fba2f66b | ||
|
|
013d5a72d4 | ||
|
|
9b2cce236f | ||
|
|
cd465e4ada | ||
|
|
6bf071df7e | ||
|
|
7c028a8332 | ||
|
|
13ac29382f | ||
|
|
8719398d05 | ||
|
|
53aa6b21fe | ||
|
|
7842704ee7 | ||
|
|
496002ea1c | ||
|
|
1a1ffb10d0 | ||
|
|
2a056ba49e | ||
|
|
eef316f099 | ||
|
|
03a57308b9 | ||
|
|
507d58435a | ||
|
|
dc21a5e5a1 | ||
|
|
cef95aadeb | ||
|
|
697496ff99 | ||
|
|
bcd1c7c2e9 | ||
|
|
87428e07ca | ||
|
|
01fb0d8497 | ||
|
|
cce81a7f45 | ||
|
|
4ad984043e | ||
|
|
6a8aa246ff | ||
|
|
e25c5283d8 | ||
|
|
5695c4db86 | ||
|
|
aa0f8593b9 | ||
|
|
4186b5b41f | ||
|
|
8904064c3a | ||
|
|
5b778a7ca4 | ||
|
|
439f62bfa8 | ||
|
|
693abbae3a | ||
|
|
e1625ba727 | ||
|
|
338553eda3 | ||
|
|
2abcd132f8 | ||
|
|
dc9f0a9758 | ||
|
|
10affed097 | ||
|
|
25a49ccd21 | ||
|
|
9ac65581bb | ||
|
|
a4a60afabb | ||
|
|
a434cb43e8 | ||
|
|
846b926a3f | ||
|
|
f0d3930346 | ||
|
|
a6fb6b70c7 | ||
|
|
2179ef9fa9 | ||
|
|
048438345a | ||
|
|
6e461e45c3 | ||
|
|
19e089702a | ||
|
|
23bab783d4 | ||
|
|
46b112bcd4 | ||
|
|
f442dd6496 | ||
|
|
bb2d9c3704 | ||
|
|
d5b2d8e081 | ||
|
|
4b43d18c4a | ||
|
|
2596fe0cb7 | ||
|
|
f1106049d9 | ||
|
|
a07bc79117 | ||
|
|
2268657272 | ||
|
|
68d83a8142 | ||
|
|
b4ff6d3007 | ||
|
|
68b73bcfba | ||
|
|
ac04add596 | ||
|
|
c703d01a23 | ||
|
|
975814368a | ||
|
|
dc6adb54fb | ||
|
|
2138ee7628 | ||
|
|
4258e943a1 | ||
|
|
c3b87d1b4f | ||
|
|
547931366d | ||
|
|
b41d3be7fa | ||
|
|
07fc7852d7 | ||
|
|
99f366adf9 | ||
|
|
d20a2469ea | ||
|
|
1abff19a5f | ||
|
|
77066c6e47 | ||
|
|
f2f07dad34 | ||
|
|
06ae8ca5a6 | ||
|
|
d33da42334 | ||
|
|
e118cd4ca0 | ||
|
|
71593dfe57 | ||
|
|
0f4a91afde | ||
|
|
2c2464a682 | ||
|
|
880452d2ed | ||
|
|
e3009f2950 | ||
|
|
cad9c3f55f | ||
|
|
12d01bc5f7 | ||
|
|
bc7615ae2d | ||
|
|
7aef172a34 | ||
|
|
f47b84b57f | ||
|
|
1a5749424b | ||
|
|
a9a5a8e45c | ||
|
|
8044366134 | ||
|
|
15efa262bb | ||
|
|
429e544556 | ||
|
|
680434f313 | ||
|
|
c9f46446d5 | ||
|
|
b77d0db59e | ||
|
|
3205ac35b0 | ||
|
|
381a4d6efe | ||
|
|
f6d288a397 | ||
|
|
013ec6a92f | ||
|
|
e2fc294470 | ||
|
|
d1717e7c90 | ||
|
|
e569ff959f | ||
|
|
839b61c32a | ||
|
|
d28b8d3158 | ||
|
|
2dfbd0d050 | ||
|
|
54879d7763 | ||
|
|
49ba75af26 | ||
|
|
232d17ec64 | ||
|
|
bafba6946c | ||
|
|
da23b16ad8 | ||
|
|
46de140aca | ||
|
|
17a2c32ca9 | ||
|
|
9f6c4daa27 | ||
|
|
ea72194650 | ||
|
|
35e220606d | ||
|
|
55f1e787f3 | ||
|
|
516cf5c8dd | ||
|
|
35fbeda003 | ||
|
|
715e3a806f | ||
|
|
6ebd71d186 | ||
|
|
4ee4e66c4f | ||
|
|
4d19ebe738 | ||
|
|
5312fdcd73 | ||
|
|
fce02e1cab | ||
|
|
15ddc1f134 | ||
|
|
d65cf7889b | ||
|
|
ddab9bd2ec | ||
|
|
eff18763a1 | ||
|
|
3e21f1e971 | ||
|
|
ccffed997e | ||
|
|
6259bcd51f | ||
|
|
a4031dbd85 | ||
|
|
2f3bce1193 | ||
|
|
3cb76e5ebb | ||
|
|
6418c0588d | ||
|
|
124b35aafe | ||
|
|
bbefdf88fd | ||
|
|
06c96d01d2 | ||
|
|
83e91586ef | ||
|
|
c82a1f95eb | ||
|
|
d34982bb65 | ||
|
|
22ed0f5059 | ||
|
|
9bc897f380 | ||
|
|
9b0e57b0f7 | ||
|
|
1d86ebfc88 | ||
|
|
a9b860765d | ||
|
|
483ff1ca75 | ||
|
|
c054b8bfa7 | ||
|
|
340ab2f87f | ||
|
|
f8b16e5ccb | ||
|
|
4bb80cfd75 | ||
|
|
de2cc11a73 | ||
|
|
c656098ee0 | ||
|
|
94f33457d3 | ||
|
|
80675818e0 | ||
|
|
b0e2d47a3e | ||
|
|
0abd928d3d | ||
|
|
597ad5a2ce | ||
|
|
703fa98a48 | ||
|
|
ec4647c0f9 | ||
|
|
33ce0ec1f1 | ||
|
|
1435864030 | ||
|
|
4a8a731476 | ||
|
|
6636fbf238 | ||
|
|
c94d44505f | ||
|
|
0032ce762e | ||
|
|
bdb338b3c7 | ||
|
|
099eed7bf1 | ||
|
|
bc253a4d5f | ||
|
|
a771fb0d41 | ||
|
|
c047fe8e90 | ||
|
|
e45eefcb90 | ||
|
|
844c19cc5b | ||
|
|
4a8570313a | ||
|
|
e59a5cbe4e | ||
|
|
bfc4c33985 | ||
|
|
5af20c70e4 | ||
|
|
bd7430c1ee | ||
|
|
6e5acc2fc1 | ||
|
|
abe3e6b36c | ||
|
|
105e430641 | ||
|
|
4a349f7a54 | ||
|
|
2f9a17fc44 | ||
|
|
bc4582b68a | ||
|
|
e09718d457 | ||
|
|
2c0418f154 | ||
|
|
a74e885bef | ||
|
|
6291a1cf23 | ||
|
|
a872ff742c | ||
|
|
58a1557088 | ||
|
|
422a7869be | ||
|
|
471e8eefb6 | ||
|
|
d2e1ec58f2 | ||
|
|
48032c0880 | ||
|
|
877dad1e24 | ||
|
|
01030e9240 | ||
|
|
a5ca3f1754 | ||
|
|
77a17a21d1 | ||
|
|
6035a4b044 | ||
|
|
469d3ed591 | ||
|
|
3afe2b65b6 | ||
|
|
afdc3d81e9 | ||
|
|
ccfe279117 | ||
|
|
5b5ff41ef1 | ||
|
|
0a713139f6 | ||
|
|
0687bc6bd6 | ||
|
|
424a8882fb | ||
|
|
3fdced357b | ||
|
|
ce2ac665e4 | ||
|
|
0375f70b5c | ||
|
|
7f8980114b | ||
|
|
312494f25f | ||
|
|
8d97b33347 | ||
|
|
b51b703a5b | ||
|
|
071c38988d | ||
|
|
365e75a270 | ||
|
|
b992928f3d | ||
|
|
32413a8e34 | ||
|
|
ada2774ab2 | ||
|
|
a644af129e | ||
|
|
7624527591 | ||
|
|
383bf1e476 | ||
|
|
8c8df3966b | ||
|
|
4344215309 | ||
|
|
0643829444 | ||
|
|
7525670610 | ||
|
|
b32a96eda0 | ||
|
|
82f5ffff8f | ||
|
|
3fd67b5f36 | ||
|
|
1647d64a4b | ||
|
|
d17416190b | ||
|
|
2158e234aa | ||
|
|
cb348a5b1f | ||
|
|
377b2db05b | ||
|
|
78b7d7f7a8 | ||
|
|
5bec1b1cf0 | ||
|
|
cd7b12edff | ||
|
|
1103d0c718 | ||
|
|
aae97c998a | ||
|
|
017c14cc99 | ||
|
|
b90703f594 | ||
|
|
552c3de357 | ||
|
|
aa2f447400 | ||
|
|
184f92d243 | ||
|
|
a1d701d05a | ||
|
|
a114b7b1c0 | ||
|
|
8524c04ca9 | ||
|
|
31630203b1 | ||
|
|
d37a9c4f87 | ||
|
|
88944eb13a | ||
|
|
bd8096b42b | ||
|
|
1e87e4bb4e | ||
|
|
9bd03483ce | ||
|
|
2e83006603 | ||
|
|
fd903eb6be | ||
|
|
2c93ec5303 | ||
|
|
d79b5a0613 | ||
|
|
a62f32d3c2 | ||
|
|
241c0ad5bd | ||
|
|
605bbfc4c0 | ||
|
|
42d365f199 | ||
|
|
31266ca92a | ||
|
|
3f3f6be825 | ||
|
|
01682cca55 | ||
|
|
99a5a5a3e9 | ||
|
|
eb0479575a | ||
|
|
97141d08f7 | ||
|
|
99e9938617 | ||
|
|
6c6dc3f879 | ||
|
|
a1311e5a24 | ||
|
|
5e6ffe353a | ||
|
|
d7cd761047 | ||
|
|
05488d63d0 | ||
|
|
3184a91ec8 | ||
|
|
0dde9056d7 | ||
|
|
a487c80535 | ||
|
|
1e9a946e6d | ||
|
|
7cd5ffc1bf | ||
|
|
fa6631edd5 | ||
|
|
e70c0913b1 | ||
|
|
5b2a31ae41 | ||
|
|
c796f2646e | ||
|
|
d0f6bde732 | ||
|
|
1bd5784a13 | ||
|
|
1f7d9f4f7b | ||
|
|
b6ac8d62a1 | ||
|
|
4ec17a08bc | ||
|
|
aefe0299e0 | ||
|
|
b89789d82f | ||
|
|
a218235964 | ||
|
|
73ad32e125 | ||
|
|
77625f8560 | ||
|
|
1af64730e0 | ||
|
|
eacf62792f | ||
|
|
6ce407305b | ||
|
|
ae3892e8ab | ||
|
|
c74875d94e | ||
|
|
271dc9c582 | ||
|
|
7bede9180d | ||
|
|
f0917cabb5 | ||
|
|
96395a908a | ||
|
|
e9a993b9e9 | ||
|
|
982fe33924 | ||
|
|
fa188eec7b | ||
|
|
bdd3763980 | ||
|
|
1cfa52b67d | ||
|
|
57d3488a0d | ||
|
|
83d34a246e | ||
|
|
76b3c9d70f | ||
|
|
d911e22d8f | ||
|
|
efd1d9dc04 | ||
|
|
88a0060b2e | ||
|
|
4adf7d62d4 | ||
|
|
6add5baa3a | ||
|
|
2a3dafc0cd | ||
|
|
f912f8d5d2 | ||
|
|
af7a5b297f | ||
|
|
344bbcf259 | ||
|
|
240fa29e94 | ||
|
|
010fe5acd5 | ||
|
|
aeec8e0b38 | ||
|
|
2d15ac3d4e | ||
|
|
53deae3781 | ||
|
|
39cc424e81 | ||
|
|
4d0b0cae9e | ||
|
|
8343cb8910 | ||
|
|
a75d9d9169 | ||
|
|
54c60d0067 | ||
|
|
91d05903b4 | ||
|
|
10a11e3abe | ||
|
|
414180b363 | ||
|
|
7603a29fc3 | ||
|
|
002ed5f298 | ||
|
|
044ba6dad2 | ||
|
|
3802d027cd | ||
|
|
3111701c38 | ||
|
|
2c9644b812 | ||
|
|
99daca5a48 | ||
|
|
a6abbb120e | ||
|
|
b0f548fb56 | ||
|
|
364d76aca7 | ||
|
|
6e9a484ea6 | ||
|
|
303f74c740 | ||
|
|
4ea8ad584b | ||
|
|
19b8a80ee9 | ||
|
|
30eb452adf | ||
|
|
92b9b46831 | ||
|
|
83a6b34803 | ||
|
|
43fefab2a1 | ||
|
|
ec3bb8f727 | ||
|
|
463d2d395c | ||
|
|
2fc1752d6e | ||
|
|
296ebf382c | ||
|
|
b91ed67276 | ||
|
|
315253b367 | ||
|
|
3b1de97eaa | ||
|
|
5ce6454d33 | ||
|
|
0653fa107f | ||
|
|
ebe5339003 | ||
|
|
95362af43c | ||
|
|
d14bf09ab8 | ||
|
|
636d2fe00a | ||
|
|
fb2425b147 | ||
|
|
2286f566d0 | ||
|
|
ed2aa87e63 | ||
|
|
f0826974f2 | ||
|
|
d61690ef46 | ||
|
|
a72ce23f16 | ||
|
|
bfae1bd999 | ||
|
|
8a7231d7ae | ||
|
|
4d922545d5 | ||
|
|
1fc32d866a | ||
|
|
230dc699e2 | ||
|
|
3f6854272f | ||
|
|
448f6684bb | ||
|
|
af06a0e497 | ||
|
|
6e38cc9048 | ||
|
|
a240f4d1df | ||
|
|
6f273b1a5f | ||
|
|
f07f17f2a4 | ||
|
|
c713627412 | ||
|
|
b1a35cd3ac | ||
|
|
9cbf69ca0b | ||
|
|
c7d2e4c1e1 | ||
|
|
cbd527843b | ||
|
|
fba233bb34 | ||
|
|
8b49428298 | ||
|
|
19f79e5a79 | ||
|
|
e20f3ecd7e | ||
|
|
c83f7ede26 | ||
|
|
f385fdefbe | ||
|
|
88fe6557e9 | ||
|
|
405e18571e | ||
|
|
094afbeb56 | ||
|
|
1fddcb3f88 | ||
|
|
b723500af0 | ||
|
|
4bfa0b08de | ||
|
|
e536cb085f | ||
|
|
083e2df4ed | ||
|
|
b7997d8a3b | ||
|
|
c80b593e5b | ||
|
|
e37f8164a9 | ||
|
|
35d4c57051 | ||
|
|
f6114f2ec4 | ||
|
|
f9e55c9908 | ||
|
|
3005e63b02 | ||
|
|
65e628cc97 | ||
|
|
738e547815 | ||
|
|
5ec8a3ae06 | ||
|
|
fdfbc5d8da | ||
|
|
504e6d7ae6 | ||
|
|
c3266a5eb1 | ||
|
|
ced1e1e726 | ||
|
|
a41493b3b0 | ||
|
|
6da73d09f1 | ||
|
|
4c0ffd33f5 | ||
|
|
99363a0ee1 | ||
|
|
71260534f9 | ||
|
|
5e62be1d8c | ||
|
|
7e6a67b436 | ||
|
|
5a0a473c30 | ||
|
|
5129442ee7 | ||
|
|
e8fd5d8062 | ||
|
|
2f6dcaa644 | ||
|
|
59939313f8 | ||
|
|
961c504ca5 | ||
|
|
b32d1a9a1d | ||
|
|
4c8adc8fee | ||
|
|
69ac7b0cf8 | ||
|
|
09526fc9e9 | ||
|
|
f0068267ee | ||
|
|
7db7c0af4f | ||
|
|
6bf10a111f | ||
|
|
530fde3a22 | ||
|
|
5b3be2ee35 | ||
|
|
3b8d7fddf7 | ||
|
|
0e80f0e4c4 | ||
|
|
a2ddb0a61b | ||
|
|
581ce03345 | ||
|
|
f7f76e17c3 | ||
|
|
1cbc93fb54 | ||
|
|
a8ddd6ce31 | ||
|
|
eb16c0e1eb | ||
|
|
9c49e51f7e | ||
|
|
90bc6ee8f3 | ||
|
|
5e75817d44 | ||
|
|
a7e4022d6b | ||
|
|
4999847625 | ||
|
|
d26a92493a | ||
|
|
05a4abea04 | ||
|
|
c1f9440aca | ||
|
|
011a2818db | ||
|
|
571309dc3e | ||
|
|
d547d00f2c | ||
|
|
668dc0ad87 | ||
|
|
0b7e0eed49 | ||
|
|
9b7e45e874 | ||
|
|
40c2c3270d | ||
|
|
b3e8cf539d | ||
|
|
fb5f332834 | ||
|
|
107c4d878a | ||
|
|
5d786d0e97 | ||
|
|
5f77eea408 | ||
|
|
a0905ec0ab | ||
|
|
d7470a3629 | ||
|
|
2287e7ba8b | ||
|
|
16a1e251cd | ||
|
|
1aa320dedb | ||
|
|
d17ce4e9f1 | ||
|
|
50c3417686 | ||
|
|
46f294dbb0 | ||
|
|
d7231f54d7 | ||
|
|
809f2a190c | ||
|
|
4f62cdf6f9 | ||
|
|
b8012ea251 | ||
|
|
02673a8900 | ||
|
|
676e0c28e7 | ||
|
|
55e68ba333 | ||
|
|
3f56d12830 | ||
|
|
257f2376d5 | ||
|
|
1d8d389bce | ||
|
|
99e43046a7 | ||
|
|
a5460f2431 | ||
|
|
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 |
22
.cvsignore
22
.cvsignore
@@ -1,22 +0,0 @@
|
|||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
aclocal.m4
|
|
||||||
aclocal.m4.bak
|
|
||||||
autom4te.cache
|
|
||||||
compile
|
|
||||||
config.guess
|
|
||||||
config.h
|
|
||||||
config.log
|
|
||||||
config.lt
|
|
||||||
config.status
|
|
||||||
config.sub
|
|
||||||
configure
|
|
||||||
curl-config
|
|
||||||
depcomp
|
|
||||||
libcurl.pc
|
|
||||||
libtool
|
|
||||||
ltmain.sh
|
|
||||||
vc6curl.ncb
|
|
||||||
vc6curl.opt
|
|
||||||
vc6curl.sln
|
|
||||||
vc6curl.suo
|
|
||||||
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
*.dsw -crlf
|
||||||
43
.gitignore
vendored
Normal file
43
.gitignore
vendored
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
.deps
|
||||||
|
.libs
|
||||||
|
*.lib
|
||||||
|
*.pdb
|
||||||
|
*.dll
|
||||||
|
*.exe
|
||||||
|
*.obj
|
||||||
|
*.asc
|
||||||
|
.*.swp
|
||||||
|
Debug
|
||||||
|
Release
|
||||||
|
*.exp
|
||||||
|
Makefile
|
||||||
|
Makefile.in
|
||||||
|
aclocal.m4
|
||||||
|
autom4te.cache
|
||||||
|
config.guess
|
||||||
|
config.log
|
||||||
|
config.status
|
||||||
|
config.sub
|
||||||
|
configure
|
||||||
|
depcomp
|
||||||
|
libtool
|
||||||
|
ltmain.sh
|
||||||
|
compile
|
||||||
|
curl-config
|
||||||
|
libcurl.pc
|
||||||
|
missing
|
||||||
|
curl-*.tar.gz
|
||||||
|
curl-*.tar.bz2
|
||||||
|
curl-*.tar.lzma
|
||||||
|
curl-*.zip
|
||||||
|
INSTALL
|
||||||
|
install-sh
|
||||||
|
*.o
|
||||||
|
*.lo
|
||||||
|
*.la
|
||||||
|
mkinstalldirs
|
||||||
|
tags
|
||||||
|
TAGS
|
||||||
|
*~
|
||||||
|
aclocal.m4.bak
|
||||||
|
CHANGES.dist
|
||||||
106
Android.mk
Normal file
106
Android.mk
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
# 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 and 2.1
|
||||||
|
#
|
||||||
|
# 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 -W, -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. Note that the -c, -o, -MD and
|
||||||
|
# similar flags must not be set.
|
||||||
|
#
|
||||||
|
# To see all the LIBS options, you'll need to do the "showcommands" trick on an
|
||||||
|
# executable that's already buildable and watch what flags Android uses to link
|
||||||
|
# it (dhcpcd is a good choice to watch). You'll also want to add -L options to
|
||||||
|
# LIBS that point to the out/.../obj/lib/ and out/.../obj/system/lib/
|
||||||
|
# directories so that additional libraries can be found and used by curl.
|
||||||
|
#
|
||||||
|
# The end result will be a configure command that looks something like this
|
||||||
|
# (the environment variable A is set to the Android root path which makes the
|
||||||
|
# command shorter):
|
||||||
|
#
|
||||||
|
# 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="-nostdlib -fno-exceptions -Wno-multichar ..." \
|
||||||
|
# LIBS="$A/prebuilt/linux-x86/toolchain/arm-eabi-X/lib/gcc/arm-eabi/X\
|
||||||
|
# /interwork/libgcc.a ..."
|
||||||
|
#
|
||||||
|
# Finally, copy the file COPYING to NOTICE so that the curl license gets put
|
||||||
|
# into the right place (but see the note about this below).
|
||||||
|
#
|
||||||
|
# Dan Fandrich
|
||||||
|
# August 2010
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
# Copy the licence to a place where Android will find it.
|
||||||
|
# Actually, this doesn't quite work because the build system searches
|
||||||
|
# for NOTICE files before it gets to this point, so it will only be seen
|
||||||
|
# on subsequent builds.
|
||||||
|
ALL_PREBUILT += $(LOCAL_PATH)/NOTICE
|
||||||
|
$(LOCAL_PATH)/NOTICE: $(LOCAL_PATH)/COPYING | $(ACP)
|
||||||
|
$(copy-file-to-target)
|
||||||
|
|
||||||
|
include $(BUILD_STATIC_LIBRARY)
|
||||||
|
|
||||||
|
|
||||||
|
#########################
|
||||||
|
# Build the curl binary
|
||||||
|
|
||||||
|
include $(CLEAR_VARS)
|
||||||
|
include $(LOCAL_PATH)/src/Makefile.inc
|
||||||
|
LOCAL_SRC_FILES := $(addprefix src/,$(CURL_CFILES))
|
||||||
|
|
||||||
|
LOCAL_MODULE := curl
|
||||||
|
LOCAL_STATIC_LIBRARIES := libcurl
|
||||||
|
LOCAL_SYSTEM_SHARED_LIBRARIES := libc
|
||||||
|
|
||||||
|
LOCAL_C_INCLUDES += $(LOCAL_PATH)/include $(LOCAL_PATH)/lib
|
||||||
|
|
||||||
|
# This may also need to include $(CURLX_ONES) in order to correctly link
|
||||||
|
# if libcurl is changed to be built as a dynamic library
|
||||||
|
LOCAL_CFLAGS += $(common_CFLAGS)
|
||||||
|
|
||||||
|
include $(BUILD_EXECUTABLE)
|
||||||
|
|
||||||
906
CHANGES
906
CHANGES
@@ -6,906 +6,10 @@
|
|||||||
|
|
||||||
Changelog
|
Changelog
|
||||||
|
|
||||||
Version 7.19.5 (18 May 2009)
|
This file no longer holds the changelog. Now you can generate it yourself
|
||||||
|
like this:
|
||||||
|
|
||||||
Daniel Stenberg (17 May 2009)
|
$ git log --pretty=fuller --no-color --date=short --decorate=full | \
|
||||||
- James Bursa posted a patch to the mailing list that fixed a problem with
|
./log2changes.pl
|
||||||
no_proxy which made it not skip the proxy if the URL entered contained a
|
|
||||||
user name. I added test case 1101 to verify.
|
|
||||||
|
|
||||||
Daniel Stenberg (11 May 2009)
|
|
||||||
- Balint Szilakszi reported a memory leak when libcurl did gzip decompression
|
|
||||||
of streams that had some parts (legitimately) missing. We now provide and use
|
|
||||||
a proper cleanup function for the content encoding submodule.
|
|
||||||
http://curl.haxx.se/mail/lib-2009-05/0092.html
|
|
||||||
|
|
||||||
- Kamil Dudka provided a fix for libcurl-NSS reported by Michael Cronenworth
|
|
||||||
at https://bugzilla.redhat.com/show_bug.cgi?id=453612#c12
|
|
||||||
|
|
||||||
If an incorrect password is given while loading a private key, libcurl ends
|
|
||||||
up in an infinite loop consuming memory. The bug is critical.
|
|
||||||
|
|
||||||
- I fixed the problem with doing NTLM, POST and then following a 302 redirect,
|
|
||||||
as reported by Ebenezer Ikonne (on curl-users) and Laurent Rabret (on
|
|
||||||
curl-library). The transfer was mistakenly marked to get more data to send
|
|
||||||
but since it didn't actually have that, it just hung there...
|
|
||||||
|
|
||||||
Daniel Stenberg (10 May 2009)
|
|
||||||
- Andre Guibert de Bruet correctly pointed out an over-alloc with one wasted
|
|
||||||
byte in the digest code.
|
|
||||||
|
|
||||||
Yang Tse (9 May 2009)
|
|
||||||
- Removed DOS and TPF package's subdirectory Makefile.am, it was only used
|
|
||||||
to include some files in the distribution tarball serving no other purpose.
|
|
||||||
Files from the DOS and TPF subdirectories are now included in the EXTRA_DIST
|
|
||||||
of the Makefile in the parent subdirectory.
|
|
||||||
|
|
||||||
Yang Tse (8 May 2009)
|
|
||||||
- Changed host name literal in several tests to one under the haxx.se domain.
|
|
||||||
|
|
||||||
- Renamed vc6 workspace and project files to avoid filename clash when used
|
|
||||||
for conversion to later VS versions.
|
|
||||||
|
|
||||||
Daniel Stenberg (8 May 2009)
|
|
||||||
- Constantine Sapuntzakis fixed bug report #2784055
|
|
||||||
(http://curl.haxx.se/bug/view.cgi?id=2784055) identifying a problem to
|
|
||||||
connect to SOCKS proxies when using the multi interface. It turned out to
|
|
||||||
almost not work at all previously. We need to wait for the TCP connect to
|
|
||||||
be properly verified before doing the SOCKS magic.
|
|
||||||
|
|
||||||
There's still a flaw in the FTP code for this.
|
|
||||||
|
|
||||||
Daniel Stenberg (7 May 2009)
|
|
||||||
- Made the SO_SNDBUF setting for the data connection socket for ftp uploads as
|
|
||||||
well. See change 28 Apr 2009.
|
|
||||||
|
|
||||||
Yang Tse (7 May 2009)
|
|
||||||
- Fixed an issue affecting FTP transfers, introduced with the transfer.c
|
|
||||||
patch committed May 4.
|
|
||||||
|
|
||||||
Daniel Stenberg (7 May 2009)
|
|
||||||
- Man page *roff problems fixed thanks to input from Colin Watson. Problems
|
|
||||||
reported in the Debian package.
|
|
||||||
|
|
||||||
- Vijay G filed bug report #2723236
|
|
||||||
(http://curl.haxx.se/bug/view.cgi?id=2723236) identifying a problem with
|
|
||||||
libcurl's TFTP code and its lack of dealing with the OACK packet.
|
|
||||||
|
|
||||||
Yang Tse (5 May 2009)
|
|
||||||
- Fixed the --ftp-port address of test #251 to the CLIENTIP address, and
|
|
||||||
reverted the change affecting test suite harness committed 4 May.
|
|
||||||
|
|
||||||
Daniel Stenberg (5 May 2009)
|
|
||||||
- Inspired by Michael Smith's session id fix for OpenSSL, I did the
|
|
||||||
corresponding fix in the GnuTLS code: make sure to store the new session id
|
|
||||||
in case the previous re-used one is rejected.
|
|
||||||
|
|
||||||
Daniel Stenberg (4 May 2009)
|
|
||||||
- Michael Smith posted bug report #2786255
|
|
||||||
(http://curl.haxx.se/bug/view.cgi?id=2786255) with a patch, identifying how
|
|
||||||
libcurl did not deal with SSL session ids properly if the server rejected a
|
|
||||||
re-use of one. Starting now, it will forget the rejected one and remember
|
|
||||||
the new. This change was for OpenSSL only, it is likely that other SSL lib
|
|
||||||
code needs similar fixes.
|
|
||||||
|
|
||||||
Yang Tse (4 May 2009)
|
|
||||||
- Applied David McCreedy's "transfer.c fixes for CURL_DO_LINEEND_CONV and
|
|
||||||
non-ASCII platform HTTP requests" patch addressing two HTTP PUT problems:
|
|
||||||
1) On non-ASCII platforms not all of the protocol portions of the PUT are
|
|
||||||
being translated to ASCII. 2) On all platforms the line endings of part of
|
|
||||||
the protocol portions are mangled from CRLF to CRCRLF if data->set.crlf or
|
|
||||||
data->set.prefer_ascii are set (depending on CURL_DO_LINEEND_CONV).
|
|
||||||
|
|
||||||
- Applied David McCreedy's patch to fix test suite harness to allow test FTP
|
|
||||||
server and client on different machines, providing FTP client address when
|
|
||||||
running the FTP test server.
|
|
||||||
|
|
||||||
Daniel Fandrich (3 May 2009)
|
|
||||||
- Added and disabled test case 563 which shows KNOWN_BUGS #59. The bug
|
|
||||||
report failed to mention that a proxy must be used to reproduce it.
|
|
||||||
|
|
||||||
Yang Tse (2 May 2009)
|
|
||||||
- Use a build-time configured curl_socklen_t data type instead of socklen_t.
|
|
||||||
|
|
||||||
Yang Tse (1 May 2009)
|
|
||||||
- Applied David McCreedy's patches "TPF-platform specific changes to various
|
|
||||||
files" and "http.c fix to Curl_proxyCONNECT for non-ASCII platforms", the
|
|
||||||
former with minor edits.
|
|
||||||
|
|
||||||
Daniel Stenberg (30 Apr 2009)
|
|
||||||
- I was going to fix issue #59 in KNOWN_BUGS
|
|
||||||
|
|
||||||
If the CURLOPT_PORT option is used on an FTP URL like
|
|
||||||
"ftp://example.com/file;type=A" the ";type=A" is stripped off.
|
|
||||||
|
|
||||||
I added test case 562 to verify, only to find out that I couldn't repeat
|
|
||||||
this bug so I hereby consider it not a bug anymore!
|
|
||||||
|
|
||||||
Daniel Stenberg (29 Apr 2009)
|
|
||||||
- Based on bug report #2723219 (http://curl.haxx.se/bug/view.cgi?id=2723219)
|
|
||||||
I've now made TFTP "connections" not being kept for re-use within libcurl.
|
|
||||||
TFTP is UDP-based so the benefit was really low (if even existing) to begin
|
|
||||||
with so instead of tracking down to fix this problem we instead removed the
|
|
||||||
re-use. I also enabled test case 1099 that I wrote a few days ago to verify
|
|
||||||
that this change fixes the reported problem.
|
|
||||||
|
|
||||||
Daniel Stenberg (28 Apr 2009)
|
|
||||||
- Constantine Sapuntzakis filed bug report #2783090
|
|
||||||
(http://curl.haxx.se/bug/view.cgi?id=2783090) pointing out that on windows
|
|
||||||
we need to grow the SO_SNDBUF buffer somewhat to get really good upload
|
|
||||||
speeds. http://support.microsoft.com/kb/823764 has the details. Friends
|
|
||||||
confirmed that simply adding 32 to CURL_MAX_WRITE_SIZE is enough.
|
|
||||||
|
|
||||||
- Bug report #2709004 (http://curl.haxx.se/bug/view.cgi?id=2709004) by Tim
|
|
||||||
Chen pointed out how curl couldn't upload with resume when reading from a
|
|
||||||
pipe.
|
|
||||||
|
|
||||||
This ended up with the introduction of a new return code for the
|
|
||||||
CURLOPT_SEEKFUNCTION callback that basically says that the seek failed but
|
|
||||||
that libcurl may try to resolve the situation anyway. In our case this means
|
|
||||||
libcurl will attempt to instead read that much data from the stream instead
|
|
||||||
of seeking and that way curl can now upload with resume when data is read
|
|
||||||
from a stream!
|
|
||||||
|
|
||||||
Daniel Stenberg (26 Apr 2009)
|
|
||||||
- Bug report #2779733 (http://curl.haxx.se/bug/view.cgi?id=2779733) by Sven
|
|
||||||
Wegener pointed out that CURLINFO_APPCONNECT_TIME didn't work with the multi
|
|
||||||
interface and provided a patch that fixed the problem!
|
|
||||||
|
|
||||||
Daniel Stenberg (24 Apr 2009)
|
|
||||||
- Kamil Dudka fixed another NSS-related leak when client certs were used.
|
|
||||||
|
|
||||||
- Bug report #2779245 (http://curl.haxx.se/bug/view.cgi?id=2779245) by Rainer
|
|
||||||
Koenig pointed out that the man page didn't tell that the *_proxy
|
|
||||||
environment variables can be specified lower case or UPPER CASE and the
|
|
||||||
lower case takes precedence,
|
|
||||||
|
|
||||||
Daniel Fandrich (21 Apr 2009)
|
|
||||||
- Added new libcurl source files to Amiga, RiscOS and VC6 build files.
|
|
||||||
|
|
||||||
Yang Tse (21 Apr 2009)
|
|
||||||
- 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.
|
|
||||||
|
|
||||||
Renamed libcurl's memory.h to curl_memory.h
|
|
||||||
|
|
||||||
Daniel Stenberg (20 Apr 2009)
|
|
||||||
- Leanic Lefever reported a crash and did some detailed research on why and
|
|
||||||
how it occurs (http://curl.haxx.se/mail/lib-2009-04/0289.html). The
|
|
||||||
conclusion was that if an error is detected and Curl_done() is called for
|
|
||||||
the connection, ftp_done() could at times return another error code that
|
|
||||||
then would take precedence and that new code confused existing logic that
|
|
||||||
works for the first error code (CURLE_SEND_ERROR) only.
|
|
||||||
|
|
||||||
- Gisle Vanem noticed that --libtool would produce bogus strings at times for
|
|
||||||
OBJECTPOINT options. Now we've introduced a new function - my_setopt_str -
|
|
||||||
within the app for setting plain string options to avoid the risk of this
|
|
||||||
mistake happening.
|
|
||||||
|
|
||||||
Daniel Stenberg (17 Apr 2009)
|
|
||||||
- Pramod Sharma reported and tracked down a bug when doing FTP over a HTTP
|
|
||||||
proxy. libcurl would then wrongly close the connection after each
|
|
||||||
request. In his case it had the weird side-effect that it killed NTLM auth
|
|
||||||
for the proxy causing an inifinite loop!
|
|
||||||
|
|
||||||
I added test case 1098 to verify this fix. The test case does however not
|
|
||||||
properly verify that the transfers are done persistently - as I couldn't
|
|
||||||
think of a clever way to achieve it right now - but you need to read the
|
|
||||||
stderr output after a test run to see that it truly did the right thing.
|
|
||||||
|
|
||||||
Daniel Stenberg (13 Apr 2009)
|
|
||||||
- bug report #2727981 (http://curl.haxx.se/bug/view.cgi?id=2727981) by Martin
|
|
||||||
Storsj<73> pointed out how setting CURLOPT_NOBODY to 0 could be downright
|
|
||||||
confusing as it set the method to either GET or HEAD. The example he showed
|
|
||||||
looked like:
|
|
||||||
|
|
||||||
curl_easy_setopt(curl, CURLOPT_PUT, 1);
|
|
||||||
curl_easy_setopt(curl, CURLOPT_NOBODY, 0);
|
|
||||||
|
|
||||||
The new way doesn't alter the method until the request is about to start. If
|
|
||||||
CURLOPT_NOBODY is then 1 the HTTP request will be HEAD. If CURLOPT_NOBODY is
|
|
||||||
0 and the request happens to have been set to HEAD, it will then instead be
|
|
||||||
set to GET. I believe this will be less surprising to users, and hopefully
|
|
||||||
not hit any existing users badly.
|
|
||||||
|
|
||||||
- Toshio Kuratomi reported a memory leak problem with libcurl+NSS that turned
|
|
||||||
out to be leaking cacerts. Kamil Dudka helped me complete the fix. The issue
|
|
||||||
is found in Redhat's bug tracker:
|
|
||||||
https://bugzilla.redhat.com/show_bug.cgi?id=453612
|
|
||||||
|
|
||||||
There are still memory leaks present, but they seem to have other reasons.
|
|
||||||
|
|
||||||
Daniel Fandrich (11 Apr 2009)
|
|
||||||
- Added new libcurl source files to Symbian OS build files.
|
|
||||||
- Improved Symbian support for SSL.
|
|
||||||
|
|
||||||
Yang Tse (10 Apr 2009)
|
|
||||||
- Daniel Johnson improved the MacOSX-Framework shell script to now perform all
|
|
||||||
the steps required to build a Mac OS X four way fat ppc/i386/ppc64/x86_64
|
|
||||||
libcurl.framework. Four way fat framework requires OS X 10.5 SDK or later.
|
|
||||||
|
|
||||||
Yang Tse (8 Apr 2009)
|
|
||||||
- Removed Sun compilers preprocessor block from curlbuild.h.dist, this also
|
|
||||||
removes it from the curlbuild.h file originally distributed by the cURL
|
|
||||||
project as this file is intended for systems not capable of running the
|
|
||||||
configure script. For those who have been building curl out of the source
|
|
||||||
code curl distribution tarball provided by curl.haxx.se the change implies
|
|
||||||
nothing. Previous change in this area committed 2 Apr becomes irrelevant.
|
|
||||||
|
|
||||||
Daniel Stenberg (6 Apr 2009)
|
|
||||||
- I clarified in the docs that CURLOPT_SEEKFUNCTION should return 0 on success
|
|
||||||
and 1 on fatal errors. Previously it only mentioned non-zero on fatal
|
|
||||||
errors. This is a slight change in meaning, but it follows what we've done
|
|
||||||
elsewhere before and it opens up for LOTS of more useful return codes
|
|
||||||
whenever we can think of them...
|
|
||||||
|
|
||||||
Yang Tse (2 Apr 2009)
|
|
||||||
- Fix curl_off_t definition for builds done using Sun compilers and a
|
|
||||||
non-configured libcurl. In this case curl_off_t data type was gated
|
|
||||||
to the off_t data type which depends on the _FILE_OFFSET_BITS. This
|
|
||||||
configuration is exactly the unwanted configuration for our curl_off_t
|
|
||||||
data type which must not depend on such setting. This breaks ABI for
|
|
||||||
libcurl libraries built with Sun compilers which were built without
|
|
||||||
having run the configure script with _FILE_OFFSET_BITS different than
|
|
||||||
64 and using the ILP32 data model.
|
|
||||||
|
|
||||||
Daniel Stenberg (1 Apr 2009)
|
|
||||||
- Andre Guibert de Bruet fixed a NULL pointer use in an infof() call if a
|
|
||||||
strdup() call failed.
|
|
||||||
|
|
||||||
Daniel Fandrich (31 Mar 2009)
|
|
||||||
- Properly return an error code in curl_easy_recv (reported by Jim Freeman).
|
|
||||||
|
|
||||||
Daniel Stenberg (18 Mar 2009)
|
|
||||||
- Kamil Dudka brought a patch that enables 6 additional crypto algorithms when
|
|
||||||
NSS is used. These ciphers were added in NSS 3.4 and require to be enabled
|
|
||||||
explicitly.
|
|
||||||
|
|
||||||
Daniel Stenberg (13 Mar 2009)
|
|
||||||
- Use libssh2_version() to present the libssh2 version in case the libssh2
|
|
||||||
library is found to support it.
|
|
||||||
|
|
||||||
Yang Tse (12 Mar 2009)
|
|
||||||
- Added missing Curl_read() return code checking in TELNET transfers.
|
|
||||||
|
|
||||||
- Pierre Brico found and fixed TELNET transfers not being aborted upon
|
|
||||||
a write callback failure.
|
|
||||||
|
|
||||||
Daniel Stenberg (11 Mar 2009)
|
|
||||||
- Kamil Dudka made the curl tool properly call curl_global_init() before any
|
|
||||||
other libcurl function.
|
|
||||||
|
|
||||||
Yang Tse (11 Mar 2009)
|
|
||||||
- Added missing TELNET timeout support for Windows builds. This issue was
|
|
||||||
reported by Pierre Brico.
|
|
||||||
|
|
||||||
Daniel Stenberg (9 Mar 2009)
|
|
||||||
- Frank Hempel found out a bug and provided the fix:
|
|
||||||
|
|
||||||
curl_easy_duphandle did not necessarily duplicate the CURLOPT_COOKIEFILE
|
|
||||||
option. It only enabled the cookie engine in the destination handle if
|
|
||||||
data->cookies is not NULL (where data is the source handle). In case of a
|
|
||||||
newly initialized handle which just had the cookie support enabled by a
|
|
||||||
curl_easy_setopt(handle, CURL_COOKIEFILE, "")-call, handle->cookies was
|
|
||||||
still NULL because the setopt-call only appends the value to
|
|
||||||
data->change.cookielist, hence duplicating this handle would not have the
|
|
||||||
cookie engine switched on.
|
|
||||||
|
|
||||||
We also concluded that the slist-functionality would be suitable for being
|
|
||||||
put in its own module rather than simply hanging out in lib/sendf.c so I
|
|
||||||
created lib/slist.[ch] for them.
|
|
||||||
|
|
||||||
- Andreas Farber made the 'buildconf' script check for the presence of m4
|
|
||||||
scripts to make it detect a bad checkout earlier. People with older
|
|
||||||
checkouts who don't do cvs update with the -d option won't get the new dirs
|
|
||||||
and then will get funny outputs that can be a bit hard to understand and
|
|
||||||
fix.
|
|
||||||
|
|
||||||
Daniel Stenberg (8 Mar 2009)
|
|
||||||
- Andre Guibert de Bruet found and fixed a code segment in ssluse.c where the
|
|
||||||
allocation of the memory BIO was not being properly checked.
|
|
||||||
|
|
||||||
- Andre Guibert de Bruet fixed the gnutls-using code: There are a few places
|
|
||||||
in the gnutls code where we were checking for negative values for errors,
|
|
||||||
when the man pages state that GNUTLS_E_SUCCESS is returned on success and
|
|
||||||
other values indicate error conditions.
|
|
||||||
|
|
||||||
- Bill Egert pointed out (http://curl.haxx.se/bug/view.cgi?id=2671602) that
|
|
||||||
curl didn't use sprintf() in a way that is documented to work in POSIX but
|
|
||||||
since we use our own printf() code (from libcurl) that shouldn't be a
|
|
||||||
problem. Nonetheless I modified the code to not rely on such particular
|
|
||||||
features and to not cause further raised eyebrowse with no good reason.
|
|
||||||
|
|
||||||
Daniel Fandrich (5 Mar 2009)
|
|
||||||
- Expanded the security section of the libcurl-tutorial man page to cover
|
|
||||||
more issues for authors to consider when writing robust libcurl-using
|
|
||||||
applications.
|
|
||||||
|
|
||||||
Yang Tse (5 Mar 2009)
|
|
||||||
- Fixed NTLM authentication memory leak on SSPI enabled Windows builds. This
|
|
||||||
issue was noticed by Chris Deidun.
|
|
||||||
|
|
||||||
Daniel Fandrich (4 Mar 2009)
|
|
||||||
- Fixed a problem with m4 quoting in the OpenSSL configure check reported
|
|
||||||
by Daniel Johnson.
|
|
||||||
|
|
||||||
Daniel Stenberg (3 Mar 2009)
|
|
||||||
- David James brought a patch that make libcurl close (all) dead connections
|
|
||||||
whenever you attempt to open a new connection.
|
|
||||||
|
|
||||||
1. After cleaning up a dead connection, "continue" instead of
|
|
||||||
returning FALSE. This ensures that we clean up all dead connections,
|
|
||||||
rather than just cleaning up the first dead connection.
|
|
||||||
2. Move up the cleanup for dead connections so that it occurs for
|
|
||||||
all connections, rather than just the connections which have the same
|
|
||||||
preferences as our current new connection.
|
|
||||||
|
|
||||||
Version 7.19.4 (3 March 2009)
|
|
||||||
|
|
||||||
Daniel Stenberg (3 Mar 2009)
|
|
||||||
- David Kierznowski notified us about a security flaw
|
|
||||||
(http://curl.haxx.se/docs/adv_20090303.html also known as CVE-2009-0037) in
|
|
||||||
which previous libcurl versions (by design) can be tricked to access an
|
|
||||||
arbitrary local/different file instead of a remote one when
|
|
||||||
CURLOPT_FOLLOWLOCATION is enabled. This flaw is now fixed in this release
|
|
||||||
together this the addition of two new setopt options for controlling this
|
|
||||||
new behavior:
|
|
||||||
|
|
||||||
o CURLOPT_REDIR_PROTOCOLS controls what protocols libcurl is allowed to
|
|
||||||
follow to when CURLOPT_FOLLOWLOCATION is enabled. By default, this option
|
|
||||||
excludes the FILE and SCP protocols and thus you nee to explicitly allow
|
|
||||||
them in your app if you really want that behavior.
|
|
||||||
|
|
||||||
o CURLOPT_PROTOCOLS controls what protocol(s) libcurl is allowed to fetch
|
|
||||||
using the primary URL option. This is useful if you want to allow a user or
|
|
||||||
other outsiders control what URL to pass to libcurl and yet not allow all
|
|
||||||
protocols libcurl may have been built to support.
|
|
||||||
|
|
||||||
Daniel Stenberg (27 Feb 2009)
|
|
||||||
- Senthil Raja Velu reported a problem when CURLOPT_INTERFACE and
|
|
||||||
CURLOPT_LOCALPORT were used together (the local port bind failed), and
|
|
||||||
Markus Koetter provided the fix!
|
|
||||||
|
|
||||||
Daniel Stenberg (25 Feb 2009)
|
|
||||||
- As Daniel Fandrich figured out, we must do the GnuTLS initing in the
|
|
||||||
curl_global_init() function to properly maintain the performing functions
|
|
||||||
thread-safe. We've previously (28 April 2007) moved the init to a later time
|
|
||||||
just to avoid it to fail very early when libgcrypt dislikes the situation,
|
|
||||||
but that move was bad and the fix should rather be in libgcrypt or
|
|
||||||
elsewhere.
|
|
||||||
|
|
||||||
Daniel Stenberg (24 Feb 2009)
|
|
||||||
- Brian J. Murrell found out that Negotiate proxy authentication didn't work.
|
|
||||||
It happened because the code used the struct for server-based auth all the
|
|
||||||
time for both proxy and server auth which of course was wrong.
|
|
||||||
|
|
||||||
Daniel Stenberg (23 Feb 2009)
|
|
||||||
- After a bug reported by James Cheng I've made curl_easy_getinfo() for
|
|
||||||
CURLINFO_CONTENT_LENGTH_DOWNLOAD and CURLINFO_CONTENT_LENGTH_UPLOAD return
|
|
||||||
-1 if the sizes aren't know. Previously these returned 0, make it impossible
|
|
||||||
to detect the difference between actually zero and unknown.
|
|
||||||
|
|
||||||
Yang Tse (23 Feb 2009)
|
|
||||||
- Daniel Johnson provided a shell script that will perform all the steps needed
|
|
||||||
to build a Mac OS X fat ppc/i386 or ppc64/x86_64 libcurl.framework
|
|
||||||
|
|
||||||
Daniel Stenberg (23 Feb 2009)
|
|
||||||
- I renamed everything in the windows builds files that used the name 'curllib'
|
|
||||||
to the proper 'libcurl' as clearly this caused confusion.
|
|
||||||
|
|
||||||
Yang Tse (20 Feb 2009)
|
|
||||||
- Do not halt compilation when using VS2008 to build a Windows 2000 target.
|
|
||||||
|
|
||||||
Daniel Stenberg (20 Feb 2009)
|
|
||||||
- Linus Nielsen Feltzing reported and helped me repeat and fix a problem with
|
|
||||||
FTP with the multi interface: when a transfer fails, like when aborted by a
|
|
||||||
write callback, the control connection was wrongly closed and thus not
|
|
||||||
re-used properly.
|
|
||||||
|
|
||||||
This change is also an attempt to cleanup the code somewhat in this area, as
|
|
||||||
now the FTP code attempts to keep (better) track on pending responses
|
|
||||||
necessary to get read in ftp_done().
|
|
||||||
|
|
||||||
Daniel Stenberg (19 Feb 2009)
|
|
||||||
- Patrik Thunstrom reported a problem and helped me repeat it. It turned out
|
|
||||||
libcurl did a superfluous 1000ms wait when doing SFTP downloads!
|
|
||||||
|
|
||||||
We read data with libssh2 while doing the "DO" operation for SFTP and then
|
|
||||||
when we were about to start getting data for the actual file part, the
|
|
||||||
"TRANSFER" part, we waited for socket action (in 1000ms) before doing a
|
|
||||||
libssh2-read. But in this case libssh2 had already read and buffered the
|
|
||||||
data so we ended up always just waiting 1000ms before we get working on the
|
|
||||||
data!
|
|
||||||
|
|
||||||
Patrick Monnerat (18 Feb 2009)
|
|
||||||
- FTP downloads (i.e.: RETR) ending with code 550 now return error
|
|
||||||
CURLE_REMOTE_FILE_NOT_FOUND instead of CURLE_FTP_COULDNT_RETR_FILE.
|
|
||||||
|
|
||||||
Daniel Stenberg (17 Feb 2009)
|
|
||||||
- Kamil Dudka made NSS-powered builds compile and run again!
|
|
||||||
|
|
||||||
- A second follow-up change by Andre Guibert de Bruet to fix a related memory
|
|
||||||
leak like that fixed on the 14th. When zlib returns failure, we need to
|
|
||||||
cleanup properly before returning error.
|
|
||||||
|
|
||||||
- CURLOPT_FTP_CREATE_MISSING_DIRS can now be set to 2 in addition to 1 for
|
|
||||||
plain FTP connections, and it will then allow MKD to fail once and retry the
|
|
||||||
CWD afterwards. This is especially useful if you're doing many simultanoes
|
|
||||||
connections against the same server and they all have this option enabled,
|
|
||||||
as then CWD may first fail but then another connection does MKD before this
|
|
||||||
connection and thus MKD fails but trying CWD works! The numbers can
|
|
||||||
(should?) now be set with the convenience enums now called
|
|
||||||
CURLFTP_CREATE_DIR and CURLFTP_CREATE_DIR_RETRY.
|
|
||||||
|
|
||||||
Tests has proven that if you're making an application that uploads a set of
|
|
||||||
files to an ftp server, you will get a noticable gain in speed if you're
|
|
||||||
using multiple connections and this option will be then be very useful.
|
|
||||||
|
|
||||||
Daniel Stenberg (14 Feb 2009)
|
|
||||||
- Andre Guibert de Bruet found and fixed a memory leak in the content encoding
|
|
||||||
code, which could happen on libz errors.
|
|
||||||
|
|
||||||
Daniel Fandrich (12 Feb 2009)
|
|
||||||
- Added support for Digest and NTLM authentication using GnuTLS.
|
|
||||||
|
|
||||||
Daniel Stenberg (11 Feb 2009)
|
|
||||||
- CURLINFO_CONDITION_UNMET was added to allow an application to get to know if
|
|
||||||
the condition in the previous request was unmet. This is typically a time
|
|
||||||
condition set with CURLOPT_TIMECONDITION and was previously not possible to
|
|
||||||
reliably figure out. From bug report #2565128
|
|
||||||
(http://curl.haxx.se/bug/view.cgi?id=2565128) filed by Jocelyn Jaubert.
|
|
||||||
|
|
||||||
Daniel Fandrich (4 Feb 2009)
|
|
||||||
- Don't add the standard /usr/lib or /usr/include paths to LDFLAGS and CPPFLAGS
|
|
||||||
(respectively) when --with-ssl=/usr is used (patch based on FreeBSD).
|
|
||||||
|
|
||||||
- Added an explicit buffer limit check in msdosify() (patch based on FreeBSD).
|
|
||||||
This couldn't ever overflow in curl, but might if the code were used
|
|
||||||
elsewhere or under different conditions.
|
|
||||||
|
|
||||||
Daniel Stenberg (3 Feb 2009)
|
|
||||||
- Hidemoto Nakada provided a small fix that makes it possible to get the
|
|
||||||
CURLINFO_CONTENT_LENGTH_DOWNLOAD size from file:// "transfers" with
|
|
||||||
CURLOPT_NOBODY set true.
|
|
||||||
|
|
||||||
Daniel Stenberg (2 Feb 2009)
|
|
||||||
- Patrick Scott found a rather large memory leak when using the multi
|
|
||||||
interface and setting CURLMOPT_MAXCONNECTS to something less than the number
|
|
||||||
of handles you add to the multi handle. All the connections that didn't fit
|
|
||||||
in the cache would not be properly disconnected nor freed!
|
|
||||||
|
|
||||||
- Craig A West brought us: libcurl now defaults to do CONNECT with HTTP
|
|
||||||
version 1.1 instead of 1.0 like before. This change also introduces the new
|
|
||||||
proxy type for libcurl called 'CURLPROXY_HTTP_1_0' that then allows apps to
|
|
||||||
switch (back) to CONNECT 1.0 requests. The curl tool also got a --proxy1.0
|
|
||||||
option that works exactly like --proxy but sets CURLPROXY_HTTP_1_0.
|
|
||||||
|
|
||||||
I updated all test cases cases that use CONNECT and I tried to do some using
|
|
||||||
--proxy1.0 and some updated to do CONNECT 1.1 to get both versions run.
|
|
||||||
|
|
||||||
Daniel Stenberg (31 Jan 2009)
|
|
||||||
- When building with c-ares 1.6.1 (not yet released) or later and IPv6 support
|
|
||||||
enabled, we can now take advantage of its brand new AF_UNSPEC support in
|
|
||||||
ares_gethostbyname(). This makes test case 241 finally run fine for me with
|
|
||||||
this setup since it now parses the "::1 ip6-localhost" line fine in my
|
|
||||||
/etc/hosts file!
|
|
||||||
|
|
||||||
Daniel Stenberg (30 Jan 2009)
|
|
||||||
- Scott Cantor filed bug report #2550061
|
|
||||||
(http://curl.haxx.se/bug/view.cgi?id=2550061) mentioning that I failed to
|
|
||||||
properly make sure that the VC9 makefiles got included in the latest
|
|
||||||
release. I've now fixed the release script and verified it so next release
|
|
||||||
will hopefully include them properly!
|
|
||||||
|
|
||||||
Daniel Fandrich (30 Jan 2009)
|
|
||||||
- Fixed --disable-proxy for FTP and SOCKS. Thanks to Daniel Egger for
|
|
||||||
reporting.
|
|
||||||
|
|
||||||
Yang Tse (29 Jan 2009)
|
|
||||||
- Introduced curl_sspi.c and curl_sspi.h for the implementation of functions
|
|
||||||
Curl_sspi_global_init() and Curl_sspi_global_cleanup() which previously were
|
|
||||||
named Curl_ntlm_global_init() and Curl_ntlm_global_cleanup() in http_ntlm.c
|
|
||||||
Also adjusted socks_sspi.c to remove the link-time dependency on the Windows
|
|
||||||
SSPI library using it now in the same way as it was done in http_ntlm.c.
|
|
||||||
|
|
||||||
Daniel Stenberg (28 Jan 2009)
|
|
||||||
- Markus Moeller introduced two new options to libcurl:
|
|
||||||
CURLOPT_SOCKS5_GSSAPI_SERVICE and CURLOPT_SOCKS5_GSSAPI_NEC to allow libcurl
|
|
||||||
to do GSS-style authentication with SOCKS5 proxies. The curl tool got the
|
|
||||||
options called --socks5-gssapi-service and --socks5-gssapi-nec to enable
|
|
||||||
these.
|
|
||||||
|
|
||||||
Daniel Stenberg (26 Jan 2009)
|
|
||||||
- Chad Monroe provided the new CURLOPT_TFTP_BLKSIZE option that allows an app
|
|
||||||
to set desired block size to use for TFTP transfers instead of the default
|
|
||||||
512 bytes.
|
|
||||||
|
|
||||||
- The "-no_ticket" option was introduced in Openssl0.9.8j. It's a flag to
|
|
||||||
disable "rfc4507bis session ticket support". rfc4507bis was later turned
|
|
||||||
into the proper RFC5077 it seems: http://tools.ietf.org/html/rfc5077
|
|
||||||
|
|
||||||
The enabled extension concerns the session management. I wonder how often
|
|
||||||
libcurl stops a connection and then resumes a TLS session. also, sending the
|
|
||||||
session data is some overhead. .I suggest that you just use your proposed
|
|
||||||
patch (which explicitly disables TICKET).
|
|
||||||
|
|
||||||
If someone writes an application with libcurl and openssl who wants to
|
|
||||||
enable the feature, one can do this in the SSL callback.
|
|
||||||
|
|
||||||
Sharad Gupta brought this to my attention. Peter Sylvester helped me decide
|
|
||||||
on the proper action.
|
|
||||||
|
|
||||||
- Alexey Borzov filed bug report #2535504
|
|
||||||
(http://curl.haxx.se/bug/view.cgi?id=2535504) pointing out that realms with
|
|
||||||
quoted quotation marks in HTTP Digest headers didn't work. I've now added
|
|
||||||
test case 1095 that verifies my fix.
|
|
||||||
|
|
||||||
- Craig A West brought CURLOPT_NOPROXY and the corresponding --noproxy option.
|
|
||||||
They basically offer the same thing the NO_PROXY environment variable only
|
|
||||||
offered previously: list a set of host names that shall not use the proxy
|
|
||||||
even if one is specified.
|
|
||||||
|
|
||||||
Daniel Fandrich (20 Jan 2009)
|
|
||||||
- Call setlocale() for libtest tests to test the effects of locale-induced
|
|
||||||
libc changes on libcurl.
|
|
||||||
|
|
||||||
- Fixed a couple more locale-dependent toupper conversions, mainly for
|
|
||||||
clarity. This does fix one problem that causes ;type=i FTP URLs
|
|
||||||
to fail in the Turkish locale when CURLOPT_PROXY_TRANSFER_MODE is
|
|
||||||
used (test case 561)
|
|
||||||
|
|
||||||
- Added tests 561 and 1091 through 1094 to test various combinations
|
|
||||||
of ;type= and ;mode= URLs that could potentially fail in the Turkish
|
|
||||||
locale.
|
|
||||||
|
|
||||||
Daniel Stenberg (20 Jan 2009)
|
|
||||||
- Lisa Xu pointed out that the ssh.obj file was missing from the
|
|
||||||
lib/Makefile.vc6 file (and thus from the vc8 and vc9 ones too).
|
|
||||||
|
|
||||||
Version 7.19.3 (19 January 2009)
|
|
||||||
|
|
||||||
Daniel Stenberg (16 Jan 2009)
|
|
||||||
- Andrew de los Reyes fixed curlbuild.h for "generic" gcc builds on PPC, both
|
|
||||||
32 bit and 64 bit.
|
|
||||||
|
|
||||||
Daniel Stenberg (15 Jan 2009)
|
|
||||||
- Tim Ansell fixed a compiler warning in lib/cookie.c
|
|
||||||
|
|
||||||
Daniel Stenberg (14 Jan 2009)
|
|
||||||
- Grant Erickson fixed timeouts for TFTP such that specifying a
|
|
||||||
connect-timeout, a max-time or both options work correctly and as expected
|
|
||||||
by passing the correct boolean value to Curl_timeleft via the
|
|
||||||
'duringconnect' parameter.
|
|
||||||
|
|
||||||
With this small change, curl TFTP now behaves as expected (and likely as
|
|
||||||
originally-designed):
|
|
||||||
|
|
||||||
1) For non-existent or unreachable dotted IP addresses:
|
|
||||||
|
|
||||||
a) With no options, follows the default curl 300s timeout...
|
|
||||||
b) With --connect-timeout only, follows that value...
|
|
||||||
c) With --max-time only, follows that value...
|
|
||||||
d) With both --connect-timeout and --max-time, follows the smaller value...
|
|
||||||
|
|
||||||
and times out with a "curl: (7) Couldn't connect to server" error.
|
|
||||||
|
|
||||||
2) For transfers to/from a valid host:
|
|
||||||
|
|
||||||
a) With no options, follows default curl 300s timeout for the
|
|
||||||
first XRQ/DATA/ACK transaction and the default TFTP 3600s
|
|
||||||
timeout for the remainder of the transfer...
|
|
||||||
|
|
||||||
b) With --connect-time only, follows that value for the
|
|
||||||
first XRQ/DATA/ACK transaction and the default TFTP 3600s
|
|
||||||
timeout for the remainder of the transfer...
|
|
||||||
|
|
||||||
c) With --max-time only, follows that value for the first
|
|
||||||
XRQ/DATA/ACK transaction and for the remainder of the
|
|
||||||
transfer...
|
|
||||||
|
|
||||||
d) With both --connect-timeout and --max-time, follows the former
|
|
||||||
for the first XRQ/DATA/ACK transaction and the latter for the
|
|
||||||
remainder of the transfer...
|
|
||||||
|
|
||||||
and times out with a "curl: (28) Timeout was reached" error as
|
|
||||||
appropriate.
|
|
||||||
|
|
||||||
Daniel Stenberg (13 Jan 2009)
|
|
||||||
- Michael Wallner fixed a NULL pointer deref when calling
|
|
||||||
curl_easy_setup(curl, CURLOPT_COOKIELIST, "SESS") on a CURL handle with no
|
|
||||||
cookies data.
|
|
||||||
|
|
||||||
- Stefan Teleman brought a patch to fix the default curlbuild.h file for the
|
|
||||||
SunPro compilers.
|
|
||||||
|
|
||||||
Daniel Stenberg (12 Jan 2009)
|
|
||||||
- Based on bug report #2498665 (http://curl.haxx.se/bug/view.cgi?id=2498665)
|
|
||||||
by Daniel Black, I've now added magic to the configure script that makes it
|
|
||||||
use pkg-config to detect gnutls details as well if the existing method
|
|
||||||
(using libgnutls-config) fails. While doing this, I cleaned up and unified
|
|
||||||
the pkg-config usage when detecting openssl and nss as well.
|
|
||||||
|
|
||||||
Daniel Stenberg (11 Jan 2009)
|
|
||||||
- Karl Moerder brought the patch that creates vc9 Makefiles, and I made
|
|
||||||
'maketgz' now use the actual makefile targets to do the VC8 and VC9
|
|
||||||
makefiles.
|
|
||||||
|
|
||||||
Daniel Stenberg (10 Jan 2009)
|
|
||||||
- Emil Romanus fixed:
|
|
||||||
|
|
||||||
When using the multi interface over HTTP and the server returns a Location
|
|
||||||
header, the running easy handle will get stuck in the CURLM_STATE_PERFORM
|
|
||||||
state, leaving the external event loop stuck waiting for data from the
|
|
||||||
ingoing socket (when using the curl_multi_socket_action stuff). While this
|
|
||||||
bug was pretty hard to find, it seems to require only a one-line fix. The
|
|
||||||
break statement on line 1374 in multi.c caused the function to skip the call
|
|
||||||
to multistate().
|
|
||||||
|
|
||||||
How to reproduce this bug? Well, that's another question. evhiperfifo.c in
|
|
||||||
the examples directory chokes on this bug only _sometimes_, probably
|
|
||||||
depending on how fast the URLs are added. One way of testing the bug out is
|
|
||||||
writing to hiper.fifo from more than one source at the same time.
|
|
||||||
|
|
||||||
Daniel Fandrich (7 Jan 2009)
|
|
||||||
- Unified much of the SessionHandle initialization done in Curl_open() and
|
|
||||||
curl_easy_reset() by creating Curl_init_userdefined(). This had the side
|
|
||||||
effect of fixing curl_easy_reset() so it now also resets
|
|
||||||
CURLOPT_FTP_FILEMETHOD and CURLOPT_SSL_SESSIONID_CACHE
|
|
||||||
|
|
||||||
Daniel Stenberg (7 Jan 2009)
|
|
||||||
- Rob Crittenden did once again provide an NSS update:
|
|
||||||
|
|
||||||
I have to jump through a few hoops now with the NSS library initialization
|
|
||||||
since another part of an application may have already initialized NSS by the
|
|
||||||
time Curl gets invoked. This patch is more careful to only shutdown the NSS
|
|
||||||
library if Curl did the initialization.
|
|
||||||
|
|
||||||
It also adds in a bit of code to set the default ciphers if the app that
|
|
||||||
call NSS_Init* did not call NSS_SetDomesticPolicy() or set specific
|
|
||||||
ciphers. One might argue that this lets other application developers get
|
|
||||||
lazy and/or they aren't using the NSS API correctly, and you'd be right.
|
|
||||||
But still, this will avoid terribly difficult-to-trace crashes and is
|
|
||||||
generally helpful.
|
|
||||||
|
|
||||||
Daniel Stenberg (1 Jan 2009)
|
|
||||||
- 'reconf' is removed since we rather have users use 'buildconf'
|
|
||||||
|
|
||||||
Daniel Stenberg (31 Dec 2008)
|
|
||||||
- Bas Mevissen reported http://curl.haxx.se/bug/view.cgi?id=2479030 pointing
|
|
||||||
out that 'reconf' didn't properly point out the m4 subdirectory when running
|
|
||||||
aclocal.
|
|
||||||
|
|
||||||
Daniel Stenberg (29 Dec 2008)
|
|
||||||
- Phil Lisiecki filed bug report #2413067
|
|
||||||
(http://curl.haxx.se/bug/view.cgi?id=2413067) that identified a problem that
|
|
||||||
would cause libcurl to mark a DNS cache entry "in use" eternally if the
|
|
||||||
subsequence TCP connect failed. It would thus never get pruned and refreshed
|
|
||||||
as it should've been.
|
|
||||||
|
|
||||||
Phil provided his own patch to this problem that while it seemed to work
|
|
||||||
wasn't complete and thus I wrote my own fix to the problem.
|
|
||||||
|
|
||||||
Daniel Stenberg (28 Dec 2008)
|
|
||||||
- Peter Korsgaard fixed building libcurl with "configure --with-ssl
|
|
||||||
--disable-verbose".
|
|
||||||
|
|
||||||
- Anthony Bryan fixed more language and spelling flaws in man pages.
|
|
||||||
|
|
||||||
Daniel Stenberg (22 Dec 2008)
|
|
||||||
- Given a recent enough libssh2, libcurl can now seek/resume with SFTP even
|
|
||||||
on file indexes beyond 2 or 4GB.
|
|
||||||
|
|
||||||
- Anthony Bryan provided a set of patches that cleaned up manual language,
|
|
||||||
corrected spellings and more.
|
|
||||||
|
|
||||||
Daniel Stenberg (20 Dec 2008)
|
|
||||||
- Igor Novoseltsev fixed a bad situation for the multi_socket() API when doing
|
|
||||||
pipelining, as libcurl could then easily get confused and A) work on the
|
|
||||||
handle that was not "first in queue" on a pipeline, or even B) tell the app
|
|
||||||
to REMOVE a socket while it was in use by a second handle in a pipeline. Both
|
|
||||||
errors caused hanging or stalling applications.
|
|
||||||
|
|
||||||
Daniel Stenberg (19 Dec 2008)
|
|
||||||
- curl_multi_timeout() could return a timeout value of 0 even though nothing
|
|
||||||
was actually ready to get done, as the internal time resolution is higher
|
|
||||||
than the returned millisecond timer. Therefore it could cause applications
|
|
||||||
running on fast processors to do short bursts of busy-loops.
|
|
||||||
curl_multi_timeout() will now only return 0 if the timeout is actually
|
|
||||||
alreay triggered.
|
|
||||||
|
|
||||||
- Using the libssh2 0.19 function libssh2_session_block_directions(), libcurl
|
|
||||||
now has an improved ability to do right when the multi interface (both
|
|
||||||
"regular" and multi_socket) is used for SCP and SFTP transfers. This should
|
|
||||||
result in (much) less busy-loop situations and thus less CPU usage with no
|
|
||||||
speed loss.
|
|
||||||
|
|
||||||
Daniel Stenberg (17 Dec 2008)
|
|
||||||
- SCP and SFTP with the multi interface had the same flaw: the 'DONE'
|
|
||||||
operation didn't complete properly if the EAGAIN equivalent was returned but
|
|
||||||
libcurl would simply continue with a half-completed close operation
|
|
||||||
performed. This ruined persistent connection re-use and cause some
|
|
||||||
SSH-protocol errors in general. The correction is unfortunately adding a
|
|
||||||
blocking function - doing it entirely non-blocking should be considered for
|
|
||||||
a better fix.
|
|
||||||
|
|
||||||
Gisle Vanem (16 Dec 2008)
|
|
||||||
- Added the possibility to use the Watt-32 tcp/ip stack under Windows.
|
|
||||||
The change simply involved adding a USE_WATT32 section in the
|
|
||||||
config-win32.h files (under ./lib and ./src). This section disables
|
|
||||||
the use of any Winsock headers.
|
|
||||||
|
|
||||||
Daniel Stenberg (16 Dec 2008)
|
|
||||||
- libssh2_sftp_last_error() was wrongly used at some places in libcurl which
|
|
||||||
made libcurl sometimes not properly abort problematic SFTP transfers.
|
|
||||||
|
|
||||||
Daniel Stenberg (12 Dec 2008)
|
|
||||||
- More work with Igor Novoseltsev to first fix the remaining stuff for
|
|
||||||
removing easy handles from multi handles when the easy handle is/was within
|
|
||||||
a HTTP pipeline. His bug report #2351653
|
|
||||||
(http://curl.haxx.se/bug/view.cgi?id=2351653) was also related and was
|
|
||||||
eventually fixed by a patch by Igor himself.
|
|
||||||
|
|
||||||
Yang Tse (12 Dec 2008)
|
|
||||||
- Patrick Monnerat fixed a build regression, introduced in 7.19.2, affecting
|
|
||||||
OS/400 compilations with IPv6 enabled.
|
|
||||||
|
|
||||||
Daniel Stenberg (12 Dec 2008)
|
|
||||||
- Mark Karpeles filed bug report #2416182 titled "crash in ConnectionExists
|
|
||||||
when using duphandle+curl_mutli"
|
|
||||||
(http://curl.haxx.se/bug/view.cgi?id=2416182) which showed that
|
|
||||||
curl_easy_duphandle() wrongly also copied the pointer to the connection
|
|
||||||
cache, which was plain wrong and caused a segfault if the handle would be
|
|
||||||
used in a different multi handle than the handle it was duplicated from.
|
|
||||||
|
|
||||||
Daniel Stenberg (11 Dec 2008)
|
|
||||||
- Keshav Krity found out that libcurl failed to deal with dotted IPv6
|
|
||||||
addresses if they were very long (>39 letters) due to a too strict address
|
|
||||||
validity parser. It now accepts addresses up to 45 bytes long.
|
|
||||||
|
|
||||||
Daniel Stenberg (11 Dec 2008)
|
|
||||||
- Internet Explorer had a broken HTTP digest authentication before v7 and
|
|
||||||
there are servers "out there" that relies on the client doing this broken
|
|
||||||
Digest authentication. Apache even comes with an option to work with such
|
|
||||||
broken clients.
|
|
||||||
|
|
||||||
The difference is only for URLs that contain a query-part (a '?'-letter and
|
|
||||||
text to the right of it).
|
|
||||||
|
|
||||||
libcurl now supports this quirk, and you enable it by setting the
|
|
||||||
CURLAUTH_DIGEST_IE bit in the bitmask you pass to the CURLOPT_HTTPAUTH or
|
|
||||||
CURLOPT_PROXYAUTH options. They are thus individually controlled to server
|
|
||||||
and proxy.
|
|
||||||
|
|
||||||
(note that there's no way to activate this with the curl tool yet)
|
|
||||||
|
|
||||||
Daniel Fandrich (9 Dec 2008)
|
|
||||||
- Added test cases 1089 and 1090 to test --write-out after a redirect to
|
|
||||||
test a report that the size didn't work, but these test cases pass.
|
|
||||||
|
|
||||||
- Documented CURLOPT_CONNECT_ONLY as being useful only on HTTP URLs.
|
|
||||||
|
|
||||||
Daniel Stenberg (9 Dec 2008)
|
|
||||||
- Ken Hirsch simplified how libcurl does FTPS: now it doesn't assume any
|
|
||||||
particular state for the control connection like it did before for implicit
|
|
||||||
FTPS (libcurl assumed such control connections to be encrypted while some
|
|
||||||
FTPS servers such as FileZilla assumes such connections to be clear
|
|
||||||
mode). Use the CURLOPT_USE_SSL option to set your desired level.
|
|
||||||
|
|
||||||
Daniel Stenberg (8 Dec 2008)
|
|
||||||
- Fred Machado posted about a weird FTP problem on the curl-users list and when
|
|
||||||
researching it, it turned out he got a 550 response back from a SIZE command
|
|
||||||
and then I fell over the text in RFC3659 that says:
|
|
||||||
|
|
||||||
The presence of the 550 error response to a SIZE command MUST NOT be taken
|
|
||||||
by the client as an indication that the file cannot be transferred in the
|
|
||||||
current MODE and TYPE.
|
|
||||||
|
|
||||||
In other words: the change I did on September 30th 2008 and that has been
|
|
||||||
included in the last two releases were a regression and a bad idea. We MUST
|
|
||||||
NOT take a 550 response from SIZE as a hint that the file doesn't exist.
|
|
||||||
|
|
||||||
- Christian Krause filed bug #2221237
|
|
||||||
(http://curl.haxx.se/bug/view.cgi?id=2221237) that identified an infinite
|
|
||||||
loop during GSS authentication given some specific conditions. With his
|
|
||||||
patience and great feedback I managed to narrow down the problem and
|
|
||||||
eventually fix it although I can't test any of this myself!
|
|
||||||
|
|
||||||
Daniel Fandrich (3 Dec 2008)
|
|
||||||
- Fixed the getifaddrs version of Curl_if2ip to work on systems without IPv6
|
|
||||||
support (e.g. Minix)
|
|
||||||
|
|
||||||
Daniel Stenberg (3 Dec 2008)
|
|
||||||
- Igor Novoseltsev filed bug #2351645
|
|
||||||
(http://curl.haxx.se/bug/view.cgi?id=2351645) that identified a problem with
|
|
||||||
the multi interface that occured if you removed an easy handle while in
|
|
||||||
progress and the handle was used in a HTTP pipeline.
|
|
||||||
|
|
||||||
- Pawel Kierski pointed out a mistake in the cookie code that could lead to a
|
|
||||||
bad fclose() after a fatal error had occured.
|
|
||||||
(http://curl.haxx.se/bug/view.cgi?id=2382219)
|
|
||||||
|
|
||||||
Daniel Fandrich (25 Nov 2008)
|
|
||||||
- If a HTTP request is Basic and num is already >=1000, the HTTP test
|
|
||||||
server adds 1 to num to get the data section to return. This allows
|
|
||||||
testing authentication negotiations using the Basic authentication
|
|
||||||
method.
|
|
||||||
|
|
||||||
- Added tests 1087 and 1088 to test Basic authentication on a redirect
|
|
||||||
with and without --location-trusted
|
|
||||||
|
|
||||||
Daniel Stenberg (24 Nov 2008)
|
|
||||||
- Based on a patch by Vlad Grachov, libcurl now uses a new libssh2 0.19
|
|
||||||
function when built to support SCP and SFTP that helps the library to know
|
|
||||||
in which direction a particular libssh2 operation would return EAGAIN so
|
|
||||||
that libcurl knows what socket conditions to wait for before trying the
|
|
||||||
function call again. Previously (and still when using libssh2 0.18 or
|
|
||||||
earlier), libcurl will busy-loop in this situation when the easy interface
|
|
||||||
is used!
|
|
||||||
|
|
||||||
Daniel Fandrich (20 Nov 2008)
|
|
||||||
- Automatically detect OpenBSD's CA cert bundle.
|
|
||||||
|
|
||||||
Daniel Stenberg (19 Nov 2008)
|
|
||||||
- I removed the default use of "Pragma: no-cache" from libcurl when a proxy is
|
|
||||||
used. It has been used since forever but it was never a good idea to use
|
|
||||||
unless explicitly asked for.
|
|
||||||
|
|
||||||
- Josef Wolf's extension that allows a $TESTDIR/gdbinit$testnum file that when
|
|
||||||
you use runtests.pl -g, will be sourced by gdb to allow additional fancy or
|
|
||||||
whatever you see fit
|
|
||||||
|
|
||||||
- Christian Krause reported and fixed a memory leak that would occur with HTTP
|
|
||||||
GSS/kerberos authentication (http://curl.haxx.se/bug/view.cgi?id=2284386)
|
|
||||||
|
|
||||||
- Andreas Wurf and Markus Koetter helped me analyze a problem that Andreas got
|
|
||||||
when uploading files to a single FTP server using multiple easy handle
|
|
||||||
handles with the multi interface. Occasionally a handle would stall in
|
|
||||||
mysterious ways.
|
|
||||||
|
|
||||||
The problem turned out to be a side-effect of the ConnectionExists()
|
|
||||||
function's eagerness to re-use a handle for HTTP pipelining so it would
|
|
||||||
select it even if already being in use, due to an inadequate check for its
|
|
||||||
chances of being used for pipelnining.
|
|
||||||
|
|
||||||
Daniel Fandrich (17 Nov 2008)
|
|
||||||
- Added more compiler warning options for gcc 4.3
|
|
||||||
|
|
||||||
Yang Tse (17 Nov 2008)
|
|
||||||
- Fix a remaining problem in the inet_pton() runtime configure check. And
|
|
||||||
fix internal Curl_inet_pton() failures to reject certain malformed literals.
|
|
||||||
|
|
||||||
- Make configure script check if ioctl with the SIOCGIFADDR command can be
|
|
||||||
used, and define HAVE_IOCTL_SIOCGIFADDR if appropriate.
|
|
||||||
|
|
||||||
Daniel Stenberg (16 Nov 2008)
|
|
||||||
- Christian Krause fixed a build failure when building with gss support
|
|
||||||
enabled and FTP disabled.
|
|
||||||
|
|
||||||
- Added check for NULL returns from strdup() in src/main.c and lib/formdata.c
|
|
||||||
- reported by Jim Meyering also prevent buffer overflow on MSDOS when you do
|
|
||||||
for example -O on a url with a file name part longer than PATH_MAX letters
|
|
||||||
|
|
||||||
- lib/nss.c fixes based on the report by Jim Meyering: I went over and added
|
|
||||||
checks for return codes for all calls to malloc and strdup that were
|
|
||||||
missing. I also changed a few malloc(13) to use arrays on the stack and a
|
|
||||||
few malloc(PATH_MAX) to instead use aprintf() to lower memory use.
|
|
||||||
|
|
||||||
- I fixed a memory leak in Curl_nss_connect() when CURLOPT_ISSUERCERT is
|
|
||||||
in use.
|
|
||||||
|
|
||||||
Daniel Fandrich (14 Nov 2008)
|
|
||||||
- Added .xml as one of the few common file extensions known by the multipart
|
|
||||||
form generator.
|
|
||||||
|
|
||||||
- Added some #ifdefs around header files and change the EAGAIN test to
|
|
||||||
fix compilation on Cell (reported by Jeff Curley).
|
|
||||||
|
|
||||||
Yang Tse (14 Nov 2008)
|
|
||||||
- Fixed several configure script issues affecting checks for inet_ntoa_r(),
|
|
||||||
inet_ntop(), inet_pton(), getifaddrs(), fcntl() and getaddrinfo().
|
|
||||||
|
|
||||||
Yang Tse (13 Nov 2008)
|
|
||||||
- Refactored configure script detection of functions used to set sockets into
|
|
||||||
non-blocking mode, and decouple function detection from function capability.
|
|
||||||
|
|
||||||
|
The older, manually edited, changelog is found in git named CHANGES.0
|
||||||
|
|||||||
@@ -6,6 +6,16 @@
|
|||||||
# include <sys/types.h>
|
# include <sys/types.h>
|
||||||
#endif /* HAVE_SYS_TYPES_H */
|
#endif /* HAVE_SYS_TYPES_H */
|
||||||
|
|
||||||
|
#ifdef HAVE_SYS_SOCKET_H
|
||||||
|
# include <sys/socket.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
# include <winsock2.h>
|
||||||
|
# include <ws2tcpip.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_STDINT_H
|
#ifdef HAVE_STDINT_H
|
||||||
# include <stdint.h>
|
# include <stdint.h>
|
||||||
#endif /* HAVE_STDINT_H */
|
#endif /* HAVE_STDINT_H */
|
||||||
|
|||||||
@@ -6,51 +6,52 @@
|
|||||||
# VARIABLE - variable to store size if the type exists.
|
# VARIABLE - variable to store size if the type exists.
|
||||||
# HAVE_${VARIABLE} - does the variable exists or not
|
# HAVE_${VARIABLE} - does the variable exists or not
|
||||||
|
|
||||||
MACRO(CHECK_TYPE_SIZE TYPE VARIABLE)
|
macro(CHECK_TYPE_SIZE TYPE VARIABLE)
|
||||||
SET(CMAKE_ALLOW_UNKNOWN_VARIABLE_READ_ACCESS 1)
|
set(CMAKE_ALLOW_UNKNOWN_VARIABLE_READ_ACCESS 1)
|
||||||
IF(NOT DEFINED ${VARIABLE})
|
if(NOT DEFINED ${VARIABLE})
|
||||||
IF("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$")
|
if("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$")
|
||||||
SET(CHECK_TYPE_SIZE_TYPE "${TYPE}")
|
set(CHECK_TYPE_SIZE_TYPE "${TYPE}")
|
||||||
SET(MACRO_CHECK_TYPE_SIZE_FLAGS
|
set(MACRO_CHECK_TYPE_SIZE_FLAGS
|
||||||
"${CMAKE_REQUIRED_FLAGS}")
|
"${CMAKE_REQUIRED_FLAGS}")
|
||||||
FOREACH(def HAVE_SYS_TYPES_H HAVE_STDINT_H HAVE_STDDEF_H)
|
foreach(def HAVE_SYS_TYPES_H
|
||||||
IF("${def}")
|
HAVE_STDINT_H HAVE_STDDEF_H HAVE_SYS_SOCKET_H)
|
||||||
SET(MACRO_CHECK_TYPE_SIZE_FLAGS
|
if("${def}")
|
||||||
|
set(MACRO_CHECK_TYPE_SIZE_FLAGS
|
||||||
"${MACRO_CHECK_TYPE_SIZE_FLAGS} -D${def}")
|
"${MACRO_CHECK_TYPE_SIZE_FLAGS} -D${def}")
|
||||||
ENDIF("${def}")
|
endif("${def}")
|
||||||
ENDFOREACH(def)
|
endforeach(def)
|
||||||
SET(CHECK_TYPE_SIZE_PREMAIN)
|
set(CHECK_TYPE_SIZE_PREMAIN)
|
||||||
FOREACH(def ${CMAKE_EXTRA_INCLUDE_FILES})
|
foreach(def ${CMAKE_EXTRA_INCLUDE_FILES})
|
||||||
SET(CHECK_TYPE_SIZE_PREMAIN "${CHECK_TYPE_SIZE_PREMAIN}#include \"${def}\"\n")
|
set(CHECK_TYPE_SIZE_PREMAIN "${CHECK_TYPE_SIZE_PREMAIN}#include \"${def}\"\n")
|
||||||
ENDFOREACH(def)
|
endforeach(def)
|
||||||
CONFIGURE_FILE(
|
configure_file(
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/CMake/CheckTypeSize.c.in"
|
"${CMAKE_CURRENT_SOURCE_DIR}/CMake/CheckTypeSize.c.in"
|
||||||
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckTypeSize.c"
|
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckTypeSize.c"
|
||||||
IMMEDIATE @ONLY)
|
IMMEDIATE @ONLY)
|
||||||
FILE(READ
|
file(READ
|
||||||
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckTypeSize.c"
|
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckTypeSize.c"
|
||||||
CHECK_TYPE_SIZE_FILE_CONTENT)
|
CHECK_TYPE_SIZE_FILE_CONTENT)
|
||||||
MESSAGE(STATUS "Check size of ${TYPE}")
|
message(STATUS "Check size of ${TYPE}")
|
||||||
IF(CMAKE_REQUIRED_LIBRARIES)
|
if(CMAKE_REQUIRED_LIBRARIES)
|
||||||
SET(CHECK_TYPE_SIZE_ADD_LIBRARIES
|
set(CHECK_TYPE_SIZE_ADD_LIBRARIES
|
||||||
"-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
|
"-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
|
||||||
ENDIF(CMAKE_REQUIRED_LIBRARIES)
|
endif(CMAKE_REQUIRED_LIBRARIES)
|
||||||
TRY_RUN(${VARIABLE} HAVE_${VARIABLE}
|
try_run(${VARIABLE} HAVE_${VARIABLE}
|
||||||
${CMAKE_BINARY_DIR}
|
${CMAKE_BINARY_DIR}
|
||||||
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckTypeSize.c"
|
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckTypeSize.c"
|
||||||
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_TYPE_SIZE_FLAGS}
|
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_TYPE_SIZE_FLAGS}
|
||||||
"${CHECK_TYPE_SIZE_ADD_LIBRARIES}"
|
"${CHECK_TYPE_SIZE_ADD_LIBRARIES}"
|
||||||
OUTPUT_VARIABLE OUTPUT)
|
OUTPUT_VARIABLE OUTPUT)
|
||||||
IF(HAVE_${VARIABLE})
|
if(HAVE_${VARIABLE})
|
||||||
MESSAGE(STATUS "Check size of ${TYPE} - done")
|
message(STATUS "Check size of ${TYPE} - done")
|
||||||
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
||||||
"Determining size of ${TYPE} passed with the following output:\n${OUTPUT}\n\n")
|
"Determining size of ${TYPE} passed with the following output:\n${OUTPUT}\n\n")
|
||||||
ELSE(HAVE_${VARIABLE})
|
else(HAVE_${VARIABLE})
|
||||||
MESSAGE(STATUS "Check size of ${TYPE} - failed")
|
message(STATUS "Check size of ${TYPE} - failed")
|
||||||
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
|
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")
|
"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})
|
||||||
ENDIF("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$")
|
endif("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$")
|
||||||
ENDIF(NOT DEFINED ${VARIABLE})
|
endif(NOT DEFINED ${VARIABLE})
|
||||||
SET(CMAKE_ALLOW_UNKNOWN_VARIABLE_READ_ACCESS )
|
set(CMAKE_ALLOW_UNKNOWN_VARIABLE_READ_ACCESS )
|
||||||
ENDMACRO(CHECK_TYPE_SIZE)
|
endmacro(CHECK_TYPE_SIZE)
|
||||||
|
|||||||
@@ -12,43 +12,43 @@
|
|||||||
# CMAKE_REQUIRED_INCLUDES = list of include directories
|
# CMAKE_REQUIRED_INCLUDES = list of include directories
|
||||||
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
|
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
|
||||||
|
|
||||||
MACRO(CURL_CHECK_C_SOURCE_COMPILES SOURCE VAR)
|
macro(CURL_CHECK_C_SOURCE_COMPILES SOURCE VAR)
|
||||||
IF("${VAR}" MATCHES "^${VAR}$" OR "${VAR}" MATCHES "UNKNOWN")
|
if("${VAR}" MATCHES "^${VAR}$" OR "${VAR}" MATCHES "UNKNOWN")
|
||||||
SET(message "${VAR}")
|
set(message "${VAR}")
|
||||||
# If the number of arguments is greater than 2 (SOURCE VAR)
|
# If the number of arguments is greater than 2 (SOURCE VAR)
|
||||||
IF(${ARGC} GREATER 2)
|
if(${ARGC} GREATER 2)
|
||||||
# then add the third argument as a message
|
# then add the third argument as a message
|
||||||
SET(message "${ARGV2} (${VAR})")
|
set(message "${ARGV2} (${VAR})")
|
||||||
ENDIF(${ARGC} GREATER 2)
|
endif(${ARGC} GREATER 2)
|
||||||
SET(MACRO_CHECK_FUNCTION_DEFINITIONS
|
set(MACRO_CHECK_FUNCTION_DEFINITIONS
|
||||||
"-D${VAR} ${CMAKE_REQUIRED_FLAGS}")
|
"-D${VAR} ${CMAKE_REQUIRED_FLAGS}")
|
||||||
IF(CMAKE_REQUIRED_LIBRARIES)
|
if(CMAKE_REQUIRED_LIBRARIES)
|
||||||
SET(CURL_CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES
|
set(CURL_CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES
|
||||||
"-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
|
"-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
|
||||||
ELSE(CMAKE_REQUIRED_LIBRARIES)
|
else(CMAKE_REQUIRED_LIBRARIES)
|
||||||
SET(CURL_CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES)
|
set(CURL_CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES)
|
||||||
ENDIF(CMAKE_REQUIRED_LIBRARIES)
|
endif(CMAKE_REQUIRED_LIBRARIES)
|
||||||
IF(CMAKE_REQUIRED_INCLUDES)
|
if(CMAKE_REQUIRED_INCLUDES)
|
||||||
SET(CURL_CHECK_C_SOURCE_COMPILES_ADD_INCLUDES
|
set(CURL_CHECK_C_SOURCE_COMPILES_ADD_INCLUDES
|
||||||
"-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}")
|
"-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}")
|
||||||
ELSE(CMAKE_REQUIRED_INCLUDES)
|
else(CMAKE_REQUIRED_INCLUDES)
|
||||||
SET(CURL_CHECK_C_SOURCE_COMPILES_ADD_INCLUDES)
|
set(CURL_CHECK_C_SOURCE_COMPILES_ADD_INCLUDES)
|
||||||
ENDIF(CMAKE_REQUIRED_INCLUDES)
|
endif(CMAKE_REQUIRED_INCLUDES)
|
||||||
SET(src "")
|
set(src "")
|
||||||
FOREACH(def ${EXTRA_DEFINES})
|
foreach(def ${EXTRA_DEFINES})
|
||||||
SET(src "${src}#define ${def} 1\n")
|
set(src "${src}#define ${def} 1\n")
|
||||||
ENDFOREACH(def)
|
endforeach(def)
|
||||||
FOREACH(inc ${HEADER_INCLUDES})
|
foreach(inc ${HEADER_INCLUDES})
|
||||||
SET(src "${src}#include <${inc}>\n")
|
set(src "${src}#include <${inc}>\n")
|
||||||
ENDFOREACH(inc)
|
endforeach(inc)
|
||||||
|
|
||||||
SET(src "${src}\nint main() { ${SOURCE} ; return 0; }")
|
set(src "${src}\nint main() { ${SOURCE} ; return 0; }")
|
||||||
SET(CMAKE_CONFIGURABLE_FILE_CONTENT "${src}")
|
set(CMAKE_CONFIGURABLE_FILE_CONTENT "${src}")
|
||||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/CMake/CMakeConfigurableFile.in
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMake/CMakeConfigurableFile.in
|
||||||
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c"
|
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c"
|
||||||
IMMEDIATE)
|
IMMEDIATE)
|
||||||
MESSAGE(STATUS "Performing Test ${message}")
|
message(STATUS "Performing Test ${message}")
|
||||||
TRY_COMPILE(${VAR}
|
try_compile(${VAR}
|
||||||
${CMAKE_BINARY_DIR}
|
${CMAKE_BINARY_DIR}
|
||||||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c
|
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c
|
||||||
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
|
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
|
||||||
@@ -56,20 +56,20 @@ MACRO(CURL_CHECK_C_SOURCE_COMPILES SOURCE VAR)
|
|||||||
"${CURL_CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES}"
|
"${CURL_CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES}"
|
||||||
"${CURL_CHECK_C_SOURCE_COMPILES_ADD_INCLUDES}"
|
"${CURL_CHECK_C_SOURCE_COMPILES_ADD_INCLUDES}"
|
||||||
OUTPUT_VARIABLE OUTPUT)
|
OUTPUT_VARIABLE OUTPUT)
|
||||||
IF(${VAR})
|
if(${VAR})
|
||||||
SET(${VAR} 1 CACHE INTERNAL "Test ${message}")
|
set(${VAR} 1 CACHE INTERNAL "Test ${message}")
|
||||||
MESSAGE(STATUS "Performing Test ${message} - Success")
|
message(STATUS "Performing Test ${message} - Success")
|
||||||
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
||||||
"Performing C SOURCE FILE Test ${message} succeded with the following output:\n"
|
"Performing C SOURCE FILE Test ${message} succeded with the following output:\n"
|
||||||
"${OUTPUT}\n"
|
"${OUTPUT}\n"
|
||||||
"Source file was:\n${src}\n")
|
"Source file was:\n${src}\n")
|
||||||
ELSE(${VAR})
|
else(${VAR})
|
||||||
MESSAGE(STATUS "Performing Test ${message} - Failed")
|
message(STATUS "Performing Test ${message} - Failed")
|
||||||
SET(${VAR} "" CACHE INTERNAL "Test ${message}")
|
set(${VAR} "" CACHE INTERNAL "Test ${message}")
|
||||||
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
|
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
|
||||||
"Performing C SOURCE FILE Test ${message} failed with the following output:\n"
|
"Performing C SOURCE FILE Test ${message} failed with the following output:\n"
|
||||||
"${OUTPUT}\n"
|
"${OUTPUT}\n"
|
||||||
"Source file was:\n${src}\n")
|
"Source file was:\n${src}\n")
|
||||||
ENDIF(${VAR})
|
endif(${VAR})
|
||||||
ENDIF("${VAR}" MATCHES "^${VAR}$" OR "${VAR}" MATCHES "UNKNOWN")
|
endif("${VAR}" MATCHES "^${VAR}$" OR "${VAR}" MATCHES "UNKNOWN")
|
||||||
ENDMACRO(CURL_CHECK_C_SOURCE_COMPILES)
|
endmacro(CURL_CHECK_C_SOURCE_COMPILES)
|
||||||
|
|||||||
@@ -12,43 +12,43 @@
|
|||||||
# CMAKE_REQUIRED_INCLUDES = list of include directories
|
# CMAKE_REQUIRED_INCLUDES = list of include directories
|
||||||
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
|
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
|
||||||
|
|
||||||
MACRO(CURL_CHECK_C_SOURCE_RUNS SOURCE VAR)
|
macro(CURL_CHECK_C_SOURCE_RUNS SOURCE VAR)
|
||||||
IF("${VAR}" MATCHES "^${VAR}$" OR "${VAR}" MATCHES "UNKNOWN")
|
if("${VAR}" MATCHES "^${VAR}$" OR "${VAR}" MATCHES "UNKNOWN")
|
||||||
SET(message "${VAR}")
|
set(message "${VAR}")
|
||||||
# If the number of arguments is greater than 2 (SOURCE VAR)
|
# If the number of arguments is greater than 2 (SOURCE VAR)
|
||||||
IF(${ARGC} GREATER 2)
|
if(${ARGC} GREATER 2)
|
||||||
# then add the third argument as a message
|
# then add the third argument as a message
|
||||||
SET(message "${ARGV2} (${VAR})")
|
set(message "${ARGV2} (${VAR})")
|
||||||
ENDIF(${ARGC} GREATER 2)
|
endif(${ARGC} GREATER 2)
|
||||||
SET(MACRO_CHECK_FUNCTION_DEFINITIONS
|
set(MACRO_CHECK_FUNCTION_DEFINITIONS
|
||||||
"-D${VAR} ${CMAKE_REQUIRED_FLAGS}")
|
"-D${VAR} ${CMAKE_REQUIRED_FLAGS}")
|
||||||
IF(CMAKE_REQUIRED_LIBRARIES)
|
if(CMAKE_REQUIRED_LIBRARIES)
|
||||||
SET(CURL_CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES
|
set(CURL_CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES
|
||||||
"-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
|
"-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
|
||||||
ELSE(CMAKE_REQUIRED_LIBRARIES)
|
else(CMAKE_REQUIRED_LIBRARIES)
|
||||||
SET(CURL_CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES)
|
set(CURL_CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES)
|
||||||
ENDIF(CMAKE_REQUIRED_LIBRARIES)
|
endif(CMAKE_REQUIRED_LIBRARIES)
|
||||||
IF(CMAKE_REQUIRED_INCLUDES)
|
if(CMAKE_REQUIRED_INCLUDES)
|
||||||
SET(CURL_CHECK_C_SOURCE_COMPILES_ADD_INCLUDES
|
set(CURL_CHECK_C_SOURCE_COMPILES_ADD_INCLUDES
|
||||||
"-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}")
|
"-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}")
|
||||||
ELSE(CMAKE_REQUIRED_INCLUDES)
|
else(CMAKE_REQUIRED_INCLUDES)
|
||||||
SET(CURL_CHECK_C_SOURCE_COMPILES_ADD_INCLUDES)
|
set(CURL_CHECK_C_SOURCE_COMPILES_ADD_INCLUDES)
|
||||||
ENDIF(CMAKE_REQUIRED_INCLUDES)
|
endif(CMAKE_REQUIRED_INCLUDES)
|
||||||
SET(src "")
|
set(src "")
|
||||||
FOREACH(def ${EXTRA_DEFINES})
|
foreach(def ${EXTRA_DEFINES})
|
||||||
SET(src "${src}#define ${def} 1\n")
|
set(src "${src}#define ${def} 1\n")
|
||||||
ENDFOREACH(def)
|
endforeach(def)
|
||||||
FOREACH(inc ${HEADER_INCLUDES})
|
foreach(inc ${HEADER_INCLUDES})
|
||||||
SET(src "${src}#include <${inc}>\n")
|
set(src "${src}#include <${inc}>\n")
|
||||||
ENDFOREACH(inc)
|
endforeach(inc)
|
||||||
|
|
||||||
SET(src "${src}\nint main() { ${SOURCE} ; return 0; }")
|
set(src "${src}\nint main() { ${SOURCE} ; return 0; }")
|
||||||
SET(CMAKE_CONFIGURABLE_FILE_CONTENT "${src}")
|
set(CMAKE_CONFIGURABLE_FILE_CONTENT "${src}")
|
||||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/CMake/CMakeConfigurableFile.in
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMake/CMakeConfigurableFile.in
|
||||||
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c"
|
"${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c"
|
||||||
IMMEDIATE)
|
IMMEDIATE)
|
||||||
MESSAGE(STATUS "Performing Test ${message}")
|
message(STATUS "Performing Test ${message}")
|
||||||
TRY_RUN(${VAR} ${VAR}_COMPILED
|
try_run(${VAR} ${VAR}_COMPILED
|
||||||
${CMAKE_BINARY_DIR}
|
${CMAKE_BINARY_DIR}
|
||||||
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c
|
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c
|
||||||
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
|
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
|
||||||
@@ -57,27 +57,27 @@ MACRO(CURL_CHECK_C_SOURCE_RUNS SOURCE VAR)
|
|||||||
"${CURL_CHECK_C_SOURCE_COMPILES_ADD_INCLUDES}"
|
"${CURL_CHECK_C_SOURCE_COMPILES_ADD_INCLUDES}"
|
||||||
OUTPUT_VARIABLE OUTPUT)
|
OUTPUT_VARIABLE OUTPUT)
|
||||||
# if it did not compile make the return value fail code of 1
|
# if it did not compile make the return value fail code of 1
|
||||||
IF(NOT ${VAR}_COMPILED)
|
if(NOT ${VAR}_COMPILED)
|
||||||
SET(${VAR} 1)
|
set(${VAR} 1)
|
||||||
ENDIF(NOT ${VAR}_COMPILED)
|
endif(NOT ${VAR}_COMPILED)
|
||||||
# if the return value was 0 then it worked
|
# if the return value was 0 then it worked
|
||||||
SET(result_var ${${VAR}})
|
set(result_var ${${VAR}})
|
||||||
IF("${result_var}" EQUAL 0)
|
if("${result_var}" EQUAL 0)
|
||||||
SET(${VAR} 1 CACHE INTERNAL "Test ${message}")
|
set(${VAR} 1 CACHE INTERNAL "Test ${message}")
|
||||||
MESSAGE(STATUS "Performing Test ${message} - Success")
|
message(STATUS "Performing Test ${message} - Success")
|
||||||
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
||||||
"Performing C SOURCE FILE Test ${message} succeded with the following output:\n"
|
"Performing C SOURCE FILE Test ${message} succeded with the following output:\n"
|
||||||
"${OUTPUT}\n"
|
"${OUTPUT}\n"
|
||||||
"Return value: ${${VAR}}\n"
|
"Return value: ${${VAR}}\n"
|
||||||
"Source file was:\n${src}\n")
|
"Source file was:\n${src}\n")
|
||||||
ELSE("${result_var}" EQUAL 0)
|
else("${result_var}" EQUAL 0)
|
||||||
MESSAGE(STATUS "Performing Test ${message} - Failed")
|
message(STATUS "Performing Test ${message} - Failed")
|
||||||
SET(${VAR} "" CACHE INTERNAL "Test ${message}")
|
set(${VAR} "" CACHE INTERNAL "Test ${message}")
|
||||||
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
|
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
|
||||||
"Performing C SOURCE FILE Test ${message} failed with the following output:\n"
|
"Performing C SOURCE FILE Test ${message} failed with the following output:\n"
|
||||||
"${OUTPUT}\n"
|
"${OUTPUT}\n"
|
||||||
"Return value: ${result_var}\n"
|
"Return value: ${result_var}\n"
|
||||||
"Source file was:\n${src}\n")
|
"Source file was:\n${src}\n")
|
||||||
ENDIF("${result_var}" EQUAL 0)
|
endif("${result_var}" EQUAL 0)
|
||||||
ENDIF("${VAR}" MATCHES "^${VAR}$" OR "${VAR}" MATCHES "UNKNOWN")
|
endif("${VAR}" MATCHES "^${VAR}$" OR "${VAR}" MATCHES "UNKNOWN")
|
||||||
ENDMACRO(CURL_CHECK_C_SOURCE_RUNS)
|
endmacro(CURL_CHECK_C_SOURCE_RUNS)
|
||||||
|
|||||||
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
|
||||||
|
)
|
||||||
@@ -1,19 +1,19 @@
|
|||||||
# Extension of the standard FindOpenSSL.cmake
|
# Extension of the standard FindOpenSSL.cmake
|
||||||
# Adds OPENSSL_INCLUDE_DIRS and libeay32
|
# Adds OPENSSL_INCLUDE_DIRS and libeay32
|
||||||
INCLUDE("${CMAKE_ROOT}/Modules/FindOpenSSL.cmake")
|
include("${CMAKE_ROOT}/Modules/FindOpenSSL.cmake")
|
||||||
|
|
||||||
# Bill Hoffman told that libeay32 is necessary for him:
|
# Bill Hoffman told that libeay32 is necessary for him:
|
||||||
FIND_LIBRARY(SSL_LIBEAY NAMES libeay32)
|
find_library(SSL_LIBEAY NAMES libeay32)
|
||||||
|
|
||||||
IF(OPENSSL_FOUND)
|
if(OPENSSL_FOUND)
|
||||||
IF(SSL_LIBEAY)
|
if(SSL_LIBEAY)
|
||||||
LIST(APPEND OPENSSL_LIBRARIES ${SSL_LIBEAY})
|
list(APPEND OPENSSL_LIBRARIES ${SSL_LIBEAY})
|
||||||
ELSE()
|
else()
|
||||||
SET(OPENSSL_FOUND FALSE)
|
set(OPENSSL_FOUND FALSE)
|
||||||
ENDIF()
|
endif()
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
IF(OPENSSL_FOUND)
|
if(OPENSSL_FOUND)
|
||||||
SET(OPENSSL_INCLUDE_DIRS ${OPENSSL_INCLUDE_DIR})
|
set(OPENSSL_INCLUDE_DIRS ${OPENSSL_INCLUDE_DIR})
|
||||||
ENDIF()
|
endif()
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
# Locate zlib
|
# Locate zlib
|
||||||
INCLUDE("${CMAKE_ROOT}/Modules/FindZLIB.cmake")
|
include("${CMAKE_ROOT}/Modules/FindZLIB.cmake")
|
||||||
|
|
||||||
FIND_LIBRARY(ZLIB_LIBRARY_DEBUG NAMES zd zlibd zdlld zlib1d )
|
find_library(ZLIB_LIBRARY_DEBUG NAMES zd zlibd zdlld zlib1d )
|
||||||
|
|
||||||
IF(ZLIB_FOUND AND ZLIB_LIBRARY_DEBUG)
|
if(ZLIB_FOUND AND ZLIB_LIBRARY_DEBUG)
|
||||||
SET( ZLIB_LIBRARIES optimized "${ZLIB_LIBRARY}" debug ${ZLIB_LIBRARY_DEBUG})
|
set( ZLIB_LIBRARIES optimized "${ZLIB_LIBRARY}" debug ${ZLIB_LIBRARY_DEBUG})
|
||||||
ENDIF()
|
endif()
|
||||||
|
|||||||
@@ -1,50 +1,50 @@
|
|||||||
INCLUDE(CurlCheckCSourceCompiles)
|
include(CurlCheckCSourceCompiles)
|
||||||
SET(EXTRA_DEFINES "__unused1\n#undef inline\n#define __unused2")
|
set(EXTRA_DEFINES "__unused1\n#undef inline\n#define __unused2")
|
||||||
SET(HEADER_INCLUDES)
|
set(HEADER_INCLUDES)
|
||||||
SET(headers_hack)
|
set(headers_hack)
|
||||||
|
|
||||||
MACRO(add_header_include check header)
|
macro(add_header_include check header)
|
||||||
IF(${check})
|
if(${check})
|
||||||
SET(headers_hack
|
set(headers_hack
|
||||||
"${headers_hack}\n#include <${header}>")
|
"${headers_hack}\n#include <${header}>")
|
||||||
#SET(HEADER_INCLUDES
|
#SET(HEADER_INCLUDES
|
||||||
# ${HEADER_INCLUDES}
|
# ${HEADER_INCLUDES}
|
||||||
# "${header}")
|
# "${header}")
|
||||||
ENDIF(${check})
|
endif(${check})
|
||||||
ENDMACRO(add_header_include)
|
endmacro(add_header_include)
|
||||||
|
|
||||||
SET(signature_call_conv)
|
set(signature_call_conv)
|
||||||
IF(HAVE_WINDOWS_H)
|
if(HAVE_WINDOWS_H)
|
||||||
add_header_include(HAVE_WINDOWS_H "windows.h")
|
add_header_include(HAVE_WINDOWS_H "windows.h")
|
||||||
add_header_include(HAVE_WINSOCK2_H "winsock2.h")
|
add_header_include(HAVE_WINSOCK2_H "winsock2.h")
|
||||||
add_header_include(HAVE_WINSOCK_H "winsock.h")
|
add_header_include(HAVE_WINSOCK_H "winsock.h")
|
||||||
SET(EXTRA_DEFINES ${EXTRA_DEFINES}
|
set(EXTRA_DEFINES ${EXTRA_DEFINES}
|
||||||
"__unused7\n#ifndef WIN32_LEAN_AND_MEAN\n#define WIN32_LEAN_AND_MEAN\n#endif\n#define __unused3")
|
"__unused7\n#ifndef WIN32_LEAN_AND_MEAN\n#define WIN32_LEAN_AND_MEAN\n#endif\n#define __unused3")
|
||||||
SET(signature_call_conv "PASCAL")
|
set(signature_call_conv "PASCAL")
|
||||||
ELSE(HAVE_WINDOWS_H)
|
else(HAVE_WINDOWS_H)
|
||||||
add_header_include(HAVE_SYS_TYPES_H "sys/types.h")
|
add_header_include(HAVE_SYS_TYPES_H "sys/types.h")
|
||||||
add_header_include(HAVE_SYS_SOCKET_H "sys/socket.h")
|
add_header_include(HAVE_SYS_SOCKET_H "sys/socket.h")
|
||||||
ENDIF(HAVE_WINDOWS_H)
|
endif(HAVE_WINDOWS_H)
|
||||||
|
|
||||||
SET(EXTRA_DEFINES_BACKUP "${EXTRA_DEFINES}")
|
set(EXTRA_DEFINES_BACKUP "${EXTRA_DEFINES}")
|
||||||
SET(EXTRA_DEFINES "${EXTRA_DEFINES_BACKUP}\n${headers_hack}\n${extern_line}\n#define __unused5")
|
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)
|
curl_check_c_source_compiles("recv(0, 0, 0, 0)" curl_cv_recv)
|
||||||
IF(curl_cv_recv)
|
if(curl_cv_recv)
|
||||||
# AC_CACHE_CHECK([types of arguments and return type for recv],
|
# AC_CACHE_CHECK([types of arguments and return type for recv],
|
||||||
#[curl_cv_func_recv_args], [
|
#[curl_cv_func_recv_args], [
|
||||||
#SET(curl_cv_func_recv_args "unknown")
|
#SET(curl_cv_func_recv_args "unknown")
|
||||||
#for recv_retv in 'int' 'ssize_t'; do
|
#for recv_retv in 'int' 'ssize_t'; do
|
||||||
IF(NOT DEFINED curl_cv_func_recv_args OR "${curl_cv_func_recv_args}" STREQUAL "unknown")
|
if(NOT DEFINED curl_cv_func_recv_args OR "${curl_cv_func_recv_args}" STREQUAL "unknown")
|
||||||
FOREACH(recv_retv "int" "ssize_t" )
|
foreach(recv_retv "int" "ssize_t" )
|
||||||
FOREACH(recv_arg1 "int" "ssize_t" "SOCKET")
|
foreach(recv_arg1 "int" "ssize_t" "SOCKET")
|
||||||
FOREACH(recv_arg2 "void *" "char *")
|
foreach(recv_arg2 "void *" "char *")
|
||||||
FOREACH(recv_arg3 "size_t" "int" "socklen_t" "unsigned int")
|
foreach(recv_arg3 "size_t" "int" "socklen_t" "unsigned int")
|
||||||
FOREACH(recv_arg4 "int" "unsigned int")
|
foreach(recv_arg4 "int" "unsigned int")
|
||||||
IF(NOT curl_cv_func_recv_done)
|
if(NOT curl_cv_func_recv_done)
|
||||||
SET(curl_cv_func_recv_test "UNKNOWN")
|
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(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")
|
set(EXTRA_DEFINES "${EXTRA_DEFINES_BACKUP}\n${headers_hack}\n${extern_line}\n#define __unused5")
|
||||||
CURL_CHECK_C_SOURCE_COMPILES("
|
curl_check_c_source_compiles("
|
||||||
${recv_arg1} s=0;
|
${recv_arg1} s=0;
|
||||||
${recv_arg2} buf=0;
|
${recv_arg2} buf=0;
|
||||||
${recv_arg3} len=0;
|
${recv_arg3} len=0;
|
||||||
@@ -52,62 +52,62 @@ IF(curl_cv_recv)
|
|||||||
${recv_retv} res = recv(s, buf, len, flags)"
|
${recv_retv} res = recv(s, buf, len, flags)"
|
||||||
curl_cv_func_recv_test
|
curl_cv_func_recv_test
|
||||||
"${recv_retv} recv(${recv_arg1}, ${recv_arg2}, ${recv_arg3}, ${recv_arg4})")
|
"${recv_retv} recv(${recv_arg1}, ${recv_arg2}, ${recv_arg3}, ${recv_arg4})")
|
||||||
IF(curl_cv_func_recv_test)
|
if(curl_cv_func_recv_test)
|
||||||
SET(curl_cv_func_recv_args
|
set(curl_cv_func_recv_args
|
||||||
"${recv_arg1},${recv_arg2},${recv_arg3},${recv_arg4},${recv_retv}")
|
"${recv_arg1},${recv_arg2},${recv_arg3},${recv_arg4},${recv_retv}")
|
||||||
SET(RECV_TYPE_ARG1 "${recv_arg1}")
|
set(RECV_TYPE_ARG1 "${recv_arg1}")
|
||||||
SET(RECV_TYPE_ARG2 "${recv_arg2}")
|
set(RECV_TYPE_ARG2 "${recv_arg2}")
|
||||||
SET(RECV_TYPE_ARG3 "${recv_arg3}")
|
set(RECV_TYPE_ARG3 "${recv_arg3}")
|
||||||
SET(RECV_TYPE_ARG4 "${recv_arg4}")
|
set(RECV_TYPE_ARG4 "${recv_arg4}")
|
||||||
SET(RECV_TYPE_RETV "${recv_retv}")
|
set(RECV_TYPE_RETV "${recv_retv}")
|
||||||
SET(HAVE_RECV 1)
|
set(HAVE_RECV 1)
|
||||||
SET(curl_cv_func_recv_done 1)
|
set(curl_cv_func_recv_done 1)
|
||||||
ENDIF(curl_cv_func_recv_test)
|
endif(curl_cv_func_recv_test)
|
||||||
ENDIF(NOT curl_cv_func_recv_done)
|
endif(NOT curl_cv_func_recv_done)
|
||||||
ENDFOREACH(recv_arg4)
|
endforeach(recv_arg4)
|
||||||
ENDFOREACH(recv_arg3)
|
endforeach(recv_arg3)
|
||||||
ENDFOREACH(recv_arg2)
|
endforeach(recv_arg2)
|
||||||
ENDFOREACH(recv_arg1)
|
endforeach(recv_arg1)
|
||||||
ENDFOREACH(recv_retv)
|
endforeach(recv_retv)
|
||||||
ELSE(NOT DEFINED curl_cv_func_recv_args OR "${curl_cv_func_recv_args}" STREQUAL "unknown")
|
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_ARG1 "${curl_cv_func_recv_args}")
|
||||||
STRING(REGEX REPLACE "^[^,]*,([^,]*),[^,]*,[^,]*,[^,]*$" "\\1" RECV_TYPE_ARG2 "${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_ARG3 "${curl_cv_func_recv_args}")
|
||||||
STRING(REGEX REPLACE "^[^,]*,[^,]*,[^,]*,([^,]*),[^,]*$" "\\1" RECV_TYPE_ARG4 "${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}")
|
string(REGEX REPLACE "^[^,]*,[^,]*,[^,]*,[^,]*,([^,]*)$" "\\1" RECV_TYPE_RETV "${curl_cv_func_recv_args}")
|
||||||
#MESSAGE("RECV_TYPE_ARG1 ${RECV_TYPE_ARG1}")
|
#MESSAGE("RECV_TYPE_ARG1 ${RECV_TYPE_ARG1}")
|
||||||
#MESSAGE("RECV_TYPE_ARG2 ${RECV_TYPE_ARG2}")
|
#MESSAGE("RECV_TYPE_ARG2 ${RECV_TYPE_ARG2}")
|
||||||
#MESSAGE("RECV_TYPE_ARG3 ${RECV_TYPE_ARG3}")
|
#MESSAGE("RECV_TYPE_ARG3 ${RECV_TYPE_ARG3}")
|
||||||
#MESSAGE("RECV_TYPE_ARG4 ${RECV_TYPE_ARG4}")
|
#MESSAGE("RECV_TYPE_ARG4 ${RECV_TYPE_ARG4}")
|
||||||
#MESSAGE("RECV_TYPE_RETV ${RECV_TYPE_RETV}")
|
#MESSAGE("RECV_TYPE_RETV ${RECV_TYPE_RETV}")
|
||||||
ENDIF(NOT DEFINED curl_cv_func_recv_args OR "${curl_cv_func_recv_args}" STREQUAL "unknown")
|
endif(NOT DEFINED curl_cv_func_recv_args OR "${curl_cv_func_recv_args}" STREQUAL "unknown")
|
||||||
|
|
||||||
IF("${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")
|
message(FATAL_ERROR "Cannot find proper types to use for recv args")
|
||||||
ENDIF("${curl_cv_func_recv_args}" STREQUAL "unknown")
|
endif("${curl_cv_func_recv_args}" STREQUAL "unknown")
|
||||||
ELSE(curl_cv_recv)
|
else(curl_cv_recv)
|
||||||
MESSAGE(FATAL_ERROR "Unable to link function recv")
|
message(FATAL_ERROR "Unable to link function recv")
|
||||||
ENDIF(curl_cv_recv)
|
endif(curl_cv_recv)
|
||||||
SET(curl_cv_func_recv_args "${curl_cv_func_recv_args}" CACHE INTERNAL "Arguments for recv")
|
set(curl_cv_func_recv_args "${curl_cv_func_recv_args}" CACHE INTERNAL "Arguments for recv")
|
||||||
SET(HAVE_RECV 1)
|
set(HAVE_RECV 1)
|
||||||
|
|
||||||
CURL_CHECK_C_SOURCE_COMPILES("send(0, 0, 0, 0)" curl_cv_send)
|
curl_check_c_source_compiles("send(0, 0, 0, 0)" curl_cv_send)
|
||||||
IF(curl_cv_send)
|
if(curl_cv_send)
|
||||||
# AC_CACHE_CHECK([types of arguments and return type for send],
|
# AC_CACHE_CHECK([types of arguments and return type for send],
|
||||||
#[curl_cv_func_send_args], [
|
#[curl_cv_func_send_args], [
|
||||||
#SET(curl_cv_func_send_args "unknown")
|
#SET(curl_cv_func_send_args "unknown")
|
||||||
#for send_retv in 'int' 'ssize_t'; do
|
#for send_retv in 'int' 'ssize_t'; do
|
||||||
IF(NOT DEFINED curl_cv_func_send_args OR "${curl_cv_func_send_args}" STREQUAL "unknown")
|
if(NOT DEFINED curl_cv_func_send_args OR "${curl_cv_func_send_args}" STREQUAL "unknown")
|
||||||
FOREACH(send_retv "int" "ssize_t" )
|
foreach(send_retv "int" "ssize_t" )
|
||||||
FOREACH(send_arg1 "int" "ssize_t" "SOCKET")
|
foreach(send_arg1 "int" "ssize_t" "SOCKET")
|
||||||
FOREACH(send_arg2 "const void *" "void *" "char *" "const char *")
|
foreach(send_arg2 "const void *" "void *" "char *" "const char *")
|
||||||
FOREACH(send_arg3 "size_t" "int" "socklen_t" "unsigned int")
|
foreach(send_arg3 "size_t" "int" "socklen_t" "unsigned int")
|
||||||
FOREACH(send_arg4 "int" "unsigned int")
|
foreach(send_arg4 "int" "unsigned int")
|
||||||
IF(NOT curl_cv_func_send_done)
|
if(NOT curl_cv_func_send_done)
|
||||||
SET(curl_cv_func_send_test "UNKNOWN")
|
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(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")
|
set(EXTRA_DEFINES "${EXTRA_DEFINES_BACKUP}\n${headers_hack}\n${extern_line}\n#define __unused5")
|
||||||
CURL_CHECK_C_SOURCE_COMPILES("
|
curl_check_c_source_compiles("
|
||||||
${send_arg1} s=0;
|
${send_arg1} s=0;
|
||||||
${send_arg2} buf=0;
|
${send_arg2} buf=0;
|
||||||
${send_arg3} len=0;
|
${send_arg3} len=0;
|
||||||
@@ -115,136 +115,136 @@ IF(curl_cv_send)
|
|||||||
${send_retv} res = send(s, buf, len, flags)"
|
${send_retv} res = send(s, buf, len, flags)"
|
||||||
curl_cv_func_send_test
|
curl_cv_func_send_test
|
||||||
"${send_retv} send(${send_arg1}, ${send_arg2}, ${send_arg3}, ${send_arg4})")
|
"${send_retv} send(${send_arg1}, ${send_arg2}, ${send_arg3}, ${send_arg4})")
|
||||||
IF(curl_cv_func_send_test)
|
if(curl_cv_func_send_test)
|
||||||
#MESSAGE("Found arguments: ${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_qual_arg2 "${send_arg2}")
|
||||||
STRING(REGEX REPLACE "const (.*)" "\\1" send_arg2 "${send_arg2}")
|
string(REGEX REPLACE "const (.*)" "\\1" send_arg2 "${send_arg2}")
|
||||||
SET(curl_cv_func_send_args
|
set(curl_cv_func_send_args
|
||||||
"${send_arg1},${send_arg2},${send_arg3},${send_arg4},${send_retv},${send_qual_arg2}")
|
"${send_arg1},${send_arg2},${send_arg3},${send_arg4},${send_retv},${send_qual_arg2}")
|
||||||
SET(SEND_TYPE_ARG1 "${send_arg1}")
|
set(SEND_TYPE_ARG1 "${send_arg1}")
|
||||||
SET(SEND_TYPE_ARG2 "${send_arg2}")
|
set(SEND_TYPE_ARG2 "${send_arg2}")
|
||||||
SET(SEND_TYPE_ARG3 "${send_arg3}")
|
set(SEND_TYPE_ARG3 "${send_arg3}")
|
||||||
SET(SEND_TYPE_ARG4 "${send_arg4}")
|
set(SEND_TYPE_ARG4 "${send_arg4}")
|
||||||
SET(SEND_TYPE_RETV "${send_retv}")
|
set(SEND_TYPE_RETV "${send_retv}")
|
||||||
SET(HAVE_SEND 1)
|
set(HAVE_SEND 1)
|
||||||
SET(curl_cv_func_send_done 1)
|
set(curl_cv_func_send_done 1)
|
||||||
ENDIF(curl_cv_func_send_test)
|
endif(curl_cv_func_send_test)
|
||||||
ENDIF(NOT curl_cv_func_send_done)
|
endif(NOT curl_cv_func_send_done)
|
||||||
ENDFOREACH(send_arg4)
|
endforeach(send_arg4)
|
||||||
ENDFOREACH(send_arg3)
|
endforeach(send_arg3)
|
||||||
ENDFOREACH(send_arg2)
|
endforeach(send_arg2)
|
||||||
ENDFOREACH(send_arg1)
|
endforeach(send_arg1)
|
||||||
ENDFOREACH(send_retv)
|
endforeach(send_retv)
|
||||||
ELSE(NOT DEFINED curl_cv_func_send_args OR "${curl_cv_func_send_args}" STREQUAL "unknown")
|
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_ARG1 "${curl_cv_func_send_args}")
|
||||||
STRING(REGEX REPLACE "^[^,]*,([^,]*),[^,]*,[^,]*,[^,]*,[^,]*$" "\\1" SEND_TYPE_ARG2 "${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_ARG3 "${curl_cv_func_send_args}")
|
||||||
STRING(REGEX REPLACE "^[^,]*,[^,]*,[^,]*,([^,]*),[^,]*,[^,]*$" "\\1" SEND_TYPE_ARG4 "${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_TYPE_RETV "${curl_cv_func_send_args}")
|
||||||
STRING(REGEX REPLACE "^[^,]*,[^,]*,[^,]*,[^,]*,[^,]*,([^,]*)$" "\\1" SEND_QUAL_ARG2 "${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_ARG1 ${SEND_TYPE_ARG1}")
|
||||||
#MESSAGE("SEND_TYPE_ARG2 ${SEND_TYPE_ARG2}")
|
#MESSAGE("SEND_TYPE_ARG2 ${SEND_TYPE_ARG2}")
|
||||||
#MESSAGE("SEND_TYPE_ARG3 ${SEND_TYPE_ARG3}")
|
#MESSAGE("SEND_TYPE_ARG3 ${SEND_TYPE_ARG3}")
|
||||||
#MESSAGE("SEND_TYPE_ARG4 ${SEND_TYPE_ARG4}")
|
#MESSAGE("SEND_TYPE_ARG4 ${SEND_TYPE_ARG4}")
|
||||||
#MESSAGE("SEND_TYPE_RETV ${SEND_TYPE_RETV}")
|
#MESSAGE("SEND_TYPE_RETV ${SEND_TYPE_RETV}")
|
||||||
#MESSAGE("SEND_QUAL_ARG2 ${SEND_QUAL_ARG2}")
|
#MESSAGE("SEND_QUAL_ARG2 ${SEND_QUAL_ARG2}")
|
||||||
ENDIF(NOT DEFINED curl_cv_func_send_args OR "${curl_cv_func_send_args}" STREQUAL "unknown")
|
endif(NOT DEFINED curl_cv_func_send_args OR "${curl_cv_func_send_args}" STREQUAL "unknown")
|
||||||
|
|
||||||
IF("${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")
|
message(FATAL_ERROR "Cannot find proper types to use for send args")
|
||||||
ENDIF("${curl_cv_func_send_args}" STREQUAL "unknown")
|
endif("${curl_cv_func_send_args}" STREQUAL "unknown")
|
||||||
SET(SEND_QUAL_ARG2 "const")
|
set(SEND_QUAL_ARG2 "const")
|
||||||
ELSE(curl_cv_send)
|
else(curl_cv_send)
|
||||||
MESSAGE(FATAL_ERROR "Unable to link function send")
|
message(FATAL_ERROR "Unable to link function send")
|
||||||
ENDIF(curl_cv_send)
|
endif(curl_cv_send)
|
||||||
SET(curl_cv_func_send_args "${curl_cv_func_send_args}" CACHE INTERNAL "Arguments for send")
|
set(curl_cv_func_send_args "${curl_cv_func_send_args}" CACHE INTERNAL "Arguments for send")
|
||||||
SET(HAVE_SEND 1)
|
set(HAVE_SEND 1)
|
||||||
|
|
||||||
SET(EXTRA_DEFINES "${EXTRA_DEFINES}\n${headers_hack}\n#define __unused5")
|
set(EXTRA_DEFINES "${EXTRA_DEFINES}\n${headers_hack}\n#define __unused5")
|
||||||
CURL_CHECK_C_SOURCE_COMPILES("int flag = MSG_NOSIGNAL" HAVE_MSG_NOSIGNAL)
|
curl_check_c_source_compiles("int flag = MSG_NOSIGNAL" HAVE_MSG_NOSIGNAL)
|
||||||
|
|
||||||
SET(EXTRA_DEFINES "__unused1\n#undef inline\n#define __unused2")
|
set(EXTRA_DEFINES "__unused1\n#undef inline\n#define __unused2")
|
||||||
SET(HEADER_INCLUDES)
|
set(HEADER_INCLUDES)
|
||||||
SET(headers_hack)
|
set(headers_hack)
|
||||||
|
|
||||||
MACRO(add_header_include check header)
|
macro(add_header_include check header)
|
||||||
IF(${check})
|
if(${check})
|
||||||
SET(headers_hack
|
set(headers_hack
|
||||||
"${headers_hack}\n#include <${header}>")
|
"${headers_hack}\n#include <${header}>")
|
||||||
#SET(HEADER_INCLUDES
|
#SET(HEADER_INCLUDES
|
||||||
# ${HEADER_INCLUDES}
|
# ${HEADER_INCLUDES}
|
||||||
# "${header}")
|
# "${header}")
|
||||||
ENDIF(${check})
|
endif(${check})
|
||||||
ENDMACRO(add_header_include header)
|
endmacro(add_header_include header)
|
||||||
|
|
||||||
IF(HAVE_WINDOWS_H)
|
if(HAVE_WINDOWS_H)
|
||||||
SET(EXTRA_DEFINES ${EXTRA_DEFINES}
|
set(EXTRA_DEFINES ${EXTRA_DEFINES}
|
||||||
"__unused7\n#ifndef WIN32_LEAN_AND_MEAN\n#define WIN32_LEAN_AND_MEAN\n#endif\n#define __unused3")
|
"__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_WINDOWS_H "windows.h")
|
||||||
add_header_include(HAVE_WINSOCK2_H "winsock2.h")
|
add_header_include(HAVE_WINSOCK2_H "winsock2.h")
|
||||||
add_header_include(HAVE_WINSOCK_H "winsock.h")
|
add_header_include(HAVE_WINSOCK_H "winsock.h")
|
||||||
ELSE(HAVE_WINDOWS_H)
|
else(HAVE_WINDOWS_H)
|
||||||
add_header_include(HAVE_SYS_TYPES_H "sys/types.h")
|
add_header_include(HAVE_SYS_TYPES_H "sys/types.h")
|
||||||
add_header_include(HAVE_SYS_TIME_H "sys/time.h")
|
add_header_include(HAVE_SYS_TIME_H "sys/time.h")
|
||||||
add_header_include(TIME_WITH_SYS_TIME "time.h")
|
add_header_include(TIME_WITH_SYS_TIME "time.h")
|
||||||
add_header_include(HAVE_TIME_H "time.h")
|
add_header_include(HAVE_TIME_H "time.h")
|
||||||
ENDIF(HAVE_WINDOWS_H)
|
endif(HAVE_WINDOWS_H)
|
||||||
SET(EXTRA_DEFINES "${EXTRA_DEFINES}\n${headers_hack}\n#define __unused5")
|
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)
|
curl_check_c_source_compiles("struct timeval ts;\nts.tv_sec = 0;\nts.tv_usec = 0" HAVE_STRUCT_TIMEVAL)
|
||||||
|
|
||||||
|
|
||||||
INCLUDE(CurlCheckCSourceRuns)
|
include(CurlCheckCSourceRuns)
|
||||||
SET(EXTRA_DEFINES)
|
set(EXTRA_DEFINES)
|
||||||
SET(HEADER_INCLUDES)
|
set(HEADER_INCLUDES)
|
||||||
IF(HAVE_SYS_POLL_H)
|
if(HAVE_SYS_POLL_H)
|
||||||
SET(HEADER_INCLUDES "sys/poll.h")
|
set(HEADER_INCLUDES "sys/poll.h")
|
||||||
ENDIF(HAVE_SYS_POLL_H)
|
endif(HAVE_SYS_POLL_H)
|
||||||
CURL_CHECK_C_SOURCE_RUNS("return poll((void *)0, 0, 10 /*ms*/)" HAVE_POLL_FINE)
|
curl_check_c_source_runs("return poll((void *)0, 0, 10 /*ms*/)" HAVE_POLL_FINE)
|
||||||
|
|
||||||
SET(HAVE_SIG_ATOMIC_T 1)
|
set(HAVE_SIG_ATOMIC_T 1)
|
||||||
SET(EXTRA_DEFINES)
|
set(EXTRA_DEFINES)
|
||||||
SET(HEADER_INCLUDES)
|
set(HEADER_INCLUDES)
|
||||||
IF(HAVE_SIGNAL_H)
|
if(HAVE_SIGNAL_H)
|
||||||
SET(HEADER_INCLUDES "signal.h")
|
set(HEADER_INCLUDES "signal.h")
|
||||||
SET(CMAKE_EXTRA_INCLUDE_FILES "signal.h")
|
set(CMAKE_EXTRA_INCLUDE_FILES "signal.h")
|
||||||
ENDIF(HAVE_SIGNAL_H)
|
endif(HAVE_SIGNAL_H)
|
||||||
CHECK_TYPE_SIZE("sig_atomic_t" SIZEOF_SIG_ATOMIC_T)
|
check_type_size("sig_atomic_t" SIZEOF_SIG_ATOMIC_T)
|
||||||
IF(HAVE_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)
|
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)
|
if(NOT HAVE_SIG_ATOMIC_T_NOT_VOLATILE)
|
||||||
SET(HAVE_SIG_ATOMIC_T_VOLATILE 1)
|
set(HAVE_SIG_ATOMIC_T_VOLATILE 1)
|
||||||
ENDIF(NOT HAVE_SIG_ATOMIC_T_NOT_VOLATILE)
|
endif(NOT HAVE_SIG_ATOMIC_T_NOT_VOLATILE)
|
||||||
ENDIF(HAVE_SIZEOF_SIG_ATOMIC_T)
|
endif(HAVE_SIZEOF_SIG_ATOMIC_T)
|
||||||
|
|
||||||
SET(CHECK_TYPE_SIZE_PREINCLUDE
|
set(CHECK_TYPE_SIZE_PREINCLUDE
|
||||||
"#undef inline")
|
"#undef inline")
|
||||||
|
|
||||||
IF(HAVE_WINDOWS_H)
|
if(HAVE_WINDOWS_H)
|
||||||
SET(CHECK_TYPE_SIZE_PREINCLUDE "${CHECK_TYPE_SIZE_PREINCLUDE}
|
set(CHECK_TYPE_SIZE_PREINCLUDE "${CHECK_TYPE_SIZE_PREINCLUDE}
|
||||||
#ifndef WIN32_LEAN_AND_MEAN
|
#ifndef WIN32_LEAN_AND_MEAN
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#endif
|
#endif
|
||||||
#include <windows.h>")
|
#include <windows.h>")
|
||||||
IF(HAVE_WINSOCK2_H)
|
if(HAVE_WINSOCK2_H)
|
||||||
SET(CHECK_TYPE_SIZE_PREINCLUDE "${CHECK_TYPE_SIZE_PREINCLUDE}\n#include <winsock2.h>")
|
set(CHECK_TYPE_SIZE_PREINCLUDE "${CHECK_TYPE_SIZE_PREINCLUDE}\n#include <winsock2.h>")
|
||||||
ENDIF(HAVE_WINSOCK2_H)
|
endif(HAVE_WINSOCK2_H)
|
||||||
ELSE(HAVE_WINDOWS_H)
|
else(HAVE_WINDOWS_H)
|
||||||
IF(HAVE_SYS_SOCKET_H)
|
if(HAVE_SYS_SOCKET_H)
|
||||||
SET(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES}
|
set(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES}
|
||||||
"sys/socket.h")
|
"sys/socket.h")
|
||||||
ENDIF(HAVE_SYS_SOCKET_H)
|
endif(HAVE_SYS_SOCKET_H)
|
||||||
IF(HAVE_NETINET_IN_H)
|
if(HAVE_NETINET_IN_H)
|
||||||
SET(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES}
|
set(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES}
|
||||||
"netinet/in.h")
|
"netinet/in.h")
|
||||||
ENDIF(HAVE_NETINET_IN_H)
|
endif(HAVE_NETINET_IN_H)
|
||||||
IF(HAVE_ARPA_INET_H)
|
if(HAVE_ARPA_INET_H)
|
||||||
SET(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES}
|
set(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES}
|
||||||
"arpa/inet.h")
|
"arpa/inet.h")
|
||||||
ENDIF(HAVE_ARPA_INET_H)
|
endif(HAVE_ARPA_INET_H)
|
||||||
ENDIF(HAVE_WINDOWS_H)
|
endif(HAVE_WINDOWS_H)
|
||||||
|
|
||||||
CHECK_TYPE_SIZE("struct sockaddr_storage" SIZEOF_STRUCT_SOCKADDR_STORAGE)
|
check_type_size("struct sockaddr_storage" SIZEOF_STRUCT_SOCKADDR_STORAGE)
|
||||||
IF(HAVE_SIZEOF_STRUCT_SOCKADDR_STORAGE)
|
if(HAVE_SIZEOF_STRUCT_SOCKADDR_STORAGE)
|
||||||
SET(HAVE_STRUCT_SOCKADDR_STORAGE 1)
|
set(HAVE_STRUCT_SOCKADDR_STORAGE 1)
|
||||||
ENDIF(HAVE_SIZEOF_STRUCT_SOCKADDR_STORAGE)
|
endif(HAVE_SIZEOF_STRUCT_SOCKADDR_STORAGE)
|
||||||
|
|
||||||
|
|||||||
@@ -1,121 +1,121 @@
|
|||||||
IF(NOT UNIX)
|
if(NOT UNIX)
|
||||||
IF(WIN32)
|
if(WIN32)
|
||||||
SET(HAVE_LIBDL 0)
|
set(HAVE_LIBDL 0)
|
||||||
SET(HAVE_LIBUCB 0)
|
set(HAVE_LIBUCB 0)
|
||||||
SET(HAVE_LIBSOCKET 0)
|
set(HAVE_LIBSOCKET 0)
|
||||||
SET(NOT_NEED_LIBNSL 0)
|
set(NOT_NEED_LIBNSL 0)
|
||||||
SET(HAVE_LIBNSL 0)
|
set(HAVE_LIBNSL 0)
|
||||||
SET(HAVE_LIBZ 0)
|
set(HAVE_LIBZ 0)
|
||||||
SET(HAVE_LIBCRYPTO 0)
|
set(HAVE_LIBCRYPTO 0)
|
||||||
|
|
||||||
SET(HAVE_DLOPEN 0)
|
set(HAVE_DLOPEN 0)
|
||||||
|
|
||||||
SET(HAVE_ALLOCA_H 0)
|
set(HAVE_ALLOCA_H 0)
|
||||||
SET(HAVE_ARPA_INET_H 0)
|
set(HAVE_ARPA_INET_H 0)
|
||||||
SET(HAVE_DLFCN_H 0)
|
set(HAVE_DLFCN_H 0)
|
||||||
SET(HAVE_FCNTL_H 1)
|
set(HAVE_FCNTL_H 1)
|
||||||
SET(HAVE_FEATURES_H 0)
|
set(HAVE_FEATURES_H 0)
|
||||||
SET(HAVE_INTTYPES_H 0)
|
set(HAVE_INTTYPES_H 0)
|
||||||
SET(HAVE_IO_H 1)
|
set(HAVE_IO_H 1)
|
||||||
SET(HAVE_MALLOC_H 1)
|
set(HAVE_MALLOC_H 1)
|
||||||
SET(HAVE_MEMORY_H 1)
|
set(HAVE_MEMORY_H 1)
|
||||||
SET(HAVE_NETDB_H 0)
|
set(HAVE_NETDB_H 0)
|
||||||
SET(HAVE_NETINET_IF_ETHER_H 0)
|
set(HAVE_NETINET_IF_ETHER_H 0)
|
||||||
SET(HAVE_NETINET_IN_H 0)
|
set(HAVE_NETINET_IN_H 0)
|
||||||
SET(HAVE_NET_IF_H 0)
|
set(HAVE_NET_IF_H 0)
|
||||||
SET(HAVE_PROCESS_H 1)
|
set(HAVE_PROCESS_H 1)
|
||||||
SET(HAVE_PWD_H 0)
|
set(HAVE_PWD_H 0)
|
||||||
SET(HAVE_SETJMP_H 1)
|
set(HAVE_SETJMP_H 1)
|
||||||
SET(HAVE_SGTTY_H 0)
|
set(HAVE_SGTTY_H 0)
|
||||||
SET(HAVE_SIGNAL_H 1)
|
set(HAVE_SIGNAL_H 1)
|
||||||
SET(HAVE_SOCKIO_H 0)
|
set(HAVE_SOCKIO_H 0)
|
||||||
SET(HAVE_STDINT_H 0)
|
set(HAVE_STDINT_H 0)
|
||||||
SET(HAVE_STDLIB_H 1)
|
set(HAVE_STDLIB_H 1)
|
||||||
SET(HAVE_STRINGS_H 0)
|
set(HAVE_STRINGS_H 0)
|
||||||
SET(HAVE_STRING_H 1)
|
set(HAVE_STRING_H 1)
|
||||||
SET(HAVE_SYS_PARAM_H 0)
|
set(HAVE_SYS_PARAM_H 0)
|
||||||
SET(HAVE_SYS_POLL_H 0)
|
set(HAVE_SYS_POLL_H 0)
|
||||||
SET(HAVE_SYS_SELECT_H 0)
|
set(HAVE_SYS_SELECT_H 0)
|
||||||
SET(HAVE_SYS_SOCKET_H 0)
|
set(HAVE_SYS_SOCKET_H 0)
|
||||||
SET(HAVE_SYS_SOCKIO_H 0)
|
set(HAVE_SYS_SOCKIO_H 0)
|
||||||
SET(HAVE_SYS_STAT_H 1)
|
set(HAVE_SYS_STAT_H 1)
|
||||||
SET(HAVE_SYS_TIME_H 0)
|
set(HAVE_SYS_TIME_H 0)
|
||||||
SET(HAVE_SYS_TYPES_H 1)
|
set(HAVE_SYS_TYPES_H 1)
|
||||||
SET(HAVE_SYS_UTIME_H 1)
|
set(HAVE_SYS_UTIME_H 1)
|
||||||
SET(HAVE_TERMIOS_H 0)
|
set(HAVE_TERMIOS_H 0)
|
||||||
SET(HAVE_TERMIO_H 0)
|
set(HAVE_TERMIO_H 0)
|
||||||
SET(HAVE_TIME_H 1)
|
set(HAVE_TIME_H 1)
|
||||||
SET(HAVE_UNISTD_H 0)
|
set(HAVE_UNISTD_H 0)
|
||||||
SET(HAVE_UTIME_H 0)
|
set(HAVE_UTIME_H 0)
|
||||||
SET(HAVE_X509_H 0)
|
set(HAVE_X509_H 0)
|
||||||
SET(HAVE_ZLIB_H 0)
|
set(HAVE_ZLIB_H 0)
|
||||||
|
|
||||||
SET(HAVE_SIZEOF_LONG_DOUBLE 1)
|
set(HAVE_SIZEOF_LONG_DOUBLE 1)
|
||||||
SET(SIZEOF_LONG_DOUBLE 8)
|
set(SIZEOF_LONG_DOUBLE 8)
|
||||||
|
|
||||||
SET(HAVE_SOCKET 1)
|
set(HAVE_SOCKET 1)
|
||||||
SET(HAVE_POLL 0)
|
set(HAVE_POLL 0)
|
||||||
SET(HAVE_SELECT 1)
|
set(HAVE_SELECT 1)
|
||||||
SET(HAVE_STRDUP 1)
|
set(HAVE_STRDUP 1)
|
||||||
SET(HAVE_STRSTR 1)
|
set(HAVE_STRSTR 1)
|
||||||
SET(HAVE_STRTOK_R 0)
|
set(HAVE_STRTOK_R 0)
|
||||||
SET(HAVE_STRFTIME 1)
|
set(HAVE_STRFTIME 1)
|
||||||
SET(HAVE_UNAME 0)
|
set(HAVE_UNAME 0)
|
||||||
SET(HAVE_STRCASECMP 0)
|
set(HAVE_STRCASECMP 0)
|
||||||
SET(HAVE_STRICMP 1)
|
set(HAVE_STRICMP 1)
|
||||||
SET(HAVE_STRCMPI 1)
|
set(HAVE_STRCMPI 1)
|
||||||
SET(HAVE_GETHOSTBYADDR 1)
|
set(HAVE_GETHOSTBYADDR 1)
|
||||||
SET(HAVE_GETTIMEOFDAY 0)
|
set(HAVE_GETTIMEOFDAY 0)
|
||||||
SET(HAVE_INET_ADDR 1)
|
set(HAVE_INET_ADDR 1)
|
||||||
SET(HAVE_INET_NTOA 1)
|
set(HAVE_INET_NTOA 1)
|
||||||
SET(HAVE_INET_NTOA_R 0)
|
set(HAVE_INET_NTOA_R 0)
|
||||||
SET(HAVE_TCGETATTR 0)
|
set(HAVE_TCGETATTR 0)
|
||||||
SET(HAVE_TCSETATTR 0)
|
set(HAVE_TCSETATTR 0)
|
||||||
SET(HAVE_PERROR 1)
|
set(HAVE_PERROR 1)
|
||||||
SET(HAVE_CLOSESOCKET 1)
|
set(HAVE_CLOSESOCKET 1)
|
||||||
SET(HAVE_SETVBUF 0)
|
set(HAVE_SETVBUF 0)
|
||||||
SET(HAVE_SIGSETJMP 0)
|
set(HAVE_SIGSETJMP 0)
|
||||||
SET(HAVE_GETPASS_R 0)
|
set(HAVE_GETPASS_R 0)
|
||||||
SET(HAVE_STRLCAT 0)
|
set(HAVE_STRLCAT 0)
|
||||||
SET(HAVE_GETPWUID 0)
|
set(HAVE_GETPWUID 0)
|
||||||
SET(HAVE_GETEUID 0)
|
set(HAVE_GETEUID 0)
|
||||||
SET(HAVE_UTIME 1)
|
set(HAVE_UTIME 1)
|
||||||
SET(HAVE_RAND_EGD 0)
|
set(HAVE_RAND_EGD 0)
|
||||||
SET(HAVE_RAND_SCREEN 0)
|
set(HAVE_RAND_SCREEN 0)
|
||||||
SET(HAVE_RAND_STATUS 0)
|
set(HAVE_RAND_STATUS 0)
|
||||||
SET(HAVE_GMTIME_R 0)
|
set(HAVE_GMTIME_R 0)
|
||||||
SET(HAVE_LOCALTIME_R 0)
|
set(HAVE_LOCALTIME_R 0)
|
||||||
SET(HAVE_GETHOSTBYADDR_R 0)
|
set(HAVE_GETHOSTBYADDR_R 0)
|
||||||
SET(HAVE_GETHOSTBYNAME_R 0)
|
set(HAVE_GETHOSTBYNAME_R 0)
|
||||||
SET(HAVE_SIGNAL_FUNC 1)
|
set(HAVE_SIGNAL_FUNC 1)
|
||||||
SET(HAVE_SIGNAL_MACRO 0)
|
set(HAVE_SIGNAL_MACRO 0)
|
||||||
|
|
||||||
SET(HAVE_GETHOSTBYADDR_R_5 0)
|
set(HAVE_GETHOSTBYADDR_R_5 0)
|
||||||
SET(HAVE_GETHOSTBYADDR_R_5_REENTRANT 0)
|
set(HAVE_GETHOSTBYADDR_R_5_REENTRANT 0)
|
||||||
SET(HAVE_GETHOSTBYADDR_R_7 0)
|
set(HAVE_GETHOSTBYADDR_R_7 0)
|
||||||
SET(HAVE_GETHOSTBYADDR_R_7_REENTRANT 0)
|
set(HAVE_GETHOSTBYADDR_R_7_REENTRANT 0)
|
||||||
SET(HAVE_GETHOSTBYADDR_R_8 0)
|
set(HAVE_GETHOSTBYADDR_R_8 0)
|
||||||
SET(HAVE_GETHOSTBYADDR_R_8_REENTRANT 0)
|
set(HAVE_GETHOSTBYADDR_R_8_REENTRANT 0)
|
||||||
SET(HAVE_GETHOSTBYNAME_R_3 0)
|
set(HAVE_GETHOSTBYNAME_R_3 0)
|
||||||
SET(HAVE_GETHOSTBYNAME_R_3_REENTRANT 0)
|
set(HAVE_GETHOSTBYNAME_R_3_REENTRANT 0)
|
||||||
SET(HAVE_GETHOSTBYNAME_R_5 0)
|
set(HAVE_GETHOSTBYNAME_R_5 0)
|
||||||
SET(HAVE_GETHOSTBYNAME_R_5_REENTRANT 0)
|
set(HAVE_GETHOSTBYNAME_R_5_REENTRANT 0)
|
||||||
SET(HAVE_GETHOSTBYNAME_R_6 0)
|
set(HAVE_GETHOSTBYNAME_R_6 0)
|
||||||
SET(HAVE_GETHOSTBYNAME_R_6_REENTRANT 0)
|
set(HAVE_GETHOSTBYNAME_R_6_REENTRANT 0)
|
||||||
|
|
||||||
SET(TIME_WITH_SYS_TIME 0)
|
set(TIME_WITH_SYS_TIME 0)
|
||||||
SET(HAVE_O_NONBLOCK 0)
|
set(HAVE_O_NONBLOCK 0)
|
||||||
SET(HAVE_IN_ADDR_T 0)
|
set(HAVE_IN_ADDR_T 0)
|
||||||
SET(HAVE_INET_NTOA_R_DECL 0)
|
set(HAVE_INET_NTOA_R_DECL 0)
|
||||||
SET(HAVE_INET_NTOA_R_DECL_REENTRANT 0)
|
set(HAVE_INET_NTOA_R_DECL_REENTRANT 0)
|
||||||
SET(HAVE_GETADDRINFO 0)
|
set(HAVE_GETADDRINFO 0)
|
||||||
SET(STDC_HEADERS 1)
|
set(STDC_HEADERS 1)
|
||||||
SET(RETSIGTYPE_TEST 1)
|
set(RETSIGTYPE_TEST 1)
|
||||||
|
|
||||||
SET(HAVE_SIGACTION 0)
|
set(HAVE_SIGACTION 0)
|
||||||
SET(HAVE_MACRO_SIGSETJMP 0)
|
set(HAVE_MACRO_SIGSETJMP 0)
|
||||||
ELSE(WIN32)
|
else(WIN32)
|
||||||
MESSAGE("This file should be included on Windows platform only")
|
message("This file should be included on Windows platform only")
|
||||||
ENDIF(WIN32)
|
endif(WIN32)
|
||||||
ENDIF(NOT UNIX)
|
endif(NOT UNIX)
|
||||||
|
|
||||||
|
|||||||
@@ -1,31 +1,31 @@
|
|||||||
# File containing various utilities
|
# File containing various utilities
|
||||||
|
|
||||||
# Converts a CMake list to a string containing elements separated by spaces
|
# Converts a CMake list to a string containing elements separated by spaces
|
||||||
FUNCTION(TO_LIST_SPACES _LIST_NAME OUTPUT_VAR)
|
function(TO_LIST_SPACES _LIST_NAME OUTPUT_VAR)
|
||||||
SET(NEW_LIST_SPACE)
|
set(NEW_LIST_SPACE)
|
||||||
FOREACH(ITEM ${${_LIST_NAME}})
|
foreach(ITEM ${${_LIST_NAME}})
|
||||||
SET(NEW_LIST_SPACE "${NEW_LIST_SPACE} ${ITEM}")
|
set(NEW_LIST_SPACE "${NEW_LIST_SPACE} ${ITEM}")
|
||||||
ENDFOREACH()
|
endforeach()
|
||||||
STRING(STRIP ${NEW_LIST_SPACE} NEW_LIST_SPACE)
|
string(STRIP ${NEW_LIST_SPACE} NEW_LIST_SPACE)
|
||||||
SET(${OUTPUT_VAR} "${NEW_LIST_SPACE}" PARENT_SCOPE)
|
set(${OUTPUT_VAR} "${NEW_LIST_SPACE}" PARENT_SCOPE)
|
||||||
ENDFUNCTION()
|
endfunction()
|
||||||
|
|
||||||
# Appends a lis of item to a string which is a space-separated list, if they don't already exist.
|
# 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)
|
function(LIST_SPACES_APPEND_ONCE LIST_NAME)
|
||||||
STRING(REPLACE " " ";" _LIST ${${LIST_NAME}})
|
string(REPLACE " " ";" _LIST ${${LIST_NAME}})
|
||||||
LIST(APPEND _LIST ${ARGN})
|
list(APPEND _LIST ${ARGN})
|
||||||
LIST(REMOVE_DUPLICATES _LIST)
|
list(REMOVE_DUPLICATES _LIST)
|
||||||
TO_LIST_SPACES(_LIST NEW_LIST_SPACE)
|
to_list_spaces(_LIST NEW_LIST_SPACE)
|
||||||
SET(${LIST_NAME} "${NEW_LIST_SPACE}" PARENT_SCOPE)
|
set(${LIST_NAME} "${NEW_LIST_SPACE}" PARENT_SCOPE)
|
||||||
ENDFUNCTION()
|
endfunction()
|
||||||
|
|
||||||
# Convinience function that does the same as LIST(FIND ...) but with a TRUE/FALSE return value.
|
# 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)
|
# Ex: IN_STR_LIST(MY_LIST "Searched item" WAS_FOUND)
|
||||||
FUNCTION(IN_STR_LIST LIST_NAME ITEM_SEARCHED RETVAL)
|
function(IN_STR_LIST LIST_NAME ITEM_SEARCHED RETVAL)
|
||||||
LIST(FIND ${LIST_NAME} ${ITEM_SEARCHED} FIND_POS)
|
list(FIND ${LIST_NAME} ${ITEM_SEARCHED} FIND_POS)
|
||||||
IF(${FIND_POS} EQUAL -1)
|
if(${FIND_POS} EQUAL -1)
|
||||||
SET(${RETVAL} FALSE PARENT_SCOPE)
|
set(${RETVAL} FALSE PARENT_SCOPE)
|
||||||
ELSE()
|
else()
|
||||||
SET(${RETVAL} TRUE PARENT_SCOPE)
|
set(${RETVAL} TRUE PARENT_SCOPE)
|
||||||
ENDIF()
|
endif()
|
||||||
ENDFUNCTION()
|
endfunction()
|
||||||
|
|||||||
1127
CMakeLists.txt
1127
CMakeLists.txt
File diff suppressed because it is too large
Load Diff
2
COPYING
2
COPYING
@@ -1,6 +1,6 @@
|
|||||||
COPYRIGHT AND PERMISSION NOTICE
|
COPYRIGHT AND PERMISSION NOTICE
|
||||||
|
|
||||||
Copyright (c) 1996 - 2009, Daniel Stenberg, <daniel@haxx.se>.
|
Copyright (c) 1996 - 2010, Daniel Stenberg, <daniel@haxx.se>.
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,6 @@ set(CTEST_PROJECT_NAME "CURL")
|
|||||||
set(CTEST_NIGHTLY_START_TIME "00:00:00 EST")
|
set(CTEST_NIGHTLY_START_TIME "00:00:00 EST")
|
||||||
|
|
||||||
set(CTEST_DROP_METHOD "http")
|
set(CTEST_DROP_METHOD "http")
|
||||||
set(CTEST_DROP_SITE "www.cdash.org")
|
set(CTEST_DROP_SITE "my.cdash.org")
|
||||||
set(CTEST_DROP_LOCATION "/CDashPublic/submit.php?project=CURL")
|
set(CTEST_DROP_LOCATION "/submit.php?project=CURL")
|
||||||
set(CTEST_DROP_SITE_CDASH TRUE)
|
set(CTEST_DROP_SITE_CDASH TRUE)
|
||||||
|
|||||||
@@ -4,10 +4,10 @@
|
|||||||
| (__| |_| | _ <| |___
|
| (__| |_| | _ <| |___
|
||||||
\___|\___/|_| \_\_____|
|
\___|\___/|_| \_\_____|
|
||||||
|
|
||||||
CVS-INFO
|
GIT-INFO
|
||||||
|
|
||||||
This file is only present in the CVS - never in release archives. It contains
|
This file is only present in git - never in release archives. It contains
|
||||||
information about other files and things that the CVS repository keeps in its
|
information about other files and things that the git repository keeps in its
|
||||||
inner sanctum.
|
inner sanctum.
|
||||||
|
|
||||||
Compile and build instructions follow below.
|
Compile and build instructions follow below.
|
||||||
@@ -20,7 +20,7 @@ Compile and build instructions follow below.
|
|||||||
perl/ is a subdirectory with various perl scripts
|
perl/ is a subdirectory with various perl scripts
|
||||||
|
|
||||||
To build in environments that support configure, after having extracted
|
To build in environments that support configure, after having extracted
|
||||||
everything from CVS, do this:
|
everything from git, do this:
|
||||||
|
|
||||||
./buildconf
|
./buildconf
|
||||||
./configure
|
./configure
|
||||||
@@ -63,5 +63,5 @@ MAC OS X
|
|||||||
3. Install the latest version of autoconf, automake and m4 with fink
|
3. Install the latest version of autoconf, automake and m4 with fink
|
||||||
4. Install version 1.4.1 of libtool - you find it in the "unstable" section
|
4. Install version 1.4.1 of libtool - you find it in the "unstable" section
|
||||||
(read the manual to see how to get unstable versions)
|
(read the manual to see how to get unstable versions)
|
||||||
5. Get cURL from the cvs
|
5. Get cURL from git
|
||||||
6. Build cURL with "./buildconf", "./configure", "make", "sudo make install"
|
6. Build cURL with "./buildconf", "./configure", "make", "sudo make install"
|
||||||
@@ -18,7 +18,6 @@
|
|||||||
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
# KIND, either express or implied.
|
# KIND, either express or implied.
|
||||||
#
|
#
|
||||||
# $Id$
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
|
||||||
AUTOMAKE_OPTIONS = foreign
|
AUTOMAKE_OPTIONS = foreign
|
||||||
@@ -32,8 +31,8 @@ CMake/FindZLIB.cmake CMake/OtherTests.cmake CMake/Platforms/WindowsCache.cmake \
|
|||||||
CMake/Utilities.cmake include/curl/curlbuild.h.cmake
|
CMake/Utilities.cmake include/curl/curlbuild.h.cmake
|
||||||
|
|
||||||
EXTRA_DIST = CHANGES COPYING maketgz Makefile.dist curl-config.in \
|
EXTRA_DIST = CHANGES COPYING maketgz Makefile.dist curl-config.in \
|
||||||
curl-style.el sample.emacs RELEASE-NOTES buildconf buildconf.bat \
|
curl-style.el sample.emacs RELEASE-NOTES buildconf \
|
||||||
libcurl.pc.in vc6curl.dsw MacOSX-Framework $(CMAKE_DIST)
|
libcurl.pc.in vc6curl.dsw MacOSX-Framework Android.mk $(CMAKE_DIST)
|
||||||
|
|
||||||
bin_SCRIPTS = curl-config
|
bin_SCRIPTS = curl-config
|
||||||
|
|
||||||
@@ -46,7 +45,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; \
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
# | (__| |_| | _ <| |___
|
# | (__| |_| | _ <| |___
|
||||||
# \___|\___/|_| \_\_____|
|
# \___|\___/|_| \_\_____|
|
||||||
#
|
#
|
||||||
# Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
|
# Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
#
|
#
|
||||||
# This software is licensed as described in the file COPYING, which
|
# This software is licensed as described in the file COPYING, which
|
||||||
# you should have received as part of this distribution. The terms
|
# you should have received as part of this distribution. The terms
|
||||||
@@ -18,7 +18,6 @@
|
|||||||
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
# KIND, either express or implied.
|
# KIND, either express or implied.
|
||||||
#
|
#
|
||||||
# $Id$
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
|
||||||
VC=vc6
|
VC=vc6
|
||||||
@@ -55,17 +54,23 @@ borland-clean:
|
|||||||
cd ..\src
|
cd ..\src
|
||||||
make -f Makefile.b32 clean
|
make -f Makefile.b32 clean
|
||||||
|
|
||||||
watcom:
|
watcom: .SYMBOLIC
|
||||||
cd lib
|
cd lib
|
||||||
wmake -f Makefile.Watcom
|
wmake -u -f Makefile.Watcom
|
||||||
cd ..\src
|
cd ..\src
|
||||||
wmake -f Makefile.Watcom
|
wmake -u -f Makefile.Watcom
|
||||||
|
|
||||||
watcom-clean:
|
watcom-clean: .SYMBOLIC
|
||||||
cd lib
|
cd lib
|
||||||
wmake -f Makefile.Watcom clean
|
wmake -u -f Makefile.Watcom clean
|
||||||
cd ..\src
|
cd ..\src
|
||||||
wmake -f Makefile.Watcom clean
|
wmake -u -f Makefile.Watcom clean
|
||||||
|
|
||||||
|
watcom-vclean: .SYMBOLIC
|
||||||
|
cd lib
|
||||||
|
wmake -u -f Makefile.Watcom vclean
|
||||||
|
cd ..\src
|
||||||
|
wmake -u -f Makefile.Watcom vclean
|
||||||
|
|
||||||
mingw32:
|
mingw32:
|
||||||
$(MAKE) -C lib -f Makefile.m32
|
$(MAKE) -C lib -f Makefile.m32
|
||||||
@@ -130,9 +135,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 +157,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
|
||||||
@@ -257,16 +268,26 @@ linux: all
|
|||||||
linux-ssl: ssl
|
linux-ssl: ssl
|
||||||
|
|
||||||
|
|
||||||
vc8:
|
vc8: lib/Makefile.vc8 src/Makefile.vc8
|
||||||
@echo "generate VC8 makefiles"
|
|
||||||
@sed -e "s#/GX /DWIN32 /YX#/EHsc /DWIN32#" -e "s#/GZ#/RTC1#" -e "s/wsock32.lib/wsock32.lib bufferoverflowu.lib/g" -e "s/VC6/VC8/g" lib/Makefile.vc6 > lib/Makefile.vc8
|
lib/Makefile.vc8: lib/Makefile.vc6
|
||||||
@sed -e "s#/GX /DWIN32 /YX#/EHsc /DWIN32#" -e "s#/GZ#/RTC1#" -e "s/wsock32.lib/wsock32.lib bufferoverflowu.lib/g" -e "s/VC6/VC8/g" src/Makefile.vc6 > src/Makefile.vc8
|
@echo "generate $@"
|
||||||
|
@sed -e "s#/GX /DWIN32 /YX#/EHsc /DWIN32#" -e "s#/GZ#/RTC1#" -e "s/ws2_32.lib/ws2_32.lib bufferoverflowu.lib/g" -e "s/VC6/VC8/g" lib/Makefile.vc6 > lib/Makefile.vc8
|
||||||
|
|
||||||
|
src/Makefile.vc8: src/Makefile.vc6
|
||||||
|
@echo "generate $@"
|
||||||
|
@sed -e "s#/GX /DWIN32 /YX#/EHsc /DWIN32#" -e "s#/GZ#/RTC1#" -e "s/ws2_32.lib/ws2_32.lib bufferoverflowu.lib/g" -e "s/VC6/VC8/g" src/Makefile.vc6 > src/Makefile.vc8
|
||||||
|
|
||||||
# VC9 makefiles are for use with VS2008
|
# VC9 makefiles are for use with VS2008
|
||||||
vc9:
|
vc9: lib/Makefile.vc9 src/Makefile.vc9
|
||||||
@echo "generate VC9 makefiles"
|
|
||||||
@sed -e "s#/GX /DWIN32 /YX#/EHsc /DWIN32#" -e "s#/GZ#/RTC1#" -e "s/wsock32.lib/ws2_32.lib/g" -e "s/vc6/vc9/g" -e "s/VC6/VC9/g" lib/Makefile.vc6 > lib/Makefile.vc9
|
lib/Makefile.vc9: lib/Makefile.vc6
|
||||||
@sed -e "s#/GX /DWIN32 /YX#/EHsc /DWIN32#" -e "s#/GZ#/RTC1#" -e "s/wsock32.lib/ws2_32.lib/g" -e "s/vc6/vc9/g" -e "s/VC6/VC9/g" src/Makefile.vc6 > src/Makefile.vc9
|
@echo "generate $@"
|
||||||
|
@sed -e "s#/GX /DWIN32 /YX#/EHsc /DWIN32#" -e "s#/GZ#/RTC1#" -e "s/ws2_32.lib/ws2_32.lib/g" -e "s/vc6/vc9/g" -e "s/VC6/VC9/g" lib/Makefile.vc6 > lib/Makefile.vc9
|
||||||
|
|
||||||
|
src/Makefile.vc9: src/Makefile.vc6
|
||||||
|
@echo "generate $@"
|
||||||
|
@sed -e "s#/GX /DWIN32 /YX#/EHsc /DWIN32#" -e "s#/GZ#/RTC1#" -e "s/ws2_32.lib/ws2_32.lib/g" -e "s/vc6/vc9/g" -e "s/VC6/VC9/g" src/Makefile.vc6 > src/Makefile.vc9
|
||||||
|
|
||||||
ca-bundle: lib/mk-ca-bundle.pl
|
ca-bundle: lib/mk-ca-bundle.pl
|
||||||
@echo "generate a fresh ca-bundle.crt"
|
@echo "generate a fresh ca-bundle.crt"
|
||||||
|
|||||||
10
README
10
README
@@ -34,15 +34,11 @@ WEB SITE
|
|||||||
|
|
||||||
http://curl.haxx.se/
|
http://curl.haxx.se/
|
||||||
|
|
||||||
CVS
|
GIT
|
||||||
|
|
||||||
To download the very latest source off the CVS server do this:
|
To download the very latest source off the GIT server do this:
|
||||||
|
|
||||||
cvs -d :pserver:anonymous@cool.haxx.se:/cvsroot/curl login
|
git clone git://github.com/bagder/curl.git
|
||||||
|
|
||||||
(just press enter when asked for password)
|
|
||||||
|
|
||||||
cvs -d :pserver:anonymous@cool.haxx.se:/cvsroot/curl co curl
|
|
||||||
|
|
||||||
(you'll get a directory named curl created, filled with the source code)
|
(you'll get a directory named curl created, filled with the source code)
|
||||||
|
|
||||||
|
|||||||
102
RELEASE-NOTES
102
RELEASE-NOTES
@@ -1,53 +1,58 @@
|
|||||||
Curl and libcurl 7.19.5
|
Curl and libcurl 7.21.1
|
||||||
|
|
||||||
Public curl releases: 111
|
Public curl releases: 117
|
||||||
Command line options: 132
|
Command line options: 138
|
||||||
curl_easy_setopt() options: 163
|
curl_easy_setopt() options: 180
|
||||||
Public functions in libcurl: 58
|
Public functions in libcurl: 58
|
||||||
Known libcurl bindings: 38
|
Known libcurl bindings: 39
|
||||||
Contributors: 715
|
Contributors: 808
|
||||||
|
|
||||||
This release includes the following changes:
|
This release includes the following changes:
|
||||||
|
|
||||||
o libcurl now closes all dead connections whenever you attempt to open a new
|
o maketgz: produce CHANGES automatically
|
||||||
connection
|
o added support for NTLM authentication when compiled with NSS
|
||||||
o libssh2's version number can now be figured out run-time instead of using
|
o build: Enable configure --enable-werror
|
||||||
the build-time fixed number
|
o curl-config: --built-shared returns shared info
|
||||||
o CURLOPT_SEEKFUNCTION may now return CURL_SEEKFUNC_CANTSEEK
|
|
||||||
o curl can now upload with resume even when reading from a pipe
|
|
||||||
o a build-time configured curl_socklen_t is now used instead of socklen_t
|
|
||||||
|
|
||||||
This release includes the following bugfixes:
|
This release includes the following bugfixes:
|
||||||
|
|
||||||
o NTLM authentication memory leak on SSPI enabled Windows builds
|
o configure: spell --disable-threaded-resolver correctly
|
||||||
o fixed the GnuTLS-using code to do correct return code checks
|
o multi: call the progress callback in all states
|
||||||
o an alloc-related call in the OpenSSL-using code didn't check the return value
|
o multi: unmark handle as used when no longer head of pipeline
|
||||||
o curl_easy_duphandle() failed to duplicate cookies at times
|
o sendrecv: treat all negative values from send/recv as errors
|
||||||
o missing TELNET timeout support in Windows builds
|
o ftp-wildcard: avoid tight loop when used without any pattern
|
||||||
o missing Curl_read() and write callback result checking in TELNET transfers
|
o multi_socket: re-use of same socket without notifying app
|
||||||
o more ciphers enabled in libcurl built to use NSS
|
o ftp wildcard: FTP LIST parser FIX
|
||||||
o properly return an error code in curl_easy_recv
|
o urlglobbing backslash escaping bug
|
||||||
o Sun compilers specific preprocessor block removed from curlbuild.h.dist
|
o build: add enable IPV6 option for the VC makefiles
|
||||||
o allow creation of four way fat libcurl Mac OS X Framework
|
o multi: CURLINFO_LASTSOCKET doesn't work after remove_handle
|
||||||
o several memory leaks in libcurl+NSS
|
o --libcurl: use *_LARGE options with typecasted constants
|
||||||
o improved the CURLOPT_NOBODY set to 0 confusions
|
o --libcurl: hide setopt() calls setting default options
|
||||||
o persistent connections when doing FTP over a HTTP proxy
|
o curl: avoid setting libcurl options to its default
|
||||||
o --libcurl bogus strings where other data was pointed to
|
o --libcurl: list the tricky options instead of using [REMARK]
|
||||||
o crash related to FTP and "Re-used connection seems dead, get a new one"
|
o http: don't enable chunked during authentication negotiations
|
||||||
o CURLINFO_APPCONNECT_TIME with the multi interface
|
o upload: warn users trying to upload from stdin with anyauth
|
||||||
o Enhanced upload speeds on Windows
|
o configure: allow environments variable to override internals
|
||||||
o TFTP problems after a failed transfer to the same host
|
o threaded resolver: fix timeout issue
|
||||||
o improved out of the box TPF compatibility
|
o multi: fix condition that remove timers before trigger
|
||||||
o HTTP PUT protocol line endings portions mangled from CRLF to CRCRLF
|
o examples: add curl_multi_timeout
|
||||||
o Rejected SSL session ids are killed properly (for OpenSSL and GnuTLS builds)
|
o --retry: access violation with URL part sets continued
|
||||||
o Deal with the TFTP OACK packet
|
o ssh: Fix compile error on 64-bit systems.
|
||||||
o fixed roff mistakes in man pages
|
o remote-header-name: chop filename at next semicolon
|
||||||
o use SOCKS proxy with the multi interface
|
o ftp: response timeout bug in "quote" sending
|
||||||
o fixed the Curl_getoff_all_pipelines SIGSEGV
|
o CUSTOMREQUEST: shouldn't be disabled when HTTP is disabled
|
||||||
o POST, NTLM and following a redirect hang
|
o Watcom makefiles overhaul.
|
||||||
o libcurl+NSS endless loop on incorrect password for private key
|
o NTLM tests: boost coverage by forcing the hostname
|
||||||
o gzip decompression memory leak
|
o multi: fix FTPS connecting the data connection with OpenSSL
|
||||||
o no_proxy flaw with user name in URL
|
o retry: consider retrying even if -f is used
|
||||||
|
o fix SOCKS problem when using multi interface
|
||||||
|
o typecheck-gcc: add checks for recently added options
|
||||||
|
o SCP: send large files properly with new enough libssh2
|
||||||
|
o multi_socket: set timeout for 100-continue
|
||||||
|
o ";type=" URL suffix over HTTP proxy
|
||||||
|
o acknowledge progress callback error returns during connect
|
||||||
|
o Watcom makefile fixes
|
||||||
|
o runtests: clear old setenv remainders before test
|
||||||
|
|
||||||
This release includes the following known bugs:
|
This release includes the following known bugs:
|
||||||
|
|
||||||
@@ -56,12 +61,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:
|
||||||
|
|
||||||
Daniel Fandrich, Yang Tse, David James, Chris Deidun, Bill Egert,
|
Dan Fandrich, Kamil Dudka, Krister Johansen, Pavel Raiskup, Jon Sargeant,
|
||||||
Andre Guibert de Bruet, Andreas Farber, Frank Hempel, Pierre Brico,
|
Pierre Joye, Tor Arntsen, Constantine Sapuntzakis, Sidney San Martin,
|
||||||
Kamil Dudka, Jim Freeman, Daniel Johnson, Toshio Kuratomi, Martin Storsjo,
|
Jeff Pohlmeyer, Jan Van Boghout, Ben Greear, Guenter Knauf, Adam Light,
|
||||||
Pramod Sharma, Gisle Vanem, Lenaic Lefever, Rainer Koenig, Sven Wegener,
|
Georg Lippitsch, Mike Power, Robin Cornelius, Mikael Johansson,
|
||||||
Tim Chen, Constantine Sapuntzakis, David McCreedy, Michael Smith,
|
Yang Tse, Ben Darnell
|
||||||
Colin Watson, Ebenezer Ikonne, Laurent Rabret, Michael Cronenworth,
|
|
||||||
Balint Szilakszi, James Bursa
|
|
||||||
|
|
||||||
Thanks! (and sorry if I forgot to mention someone)
|
Thanks! (and sorry if I forgot to mention someone)
|
||||||
|
|||||||
@@ -1,9 +1,4 @@
|
|||||||
To be addressed in 7.19.6 (planned release: July 2009)
|
To be addressed in 7.XX.X
|
||||||
=========================
|
=========================
|
||||||
|
|
||||||
226 - Active Mode FTPS Data Port Range
|
261 -
|
||||||
|
|
||||||
235 - KNOWN_BUG #65
|
|
||||||
Code adjustment for FTP over socks proxy remains
|
|
||||||
|
|
||||||
240 -
|
|
||||||
|
|||||||
100
acinclude.m4
100
acinclude.m4
@@ -5,7 +5,7 @@
|
|||||||
# | (__| |_| | _ <| |___
|
# | (__| |_| | _ <| |___
|
||||||
# \___|\___/|_| \_\_____|
|
# \___|\___/|_| \_\_____|
|
||||||
#
|
#
|
||||||
# Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
|
# Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
#
|
#
|
||||||
# This software is licensed as described in the file COPYING, which
|
# This software is licensed as described in the file COPYING, which
|
||||||
# you should have received as part of this distribution. The terms
|
# you should have received as part of this distribution. The terms
|
||||||
@@ -18,7 +18,6 @@
|
|||||||
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
# KIND, either express or implied.
|
# KIND, either express or implied.
|
||||||
#
|
#
|
||||||
# $Id$
|
|
||||||
#***************************************************************************
|
#***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
@@ -1852,7 +1851,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([[
|
||||||
@@ -1882,6 +1881,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;
|
||||||
@@ -2199,6 +2201,52 @@ 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 CURL_DEFINE_UNQUOTED (VARIABLE, [VALUE])
|
||||||
dnl -------------------------------------------------
|
dnl -------------------------------------------------
|
||||||
dnl Like AC_DEFINE_UNQUOTED this macro will define a C preprocessor
|
dnl Like AC_DEFINE_UNQUOTED this macro will define a C preprocessor
|
||||||
@@ -3141,25 +3189,53 @@ AC_DEFUN([CURL_CHECK_WIN32_LARGEFILE], [
|
|||||||
esac
|
esac
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl CURL_CHECK_PKGCONFIG ($module)
|
dnl CURL_EXPORT_PCDIR ($pcdir)
|
||||||
|
dnl ------------------------
|
||||||
|
dnl if $pcdir is not empty, set PKG_CONFIG_LIBDIR to $pcdir and export
|
||||||
|
dnl
|
||||||
|
dnl we need this macro since pkg-config distinguishes among empty and unset
|
||||||
|
dnl variable while checking PKG_CONFIG_LIBDIR
|
||||||
|
dnl
|
||||||
|
|
||||||
|
AC_DEFUN([CURL_EXPORT_PCDIR], [
|
||||||
|
if test -n "$1"; then
|
||||||
|
PKG_CONFIG_LIBDIR="$1"
|
||||||
|
export PKG_CONFIG_LIBDIR
|
||||||
|
fi
|
||||||
|
])
|
||||||
|
|
||||||
|
dnl CURL_CHECK_PKGCONFIG ($module, [$pcdir])
|
||||||
dnl ------------------------
|
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 Optionally PKG_CONFIG_LIBDIR may be given as $pcdir.
|
||||||
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"
|
||||||
|
|
||||||
|
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)
|
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])
|
||||||
dnl ask pkg-config about $1
|
dnl ask pkg-config about $1
|
||||||
$PKGCONFIG --exists $1
|
itexists=`CURL_EXPORT_PCDIR([$2]) dnl
|
||||||
if test "$?" -ne "0"; then
|
$PKGCONFIG --exists $1 >/dev/null 2>&1 && echo 1`
|
||||||
|
|
||||||
|
if test -z "$itexists"; then
|
||||||
dnl pkg-config does not have info about the given module! set the
|
dnl pkg-config does not have info about the given module! set the
|
||||||
dnl variable to 'no'
|
dnl variable to 'no'
|
||||||
PKGCONFIG="no"
|
PKGCONFIG="no"
|
||||||
@@ -3168,8 +3244,4 @@ AC_DEFUN([CURL_CHECK_PKGCONFIG], [
|
|||||||
AC_MSG_RESULT([found])
|
AC_MSG_RESULT([found])
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
else
|
|
||||||
PKGCONFIG="no"
|
|
||||||
fi
|
|
||||||
])
|
])
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
*.lo
|
|
||||||
.deps
|
|
||||||
.libs
|
|
||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
aclocal.m4
|
|
||||||
adig
|
|
||||||
ahost
|
|
||||||
ares_build.h
|
|
||||||
ares_version.h.dist
|
|
||||||
autom4te.cache
|
|
||||||
config.guess
|
|
||||||
config.h
|
|
||||||
config.h.in
|
|
||||||
config.log
|
|
||||||
config.lt
|
|
||||||
config.status
|
|
||||||
config.sub
|
|
||||||
configure
|
|
||||||
depcomp
|
|
||||||
libcares.la
|
|
||||||
libcares.pc
|
|
||||||
libtool
|
|
||||||
ltmain.sh
|
|
||||||
missing
|
|
||||||
stamp-h*
|
|
||||||
37
ares/AUTHORS
37
ares/AUTHORS
@@ -1,37 +0,0 @@
|
|||||||
c-ares is based on ares, and these are the people that have worked on it since
|
|
||||||
the fork was made:
|
|
||||||
|
|
||||||
Alexander Lazic
|
|
||||||
Alexey Simak
|
|
||||||
Andreas Rieke
|
|
||||||
Ashish Sharma
|
|
||||||
Brad House
|
|
||||||
Brad Spencer
|
|
||||||
Bram Matthys
|
|
||||||
Dan Fandrich
|
|
||||||
Daniel Stenberg
|
|
||||||
Dirk Manske
|
|
||||||
Dominick Meglio
|
|
||||||
Doug Goldstein
|
|
||||||
Duncan Wilcox
|
|
||||||
Eino Tuominen
|
|
||||||
Erik Kline
|
|
||||||
George Neill
|
|
||||||
Gisle Vanem
|
|
||||||
Guilherme Balena Versiani
|
|
||||||
Gunter Knauf
|
|
||||||
Henrik Stoerner
|
|
||||||
James Bursa
|
|
||||||
Michael Wallner
|
|
||||||
Nick Mathewson
|
|
||||||
Phil Blundell
|
|
||||||
Ravi Pratap
|
|
||||||
Robin Cornelius
|
|
||||||
Sebastian at basti79.de
|
|
||||||
Shmulik Regev
|
|
||||||
Steinar H. Gunderson
|
|
||||||
Tofu Linden
|
|
||||||
Vlad Dinulescu
|
|
||||||
William Ahern
|
|
||||||
Yang Tse
|
|
||||||
liren at vivisimo.com
|
|
||||||
936
ares/CHANGES
936
ares/CHANGES
@@ -1,936 +0,0 @@
|
|||||||
Changelog for the c-ares project
|
|
||||||
|
|
||||||
* 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 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)
|
|
||||||
- Do not halt compilation when using VS2008 to build a Windows 2000 target.
|
|
||||||
|
|
||||||
* February 3 2009 (Phil Blundell)
|
|
||||||
- If the server returns garbage or nothing at all in response to an AAAA query,
|
|
||||||
go on and ask for A records anyway.
|
|
||||||
|
|
||||||
* January 31 2009 (Daniel Stenberg)
|
|
||||||
- ares_gethostbyname() now accepts 'AF_UNSPEC' as a family for resolving
|
|
||||||
either AF_INET6 or AF_INET. It works by accepting any of the looksups in the
|
|
||||||
hosts file, and it resolves the AAAA field with a fallback to A.
|
|
||||||
|
|
||||||
* January 14 2009 (Daniel Stenberg)
|
|
||||||
- ares.h no longer uses the HAVE_STRUCT_IN6_ADDR define check, but instead it
|
|
||||||
now declares the private struct ares_in6_addr for all systems instead of
|
|
||||||
relying on one possibly not present in the system.
|
|
||||||
|
|
||||||
* January 13 2009 (Phil Blundell)
|
|
||||||
- ares__send_query() now varies the retry timeout pseudo-randomly to avoid
|
|
||||||
packet storms when several queries were started at the same time.
|
|
||||||
|
|
||||||
* January 11 2009 (Daniel Stenberg)
|
|
||||||
- Phil Blundell added the internal function ares__expand_name_for_response()
|
|
||||||
that is now used by the ares_parse_*_reply() functions instead of the
|
|
||||||
ares_expand_name() simply to easier return ARES_EBADRESP for the cases where
|
|
||||||
the name expansion fails as in responses that really isn't expected.
|
|
||||||
|
|
||||||
Version 1.6.0 (Dec 9, 2008)
|
|
||||||
|
|
||||||
* December 9 2008 (Gisle Vanem)
|
|
||||||
|
|
||||||
Fixes for Win32 targets using the Watt-32 tcp/ip stack.
|
|
||||||
|
|
||||||
* Dec 4 2008 (Daniel Stenberg)
|
|
||||||
|
|
||||||
Gregor Jasny provided the patch that introduces ares_set_socket_callback(),
|
|
||||||
and I edited it to also get duped by ares_dup().
|
|
||||||
|
|
||||||
* Dec 3 2008 (Daniel Stenberg)
|
|
||||||
|
|
||||||
API changes:
|
|
||||||
|
|
||||||
I made sure the public ares_config struct looks like before and yet it
|
|
||||||
supports the ROTATE option thanks to c-ares now storing the "optmask"
|
|
||||||
internally. Thus we should be ABI compatible with the past release(s)
|
|
||||||
now. My efforts mentioned below should not break backwards ABI compliance.
|
|
||||||
|
|
||||||
Here's how I suggest we proceed with the API:
|
|
||||||
|
|
||||||
ares_init() will be primary "channel creator" function.
|
|
||||||
|
|
||||||
ares_init_options() will continue to work exactly like now and before. For
|
|
||||||
starters, it will be the (only) way to set the existing options.
|
|
||||||
|
|
||||||
ares_save_options() will continue to work like today, but will ONLY save
|
|
||||||
options that you can set today (including ARES_OPT_ROTATE actually) but new
|
|
||||||
options that we add may not be saved with this.
|
|
||||||
|
|
||||||
Instead we introduce:
|
|
||||||
|
|
||||||
ares_dup() that instead can make a new channel and clone the config used
|
|
||||||
from an existing channel. It will then clone all config options, including
|
|
||||||
future new things we add.
|
|
||||||
|
|
||||||
ares_set_*() style functions that set (new) config options. As a start we
|
|
||||||
simply add these for new functionality, but over time we can also introduce
|
|
||||||
them for existing "struct ares_options" so that we can eventually deprecate
|
|
||||||
the two ares_*_options() functions.
|
|
||||||
|
|
||||||
ares_get_*() style functions for extracting info from a channel handle that
|
|
||||||
should be used instead of ares_save_options().
|
|
||||||
|
|
||||||
* Nov 26 2008 (Yang Tse)
|
|
||||||
- Brad Spencer provided changes to allow buildconf to work on OS X.
|
|
||||||
|
|
||||||
- Gerald Combs fixed a bug in ares_parse_ptr_reply() which would cause a
|
|
||||||
buffer to shrink instead of expand if a reply contained 8 or more records.
|
|
||||||
|
|
||||||
* Nov 25 2008 (Yang Tse)
|
|
||||||
- In preparation for the upcomming IPv6 nameservers patch, the internal
|
|
||||||
ares_addr union is now changed into an internal struct which also holds
|
|
||||||
the address family.
|
|
||||||
|
|
||||||
* Nov 19 2008 (Daniel Stenberg)
|
|
||||||
- Brad Spencer brought the new function ares_gethostbyname_file() which simply
|
|
||||||
resolves a host name from the given file, using the regular hosts syntax.
|
|
||||||
|
|
||||||
* Nov 1 2008 (Daniel Stenberg)
|
|
||||||
- Carlo Contavalli added support for the glibc "rotate" option, as documented
|
|
||||||
in man resolv.conf:
|
|
||||||
|
|
||||||
causes round robin selection of nameservers from among those listed. This
|
|
||||||
has the effect of spreading the query load among all listed servers, rather
|
|
||||||
than having all clients try the first listed server first every time.
|
|
||||||
|
|
||||||
You can enable it with ARES_OPT_ROTATE
|
|
||||||
|
|
||||||
* Oct 21 2008 (Yang Tse)
|
|
||||||
Charles Hardin added handling of EINPROGRESS for UDP connects.
|
|
||||||
|
|
||||||
* Oct 18 2008 (Daniel Stenberg)
|
|
||||||
Charles Hardin made adig support a regular numerical dotted IP address for the
|
|
||||||
-s option as well.
|
|
||||||
|
|
||||||
* Oct 7 2008 (Yang Tse)
|
|
||||||
- Added --enable-optimize configure option to enable and disable compiler
|
|
||||||
optimizations to allow decoupled setting from --enable-debug.
|
|
||||||
|
|
||||||
* Oct 2 2008 (Yang Tse)
|
|
||||||
- Added --enable-warnings configure option to enable and disable strict
|
|
||||||
compiler warnings to allow decoupled setting from --enable-debug.
|
|
||||||
|
|
||||||
* Sep 17 2008 (Yang Tse)
|
|
||||||
- Code reorganization to allow internal/private use of "nameser.h" to any
|
|
||||||
system that lacks arpa/nameser.h or arpa/nameser_compat.h header files.
|
|
||||||
|
|
||||||
* Sep 16 2008 (Yang Tse)
|
|
||||||
- Code reorganization to allow internal/private use of ares_writev to any
|
|
||||||
system that lacks the writev function.
|
|
||||||
|
|
||||||
* Sep 15 2008 (Yang Tse)
|
|
||||||
- Code reorganization to allow internal/private use of ares_strcasecmp to any
|
|
||||||
system that lacks the strcasecmp function.
|
|
||||||
|
|
||||||
- Improve configure detection of some string functions.
|
|
||||||
|
|
||||||
* Sep 11 2008 (Yang Tse)
|
|
||||||
- Code reorganization to allow internal/private use of ares_strdup to any
|
|
||||||
system that lacks the strdup function.
|
|
||||||
|
|
||||||
Version 1.5.3 (Aug 29, 2008)
|
|
||||||
|
|
||||||
* Aug 25 2008 (Yang Tse)
|
|
||||||
- Improvement by Brad House:
|
|
||||||
|
|
||||||
This patch addresses an issue in which a response could be sent back to the
|
|
||||||
source port of a client from a different address than the request was made to.
|
|
||||||
This is one form of a DNS cache poisoning attack.
|
|
||||||
|
|
||||||
The patch simply uses recvfrom() rather than recv() and validates that the
|
|
||||||
address returned from recvfrom() matches the address of the server we have
|
|
||||||
connected to. Only necessary on UDP sockets as they are connection-less, TCP
|
|
||||||
is unaffected.
|
|
||||||
|
|
||||||
- Fix by George Neill:
|
|
||||||
Fixed compilation of acountry sample application failure on some systems.
|
|
||||||
|
|
||||||
* Aug 4 2008 (Daniel Stenberg)
|
|
||||||
- Fix by Tofu Linden:
|
|
||||||
|
|
||||||
The symptom:
|
|
||||||
* Users (usually, but not always) on 2-Wire routers and the Comcast service
|
|
||||||
and a wired connection to their router would find that the second and
|
|
||||||
subsequent DNS lookups from fresh processes using c-ares to resolve the same
|
|
||||||
address would cause the process to never see a reply (it keeps polling for
|
|
||||||
around 1m15s before giving up).
|
|
||||||
|
|
||||||
The repro:
|
|
||||||
* On such a machine (and yeah, it took us a lot of QA to find the systems
|
|
||||||
that reproduce such a specific problem!), do 'ahost www.secondlife.com',
|
|
||||||
then do it again. The first process's lookup will work, subsequent lookups
|
|
||||||
will time-out and fail.
|
|
||||||
|
|
||||||
The cause:
|
|
||||||
* init_id_key() was calling randomize_key() *before* it initialized
|
|
||||||
key->state, meaning that the randomness generated by randomize_key() is
|
|
||||||
immediately overwritten with deterministic values. (/dev/urandom was also
|
|
||||||
being read incorrectly in the c-ares version we were using, but this was
|
|
||||||
fixed in a later version.)
|
|
||||||
* This makes the stream of generated query-IDs from any new c-ares process
|
|
||||||
be an identical and predictable sequence of IDs.
|
|
||||||
* This makes the 2-Wire's default built-in DNS server detect these queries
|
|
||||||
as probable-duplicates and (erroneously) not respond at all.
|
|
||||||
|
|
||||||
|
|
||||||
* Aug 4 2008 (Yang Tse)
|
|
||||||
- Autoconf 2.62 has changed the behaviour of the AC_AIX macro which we use.
|
|
||||||
Prior versions of autoconf defined _ALL_SOURCE if _AIX was defined. 2.62
|
|
||||||
version of AC_AIX defines _ALL_SOURCE and other four preprocessor symbols
|
|
||||||
no matter if the system is AIX or not. To keep the traditional behaviour,
|
|
||||||
and an uniform one across autoconf versions AC_AIX is replaced with our
|
|
||||||
own internal macro CARES_CHECK_AIX_ALL_SOURCE.
|
|
||||||
|
|
||||||
* Aug 1 2008 (Yang Tse)
|
|
||||||
- Configure process now checks if the preprocessor _REENTRANT symbol is already
|
|
||||||
defined. If it isn't currently defined a set of checks are performed to test
|
|
||||||
if its definition is required to make visible to the compiler a set of *_r
|
|
||||||
functions. Finally, if _REENTRANT is already defined or needed it takes care
|
|
||||||
of making adjustments necessary to ensure that it is defined equally for the
|
|
||||||
configure process tests and generated config file.
|
|
||||||
|
|
||||||
* Jul 20 2008 (Yang Tse)
|
|
||||||
- When recvfrom prototype uses a void pointer for arguments 2, 5 or 6 this will
|
|
||||||
now cause the definition, as appropriate, of RECVFROM_TYPE_ARG2_IS_VOID,
|
|
||||||
RECVFROM_TYPE_ARG5_IS_VOID or RECVFROM_TYPE_ARG6_IS_VOID.
|
|
||||||
|
|
||||||
* Jul 17 2008 (Yang Tse)
|
|
||||||
- RECVFROM_TYPE_ARG2, RECVFROM_TYPE_ARG5 and RECVFROM_TYPE_ARG6 are now defined
|
|
||||||
to the data type pointed by its respective argument and not the pointer type.
|
|
||||||
|
|
||||||
* Jul 16 2008 (Yang Tse)
|
|
||||||
- Improved configure detection of number of arguments for getservbyport_r.
|
|
||||||
Detection is now based on compilation checks instead of linker ones.
|
|
||||||
|
|
||||||
- Configure process now checks availability of recvfrom() socket function and
|
|
||||||
finds out its return type and the types of its arguments. Added definitions
|
|
||||||
for non-configure systems config files, and introduced macro sreadfrom which
|
|
||||||
will be used on udp sockets as a recvfrom() wrapper in the future.
|
|
||||||
|
|
||||||
* Jul 15 2008 (Yang Tse)
|
|
||||||
- Introduce definition of _REENTRANT symbol in setup.h to improve library
|
|
||||||
usability. Previously the configure process only used the AC_SYS_LARGEFILE
|
|
||||||
macro for debug builds, now it is also used for non-debug ones enabling the
|
|
||||||
use of configure options --enable-largefile and --disable-largefile which
|
|
||||||
might be needed for library compatibility. Remove checking the size of
|
|
||||||
curl_off_t, it is no longer needed.
|
|
||||||
|
|
||||||
* Jul 3 2008 (Daniel Stenberg)
|
|
||||||
- Phil Blundell: If you ask ares_gethostbyname() to do an AF_INET6 lookup and
|
|
||||||
the target host has only A records, it automatically falls back to an
|
|
||||||
AF_INET lookup and gives you the A results. However, if the target host has
|
|
||||||
a CNAME record, this behaviour is defeated since the original query does
|
|
||||||
return some data even though ares_parse_aaa_reply() doesn't consider it
|
|
||||||
relevant. Here's a small patch to make it behave the same with and without
|
|
||||||
the CNAME.
|
|
||||||
|
|
||||||
* Jul 2 2008 (Yang Tse)
|
|
||||||
- Fallback to gettimeofday when monotonic clock is unavailable at run-time.
|
|
||||||
|
|
||||||
* Jun 30 2008 (Daniel Stenberg)
|
|
||||||
|
|
||||||
- As was pointed out to me by Andreas Schuldei, the MAXHOSTNAMELEN define is
|
|
||||||
not posix or anything and thus c-ares failed to build on hurd (and possibly
|
|
||||||
elsewhere). The define was also somewhat artificially used in the windows
|
|
||||||
port. Now, I instead rewrote the use of gethostbyname to enlarge the host
|
|
||||||
name buffer in case of need and totally avoid the use of the MAXHOSTNAMELEN
|
|
||||||
define. I thus also removed the defien from the namser.h file where it was
|
|
||||||
once added for the windows build.
|
|
||||||
|
|
||||||
I also fixed init_by_defaults() function to not leak memory in case if
|
|
||||||
error.
|
|
||||||
|
|
||||||
* Jun 9 2008 (Yang Tse)
|
|
||||||
|
|
||||||
- Make libcares.pc generated file for pkg-config include information relative
|
|
||||||
to the libraries needed for the static linking of c-ares.
|
|
||||||
|
|
||||||
* May 30 2008 (Yang Tse)
|
|
||||||
|
|
||||||
- Brad House fixed a missing header file inclusion in adig sample program.
|
|
||||||
|
|
||||||
Version 1.5.2 (May 29, 2008)
|
|
||||||
|
|
||||||
* May 13 2008 (Daniel Stenberg)
|
|
||||||
|
|
||||||
- Introducing millisecond resolution support for the timeout option. See
|
|
||||||
ares_init_options()'s ARES_OPT_TIMEOUTMS.
|
|
||||||
|
|
||||||
* May 9 2008 (Yang Tse)
|
|
||||||
|
|
||||||
- Use monotonic time source if available, for private function ares__tvnow()
|
|
||||||
|
|
||||||
* May 7 2008 (Daniel Stenberg)
|
|
||||||
|
|
||||||
- Sebastian made c-ares able to return all PTR-records when doing reverse
|
|
||||||
lookups. It is not common practice to have multiple PTR-Records for a single
|
|
||||||
IP, but its perfectly legal and some sites have those.
|
|
||||||
|
|
||||||
- Doug Goldstein provided a configure patch: updates autoconf 2.13 usage to
|
|
||||||
autoconf 2.57 usage (which is the version you have specified as the minimum
|
|
||||||
version). It's a minor change but it does clean up some warnings with newer
|
|
||||||
autoconf (specifically 2.62).
|
|
||||||
|
|
||||||
* May 5 2008 (Yang Tse)
|
|
||||||
|
|
||||||
- Improved parsing of resolver configuration files.
|
|
||||||
|
|
||||||
* April 4 2008 (Daniel Stenberg)
|
|
||||||
|
|
||||||
- Eino Tuominen improved the code when a file is used to seed the randomizer.
|
|
||||||
|
|
||||||
- Alexey Simak made adig support NAPTR records
|
|
||||||
|
|
||||||
- Alexey Simak fixed the VC dsp file by adding the missing source file
|
|
||||||
ares_expand_string.c
|
|
||||||
|
|
||||||
* December 11 2007 (Gisle Vanem)
|
|
||||||
|
|
||||||
- Added another sample application; acountry.c which converts an
|
|
||||||
IPv4-address(es) and/or host-name(s) to country-name and country-code.
|
|
||||||
This uses the service of the DNSBL at countries.nerd.dk.
|
|
||||||
|
|
||||||
* December 3 2007 (Daniel Stenberg)
|
|
||||||
|
|
||||||
- Brad Spencer fixed the configure script to assume that there's no
|
|
||||||
/dev/urandom when built cross-compiled as then the script cannot check for
|
|
||||||
it.
|
|
||||||
|
|
||||||
- Erik Kline cleaned up ares_gethostbyaddr.c:next_lookup() somewhat
|
|
||||||
|
|
||||||
Version 1.5.1 (Nov 21, 2007)
|
|
||||||
|
|
||||||
* November 21 2007 (Daniel Stenberg)
|
|
||||||
|
|
||||||
- Robin Cornelius pointed out that ares_llist.h was missing in the release
|
|
||||||
archive for 1.5.0
|
|
||||||
|
|
||||||
Version 1.5.0 (Nov 21, 2007)
|
|
||||||
|
|
||||||
* October 2 2007 (Daniel Stenberg)
|
|
||||||
|
|
||||||
- ares_strerror() segfaulted if the input error number was out of the currently
|
|
||||||
supported range.
|
|
||||||
|
|
||||||
- Yang Tse: Avoid a segfault when generating a DNS "Transaction ID" in
|
|
||||||
internal function init_id_key() under low memory conditions.
|
|
||||||
|
|
||||||
* September 28 2007 (Daniel Stenberg)
|
|
||||||
|
|
||||||
- Bumped version to 1.5.0 for next release and soname bumped to 2 due to ABI
|
|
||||||
and API changes in the progress callback (and possibly more coming up from
|
|
||||||
Steinar)
|
|
||||||
|
|
||||||
* September 28 2007 (Steinar H. Gunderson)
|
|
||||||
|
|
||||||
- Don't skip a server if it's the only one. (Bugfix from the Google tree.)
|
|
||||||
|
|
||||||
- Made the query callbacks receive the number of timeouts that happened during
|
|
||||||
the execution of a query, and updated documentation accordingly. (Patch from
|
|
||||||
the Google tree.)
|
|
||||||
|
|
||||||
- Support a few more socket options: ARES_OPT_SOCK_SNDBUF and
|
|
||||||
ARES_OPT_SOCK_RCVBUF
|
|
||||||
|
|
||||||
- Always register for TCP events even if there are no outstanding queries, as
|
|
||||||
the other side could always close the connection, which is a valid event
|
|
||||||
which should be responded to.
|
|
||||||
|
|
||||||
* September 22 2007 (Daniel Stenberg)
|
|
||||||
|
|
||||||
- Steinar H. Gunderson fixed: Correctly clear sockets from the fd_set on in
|
|
||||||
several functions (write_tcp_data, read_tcp_data, read_udp_packets) so that
|
|
||||||
if it fails and the socket is closed the following code doesn't try to use
|
|
||||||
the file descriptor.
|
|
||||||
|
|
||||||
- Steinar H. Gunderson modified c-ares to now also do to DNS retries even when
|
|
||||||
TCP is used since there are several edge cases where it still makes sense.
|
|
||||||
|
|
||||||
- Brad House provided a fix for ares_save_options():
|
|
||||||
|
|
||||||
Apparently I overlooked something with the ares_save_options() where it
|
|
||||||
would try to do a malloc(0) when no options of that type needed to be saved.
|
|
||||||
On most platforms, this was fine because malloc(0) doesn't actually return
|
|
||||||
NULL, but on AIX it does, so ares_save_options would return ARES_ENOMEM.
|
|
||||||
|
|
||||||
* July 14 2007 (Daniel Stenberg)
|
|
||||||
|
|
||||||
- Vlad Dinulescu fixed two outstanding valgrind reports:
|
|
||||||
|
|
||||||
1. In ares_query.c , in find_query_by_id we compare q->qid (which is a short
|
|
||||||
int variable) with qid, which is declared as an int variable. Moreover,
|
|
||||||
DNS_HEADER_SET_QID is used to set the value of qid, but DNS_HEADER_SET_QID
|
|
||||||
sets only the first two bytes of qid. I think that qid should be declared as
|
|
||||||
"unsigned short" in this function.
|
|
||||||
|
|
||||||
2. The same problem occurs in ares_process.c, process_answer() . query->qid
|
|
||||||
(an unsigned short integer variable) is compared with id, which is an
|
|
||||||
integer variable. Moreover, id is initialized from DNS_HEADER_QID which sets
|
|
||||||
only the first two bytes of id. I think that the id variable should be
|
|
||||||
declared as "unsigned short" in this function.
|
|
||||||
|
|
||||||
Even after declaring these variables as "unsigned short", the valgrind
|
|
||||||
errors are still there. Which brings us to the third problem.
|
|
||||||
|
|
||||||
3. The third problem is that Valgrind assumes that query->qid is not
|
|
||||||
initialised correctly. And it does that because query->qid is set from
|
|
||||||
DNS_HEADER_QID(qbuf); Valgrind says that qbuf has unitialised bytes. And
|
|
||||||
qbuf has uninitialised bytes because of channel->next_id . And next_id is
|
|
||||||
set by ares_init.c:ares__generate_new_id() . I found that putting short r=0
|
|
||||||
in this function (instead of short r) makes all Valgrind warnings go away.
|
|
||||||
I have studied ares__rc4() too, and this is the offending line:
|
|
||||||
|
|
||||||
buffer_ptr[counter] ^= state[xorIndex]; (ares_query.c:62)
|
|
||||||
|
|
||||||
This is what triggers Valgrind.. buffer_ptr is unitialised in this function,
|
|
||||||
and by applying ^= on it, it remains unitialised.
|
|
||||||
|
|
||||||
Version 1.4.0 (June 8, 2007)
|
|
||||||
|
|
||||||
* June 4 2007 (Daniel Stenberg)
|
|
||||||
|
|
||||||
- James Bursa reported a major memory problem when resolving multi-IP names
|
|
||||||
and I found and fixed the problem. It was added by Ashish Sharma's patch
|
|
||||||
two days ago.
|
|
||||||
|
|
||||||
When I then tried to verify multiple entries in /etc/hosts after my fix, I
|
|
||||||
got another segfault and decided this code was not ripe for inclusion and I
|
|
||||||
reverted the patch.
|
|
||||||
|
|
||||||
* June 2 2007
|
|
||||||
|
|
||||||
- Brad Spencer found and fixed three flaws in the code, found with the new
|
|
||||||
gcc 4.2.0 warning: -Waddress
|
|
||||||
|
|
||||||
- Brad House fixed VS2005 compiler warnings due to time_t being 64bit.
|
|
||||||
He also made recent Microsoft compilers use _strdup() instead of strdup().
|
|
||||||
|
|
||||||
- Brad House's man pages for ares_save_options() and ares_destroy_options()
|
|
||||||
were added.
|
|
||||||
|
|
||||||
- Ashish Sharma provided a patch for supporting multiple entries in the
|
|
||||||
/etc/hosts file. Patch edited for coding style and functionality by me
|
|
||||||
(Daniel).
|
|
||||||
|
|
||||||
* May 30 2007
|
|
||||||
|
|
||||||
- Shmulik Regev brought cryptographically secure transaction IDs:
|
|
||||||
|
|
||||||
The c-ares library implementation uses a DNS "Transaction ID" field that is
|
|
||||||
seeded with a pseudo random number (based on gettimeofday) which is
|
|
||||||
incremented (++) between consecutive calls and is therefore rather
|
|
||||||
predictable. In general, predictability of DNS Transaction ID is a well
|
|
||||||
known security problem (e.g.
|
|
||||||
http://bak.spc.org/dms/archive/dns_id_attack.txt) and makes a c-ares based
|
|
||||||
implementation vulnerable to DNS poisoning. Credit goes to Amit Klein
|
|
||||||
(Trusteer) for identifying this problem.
|
|
||||||
|
|
||||||
The patch I wrote changes the implementation to use a more secure way of
|
|
||||||
generating unique IDs. It starts by obtaining a key with reasonable entropy
|
|
||||||
which is used with an RC4 stream to generate the cryptographically secure
|
|
||||||
transaction IDs.
|
|
||||||
|
|
||||||
Note that the key generation code (in ares_init:randomize_key) has two
|
|
||||||
versions, the Windows specific one uses a cryptographically safe function
|
|
||||||
provided (but undocumented :) by the operating system (described at
|
|
||||||
http://blogs.msdn.com/michael_howard/archive/2005/01/14/353379.aspx). The
|
|
||||||
default implementation is a bit naive and uses the standard 'rand'
|
|
||||||
function. Surely a better way to generate random keys exists for other
|
|
||||||
platforms.
|
|
||||||
|
|
||||||
The patch can be tested by using the adig utility and using the '-s' option.
|
|
||||||
|
|
||||||
- Brad House added ares_save_options() and ares_destroy_options() that can be
|
|
||||||
used to keep options for later re-usal when ares_init_options() is used.
|
|
||||||
|
|
||||||
Problem: Calling ares_init() for each lookup can be unnecessarily resource
|
|
||||||
intensive. On windows, it must LoadLibrary() or search the registry
|
|
||||||
on each call to ares_init(). On unix, it must read and parse
|
|
||||||
multiple files to obtain the necessary configuration information. In
|
|
||||||
a single-threaded environment, it would make sense to only
|
|
||||||
ares_init() once, but in a heavily multi-threaded environment, it is
|
|
||||||
undesirable to ares_init() and ares_destroy() for each thread created
|
|
||||||
and track that.
|
|
||||||
|
|
||||||
Solution: Create ares_save_options() and ares_destroy_options() functions to
|
|
||||||
retrieve and free options obtained from an initialized channel. The
|
|
||||||
options populated can be used to pass back into ares_init_options(),
|
|
||||||
it should populate all needed fields and not retrieve any information
|
|
||||||
from the system. Probably wise to destroy the cache every minute or
|
|
||||||
so to prevent the data from becoming stale.
|
|
||||||
|
|
||||||
- Daniel S added ares_process_fd() to allow applications to ask for processing
|
|
||||||
on specific sockets and thus avoiding select() and associated
|
|
||||||
functions/macros. This function will be used by upcoming libcurl releases
|
|
||||||
for this very reason. It also made me export the ares_socket_t type in the
|
|
||||||
public ares.h header file, since ares_process_fd() uses that type for two of
|
|
||||||
the arguments.
|
|
||||||
|
|
||||||
* May 25 2007
|
|
||||||
|
|
||||||
- Ravi Pratap fixed a flaw in the init_by_resolv_conf() function for windows
|
|
||||||
that could cause it to return a bad return code.
|
|
||||||
|
|
||||||
* April 16 2007
|
|
||||||
|
|
||||||
- Yang Tse: Provide ares_getopt() command-line parser function as a source
|
|
||||||
code helper function, not belonging to the actual c-ares library.
|
|
||||||
|
|
||||||
* February 19 2007
|
|
||||||
|
|
||||||
- Vlad Dinulescu added ares_parse_ns_reply().
|
|
||||||
|
|
||||||
* February 13 2007
|
|
||||||
|
|
||||||
- Yang Tse: Fix failure to get the search sequence of /etc/hosts and
|
|
||||||
DNS from /etc/nsswitch.conf, /etc/host.conf or /etc/svc.conf when
|
|
||||||
/etc/resolv.conf did not exist or was unable to read it.
|
|
||||||
|
|
||||||
* November 22 2006
|
|
||||||
|
|
||||||
- Install ares_dns.h too
|
|
||||||
|
|
||||||
- Michael Wallner fixed this problem: When I set domains in the options
|
|
||||||
struct, and there are domain/search entries in /etc/resolv.conf, the domains
|
|
||||||
of the options struct will be overridden.
|
|
||||||
|
|
||||||
* November 6 2006
|
|
||||||
|
|
||||||
- Yang Tse removed a couple of potential zero size memory allocations.
|
|
||||||
|
|
||||||
- Andreas Rieke fixed the line endings in the areslib.dsp file that I (Daniel)
|
|
||||||
broke in the 1.3.2 release. We should switch to a system where that file is
|
|
||||||
auto-generated. We could rip some code for that from curl...
|
|
||||||
|
|
||||||
Version 1.3.2 (November 3, 2006)
|
|
||||||
|
|
||||||
* October 12 2006
|
|
||||||
|
|
||||||
- Prevent ares_getsock() to overflow if more than 16 sockets are used.
|
|
||||||
|
|
||||||
* September 11 2006
|
|
||||||
|
|
||||||
- Guilherme Balena Versiani: I noted a strange BUG in Win32 port
|
|
||||||
(ares_init.c/get_iphlpapi_dns_info() function): when I disable the network
|
|
||||||
by hand or disconnect the network cable in Windows 2000 or Windows XP, my
|
|
||||||
application gets 127.0.0.1 as the only name server. The problem comes from
|
|
||||||
'GetNetworkParams' function, that returns the empty string "" as the only
|
|
||||||
name server in that case. Moreover, the Windows implementation of
|
|
||||||
inet_addr() returns INADDR_LOOPBACK instead of INADDR_NONE.
|
|
||||||
|
|
||||||
* August 29 2006
|
|
||||||
|
|
||||||
- Brad Spencer did
|
|
||||||
|
|
||||||
o made ares_version.h use extern "C" for c++ compilers
|
|
||||||
o fixed compiler warnings in ares_getnameinfo.c
|
|
||||||
o fixed a buffer position init for TCP reads
|
|
||||||
|
|
||||||
* August 3 2006
|
|
||||||
|
|
||||||
- Ravi Pratap fixed ares_getsock() to actually return the proper bitmap and
|
|
||||||
not always zero!
|
|
||||||
|
|
||||||
Version 1.3.1 (June 24, 2006)
|
|
||||||
|
|
||||||
* July 23, 2006
|
|
||||||
|
|
||||||
- Gisle Vanem added getopt() to the ahost program. Currently accepts
|
|
||||||
only [-t {a|aaaa}] to specify address family in ares_gethostbyname().
|
|
||||||
|
|
||||||
* June 19, 2006
|
|
||||||
|
|
||||||
- (wahern) Removed "big endian" DNS section and RR data integer parser
|
|
||||||
macros from ares_dns.h, which break c-ares on my Sparc64. Bit-wise
|
|
||||||
operations in C operate on logical values. And in any event the octets are
|
|
||||||
already in big-endian (aka network) byte order so they're being reversed
|
|
||||||
(thus the source of the breakage).
|
|
||||||
|
|
||||||
* June 18, 2006
|
|
||||||
|
|
||||||
- William Ahern handles EAGAIN/EWOULDBLOCK errors in most of the I/O calls
|
|
||||||
from area_process.c.
|
|
||||||
|
|
||||||
TODO: Handle one last EAGAIN for a UDP socket send(2) in
|
|
||||||
ares__send_query().
|
|
||||||
|
|
||||||
* May 10, 2006
|
|
||||||
|
|
||||||
- Bram Matthys brought my attention to a libtool peculiarity where detecting
|
|
||||||
things such as C++ compiler actually is a bad thing and since we don't need
|
|
||||||
that detection I added a work-around, much inspired by a previous patch by
|
|
||||||
Paolo Bonzini. This also shortens the configure script quite a lot.
|
|
||||||
|
|
||||||
* May 3, 2006
|
|
||||||
|
|
||||||
- Nick Mathewson added the ARES_OPT_SOCK_STATE_CB option that when set makes
|
|
||||||
c-ares call a callback on socket state changes. A better way than the
|
|
||||||
ares_getsock() to get full control over the socket state.
|
|
||||||
|
|
||||||
* January 9, 2006
|
|
||||||
|
|
||||||
- Alexander Lazic improved the getservbyport_r() configure check.
|
|
||||||
|
|
||||||
* January 6, 2006
|
|
||||||
|
|
||||||
- Alexander Lazic pointed out that the buildconf should use the ACLOCAL_FLAGS
|
|
||||||
variable for easier controlling what it does and how it runs.
|
|
||||||
|
|
||||||
* January 5, 2006
|
|
||||||
|
|
||||||
- James Bursa fixed c-ares to find the hosts file on RISC OS, and made it
|
|
||||||
build with newer gcc versions that no longer defines "riscos".
|
|
||||||
|
|
||||||
* December 22
|
|
||||||
|
|
||||||
- Daniel Stenberg added ares_getsock() that extracts the set of sockets to
|
|
||||||
wait for action on. Similar to ares_fds() but not restricted to using
|
|
||||||
select() for the waiting.
|
|
||||||
|
|
||||||
* November 25
|
|
||||||
|
|
||||||
- Yang Tse fixed some send() / recv() compiler warnings
|
|
||||||
|
|
||||||
* September 18
|
|
||||||
|
|
||||||
- Added constants that will be used by ares_getaddrinfo
|
|
||||||
|
|
||||||
- Made ares_getnameinfo use the reentrant getservbyport (getservbyport_r) if it
|
|
||||||
is available to ensure it works properly in a threaded environment.
|
|
||||||
|
|
||||||
* September 10
|
|
||||||
|
|
||||||
- configure fix for detecting a member in the sockaddr_in6 struct which failed
|
|
||||||
on ipv6-enabled HP-UX 11.00
|
|
||||||
|
|
||||||
Version 1.3.0 (August 29, 2005)
|
|
||||||
|
|
||||||
* August 21
|
|
||||||
|
|
||||||
- Alfredo Tupone provided a fix for the Windows code in get_iphlpapi_dns_info()
|
|
||||||
when getting the DNS server etc.
|
|
||||||
|
|
||||||
* June 19
|
|
||||||
|
|
||||||
- Added some checks for the addrinfo structure.
|
|
||||||
|
|
||||||
* June 2
|
|
||||||
|
|
||||||
- William Ahern:
|
|
||||||
|
|
||||||
Make UDP sockets non-blocking. I've confirmed that at least on Linux 2.4 a
|
|
||||||
read event can come back from poll() on a valid SOCK_DGRAM socket but
|
|
||||||
recv(2) will still block. This patch doesn't ignore EAGAIN in
|
|
||||||
read_udp_packets(), though maybe it should. (This patch was edited by Daniel
|
|
||||||
Stenberg and a new configure test was added (imported from curl's configure)
|
|
||||||
to properly detect what non-blocking socket approach to use.)
|
|
||||||
|
|
||||||
I'm not quite sure how this was happening, but I've been seeing PTR queries
|
|
||||||
which seem to return empty responses. At least, they were empty when calling
|
|
||||||
ares_expand_name() on the record. Here's a patch which guarantees to
|
|
||||||
NUL-terminate the expanded name. The old behavior failed to NUL-terminate if
|
|
||||||
len was 0, and this was causing strlen() to run past the end of the buffer
|
|
||||||
after calling ares_expand_name() and getting ARES_SUCCESS as the return
|
|
||||||
value. If q is not greater than *s then it's equal and *s is always
|
|
||||||
allocated with at least one byte.
|
|
||||||
|
|
||||||
* May 16
|
|
||||||
|
|
||||||
- Added ares_getnameinfo which mimics the getnameinfo API (another feature
|
|
||||||
that could use testing).
|
|
||||||
|
|
||||||
* May 14
|
|
||||||
|
|
||||||
- Added an inet_ntop function from BIND for systems that do not have it.
|
|
||||||
|
|
||||||
* April 9
|
|
||||||
|
|
||||||
- Made sortlist support IPv6 (this can probably use some testing).
|
|
||||||
|
|
||||||
- Made sortlist support CIDR matching for IPv4.
|
|
||||||
|
|
||||||
* April 8
|
|
||||||
|
|
||||||
- Added preliminary IPv6 support to ares_gethostbyname. Currently, sortlist
|
|
||||||
does not work with IPv6. Also provided an implementation of bitncmp from
|
|
||||||
BIND for systems that do not supply this function. This will be used to add
|
|
||||||
IPv6 support to sortlist.
|
|
||||||
|
|
||||||
- Made ares_gethostbyaddr support IPv6 by specifying AF_INET6 as the family.
|
|
||||||
The function can lookup IPv6 addresses both from files (/etc/hosts) and
|
|
||||||
DNS lookups.
|
|
||||||
|
|
||||||
* April 7
|
|
||||||
|
|
||||||
- Tupone Alfredo fixed includes of arpa/nameser_compat.h to build fine on Mac
|
|
||||||
OS X.
|
|
||||||
|
|
||||||
* April 5
|
|
||||||
|
|
||||||
- Dominick Meglio: Provided implementations of inet_net_pton and inet_pton
|
|
||||||
from BIND for systems that do not include these functions.
|
|
||||||
|
|
||||||
* March 11, 2005
|
|
||||||
|
|
||||||
- Dominick Meglio added ares_parse_aaaa_reply.c and did various
|
|
||||||
adjustments. The first little steps towards IPv6 support!
|
|
||||||
|
|
||||||
* November 7
|
|
||||||
|
|
||||||
- Fixed the VC project and makefile to use ares_cancel and ares_version
|
|
||||||
|
|
||||||
* October 24
|
|
||||||
|
|
||||||
- The released ares_version.h from 1.2.1 says 1.2.0 due to a maketgz flaw.
|
|
||||||
This is now fixed.
|
|
||||||
|
|
||||||
Version 1.2.1 (October 20, 2004)
|
|
||||||
|
|
||||||
* September 29
|
|
||||||
|
|
||||||
- Henrik Stoerner fix: got a report that Tru64 Unix (the unix from Digital
|
|
||||||
when they made Alpha's) uses /etc/svc.conf for the purpose fixed below for
|
|
||||||
other OSes. He made c-ares check for and understand it if present.
|
|
||||||
|
|
||||||
- Now c-ares will use local host name lookup _before_ DNS resolving by default
|
|
||||||
if nothing else is told.
|
|
||||||
|
|
||||||
* September 26
|
|
||||||
|
|
||||||
- Henrik Stoerner: found out that c-ares does not look at the /etc/host.conf
|
|
||||||
file to determine the sequence in which to search /etc/hosts and DNS. So on
|
|
||||||
systems where this order is defined by /etc/host.conf instead of a "lookup"
|
|
||||||
entry in /etc/resolv.conf, c-ares will always default to looking in DNS
|
|
||||||
first, and /etc/hosts second.
|
|
||||||
|
|
||||||
c-ares now looks at
|
|
||||||
|
|
||||||
1) resolv.conf (for the "lookup" line);
|
|
||||||
2) nsswitch.fon (for the "hosts:" line);
|
|
||||||
3) host.conf (for the "order" line).
|
|
||||||
|
|
||||||
First match wins.
|
|
||||||
|
|
||||||
- Dominick Meglio patched: C-ares on Windows assumed that the HOSTS file is
|
|
||||||
located in a static location. It assumed
|
|
||||||
C:\Windows\System32\Drivers\Etc. This is a poor assumption to make. In fact,
|
|
||||||
the location of the HOSTS file can be changed via a registry setting.
|
|
||||||
|
|
||||||
There is a key called DatabasePath which specifies the path to the HOSTS
|
|
||||||
file:
|
|
||||||
http://www.microsoft.com/technet/itsolutions/network/deploy/depovg/tcpip2k.mspx
|
|
||||||
|
|
||||||
The patch will make c-ares correctly consult the registry for the location
|
|
||||||
of this file.
|
|
||||||
|
|
||||||
* August 29
|
|
||||||
|
|
||||||
- Gisle Vanem fixed the MSVC build files.
|
|
||||||
|
|
||||||
* August 20
|
|
||||||
|
|
||||||
- Gisle Vanem made c-ares build and work with his Watt-32 TCP/IP stack.
|
|
||||||
|
|
||||||
* August 13
|
|
||||||
|
|
||||||
- Harshal Pradhan made a minor syntax change in ares_init.c to make it build
|
|
||||||
fine with MSVC 7.1
|
|
||||||
|
|
||||||
* July 24
|
|
||||||
|
|
||||||
- Made the lib get built static only if --enable-debug is used.
|
|
||||||
|
|
||||||
- Gisle Vanem fixed:
|
|
||||||
|
|
||||||
Basically in loops like handle_errors(), 'query->next' was assigned a local
|
|
||||||
variable and then query was referenced after the memory was freed by
|
|
||||||
next_server(). I've changed that so next_server() and end_query() returns
|
|
||||||
the next query. So callers should use this ret-value.
|
|
||||||
|
|
||||||
The next problem was that 'server->tcp_buffer_pos' had a random value at
|
|
||||||
entry to 1st recv() (luckily causing Winsock to return ENOBUFS).
|
|
||||||
|
|
||||||
I've also added a ares_writev() for Windows to streamline the code a bit
|
|
||||||
more.
|
|
||||||
|
|
||||||
* July 20
|
|
||||||
- Fixed a few variable return types for some system calls. Made configure
|
|
||||||
check for ssize_t to make it possible to use that when receiving the send()
|
|
||||||
error code. This is necessary to prevent compiler warnings on some systems.
|
|
||||||
|
|
||||||
- Made configure create config.h, and all source files now include setup.h that
|
|
||||||
might include the proper config.h (or a handicrafted alternative).
|
|
||||||
|
|
||||||
- Switched to 'ares_socket_t' type for sockets in ares, since Windows don't
|
|
||||||
use 'int' for that.
|
|
||||||
|
|
||||||
- automake-ified and libool-ified c-ares. Now it builds libcares as a shared
|
|
||||||
lib on most platforms if wanted. (This bloated the size of the release
|
|
||||||
archive with another 200K!)
|
|
||||||
|
|
||||||
- Makefile.am now uses Makefile.inc for the c sources, h headers and man
|
|
||||||
pages, to make it easier for other makefiles to use the exact same set of
|
|
||||||
files.
|
|
||||||
|
|
||||||
- Adjusted 'maketgz' to use the new automake magic when building distribution
|
|
||||||
archives.
|
|
||||||
|
|
||||||
- Anyone desires HTML and/or PDF versions of the man pages in the release
|
|
||||||
archives?
|
|
||||||
|
|
||||||
* July 3
|
|
||||||
- G<>nter Knauf made c-ares build and run on Novell Netware.
|
|
||||||
|
|
||||||
* July 1
|
|
||||||
- Gisle Vanem provided Makefile.dj to build with djgpp, added a few more djgpp
|
|
||||||
fixes and made ares not use 'errno' to provide further info on Windows.
|
|
||||||
|
|
||||||
* June 30
|
|
||||||
- Gisle Vanem made it build with djgpp and run fine with the Watt-32 stack.
|
|
||||||
|
|
||||||
* June 10
|
|
||||||
- Gisle Vanem's init patch for Windows:
|
|
||||||
|
|
||||||
The init_by_resolv_conf() function fetches the DNS-server(s)
|
|
||||||
from a series of registry branches.
|
|
||||||
|
|
||||||
This can be wrong in the case where DHCP has assigned nameservers, but the
|
|
||||||
user has overridden these servers with other prefered settings. Then it's
|
|
||||||
wrong to use the DHCPNAMESERVER setting in registry.
|
|
||||||
|
|
||||||
In the case of no global DHCP-assigned or fixed servers, but DNS server(s)
|
|
||||||
per adapter, one has to query the adapter branches. But how can c-ares know
|
|
||||||
which adapter is valid for use? AFAICS it can't. There could be one adapter
|
|
||||||
that is down (e.g. a VPN adapter).
|
|
||||||
|
|
||||||
So it's better to leave this to the IP Helper API (iphlapi) available in
|
|
||||||
Win-98/2000 and later. My patch falls-back to the old way if not available.
|
|
||||||
|
|
||||||
* June 8
|
|
||||||
- James Bursa fixed an init issue for RISC OS.
|
|
||||||
|
|
||||||
* May 11
|
|
||||||
- Nico Stappenbelt reported that when processing domain and search lines in
|
|
||||||
the resolv.conf file, the first entry encountered is processed and used as
|
|
||||||
the search list. According to the manual pages for both Linux, Solaris and
|
|
||||||
Tru64, the last entry of either a domain or a search field is used.
|
|
||||||
|
|
||||||
This is now adjusted in the code
|
|
||||||
|
|
||||||
Version 1.2.0 (April 13, 2004)
|
|
||||||
|
|
||||||
* April 2, 2004
|
|
||||||
- Updated various man pages to look nicer when converted to HTML on the web
|
|
||||||
site.
|
|
||||||
|
|
||||||
* April 1, 2004
|
|
||||||
- Dirk Manske provided a new function that is now named ares_cancel(). It is
|
|
||||||
used to cancel/cleanup a resolve/request made using ares functions on the
|
|
||||||
given ares channel. It does not destroy/kill the ares channel itself.
|
|
||||||
|
|
||||||
- Dominick Meglio cleaned up the formatting in several man pages.
|
|
||||||
|
|
||||||
* March 30, 2004
|
|
||||||
- Dominick Meglio's new ares_expand_string. A helper function when decoding
|
|
||||||
incoming DNS packages.
|
|
||||||
|
|
||||||
- Daniel Stenberg modified the Makefile.in to use a for loop for the man page
|
|
||||||
installation to improve overview and make it easier to add man pages.
|
|
||||||
|
|
||||||
Version 1.1.0 (March 11, 2004)
|
|
||||||
|
|
||||||
* March 9, 2004
|
|
||||||
- Gisle Vanem improved build on Windows.
|
|
||||||
|
|
||||||
* February 25, 2004
|
|
||||||
- Dan Fandrich found a flaw in the Feb 22 fix.
|
|
||||||
|
|
||||||
- Added better configure --enable-debug logic (taken from the curl configure
|
|
||||||
script). Added acinclude.m4 to the tarball.
|
|
||||||
|
|
||||||
* February 23, 2004
|
|
||||||
- Removed ares_free_errmem(), the function, the file and the man page. It was
|
|
||||||
not used and it did nothing.
|
|
||||||
|
|
||||||
- Fixed a lot of code that wasn't "64bit clean" and thus caused a lot of
|
|
||||||
compiler warnings on picky compilers.
|
|
||||||
|
|
||||||
* February 22, 2004
|
|
||||||
- Dominick Meglio made ares init support multiple name servers in the
|
|
||||||
NameServer key on Windows.
|
|
||||||
|
|
||||||
* February 16, 2004
|
|
||||||
- Modified ares_private.h to include libcurl's memory debug header if
|
|
||||||
CURLDEBUG is set. This makes all the ares-functions supervised properly by
|
|
||||||
the curl test suite. This also forced me to add inclusion of the
|
|
||||||
ares_private.h header in a few more files that are using some kind of
|
|
||||||
memory-related resources.
|
|
||||||
|
|
||||||
- Made the makefile only build ahost and adig if 'make demos' is used.
|
|
||||||
|
|
||||||
* February 10, 2004
|
|
||||||
- Dirk Manske made ares_version.h installed with 'make install'
|
|
||||||
|
|
||||||
* February 4, 2004
|
|
||||||
- ares_free_errmem() is subject for removal, it is simply present for future
|
|
||||||
purposes, and since we removed the extra parameter in strerror() it won't
|
|
||||||
be used by c-ares!
|
|
||||||
- configure --enable-debug now enables picky compiler options if gcc is used
|
|
||||||
- fixed several compiler warnings --enable-debug showed and Joerg Mueller-Tolk
|
|
||||||
reported
|
|
||||||
|
|
||||||
Version 1.0.0 (February 3, 2004)
|
|
||||||
|
|
||||||
* February 3, 2004
|
|
||||||
- now we produce the libcares.a library instead of the previous libares.a
|
|
||||||
since we are no longer compatible
|
|
||||||
|
|
||||||
* February 2, 2004
|
|
||||||
|
|
||||||
- ares_strerror() has one argument less. This is the first official
|
|
||||||
modification of the existing provided ares API.
|
|
||||||
|
|
||||||
* January 29, 2004
|
|
||||||
|
|
||||||
- Dirk Manske fixed how the socket is set non-blocking.
|
|
||||||
|
|
||||||
* January 4, 2004
|
|
||||||
|
|
||||||
- Dominick Meglio made the private gettimeofday() become ares_gettimeofday()
|
|
||||||
instead in order to not pollute the name space and risk colliding with
|
|
||||||
other libraries' versions of this function.
|
|
||||||
|
|
||||||
* October 24, 2003. Daniel Stenberg
|
|
||||||
|
|
||||||
Added ares_version().
|
|
||||||
|
|
||||||
Version 1.0-pre1 (8 October 2003)
|
|
||||||
|
|
||||||
- James Bursa made it run on RISC OS
|
|
||||||
|
|
||||||
- Dominick Meglio made it run fine on NT4
|
|
||||||
|
|
||||||
- Duncan Wilcox made it work fine on Mac OS X
|
|
||||||
|
|
||||||
- Daniel Stenberg adjusted the windows port
|
|
||||||
|
|
||||||
- liren at vivisimo.com made the initial windows port
|
|
||||||
|
|
||||||
* Imported the sources from ares 1.1.1
|
|
||||||
121
ares/Makefile.am
121
ares/Makefile.am
@@ -1,121 +0,0 @@
|
|||||||
AUTOMAKE_OPTIONS = foreign nostdinc
|
|
||||||
|
|
||||||
ACLOCAL_AMFLAGS = -I m4
|
|
||||||
|
|
||||||
# Specify our include paths here, and do it relative to $(top_srcdir) and
|
|
||||||
# $(top_builddir), to ensure that these paths which belong to the library
|
|
||||||
# being currently built and tested are searched before the library which
|
|
||||||
# might possibly already be installed in the system.
|
|
||||||
#
|
|
||||||
# When using the low-level hard-hacking memory leak tracking code from
|
|
||||||
# libcurl the generated curl/curlbuild.h file must also be reachable.
|
|
||||||
# Using the libcurl lowlevel code from within c-ares library is ugly and
|
|
||||||
# only works when c-ares is built and linked with a similarly debug-build
|
|
||||||
# libcurl, but we do this anyway for convenience.
|
|
||||||
#
|
|
||||||
# $(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) is for c-ares's lib/setup.h and other "c-ares-private" files
|
|
||||||
|
|
||||||
if CURLDEBUG
|
|
||||||
INCLUDES = -I$(top_builddir)/../include \
|
|
||||||
-I$(top_builddir) \
|
|
||||||
-I$(top_srcdir)
|
|
||||||
else
|
|
||||||
INCLUDES = -I$(top_builddir) \
|
|
||||||
-I$(top_srcdir)
|
|
||||||
endif
|
|
||||||
|
|
||||||
lib_LTLIBRARIES = libcares.la
|
|
||||||
|
|
||||||
man_MANS = $(MANPAGES)
|
|
||||||
|
|
||||||
MSVCFILES = vc/vc.dsw vc/acountry/acountry.dsp vc/adig/adig.dsp \
|
|
||||||
vc/ahost/ahost.dsp vc/areslib/areslib.dsp vc/areslib/areslib.dsw
|
|
||||||
|
|
||||||
if DEBUGBUILD
|
|
||||||
PROGS =
|
|
||||||
else
|
|
||||||
PROGS = ahost adig acountry
|
|
||||||
endif
|
|
||||||
|
|
||||||
noinst_PROGRAMS =$(PROGS)
|
|
||||||
|
|
||||||
# adig and ahost are just sample programs and thus not mentioned with the
|
|
||||||
# regular sources and headers
|
|
||||||
EXTRA_DIST = AUTHORS CHANGES README.cares Makefile.inc Makefile.dj \
|
|
||||||
Makefile.m32 Makefile.netware Makefile.vc6 $(man_MANS) $(MSVCFILES) \
|
|
||||||
config-win32.h RELEASE-NOTES libcares.pc.in buildconf get_ver.awk maketgz \
|
|
||||||
TODO ares_build.h.in buildconf.bat
|
|
||||||
|
|
||||||
DISTCLEANFILES = ares_build.h
|
|
||||||
|
|
||||||
pkgconfigdir = $(libdir)/pkgconfig
|
|
||||||
pkgconfig_DATA = libcares.pc
|
|
||||||
|
|
||||||
VER=-version-info 2:0:0
|
|
||||||
# This flag accepts an argument of the form current[:revision[:age]]. So,
|
|
||||||
# passing -version-info 3:12:1 sets current to 3, revision to 12, and age to
|
|
||||||
# 1.
|
|
||||||
#
|
|
||||||
# If either revision or age are omitted, they default to 0. Also note that age
|
|
||||||
# must be less than or equal to the current interface number.
|
|
||||||
#
|
|
||||||
# Here are a set of rules to help you update your library version information:
|
|
||||||
#
|
|
||||||
# 1.Start with version information of 0:0:0 for each libtool library.
|
|
||||||
#
|
|
||||||
# 2.Update the version information only immediately before a public release of
|
|
||||||
# your software. More frequent updates are unnecessary, and only guarantee
|
|
||||||
# that the current interface number gets larger faster.
|
|
||||||
#
|
|
||||||
# 3.If the library source code has changed at all since the last update, then
|
|
||||||
# increment revision (c:r+1:a)
|
|
||||||
#
|
|
||||||
# 4.If any interfaces have been added, removed, or changed since the last
|
|
||||||
# update, increment current, and set revision to 0. (c+1:r=0:a)
|
|
||||||
#
|
|
||||||
# 5.If any interfaces have been added since the last public release, then
|
|
||||||
# increment age. (c:r:a+1)
|
|
||||||
#
|
|
||||||
# 6.If any interfaces have been removed since the last public release, then
|
|
||||||
# set age to 0. (c:r:a=0)
|
|
||||||
#
|
|
||||||
|
|
||||||
if NO_UNDEFINED
|
|
||||||
# The -no-undefined flag is crucial for this to build fine on some platforms
|
|
||||||
UNDEF = -no-undefined
|
|
||||||
endif
|
|
||||||
|
|
||||||
EXPORT_SYMBOLS = -export-symbols-regex '^ares_[[:alnum:]].*'
|
|
||||||
|
|
||||||
libcares_la_LDFLAGS = $(UNDEF) $(VER) $(EXPORT_SYMBOLS)
|
|
||||||
|
|
||||||
# Makefile.inc provides the CSOURCES and HHEADERS defines
|
|
||||||
include Makefile.inc
|
|
||||||
|
|
||||||
libcares_la_SOURCES = $(CSOURCES) $(HHEADERS)
|
|
||||||
|
|
||||||
# where to install the c-ares headers
|
|
||||||
libcares_ladir = $(includedir)
|
|
||||||
# what headers to install on 'make install':
|
|
||||||
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_LDADD = $(top_builddir)/$(lib_LTLIBRARIES)
|
|
||||||
|
|
||||||
adig_SOURCES = adig.c ares_getopt.c ares_getopt.h
|
|
||||||
adig_LDADD = $(top_builddir)/$(lib_LTLIBRARIES)
|
|
||||||
|
|
||||||
acountry_SOURCES = acountry.c ares_getopt.c ares_getopt.h
|
|
||||||
acountry_LDADD = $(top_builddir)/$(lib_LTLIBRARIES)
|
|
||||||
|
|
||||||
# Make files named *.dist replace the file without .dist extension
|
|
||||||
dist-hook:
|
|
||||||
find $(distdir) -name "*.dist" -exec rm {} \;
|
|
||||||
(distit=`find $(srcdir) -name "*.dist"`; \
|
|
||||||
for file in $$distit; do \
|
|
||||||
strip=`echo $$file | sed -e s/^$(srcdir)// -e s/\.dist//`; \
|
|
||||||
cp $$file $(distdir)$$strip; \
|
|
||||||
done)
|
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
#
|
|
||||||
# c-ares Makefile for djgpp/gcc/Watt-32.
|
|
||||||
# By Gisle Vanem <giva@bgnett.no> 2004.
|
|
||||||
#
|
|
||||||
# $Id$
|
|
||||||
|
|
||||||
TOPDIR = ..
|
|
||||||
|
|
||||||
include ../packages/DOS/common.dj
|
|
||||||
|
|
||||||
include Makefile.inc
|
|
||||||
|
|
||||||
CFLAGS += -DWATT32 -DHAVE_AF_INET6 -DHAVE_PF_INET6 -DHAVE_IOCTLSOCKET \
|
|
||||||
-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 -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 \
|
|
||||||
-DHAVE_LIMITS_H
|
|
||||||
|
|
||||||
LDFLAGS = -s
|
|
||||||
|
|
||||||
ifeq ($(USE_DEBUG),1)
|
|
||||||
EX_LIBS = ../lib/libcurl.a
|
|
||||||
OBJ_HACK = $(OBJECTS)
|
|
||||||
else
|
|
||||||
OBJ_HACK = libcares.a
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(USE_SSL),1)
|
|
||||||
EX_LIBS += $(OPENSSL_ROOT)/lib/libssl.a $(OPENSSL_ROOT)/lib/libcrypt.a
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(USE_ZLIB),1)
|
|
||||||
EX_LIBS += $(ZLIB_ROOT)/libz.a
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(USE_IDNA),1)
|
|
||||||
EX_LIBS += $(LIBIDN_ROOT)/lib/dj_obj/libidn.a -liconv
|
|
||||||
endif
|
|
||||||
|
|
||||||
EX_LIBS += $(WATT32_ROOT)/lib/libwatt.a
|
|
||||||
|
|
||||||
OBJECTS = $(addprefix $(OBJ_DIR)/, $(CSOURCES:.c=.o))
|
|
||||||
|
|
||||||
all: $(OBJ_DIR) libcares.a ahost.exe adig.exe acountry.exe
|
|
||||||
@echo Welcome to c-ares.
|
|
||||||
|
|
||||||
libcares.a: $(OBJECTS)
|
|
||||||
ar rs $@ $?
|
|
||||||
|
|
||||||
ahost.exe: ahost.c $(OBJ_DIR)/ares_getopt.o $(OBJ_HACK)
|
|
||||||
$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^ $(EX_LIBS)
|
|
||||||
|
|
||||||
adig.exe: adig.c $(OBJ_DIR)/ares_getopt.o $(OBJ_HACK)
|
|
||||||
$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^ $(EX_LIBS)
|
|
||||||
|
|
||||||
acountry.exe: acountry.c $(OBJ_DIR)/ares_getopt.o $(OBJ_HACK)
|
|
||||||
$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^ $(EX_LIBS)
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f $(OBJECTS) libcares.a
|
|
||||||
|
|
||||||
vclean realclean: clean
|
|
||||||
rm -f ahost.exe adig.exe acountry.exe depend.dj
|
|
||||||
- rmdir $(OBJ_DIR)
|
|
||||||
|
|
||||||
-include depend.dj
|
|
||||||
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
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 \
|
|
||||||
ares_library_init.c
|
|
||||||
|
|
||||||
HHEADERS = ares.h ares_private.h setup.h ares_dns.h ares_version.h \
|
|
||||||
nameser.h inet_net_pton.h inet_ntop.h ares_ipv6.h bitncmp.h setup_once.h \
|
|
||||||
ares_llist.h ares_strdup.h ares_strcasecmp.h ares_writev.h ares_build.h \
|
|
||||||
ares_rules.h ares_library_init.h
|
|
||||||
|
|
||||||
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
|
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
#############################################################
|
|
||||||
# $Id$
|
|
||||||
#
|
|
||||||
## Makefile for building libcares.a with MingW32 (GCC-3.2)
|
|
||||||
## Use: make -f Makefile.m32 [demos]
|
|
||||||
##
|
|
||||||
## Quick hack by Guenter; comments to: /dev/nul
|
|
||||||
#
|
|
||||||
########################################################
|
|
||||||
## Nothing more to do below this line!
|
|
||||||
|
|
||||||
LIB = libcares.a
|
|
||||||
|
|
||||||
CC = gcc
|
|
||||||
LD = gcc
|
|
||||||
RANLIB = ranlib
|
|
||||||
#RM = rm -f
|
|
||||||
|
|
||||||
CFLAGS = -O2 -Wall
|
|
||||||
LDFLAGS = -s
|
|
||||||
LIBS = -lwsock32
|
|
||||||
|
|
||||||
# Makefile.inc provides the CSOURCES and HHEADERS defines
|
|
||||||
include Makefile.inc
|
|
||||||
|
|
||||||
OBJLIB := $(patsubst %.c,%.o,$(strip $(CSOURCES)))
|
|
||||||
|
|
||||||
|
|
||||||
$(LIB): $(OBJLIB)
|
|
||||||
ar cru $@ $^
|
|
||||||
$(RANLIB) $@
|
|
||||||
|
|
||||||
all: $(LIB) demos
|
|
||||||
|
|
||||||
demos: adig.exe ahost.exe acountry.exe
|
|
||||||
|
|
||||||
tags:
|
|
||||||
etags *.[ch]
|
|
||||||
|
|
||||||
%.exe: %.o ares_getopt.o $(LIB)
|
|
||||||
$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
|
|
||||||
|
|
||||||
$(OBJLIB): ares.h ares_dns.h ares_private.h ares_build.h ares_rules.h
|
|
||||||
|
|
||||||
.c.o:
|
|
||||||
$(CC) $(CFLAGS) -c $<
|
|
||||||
|
|
||||||
check:
|
|
||||||
|
|
||||||
install:
|
|
||||||
${top_srcdir}/mkinstalldirs ${DESTDIR}${libdir}
|
|
||||||
${top_srcdir}/mkinstalldirs ${DESTDIR}${includedir}
|
|
||||||
${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man3
|
|
||||||
${INSTALL} -m 644 $(LIB) ${DESTDIR}${libdir}
|
|
||||||
${RANLIB} ${DESTDIR}${libdir}/$(LIB)
|
|
||||||
chmod u-w ${DESTDIR}${libdir}/$(LIB)
|
|
||||||
${INSTALL} -m 444 ${srcdir}/ares.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 \
|
|
||||||
${INSTALL} -m 444 ${srcdir}/$${man} ${DESTDIR}${mandir}/man3; \
|
|
||||||
done)
|
|
||||||
|
|
||||||
clean:
|
|
||||||
$(RM) ares_getopt.o $(OBJLIB) $(LIB) adig.exe ahost.exe acountry.exe
|
|
||||||
|
|
||||||
distclean: clean
|
|
||||||
$(RM) config.cache config.log config.status Makefile
|
|
||||||
|
|
||||||
@@ -1,429 +0,0 @@
|
|||||||
#################################################################
|
|
||||||
# $Id$
|
|
||||||
#
|
|
||||||
## Makefile for building libcares (NetWare version - gnu make)
|
|
||||||
## Use: make -f Makefile.netware
|
|
||||||
##
|
|
||||||
## Comments to: Guenter Knauf http://www.gknw.de/phpbb
|
|
||||||
#
|
|
||||||
#################################################################
|
|
||||||
|
|
||||||
# Edit the path below to point to the base of your Novell NDK.
|
|
||||||
ifndef NDKBASE
|
|
||||||
NDKBASE = c:/novell
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifndef INSTDIR
|
|
||||||
INSTDIR = ../ares-$(LIBCARES_VERSION_STR)-bin-nw
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Edit the vars below to change NLM target settings.
|
|
||||||
TARGETS = adig.nlm ahost.nlm acountry.nlm
|
|
||||||
LTARGET = libcares.$(LIBEXT)
|
|
||||||
VERSION = $(LIBCARES_VERSION)
|
|
||||||
COPYR = Copyright (C) 1996 - 2008, Daniel Stenberg, <daniel@haxx.se>
|
|
||||||
DESCR = cURL $(subst .def,,$(notdir $@)) $(LIBCARES_VERSION_STR) - http://curl.haxx.se
|
|
||||||
MTSAFE = YES
|
|
||||||
STACK = 64000
|
|
||||||
SCREEN = none
|
|
||||||
#EXPORTS =
|
|
||||||
# Comment the line below if you dont want to load protected automatically.
|
|
||||||
#LDRING = 3
|
|
||||||
|
|
||||||
# Edit the var below to point to your lib architecture.
|
|
||||||
ifndef LIBARCH
|
|
||||||
LIBARCH = LIBC
|
|
||||||
endif
|
|
||||||
|
|
||||||
# must be equal to NDEBUG or DEBUG, CURLDEBUG
|
|
||||||
ifndef DB
|
|
||||||
DB = NDEBUG
|
|
||||||
endif
|
|
||||||
# Optimization: -O<n> or debugging: -g
|
|
||||||
ifeq ($(DB),NDEBUG)
|
|
||||||
OPT = -O2
|
|
||||||
OBJDIR = release
|
|
||||||
else
|
|
||||||
OPT = -g
|
|
||||||
OBJDIR = debug
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Include the version info retrieved from curlver.h
|
|
||||||
-include $(OBJDIR)/version.inc
|
|
||||||
|
|
||||||
# The following lines defines your compiler.
|
|
||||||
ifdef CWFolder
|
|
||||||
METROWERKS = $(CWFolder)
|
|
||||||
endif
|
|
||||||
ifdef METROWERKS
|
|
||||||
# MWCW_PATH = $(subst \,/,$(METROWERKS))/Novell Support
|
|
||||||
MWCW_PATH = $(subst \,/,$(METROWERKS))/Novell Support/Metrowerks Support
|
|
||||||
CC = mwccnlm
|
|
||||||
else
|
|
||||||
CC = gcc
|
|
||||||
endif
|
|
||||||
# a native win32 awk can be downloaded from here:
|
|
||||||
# http://www.gknw.net/development/prgtools/awk-20070501.zip
|
|
||||||
AWK = awk
|
|
||||||
YACC = bison -y
|
|
||||||
CP = cp -afv
|
|
||||||
MKDIR = mkdir
|
|
||||||
# RM = rm -f
|
|
||||||
# if you want to mark the target as MTSAFE you will need a tool for
|
|
||||||
# generating the xdc data for the linker; here's a minimal tool:
|
|
||||||
# http://www.gknw.net/development/prgtools/mkxdc.zip
|
|
||||||
MPKXDC = mkxdc
|
|
||||||
|
|
||||||
# Global flags for all compilers
|
|
||||||
CFLAGS += $(OPT) -D$(DB) -DNETWARE -DHAVE_CONFIG_H -nostdinc
|
|
||||||
|
|
||||||
ifeq ($(CC),mwccnlm)
|
|
||||||
LD = mwldnlm
|
|
||||||
LDFLAGS = -nostdlib $(PRELUDE) $(OBJEXE) $(<:.def=.o) -o $@ -commandfile
|
|
||||||
AR = mwldnlm
|
|
||||||
ARFLAGS = -nostdlib -type library -o
|
|
||||||
LIBEXT = lib
|
|
||||||
#RANLIB =
|
|
||||||
CFLAGS += -msgstyle gcc -gccinc -inline off -opt nointrinsics -proc 586
|
|
||||||
CFLAGS += -relax_pointers
|
|
||||||
#CFLAGS += -w on
|
|
||||||
ifeq ($(LIBARCH),LIBC)
|
|
||||||
PRELUDE = $(SDK_LIBC)/imports/libcpre.o
|
|
||||||
CFLAGS += -align 4
|
|
||||||
else
|
|
||||||
# PRELUDE = $(SDK_CLIB)/imports/clibpre.o
|
|
||||||
# to avoid the __init_* / __deinit_* whoes dont use prelude from NDK
|
|
||||||
PRELUDE = "$(MWCW_PATH)/libraries/runtime/prelude.obj"
|
|
||||||
# CFLAGS += -include "$(MWCW_PATH)/headers/nlm_clib_prefix.h"
|
|
||||||
CFLAGS += -align 1
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
LD = nlmconv
|
|
||||||
LDFLAGS = -T
|
|
||||||
AR = ar
|
|
||||||
ARFLAGS = -cq
|
|
||||||
LIBEXT = a
|
|
||||||
RANLIB = ranlib
|
|
||||||
CFLAGS += -fno-builtin -fpcc-struct-return -fno-strict-aliasing
|
|
||||||
CFLAGS += -Wall -Wno-format -Wno-uninitialized # -pedantic
|
|
||||||
ifeq ($(LIBARCH),LIBC)
|
|
||||||
PRELUDE = $(SDK_LIBC)/imports/libcpre.gcc.o
|
|
||||||
else
|
|
||||||
# PRELUDE = $(SDK_CLIB)/imports/clibpre.gcc.o
|
|
||||||
# to avoid the __init_* / __deinit_* whoes dont use prelude from NDK
|
|
||||||
# http://www.gknw.net/development/mk_nlm/gcc_pre.zip
|
|
||||||
PRELUDE = $(NDK_ROOT)/pre/prelude.o
|
|
||||||
CFLAGS += -include $(NDKBASE)/nlmconv/genlm.h
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
NDK_ROOT = $(NDKBASE)/ndk
|
|
||||||
SDK_CLIB = $(NDK_ROOT)/nwsdk
|
|
||||||
SDK_LIBC = $(NDK_ROOT)/libc
|
|
||||||
|
|
||||||
ifeq ($(LIBARCH),LIBC)
|
|
||||||
INCLUDES += -I$(SDK_LIBC)/include
|
|
||||||
# INCLUDES += -I$(SDK_LIBC)/include/nks
|
|
||||||
# INCLUDES += -I$(SDK_LIBC)/include/winsock
|
|
||||||
CFLAGS += -D_POSIX_SOURCE
|
|
||||||
else
|
|
||||||
INCLUDES += -I$(SDK_CLIB)/include/nlm
|
|
||||||
# INCLUDES += -I$(SDK_CLIB)/include/nlm/obsolete
|
|
||||||
# INCLUDES += -I$(SDK_CLIB)/include
|
|
||||||
endif
|
|
||||||
ifeq ($(DB),CURLDEBUG)
|
|
||||||
INCLUDES += -I../include
|
|
||||||
endif
|
|
||||||
CFLAGS += -I. $(INCLUDES)
|
|
||||||
|
|
||||||
ifeq ($(MTSAFE),YES)
|
|
||||||
XDCOPT = -n
|
|
||||||
endif
|
|
||||||
ifeq ($(MTSAFE),NO)
|
|
||||||
XDCOPT = -u
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(findstring linux,$(OSTYPE)),linux)
|
|
||||||
DL = '
|
|
||||||
#-include $(NDKBASE)/nlmconv/ncpfs.inc
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Makefile.inc provides the CSOURCES and HHEADERS defines
|
|
||||||
include Makefile.inc
|
|
||||||
|
|
||||||
OBJLIB := $(patsubst %.c,$(OBJDIR)/%.o,$(strip $(CSOURCES)))
|
|
||||||
OBJEXE = $(OBJLIB) $(OBJDIR)/ares_getopt.o
|
|
||||||
|
|
||||||
.PHONY: lib nlm prebuild dist install clean
|
|
||||||
|
|
||||||
lib: prebuild $(LTARGET)
|
|
||||||
|
|
||||||
nlm: prebuild $(TARGETS)
|
|
||||||
|
|
||||||
prebuild: $(OBJDIR) ares_build.h $(OBJDIR)/version.inc config.h
|
|
||||||
|
|
||||||
install: $(INSTDIR) all
|
|
||||||
@$(CP) *.nlm $(INSTDIR)
|
|
||||||
@$(CP) ../CHANGES $(INSTDIR)
|
|
||||||
@$(CP) ../COPYING $(INSTDIR)
|
|
||||||
@$(CP) ../README $(INSTDIR)
|
|
||||||
@$(CP) ../RELEASE-NOTES $(INSTDIR)
|
|
||||||
|
|
||||||
clean:
|
|
||||||
-$(RM) $(LTARGET) $(TARGETS) config.h
|
|
||||||
-$(RM) -r $(OBJDIR)
|
|
||||||
-$(RM) -r arpa
|
|
||||||
|
|
||||||
%.$(LIBEXT): $(OBJLIB)
|
|
||||||
@echo Creating $@
|
|
||||||
@-$(RM) $@
|
|
||||||
@$(AR) $(ARFLAGS) $@ $^
|
|
||||||
ifdef RANLIB
|
|
||||||
@$(RANLIB) $@
|
|
||||||
endif
|
|
||||||
|
|
||||||
%.nlm: $(OBJDIR)/%.def $(OBJDIR)/%.o $(OBJDIR)/%.xdc $(OBJEXE)
|
|
||||||
@echo Linking $@
|
|
||||||
@-$(RM) $@
|
|
||||||
@$(LD) $(LDFLAGS) $<
|
|
||||||
|
|
||||||
$(OBJDIR) $(INSTDIR):
|
|
||||||
@$(MKDIR) $@
|
|
||||||
|
|
||||||
$(OBJDIR)/%.o: %.c
|
|
||||||
# @echo Compiling $<
|
|
||||||
$(CC) $(CFLAGS) -c $< -o $@
|
|
||||||
|
|
||||||
$(OBJDIR)/version.inc: ares_version.h $(OBJDIR)
|
|
||||||
@echo Creating $@
|
|
||||||
@$(AWK) -f get_ver.awk $< > $@
|
|
||||||
|
|
||||||
$(OBJDIR)/%.xdc: Makefile.netware
|
|
||||||
@echo Creating $@
|
|
||||||
@$(MPKXDC) $(XDCOPT) $@
|
|
||||||
|
|
||||||
$(OBJDIR)/%.def: Makefile.netware
|
|
||||||
@echo Creating $@
|
|
||||||
@echo $(DL)# DEF file for linking with $(LD)$(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)copyright "$(COPYR)"$(DL) >> $@
|
|
||||||
@echo $(DL)description "$(DESCR)"$(DL) >> $@
|
|
||||||
@echo $(DL)version $(VERSION)$(DL) >> $@
|
|
||||||
ifdef NLMTYPE
|
|
||||||
@echo $(DL)type $(NLMTYPE)$(DL) >> $@
|
|
||||||
endif
|
|
||||||
ifdef STACK
|
|
||||||
@echo $(DL)stack $(STACK)$(DL) >> $@
|
|
||||||
endif
|
|
||||||
ifdef SCREEN
|
|
||||||
@echo $(DL)screenname "$(SCREEN)"$(DL) >> $@
|
|
||||||
else
|
|
||||||
@echo $(DL)screenname "DEFAULT"$(DL) >> $@
|
|
||||||
endif
|
|
||||||
ifeq ($(DB),DEBUG)
|
|
||||||
@echo $(DL)debug$(DL) >> $@
|
|
||||||
endif
|
|
||||||
@echo $(DL)threadname "$^"$(DL) >> $@
|
|
||||||
ifdef XDCOPT
|
|
||||||
@echo $(DL)xdcdata $(@:.def=.xdc)$(DL) >> $@
|
|
||||||
endif
|
|
||||||
ifeq ($(LDRING),0)
|
|
||||||
@echo $(DL)flag_on 16$(DL) >> $@
|
|
||||||
endif
|
|
||||||
ifeq ($(LDRING),3)
|
|
||||||
@echo $(DL)flag_on 512$(DL) >> $@
|
|
||||||
endif
|
|
||||||
ifeq ($(LIBARCH),CLIB)
|
|
||||||
@echo $(DL)start _Prelude$(DL) >> $@
|
|
||||||
@echo $(DL)exit _Stop$(DL) >> $@
|
|
||||||
@echo $(DL)import @$(SDK_CLIB)/imports/clib.imp$(DL) >> $@
|
|
||||||
@echo $(DL)import @$(SDK_CLIB)/imports/threads.imp$(DL) >> $@
|
|
||||||
@echo $(DL)import @$(SDK_CLIB)/imports/nlmlib.imp$(DL) >> $@
|
|
||||||
@echo $(DL)import @$(SDK_CLIB)/imports/socklib.imp$(DL) >> $@
|
|
||||||
@echo $(DL)module clib$(DL) >> $@
|
|
||||||
else
|
|
||||||
@echo $(DL)flag_on 64$(DL) >> $@
|
|
||||||
@echo $(DL)pseudopreemption$(DL) >> $@
|
|
||||||
@echo $(DL)start _LibCPrelude$(DL) >> $@
|
|
||||||
@echo $(DL)exit _LibCPostlude$(DL) >> $@
|
|
||||||
@echo $(DL)check _LibCCheckUnload$(DL) >> $@
|
|
||||||
@echo $(DL)import @$(SDK_LIBC)/imports/libc.imp$(DL) >> $@
|
|
||||||
@echo $(DL)import @$(SDK_LIBC)/imports/netware.imp$(DL) >> $@
|
|
||||||
@echo $(DL)module libc$(DL) >> $@
|
|
||||||
endif
|
|
||||||
ifdef MODULES
|
|
||||||
@echo $(DL)module $(MODULES)$(DL) >> $@
|
|
||||||
endif
|
|
||||||
ifdef EXPORTS
|
|
||||||
@echo $(DL)export $(EXPORTS)$(DL) >> $@
|
|
||||||
endif
|
|
||||||
ifdef IMPORTS
|
|
||||||
@echo $(DL)import $(IMPORTS)$(DL) >> $@
|
|
||||||
endif
|
|
||||||
ifeq ($(LD),nlmconv)
|
|
||||||
@echo $(DL)input $(PRELUDE)$(DL) >> $@
|
|
||||||
@echo $(DL)input $(OBJEXE)$(DL) >> $@
|
|
||||||
@echo $(DL)input $(@:.def=.o)$(DL) >> $@
|
|
||||||
@echo $(DL)output $(notdir $(@:.def=.nlm))$(DL) >> $@
|
|
||||||
endif
|
|
||||||
|
|
||||||
config.h: Makefile.netware
|
|
||||||
@echo Creating $@
|
|
||||||
@echo $(DL)/* $@ 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 NETWARE$(DL) >> $@
|
|
||||||
@echo $(DL)#error This $(notdir $@) is created for NetWare platform!$(DL) >> $@
|
|
||||||
@echo $(DL)#endif$(DL) >> $@
|
|
||||||
@echo $(DL)#define VERSION "$(LIBCARES_VERSION_STR)"$(DL) >> $@
|
|
||||||
@echo $(DL)#define PACKAGE_BUGREPORT "a suitable curl mailing list => http://curl.haxx.se/mail/"$(DL) >> $@
|
|
||||||
ifeq ($(LIBARCH),CLIB)
|
|
||||||
@echo $(DL)#define OS "i586-pc-clib-NetWare"$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_STRICMP 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_STRNICMP 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define NETDB_USE_INTERNET 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define RECV_TYPE_ARG1 int$(DL) >> $@
|
|
||||||
@echo $(DL)#define RECV_TYPE_ARG2 char *$(DL) >> $@
|
|
||||||
@echo $(DL)#define RECV_TYPE_ARG3 int$(DL) >> $@
|
|
||||||
@echo $(DL)#define RECV_TYPE_ARG4 int$(DL) >> $@
|
|
||||||
@echo $(DL)#define RECV_TYPE_RETV int$(DL) >> $@
|
|
||||||
@echo $(DL)#define RECVFROM_TYPE_ARG1 int$(DL) >> $@
|
|
||||||
@echo $(DL)#define RECVFROM_TYPE_ARG2 char$(DL) >> $@
|
|
||||||
@echo $(DL)#define RECVFROM_TYPE_ARG3 int$(DL) >> $@
|
|
||||||
@echo $(DL)#define RECVFROM_TYPE_ARG4 int$(DL) >> $@
|
|
||||||
@echo $(DL)#define RECVFROM_TYPE_ARG5 struct sockaddr$(DL) >> $@
|
|
||||||
@echo $(DL)#define RECVFROM_TYPE_ARG6 int$(DL) >> $@
|
|
||||||
@echo $(DL)#define RECVFROM_TYPE_RETV int$(DL) >> $@
|
|
||||||
@echo $(DL)#define SEND_QUAL_ARG2$(DL) >> $@
|
|
||||||
@echo $(DL)#define SEND_TYPE_ARG1 int$(DL) >> $@
|
|
||||||
@echo $(DL)#define SEND_TYPE_ARG2 char *$(DL) >> $@
|
|
||||||
@echo $(DL)#define SEND_TYPE_ARG3 int$(DL) >> $@
|
|
||||||
@echo $(DL)#define SEND_TYPE_ARG4 int$(DL) >> $@
|
|
||||||
@echo $(DL)#define SEND_TYPE_RETV int$(DL) >> $@
|
|
||||||
else
|
|
||||||
@echo $(DL)#define OS "i586-pc-libc-NetWare"$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_DLFCN_H 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_DLOPEN 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_FTRUNCATE 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_GETTIMEOFDAY 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_INTTYPES_H 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_LONGLONG 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_STDINT_H 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_STRCASECMP 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_STRLCAT 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_STRLCPY 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_STRTOLL 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_SYS_PARAM_H 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_SYS_SELECT_H 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_TERMIOS_H 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_AF_INET6 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_PF_INET6 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_FREEADDRINFO 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_GETADDRINFO 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_STRUCT_IN6_ADDR 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_STRUCT_SOCKADDR_IN6 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define RECV_TYPE_ARG1 int$(DL) >> $@
|
|
||||||
@echo $(DL)#define RECV_TYPE_ARG2 void *$(DL) >> $@
|
|
||||||
@echo $(DL)#define RECV_TYPE_ARG3 size_t$(DL) >> $@
|
|
||||||
@echo $(DL)#define RECV_TYPE_ARG4 int$(DL) >> $@
|
|
||||||
@echo $(DL)#define RECV_TYPE_RETV ssize_t$(DL) >> $@
|
|
||||||
@echo $(DL)#define RECVFROM_TYPE_ARG1 int$(DL) >> $@
|
|
||||||
@echo $(DL)#define RECVFROM_TYPE_ARG2 void$(DL) >> $@
|
|
||||||
@echo $(DL)#define RECVFROM_TYPE_ARG3 size_t$(DL) >> $@
|
|
||||||
@echo $(DL)#define RECVFROM_TYPE_ARG4 int$(DL) >> $@
|
|
||||||
@echo $(DL)#define RECVFROM_TYPE_ARG5 struct sockaddr$(DL) >> $@
|
|
||||||
@echo $(DL)#define RECVFROM_TYPE_ARG6 size_t$(DL) >> $@
|
|
||||||
@echo $(DL)#define RECVFROM_TYPE_RETV ssize_t$(DL) >> $@
|
|
||||||
@echo $(DL)#define RECVFROM_TYPE_ARG2_IS_VOID 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define SEND_QUAL_ARG2$(DL) >> $@
|
|
||||||
@echo $(DL)#define SEND_TYPE_ARG1 int$(DL) >> $@
|
|
||||||
@echo $(DL)#define SEND_TYPE_ARG2 void *$(DL) >> $@
|
|
||||||
@echo $(DL)#define SEND_TYPE_ARG3 size_t$(DL) >> $@
|
|
||||||
@echo $(DL)#define SEND_TYPE_ARG4 int$(DL) >> $@
|
|
||||||
@echo $(DL)#define SEND_TYPE_RETV ssize_t$(DL) >> $@
|
|
||||||
@echo $(DL)#define SIZEOF_STRUCT_IN6_ADDR 16$(DL) >> $@
|
|
||||||
endif
|
|
||||||
@echo $(DL)#define HAVE_ARPA_INET_H 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_ASSERT_H 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_ERR_H 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_FCNTL_H 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_GETHOSTBYADDR 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_GETHOSTBYNAME 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_GETHOSTNAME 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_GETPROTOBYNAME 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_GMTIME_R 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_INET_ADDR 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_IOCTL 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_LOCALTIME_R 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_MALLOC_H 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_NETINET_IN_H 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_RECV 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_RECVFROM 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_SELECT 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_SEND 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_SETJMP_H 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_SIGNAL 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_SIGNAL_H 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_SIG_ATOMIC_T 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_SOCKET 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_STDLIB_H 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_STRDUP 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_STRFTIME 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_STRING_H 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_STRSTR 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_STRUCT_ADDRINFO 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_STRUCT_TIMEVAL 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_SYS_IOCTL_H 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_SYS_STAT_H 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_SYS_TIME_H 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_TIME_H 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_UNAME 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_UNISTD_H 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_UTIME 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_UTIME_H 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_WRITEV 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define RETSIGTYPE void$(DL) >> $@
|
|
||||||
@echo $(DL)#define SIZEOF_STRUCT_IN_ADDR 4$(DL) >> $@
|
|
||||||
@echo $(DL)#define STDC_HEADERS 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define TIME_WITH_SYS_TIME 1$(DL) >> $@
|
|
||||||
ifdef NW_WINSOCK
|
|
||||||
@echo $(DL)#define HAVE_CLOSESOCKET 1$(DL) >> $@
|
|
||||||
else
|
|
||||||
@echo $(DL)#define HAVE_SYS_TYPES_H 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_SYS_SOCKET_H 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_SYS_SOCKIO_H 1$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_NETDB_H 1$(DL) >> $@
|
|
||||||
endif
|
|
||||||
@echo $(DL)#ifdef __GNUC__$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_VARIADIC_MACROS_GCC 1$(DL) >> $@
|
|
||||||
@echo $(DL)#else$(DL) >> $@
|
|
||||||
@echo $(DL)#define HAVE_VARIADIC_MACROS_C99 1$(DL) >> $@
|
|
||||||
@echo $(DL)#endif$(DL) >> $@
|
|
||||||
|
|
||||||
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,274 +0,0 @@
|
|||||||
# $Id$
|
|
||||||
#
|
|
||||||
# C-ares makefile for MSVC6+
|
|
||||||
# G. Vanem <giva@bgnett.no>.
|
|
||||||
#
|
|
||||||
|
|
||||||
CFG_MODEL = MD
|
|
||||||
DEBUG_MODEL = d
|
|
||||||
USE_WATT32 = 0
|
|
||||||
|
|
||||||
#
|
|
||||||
# Configurations:
|
|
||||||
# -MD - msvcrt.dll, threads, release (normal)
|
|
||||||
# -MDd - msvcrtd.dll, threads, debug
|
|
||||||
# -ML - libc, no threads, release
|
|
||||||
# -MLd - libc, no threads, debug
|
|
||||||
# -MT - libc, threads, release
|
|
||||||
# -MTd - libc, threads, debug
|
|
||||||
|
|
||||||
CC = cl
|
|
||||||
|
|
||||||
CFLAGS = -nologo -$(CFG_MODEL)$(DEBUG_MODEL) -W3 -Yd -Zi
|
|
||||||
LDFLAGS = -machine:i386 -map
|
|
||||||
|
|
||||||
OBJ_DIR = VC6_obj
|
|
||||||
DEF_FILE = cares.def
|
|
||||||
|
|
||||||
!if "$(USE_WATT32)" == "1"
|
|
||||||
CFLAGS = $(CFLAGS) -UWIN32 -DWATT32 -D_USE_32BIT_TIME_T -I$(WATT_ROOT)\inc
|
|
||||||
EX_LIBS = $(WATT_ROOT)\lib\wattcpvc_imp.lib
|
|
||||||
|
|
||||||
!else
|
|
||||||
CFLAGS = $(CFLAGS) -DWIN32 -DWIN32_LEAN_AND_MEAN
|
|
||||||
EX_LIBS = advapi32.lib ws2_32.lib
|
|
||||||
!endif
|
|
||||||
|
|
||||||
!if "$(DEBUG_MODEL)" == "d"
|
|
||||||
CFLAGS = $(CFLAGS) -D_DEBUG -GZ
|
|
||||||
LDFLAGS = $(LDFLAGS) -debug -fixed:no
|
|
||||||
|
|
||||||
!else
|
|
||||||
CFLAGS = $(CFLAGS) -O2 -Og
|
|
||||||
LDFLAGS = $(LDFLAGS) -release
|
|
||||||
!endif
|
|
||||||
|
|
||||||
CFLAGS = $(CFLAGS) -I.\.
|
|
||||||
|
|
||||||
OBJECTS = $(OBJ_DIR)\ares_fds.obj \
|
|
||||||
$(OBJ_DIR)\ares_process.obj \
|
|
||||||
$(OBJ_DIR)\ares_free_hostent.obj \
|
|
||||||
$(OBJ_DIR)\ares_query.obj \
|
|
||||||
$(OBJ_DIR)\ares__close_sockets.obj \
|
|
||||||
$(OBJ_DIR)\ares_free_string.obj \
|
|
||||||
$(OBJ_DIR)\ares_search.obj \
|
|
||||||
$(OBJ_DIR)\ares__get_hostent.obj \
|
|
||||||
$(OBJ_DIR)\ares_gethostbyaddr.obj \
|
|
||||||
$(OBJ_DIR)\ares_getsock.obj \
|
|
||||||
$(OBJ_DIR)\ares_send.obj \
|
|
||||||
$(OBJ_DIR)\ares__read_line.obj \
|
|
||||||
$(OBJ_DIR)\ares_gethostbyname.obj \
|
|
||||||
$(OBJ_DIR)\ares_getnameinfo.obj \
|
|
||||||
$(OBJ_DIR)\ares_strcasecmp.obj \
|
|
||||||
$(OBJ_DIR)\ares_strerror.obj \
|
|
||||||
$(OBJ_DIR)\ares_cancel.obj \
|
|
||||||
$(OBJ_DIR)\ares_init.obj \
|
|
||||||
$(OBJ_DIR)\ares_library_init.obj \
|
|
||||||
$(OBJ_DIR)\ares_llist.obj \
|
|
||||||
$(OBJ_DIR)\ares_timeout.obj \
|
|
||||||
$(OBJ_DIR)\ares__timeval.obj \
|
|
||||||
$(OBJ_DIR)\ares_destroy.obj \
|
|
||||||
$(OBJ_DIR)\ares_mkquery.obj \
|
|
||||||
$(OBJ_DIR)\ares_version.obj \
|
|
||||||
$(OBJ_DIR)\ares_expand_name.obj \
|
|
||||||
$(OBJ_DIR)\ares_parse_a_reply.obj \
|
|
||||||
$(OBJ_DIR)\ares_parse_aaaa_reply.obj \
|
|
||||||
$(OBJ_DIR)\ares_parse_ns_reply.obj \
|
|
||||||
$(OBJ_DIR)\windows_port.obj \
|
|
||||||
$(OBJ_DIR)\ares_expand_string.obj \
|
|
||||||
$(OBJ_DIR)\ares_parse_ptr_reply.obj \
|
|
||||||
$(OBJ_DIR)\ares_writev.obj \
|
|
||||||
$(OBJ_DIR)\bitncmp.obj \
|
|
||||||
$(OBJ_DIR)\inet_net_pton.obj \
|
|
||||||
$(OBJ_DIR)\inet_ntop.obj
|
|
||||||
|
|
||||||
all: $(OBJ_DIR) cares.lib cares.dll cares_imp.lib ahost.exe adig.exe acountry.exe
|
|
||||||
@echo Welcome to c-ares library and examples
|
|
||||||
|
|
||||||
$(OBJ_DIR):
|
|
||||||
mkdir $(OBJ_DIR)
|
|
||||||
|
|
||||||
cares.lib: $(OBJ_DIR) $(OBJECTS)
|
|
||||||
lib -nologo -out:$@ $(OBJECTS)
|
|
||||||
|
|
||||||
cares_imp.lib cares.dll: $(OBJ_DIR) $(DEF_FILE) $(OBJECTS)
|
|
||||||
link $(LDFLAGS) -dll -implib:cares_imp.lib -out:cares.dll \
|
|
||||||
-def:$(DEF_FILE) $(OBJECTS) $(EX_LIBS)
|
|
||||||
|
|
||||||
$(DEF_FILE): $(OBJECTS) Makefile.VC6
|
|
||||||
@echo ; Generated. DO NOT EDIT > $@
|
|
||||||
@echo LIBRARY cares.dll >> $@
|
|
||||||
@echo EXPORTS >> $@
|
|
||||||
@echo ares_cancel >> $@
|
|
||||||
@echo ares_destroy >> $@
|
|
||||||
@echo ares_expand_name >> $@
|
|
||||||
@echo ares_expand_string >> $@
|
|
||||||
@echo ares_fds >> $@
|
|
||||||
@echo ares_free_hostent >> $@
|
|
||||||
@echo ares_free_string >> $@
|
|
||||||
@echo ares_gethostbyaddr >> $@
|
|
||||||
@echo ares_gethostbyname >> $@
|
|
||||||
@echo ares_getsock >> $@
|
|
||||||
@echo ares_init >> $@
|
|
||||||
@echo ares_init_options >> $@
|
|
||||||
@echo ares_library_init >> $@
|
|
||||||
@echo ares_library_cleanup >> $@
|
|
||||||
@echo ares_mkquery >> $@
|
|
||||||
@echo ares_parse_a_reply >> $@
|
|
||||||
@echo ares_parse_ptr_reply >> $@
|
|
||||||
@echo ares_parse_ns_reply >> $@
|
|
||||||
@echo ares_process >> $@
|
|
||||||
@echo ares_process_fd >> $@
|
|
||||||
@echo ares_query >> $@
|
|
||||||
@echo ares_search >> $@
|
|
||||||
@echo ares_strerror >> $@
|
|
||||||
@echo ares_strncasecmp >> $@
|
|
||||||
@echo ares_strcasecmp >> $@
|
|
||||||
@echo ares_timeout >> $@
|
|
||||||
@echo ares_version >> $@
|
|
||||||
@echo ares_inet_net_pton >> $@
|
|
||||||
@echo ares_inet_ntop >> $@
|
|
||||||
@echo ares_inet_pton >> $@
|
|
||||||
@echo ares_getnameinfo >> $@
|
|
||||||
@echo ares_parse_aaaa_reply >> $@
|
|
||||||
!if "$(USE_WATT32)" == "0"
|
|
||||||
@echo ares_writev >> $@
|
|
||||||
!endif
|
|
||||||
|
|
||||||
ahost.exe: $(OBJ_DIR) $(OBJ_DIR)\ahost.obj $(OBJ_DIR)\ares_getopt.obj cares_imp.lib
|
|
||||||
link $(LDFLAGS) -out:$@ $(OBJ_DIR)\ahost.obj $(OBJ_DIR)\ares_getopt.obj cares_imp.lib $(EX_LIBS)
|
|
||||||
|
|
||||||
adig.exe: $(OBJ_DIR) $(OBJ_DIR)\adig.obj $(OBJ_DIR)\ares_getopt.obj cares_imp.lib
|
|
||||||
link $(LDFLAGS) -out:$@ $(OBJ_DIR)\adig.obj $(OBJ_DIR)\ares_getopt.obj cares_imp.lib $(EX_LIBS)
|
|
||||||
|
|
||||||
acountry.exe: $(OBJ_DIR) $(OBJ_DIR)\acountry.obj $(OBJ_DIR)\ares_getopt.obj cares_imp.lib
|
|
||||||
link $(LDFLAGS) -out:$@ $(OBJ_DIR)\acountry.obj $(OBJ_DIR)\ares_getopt.obj cares_imp.lib $(EX_LIBS)
|
|
||||||
|
|
||||||
clean:
|
|
||||||
- del $(OBJ_DIR)\*.obj *.ilk *.pdb *.pbt *.pbi *.pbo *._xe *.map
|
|
||||||
|
|
||||||
vclean realclean: clean
|
|
||||||
- del $(DEF_FILE) cares.lib cares_imp.* cares.dll
|
|
||||||
- del ahost.exe adig.exe acountry.exe
|
|
||||||
- rd $(OBJ_DIR)
|
|
||||||
|
|
||||||
.c{$(OBJ_DIR)}.obj:
|
|
||||||
$(CC) $(CFLAGS) -Fo$*.obj -c $<
|
|
||||||
|
|
||||||
#
|
|
||||||
# Copyright "gcc -MM .."
|
|
||||||
#
|
|
||||||
$(OBJ_DIR)\ares_fds.obj: ares_fds.c setup.h setup_once.h ares.h ares_private.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 \
|
|
||||||
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 \
|
|
||||||
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 \
|
|
||||||
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 \
|
|
||||||
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 ares_build.h ares_rules.h
|
|
||||||
|
|
||||||
$(OBJ_DIR)\ares_search.obj: ares_search.c setup.h setup_once.h nameser.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 \
|
|
||||||
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 \
|
|
||||||
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 \
|
|
||||||
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 \
|
|
||||||
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 \
|
|
||||||
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 \
|
|
||||||
ares_build.h ares_rules.h
|
|
||||||
|
|
||||||
$(OBJ_DIR)\ares_strerror.obj: ares_strerror.c 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 \
|
|
||||||
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 \
|
|
||||||
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 \
|
|
||||||
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 \
|
|
||||||
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 \
|
|
||||||
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 \
|
|
||||||
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.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 \
|
|
||||||
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 \
|
|
||||||
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 \
|
|
||||||
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 \
|
|
||||||
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 \
|
|
||||||
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 \
|
|
||||||
setup_once.h nameser.h ares.h ares_dns.h inet_net_pton.h ares_private.h \
|
|
||||||
ares_ipv6.h ares_build.h ares_rules.h
|
|
||||||
|
|
||||||
$(OBJ_DIR)\ares_parse_ns_reply.obj: ares_parse_ns_reply.c setup.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 \
|
|
||||||
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 \
|
|
||||||
ares_ipv6.h inet_net_pton.h ares_build.h ares_rules.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 \
|
|
||||||
ares_ipv6.h inet_ntop.h ares_build.h ares_rules.h
|
|
||||||
|
|
||||||
$(OBJ_DIR)\ares_getopt.obj: ares_getopt.c ares_getopt.h ares_build.h \
|
|
||||||
ares_rules.h
|
|
||||||
|
|
||||||
$(OBJ_DIR)\ares_library_init.obj: ares_library_init.c setup.h setup_once.h \
|
|
||||||
ares.h ares_private.h ares_library_init.h ares_build.h ares_rules.h
|
|
||||||
|
|
||||||
$(OBJ_DIR)\ares_llist.obj: ares_llist.c setup.h setup_once.h ares.h \
|
|
||||||
ares_private.h ares_llist.h ares_build.h ares_rules.h
|
|
||||||
|
|
||||||
$(OBJ_DIR)\ares_writev.obj: ares_writev.c setup.h setup_once.h ares.h \
|
|
||||||
ares_writev.h ares_build.h ares_rules.h
|
|
||||||
21
ares/NEWS
21
ares/NEWS
@@ -1,21 +0,0 @@
|
|||||||
Major changes since:
|
|
||||||
* see the CHANGES file
|
|
||||||
|
|
||||||
Major changes in release 1.1.1:
|
|
||||||
* ares should now compile as C++ code (no longer uses reserved word
|
|
||||||
"class").
|
|
||||||
* Added SRV support to adig test program.
|
|
||||||
* Fixed a few error handling bugs in query processing.
|
|
||||||
|
|
||||||
Major changes in release 1.1.0:
|
|
||||||
* Added ares_free_string() function so that memory can be freed in the
|
|
||||||
same layer as it is allocated, a desirable feature in some
|
|
||||||
environments.
|
|
||||||
* A few of the ares_dns.h macros are fixed to use the proper bitwise
|
|
||||||
operator.
|
|
||||||
* Fixed a couple of fenceposts fixed in ares_expand_name()'s
|
|
||||||
bounds-checking.
|
|
||||||
* In process_timeouts(), extract query->next before calling
|
|
||||||
next_server() and possibly freeing the query structure.
|
|
||||||
* Casted arguments to ctype macros casted to unsigned char, since not
|
|
||||||
all char values are valid inputs to those macros according to ANSI.
|
|
||||||
46
ares/README
46
ares/README
@@ -1,46 +0,0 @@
|
|||||||
This is c-ares, a forked version of the original ares. The original ares
|
|
||||||
README follows below, the c-ares specific details are in README.cares
|
|
||||||
|
|
||||||
====================================================================
|
|
||||||
|
|
||||||
This is ares, an asynchronous resolver library. It is intended for
|
|
||||||
applications which need to perform DNS queries without blocking, or
|
|
||||||
need to perform multiple DNS queries in parallel. The primary
|
|
||||||
examples of such applications are servers which communicate with
|
|
||||||
multiple clients and programs with graphical user interfaces.
|
|
||||||
|
|
||||||
This library implementation is not especially portable to crufty old
|
|
||||||
systems like SunOS 4. It assumes a compiler which can handle ANSI C
|
|
||||||
syntax, a system malloc which properly handles realloc(NULL, foo) and
|
|
||||||
free(NULL), and a reasonably up-to-date <arpa/nameser.h>.
|
|
||||||
|
|
||||||
I have attempted to preserve the externally visible behavior of the
|
|
||||||
BIND resolver in nearly all respects. The API of the library is, of
|
|
||||||
course, very different from the synchronous BIND API; instead of
|
|
||||||
invoking a function like res_send() and getting a return value back
|
|
||||||
indicating the number of bytes in the response, you invoke a function
|
|
||||||
like ares_send() and give it a callback function to invoke when the
|
|
||||||
response arrives. You then have to select() on the file descriptors
|
|
||||||
indicated by ares_fds(), with a timeout given by ares_timeout(). You
|
|
||||||
call ares_process() when select() returns.
|
|
||||||
|
|
||||||
Some features are missing from the current version of ares, relative
|
|
||||||
to the BIND resolver:
|
|
||||||
|
|
||||||
* There is no IPV6 support. [not true for c-ares]
|
|
||||||
* There is no hostname verification.
|
|
||||||
* There is no logging of unexpected events.
|
|
||||||
* There is no debugging-oriented logging.
|
|
||||||
* There is no YP support.
|
|
||||||
|
|
||||||
libares requires an ANSI compiler to compile and use. To build the
|
|
||||||
library, just run "./configure" and "make". To install it, run "make
|
|
||||||
install". Run "./configure --help" to see a list of options you can
|
|
||||||
provide to configure to change how the library builds. libares has no
|
|
||||||
data files, so you can move the include file and library around freely
|
|
||||||
without leaving behind any dependencies on old paths. Building the
|
|
||||||
library will also build the "adig" program, a little toy for trying
|
|
||||||
out the library. It doesn't get installed.
|
|
||||||
|
|
||||||
libares is distributed at athena-dist.mit.edu:pub/ATHENA/ares. Please
|
|
||||||
send bug reports and comments to ghudson@mit.edu.
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
c-ares
|
|
||||||
======
|
|
||||||
|
|
||||||
This package is based on ares 1.1.1 (written by Greg Hudson). I decided to
|
|
||||||
fork and release a separate project since the ares author didn't want the
|
|
||||||
improvements that were vital for our use of it.
|
|
||||||
|
|
||||||
This package is dubbed 'c-ares' since I (Daniel Stenberg) wanted this for use
|
|
||||||
within the curl project (hence the letter C) and it makes a nice pun. Also,
|
|
||||||
c-ares is not API compatible with ares: a new name makes that more obvious to
|
|
||||||
the public.
|
|
||||||
|
|
||||||
The full source code is available in the 'c-ares' release archives, and in the
|
|
||||||
'ares' subdir of the curl CVS source repository.
|
|
||||||
|
|
||||||
If you find bugs, correct flaws, have questions or have comments in general in
|
|
||||||
regard to c-ares (or by all means the original ares too), get in touch with us
|
|
||||||
on the c-ares mailing list: http://cool.haxx.se/mailman/listinfo/c-ares
|
|
||||||
|
|
||||||
c-ares is of course distributed under the same MIT-style license as the
|
|
||||||
original ares.
|
|
||||||
|
|
||||||
You'll find all c-ares details and news here:
|
|
||||||
|
|
||||||
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 dependant 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,21 +0,0 @@
|
|||||||
This is what's new and changed in the c-ares 1.6.1 release:
|
|
||||||
|
|
||||||
Changed:
|
|
||||||
|
|
||||||
o in6_addr is not used in ares.h anymore, but a private ares_in6_addr is
|
|
||||||
instead declared and used
|
|
||||||
o ares_gethostbyname() now supports 'AF_UNSPEC' as a family for resolving
|
|
||||||
either AF_INET6 or AF_INET
|
|
||||||
o a build-time configured ares_socklen_t is now used instead of socklen_t
|
|
||||||
|
|
||||||
Fixed:
|
|
||||||
|
|
||||||
o ares_parse_*_reply() functions now return ARES_EBADRESP instead of
|
|
||||||
ARES_EBADNAME if the name in the response failed to decode
|
|
||||||
o only expose/export symbols starting with 'ares_'
|
|
||||||
|
|
||||||
Thanks go to these friendly people for their efforts and contributions:
|
|
||||||
|
|
||||||
Phil Blundell, Japheth Cleaver, Yang Tse, Gregor Jasny
|
|
||||||
|
|
||||||
Have fun!
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
TODO
|
|
||||||
====
|
|
||||||
|
|
||||||
ares_gethostbyname
|
|
||||||
|
|
||||||
- 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
|
|
||||||
all known resolves and not just explicitly IPv4 _or_ IPv6 resolves.
|
|
||||||
1876
ares/acinclude.m4
1876
ares/acinclude.m4
File diff suppressed because it is too large
Load Diff
623
ares/acountry.c
623
ares/acountry.c
@@ -1,623 +0,0 @@
|
|||||||
/*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
* IP-address/hostname to country converter.
|
|
||||||
*
|
|
||||||
* Problem; you want to know where IP a.b.c.d is located.
|
|
||||||
*
|
|
||||||
* Use ares_gethostbyname ("d.c.b.a.zz.countries.nerd.dk")
|
|
||||||
* and get the CNAME (host->h_name). Result will be:
|
|
||||||
* 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)
|
|
||||||
*
|
|
||||||
* The 2 letter country code in <CC> and the ISO-3166 country
|
|
||||||
* number in x.y (number = x*256 + y). Version 2 of the protocol is missing
|
|
||||||
* the <CC> number.
|
|
||||||
*
|
|
||||||
* Ref: http://countries.nerd.dk/more.html
|
|
||||||
*
|
|
||||||
* Written by G. Vanem <gvanem@broadpark.no> 2006, 2007
|
|
||||||
*
|
|
||||||
* NB! This program may not be big-endian aware.
|
|
||||||
*
|
|
||||||
* 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 "setup.h"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <ctype.h>
|
|
||||||
#ifdef HAVE_UNISTD_H
|
|
||||||
#include <unistd.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_STRINGS_H
|
|
||||||
#include <strings.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(WIN32) && !defined(WATT32)
|
|
||||||
#include <winsock.h>
|
|
||||||
#else
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <arpa/inet.h>
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#include <netdb.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "ares.h"
|
|
||||||
#include "ares_getopt.h"
|
|
||||||
#include "inet_net_pton.h"
|
|
||||||
#include "inet_ntop.h"
|
|
||||||
|
|
||||||
#ifndef HAVE_STRDUP
|
|
||||||
# include "ares_strdup.h"
|
|
||||||
# define strdup(ptr) ares_strdup(ptr)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef HAVE_STRCASECMP
|
|
||||||
# include "ares_strcasecmp.h"
|
|
||||||
# define strcasecmp(p1,p2) ares_strcasecmp(p1,p2)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef HAVE_STRNCASECMP
|
|
||||||
# include "ares_strcasecmp.h"
|
|
||||||
# define strncasecmp(p1,p2,n) ares_strncasecmp(p1,p2,n)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef INADDR_NONE
|
|
||||||
#define INADDR_NONE 0xffffffff
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static const char *usage = "acountry [-vh?] {host|addr} ...\n";
|
|
||||||
static const char nerd_fmt[] = "%u.%u.%u.%u.zz.countries.nerd.dk";
|
|
||||||
static const char *nerd_ver1 = nerd_fmt + 14;
|
|
||||||
static const char *nerd_ver2 = nerd_fmt + 11;
|
|
||||||
static int verbose = 0;
|
|
||||||
|
|
||||||
#define TRACE(fmt) do { \
|
|
||||||
if (verbose > 0) \
|
|
||||||
printf fmt ; \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
static void wait_ares(ares_channel channel);
|
|
||||||
static void callback(void *arg, int status, int timeouts, struct hostent *host);
|
|
||||||
static void callback2(void *arg, int status, int timeouts, struct hostent *host);
|
|
||||||
static void find_country_from_cname(const char *cname, struct in_addr addr);
|
|
||||||
|
|
||||||
static void Abort(const char *fmt, ...)
|
|
||||||
{
|
|
||||||
va_list args;
|
|
||||||
va_start(args, fmt);
|
|
||||||
vfprintf(stderr, fmt, args);
|
|
||||||
va_end(args);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
ares_channel channel;
|
|
||||||
int ch, status;
|
|
||||||
|
|
||||||
#if defined(WIN32) && !defined(WATT32)
|
|
||||||
WORD wVersionRequested = MAKEWORD(USE_WINSOCK,USE_WINSOCK);
|
|
||||||
WSADATA wsaData;
|
|
||||||
WSAStartup(wVersionRequested, &wsaData);
|
|
||||||
#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)
|
|
||||||
switch (ch)
|
|
||||||
{
|
|
||||||
case 'd':
|
|
||||||
#ifdef WATT32
|
|
||||||
dbug_init();
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
case 'v':
|
|
||||||
verbose++;
|
|
||||||
break;
|
|
||||||
case 'h':
|
|
||||||
case '?':
|
|
||||||
default:
|
|
||||||
Abort(usage);
|
|
||||||
}
|
|
||||||
|
|
||||||
argc -= optind;
|
|
||||||
argv += optind;
|
|
||||||
if (argc < 1)
|
|
||||||
Abort(usage);
|
|
||||||
|
|
||||||
status = ares_init(&channel);
|
|
||||||
if (status != ARES_SUCCESS)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "ares_init: %s\n", ares_strerror(status));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initiate the queries, one per command-line argument. */
|
|
||||||
for ( ; *argv; argv++)
|
|
||||||
{
|
|
||||||
struct in_addr addr;
|
|
||||||
char buf[100];
|
|
||||||
|
|
||||||
/* If this fails, assume '*argv' is a host-name that
|
|
||||||
* must be resolved first
|
|
||||||
*/
|
|
||||||
if (ares_inet_pton(AF_INET, *argv, &addr) != 1)
|
|
||||||
{
|
|
||||||
ares_gethostbyname(channel, *argv, AF_INET, callback2, &addr);
|
|
||||||
wait_ares(channel);
|
|
||||||
if (addr.s_addr == INADDR_NONE)
|
|
||||||
{
|
|
||||||
printf("Failed to lookup %s\n", *argv);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sprintf(buf, nerd_fmt,
|
|
||||||
(unsigned int)(addr.s_addr >> 24),
|
|
||||||
(unsigned int)((addr.s_addr >> 16) & 255),
|
|
||||||
(unsigned int)((addr.s_addr >> 8) & 255),
|
|
||||||
(unsigned int)(addr.s_addr & 255));
|
|
||||||
TRACE(("Looking up %s...", buf));
|
|
||||||
fflush(stdout);
|
|
||||||
ares_gethostbyname(channel, buf, AF_INET, callback, buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
wait_ares(channel);
|
|
||||||
ares_destroy(channel);
|
|
||||||
|
|
||||||
ares_library_cleanup();
|
|
||||||
|
|
||||||
#if defined(WIN32) && !defined(WATT32)
|
|
||||||
WSACleanup();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Wait for the queries to complete.
|
|
||||||
*/
|
|
||||||
static void wait_ares(ares_channel channel)
|
|
||||||
{
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
struct timeval *tvp, tv;
|
|
||||||
fd_set read_fds, write_fds;
|
|
||||||
int nfds;
|
|
||||||
|
|
||||||
FD_ZERO(&read_fds);
|
|
||||||
FD_ZERO(&write_fds);
|
|
||||||
nfds = ares_fds(channel, &read_fds, &write_fds);
|
|
||||||
if (nfds == 0)
|
|
||||||
break;
|
|
||||||
tvp = ares_timeout(channel, NULL, &tv);
|
|
||||||
select(nfds, &read_fds, &write_fds, NULL, tvp);
|
|
||||||
ares_process(channel, &read_fds, &write_fds);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This is the callback used when we have the IP-address of interest.
|
|
||||||
* Extract the CNAME and figure out the country-code from it.
|
|
||||||
*/
|
|
||||||
static void callback(void *arg, int status, int timeouts, struct hostent *host)
|
|
||||||
{
|
|
||||||
const char *name = (const char*)arg;
|
|
||||||
const char *cname;
|
|
||||||
char buf[20];
|
|
||||||
|
|
||||||
(void)timeouts;
|
|
||||||
|
|
||||||
if (!host || status != ARES_SUCCESS)
|
|
||||||
{
|
|
||||||
printf("Failed to lookup %s: %s\n", name, ares_strerror(status));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
TRACE(("\nFound address %s, name %s\n",
|
|
||||||
ares_inet_ntop(AF_INET,(const char*)host->h_addr,buf,sizeof(buf)),
|
|
||||||
host->h_name));
|
|
||||||
|
|
||||||
cname = host->h_name; /* CNAME gets put here */
|
|
||||||
if (!cname)
|
|
||||||
printf("Failed to get CNAME for %s\n", name);
|
|
||||||
else
|
|
||||||
find_country_from_cname(cname, *(struct in_addr*)host->h_addr);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This is the callback used to obtain the IP-address of the host of interest.
|
|
||||||
*/
|
|
||||||
static void callback2(void *arg, int status, int timeouts, struct hostent *host)
|
|
||||||
{
|
|
||||||
struct in_addr *addr = (struct in_addr*) arg;
|
|
||||||
|
|
||||||
(void)timeouts;
|
|
||||||
if (!host || status != ARES_SUCCESS)
|
|
||||||
memset(addr, INADDR_NONE, sizeof(*addr));
|
|
||||||
else
|
|
||||||
memcpy(addr, host->h_addr, sizeof(*addr));
|
|
||||||
}
|
|
||||||
|
|
||||||
struct search_list {
|
|
||||||
int country_number; /* ISO-3166 country number */
|
|
||||||
char short_name[3]; /* A2 short country code */
|
|
||||||
const char *long_name; /* normal country name */
|
|
||||||
};
|
|
||||||
|
|
||||||
static const struct search_list *list_lookup(int number, const struct search_list *list, int num)
|
|
||||||
{
|
|
||||||
while (num > 0 && list->long_name)
|
|
||||||
{
|
|
||||||
if (list->country_number == number)
|
|
||||||
return (list);
|
|
||||||
num--;
|
|
||||||
list++;
|
|
||||||
}
|
|
||||||
return (NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Ref: ftp://ftp.ripe.net/iso3166-countrycodes.txt
|
|
||||||
*/
|
|
||||||
static const struct search_list country_list[] = {
|
|
||||||
{ 4, "af", "Afghanistan" },
|
|
||||||
{ 248, "ax", "<EFBFBD>land Island" },
|
|
||||||
{ 8, "al", "Albania" },
|
|
||||||
{ 12, "dz", "Algeria" },
|
|
||||||
{ 16, "as", "American Samoa" },
|
|
||||||
{ 20, "ad", "Andorra" },
|
|
||||||
{ 24, "ao", "Angola" },
|
|
||||||
{ 660, "ai", "Anguilla" },
|
|
||||||
{ 10, "aq", "Antarctica" },
|
|
||||||
{ 28, "ag", "Antigua & Barbuda" },
|
|
||||||
{ 32, "ar", "Argentina" },
|
|
||||||
{ 51, "am", "Armenia" },
|
|
||||||
{ 533, "aw", "Aruba" },
|
|
||||||
{ 36, "au", "Australia" },
|
|
||||||
{ 40, "at", "Austria" },
|
|
||||||
{ 31, "az", "Azerbaijan" },
|
|
||||||
{ 44, "bs", "Bahamas" },
|
|
||||||
{ 48, "bh", "Bahrain" },
|
|
||||||
{ 50, "bd", "Bangladesh" },
|
|
||||||
{ 52, "bb", "Barbados" },
|
|
||||||
{ 112, "by", "Belarus" },
|
|
||||||
{ 56, "be", "Belgium" },
|
|
||||||
{ 84, "bz", "Belize" },
|
|
||||||
{ 204, "bj", "Benin" },
|
|
||||||
{ 60, "bm", "Bermuda" },
|
|
||||||
{ 64, "bt", "Bhutan" },
|
|
||||||
{ 68, "bo", "Bolivia" },
|
|
||||||
{ 70, "ba", "Bosnia & Herzegowina" },
|
|
||||||
{ 72, "bw", "Botswana" },
|
|
||||||
{ 74, "bv", "Bouvet Island" },
|
|
||||||
{ 76, "br", "Brazil" },
|
|
||||||
{ 86, "io", "British Indian Ocean Territory" },
|
|
||||||
{ 96, "bn", "Brunei Darussalam" },
|
|
||||||
{ 100, "bg", "Bulgaria" },
|
|
||||||
{ 854, "bf", "Burkina Faso" },
|
|
||||||
{ 108, "bi", "Burundi" },
|
|
||||||
{ 116, "kh", "Cambodia" },
|
|
||||||
{ 120, "cm", "Cameroon" },
|
|
||||||
{ 124, "ca", "Canada" },
|
|
||||||
{ 132, "cv", "Cape Verde" },
|
|
||||||
{ 136, "ky", "Cayman Islands" },
|
|
||||||
{ 140, "cf", "Central African Republic" },
|
|
||||||
{ 148, "td", "Chad" },
|
|
||||||
{ 152, "cl", "Chile" },
|
|
||||||
{ 156, "cn", "China" },
|
|
||||||
{ 162, "cx", "Christmas Island" },
|
|
||||||
{ 166, "cc", "Cocos Islands" },
|
|
||||||
{ 170, "co", "Colombia" },
|
|
||||||
{ 174, "km", "Comoros" },
|
|
||||||
{ 178, "cg", "Congo" },
|
|
||||||
{ 180, "cd", "Congo" },
|
|
||||||
{ 184, "ck", "Cook Islands" },
|
|
||||||
{ 188, "cr", "Costa Rica" },
|
|
||||||
{ 384, "ci", "Cote d'Ivoire" },
|
|
||||||
{ 191, "hr", "Croatia" },
|
|
||||||
{ 192, "cu", "Cuba" },
|
|
||||||
{ 196, "cy", "Cyprus" },
|
|
||||||
{ 203, "cz", "Czech Republic" },
|
|
||||||
{ 208, "dk", "Denmark" },
|
|
||||||
{ 262, "dj", "Djibouti" },
|
|
||||||
{ 212, "dm", "Dominica" },
|
|
||||||
{ 214, "do", "Dominican Republic" },
|
|
||||||
{ 218, "ec", "Ecuador" },
|
|
||||||
{ 818, "eg", "Egypt" },
|
|
||||||
{ 222, "sv", "El Salvador" },
|
|
||||||
{ 226, "gq", "Equatorial Guinea" },
|
|
||||||
{ 232, "er", "Eritrea" },
|
|
||||||
{ 233, "ee", "Estonia" },
|
|
||||||
{ 231, "et", "Ethiopia" },
|
|
||||||
{ 238, "fk", "Falkland Islands" },
|
|
||||||
{ 234, "fo", "Faroe Islands" },
|
|
||||||
{ 242, "fj", "Fiji" },
|
|
||||||
{ 246, "fi", "Finland" },
|
|
||||||
{ 250, "fr", "France" },
|
|
||||||
{ 249, "fx", "France, Metropolitan" },
|
|
||||||
{ 254, "gf", "French Guiana" },
|
|
||||||
{ 258, "pf", "French Polynesia" },
|
|
||||||
{ 260, "tf", "French Southern Territories" },
|
|
||||||
{ 266, "ga", "Gabon" },
|
|
||||||
{ 270, "gm", "Gambia" },
|
|
||||||
{ 268, "ge", "Georgia" },
|
|
||||||
{ 276, "de", "Germany" },
|
|
||||||
{ 288, "gh", "Ghana" },
|
|
||||||
{ 292, "gi", "Gibraltar" },
|
|
||||||
{ 300, "gr", "Greece" },
|
|
||||||
{ 304, "gl", "Greenland" },
|
|
||||||
{ 308, "gd", "Grenada" },
|
|
||||||
{ 312, "gp", "Guadeloupe" },
|
|
||||||
{ 316, "gu", "Guam" },
|
|
||||||
{ 320, "gt", "Guatemala" },
|
|
||||||
{ 324, "gn", "Guinea" },
|
|
||||||
{ 624, "gw", "Guinea-Bissau" },
|
|
||||||
{ 328, "gy", "Guyana" },
|
|
||||||
{ 332, "ht", "Haiti" },
|
|
||||||
{ 334, "hm", "Heard & Mc Donald Islands" },
|
|
||||||
{ 336, "va", "Vatican City" },
|
|
||||||
{ 340, "hn", "Honduras" },
|
|
||||||
{ 344, "hk", "Hong kong" },
|
|
||||||
{ 348, "hu", "Hungary" },
|
|
||||||
{ 352, "is", "Iceland" },
|
|
||||||
{ 356, "in", "India" },
|
|
||||||
{ 360, "id", "Indonesia" },
|
|
||||||
{ 364, "ir", "Iran" },
|
|
||||||
{ 368, "iq", "Iraq" },
|
|
||||||
{ 372, "ie", "Ireland" },
|
|
||||||
{ 376, "il", "Israel" },
|
|
||||||
{ 380, "it", "Italy" },
|
|
||||||
{ 388, "jm", "Jamaica" },
|
|
||||||
{ 392, "jp", "Japan" },
|
|
||||||
{ 400, "jo", "Jordan" },
|
|
||||||
{ 398, "kz", "Kazakhstan" },
|
|
||||||
{ 404, "ke", "Kenya" },
|
|
||||||
{ 296, "ki", "Kiribati" },
|
|
||||||
{ 408, "kp", "Korea (north)" },
|
|
||||||
{ 410, "kr", "Korea (south)" },
|
|
||||||
{ 414, "kw", "Kuwait" },
|
|
||||||
{ 417, "kg", "Kyrgyzstan" },
|
|
||||||
{ 418, "la", "Laos" },
|
|
||||||
{ 428, "lv", "Latvia" },
|
|
||||||
{ 422, "lb", "Lebanon" },
|
|
||||||
{ 426, "ls", "Lesotho" },
|
|
||||||
{ 430, "lr", "Liberia" },
|
|
||||||
{ 434, "ly", "Libya" },
|
|
||||||
{ 438, "li", "Liechtenstein" },
|
|
||||||
{ 440, "lt", "Lithuania" },
|
|
||||||
{ 442, "lu", "Luxembourg" },
|
|
||||||
{ 446, "mo", "Macao" },
|
|
||||||
{ 807, "mk", "Macedonia" },
|
|
||||||
{ 450, "mg", "Madagascar" },
|
|
||||||
{ 454, "mw", "Malawi" },
|
|
||||||
{ 458, "my", "Malaysia" },
|
|
||||||
{ 462, "mv", "Maldives" },
|
|
||||||
{ 466, "ml", "Mali" },
|
|
||||||
{ 470, "mt", "Malta" },
|
|
||||||
{ 584, "mh", "Marshall Islands" },
|
|
||||||
{ 474, "mq", "Martinique" },
|
|
||||||
{ 478, "mr", "Mauritania" },
|
|
||||||
{ 480, "mu", "Mauritius" },
|
|
||||||
{ 175, "yt", "Mayotte" },
|
|
||||||
{ 484, "mx", "Mexico" },
|
|
||||||
{ 583, "fm", "Micronesia" },
|
|
||||||
{ 498, "md", "Moldova" },
|
|
||||||
{ 492, "mc", "Monaco" },
|
|
||||||
{ 496, "mn", "Mongolia" },
|
|
||||||
{ 500, "ms", "Montserrat" },
|
|
||||||
{ 504, "ma", "Morocco" },
|
|
||||||
{ 508, "mz", "Mozambique" },
|
|
||||||
{ 104, "mm", "Myanmar" },
|
|
||||||
{ 516, "na", "Namibia" },
|
|
||||||
{ 520, "nr", "Nauru" },
|
|
||||||
{ 524, "np", "Nepal" },
|
|
||||||
{ 528, "nl", "Netherlands" },
|
|
||||||
{ 530, "an", "Netherlands Antilles" },
|
|
||||||
{ 540, "nc", "New Caledonia" },
|
|
||||||
{ 554, "nz", "New Zealand" },
|
|
||||||
{ 558, "ni", "Nicaragua" },
|
|
||||||
{ 562, "ne", "Niger" },
|
|
||||||
{ 566, "ng", "Nigeria" },
|
|
||||||
{ 570, "nu", "Niue" },
|
|
||||||
{ 574, "nf", "Norfolk Island" },
|
|
||||||
{ 580, "mp", "Northern Mariana Islands" },
|
|
||||||
{ 578, "no", "Norway" },
|
|
||||||
{ 512, "om", "Oman" },
|
|
||||||
{ 586, "pk", "Pakistan" },
|
|
||||||
{ 585, "pw", "Palau" },
|
|
||||||
{ 275, "ps", "Palestinian Territory" },
|
|
||||||
{ 591, "pa", "Panama" },
|
|
||||||
{ 598, "pg", "Papua New Guinea" },
|
|
||||||
{ 600, "py", "Paraguay" },
|
|
||||||
{ 604, "pe", "Peru" },
|
|
||||||
{ 608, "ph", "Philippines" },
|
|
||||||
{ 612, "pn", "Pitcairn" },
|
|
||||||
{ 616, "pl", "Poland" },
|
|
||||||
{ 620, "pt", "Portugal" },
|
|
||||||
{ 630, "pr", "Puerto Rico" },
|
|
||||||
{ 634, "qa", "Qatar" },
|
|
||||||
{ 638, "re", "Reunion" },
|
|
||||||
{ 642, "ro", "Romania" },
|
|
||||||
{ 643, "ru", "Russia" },
|
|
||||||
{ 646, "rw", "Rwanda" },
|
|
||||||
{ 659, "kn", "Saint Kitts & Nevis" },
|
|
||||||
{ 662, "lc", "Saint Lucia" },
|
|
||||||
{ 670, "vc", "Saint Vincent" },
|
|
||||||
{ 882, "ws", "Samoa" },
|
|
||||||
{ 674, "sm", "San Marino" },
|
|
||||||
{ 678, "st", "Sao Tome & Principe" },
|
|
||||||
{ 682, "sa", "Saudi Arabia" },
|
|
||||||
{ 686, "sn", "Senegal" },
|
|
||||||
{ 891, "cs", "Serbia and Montenegro" },
|
|
||||||
{ 690, "sc", "Seychelles" },
|
|
||||||
{ 694, "sl", "Sierra Leone" },
|
|
||||||
{ 702, "sg", "Singapore" },
|
|
||||||
{ 703, "sk", "Slovakia" },
|
|
||||||
{ 705, "si", "Slovenia" },
|
|
||||||
{ 90, "sb", "Solomon Islands" },
|
|
||||||
{ 706, "so", "Somalia" },
|
|
||||||
{ 710, "za", "South Africa" },
|
|
||||||
{ 239, "gs", "South Georgia" },
|
|
||||||
{ 724, "es", "Spain" },
|
|
||||||
{ 144, "lk", "Sri Lanka" },
|
|
||||||
{ 654, "sh", "St. Helena" },
|
|
||||||
{ 666, "pm", "St. Pierre & Miquelon" },
|
|
||||||
{ 736, "sd", "Sudan" },
|
|
||||||
{ 740, "sr", "Suriname" },
|
|
||||||
{ 744, "sj", "Svalbard & Jan Mayen Islands" },
|
|
||||||
{ 748, "sz", "Swaziland" },
|
|
||||||
{ 752, "se", "Sweden" },
|
|
||||||
{ 756, "ch", "Switzerland" },
|
|
||||||
{ 760, "sy", "Syrian Arab Republic" },
|
|
||||||
{ 626, "tl", "Timor-Leste" },
|
|
||||||
{ 158, "tw", "Taiwan" },
|
|
||||||
{ 762, "tj", "Tajikistan" },
|
|
||||||
{ 834, "tz", "Tanzania" },
|
|
||||||
{ 764, "th", "Thailand" },
|
|
||||||
{ 768, "tg", "Togo" },
|
|
||||||
{ 772, "tk", "Tokelau" },
|
|
||||||
{ 776, "to", "Tonga" },
|
|
||||||
{ 780, "tt", "Trinidad & Tobago" },
|
|
||||||
{ 788, "tn", "Tunisia" },
|
|
||||||
{ 792, "tr", "Turkey" },
|
|
||||||
{ 795, "tm", "Turkmenistan" },
|
|
||||||
{ 796, "tc", "Turks & Caicos Islands" },
|
|
||||||
{ 798, "tv", "Tuvalu" },
|
|
||||||
{ 800, "ug", "Uganda" },
|
|
||||||
{ 804, "ua", "Ukraine" },
|
|
||||||
{ 784, "ae", "United Arab Emirates" },
|
|
||||||
{ 826, "gb", "United Kingdom" },
|
|
||||||
{ 840, "us", "United States" },
|
|
||||||
{ 581, "um", "United States Minor Outlying Islands" },
|
|
||||||
{ 858, "uy", "Uruguay" },
|
|
||||||
{ 860, "uz", "Uzbekistan" },
|
|
||||||
{ 548, "vu", "Vanuatu" },
|
|
||||||
{ 862, "ve", "Venezuela" },
|
|
||||||
{ 704, "vn", "Vietnam" },
|
|
||||||
{ 92, "vg", "Virgin Islands (British)" },
|
|
||||||
{ 850, "vi", "Virgin Islands (US)" },
|
|
||||||
{ 876, "wf", "Wallis & Futuna Islands" },
|
|
||||||
{ 732, "eh", "Western Sahara" },
|
|
||||||
{ 887, "ye", "Yemen" },
|
|
||||||
{ 894, "zm", "Zambia" },
|
|
||||||
{ 716, "zw", "Zimbabwe" }
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Check if start of 'str' is simply an IPv4 address.
|
|
||||||
*/
|
|
||||||
#define BYTE_OK(x) ((x) >= 0 && (x) <= 255)
|
|
||||||
|
|
||||||
static int is_addr(char *str, char **end)
|
|
||||||
{
|
|
||||||
int a0, a1, a2, a3, num, rc = 0, length = 0;
|
|
||||||
|
|
||||||
num = sscanf(str,"%3d.%3d.%3d.%3d%n",&a0,&a1,&a2,&a3,&length);
|
|
||||||
if( (num == 4) &&
|
|
||||||
BYTE_OK(a0) && BYTE_OK(a1) && BYTE_OK(a2) && BYTE_OK(a3) &&
|
|
||||||
length >= (3+4))
|
|
||||||
{
|
|
||||||
rc = 1;
|
|
||||||
*end = str + length;
|
|
||||||
}
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Find the country-code and name from the CNAME. E.g.:
|
|
||||||
* version 1: CNAME = zzno.countries.nerd.dk with address 127.0.2.66
|
|
||||||
* yields ccode_A" = "no" and cnumber 578 (2.66).
|
|
||||||
* version 2: CNAME = <a.b.c.d>.zz.countries.nerd.dk with address 127.0.2.66
|
|
||||||
* yields cnumber 578 (2.66). ccode_A is "";
|
|
||||||
*/
|
|
||||||
static void find_country_from_cname(const char *cname, struct in_addr addr)
|
|
||||||
{
|
|
||||||
const struct search_list *country;
|
|
||||||
char ccode_A2[3], *ccopy, *dot_4;
|
|
||||||
int cnumber, z0, z1, ver_1, ver_2;
|
|
||||||
unsigned long ip;
|
|
||||||
|
|
||||||
ip = ntohl(addr.s_addr);
|
|
||||||
z0 = tolower(cname[0]);
|
|
||||||
z1 = tolower(cname[1]);
|
|
||||||
ccopy = strdup(cname);
|
|
||||||
dot_4 = NULL;
|
|
||||||
|
|
||||||
ver_1 = (z0 == 'z' && z1 == 'z' && !strcasecmp(cname+4,nerd_ver1));
|
|
||||||
ver_2 = (is_addr(ccopy,&dot_4) && !strcasecmp(dot_4,nerd_ver2));
|
|
||||||
|
|
||||||
if (ver_1)
|
|
||||||
{
|
|
||||||
const char *dot = strchr(cname, '.');
|
|
||||||
if ((z0 != 'z' && z1 != 'z') || dot != cname+4)
|
|
||||||
{
|
|
||||||
printf("Unexpected CNAME %s (ver_1)\n", cname);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (ver_2)
|
|
||||||
{
|
|
||||||
z0 = tolower(dot_4[1]);
|
|
||||||
z1 = tolower(dot_4[2]);
|
|
||||||
if (z0 != 'z' && z1 != 'z')
|
|
||||||
{
|
|
||||||
printf("Unexpected CNAME %s (ver_2)\n", cname);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
printf("Unexpected CNAME %s (ver?)\n", cname);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ver_1)
|
|
||||||
{
|
|
||||||
ccode_A2[0] = (char)tolower(cname[2]);
|
|
||||||
ccode_A2[1] = (char)tolower(cname[3]);
|
|
||||||
ccode_A2[2] = '\0';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
ccode_A2[0] = '\0';
|
|
||||||
|
|
||||||
cnumber = ip & 0xFFFF;
|
|
||||||
|
|
||||||
TRACE(("Found country-code `%s', number %d\n",
|
|
||||||
ver_1 ? ccode_A2 : "<n/a>", cnumber));
|
|
||||||
|
|
||||||
country = list_lookup(cnumber, country_list,
|
|
||||||
sizeof(country_list) / sizeof(country_list[0]));
|
|
||||||
if (!country)
|
|
||||||
printf("Name for country-number %d not found.\n", cnumber);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (ver_1 && *(unsigned short*)&country->short_name != *(unsigned*)&ccode_A2)
|
|
||||||
printf("short-name mismatch; %s vs %s\n", country->short_name, ccode_A2);
|
|
||||||
|
|
||||||
printf("%s (%s), number %d.\n",
|
|
||||||
country->long_name, country->short_name, cnumber);
|
|
||||||
}
|
|
||||||
free(ccopy);
|
|
||||||
}
|
|
||||||
|
|
||||||
730
ares/adig.c
730
ares/adig.c
@@ -1,730 +0,0 @@
|
|||||||
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
* 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 "setup.h"
|
|
||||||
|
|
||||||
#ifdef HAVE_SYS_SOCKET_H
|
|
||||||
# include <sys/socket.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_NETINET_IN_H
|
|
||||||
# include <netinet/in.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_ARPA_INET_H
|
|
||||||
# include <arpa/inet.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_NETDB_H
|
|
||||||
# include <netdb.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_SYS_TIME_H
|
|
||||||
# include <sys/time.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_UNISTD_H
|
|
||||||
# include <unistd.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_STRINGS_H
|
|
||||||
# include <strings.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <ctype.h>
|
|
||||||
#include <errno.h>
|
|
||||||
|
|
||||||
#include "ares.h"
|
|
||||||
#include "ares_dns.h"
|
|
||||||
#include "inet_ntop.h"
|
|
||||||
#include "inet_net_pton.h"
|
|
||||||
#include "ares_getopt.h"
|
|
||||||
|
|
||||||
#ifndef HAVE_STRDUP
|
|
||||||
# include "ares_strdup.h"
|
|
||||||
# define strdup(ptr) ares_strdup(ptr)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef HAVE_STRCASECMP
|
|
||||||
# include "ares_strcasecmp.h"
|
|
||||||
# define strcasecmp(p1,p2) ares_strcasecmp(p1,p2)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef HAVE_STRNCASECMP
|
|
||||||
# include "ares_strcasecmp.h"
|
|
||||||
# define strncasecmp(p1,p2,n) ares_strncasecmp(p1,p2,n)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WATT32
|
|
||||||
#undef WIN32 /* Redefined in MingW headers */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Mac OS X portability check */
|
|
||||||
#ifndef T_SRV
|
|
||||||
#define T_SRV 33 /* server selection */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct nv {
|
|
||||||
const char *name;
|
|
||||||
int value;
|
|
||||||
};
|
|
||||||
|
|
||||||
static const struct nv flags[] = {
|
|
||||||
{ "usevc", ARES_FLAG_USEVC },
|
|
||||||
{ "primary", ARES_FLAG_PRIMARY },
|
|
||||||
{ "igntc", ARES_FLAG_IGNTC },
|
|
||||||
{ "norecurse", ARES_FLAG_NORECURSE },
|
|
||||||
{ "stayopen", ARES_FLAG_STAYOPEN },
|
|
||||||
{ "noaliases", ARES_FLAG_NOALIASES }
|
|
||||||
};
|
|
||||||
static const int nflags = sizeof(flags) / sizeof(flags[0]);
|
|
||||||
|
|
||||||
static const struct nv classes[] = {
|
|
||||||
{ "IN", C_IN },
|
|
||||||
{ "CHAOS", C_CHAOS },
|
|
||||||
{ "HS", C_HS },
|
|
||||||
{ "ANY", C_ANY }
|
|
||||||
};
|
|
||||||
static const int nclasses = sizeof(classes) / sizeof(classes[0]);
|
|
||||||
|
|
||||||
static const struct nv types[] = {
|
|
||||||
{ "A", T_A },
|
|
||||||
{ "NS", T_NS },
|
|
||||||
{ "MD", T_MD },
|
|
||||||
{ "MF", T_MF },
|
|
||||||
{ "CNAME", T_CNAME },
|
|
||||||
{ "SOA", T_SOA },
|
|
||||||
{ "MB", T_MB },
|
|
||||||
{ "MG", T_MG },
|
|
||||||
{ "MR", T_MR },
|
|
||||||
{ "NULL", T_NULL },
|
|
||||||
{ "WKS", T_WKS },
|
|
||||||
{ "PTR", T_PTR },
|
|
||||||
{ "HINFO", T_HINFO },
|
|
||||||
{ "MINFO", T_MINFO },
|
|
||||||
{ "MX", T_MX },
|
|
||||||
{ "TXT", T_TXT },
|
|
||||||
{ "RP", T_RP },
|
|
||||||
{ "AFSDB", T_AFSDB },
|
|
||||||
{ "X25", T_X25 },
|
|
||||||
{ "ISDN", T_ISDN },
|
|
||||||
{ "RT", T_RT },
|
|
||||||
{ "NSAP", T_NSAP },
|
|
||||||
{ "NSAP_PTR", T_NSAP_PTR },
|
|
||||||
{ "SIG", T_SIG },
|
|
||||||
{ "KEY", T_KEY },
|
|
||||||
{ "PX", T_PX },
|
|
||||||
{ "GPOS", T_GPOS },
|
|
||||||
{ "AAAA", T_AAAA },
|
|
||||||
{ "LOC", T_LOC },
|
|
||||||
{ "SRV", T_SRV },
|
|
||||||
{ "AXFR", T_AXFR },
|
|
||||||
{ "MAILB", T_MAILB },
|
|
||||||
{ "MAILA", T_MAILA },
|
|
||||||
{ "NAPTR", T_NAPTR },
|
|
||||||
{ "ANY", T_ANY }
|
|
||||||
};
|
|
||||||
static const int ntypes = sizeof(types) / sizeof(types[0]);
|
|
||||||
|
|
||||||
static const char *opcodes[] = {
|
|
||||||
"QUERY", "IQUERY", "STATUS", "(reserved)", "NOTIFY",
|
|
||||||
"(unknown)", "(unknown)", "(unknown)", "(unknown)",
|
|
||||||
"UPDATEA", "UPDATED", "UPDATEDA", "UPDATEM", "UPDATEMA",
|
|
||||||
"ZONEINIT", "ZONEREF"
|
|
||||||
};
|
|
||||||
struct in_addr inaddr;
|
|
||||||
|
|
||||||
static const char *rcodes[] = {
|
|
||||||
"NOERROR", "FORMERR", "SERVFAIL", "NXDOMAIN", "NOTIMP", "REFUSED",
|
|
||||||
"(unknown)", "(unknown)", "(unknown)", "(unknown)", "(unknown)",
|
|
||||||
"(unknown)", "(unknown)", "(unknown)", "(unknown)", "NOCHANGE"
|
|
||||||
};
|
|
||||||
|
|
||||||
static void callback(void *arg, int status, int timeouts,
|
|
||||||
unsigned char *abuf, int alen);
|
|
||||||
static const unsigned char *display_question(const unsigned char *aptr,
|
|
||||||
const unsigned char *abuf,
|
|
||||||
int alen);
|
|
||||||
static const unsigned char *display_rr(const unsigned char *aptr,
|
|
||||||
const unsigned char *abuf, int alen);
|
|
||||||
static const char *type_name(int type);
|
|
||||||
static const char *class_name(int dnsclass);
|
|
||||||
static void usage(void);
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
ares_channel channel;
|
|
||||||
int c, i, optmask = ARES_OPT_FLAGS, dnsclass = C_IN, type = T_A;
|
|
||||||
int status, nfds, count;
|
|
||||||
struct ares_options options;
|
|
||||||
struct hostent *hostent;
|
|
||||||
fd_set read_fds, write_fds;
|
|
||||||
struct timeval *tvp, tv;
|
|
||||||
|
|
||||||
#ifdef USE_WINSOCK
|
|
||||||
WORD wVersionRequested = MAKEWORD(USE_WINSOCK,USE_WINSOCK);
|
|
||||||
WSADATA wsaData;
|
|
||||||
WSAStartup(wVersionRequested, &wsaData);
|
|
||||||
#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.servers = NULL;
|
|
||||||
options.nservers = 0;
|
|
||||||
while ((c = ares_getopt(argc, argv, "df:s:c:t:T:U:")) != -1)
|
|
||||||
{
|
|
||||||
switch (c)
|
|
||||||
{
|
|
||||||
case 'd':
|
|
||||||
#ifdef WATT32
|
|
||||||
dbug_init();
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'f':
|
|
||||||
/* Add a flag. */
|
|
||||||
for (i = 0; i < nflags; i++)
|
|
||||||
{
|
|
||||||
if (strcmp(flags[i].name, optarg) == 0)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (i == nflags)
|
|
||||||
usage();
|
|
||||||
options.flags |= flags[i].value;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 's':
|
|
||||||
/* Add a server, and specify servers in the option mask. */
|
|
||||||
if (ares_inet_pton(AF_INET, optarg, &inaddr) <= 0)
|
|
||||||
{
|
|
||||||
hostent = gethostbyname(optarg);
|
|
||||||
if (!hostent || hostent->h_addrtype != AF_INET)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "adig: server %s not found.\n", optarg);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
memcpy(&inaddr, hostent->h_addr, sizeof(struct in_addr));
|
|
||||||
}
|
|
||||||
options.servers = realloc(options.servers, (options.nservers + 1)
|
|
||||||
* sizeof(struct in_addr));
|
|
||||||
if (!options.servers)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "Out of memory!\n");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
memcpy(&options.servers[options.nservers], &inaddr,
|
|
||||||
sizeof(struct in_addr));
|
|
||||||
options.nservers++;
|
|
||||||
optmask |= ARES_OPT_SERVERS;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'c':
|
|
||||||
/* Set the query class. */
|
|
||||||
for (i = 0; i < nclasses; i++)
|
|
||||||
{
|
|
||||||
if (strcasecmp(classes[i].name, optarg) == 0)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (i == nclasses)
|
|
||||||
usage();
|
|
||||||
dnsclass = classes[i].value;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 't':
|
|
||||||
/* Set the query type. */
|
|
||||||
for (i = 0; i < ntypes; i++)
|
|
||||||
{
|
|
||||||
if (strcasecmp(types[i].name, optarg) == 0)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (i == ntypes)
|
|
||||||
usage();
|
|
||||||
type = types[i].value;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'T':
|
|
||||||
/* Set the TCP port number. */
|
|
||||||
if (!ISDIGIT(*optarg))
|
|
||||||
usage();
|
|
||||||
options.tcp_port = (unsigned short)strtol(optarg, NULL, 0);
|
|
||||||
optmask |= ARES_OPT_TCP_PORT;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'U':
|
|
||||||
/* Set the UDP port number. */
|
|
||||||
if (!ISDIGIT(*optarg))
|
|
||||||
usage();
|
|
||||||
options.udp_port = (unsigned short)strtol(optarg, NULL, 0);
|
|
||||||
optmask |= ARES_OPT_UDP_PORT;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
argc -= optind;
|
|
||||||
argv += optind;
|
|
||||||
if (argc == 0)
|
|
||||||
usage();
|
|
||||||
|
|
||||||
status = ares_init_options(&channel, &options, optmask);
|
|
||||||
|
|
||||||
if (status != ARES_SUCCESS)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "ares_init_options: %s\n",
|
|
||||||
ares_strerror(status));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initiate the queries, one per command-line argument. If there is
|
|
||||||
* only one query to do, supply NULL as the callback argument;
|
|
||||||
* otherwise, supply the query name as an argument so we can
|
|
||||||
* distinguish responses for the user when printing them out.
|
|
||||||
*/
|
|
||||||
if (argc == 1)
|
|
||||||
ares_query(channel, *argv, dnsclass, type, callback, (char *) NULL);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (; *argv; argv++)
|
|
||||||
ares_query(channel, *argv, dnsclass, type, callback, *argv);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Wait for all queries to complete. */
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
FD_ZERO(&read_fds);
|
|
||||||
FD_ZERO(&write_fds);
|
|
||||||
nfds = ares_fds(channel, &read_fds, &write_fds);
|
|
||||||
if (nfds == 0)
|
|
||||||
break;
|
|
||||||
tvp = ares_timeout(channel, NULL, &tv);
|
|
||||||
count = select(nfds, &read_fds, &write_fds, NULL, tvp);
|
|
||||||
if (count < 0 && SOCKERRNO != EINVAL)
|
|
||||||
{
|
|
||||||
perror("select");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
ares_process(channel, &read_fds, &write_fds);
|
|
||||||
}
|
|
||||||
|
|
||||||
ares_destroy(channel);
|
|
||||||
|
|
||||||
ares_library_cleanup();
|
|
||||||
|
|
||||||
#ifdef USE_WINSOCK
|
|
||||||
WSACleanup();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void callback(void *arg, int status, int timeouts,
|
|
||||||
unsigned char *abuf, int alen)
|
|
||||||
{
|
|
||||||
char *name = (char *) arg;
|
|
||||||
int id, qr, opcode, aa, tc, rd, ra, rcode;
|
|
||||||
unsigned int qdcount, ancount, nscount, arcount, i;
|
|
||||||
const unsigned char *aptr;
|
|
||||||
|
|
||||||
(void) timeouts;
|
|
||||||
|
|
||||||
/* Display the query name if given. */
|
|
||||||
if (name)
|
|
||||||
printf("Answer for query %s:\n", name);
|
|
||||||
|
|
||||||
/* Display an error message if there was an error, but only stop if
|
|
||||||
* we actually didn't get an answer buffer.
|
|
||||||
*/
|
|
||||||
if (status != ARES_SUCCESS)
|
|
||||||
{
|
|
||||||
printf("%s\n", ares_strerror(status));
|
|
||||||
if (!abuf)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Won't happen, but check anyway, for safety. */
|
|
||||||
if (alen < HFIXEDSZ)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* Parse the answer header. */
|
|
||||||
id = DNS_HEADER_QID(abuf);
|
|
||||||
qr = DNS_HEADER_QR(abuf);
|
|
||||||
opcode = DNS_HEADER_OPCODE(abuf);
|
|
||||||
aa = DNS_HEADER_AA(abuf);
|
|
||||||
tc = DNS_HEADER_TC(abuf);
|
|
||||||
rd = DNS_HEADER_RD(abuf);
|
|
||||||
ra = DNS_HEADER_RA(abuf);
|
|
||||||
rcode = DNS_HEADER_RCODE(abuf);
|
|
||||||
qdcount = DNS_HEADER_QDCOUNT(abuf);
|
|
||||||
ancount = DNS_HEADER_ANCOUNT(abuf);
|
|
||||||
nscount = DNS_HEADER_NSCOUNT(abuf);
|
|
||||||
arcount = DNS_HEADER_ARCOUNT(abuf);
|
|
||||||
|
|
||||||
/* Display the answer header. */
|
|
||||||
printf("id: %d\n", id);
|
|
||||||
printf("flags: %s%s%s%s%s\n",
|
|
||||||
qr ? "qr " : "",
|
|
||||||
aa ? "aa " : "",
|
|
||||||
tc ? "tc " : "",
|
|
||||||
rd ? "rd " : "",
|
|
||||||
ra ? "ra " : "");
|
|
||||||
printf("opcode: %s\n", opcodes[opcode]);
|
|
||||||
printf("rcode: %s\n", rcodes[rcode]);
|
|
||||||
|
|
||||||
/* Display the questions. */
|
|
||||||
printf("Questions:\n");
|
|
||||||
aptr = abuf + HFIXEDSZ;
|
|
||||||
for (i = 0; i < qdcount; i++)
|
|
||||||
{
|
|
||||||
aptr = display_question(aptr, abuf, alen);
|
|
||||||
if (aptr == NULL)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Display the answers. */
|
|
||||||
printf("Answers:\n");
|
|
||||||
for (i = 0; i < ancount; i++)
|
|
||||||
{
|
|
||||||
aptr = display_rr(aptr, abuf, alen);
|
|
||||||
if (aptr == NULL)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Display the NS records. */
|
|
||||||
printf("NS records:\n");
|
|
||||||
for (i = 0; i < nscount; i++)
|
|
||||||
{
|
|
||||||
aptr = display_rr(aptr, abuf, alen);
|
|
||||||
if (aptr == NULL)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Display the additional records. */
|
|
||||||
printf("Additional records:\n");
|
|
||||||
for (i = 0; i < arcount; i++)
|
|
||||||
{
|
|
||||||
aptr = display_rr(aptr, abuf, alen);
|
|
||||||
if (aptr == NULL)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static const unsigned char *display_question(const unsigned char *aptr,
|
|
||||||
const unsigned char *abuf,
|
|
||||||
int alen)
|
|
||||||
{
|
|
||||||
char *name;
|
|
||||||
int type, dnsclass, status;
|
|
||||||
long len;
|
|
||||||
|
|
||||||
/* Parse the question name. */
|
|
||||||
status = ares_expand_name(aptr, abuf, alen, &name, &len);
|
|
||||||
if (status != ARES_SUCCESS)
|
|
||||||
return NULL;
|
|
||||||
aptr += len;
|
|
||||||
|
|
||||||
/* Make sure there's enough data after the name for the fixed part
|
|
||||||
* of the question.
|
|
||||||
*/
|
|
||||||
if (aptr + QFIXEDSZ > abuf + alen)
|
|
||||||
{
|
|
||||||
ares_free_string(name);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Parse the question type and class. */
|
|
||||||
type = DNS_QUESTION_TYPE(aptr);
|
|
||||||
dnsclass = DNS_QUESTION_CLASS(aptr);
|
|
||||||
aptr += QFIXEDSZ;
|
|
||||||
|
|
||||||
/* Display the question, in a format sort of similar to how we will
|
|
||||||
* display RRs.
|
|
||||||
*/
|
|
||||||
printf("\t%-15s.\t", name);
|
|
||||||
if (dnsclass != C_IN)
|
|
||||||
printf("\t%s", class_name(dnsclass));
|
|
||||||
printf("\t%s\n", type_name(type));
|
|
||||||
ares_free_string(name);
|
|
||||||
return aptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const unsigned char *display_rr(const unsigned char *aptr,
|
|
||||||
const unsigned char *abuf, int alen)
|
|
||||||
{
|
|
||||||
const unsigned char *p;
|
|
||||||
int type, dnsclass, ttl, dlen, status;
|
|
||||||
long len;
|
|
||||||
char addr[46];
|
|
||||||
union {
|
|
||||||
unsigned char * as_uchar;
|
|
||||||
char * as_char;
|
|
||||||
} name;
|
|
||||||
|
|
||||||
/* Parse the RR name. */
|
|
||||||
status = ares_expand_name(aptr, abuf, alen, &name.as_char, &len);
|
|
||||||
if (status != ARES_SUCCESS)
|
|
||||||
return NULL;
|
|
||||||
aptr += len;
|
|
||||||
|
|
||||||
/* Make sure there is enough data after the RR name for the fixed
|
|
||||||
* part of the RR.
|
|
||||||
*/
|
|
||||||
if (aptr + RRFIXEDSZ > abuf + alen)
|
|
||||||
{
|
|
||||||
ares_free_string(name.as_char);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Parse the fixed part of the RR, and advance to the RR data
|
|
||||||
* field. */
|
|
||||||
type = DNS_RR_TYPE(aptr);
|
|
||||||
dnsclass = DNS_RR_CLASS(aptr);
|
|
||||||
ttl = DNS_RR_TTL(aptr);
|
|
||||||
dlen = DNS_RR_LEN(aptr);
|
|
||||||
aptr += RRFIXEDSZ;
|
|
||||||
if (aptr + dlen > abuf + alen)
|
|
||||||
{
|
|
||||||
ares_free_string(name.as_char);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Display the RR name, class, and type. */
|
|
||||||
printf("\t%-15s.\t%d", name.as_char, ttl);
|
|
||||||
if (dnsclass != C_IN)
|
|
||||||
printf("\t%s", class_name(dnsclass));
|
|
||||||
printf("\t%s", type_name(type));
|
|
||||||
ares_free_string(name.as_char);
|
|
||||||
|
|
||||||
/* Display the RR data. Don't touch aptr. */
|
|
||||||
switch (type)
|
|
||||||
{
|
|
||||||
case T_CNAME:
|
|
||||||
case T_MB:
|
|
||||||
case T_MD:
|
|
||||||
case T_MF:
|
|
||||||
case T_MG:
|
|
||||||
case T_MR:
|
|
||||||
case T_NS:
|
|
||||||
case T_PTR:
|
|
||||||
/* For these types, the RR data is just a domain name. */
|
|
||||||
status = ares_expand_name(aptr, abuf, alen, &name.as_char, &len);
|
|
||||||
if (status != ARES_SUCCESS)
|
|
||||||
return NULL;
|
|
||||||
printf("\t%s.", name.as_char);
|
|
||||||
ares_free_string(name.as_char);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case T_HINFO:
|
|
||||||
/* The RR data is two length-counted character strings. */
|
|
||||||
p = aptr;
|
|
||||||
len = *p;
|
|
||||||
if (p + len + 1 > aptr + dlen)
|
|
||||||
return NULL;
|
|
||||||
printf("\t%.*s", (int)len, p + 1);
|
|
||||||
p += len + 1;
|
|
||||||
len = *p;
|
|
||||||
if (p + len + 1 > aptr + dlen)
|
|
||||||
return NULL;
|
|
||||||
printf("\t%.*s", (int)len, p + 1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case T_MINFO:
|
|
||||||
/* The RR data is two domain names. */
|
|
||||||
p = aptr;
|
|
||||||
status = ares_expand_name(p, abuf, alen, &name.as_char, &len);
|
|
||||||
if (status != ARES_SUCCESS)
|
|
||||||
return NULL;
|
|
||||||
printf("\t%s.", name.as_char);
|
|
||||||
ares_free_string(name.as_char);
|
|
||||||
p += len;
|
|
||||||
status = ares_expand_name(p, abuf, alen, &name.as_char, &len);
|
|
||||||
if (status != ARES_SUCCESS)
|
|
||||||
return NULL;
|
|
||||||
printf("\t%s.", name.as_char);
|
|
||||||
ares_free_string(name.as_char);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case T_MX:
|
|
||||||
/* The RR data is two bytes giving a preference ordering, and
|
|
||||||
* then a domain name.
|
|
||||||
*/
|
|
||||||
if (dlen < 2)
|
|
||||||
return NULL;
|
|
||||||
printf("\t%d", DNS__16BIT(aptr));
|
|
||||||
status = ares_expand_name(aptr + 2, abuf, alen, &name.as_char, &len);
|
|
||||||
if (status != ARES_SUCCESS)
|
|
||||||
return NULL;
|
|
||||||
printf("\t%s.", name.as_char);
|
|
||||||
ares_free_string(name.as_char);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case T_SOA:
|
|
||||||
/* The RR data is two domain names and then five four-byte
|
|
||||||
* numbers giving the serial number and some timeouts.
|
|
||||||
*/
|
|
||||||
p = aptr;
|
|
||||||
status = ares_expand_name(p, abuf, alen, &name.as_char, &len);
|
|
||||||
if (status != ARES_SUCCESS)
|
|
||||||
return NULL;
|
|
||||||
printf("\t%s.\n", name.as_char);
|
|
||||||
ares_free_string(name.as_char);
|
|
||||||
p += len;
|
|
||||||
status = ares_expand_name(p, abuf, alen, &name.as_char, &len);
|
|
||||||
if (status != ARES_SUCCESS)
|
|
||||||
return NULL;
|
|
||||||
printf("\t\t\t\t\t\t%s.\n", name.as_char);
|
|
||||||
ares_free_string(name.as_char);
|
|
||||||
p += len;
|
|
||||||
if (p + 20 > aptr + dlen)
|
|
||||||
return NULL;
|
|
||||||
printf("\t\t\t\t\t\t( %lu %lu %lu %lu %lu )",
|
|
||||||
(unsigned long)DNS__32BIT(p), (unsigned long)DNS__32BIT(p+4),
|
|
||||||
(unsigned long)DNS__32BIT(p+8), (unsigned long)DNS__32BIT(p+12),
|
|
||||||
(unsigned long)DNS__32BIT(p+16));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case T_TXT:
|
|
||||||
/* The RR data is one or more length-counted character
|
|
||||||
* strings. */
|
|
||||||
p = aptr;
|
|
||||||
while (p < aptr + dlen)
|
|
||||||
{
|
|
||||||
len = *p;
|
|
||||||
if (p + len + 1 > aptr + dlen)
|
|
||||||
return NULL;
|
|
||||||
printf("\t%.*s", (int)len, p + 1);
|
|
||||||
p += len + 1;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case T_A:
|
|
||||||
/* The RR data is a four-byte Internet address. */
|
|
||||||
if (dlen != 4)
|
|
||||||
return NULL;
|
|
||||||
printf("\t%s", ares_inet_ntop(AF_INET,aptr,addr,sizeof(addr)));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case T_AAAA:
|
|
||||||
/* The RR data is a 16-byte IPv6 address. */
|
|
||||||
if (dlen != 16)
|
|
||||||
return NULL;
|
|
||||||
printf("\t%s", ares_inet_ntop(AF_INET6,aptr,addr,sizeof(addr)));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case T_WKS:
|
|
||||||
/* Not implemented yet */
|
|
||||||
break;
|
|
||||||
|
|
||||||
case T_SRV:
|
|
||||||
/* The RR data is three two-byte numbers representing the
|
|
||||||
* priority, weight, and port, followed by a domain name.
|
|
||||||
*/
|
|
||||||
|
|
||||||
printf("\t%d", DNS__16BIT(aptr));
|
|
||||||
printf(" %d", DNS__16BIT(aptr + 2));
|
|
||||||
printf(" %d", DNS__16BIT(aptr + 4));
|
|
||||||
|
|
||||||
status = ares_expand_name(aptr + 6, abuf, alen, &name.as_char, &len);
|
|
||||||
if (status != ARES_SUCCESS)
|
|
||||||
return NULL;
|
|
||||||
printf("\t%s.", name.as_char);
|
|
||||||
ares_free_string(name.as_char);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case T_NAPTR:
|
|
||||||
|
|
||||||
printf("\t%d", DNS__16BIT(aptr)); /* order */
|
|
||||||
printf(" %d\n", DNS__16BIT(aptr + 2)); /* preference */
|
|
||||||
|
|
||||||
p = aptr + 4;
|
|
||||||
status = ares_expand_string(p, abuf, alen, &name.as_uchar, &len);
|
|
||||||
if (status != ARES_SUCCESS)
|
|
||||||
return NULL;
|
|
||||||
printf("\t\t\t\t\t\t%s\n", name.as_char);
|
|
||||||
ares_free_string(name.as_char);
|
|
||||||
p += len;
|
|
||||||
|
|
||||||
status = ares_expand_string(p, abuf, alen, &name.as_uchar, &len);
|
|
||||||
if (status != ARES_SUCCESS)
|
|
||||||
return NULL;
|
|
||||||
printf("\t\t\t\t\t\t%s\n", name.as_char);
|
|
||||||
ares_free_string(name.as_char);
|
|
||||||
p += len;
|
|
||||||
|
|
||||||
status = ares_expand_string(p, abuf, alen, &name.as_uchar, &len);
|
|
||||||
if (status != ARES_SUCCESS)
|
|
||||||
return NULL;
|
|
||||||
printf("\t\t\t\t\t\t%s\n", name.as_char);
|
|
||||||
ares_free_string(name.as_char);
|
|
||||||
p += len;
|
|
||||||
|
|
||||||
status = ares_expand_string(p, abuf, alen, &name.as_uchar, &len);
|
|
||||||
if (status != ARES_SUCCESS)
|
|
||||||
return NULL;
|
|
||||||
printf("\t\t\t\t\t\t%s", name.as_char);
|
|
||||||
ares_free_string(name.as_char);
|
|
||||||
break;
|
|
||||||
|
|
||||||
|
|
||||||
default:
|
|
||||||
printf("\t[Unknown RR; cannot parse]");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
printf("\n");
|
|
||||||
|
|
||||||
return aptr + dlen;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *type_name(int type)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < ntypes; i++)
|
|
||||||
{
|
|
||||||
if (types[i].value == type)
|
|
||||||
return types[i].name;
|
|
||||||
}
|
|
||||||
return "(unknown)";
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *class_name(int dnsclass)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < nclasses; i++)
|
|
||||||
{
|
|
||||||
if (classes[i].value == dnsclass)
|
|
||||||
return classes[i].name;
|
|
||||||
}
|
|
||||||
return "(unknown)";
|
|
||||||
}
|
|
||||||
|
|
||||||
static void usage(void)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "usage: adig [-f flag] [-s server] [-c class] "
|
|
||||||
"[-t type] [-p port] name ...\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
202
ares/ahost.c
202
ares/ahost.c
@@ -1,202 +0,0 @@
|
|||||||
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
* 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 "setup.h"
|
|
||||||
|
|
||||||
#if !defined(WIN32) || defined(WATT32)
|
|
||||||
#ifdef HAVE_SYS_TIME_H
|
|
||||||
#include <sys/time.h>
|
|
||||||
#endif
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#include <arpa/inet.h>
|
|
||||||
#include <netdb.h>
|
|
||||||
#ifdef HAVE_UNISTD_H
|
|
||||||
#include <unistd.h>
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_STRINGS_H
|
|
||||||
#include <strings.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "ares.h"
|
|
||||||
#include "ares_dns.h"
|
|
||||||
#include "inet_ntop.h"
|
|
||||||
#include "inet_net_pton.h"
|
|
||||||
#include "ares_getopt.h"
|
|
||||||
#include "ares_ipv6.h"
|
|
||||||
|
|
||||||
#ifndef HAVE_STRDUP
|
|
||||||
# include "ares_strdup.h"
|
|
||||||
# define strdup(ptr) ares_strdup(ptr)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef HAVE_STRCASECMP
|
|
||||||
# include "ares_strcasecmp.h"
|
|
||||||
# define strcasecmp(p1,p2) ares_strcasecmp(p1,p2)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef HAVE_STRNCASECMP
|
|
||||||
# include "ares_strcasecmp.h"
|
|
||||||
# define strncasecmp(p1,p2,n) ares_strncasecmp(p1,p2,n)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void callback(void *arg, int status, int timeouts, struct hostent *host);
|
|
||||||
static void usage(void);
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
ares_channel channel;
|
|
||||||
int status, nfds, c, addr_family = AF_INET;
|
|
||||||
fd_set read_fds, write_fds;
|
|
||||||
struct timeval *tvp, tv;
|
|
||||||
struct in_addr addr4;
|
|
||||||
struct in6_addr addr6;
|
|
||||||
|
|
||||||
#ifdef USE_WINSOCK
|
|
||||||
WORD wVersionRequested = MAKEWORD(USE_WINSOCK,USE_WINSOCK);
|
|
||||||
WSADATA wsaData;
|
|
||||||
WSAStartup(wVersionRequested, &wsaData);
|
|
||||||
#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)
|
|
||||||
{
|
|
||||||
switch (c)
|
|
||||||
{
|
|
||||||
case 'd':
|
|
||||||
#ifdef WATT32
|
|
||||||
dbug_init();
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
case 't':
|
|
||||||
if (!strcasecmp(optarg,"a"))
|
|
||||||
addr_family = AF_INET;
|
|
||||||
else if (!strcasecmp(optarg,"aaaa"))
|
|
||||||
addr_family = AF_INET6;
|
|
||||||
else
|
|
||||||
usage();
|
|
||||||
break;
|
|
||||||
case 'h':
|
|
||||||
default:
|
|
||||||
usage();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
argc -= optind;
|
|
||||||
argv += optind;
|
|
||||||
if (argc < 1)
|
|
||||||
usage();
|
|
||||||
|
|
||||||
status = ares_init(&channel);
|
|
||||||
if (status != ARES_SUCCESS)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "ares_init: %s\n", ares_strerror(status));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initiate the queries, one per command-line argument. */
|
|
||||||
for ( ; *argv; argv++)
|
|
||||||
{
|
|
||||||
if (ares_inet_pton(AF_INET, *argv, &addr4) == 1)
|
|
||||||
{
|
|
||||||
ares_gethostbyaddr(channel, &addr4, sizeof(addr4), AF_INET, callback,
|
|
||||||
*argv);
|
|
||||||
}
|
|
||||||
else if (ares_inet_pton(AF_INET6, *argv, &addr6) == 1)
|
|
||||||
{
|
|
||||||
ares_gethostbyaddr(channel, &addr6, sizeof(addr6), AF_INET6, callback,
|
|
||||||
*argv);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ares_gethostbyname(channel, *argv, addr_family, callback, *argv);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Wait for all queries to complete. */
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
FD_ZERO(&read_fds);
|
|
||||||
FD_ZERO(&write_fds);
|
|
||||||
nfds = ares_fds(channel, &read_fds, &write_fds);
|
|
||||||
if (nfds == 0)
|
|
||||||
break;
|
|
||||||
tvp = ares_timeout(channel, NULL, &tv);
|
|
||||||
select(nfds, &read_fds, &write_fds, NULL, tvp);
|
|
||||||
ares_process(channel, &read_fds, &write_fds);
|
|
||||||
}
|
|
||||||
|
|
||||||
ares_destroy(channel);
|
|
||||||
|
|
||||||
ares_library_cleanup();
|
|
||||||
|
|
||||||
#ifdef USE_WINSOCK
|
|
||||||
WSACleanup();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void callback(void *arg, int status, int timeouts, struct hostent *host)
|
|
||||||
{
|
|
||||||
char **p;
|
|
||||||
|
|
||||||
(void)timeouts;
|
|
||||||
|
|
||||||
if (status != ARES_SUCCESS)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "%s: %s\n", (char *) arg, ares_strerror(status));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (p = host->h_addr_list; *p; p++)
|
|
||||||
{
|
|
||||||
char addr_buf[46] = "??";
|
|
||||||
|
|
||||||
ares_inet_ntop(host->h_addrtype, *p, addr_buf, sizeof(addr_buf));
|
|
||||||
printf("%-32s\t%s", host->h_name, addr_buf);
|
|
||||||
#if 0
|
|
||||||
if (host->h_aliases[0])
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
printf (", Aliases: ");
|
|
||||||
for (i = 0; host->h_aliases[i]; i++)
|
|
||||||
printf("%s ", host->h_aliases[i]);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
puts("");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void usage(void)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "usage: ahost [-t {a|aaaa}] {host|addr} ...\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
347
ares/ares.h
347
ares/ares.h
@@ -1,347 +0,0 @@
|
|||||||
/* $Id$ */
|
|
||||||
|
|
||||||
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||||
* Copyright (C) 2007-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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef 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
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
|
|
||||||
#define WIN32
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
|
|
||||||
/* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish
|
|
||||||
libc5-based Linux systems. Only include it on system that are known to
|
|
||||||
require it! */
|
|
||||||
#if defined(_AIX) || defined(__NOVELL_LIBC__) || defined(__NetBSD__) || \
|
|
||||||
defined(__minix) || defined(__SYMBIAN32__) || defined(__INTEGRITY)
|
|
||||||
#include <sys/select.h>
|
|
||||||
#endif
|
|
||||||
#if (defined(NETWARE) && !defined(__NOVELL_LIBC__))
|
|
||||||
#include <sys/bsdskt.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(WATT32)
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <tcp.h>
|
|
||||||
#elif defined(WIN32)
|
|
||||||
# ifndef WIN32_LEAN_AND_MEAN
|
|
||||||
# define WIN32_LEAN_AND_MEAN
|
|
||||||
# endif
|
|
||||||
# include <windows.h>
|
|
||||||
# include <winsock2.h>
|
|
||||||
# include <ws2tcpip.h>
|
|
||||||
#else
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define ARES_SUCCESS 0
|
|
||||||
|
|
||||||
/* Server error codes (ARES_ENODATA indicates no relevant answer) */
|
|
||||||
#define ARES_ENODATA 1
|
|
||||||
#define ARES_EFORMERR 2
|
|
||||||
#define ARES_ESERVFAIL 3
|
|
||||||
#define ARES_ENOTFOUND 4
|
|
||||||
#define ARES_ENOTIMP 5
|
|
||||||
#define ARES_EREFUSED 6
|
|
||||||
|
|
||||||
/* Locally generated error codes */
|
|
||||||
#define ARES_EBADQUERY 7
|
|
||||||
#define ARES_EBADNAME 8
|
|
||||||
#define ARES_EBADFAMILY 9
|
|
||||||
#define ARES_EBADRESP 10
|
|
||||||
#define ARES_ECONNREFUSED 11
|
|
||||||
#define ARES_ETIMEOUT 12
|
|
||||||
#define ARES_EOF 13
|
|
||||||
#define ARES_EFILE 14
|
|
||||||
#define ARES_ENOMEM 15
|
|
||||||
#define ARES_EDESTRUCTION 16
|
|
||||||
#define ARES_EBADSTR 17
|
|
||||||
|
|
||||||
/* ares_getnameinfo error codes */
|
|
||||||
#define ARES_EBADFLAGS 18
|
|
||||||
|
|
||||||
/* ares_getaddrinfo error codes */
|
|
||||||
#define ARES_ENONAME 19
|
|
||||||
#define ARES_EBADHINTS 20
|
|
||||||
|
|
||||||
/* ares_library_init error codes */
|
|
||||||
#define ARES_ELOADIPHLPAPI 21
|
|
||||||
#define ARES_ELOADADVAPI32 22
|
|
||||||
#define ARES_EADDRGetNetworkParams 23
|
|
||||||
|
|
||||||
/* Flag values */
|
|
||||||
#define ARES_FLAG_USEVC (1 << 0)
|
|
||||||
#define ARES_FLAG_PRIMARY (1 << 1)
|
|
||||||
#define ARES_FLAG_IGNTC (1 << 2)
|
|
||||||
#define ARES_FLAG_NORECURSE (1 << 3)
|
|
||||||
#define ARES_FLAG_STAYOPEN (1 << 4)
|
|
||||||
#define ARES_FLAG_NOSEARCH (1 << 5)
|
|
||||||
#define ARES_FLAG_NOALIASES (1 << 6)
|
|
||||||
#define ARES_FLAG_NOCHECKRESP (1 << 7)
|
|
||||||
|
|
||||||
/* Option mask values */
|
|
||||||
#define ARES_OPT_FLAGS (1 << 0)
|
|
||||||
#define ARES_OPT_TIMEOUT (1 << 1)
|
|
||||||
#define ARES_OPT_TRIES (1 << 2)
|
|
||||||
#define ARES_OPT_NDOTS (1 << 3)
|
|
||||||
#define ARES_OPT_UDP_PORT (1 << 4)
|
|
||||||
#define ARES_OPT_TCP_PORT (1 << 5)
|
|
||||||
#define ARES_OPT_SERVERS (1 << 6)
|
|
||||||
#define ARES_OPT_DOMAINS (1 << 7)
|
|
||||||
#define ARES_OPT_LOOKUPS (1 << 8)
|
|
||||||
#define ARES_OPT_SOCK_STATE_CB (1 << 9)
|
|
||||||
#define ARES_OPT_SORTLIST (1 << 10)
|
|
||||||
#define ARES_OPT_SOCK_SNDBUF (1 << 11)
|
|
||||||
#define ARES_OPT_SOCK_RCVBUF (1 << 12)
|
|
||||||
#define ARES_OPT_TIMEOUTMS (1 << 13)
|
|
||||||
#define ARES_OPT_ROTATE (1 << 14)
|
|
||||||
|
|
||||||
/* Nameinfo flag values */
|
|
||||||
#define ARES_NI_NOFQDN (1 << 0)
|
|
||||||
#define ARES_NI_NUMERICHOST (1 << 1)
|
|
||||||
#define ARES_NI_NAMEREQD (1 << 2)
|
|
||||||
#define ARES_NI_NUMERICSERV (1 << 3)
|
|
||||||
#define ARES_NI_DGRAM (1 << 4)
|
|
||||||
#define ARES_NI_TCP 0
|
|
||||||
#define ARES_NI_UDP ARES_NI_DGRAM
|
|
||||||
#define ARES_NI_SCTP (1 << 5)
|
|
||||||
#define ARES_NI_DCCP (1 << 6)
|
|
||||||
#define ARES_NI_NUMERICSCOPE (1 << 7)
|
|
||||||
#define ARES_NI_LOOKUPHOST (1 << 8)
|
|
||||||
#define ARES_NI_LOOKUPSERVICE (1 << 9)
|
|
||||||
/* Reserved for future use */
|
|
||||||
#define ARES_NI_IDN (1 << 10)
|
|
||||||
#define ARES_NI_IDN_ALLOW_UNASSIGNED (1 << 11)
|
|
||||||
#define ARES_NI_IDN_USE_STD3_ASCII_RULES (1 << 12)
|
|
||||||
|
|
||||||
/* Addrinfo flag values */
|
|
||||||
#define ARES_AI_CANONNAME (1 << 0)
|
|
||||||
#define ARES_AI_NUMERICHOST (1 << 1)
|
|
||||||
#define ARES_AI_PASSIVE (1 << 2)
|
|
||||||
#define ARES_AI_NUMERICSERV (1 << 3)
|
|
||||||
#define ARES_AI_V4MAPPED (1 << 4)
|
|
||||||
#define ARES_AI_ALL (1 << 5)
|
|
||||||
#define ARES_AI_ADDRCONFIG (1 << 6)
|
|
||||||
/* Reserved for future use */
|
|
||||||
#define ARES_AI_IDN (1 << 10)
|
|
||||||
#define ARES_AI_IDN_ALLOW_UNASSIGNED (1 << 11)
|
|
||||||
#define ARES_AI_IDN_USE_STD3_ASCII_RULES (1 << 12)
|
|
||||||
#define ARES_AI_CANONIDN (1 << 13)
|
|
||||||
|
|
||||||
#define ARES_AI_MASK (ARES_AI_CANONNAME|ARES_AI_NUMERICHOST|ARES_AI_PASSIVE| \
|
|
||||||
ARES_AI_NUMERICSERV|ARES_AI_V4MAPPED|ARES_AI_ALL| \
|
|
||||||
ARES_AI_ADDRCONFIG)
|
|
||||||
#define ARES_GETSOCK_MAXNUM 16 /* ares_getsock() can return info about this
|
|
||||||
many sockets */
|
|
||||||
#define ARES_GETSOCK_READABLE(bits,num) (bits & (1<< (num)))
|
|
||||||
#define ARES_GETSOCK_WRITABLE(bits,num) (bits & (1 << ((num) + \
|
|
||||||
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
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef ares_socket_typedef
|
|
||||||
#ifdef WIN32
|
|
||||||
typedef SOCKET ares_socket_t;
|
|
||||||
#define ARES_SOCKET_BAD INVALID_SOCKET
|
|
||||||
#else
|
|
||||||
typedef int ares_socket_t;
|
|
||||||
#define ARES_SOCKET_BAD -1
|
|
||||||
#endif
|
|
||||||
#define ares_socket_typedef
|
|
||||||
#endif /* ares_socket_typedef */
|
|
||||||
|
|
||||||
typedef void (*ares_sock_state_cb)(void *data,
|
|
||||||
ares_socket_t socket_fd,
|
|
||||||
int readable,
|
|
||||||
int writable);
|
|
||||||
|
|
||||||
struct apattern;
|
|
||||||
|
|
||||||
/* NOTE about the ares_options struct to users and developers.
|
|
||||||
|
|
||||||
This struct will remain looking like this. It will not be extended nor
|
|
||||||
shrunk in future releases, but all new options will be set by ares_set_*()
|
|
||||||
options instead of with the ares_init_options() function.
|
|
||||||
|
|
||||||
Eventually (in a galaxy far far away), all options will be settable by
|
|
||||||
ares_set_*() options and the ares_init_options() function will become
|
|
||||||
deprecated.
|
|
||||||
|
|
||||||
When new options are added to c-ares, they are not added to this
|
|
||||||
struct. And they are not "saved" with the ares_save_options() function but
|
|
||||||
instead we encourage the use of the ares_dup() function. Needless to say,
|
|
||||||
if you add config options to c-ares you need to make sure ares_dup()
|
|
||||||
duplicates this new option.
|
|
||||||
|
|
||||||
*/
|
|
||||||
struct ares_options {
|
|
||||||
int flags;
|
|
||||||
int timeout; /* in seconds or milliseconds, depending on options */
|
|
||||||
int tries;
|
|
||||||
int ndots;
|
|
||||||
unsigned short udp_port;
|
|
||||||
unsigned short tcp_port;
|
|
||||||
int socket_send_buffer_size;
|
|
||||||
int socket_receive_buffer_size;
|
|
||||||
struct in_addr *servers;
|
|
||||||
int nservers;
|
|
||||||
char **domains;
|
|
||||||
int ndomains;
|
|
||||||
char *lookups;
|
|
||||||
ares_sock_state_cb sock_state_cb;
|
|
||||||
void *sock_state_cb_data;
|
|
||||||
struct apattern *sortlist;
|
|
||||||
int nsort;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct hostent;
|
|
||||||
struct timeval;
|
|
||||||
struct sockaddr;
|
|
||||||
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_library_init(int flags);
|
|
||||||
void ares_library_cleanup(void);
|
|
||||||
const char *ares_version(int *version);
|
|
||||||
|
|
||||||
int ares_init(ares_channel *channelptr);
|
|
||||||
int ares_init_options(ares_channel *channelptr, struct ares_options *options,
|
|
||||||
int optmask);
|
|
||||||
int ares_save_options(ares_channel channel, struct ares_options *options,
|
|
||||||
int *optmask);
|
|
||||||
void ares_destroy_options(struct ares_options *options);
|
|
||||||
int ares_dup(ares_channel *dest, ares_channel src);
|
|
||||||
void ares_destroy(ares_channel channel);
|
|
||||||
void ares_cancel(ares_channel channel);
|
|
||||||
void ares_set_socket_callback(ares_channel channel,
|
|
||||||
ares_sock_create_callback callback,
|
|
||||||
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,
|
|
||||||
ares_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,
|
|
||||||
int rd, unsigned char **buf, int *buflen);
|
|
||||||
int ares_expand_name(const unsigned char *encoded, const unsigned char *abuf,
|
|
||||||
int alen, char **s, long *enclen);
|
|
||||||
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
|
|
||||||
* struct below when ares itself was built, but many apps would use this
|
|
||||||
* private version since the header checked a HAVE_* define for it. Starting
|
|
||||||
* with 1.6.1 we always declare and use our own to stop relying on the
|
|
||||||
* system's one.
|
|
||||||
*/
|
|
||||||
struct ares_in6_addr {
|
|
||||||
union {
|
|
||||||
unsigned char _S6_u8[16];
|
|
||||||
} _S6_un;
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* TODO: the structs 'addrttl' and 'addr6ttl' really should get their names
|
|
||||||
* prefixed with ares_ to keep them in our own "name space".
|
|
||||||
*/
|
|
||||||
struct addrttl {
|
|
||||||
struct in_addr ipaddr;
|
|
||||||
int ttl;
|
|
||||||
};
|
|
||||||
struct addr6ttl {
|
|
||||||
struct ares_in6_addr ip6addr;
|
|
||||||
int ttl;
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
** 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.
|
|
||||||
** Also, if addrttls is nonnull, put up to *naddrttls IPv4 addresses along with
|
|
||||||
** their TTLs in that array, and set *naddrttls to the number of addresses
|
|
||||||
** so written.
|
|
||||||
*/
|
|
||||||
int ares_parse_a_reply(const unsigned char *abuf, int alen,
|
|
||||||
struct hostent **host,
|
|
||||||
struct addrttl *addrttls, int *naddrttls);
|
|
||||||
int ares_parse_aaaa_reply(const unsigned char *abuf, int alen,
|
|
||||||
struct hostent **host,
|
|
||||||
struct addr6ttl *addrttls, int *naddrttls);
|
|
||||||
int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr,
|
|
||||||
int addrlen, int family, struct hostent **host);
|
|
||||||
int ares_parse_ns_reply(const unsigned char *abuf, int alen,
|
|
||||||
struct hostent **host);
|
|
||||||
void ares_free_string(void *str);
|
|
||||||
void ares_free_hostent(struct hostent *host);
|
|
||||||
const char *ares_strerror(int code);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* ARES__H */
|
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
/* $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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "setup.h"
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#ifdef HAVE_UNISTD_H
|
|
||||||
#include <unistd.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "ares.h"
|
|
||||||
#include "ares_private.h"
|
|
||||||
|
|
||||||
void ares__close_sockets(ares_channel channel, struct server_state *server)
|
|
||||||
{
|
|
||||||
struct send_request *sendreq;
|
|
||||||
|
|
||||||
/* Free all pending output buffers. */
|
|
||||||
while (server->qhead)
|
|
||||||
{
|
|
||||||
/* Advance server->qhead; pull out query as we go. */
|
|
||||||
sendreq = server->qhead;
|
|
||||||
server->qhead = sendreq->next;
|
|
||||||
if (sendreq->data_storage != NULL)
|
|
||||||
free(sendreq->data_storage);
|
|
||||||
free(sendreq);
|
|
||||||
}
|
|
||||||
server->qtail = NULL;
|
|
||||||
|
|
||||||
/* Reset any existing input buffer. */
|
|
||||||
if (server->tcp_buffer)
|
|
||||||
free(server->tcp_buffer);
|
|
||||||
server->tcp_buffer = NULL;
|
|
||||||
server->tcp_lenbuf_pos = 0;
|
|
||||||
|
|
||||||
/* Reset brokenness */
|
|
||||||
server->is_broken = 0;
|
|
||||||
|
|
||||||
/* Close the TCP and UDP sockets. */
|
|
||||||
if (server->tcp_socket != ARES_SOCKET_BAD)
|
|
||||||
{
|
|
||||||
SOCK_STATE_CALLBACK(channel, server->tcp_socket, 0, 0);
|
|
||||||
closesocket(server->tcp_socket);
|
|
||||||
server->tcp_socket = ARES_SOCKET_BAD;
|
|
||||||
server->tcp_connection_generation = ++channel->tcp_connection_generation;
|
|
||||||
}
|
|
||||||
if (server->udp_socket != ARES_SOCKET_BAD)
|
|
||||||
{
|
|
||||||
SOCK_STATE_CALLBACK(channel, server->udp_socket, 0, 0);
|
|
||||||
closesocket(server->udp_socket);
|
|
||||||
server->udp_socket = ARES_SOCKET_BAD;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,203 +0,0 @@
|
|||||||
/* $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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "setup.h"
|
|
||||||
|
|
||||||
#if !defined(WIN32) || defined(WATT32)
|
|
||||||
#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
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <ctype.h>
|
|
||||||
|
|
||||||
#include "ares.h"
|
|
||||||
#include "inet_net_pton.h"
|
|
||||||
#include "ares_private.h"
|
|
||||||
|
|
||||||
int ares__get_hostent(FILE *fp, int family, struct hostent **host)
|
|
||||||
{
|
|
||||||
char *line = NULL, *p, *q, *canonical, **alias;
|
|
||||||
int status, linesize, end_at_hostname, naliases;
|
|
||||||
struct in_addr addr;
|
|
||||||
struct in6_addr addr6;
|
|
||||||
size_t addrlen = sizeof(struct in_addr);
|
|
||||||
struct hostent *hostent = NULL;
|
|
||||||
|
|
||||||
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. */
|
|
||||||
p = line;
|
|
||||||
while (*p && !ISSPACE(*p))
|
|
||||||
p++;
|
|
||||||
if (!*p)
|
|
||||||
continue;
|
|
||||||
*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;
|
|
||||||
|
|
||||||
/* Get the canonical hostname. */
|
|
||||||
p++;
|
|
||||||
while (ISSPACE(*p))
|
|
||||||
p++;
|
|
||||||
if (!*p)
|
|
||||||
continue;
|
|
||||||
q = p;
|
|
||||||
while (*q && !ISSPACE(*q))
|
|
||||||
q++;
|
|
||||||
end_at_hostname = (*q == 0);
|
|
||||||
*q = 0;
|
|
||||||
canonical = p;
|
|
||||||
|
|
||||||
naliases = 0;
|
|
||||||
if (!end_at_hostname)
|
|
||||||
{
|
|
||||||
/* Count the aliases. */
|
|
||||||
p = q + 1;
|
|
||||||
while (ISSPACE(*p))
|
|
||||||
p++;
|
|
||||||
while (*p)
|
|
||||||
{
|
|
||||||
while (*p && !ISSPACE(*p))
|
|
||||||
p++;
|
|
||||||
while (ISSPACE(*p))
|
|
||||||
p++;
|
|
||||||
naliases++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Allocate memory for the host structure. */
|
|
||||||
hostent = malloc(sizeof(struct hostent));
|
|
||||||
if (!hostent)
|
|
||||||
break;
|
|
||||||
hostent->h_aliases = NULL;
|
|
||||||
hostent->h_addr_list = NULL;
|
|
||||||
hostent->h_name = strdup(canonical);
|
|
||||||
if (!hostent->h_name)
|
|
||||||
break;
|
|
||||||
hostent->h_addr_list = malloc(2 * sizeof(char *));
|
|
||||||
if (!hostent->h_addr_list)
|
|
||||||
break;
|
|
||||||
hostent->h_addr_list[0] = malloc(addrlen);
|
|
||||||
if (!hostent->h_addr_list[0])
|
|
||||||
break;
|
|
||||||
hostent->h_aliases = malloc((naliases + 1) * sizeof(char *));
|
|
||||||
if (!hostent->h_aliases)
|
|
||||||
break;
|
|
||||||
|
|
||||||
/* Copy in aliases. */
|
|
||||||
naliases = 0;
|
|
||||||
if (!end_at_hostname)
|
|
||||||
{
|
|
||||||
p = canonical + strlen(canonical) + 1;
|
|
||||||
while (ISSPACE(*p))
|
|
||||||
p++;
|
|
||||||
while (*p)
|
|
||||||
{
|
|
||||||
q = p;
|
|
||||||
while (*q && !ISSPACE(*q))
|
|
||||||
q++;
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
hostent->h_aliases[naliases] = NULL;
|
|
||||||
|
|
||||||
hostent->h_addrtype = family;
|
|
||||||
hostent->h_length = (int)addrlen;
|
|
||||||
if (family == AF_INET)
|
|
||||||
memcpy(hostent->h_addr_list[0], &addr, addrlen);
|
|
||||||
else if (family == AF_INET6)
|
|
||||||
memcpy(hostent->h_addr_list[0], &addr6, addrlen);
|
|
||||||
hostent->h_addr_list[1] = NULL;
|
|
||||||
*host = hostent;
|
|
||||||
free(line);
|
|
||||||
return ARES_SUCCESS;
|
|
||||||
}
|
|
||||||
if(line)
|
|
||||||
free(line);
|
|
||||||
|
|
||||||
if (status == ARES_SUCCESS)
|
|
||||||
{
|
|
||||||
/* Memory allocation failure; clean up. */
|
|
||||||
if (hostent)
|
|
||||||
{
|
|
||||||
if(hostent->h_name)
|
|
||||||
free((char *) hostent->h_name);
|
|
||||||
if (hostent->h_aliases)
|
|
||||||
{
|
|
||||||
for (alias = hostent->h_aliases; *alias; alias++)
|
|
||||||
free(*alias);
|
|
||||||
}
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
*host = NULL;
|
|
||||||
return ARES_ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
/* $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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "setup.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include "ares.h"
|
|
||||||
#include "ares_private.h"
|
|
||||||
|
|
||||||
/* This is an internal function. Its contract is to read a line from
|
|
||||||
* a file into a dynamically allocated buffer, zeroing the trailing
|
|
||||||
* newline if there is one. The calling routine may call
|
|
||||||
* ares__read_line multiple times with the same buf and bufsize
|
|
||||||
* pointers; *buf will be reallocated and *bufsize adjusted as
|
|
||||||
* appropriate. The initial value of *buf should be NULL. After the
|
|
||||||
* calling routine is done reading lines, it should free *buf.
|
|
||||||
*/
|
|
||||||
int ares__read_line(FILE *fp, char **buf, int *bufsize)
|
|
||||||
{
|
|
||||||
char *newbuf;
|
|
||||||
size_t offset = 0;
|
|
||||||
size_t len;
|
|
||||||
|
|
||||||
if (*buf == NULL)
|
|
||||||
{
|
|
||||||
*buf = malloc(128);
|
|
||||||
if (!*buf)
|
|
||||||
return ARES_ENOMEM;
|
|
||||||
*bufsize = 128;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
if (!fgets(*buf + offset, *bufsize - (int)offset, fp))
|
|
||||||
return (offset != 0) ? 0 : (ferror(fp)) ? ARES_EFILE : ARES_EOF;
|
|
||||||
len = offset + strlen(*buf + offset);
|
|
||||||
if ((*buf)[len - 1] == '\n')
|
|
||||||
{
|
|
||||||
(*buf)[len - 1] = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
offset = len;
|
|
||||||
|
|
||||||
/* Allocate more space. */
|
|
||||||
newbuf = realloc(*buf, *bufsize * 2);
|
|
||||||
if (!newbuf)
|
|
||||||
return ARES_ENOMEM;
|
|
||||||
*buf = newbuf;
|
|
||||||
*bufsize *= 2;
|
|
||||||
}
|
|
||||||
return ARES_SUCCESS;
|
|
||||||
}
|
|
||||||
@@ -1,112 +0,0 @@
|
|||||||
/* $Id$ */
|
|
||||||
|
|
||||||
/* Copyright (C) 2008 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "setup.h"
|
|
||||||
#include "ares.h"
|
|
||||||
#include "ares_private.h"
|
|
||||||
|
|
||||||
#if defined(WIN32) && !defined(MSDOS)
|
|
||||||
|
|
||||||
struct timeval ares__tvnow(void)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
** GetTickCount() is available on _all_ Windows versions from W95 up
|
|
||||||
** to nowadays. Returns milliseconds elapsed since last system boot,
|
|
||||||
** increases monotonically and wraps once 49.7 days have elapsed.
|
|
||||||
*/
|
|
||||||
struct timeval now;
|
|
||||||
DWORD milliseconds = GetTickCount();
|
|
||||||
now.tv_sec = milliseconds / 1000;
|
|
||||||
now.tv_usec = (milliseconds % 1000) * 1000;
|
|
||||||
return now;
|
|
||||||
}
|
|
||||||
|
|
||||||
#elif defined(HAVE_CLOCK_GETTIME_MONOTONIC)
|
|
||||||
|
|
||||||
struct timeval ares__tvnow(void)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
** clock_gettime() is granted to be increased monotonically when the
|
|
||||||
** monotonic clock is queried. Time starting point is unspecified, it
|
|
||||||
** could be the system start-up time, the Epoch, or something else,
|
|
||||||
** in any case the time starting point does not change once that the
|
|
||||||
** system has started up.
|
|
||||||
*/
|
|
||||||
struct timeval now;
|
|
||||||
struct timespec tsnow;
|
|
||||||
if(0 == clock_gettime(CLOCK_MONOTONIC, &tsnow)) {
|
|
||||||
now.tv_sec = tsnow.tv_sec;
|
|
||||||
now.tv_usec = tsnow.tv_nsec / 1000;
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
** Even when the configure process has truly detected monotonic clock
|
|
||||||
** availability, it might happen that it is not actually available at
|
|
||||||
** run-time. When this occurs simply fallback to other time source.
|
|
||||||
*/
|
|
||||||
#ifdef HAVE_GETTIMEOFDAY
|
|
||||||
else
|
|
||||||
(void)gettimeofday(&now, NULL);
|
|
||||||
#else
|
|
||||||
else {
|
|
||||||
now.tv_sec = (long)time(NULL);
|
|
||||||
now.tv_usec = 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return now;
|
|
||||||
}
|
|
||||||
|
|
||||||
#elif defined(HAVE_GETTIMEOFDAY)
|
|
||||||
|
|
||||||
struct timeval ares__tvnow(void)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
** gettimeofday() is not granted to be increased monotonically, due to
|
|
||||||
** clock drifting and external source time synchronization it can jump
|
|
||||||
** forward or backward in time.
|
|
||||||
*/
|
|
||||||
struct timeval now;
|
|
||||||
(void)gettimeofday(&now, NULL);
|
|
||||||
return now;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
struct timeval ares__tvnow(void)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
** time() returns the value of time in seconds since the Epoch.
|
|
||||||
*/
|
|
||||||
struct timeval now;
|
|
||||||
now.tv_sec = (long)time(NULL);
|
|
||||||
now.tv_usec = 0;
|
|
||||||
return now;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0 /* Not used */
|
|
||||||
/*
|
|
||||||
* Make sure that the first argument is the more recent time, as otherwise
|
|
||||||
* we'll get a weird negative time-diff back...
|
|
||||||
*
|
|
||||||
* Returns: the time difference in number of milliseconds.
|
|
||||||
*/
|
|
||||||
long ares__tvdiff(struct timeval newer, struct timeval older)
|
|
||||||
{
|
|
||||||
return (newer.tv_sec-older.tv_sec)*1000+
|
|
||||||
(newer.tv_usec-older.tv_usec)/1000;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
@@ -1,253 +0,0 @@
|
|||||||
#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 */
|
|
||||||
@@ -1,111 +0,0 @@
|
|||||||
#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 */
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
.\" $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.
|
|
||||||
.\"
|
|
||||||
.TH ARES_CANCEL 3 "31 March 2004"
|
|
||||||
.SH NAME
|
|
||||||
ares_cancel \- Cancel a resolve
|
|
||||||
.SH SYNOPSIS
|
|
||||||
.nf
|
|
||||||
.B #include <ares.h>
|
|
||||||
.PP
|
|
||||||
.B int ares_cancel(ares_channel \fIchannel\fP)
|
|
||||||
.fi
|
|
||||||
.SH DESCRIPTION
|
|
||||||
The \fBares_cancel\fP function cancels all lookups/requests made on the the
|
|
||||||
name service channel identified by \fIchannel\fP. \fBares_cancel\fP invokes
|
|
||||||
the callbacks for each pending query on the channel, passing a status of
|
|
||||||
.BR ARES_ETIMEOUT .
|
|
||||||
These calls give the callbacks a chance to clean up any state which
|
|
||||||
might have been stored in their arguments.
|
|
||||||
.SH SEE ALSO
|
|
||||||
.BR ares_init (3)
|
|
||||||
.BR ares_destroy (3)
|
|
||||||
.SH NOTES
|
|
||||||
This function was added in c-ares 1.2.0
|
|
||||||
.SH AUTHOR
|
|
||||||
Dirk Manske
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
/* $Id$ */
|
|
||||||
|
|
||||||
/* Copyright (C) 2004 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "setup.h"
|
|
||||||
#include <assert.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include "ares.h"
|
|
||||||
#include "ares_private.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
* ares_cancel() cancels all ongoing requests/resolves that might be going on
|
|
||||||
* on the given channel. It does NOT kill the channel, use ares_destroy() for
|
|
||||||
* that.
|
|
||||||
*/
|
|
||||||
void ares_cancel(ares_channel channel)
|
|
||||||
{
|
|
||||||
struct query *query;
|
|
||||||
struct list_node* list_head;
|
|
||||||
struct list_node* list_node;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
list_head = &(channel->all_queries);
|
|
||||||
for (list_node = list_head->next; list_node != list_head; )
|
|
||||||
{
|
|
||||||
query = list_node->data;
|
|
||||||
list_node = list_node->next; /* since we're deleting the query */
|
|
||||||
query->callback(query->arg, ARES_ETIMEOUT, 0, NULL, 0);
|
|
||||||
ares__free_query(query);
|
|
||||||
}
|
|
||||||
#ifndef NDEBUG
|
|
||||||
/* Freeing the query should remove it from all the lists in which it sits,
|
|
||||||
* so all query lists should be empty now.
|
|
||||||
*/
|
|
||||||
assert(ares__is_list_empty(&(channel->all_queries)));
|
|
||||||
for (i = 0; i < ARES_QID_TABLE_SIZE; i++)
|
|
||||||
{
|
|
||||||
assert(ares__is_list_empty(&(channel->queries_by_qid[i])));
|
|
||||||
}
|
|
||||||
for (i = 0; i < ARES_TIMEOUT_TABLE_SIZE; i++)
|
|
||||||
{
|
|
||||||
assert(ares__is_list_empty(&(channel->queries_by_timeout[i])));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (!(channel->flags & ARES_FLAG_STAYOPEN))
|
|
||||||
{
|
|
||||||
if (channel->servers)
|
|
||||||
{
|
|
||||||
for (i = 0; i < channel->nservers; i++)
|
|
||||||
ares__close_sockets(channel, &channel->servers[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
.\" $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.
|
|
||||||
.\"
|
|
||||||
.TH ARES_DESTROY 3 "7 December 2004"
|
|
||||||
.SH NAME
|
|
||||||
ares_destroy \- Destroy a resolver channel
|
|
||||||
.SH SYNOPSIS
|
|
||||||
.nf
|
|
||||||
.B #include <ares.h>
|
|
||||||
.PP
|
|
||||||
.B void ares_destroy(ares_channel \fIchannel\fP)
|
|
||||||
.fi
|
|
||||||
.SH DESCRIPTION
|
|
||||||
The
|
|
||||||
.B ares_destroy
|
|
||||||
function destroys the name service channel identified by
|
|
||||||
.IR channel ,
|
|
||||||
freeing all memory and closing all sockets used by the channel.
|
|
||||||
.B ares_destroy
|
|
||||||
invokes the callbacks for each pending query on the channel, passing a
|
|
||||||
status of
|
|
||||||
.BR ARES_EDESTRUCTION .
|
|
||||||
These calls give the callbacks a chance to clean up any state which
|
|
||||||
might have been stored in their arguments.
|
|
||||||
.SH SEE ALSO
|
|
||||||
.BR ares_init (3),
|
|
||||||
.BR ares_cancel (3)
|
|
||||||
.SH AUTHOR
|
|
||||||
Greg Hudson, MIT Information Systems
|
|
||||||
.br
|
|
||||||
Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||||
@@ -1,93 +0,0 @@
|
|||||||
/* $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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "setup.h"
|
|
||||||
#include <assert.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include "ares.h"
|
|
||||||
#include "ares_private.h"
|
|
||||||
|
|
||||||
void ares_destroy_options(struct ares_options *options)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
free(options->servers);
|
|
||||||
for (i = 0; i < options->ndomains; i++)
|
|
||||||
free(options->domains[i]);
|
|
||||||
free(options->domains);
|
|
||||||
if(options->sortlist)
|
|
||||||
free(options->sortlist);
|
|
||||||
free(options->lookups);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ares_destroy(ares_channel channel)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
struct query *query;
|
|
||||||
struct list_node* list_head;
|
|
||||||
struct list_node* list_node;
|
|
||||||
|
|
||||||
if (!channel)
|
|
||||||
return;
|
|
||||||
|
|
||||||
list_head = &(channel->all_queries);
|
|
||||||
for (list_node = list_head->next; list_node != list_head; )
|
|
||||||
{
|
|
||||||
query = list_node->data;
|
|
||||||
list_node = list_node->next; /* since we're deleting the query */
|
|
||||||
query->callback(query->arg, ARES_EDESTRUCTION, 0, NULL, 0);
|
|
||||||
ares__free_query(query);
|
|
||||||
}
|
|
||||||
#ifndef NDEBUG
|
|
||||||
/* Freeing the query should remove it from all the lists in which it sits,
|
|
||||||
* so all query lists should be empty now.
|
|
||||||
*/
|
|
||||||
assert(ares__is_list_empty(&(channel->all_queries)));
|
|
||||||
for (i = 0; i < ARES_QID_TABLE_SIZE; i++)
|
|
||||||
{
|
|
||||||
assert(ares__is_list_empty(&(channel->queries_by_qid[i])));
|
|
||||||
}
|
|
||||||
for (i = 0; i < ARES_TIMEOUT_TABLE_SIZE; i++)
|
|
||||||
{
|
|
||||||
assert(ares__is_list_empty(&(channel->queries_by_timeout[i])));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (channel->servers) {
|
|
||||||
for (i = 0; i < channel->nservers; i++)
|
|
||||||
{
|
|
||||||
struct server_state *server = &channel->servers[i];
|
|
||||||
ares__close_sockets(channel, server);
|
|
||||||
assert(ares__is_list_empty(&(server->queries_to_server)));
|
|
||||||
}
|
|
||||||
free(channel->servers);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (channel->domains) {
|
|
||||||
for (i = 0; i < channel->ndomains; i++)
|
|
||||||
free(channel->domains[i]);
|
|
||||||
free(channel->domains);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(channel->sortlist)
|
|
||||||
free(channel->sortlist);
|
|
||||||
|
|
||||||
if (channel->lookups)
|
|
||||||
free(channel->lookups);
|
|
||||||
|
|
||||||
free(channel);
|
|
||||||
}
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
.\" $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.
|
|
||||||
.\"
|
|
||||||
.TH ARES_DESTROY_OPTIONS 3 "1 June 2007"
|
|
||||||
.SH NAME
|
|
||||||
ares_destroy_options \- Destroy options initialized with ares_save_options
|
|
||||||
.SH SYNOPSIS
|
|
||||||
.nf
|
|
||||||
.B #include <ares.h>
|
|
||||||
.PP
|
|
||||||
.B void ares_destroy_options(struct ares_options *\fIoptions\fP)
|
|
||||||
.fi
|
|
||||||
.SH DESCRIPTION
|
|
||||||
The
|
|
||||||
.B ares_destroy_options
|
|
||||||
function destroys the options struct identified by
|
|
||||||
.IR options ,
|
|
||||||
freeing all memory allocated by ares_save_options.
|
|
||||||
|
|
||||||
.SH SEE ALSO
|
|
||||||
.BR ares_save_options (3),
|
|
||||||
.BR ares_init_options (3)
|
|
||||||
.SH AUTHOR
|
|
||||||
Brad House
|
|
||||||
.br
|
|
||||||
Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||||
@@ -1,91 +0,0 @@
|
|||||||
/* $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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef ARES__DNS_H
|
|
||||||
#define ARES__DNS_H
|
|
||||||
|
|
||||||
#define DNS__16BIT(p) (((p)[0] << 8) | (p)[1])
|
|
||||||
#define DNS__32BIT(p) (((p)[0] << 24) | ((p)[1] << 16) | \
|
|
||||||
((p)[2] << 8) | (p)[3])
|
|
||||||
|
|
||||||
#define DNS__SET16BIT(p, v) (((p)[0] = (unsigned char)(((v) >> 8) & 0xff)), \
|
|
||||||
((p)[1] = (unsigned char)((v) & 0xff)))
|
|
||||||
#define DNS__SET32BIT(p, v) (((p)[0] = (unsigned char)(((v) >> 24) & 0xff)), \
|
|
||||||
((p)[1] = (unsigned char)(((v) >> 16) & 0xff)), \
|
|
||||||
((p)[2] = (unsigned char)(((v) >> 8) & 0xff)), \
|
|
||||||
((p)[3] = (unsigned char)((v) & 0xff)))
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* we cannot use this approach on systems where we can't access 16/32 bit
|
|
||||||
data on un-aligned addresses */
|
|
||||||
#define DNS__16BIT(p) ntohs(*(unsigned short*)(p))
|
|
||||||
#define DNS__32BIT(p) ntohl(*(unsigned long*)(p))
|
|
||||||
#define DNS__SET16BIT(p, v) *(unsigned short*)(p) = htons(v)
|
|
||||||
#define DNS__SET32BIT(p, v) *(unsigned long*)(p) = htonl(v)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Macros for parsing a DNS header */
|
|
||||||
#define DNS_HEADER_QID(h) DNS__16BIT(h)
|
|
||||||
#define DNS_HEADER_QR(h) (((h)[2] >> 7) & 0x1)
|
|
||||||
#define DNS_HEADER_OPCODE(h) (((h)[2] >> 3) & 0xf)
|
|
||||||
#define DNS_HEADER_AA(h) (((h)[2] >> 2) & 0x1)
|
|
||||||
#define DNS_HEADER_TC(h) (((h)[2] >> 1) & 0x1)
|
|
||||||
#define DNS_HEADER_RD(h) ((h)[2] & 0x1)
|
|
||||||
#define DNS_HEADER_RA(h) (((h)[3] >> 7) & 0x1)
|
|
||||||
#define DNS_HEADER_Z(h) (((h)[3] >> 4) & 0x7)
|
|
||||||
#define DNS_HEADER_RCODE(h) ((h)[3] & 0xf)
|
|
||||||
#define DNS_HEADER_QDCOUNT(h) DNS__16BIT((h) + 4)
|
|
||||||
#define DNS_HEADER_ANCOUNT(h) DNS__16BIT((h) + 6)
|
|
||||||
#define DNS_HEADER_NSCOUNT(h) DNS__16BIT((h) + 8)
|
|
||||||
#define DNS_HEADER_ARCOUNT(h) DNS__16BIT((h) + 10)
|
|
||||||
|
|
||||||
/* Macros for constructing a DNS header */
|
|
||||||
#define DNS_HEADER_SET_QID(h, v) DNS__SET16BIT(h, v)
|
|
||||||
#define DNS_HEADER_SET_QR(h, v) ((h)[2] |= (unsigned char)(((v) & 0x1) << 7))
|
|
||||||
#define DNS_HEADER_SET_OPCODE(h, v) ((h)[2] |= (unsigned char)(((v) & 0xf) << 3))
|
|
||||||
#define DNS_HEADER_SET_AA(h, v) ((h)[2] |= (unsigned char)(((v) & 0x1) << 2))
|
|
||||||
#define DNS_HEADER_SET_TC(h, v) ((h)[2] |= (unsigned char)(((v) & 0x1) << 1))
|
|
||||||
#define DNS_HEADER_SET_RD(h, v) ((h)[2] |= (unsigned char)((v) & 0x1))
|
|
||||||
#define DNS_HEADER_SET_RA(h, v) ((h)[3] |= (unsigned char)(((v) & 0x1) << 7))
|
|
||||||
#define DNS_HEADER_SET_Z(h, v) ((h)[3] |= (unsigned char)(((v) & 0x7) << 4))
|
|
||||||
#define DNS_HEADER_SET_RCODE(h, v) ((h)[3] |= (unsigned char)((v) & 0xf))
|
|
||||||
#define DNS_HEADER_SET_QDCOUNT(h, v) DNS__SET16BIT((h) + 4, v)
|
|
||||||
#define DNS_HEADER_SET_ANCOUNT(h, v) DNS__SET16BIT((h) + 6, v)
|
|
||||||
#define DNS_HEADER_SET_NSCOUNT(h, v) DNS__SET16BIT((h) + 8, v)
|
|
||||||
#define DNS_HEADER_SET_ARCOUNT(h, v) DNS__SET16BIT((h) + 10, v)
|
|
||||||
|
|
||||||
/* Macros for parsing the fixed part of a DNS question */
|
|
||||||
#define DNS_QUESTION_TYPE(q) DNS__16BIT(q)
|
|
||||||
#define DNS_QUESTION_CLASS(q) DNS__16BIT((q) + 2)
|
|
||||||
|
|
||||||
/* Macros for constructing the fixed part of a DNS question */
|
|
||||||
#define DNS_QUESTION_SET_TYPE(q, v) DNS__SET16BIT(q, v)
|
|
||||||
#define DNS_QUESTION_SET_CLASS(q, v) DNS__SET16BIT((q) + 2, v)
|
|
||||||
|
|
||||||
/* Macros for parsing the fixed part of a DNS resource record */
|
|
||||||
#define DNS_RR_TYPE(r) DNS__16BIT(r)
|
|
||||||
#define DNS_RR_CLASS(r) DNS__16BIT((r) + 2)
|
|
||||||
#define DNS_RR_TTL(r) DNS__32BIT((r) + 4)
|
|
||||||
#define DNS_RR_LEN(r) DNS__16BIT((r) + 8)
|
|
||||||
|
|
||||||
/* Macros for constructing the fixed part of a DNS resource record */
|
|
||||||
#define DNS_RR_SET_TYPE(r) DNS__SET16BIT(r, v)
|
|
||||||
#define DNS_RR_SET_CLASS(r) DNS__SET16BIT((r) + 2, v)
|
|
||||||
#define DNS_RR_SET_TTL(r) DNS__SET32BIT((r) + 4, v)
|
|
||||||
#define DNS_RR_SET_LEN(r) DNS__SET16BIT((r) + 8, v)
|
|
||||||
|
|
||||||
#endif /* ARES__DNS_H */
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
.\" $Id$
|
|
||||||
.\"
|
|
||||||
.\" Copyright (C) 2007-2008 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_DUP 3 "2 Dec 2008"
|
|
||||||
.SH NAME
|
|
||||||
ares_dup \- Duplicate a resolver channel
|
|
||||||
.SH SYNOPSIS
|
|
||||||
.nf
|
|
||||||
.B #include <ares.h>
|
|
||||||
.PP
|
|
||||||
.B int ares_dup(ares_channel *\fIchannel\fP, ares_channel \fIsource\fP)
|
|
||||||
.fi
|
|
||||||
.SH DESCRIPTION
|
|
||||||
The \fBares_dup(3)\fP function duplicates an existing communications channel
|
|
||||||
for name service lookups. If it returns successfully, \fBares_dup(3)\fP will
|
|
||||||
set the variable pointed to by \fIchannel\fP to a handle used to identify the
|
|
||||||
name service channel. The caller should invoke \fIares_destroy(3)\fP on the
|
|
||||||
handle when the channel is no longer needed.
|
|
||||||
|
|
||||||
The \fBares_dup_options\fP function also initializes a name service channel,
|
|
||||||
with additional options set exactly as the \fIsource\fP channel has them
|
|
||||||
configured.
|
|
||||||
.SH SEE ALSO
|
|
||||||
.BR ares_destroy(3),
|
|
||||||
.BR ares_init(3)
|
|
||||||
.SH AVAILABILITY
|
|
||||||
ares_dup(3) was added in c-ares 1.6.0
|
|
||||||
.SH AUTHOR
|
|
||||||
Daniel Stenberg
|
|
||||||
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
.\" $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.
|
|
||||||
.\"
|
|
||||||
.TH ARES_EXPAND_NAME 3 "23 July 1998"
|
|
||||||
.SH NAME
|
|
||||||
ares_expand_name \- Expand a DNS-encoded domain name
|
|
||||||
.SH SYNOPSIS
|
|
||||||
.nf
|
|
||||||
.B #include <ares.h>
|
|
||||||
.PP
|
|
||||||
.B int ares_expand_name(const unsigned char *\fIencoded\fP,
|
|
||||||
.B const unsigned char *\fIabuf\fP, int \fIalen\fP, char **\fIs\fP,
|
|
||||||
.B int *\fIenclen\fP)
|
|
||||||
.fi
|
|
||||||
.SH DESCRIPTION
|
|
||||||
The
|
|
||||||
.B ares_expand_name
|
|
||||||
function converts a DNS-encoded domain name to a dot-separated C
|
|
||||||
string. The argument
|
|
||||||
.I encoded
|
|
||||||
gives the beginning of the encoded domain name, and the arguments
|
|
||||||
.I abuf
|
|
||||||
and
|
|
||||||
.I alen
|
|
||||||
give the containing message buffer (necessary for the processing of
|
|
||||||
indirection pointers within the encoded domain name). The result is
|
|
||||||
placed in a NUL-terminated allocated buffer, a pointer to which is
|
|
||||||
stored in the variable pointed to by
|
|
||||||
.IR s .
|
|
||||||
The length of the encoded name is stored in the variable pointed to by
|
|
||||||
.I enclen
|
|
||||||
so that the caller can advance past the encoded domain name to read
|
|
||||||
further data in the message.
|
|
||||||
.SH RETURN VALUES
|
|
||||||
.B ares_expand_name
|
|
||||||
can return any of the following values:
|
|
||||||
.TP 15
|
|
||||||
.B ARES_SUCCESS
|
|
||||||
Expansion of the encoded name succeeded.
|
|
||||||
.TP 15
|
|
||||||
.B ARES_EBADNAME
|
|
||||||
The encoded domain name was malformed and could not be expanded.
|
|
||||||
.TP 15
|
|
||||||
.B ARES_ENOMEM
|
|
||||||
Memory was exhausted.
|
|
||||||
.SH SEE ALSO
|
|
||||||
.BR ares_mkquery (3)
|
|
||||||
.SH AUTHOR
|
|
||||||
Greg Hudson, MIT Information Systems
|
|
||||||
.br
|
|
||||||
Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||||
@@ -1,190 +0,0 @@
|
|||||||
/* $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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "setup.h"
|
|
||||||
|
|
||||||
#ifdef HAVE_SYS_SOCKET_H
|
|
||||||
# include <sys/socket.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_NETINET_IN_H
|
|
||||||
# include <netinet/in.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 "ares.h"
|
|
||||||
#include "ares_private.h" /* for the memdebug */
|
|
||||||
|
|
||||||
static int name_length(const unsigned char *encoded, const unsigned char *abuf,
|
|
||||||
int alen);
|
|
||||||
|
|
||||||
/* Expand an RFC1035-encoded domain name given by encoded. The
|
|
||||||
* containing message is given by abuf and alen. The result given by
|
|
||||||
* *s, which is set to a NUL-terminated allocated buffer. *enclen is
|
|
||||||
* set to the length of the encoded name (not the length of the
|
|
||||||
* expanded name; the goal is to tell the caller how many bytes to
|
|
||||||
* move forward to get past the encoded name).
|
|
||||||
*
|
|
||||||
* In the simple case, an encoded name is a series of labels, each
|
|
||||||
* composed of a one-byte length (limited to values between 0 and 63
|
|
||||||
* inclusive) followed by the label contents. The name is terminated
|
|
||||||
* by a zero-length label.
|
|
||||||
*
|
|
||||||
* In the more complicated case, a label may be terminated by an
|
|
||||||
* indirection pointer, specified by two bytes with the high bits of
|
|
||||||
* the first byte (corresponding to INDIR_MASK) set to 11. With the
|
|
||||||
* two high bits of the first byte stripped off, the indirection
|
|
||||||
* pointer gives an offset from the beginning of the containing
|
|
||||||
* message with more labels to decode. Indirection can happen an
|
|
||||||
* arbitrary number of times, so we have to detect loops.
|
|
||||||
*
|
|
||||||
* Since the expanded name uses '.' as a label separator, we use
|
|
||||||
* backslashes to escape periods or backslashes in the expanded name.
|
|
||||||
*/
|
|
||||||
|
|
||||||
int ares_expand_name(const unsigned char *encoded, const unsigned char *abuf,
|
|
||||||
int alen, char **s, long *enclen)
|
|
||||||
{
|
|
||||||
int len, indir = 0;
|
|
||||||
char *q;
|
|
||||||
const unsigned char *p;
|
|
||||||
|
|
||||||
len = name_length(encoded, abuf, alen);
|
|
||||||
if (len == -1)
|
|
||||||
return ARES_EBADNAME;
|
|
||||||
|
|
||||||
*s = malloc(len + 1);
|
|
||||||
if (!*s)
|
|
||||||
return ARES_ENOMEM;
|
|
||||||
q = *s;
|
|
||||||
|
|
||||||
if (len == 0) {
|
|
||||||
/* RFC2181 says this should be ".": the root of the DNS tree.
|
|
||||||
* Since this function strips trailing dots though, it becomes ""
|
|
||||||
*/
|
|
||||||
q[0] = '\0';
|
|
||||||
*enclen = 1; /* the caller should move one byte to get past this */
|
|
||||||
return ARES_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* No error-checking necessary; it was all done by name_length(). */
|
|
||||||
p = encoded;
|
|
||||||
while (*p)
|
|
||||||
{
|
|
||||||
if ((*p & INDIR_MASK) == INDIR_MASK)
|
|
||||||
{
|
|
||||||
if (!indir)
|
|
||||||
{
|
|
||||||
*enclen = p + 2 - encoded;
|
|
||||||
indir = 1;
|
|
||||||
}
|
|
||||||
p = abuf + ((*p & ~INDIR_MASK) << 8 | *(p + 1));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
len = *p;
|
|
||||||
p++;
|
|
||||||
while (len--)
|
|
||||||
{
|
|
||||||
if (*p == '.' || *p == '\\')
|
|
||||||
*q++ = '\\';
|
|
||||||
*q++ = *p;
|
|
||||||
p++;
|
|
||||||
}
|
|
||||||
*q++ = '.';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!indir)
|
|
||||||
*enclen = p + 1 - encoded;
|
|
||||||
|
|
||||||
/* Nuke the trailing period if we wrote one. */
|
|
||||||
if (q > *s)
|
|
||||||
*(q - 1) = 0;
|
|
||||||
else
|
|
||||||
*q = 0; /* zero terminate */
|
|
||||||
|
|
||||||
return ARES_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return the length of the expansion of an encoded domain name, or
|
|
||||||
* -1 if the encoding is invalid.
|
|
||||||
*/
|
|
||||||
static int name_length(const unsigned char *encoded, const unsigned char *abuf,
|
|
||||||
int alen)
|
|
||||||
{
|
|
||||||
int n = 0, offset, indir = 0;
|
|
||||||
|
|
||||||
/* Allow the caller to pass us abuf + alen and have us check for it. */
|
|
||||||
if (encoded == abuf + alen)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
while (*encoded)
|
|
||||||
{
|
|
||||||
if ((*encoded & INDIR_MASK) == INDIR_MASK)
|
|
||||||
{
|
|
||||||
/* Check the offset and go there. */
|
|
||||||
if (encoded + 1 >= abuf + alen)
|
|
||||||
return -1;
|
|
||||||
offset = (*encoded & ~INDIR_MASK) << 8 | *(encoded + 1);
|
|
||||||
if (offset >= alen)
|
|
||||||
return -1;
|
|
||||||
encoded = abuf + offset;
|
|
||||||
|
|
||||||
/* If we've seen more indirects than the message length,
|
|
||||||
* then there's a loop.
|
|
||||||
*/
|
|
||||||
if (++indir > alen)
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
offset = *encoded;
|
|
||||||
if (encoded + offset + 1 >= abuf + alen)
|
|
||||||
return -1;
|
|
||||||
encoded++;
|
|
||||||
while (offset--)
|
|
||||||
{
|
|
||||||
n += (*encoded == '.' || *encoded == '\\') ? 2 : 1;
|
|
||||||
encoded++;
|
|
||||||
}
|
|
||||||
n++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If there were any labels at all, then the number of dots is one
|
|
||||||
* less than the number of labels, so subtract one.
|
|
||||||
*/
|
|
||||||
return (n) ? n - 1 : n;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Like ares_expand_name but returns EBADRESP in case of invalid input. */
|
|
||||||
int ares__expand_name_for_response(const unsigned char *encoded,
|
|
||||||
const unsigned char *abuf, int alen,
|
|
||||||
char **s, long *enclen)
|
|
||||||
{
|
|
||||||
int status = ares_expand_name(encoded, abuf, alen, s, enclen);
|
|
||||||
if (status == ARES_EBADNAME)
|
|
||||||
status = ARES_EBADRESP;
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
.\" $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.
|
|
||||||
.\"
|
|
||||||
.TH ARES_EXPAND_NAME 3 "23 July 1998"
|
|
||||||
.SH NAME
|
|
||||||
ares_expand_string \- Expand a length encoded string
|
|
||||||
.SH SYNOPSIS
|
|
||||||
.nf
|
|
||||||
.B #include <ares.h>
|
|
||||||
.PP
|
|
||||||
.B int ares_expand_string(const unsigned char *\fIencoded\fP,
|
|
||||||
.B const unsigned char *\fIabuf\fP, int \fIalen\fP, unsigned char **\fIs\fP,
|
|
||||||
.B int *\fIenclen\fP)
|
|
||||||
.fi
|
|
||||||
.SH DESCRIPTION
|
|
||||||
The
|
|
||||||
.B ares_expand_string
|
|
||||||
function converts a length encoded string to a NUL-terminated C
|
|
||||||
string. The argument
|
|
||||||
.I encoded
|
|
||||||
gives the beginning of the encoded string, and the arguments
|
|
||||||
.I abuf
|
|
||||||
and
|
|
||||||
.I alen
|
|
||||||
give the containing message buffer (necessary for the processing of
|
|
||||||
indirection pointers within the encoded domain name). The result is
|
|
||||||
placed in a NUL-terminated allocated buffer, a pointer to which is
|
|
||||||
stored in the variable pointed to by
|
|
||||||
.IR s .
|
|
||||||
The length of the encoded string is stored in the variable pointed to by
|
|
||||||
.I enclen
|
|
||||||
so that the caller can advance past the encoded string to read
|
|
||||||
further data in the message.
|
|
||||||
.SH RETURN VALUES
|
|
||||||
.B ares_expand_string
|
|
||||||
can return any of the following values:
|
|
||||||
.TP 15
|
|
||||||
.B ARES_SUCCESS
|
|
||||||
Expansion of the encoded string succeeded.
|
|
||||||
.TP 15
|
|
||||||
.B ARES_EBADSTR
|
|
||||||
The encoded string was malformed and could not be expanded.
|
|
||||||
.TP 15
|
|
||||||
.B ARES_ENOMEM
|
|
||||||
Memory was exhausted.
|
|
||||||
.SH SEE ALSO
|
|
||||||
.BR ares_free_string (3)
|
|
||||||
.SH AUTHOR
|
|
||||||
Dominick Meglio
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
/* $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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "setup.h"
|
|
||||||
|
|
||||||
#ifdef HAVE_SYS_SOCKET_H
|
|
||||||
# include <sys/socket.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_NETINET_IN_H
|
|
||||||
# include <netinet/in.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_ARPA_NAMESER_H
|
|
||||||
# include <arpa/nameser.h>
|
|
||||||
#else
|
|
||||||
# include "nameser.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include "ares.h"
|
|
||||||
#include "ares_private.h" /* for the memdebug */
|
|
||||||
|
|
||||||
/* Simply decodes a length-encoded character string. The first byte of the
|
|
||||||
* input is the length of the string to be returned and the bytes thereafter
|
|
||||||
* are the characters of the string. The returned result will be NULL
|
|
||||||
* terminated.
|
|
||||||
*/
|
|
||||||
int ares_expand_string(const unsigned char *encoded,
|
|
||||||
const unsigned char *abuf,
|
|
||||||
int alen,
|
|
||||||
unsigned char **s,
|
|
||||||
long *enclen)
|
|
||||||
{
|
|
||||||
unsigned char *q;
|
|
||||||
long len;
|
|
||||||
if (encoded == abuf+alen)
|
|
||||||
return ARES_EBADSTR;
|
|
||||||
|
|
||||||
len = *encoded;
|
|
||||||
if (encoded+len+1 > abuf+alen)
|
|
||||||
return ARES_EBADSTR;
|
|
||||||
|
|
||||||
encoded++;
|
|
||||||
|
|
||||||
*s = malloc(len+1);
|
|
||||||
if (*s == NULL)
|
|
||||||
return ARES_ENOMEM;
|
|
||||||
q = *s;
|
|
||||||
strncpy((char *)q, (char *)encoded, len);
|
|
||||||
q[len] = '\0';
|
|
||||||
|
|
||||||
*s = q;
|
|
||||||
|
|
||||||
*enclen = len+1;
|
|
||||||
|
|
||||||
return ARES_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
.\" $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.
|
|
||||||
.\"
|
|
||||||
.TH ARES_FDS 3 "23 July 1998"
|
|
||||||
.SH NAME
|
|
||||||
ares_fds \- Get file descriptors to select on for name service
|
|
||||||
.SH SYNOPSIS
|
|
||||||
.nf
|
|
||||||
.B #include <ares.h>
|
|
||||||
.PP
|
|
||||||
.B int ares_fds(ares_channel \fIchannel\fP, fd_set *\fIread_fds\fP,
|
|
||||||
.B fd_set *\fIwrite_fds\fP)
|
|
||||||
.fi
|
|
||||||
.SH DESCRIPTION
|
|
||||||
The
|
|
||||||
.B ares_fds
|
|
||||||
function retrieves the set of file descriptors which the calling
|
|
||||||
application should select on for reading and writing for the
|
|
||||||
processing of name service queries pending on the name service channel
|
|
||||||
identified by
|
|
||||||
.IR channel .
|
|
||||||
File descriptors will be set in the file descriptor sets pointed to by
|
|
||||||
.I read_fds
|
|
||||||
and
|
|
||||||
.I write_fds
|
|
||||||
as appropriate. File descriptors already set in
|
|
||||||
.I read_fds
|
|
||||||
and
|
|
||||||
.I write_fds
|
|
||||||
will remain set; initialization of the file descriptor sets
|
|
||||||
(using
|
|
||||||
.BR FD_ZERO )
|
|
||||||
is the responsibility of the caller.
|
|
||||||
.SH RETURN VALUES
|
|
||||||
.B ares_fds
|
|
||||||
returns one greater than the number of the highest socket set in either
|
|
||||||
.I read_fds
|
|
||||||
or
|
|
||||||
.IR write_fds .
|
|
||||||
If no queries are active,
|
|
||||||
.B ares_fds
|
|
||||||
will return 0.
|
|
||||||
.SH SEE ALSO
|
|
||||||
.BR ares_timeout (3),
|
|
||||||
.BR ares_process (3)
|
|
||||||
.SH AUTHOR
|
|
||||||
Greg Hudson, MIT Information Systems
|
|
||||||
.br
|
|
||||||
Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
/* $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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "setup.h"
|
|
||||||
|
|
||||||
#ifdef HAVE_SYS_TIME_H
|
|
||||||
#include <sys/time.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "ares.h"
|
|
||||||
#include "ares_private.h"
|
|
||||||
|
|
||||||
int ares_fds(ares_channel channel, fd_set *read_fds, fd_set *write_fds)
|
|
||||||
{
|
|
||||||
struct server_state *server;
|
|
||||||
ares_socket_t nfds;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
/* Are there any active queries? */
|
|
||||||
int active_queries = !ares__is_list_empty(&(channel->all_queries));
|
|
||||||
|
|
||||||
nfds = 0;
|
|
||||||
for (i = 0; i < channel->nservers; i++)
|
|
||||||
{
|
|
||||||
server = &channel->servers[i];
|
|
||||||
/* We only need to register interest in UDP sockets if we have
|
|
||||||
* outstanding queries.
|
|
||||||
*/
|
|
||||||
if (active_queries && server->udp_socket != ARES_SOCKET_BAD)
|
|
||||||
{
|
|
||||||
FD_SET(server->udp_socket, read_fds);
|
|
||||||
if (server->udp_socket >= nfds)
|
|
||||||
nfds = server->udp_socket + 1;
|
|
||||||
}
|
|
||||||
/* We always register for TCP events, because we want to know
|
|
||||||
* when the other side closes the connection, so we don't waste
|
|
||||||
* time trying to use a broken connection.
|
|
||||||
*/
|
|
||||||
if (server->tcp_socket != ARES_SOCKET_BAD)
|
|
||||||
{
|
|
||||||
FD_SET(server->tcp_socket, read_fds);
|
|
||||||
if (server->qhead)
|
|
||||||
FD_SET(server->tcp_socket, write_fds);
|
|
||||||
if (server->tcp_socket >= nfds)
|
|
||||||
nfds = server->tcp_socket + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return (int)nfds;
|
|
||||||
}
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
.\" $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.
|
|
||||||
.\"
|
|
||||||
.TH ARES_FREE_HOSTENT 3 "23 July 1998"
|
|
||||||
.SH NAME
|
|
||||||
ares_free_hostent \- Free host structure allocated by ares functions
|
|
||||||
.SH SYNOPSIS
|
|
||||||
.nf
|
|
||||||
.B #include <ares.h>
|
|
||||||
.PP
|
|
||||||
.B void ares_free_hostent(struct hostent *\fIhost\fP)
|
|
||||||
.fi
|
|
||||||
.SH DESCRIPTION
|
|
||||||
The
|
|
||||||
.I ares_free_hostent
|
|
||||||
function frees a
|
|
||||||
.B struct hostent
|
|
||||||
allocated by one of the functions \fIares_parse_a_reply(3)\fP,
|
|
||||||
\fIares_parse_aaaa_reply(3)\fP, or \fIares_parse_ptr_reply(3)\fP.
|
|
||||||
.SH NOTES
|
|
||||||
It is not necessary (and is not correct) to free the host structure passed to
|
|
||||||
the callback functions for \fIares_gethostbyname(3)\fP or
|
|
||||||
\fIares_gethostbyaddr(3)\fP. c-ares will automatically free such host
|
|
||||||
structures when the callback returns.
|
|
||||||
.SH SEE ALSO
|
|
||||||
.BR ares_parse_a_reply (3),
|
|
||||||
.BR ares_parse_aaaa_reply (3),
|
|
||||||
.BR ares_parse_ptr_reply (3),
|
|
||||||
.BR ares_parse_ns_reply (3)
|
|
||||||
.SH AUTHOR
|
|
||||||
Greg Hudson, MIT Information Systems
|
|
||||||
.br
|
|
||||||
Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
/* $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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "setup.h"
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#if !defined(WIN32) || defined(WATT32)
|
|
||||||
#include <netdb.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "ares.h"
|
|
||||||
#include "ares_private.h" /* for memdebug */
|
|
||||||
|
|
||||||
void ares_free_hostent(struct hostent *host)
|
|
||||||
{
|
|
||||||
char **p;
|
|
||||||
|
|
||||||
free((char *)(host->h_name));
|
|
||||||
for (p = host->h_aliases; *p; p++)
|
|
||||||
free(*p);
|
|
||||||
free(host->h_aliases);
|
|
||||||
free(host->h_addr_list[0]); /* no matter if there is one or many entries,
|
|
||||||
there is only one malloc for all of them */
|
|
||||||
free(host->h_addr_list);
|
|
||||||
free(host);
|
|
||||||
}
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
.\" $Id$
|
|
||||||
.\"
|
|
||||||
.\" Copyright 2000 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_FREE_STRING 3 "4 February 2004"
|
|
||||||
.SH NAME
|
|
||||||
ares_free_string \- Free strings allocated by ares functions
|
|
||||||
.SH SYNOPSIS
|
|
||||||
.nf
|
|
||||||
.B #include <ares.h>
|
|
||||||
.PP
|
|
||||||
.B void ares_free_string(void *\fIstr\fP)
|
|
||||||
.fi
|
|
||||||
.SH DESCRIPTION
|
|
||||||
The
|
|
||||||
.I ares_free_string
|
|
||||||
function frees a string allocated by an ares function.
|
|
||||||
.SH SEE ALSO
|
|
||||||
.BR ares_mkquery (3)
|
|
||||||
.BR ares_expand_string (3)
|
|
||||||
.SH AUTHOR
|
|
||||||
Greg Hudson, MIT Information Systems
|
|
||||||
.br
|
|
||||||
Copyright 2000 by the Massachusetts Institute of Technology.
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
/* $Id$ */
|
|
||||||
|
|
||||||
/* Copyright 2000 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "setup.h"
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include "ares.h"
|
|
||||||
#include "ares_private.h"
|
|
||||||
|
|
||||||
void ares_free_string(void *str)
|
|
||||||
{
|
|
||||||
free(str);
|
|
||||||
}
|
|
||||||
@@ -1,102 +0,0 @@
|
|||||||
.\" $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.
|
|
||||||
.\"
|
|
||||||
.TH ARES_GETHOSTBYADDR 3 "24 July 1998"
|
|
||||||
.SH NAME
|
|
||||||
ares_gethostbyaddr \- Initiate a host query by address
|
|
||||||
.SH SYNOPSIS
|
|
||||||
.nf
|
|
||||||
.B #include <ares.h>
|
|
||||||
.PP
|
|
||||||
.B typedef void (*ares_host_callback)(void *\fIarg\fP, int \fIstatus\fP,
|
|
||||||
.B int \fItimeouts\fP, struct hostent *\fIhostent\fP)
|
|
||||||
.PP
|
|
||||||
.B void ares_gethostbyaddr(ares_channel \fIchannel\fP, const void *\fIaddr\fP,
|
|
||||||
.B int \fIaddrlen\fP, int \fIfamily\fP, ares_host_callback \fIcallback\fP,
|
|
||||||
.B void *\fIarg\fP)
|
|
||||||
.fi
|
|
||||||
.SH DESCRIPTION
|
|
||||||
The
|
|
||||||
.B ares_gethostbyaddr
|
|
||||||
function initiates a host query by address on the name service channel
|
|
||||||
identified by
|
|
||||||
.IR channel .
|
|
||||||
The parameters
|
|
||||||
.I addr
|
|
||||||
and
|
|
||||||
.I addrlen
|
|
||||||
give the address as a series of bytes, and
|
|
||||||
.I family
|
|
||||||
gives the type of address. When the query is complete or has 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
|
|
||||||
\fIares_process(3)\fP, \fIares_destroy(3)\fP or \fIares_cancel(3)\fP.
|
|
||||||
.PP
|
|
||||||
The callback argument
|
|
||||||
.I arg
|
|
||||||
is copied from the
|
|
||||||
.B ares_gethostbyaddr
|
|
||||||
argument
|
|
||||||
.IR arg .
|
|
||||||
The callback argument
|
|
||||||
.I status
|
|
||||||
indicates whether the query succeeded and, if not, how it failed. It
|
|
||||||
may have any of the following values:
|
|
||||||
.TP 19
|
|
||||||
.B ARES_SUCCESS
|
|
||||||
The host lookup completed successfully.
|
|
||||||
.TP 19
|
|
||||||
.B ARES_ENOTIMP
|
|
||||||
The ares library does not know how to look up addresses of type
|
|
||||||
.IR family .
|
|
||||||
.TP 19
|
|
||||||
.B ARES_ENOTFOUND
|
|
||||||
The address
|
|
||||||
.I addr
|
|
||||||
was not found.
|
|
||||||
.TP 19
|
|
||||||
.B ARES_ENOMEM
|
|
||||||
Memory was exhausted.
|
|
||||||
.TP 19
|
|
||||||
.B ARES_EDESTRUCTION
|
|
||||||
The name service channel
|
|
||||||
.I channel
|
|
||||||
is being destroyed; the query will not be completed.
|
|
||||||
.PP
|
|
||||||
The callback argument
|
|
||||||
.I timeouts
|
|
||||||
reports how many times a query timed out during the execution of the
|
|
||||||
given request.
|
|
||||||
.PP
|
|
||||||
On successful completion of the query, the callback argument
|
|
||||||
.I hostent
|
|
||||||
points to a
|
|
||||||
.B struct hostent
|
|
||||||
containing the name of the host returned by the query. The callback
|
|
||||||
need not and should not attempt to free the memory pointed to by
|
|
||||||
.IR hostent ;
|
|
||||||
the ares library will free it when the callback returns. If the query
|
|
||||||
did not complete successfully,
|
|
||||||
.I hostent
|
|
||||||
will be
|
|
||||||
.BR NULL .
|
|
||||||
.SH SEE ALSO
|
|
||||||
.BR ares_process (3),
|
|
||||||
.BR ares_gethostbyname (3)
|
|
||||||
.SH AUTHOR
|
|
||||||
Greg Hudson, MIT Information Systems
|
|
||||||
.br
|
|
||||||
Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||||
@@ -1,291 +0,0 @@
|
|||||||
/* $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.
|
|
||||||
*/
|
|
||||||
#include "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 <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "ares.h"
|
|
||||||
#include "inet_net_pton.h"
|
|
||||||
#include "ares_private.h"
|
|
||||||
|
|
||||||
#ifdef WATT32
|
|
||||||
#undef WIN32
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct addr_query {
|
|
||||||
/* Arguments passed to ares_gethostbyaddr() */
|
|
||||||
ares_channel channel;
|
|
||||||
struct ares_addr addr;
|
|
||||||
ares_host_callback callback;
|
|
||||||
void *arg;
|
|
||||||
|
|
||||||
const char *remaining_lookups;
|
|
||||||
int timeouts;
|
|
||||||
};
|
|
||||||
|
|
||||||
static void next_lookup(struct addr_query *aquery);
|
|
||||||
static void addr_callback(void *arg, int status, int timeouts,
|
|
||||||
unsigned char *abuf, int alen);
|
|
||||||
static void end_aquery(struct addr_query *aquery, int status,
|
|
||||||
struct hostent *host);
|
|
||||||
static int file_lookup(struct ares_addr *addr, struct hostent **host);
|
|
||||||
static void ptr_rr_name(char *name, const struct ares_addr *addr);
|
|
||||||
|
|
||||||
void ares_gethostbyaddr(ares_channel channel, const void *addr, int addrlen,
|
|
||||||
int family, ares_host_callback callback, void *arg)
|
|
||||||
{
|
|
||||||
struct addr_query *aquery;
|
|
||||||
|
|
||||||
if (family != AF_INET && family != AF_INET6)
|
|
||||||
{
|
|
||||||
callback(arg, ARES_ENOTIMP, 0, NULL);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((family == AF_INET && addrlen != sizeof(struct in_addr)) ||
|
|
||||||
(family == AF_INET6 && addrlen != sizeof(struct in6_addr)))
|
|
||||||
{
|
|
||||||
callback(arg, ARES_ENOTIMP, 0, NULL);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
aquery = malloc(sizeof(struct addr_query));
|
|
||||||
if (!aquery)
|
|
||||||
{
|
|
||||||
callback(arg, ARES_ENOMEM, 0, NULL);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
aquery->channel = channel;
|
|
||||||
if (family == AF_INET)
|
|
||||||
memcpy(&aquery->addr.addrV4, addr, sizeof(struct in_addr));
|
|
||||||
else
|
|
||||||
memcpy(&aquery->addr.addrV6, addr, sizeof(struct in6_addr));
|
|
||||||
aquery->addr.family = family;
|
|
||||||
aquery->callback = callback;
|
|
||||||
aquery->arg = arg;
|
|
||||||
aquery->remaining_lookups = channel->lookups;
|
|
||||||
aquery->timeouts = 0;
|
|
||||||
|
|
||||||
next_lookup(aquery);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void next_lookup(struct addr_query *aquery)
|
|
||||||
{
|
|
||||||
const char *p;
|
|
||||||
char name[128];
|
|
||||||
int status;
|
|
||||||
struct hostent *host;
|
|
||||||
|
|
||||||
for (p = aquery->remaining_lookups; *p; p++)
|
|
||||||
{
|
|
||||||
switch (*p)
|
|
||||||
{
|
|
||||||
case 'b':
|
|
||||||
ptr_rr_name(name, &aquery->addr);
|
|
||||||
aquery->remaining_lookups = p + 1;
|
|
||||||
ares_query(aquery->channel, name, C_IN, T_PTR, addr_callback,
|
|
||||||
aquery);
|
|
||||||
return;
|
|
||||||
case 'f':
|
|
||||||
status = file_lookup(&aquery->addr, &host);
|
|
||||||
|
|
||||||
/* this status check below previously checked for !ARES_ENOTFOUND,
|
|
||||||
but we should not assume that this single error code is the one
|
|
||||||
that can occur, as that is in fact no longer the case */
|
|
||||||
if (status == ARES_SUCCESS)
|
|
||||||
{
|
|
||||||
end_aquery(aquery, status, host);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
end_aquery(aquery, ARES_ENOTFOUND, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void addr_callback(void *arg, int status, int timeouts,
|
|
||||||
unsigned char *abuf, int alen)
|
|
||||||
{
|
|
||||||
struct addr_query *aquery = (struct addr_query *) arg;
|
|
||||||
struct hostent *host;
|
|
||||||
size_t addrlen;
|
|
||||||
|
|
||||||
aquery->timeouts += timeouts;
|
|
||||||
if (status == ARES_SUCCESS)
|
|
||||||
{
|
|
||||||
if (aquery->addr.family == AF_INET)
|
|
||||||
{
|
|
||||||
addrlen = sizeof(struct in_addr);
|
|
||||||
status = ares_parse_ptr_reply(abuf, alen, &aquery->addr.addrV4,
|
|
||||||
(int)addrlen, AF_INET, &host);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
else if (status == ARES_EDESTRUCTION)
|
|
||||||
end_aquery(aquery, status, NULL);
|
|
||||||
else
|
|
||||||
next_lookup(aquery);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void end_aquery(struct addr_query *aquery, int status,
|
|
||||||
struct hostent *host)
|
|
||||||
{
|
|
||||||
aquery->callback(aquery->arg, status, aquery->timeouts, host);
|
|
||||||
if (host)
|
|
||||||
ares_free_hostent(host);
|
|
||||||
free(aquery);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int file_lookup(struct ares_addr *addr, struct hostent **host)
|
|
||||||
{
|
|
||||||
FILE *fp;
|
|
||||||
int status;
|
|
||||||
int error;
|
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
char PATH_HOSTS[MAX_PATH];
|
|
||||||
if (IS_NT()) {
|
|
||||||
char tmp[MAX_PATH];
|
|
||||||
HKEY hkeyHosts;
|
|
||||||
|
|
||||||
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0, KEY_READ, &hkeyHosts)
|
|
||||||
== ERROR_SUCCESS)
|
|
||||||
{
|
|
||||||
DWORD dwLength = MAX_PATH;
|
|
||||||
RegQueryValueEx(hkeyHosts, DATABASEPATH, NULL, NULL, (LPBYTE)tmp,
|
|
||||||
&dwLength);
|
|
||||||
ExpandEnvironmentStrings(tmp, PATH_HOSTS, MAX_PATH);
|
|
||||||
RegCloseKey(hkeyHosts);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
GetWindowsDirectory(PATH_HOSTS, MAX_PATH);
|
|
||||||
|
|
||||||
strcat(PATH_HOSTS, WIN_PATH_HOSTS);
|
|
||||||
|
|
||||||
#elif defined(WATT32)
|
|
||||||
extern const char *_w32_GetHostsFile (void);
|
|
||||||
const char *PATH_HOSTS = _w32_GetHostsFile();
|
|
||||||
|
|
||||||
if (!PATH_HOSTS)
|
|
||||||
return ARES_ENOTFOUND;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
fp = fopen(PATH_HOSTS, "r");
|
|
||||||
if (!fp)
|
|
||||||
{
|
|
||||||
error = ERRNO;
|
|
||||||
switch(error)
|
|
||||||
{
|
|
||||||
case ENOENT:
|
|
||||||
case ESRCH:
|
|
||||||
return ARES_ENOTFOUND;
|
|
||||||
default:
|
|
||||||
DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n",
|
|
||||||
error, strerror(error)));
|
|
||||||
DEBUGF(fprintf(stderr, "Error opening file: %s\n",
|
|
||||||
PATH_HOSTS));
|
|
||||||
*host = NULL;
|
|
||||||
return ARES_EFILE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
while ((status = ares__get_hostent(fp, addr->family, host)) == ARES_SUCCESS)
|
|
||||||
{
|
|
||||||
if (addr->family != (*host)->h_addrtype)
|
|
||||||
{
|
|
||||||
ares_free_hostent(*host);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (addr->family == AF_INET)
|
|
||||||
{
|
|
||||||
if (memcmp((*host)->h_addr, &addr->addrV4, sizeof(struct in_addr)) == 0)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else if (addr->family == AF_INET6)
|
|
||||||
{
|
|
||||||
if (memcmp((*host)->h_addr, &addr->addrV6, sizeof(struct in6_addr)) == 0)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
ares_free_hostent(*host);
|
|
||||||
}
|
|
||||||
fclose(fp);
|
|
||||||
if (status == ARES_EOF)
|
|
||||||
status = ARES_ENOTFOUND;
|
|
||||||
if (status != ARES_SUCCESS)
|
|
||||||
*host = NULL;
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void ptr_rr_name(char *name, const struct ares_addr *addr)
|
|
||||||
{
|
|
||||||
if (addr->family == AF_INET)
|
|
||||||
{
|
|
||||||
unsigned long laddr = ntohl(addr->addrV4.s_addr);
|
|
||||||
int a1 = (int)((laddr >> 24) & 0xff);
|
|
||||||
int a2 = (int)((laddr >> 16) & 0xff);
|
|
||||||
int a3 = (int)((laddr >> 8) & 0xff);
|
|
||||||
int a4 = (int)(laddr & 0xff);
|
|
||||||
sprintf(name, "%d.%d.%d.%d.in-addr.arpa", a4, a3, a2, a1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
unsigned char *bytes = (unsigned char *)&addr->addrV6.s6_addr;
|
|
||||||
/* There are too many arguments to do this in one line using
|
|
||||||
* minimally C89-compliant compilers */
|
|
||||||
sprintf(name,
|
|
||||||
"%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.",
|
|
||||||
bytes[15]&0xf, bytes[15] >> 4, bytes[14]&0xf, bytes[14] >> 4,
|
|
||||||
bytes[13]&0xf, bytes[13] >> 4, bytes[12]&0xf, bytes[12] >> 4,
|
|
||||||
bytes[11]&0xf, bytes[11] >> 4, bytes[10]&0xf, bytes[10] >> 4,
|
|
||||||
bytes[9]&0xf, bytes[9] >> 4, bytes[8]&0xf, bytes[8] >> 4);
|
|
||||||
sprintf(name+strlen(name),
|
|
||||||
"%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.ip6.arpa",
|
|
||||||
bytes[7]&0xf, bytes[7] >> 4, bytes[6]&0xf, bytes[6] >> 4,
|
|
||||||
bytes[5]&0xf, bytes[5] >> 4, bytes[4]&0xf, bytes[4] >> 4,
|
|
||||||
bytes[3]&0xf, bytes[3] >> 4, bytes[2]&0xf, bytes[2] >> 4,
|
|
||||||
bytes[1]&0xf, bytes[1] >> 4, bytes[0]&0xf, bytes[0] >> 4);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,106 +0,0 @@
|
|||||||
.\" $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.
|
|
||||||
.\"
|
|
||||||
.TH ARES_GETHOSTBYNAME 3 "25 July 1998"
|
|
||||||
.SH NAME
|
|
||||||
ares_gethostbyname \- Initiate a host query by name
|
|
||||||
.SH SYNOPSIS
|
|
||||||
.nf
|
|
||||||
.B #include <ares.h>
|
|
||||||
.PP
|
|
||||||
.B typedef void (*ares_host_callback)(void *\fIarg\fP, int \fIstatus\fP,
|
|
||||||
.B int \fItimeouts\fP, struct hostent *\fIhostent\fP)
|
|
||||||
.PP
|
|
||||||
.B void ares_gethostbyname(ares_channel \fIchannel\fP, const char *\fIname\fP,
|
|
||||||
.B int \fIfamily\fP, ares_host_callback \fIcallback\fP, void *\fIarg\fP)
|
|
||||||
.fi
|
|
||||||
.SH DESCRIPTION
|
|
||||||
The
|
|
||||||
.B ares_gethostbyname
|
|
||||||
function initiates a host query by name on the name service channel
|
|
||||||
identified by
|
|
||||||
.IR channel .
|
|
||||||
The parameter
|
|
||||||
.I name
|
|
||||||
gives the hostname as a NUL-terminated C string, and
|
|
||||||
.I family
|
|
||||||
gives the desired type of address for the resulting host entry. When the
|
|
||||||
query is complete or has 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 \fIares_process(3)\fP, \fIares_destroy(3)\fP or
|
|
||||||
\fIares_cancel(3)\fP.
|
|
||||||
.PP
|
|
||||||
The callback argument
|
|
||||||
.I arg
|
|
||||||
is copied from the
|
|
||||||
.B ares_gethostbyname
|
|
||||||
argument
|
|
||||||
.IR arg .
|
|
||||||
The callback argument
|
|
||||||
.I status
|
|
||||||
indicates whether the query succeeded and, if not, how it failed. It
|
|
||||||
may have any of the following values:
|
|
||||||
.TP 19
|
|
||||||
.B ARES_SUCCESS
|
|
||||||
The host lookup completed successfully.
|
|
||||||
.TP 19
|
|
||||||
.B ARES_ENOTIMP
|
|
||||||
The ares library does not know how to find addresses of type
|
|
||||||
.IR family .
|
|
||||||
.TP 19
|
|
||||||
.B ARES_EBADNAME
|
|
||||||
The hostname
|
|
||||||
.B name
|
|
||||||
is composed entirely of numbers and periods, but is not a valid
|
|
||||||
representation of an Internet address.
|
|
||||||
.TP 19
|
|
||||||
.B ARES_ENOTFOUND
|
|
||||||
The address
|
|
||||||
.I addr
|
|
||||||
was not found.
|
|
||||||
.TP 19
|
|
||||||
.B ARES_ENOMEM
|
|
||||||
Memory was exhausted.
|
|
||||||
.TP 19
|
|
||||||
.B ARES_EDESTRUCTION
|
|
||||||
The name service channel
|
|
||||||
.I channel
|
|
||||||
is being destroyed; the query will not be completed.
|
|
||||||
.PP
|
|
||||||
The callback argument
|
|
||||||
.I timeouts
|
|
||||||
reports how many times a query timed out during the execution of the
|
|
||||||
given request.
|
|
||||||
.PP
|
|
||||||
On successful completion of the query, the callback argument
|
|
||||||
.I hostent
|
|
||||||
points to a
|
|
||||||
.B struct hostent
|
|
||||||
containing the name of the host returned by the query. The callback
|
|
||||||
need not and should not attempt to free the memory pointed to by
|
|
||||||
.IR hostent ;
|
|
||||||
the ares library will free it when the callback returns. If the query
|
|
||||||
did not complete successfully,
|
|
||||||
.I hostent
|
|
||||||
will be
|
|
||||||
.BR NULL .
|
|
||||||
.SH SEE ALSO
|
|
||||||
.BR ares_process (3),
|
|
||||||
.BR ares_gethostbyaddr (3)
|
|
||||||
.SH AUTHOR
|
|
||||||
Greg Hudson, MIT Information Systems
|
|
||||||
.br
|
|
||||||
Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||||
@@ -1,507 +0,0 @@
|
|||||||
/* $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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "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 <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <ctype.h>
|
|
||||||
#ifdef HAVE_STRINGS_H
|
|
||||||
#include <strings.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "ares.h"
|
|
||||||
#include "inet_net_pton.h"
|
|
||||||
#include "bitncmp.h"
|
|
||||||
#include "ares_private.h"
|
|
||||||
|
|
||||||
#ifdef WATT32
|
|
||||||
#undef WIN32
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct host_query {
|
|
||||||
/* Arguments passed to ares_gethostbyname() */
|
|
||||||
ares_channel channel;
|
|
||||||
char *name;
|
|
||||||
ares_host_callback callback;
|
|
||||||
void *arg;
|
|
||||||
int sent_family; /* this family is what was is being used */
|
|
||||||
int want_family; /* this family is what is asked for in the API */
|
|
||||||
const char *remaining_lookups;
|
|
||||||
int timeouts;
|
|
||||||
};
|
|
||||||
|
|
||||||
static void next_lookup(struct host_query *hquery, int status_code);
|
|
||||||
static void host_callback(void *arg, int status, int timeouts,
|
|
||||||
unsigned char *abuf, int alen);
|
|
||||||
static void end_hquery(struct host_query *hquery, int status,
|
|
||||||
struct hostent *host);
|
|
||||||
static int fake_hostent(const char *name, int family,
|
|
||||||
ares_host_callback callback, void *arg);
|
|
||||||
static int file_lookup(const char *name, int family, struct hostent **host);
|
|
||||||
static void sort_addresses(struct hostent *host,
|
|
||||||
const struct apattern *sortlist, int nsort);
|
|
||||||
static void sort6_addresses(struct hostent *host,
|
|
||||||
const struct apattern *sortlist, int nsort);
|
|
||||||
static int get_address_index(const struct in_addr *addr,
|
|
||||||
const struct apattern *sortlist, int nsort);
|
|
||||||
static int get6_address_index(const struct in6_addr *addr,
|
|
||||||
const struct apattern *sortlist, int nsort);
|
|
||||||
|
|
||||||
void ares_gethostbyname(ares_channel channel, const char *name, int family,
|
|
||||||
ares_host_callback callback, void *arg)
|
|
||||||
{
|
|
||||||
struct host_query *hquery;
|
|
||||||
|
|
||||||
/* Right now we only know how to look up Internet addresses - and unspec
|
|
||||||
means try both basically. */
|
|
||||||
switch (family) {
|
|
||||||
case AF_INET:
|
|
||||||
case AF_INET6:
|
|
||||||
case AF_UNSPEC:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
callback(arg, ARES_ENOTIMP, 0, NULL);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fake_hostent(name, family, callback, arg))
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* Allocate and fill in the host query structure. */
|
|
||||||
hquery = malloc(sizeof(struct host_query));
|
|
||||||
if (!hquery)
|
|
||||||
{
|
|
||||||
callback(arg, ARES_ENOMEM, 0, NULL);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
hquery->channel = channel;
|
|
||||||
hquery->name = strdup(name);
|
|
||||||
hquery->want_family = family;
|
|
||||||
hquery->sent_family = -1; /* nothing is sent yet */
|
|
||||||
if (!hquery->name) {
|
|
||||||
free(hquery);
|
|
||||||
callback(arg, ARES_ENOMEM, 0, NULL);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
hquery->callback = callback;
|
|
||||||
hquery->arg = arg;
|
|
||||||
hquery->remaining_lookups = channel->lookups;
|
|
||||||
hquery->timeouts = 0;
|
|
||||||
|
|
||||||
/* Start performing lookups according to channel->lookups. */
|
|
||||||
next_lookup(hquery, ARES_ECONNREFUSED /* initial error code */);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void next_lookup(struct host_query *hquery, int status_code)
|
|
||||||
{
|
|
||||||
const char *p;
|
|
||||||
struct hostent *host;
|
|
||||||
int status = status_code;
|
|
||||||
|
|
||||||
for (p = hquery->remaining_lookups; *p; p++)
|
|
||||||
{
|
|
||||||
switch (*p)
|
|
||||||
{
|
|
||||||
case 'b':
|
|
||||||
/* DNS lookup */
|
|
||||||
hquery->remaining_lookups = p + 1;
|
|
||||||
if ((hquery->want_family == AF_INET6) ||
|
|
||||||
(hquery->want_family == AF_UNSPEC)) {
|
|
||||||
/* if inet6 or unspec, start out with AAAA */
|
|
||||||
hquery->sent_family = AF_INET6;
|
|
||||||
ares_search(hquery->channel, hquery->name, C_IN, T_AAAA,
|
|
||||||
host_callback, hquery);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
hquery->sent_family = AF_INET;
|
|
||||||
ares_search(hquery->channel, hquery->name, C_IN, T_A, host_callback,
|
|
||||||
hquery);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
|
|
||||||
case 'f':
|
|
||||||
/* Host file lookup */
|
|
||||||
status = file_lookup(hquery->name, hquery->want_family, &host);
|
|
||||||
|
|
||||||
/* this status check below previously checked for !ARES_ENOTFOUND,
|
|
||||||
but we should not assume that this single error code is the one
|
|
||||||
that can occur, as that is in fact no longer the case */
|
|
||||||
if (status == ARES_SUCCESS)
|
|
||||||
{
|
|
||||||
end_hquery(hquery, status, host);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
status = status_code; /* Use original status code */
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
end_hquery(hquery, status, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void host_callback(void *arg, int status, int timeouts,
|
|
||||||
unsigned char *abuf, int alen)
|
|
||||||
{
|
|
||||||
struct host_query *hquery = (struct host_query *) arg;
|
|
||||||
ares_channel channel = hquery->channel;
|
|
||||||
struct hostent *host = NULL;
|
|
||||||
|
|
||||||
hquery->timeouts += timeouts;
|
|
||||||
if (status == ARES_SUCCESS)
|
|
||||||
{
|
|
||||||
if (hquery->sent_family == AF_INET)
|
|
||||||
{
|
|
||||||
status = ares_parse_a_reply(abuf, alen, &host, NULL, NULL);
|
|
||||||
if (host && channel->nsort)
|
|
||||||
sort_addresses(host, channel->sortlist, channel->nsort);
|
|
||||||
}
|
|
||||||
else if (hquery->sent_family == AF_INET6)
|
|
||||||
{
|
|
||||||
status = ares_parse_aaaa_reply(abuf, alen, &host, NULL, NULL);
|
|
||||||
if (status == ARES_ENODATA || status == ARES_EBADRESP) {
|
|
||||||
/* The query returned something but either there were no AAAA records (e.g. just CNAME)
|
|
||||||
or the response was malformed. Try looking up A instead.
|
|
||||||
We should possibly limit this attempt-next logic to AF_UNSPEC lookups only. */
|
|
||||||
hquery->sent_family = AF_INET;
|
|
||||||
ares_search(hquery->channel, hquery->name, C_IN, T_A,
|
|
||||||
host_callback, hquery);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (host && channel->nsort)
|
|
||||||
sort6_addresses(host, channel->sortlist, channel->nsort);
|
|
||||||
}
|
|
||||||
end_hquery(hquery, status, host);
|
|
||||||
}
|
|
||||||
else if ((status == ARES_ENODATA || status == ARES_EBADRESP || status == ARES_ETIMEOUT) && hquery->sent_family == AF_INET6)
|
|
||||||
{
|
|
||||||
/* The AAAA query yielded no useful result. Now look up an A instead.
|
|
||||||
We should possibly limit this attempt-next logic to AF_UNSPEC lookups only. */
|
|
||||||
hquery->sent_family = AF_INET;
|
|
||||||
ares_search(hquery->channel, hquery->name, C_IN, T_A, host_callback,
|
|
||||||
hquery);
|
|
||||||
}
|
|
||||||
else if (status == ARES_EDESTRUCTION)
|
|
||||||
end_hquery(hquery, status, NULL);
|
|
||||||
else
|
|
||||||
next_lookup(hquery, status);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void end_hquery(struct host_query *hquery, int status,
|
|
||||||
struct hostent *host)
|
|
||||||
{
|
|
||||||
hquery->callback(hquery->arg, status, hquery->timeouts, host);
|
|
||||||
if (host)
|
|
||||||
ares_free_hostent(host);
|
|
||||||
free(hquery->name);
|
|
||||||
free(hquery);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If the name looks like an IP address, fake up a host entry, end the
|
|
||||||
* query immediately, and return true. Otherwise return false.
|
|
||||||
*/
|
|
||||||
static int fake_hostent(const char *name, int family, ares_host_callback callback,
|
|
||||||
void *arg)
|
|
||||||
{
|
|
||||||
struct hostent hostent;
|
|
||||||
char *aliases[1] = { NULL };
|
|
||||||
char *addrs[2];
|
|
||||||
int result = 0;
|
|
||||||
struct in_addr in;
|
|
||||||
struct in6_addr in6;
|
|
||||||
|
|
||||||
if (family == AF_INET)
|
|
||||||
{
|
|
||||||
/* It only looks like an IP address if it's all numbers and dots. */
|
|
||||||
int numdots = 0;
|
|
||||||
const char *p;
|
|
||||||
for (p = name; *p; p++)
|
|
||||||
{
|
|
||||||
if (!ISDIGIT(*p) && *p != '.') {
|
|
||||||
return 0;
|
|
||||||
} else if (*p == '.') {
|
|
||||||
numdots++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* if we don't have 3 dots, it is illegal
|
|
||||||
* (although inet_addr doesn't think so).
|
|
||||||
*/
|
|
||||||
if (numdots != 3)
|
|
||||||
result = 0;
|
|
||||||
else
|
|
||||||
result = ((in.s_addr = inet_addr(name)) == INADDR_NONE ? 0 : 1);
|
|
||||||
}
|
|
||||||
else if (family == AF_INET6)
|
|
||||||
result = (ares_inet_pton(AF_INET6, name, &in6) < 1 ? 0 : 1);
|
|
||||||
|
|
||||||
if (!result)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (family == AF_INET)
|
|
||||||
{
|
|
||||||
hostent.h_length = (int)sizeof(struct in_addr);
|
|
||||||
addrs[0] = (char *)∈
|
|
||||||
}
|
|
||||||
else if (family == AF_INET6)
|
|
||||||
{
|
|
||||||
hostent.h_length = (int)sizeof(struct in6_addr);
|
|
||||||
addrs[0] = (char *)&in6;
|
|
||||||
}
|
|
||||||
/* Duplicate the name, to avoid a constness violation. */
|
|
||||||
hostent.h_name = strdup(name);
|
|
||||||
if (!hostent.h_name)
|
|
||||||
{
|
|
||||||
callback(arg, ARES_ENOMEM, 0, NULL);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Fill in the rest of the host structure and terminate the query. */
|
|
||||||
addrs[1] = NULL;
|
|
||||||
hostent.h_aliases = aliases;
|
|
||||||
hostent.h_addrtype = family;
|
|
||||||
hostent.h_addr_list = addrs;
|
|
||||||
callback(arg, ARES_SUCCESS, 0, &hostent);
|
|
||||||
|
|
||||||
free((char *)(hostent.h_name));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This is an API method */
|
|
||||||
int ares_gethostbyname_file(ares_channel channel, const char *name,
|
|
||||||
int family, struct hostent **host)
|
|
||||||
{
|
|
||||||
int result;
|
|
||||||
|
|
||||||
/* We only take the channel to ensure that ares_init() been called. */
|
|
||||||
if(channel == NULL)
|
|
||||||
{
|
|
||||||
/* Anything will do, really. This seems fine, and is consistent with
|
|
||||||
other error cases. */
|
|
||||||
*host = NULL;
|
|
||||||
return ARES_ENOTFOUND;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Just chain to the internal implementation we use here; it's exactly
|
|
||||||
* what we want.
|
|
||||||
*/
|
|
||||||
result = file_lookup(name, family, host);
|
|
||||||
if(result != ARES_SUCCESS)
|
|
||||||
{
|
|
||||||
/* We guarantee a NULL hostent on failure. */
|
|
||||||
*host = NULL;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int file_lookup(const char *name, int family, struct hostent **host)
|
|
||||||
{
|
|
||||||
FILE *fp;
|
|
||||||
char **alias;
|
|
||||||
int status;
|
|
||||||
int error;
|
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
char PATH_HOSTS[MAX_PATH];
|
|
||||||
if (IS_NT()) {
|
|
||||||
char tmp[MAX_PATH];
|
|
||||||
HKEY hkeyHosts;
|
|
||||||
|
|
||||||
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0, KEY_READ, &hkeyHosts)
|
|
||||||
== ERROR_SUCCESS)
|
|
||||||
{
|
|
||||||
DWORD dwLength = MAX_PATH;
|
|
||||||
RegQueryValueEx(hkeyHosts, DATABASEPATH, NULL, NULL, (LPBYTE)tmp,
|
|
||||||
&dwLength);
|
|
||||||
ExpandEnvironmentStrings(tmp, PATH_HOSTS, MAX_PATH);
|
|
||||||
RegCloseKey(hkeyHosts);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
GetWindowsDirectory(PATH_HOSTS, MAX_PATH);
|
|
||||||
|
|
||||||
strcat(PATH_HOSTS, WIN_PATH_HOSTS);
|
|
||||||
|
|
||||||
#elif defined(WATT32)
|
|
||||||
extern const char *_w32_GetHostsFile (void);
|
|
||||||
const char *PATH_HOSTS = _w32_GetHostsFile();
|
|
||||||
|
|
||||||
if (!PATH_HOSTS)
|
|
||||||
return ARES_ENOTFOUND;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
fp = fopen(PATH_HOSTS, "r");
|
|
||||||
if (!fp)
|
|
||||||
{
|
|
||||||
error = ERRNO;
|
|
||||||
switch(error)
|
|
||||||
{
|
|
||||||
case ENOENT:
|
|
||||||
case ESRCH:
|
|
||||||
return ARES_ENOTFOUND;
|
|
||||||
default:
|
|
||||||
DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n",
|
|
||||||
error, strerror(error)));
|
|
||||||
DEBUGF(fprintf(stderr, "Error opening file: %s\n",
|
|
||||||
PATH_HOSTS));
|
|
||||||
*host = NULL;
|
|
||||||
return ARES_EFILE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
while ((status = ares__get_hostent(fp, family, host)) == ARES_SUCCESS)
|
|
||||||
{
|
|
||||||
if (strcasecmp((*host)->h_name, name) == 0)
|
|
||||||
break;
|
|
||||||
for (alias = (*host)->h_aliases; *alias; alias++)
|
|
||||||
{
|
|
||||||
if (strcasecmp(*alias, name) == 0)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (*alias)
|
|
||||||
break;
|
|
||||||
ares_free_hostent(*host);
|
|
||||||
}
|
|
||||||
fclose(fp);
|
|
||||||
if (status == ARES_EOF)
|
|
||||||
status = ARES_ENOTFOUND;
|
|
||||||
if (status != ARES_SUCCESS)
|
|
||||||
*host = NULL;
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void sort_addresses(struct hostent *host, const struct apattern *sortlist,
|
|
||||||
int nsort)
|
|
||||||
{
|
|
||||||
struct in_addr a1, a2;
|
|
||||||
int i1, i2, ind1, ind2;
|
|
||||||
|
|
||||||
/* This is a simple insertion sort, not optimized at all. i1 walks
|
|
||||||
* through the address list, with the loop invariant that everything
|
|
||||||
* to the left of i1 is sorted. In the loop body, the value at i1 is moved
|
|
||||||
* back through the list (via i2) until it is in sorted order.
|
|
||||||
*/
|
|
||||||
for (i1 = 0; host->h_addr_list[i1]; i1++)
|
|
||||||
{
|
|
||||||
memcpy(&a1, host->h_addr_list[i1], sizeof(struct in_addr));
|
|
||||||
ind1 = get_address_index(&a1, sortlist, nsort);
|
|
||||||
for (i2 = i1 - 1; i2 >= 0; i2--)
|
|
||||||
{
|
|
||||||
memcpy(&a2, host->h_addr_list[i2], sizeof(struct in_addr));
|
|
||||||
ind2 = get_address_index(&a2, sortlist, nsort);
|
|
||||||
if (ind2 <= ind1)
|
|
||||||
break;
|
|
||||||
memcpy(host->h_addr_list[i2 + 1], &a2, sizeof(struct in_addr));
|
|
||||||
}
|
|
||||||
memcpy(host->h_addr_list[i2 + 1], &a1, sizeof(struct in_addr));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Find the first entry in sortlist which matches addr. Return nsort
|
|
||||||
* if none of them match.
|
|
||||||
*/
|
|
||||||
static int get_address_index(const struct in_addr *addr,
|
|
||||||
const struct apattern *sortlist,
|
|
||||||
int nsort)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < nsort; i++)
|
|
||||||
{
|
|
||||||
if (sortlist[i].family != AF_INET)
|
|
||||||
continue;
|
|
||||||
if (sortlist[i].type == PATTERN_MASK)
|
|
||||||
{
|
|
||||||
if ((addr->s_addr & sortlist[i].mask.addr4.s_addr)
|
|
||||||
== sortlist[i].addrV4.s_addr)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!ares_bitncmp(&addr->s_addr, &sortlist[i].addrV4.s_addr,
|
|
||||||
sortlist[i].mask.bits))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void sort6_addresses(struct hostent *host, const struct apattern *sortlist,
|
|
||||||
int nsort)
|
|
||||||
{
|
|
||||||
struct in6_addr a1, a2;
|
|
||||||
int i1, i2, ind1, ind2;
|
|
||||||
|
|
||||||
/* This is a simple insertion sort, not optimized at all. i1 walks
|
|
||||||
* through the address list, with the loop invariant that everything
|
|
||||||
* to the left of i1 is sorted. In the loop body, the value at i1 is moved
|
|
||||||
* back through the list (via i2) until it is in sorted order.
|
|
||||||
*/
|
|
||||||
for (i1 = 0; host->h_addr_list[i1]; i1++)
|
|
||||||
{
|
|
||||||
memcpy(&a1, host->h_addr_list[i1], sizeof(struct in6_addr));
|
|
||||||
ind1 = get6_address_index(&a1, sortlist, nsort);
|
|
||||||
for (i2 = i1 - 1; i2 >= 0; i2--)
|
|
||||||
{
|
|
||||||
memcpy(&a2, host->h_addr_list[i2], sizeof(struct in6_addr));
|
|
||||||
ind2 = get6_address_index(&a2, sortlist, nsort);
|
|
||||||
if (ind2 <= ind1)
|
|
||||||
break;
|
|
||||||
memcpy(host->h_addr_list[i2 + 1], &a2, sizeof(struct in6_addr));
|
|
||||||
}
|
|
||||||
memcpy(host->h_addr_list[i2 + 1], &a1, sizeof(struct in6_addr));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Find the first entry in sortlist which matches addr. Return nsort
|
|
||||||
* if none of them match.
|
|
||||||
*/
|
|
||||||
static int get6_address_index(const struct in6_addr *addr,
|
|
||||||
const struct apattern *sortlist,
|
|
||||||
int nsort)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < nsort; i++)
|
|
||||||
{
|
|
||||||
if (sortlist[i].family != AF_INET6)
|
|
||||||
continue;
|
|
||||||
if (!ares_bitncmp(&addr->s6_addr, &sortlist[i].addrV6.s6_addr, sortlist[i].mask.bits))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
@@ -1,84 +0,0 @@
|
|||||||
.\" $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.
|
|
||||||
.\"
|
|
||||||
.TH ARES_GETHOSTBYNAME 3 "25 July 1998"
|
|
||||||
.SH NAME
|
|
||||||
ares_gethostbyname_file \- Lookup a name in the system's hosts file
|
|
||||||
.SH SYNOPSIS
|
|
||||||
.nf
|
|
||||||
.B #include <ares.h>
|
|
||||||
.PP
|
|
||||||
.B void ares_gethostbyname_file(ares_channel \fIchannel\fP, const char *\fIname\fP,
|
|
||||||
.B int \fIfamily\fP, struct hostent **host)
|
|
||||||
.fi
|
|
||||||
.SH DESCRIPTION
|
|
||||||
The
|
|
||||||
.B ares_gethostbyname_file
|
|
||||||
function performs a host lookup by name against the system's hosts file (or equivalent local hostname database).
|
|
||||||
The
|
|
||||||
.IR channel
|
|
||||||
parameter is required, but no asynchronous queries are performed. Instead, the
|
|
||||||
lookup is done via the same mechanism used to perform 'f' lookups
|
|
||||||
(see the
|
|
||||||
.I lookups
|
|
||||||
options field in \fIares_init_options(3)\fP).
|
|
||||||
The parameter
|
|
||||||
.I name
|
|
||||||
gives the hostname as a NUL-terminated C string, and
|
|
||||||
.I family
|
|
||||||
gives the desired type of address for the resulting host entry.
|
|
||||||
.PP
|
|
||||||
The return value indicates whether the query succeeded and, if not, how it
|
|
||||||
failed. It may have any of the following values:
|
|
||||||
.TP 19
|
|
||||||
.B ARES_SUCCESS
|
|
||||||
The host lookup completed successfully and
|
|
||||||
.I host
|
|
||||||
now points to the result (and must be freed with \fIares_free_hostent(3)\fP).
|
|
||||||
.TP 19
|
|
||||||
.B ARES_ENOTFOUND
|
|
||||||
The hostname
|
|
||||||
.I name
|
|
||||||
was not found.
|
|
||||||
.TP 19
|
|
||||||
.B ARES_EFILE
|
|
||||||
There was a file I/O error while performing the lookup.
|
|
||||||
.TP 19
|
|
||||||
.B ARES_ENOMEM
|
|
||||||
Memory was exhausted.
|
|
||||||
.PP
|
|
||||||
On successful completion of the query, the pointer pointed to by
|
|
||||||
.I host
|
|
||||||
points to a
|
|
||||||
.B struct hostent
|
|
||||||
containing the address of the host returned by the lookup. The user must
|
|
||||||
free the memory pointed to by
|
|
||||||
.IR host
|
|
||||||
when finished with it by calling \fIares_free_hostent(3)\fP. If the lookup did
|
|
||||||
not complete successfully,
|
|
||||||
.I host
|
|
||||||
will be
|
|
||||||
.BR NULL .
|
|
||||||
.SH AVAILABILITY
|
|
||||||
Added in c-ares 1.5.4
|
|
||||||
.SH SEE ALSO
|
|
||||||
.BR ares_gethostbyname (3),
|
|
||||||
.BR ares_free_hostent (3),
|
|
||||||
.BR ares_init_options (3)
|
|
||||||
.SH AUTHOR
|
|
||||||
Brad Spencer
|
|
||||||
.br
|
|
||||||
Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||||
@@ -1,150 +0,0 @@
|
|||||||
.\" $Id$
|
|
||||||
.\"
|
|
||||||
.\" Copyright 2005 by Dominick Meglio.
|
|
||||||
.\"
|
|
||||||
.\" 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_GETNAMEINFO 3 "1 May 2009"
|
|
||||||
.SH NAME
|
|
||||||
ares_getnameinfo \- Address-to-nodename translation in protocol-independent manner
|
|
||||||
.SH SYNOPSIS
|
|
||||||
.nf
|
|
||||||
.B #include <ares.h>
|
|
||||||
.PP
|
|
||||||
.B typedef void (*ares_nameinfo_callback)(void *\fIarg\fP, int \fIstatus\fP,
|
|
||||||
.B int \fItimeouts\fP, char *\fInode\fP, char *\fIservice\fP)
|
|
||||||
.PP
|
|
||||||
.B void ares_getnameinfo(ares_channel \fIchannel\fP, const struct sockaddr *\fIsa\fP,
|
|
||||||
.B ares_socklen_t \fIsalen\fP, int \fIflags\fP, ares_nameinfo_callback \fIcallback\fP,
|
|
||||||
.B void *\fIarg\fP)
|
|
||||||
.fi
|
|
||||||
.SH DESCRIPTION
|
|
||||||
The
|
|
||||||
.B ares_getnameinfo
|
|
||||||
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
|
|
||||||
translate the address either by executing a host query on the name service channel
|
|
||||||
identified by
|
|
||||||
.IR channel
|
|
||||||
or it will attempt to resolve it locally if possible.
|
|
||||||
The parameters
|
|
||||||
.I sa
|
|
||||||
and
|
|
||||||
.I len
|
|
||||||
give the address as a sockaddr structure, and
|
|
||||||
.I flags
|
|
||||||
gives the options that the function will use. Valid flags are listed below:
|
|
||||||
.TP 19
|
|
||||||
.B ARES_NI_NOFQDN
|
|
||||||
Only the nodename portion of the FQDN is returned for local hosts.
|
|
||||||
.TP 19
|
|
||||||
.B ARES_NI_NUMERICHOST
|
|
||||||
The numeric form of the hostname is returned rather than the name.
|
|
||||||
.TP 19
|
|
||||||
.B ARES_NI_NAMEREQD
|
|
||||||
An error is returned if the hostname cannot be found in the DNS.
|
|
||||||
.TP 19
|
|
||||||
.B ARES_NI_NUMERICSERV
|
|
||||||
The numeric form of the service is returned rather than the name.
|
|
||||||
.TP 19
|
|
||||||
.B ARES_NI_TCP
|
|
||||||
The service name is to be looked up for the TCP protocol.
|
|
||||||
.TP 19
|
|
||||||
.B ARES_NI_UDP
|
|
||||||
The service name is to be looked up for the UDP protocol.
|
|
||||||
.TP 19
|
|
||||||
.B ARES_NI_SCTP
|
|
||||||
The service name is to be looked up for the SCTP protocol.
|
|
||||||
.TP 19
|
|
||||||
.B ARES_NI_DCCP
|
|
||||||
The service name is to be looked up for the DCCP protocol.
|
|
||||||
.TP 19
|
|
||||||
.B ARES_NI_NUMERICSCOPE
|
|
||||||
The numeric form of the scope ID is returned rather than the name.
|
|
||||||
.TP 19
|
|
||||||
.B ARES_NI_LOOKUPHOST
|
|
||||||
A hostname lookup is being requested.
|
|
||||||
.TP 19
|
|
||||||
.B ARES_NI_LOOKUPSERVICE
|
|
||||||
A service name lookup is being requested.
|
|
||||||
.PP
|
|
||||||
When the query
|
|
||||||
is complete or has
|
|
||||||
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
|
|
||||||
\fIares_process(3)\fP, \fIares_destroy(3)\fP or \fIares_cancel(3)\fP.
|
|
||||||
.PP
|
|
||||||
The callback argument
|
|
||||||
.I arg
|
|
||||||
is copied from the
|
|
||||||
.B ares_getnameinfo
|
|
||||||
argument
|
|
||||||
.IR arg .
|
|
||||||
The callback argument
|
|
||||||
.I status
|
|
||||||
indicates whether the query succeeded and, if not, how it failed. It
|
|
||||||
may have any of the following values:
|
|
||||||
.TP 19
|
|
||||||
.B ARES_SUCCESS
|
|
||||||
The host lookup completed successfully.
|
|
||||||
.TP 19
|
|
||||||
.B ARES_ENOTIMP
|
|
||||||
The ares library does not know how to look up addresses of type
|
|
||||||
.IR family .
|
|
||||||
.TP 19
|
|
||||||
.B ARES_ENOTFOUND
|
|
||||||
The address
|
|
||||||
.I addr
|
|
||||||
was not found.
|
|
||||||
.TP 19
|
|
||||||
.B ARES_ENOMEM
|
|
||||||
Memory was exhausted.
|
|
||||||
.TP 19
|
|
||||||
.B ARES_EDESTRUCTION
|
|
||||||
The name service channel
|
|
||||||
.I channel
|
|
||||||
is being destroyed; the query will not be completed.
|
|
||||||
.TP 19
|
|
||||||
.B ARES_EBADFLAGS
|
|
||||||
The
|
|
||||||
.I flags
|
|
||||||
parameter contains an illegal value.
|
|
||||||
.PP
|
|
||||||
The callback argument
|
|
||||||
.I timeouts
|
|
||||||
reports how many times a query timed out during the execution of the
|
|
||||||
given request.
|
|
||||||
.PP
|
|
||||||
On successful completion of the query, the callback argument
|
|
||||||
.I node
|
|
||||||
contains a string representing the hostname (assuming
|
|
||||||
.B ARES_NI_LOOKUPHOST
|
|
||||||
was specified). Additionally,
|
|
||||||
.I service
|
|
||||||
contains a string representing the service name (assuming
|
|
||||||
.B ARES_NI_LOOKUPSERVICE
|
|
||||||
was specified).
|
|
||||||
If the query did not complete successfully, or one of the values
|
|
||||||
was not requested,
|
|
||||||
.I node
|
|
||||||
or
|
|
||||||
.I service
|
|
||||||
will be
|
|
||||||
.BR NULL .
|
|
||||||
.SH SEE ALSO
|
|
||||||
.BR ares_process (3),
|
|
||||||
.BR ares_getaddrinfo (3)
|
|
||||||
.SH AUTHOR
|
|
||||||
Dominick Meglio
|
|
||||||
.br
|
|
||||||
Copyright 2005 by Dominick Meglio.
|
|
||||||
@@ -1,414 +0,0 @@
|
|||||||
/* $Id$ */
|
|
||||||
|
|
||||||
/* Copyright 2005 by Dominick Meglio
|
|
||||||
*
|
|
||||||
* 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 "setup.h"
|
|
||||||
|
|
||||||
#ifdef HAVE_GETSERVBYPORT_R
|
|
||||||
# if !defined(GETSERVBYPORT_R_ARGS) || \
|
|
||||||
(GETSERVBYPORT_R_ARGS < 4) || (GETSERVBYPORT_R_ARGS > 6)
|
|
||||||
# error "you MUST specifiy a valid number of arguments for getservbyport_r"
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#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_NET_IF_H
|
|
||||||
#include <net/if.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_UNISTD_H
|
|
||||||
#include <unistd.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "ares.h"
|
|
||||||
#include "ares_ipv6.h"
|
|
||||||
#include "inet_ntop.h"
|
|
||||||
#include "ares_private.h"
|
|
||||||
|
|
||||||
#ifdef WATT32
|
|
||||||
#undef WIN32
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct nameinfo_query {
|
|
||||||
ares_nameinfo_callback callback;
|
|
||||||
void *arg;
|
|
||||||
union {
|
|
||||||
struct sockaddr_in addr4;
|
|
||||||
struct sockaddr_in6 addr6;
|
|
||||||
} addr;
|
|
||||||
int family;
|
|
||||||
int flags;
|
|
||||||
int timeouts;
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID
|
|
||||||
#define IPBUFSIZ 40+IF_NAMESIZE
|
|
||||||
#else
|
|
||||||
#define IPBUFSIZ 40
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void nameinfo_callback(void *arg, int status, int timeouts, struct hostent *host);
|
|
||||||
static char *lookup_service(unsigned short port, int flags,
|
|
||||||
char *buf, size_t buflen);
|
|
||||||
#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID
|
|
||||||
static void append_scopeid(struct sockaddr_in6 *addr6, unsigned int scopeid,
|
|
||||||
char *buf, size_t buflen);
|
|
||||||
#endif
|
|
||||||
static char *ares_striendstr(const char *s1, const char *s2);
|
|
||||||
|
|
||||||
void ares_getnameinfo(ares_channel channel, const struct sockaddr *sa,
|
|
||||||
ares_socklen_t salen,
|
|
||||||
int flags, ares_nameinfo_callback callback, void *arg)
|
|
||||||
{
|
|
||||||
struct sockaddr_in *addr = NULL;
|
|
||||||
struct sockaddr_in6 *addr6 = NULL;
|
|
||||||
struct nameinfo_query *niquery;
|
|
||||||
|
|
||||||
/* Verify the buffer size */
|
|
||||||
if (salen == sizeof(struct sockaddr_in))
|
|
||||||
addr = (struct sockaddr_in *)sa;
|
|
||||||
else if (salen == sizeof(struct sockaddr_in6))
|
|
||||||
addr6 = (struct sockaddr_in6 *)sa;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
callback(arg, ARES_ENOTIMP, 0, NULL, NULL);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If neither, assume they want a host */
|
|
||||||
if (!(flags & ARES_NI_LOOKUPSERVICE) && !(flags & ARES_NI_LOOKUPHOST))
|
|
||||||
flags |= ARES_NI_LOOKUPHOST;
|
|
||||||
|
|
||||||
/* All they want is a service, no need for DNS */
|
|
||||||
if ((flags & ARES_NI_LOOKUPSERVICE) && !(flags & ARES_NI_LOOKUPHOST))
|
|
||||||
{
|
|
||||||
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),
|
|
||||||
flags, buf, sizeof(buf));
|
|
||||||
callback(arg, ARES_SUCCESS, 0, NULL, service);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* They want a host lookup */
|
|
||||||
if ((flags & ARES_NI_LOOKUPHOST))
|
|
||||||
{
|
|
||||||
/* A numeric host can be handled without DNS */
|
|
||||||
if ((flags & ARES_NI_NUMERICHOST))
|
|
||||||
{
|
|
||||||
unsigned int port = 0;
|
|
||||||
char ipbuf[IPBUFSIZ];
|
|
||||||
char srvbuf[33];
|
|
||||||
char *service = NULL;
|
|
||||||
ipbuf[0] = 0;
|
|
||||||
|
|
||||||
/* Specifying not to lookup a host, but then saying a host
|
|
||||||
* is required has to be illegal.
|
|
||||||
*/
|
|
||||||
if (flags & ARES_NI_NAMEREQD)
|
|
||||||
{
|
|
||||||
callback(arg, ARES_EBADFLAGS, 0, NULL, NULL);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (salen == sizeof(struct sockaddr_in6))
|
|
||||||
{
|
|
||||||
ares_inet_ntop(AF_INET6, &addr6->sin6_addr, ipbuf, IPBUFSIZ);
|
|
||||||
port = addr6->sin6_port;
|
|
||||||
/* If the system supports scope IDs, use it */
|
|
||||||
#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID
|
|
||||||
append_scopeid(addr6, flags, ipbuf, sizeof(ipbuf));
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ares_inet_ntop(AF_INET, &addr->sin_addr, ipbuf, IPBUFSIZ);
|
|
||||||
port = addr->sin_port;
|
|
||||||
}
|
|
||||||
/* They also want a service */
|
|
||||||
if (flags & ARES_NI_LOOKUPSERVICE)
|
|
||||||
service = lookup_service((unsigned short)(port & 0xffff),
|
|
||||||
flags, srvbuf, sizeof(srvbuf));
|
|
||||||
callback(arg, ARES_SUCCESS, 0, ipbuf, service);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
/* This is where a DNS lookup becomes necessary */
|
|
||||||
else
|
|
||||||
{
|
|
||||||
niquery = malloc(sizeof(struct nameinfo_query));
|
|
||||||
if (!niquery)
|
|
||||||
{
|
|
||||||
callback(arg, ARES_ENOMEM, 0, NULL, NULL);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
niquery->callback = callback;
|
|
||||||
niquery->arg = arg;
|
|
||||||
niquery->flags = flags;
|
|
||||||
niquery->timeouts = 0;
|
|
||||||
if (sa->sa_family == AF_INET)
|
|
||||||
{
|
|
||||||
niquery->family = AF_INET;
|
|
||||||
memcpy(&niquery->addr.addr4, addr, sizeof(addr));
|
|
||||||
ares_gethostbyaddr(channel, &addr->sin_addr, sizeof(struct in_addr), AF_INET,
|
|
||||||
nameinfo_callback, niquery);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
niquery->family = AF_INET6;
|
|
||||||
memcpy(&niquery->addr.addr6, addr6, sizeof(addr6));
|
|
||||||
ares_gethostbyaddr(channel, &addr6->sin6_addr, sizeof(struct in6_addr), AF_INET6,
|
|
||||||
nameinfo_callback, niquery);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void nameinfo_callback(void *arg, int status, int timeouts, struct hostent *host)
|
|
||||||
{
|
|
||||||
struct nameinfo_query *niquery = (struct nameinfo_query *) arg;
|
|
||||||
char srvbuf[33];
|
|
||||||
char *service = NULL;
|
|
||||||
|
|
||||||
niquery->timeouts += timeouts;
|
|
||||||
if (status == ARES_SUCCESS)
|
|
||||||
{
|
|
||||||
/* They want a service too */
|
|
||||||
if (niquery->flags & ARES_NI_LOOKUPSERVICE)
|
|
||||||
{
|
|
||||||
if (niquery->family == AF_INET)
|
|
||||||
service = lookup_service(niquery->addr.addr4.sin_port,
|
|
||||||
niquery->flags, srvbuf, sizeof(srvbuf));
|
|
||||||
else
|
|
||||||
service = lookup_service(niquery->addr.addr6.sin6_port,
|
|
||||||
niquery->flags, srvbuf, sizeof(srvbuf));
|
|
||||||
}
|
|
||||||
/* NOFQDN means we have to strip off the domain name portion.
|
|
||||||
We do this by determining our own domain name, then searching the string
|
|
||||||
for this domain name and removing it.
|
|
||||||
*/
|
|
||||||
#ifdef HAVE_GETHOSTNAME
|
|
||||||
if (niquery->flags & ARES_NI_NOFQDN)
|
|
||||||
{
|
|
||||||
char buf[255];
|
|
||||||
char *domain;
|
|
||||||
gethostname(buf, 255);
|
|
||||||
if ((domain = strchr(buf, '.')))
|
|
||||||
{
|
|
||||||
char *end = ares_striendstr(host->h_name, domain);
|
|
||||||
if (end)
|
|
||||||
*end = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
niquery->callback(niquery->arg, ARES_SUCCESS, niquery->timeouts, (char *)(host->h_name),
|
|
||||||
service);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
/* We couldn't find the host, but it's OK, we can use the IP */
|
|
||||||
else if (status == ARES_ENOTFOUND && !(niquery->flags & ARES_NI_NAMEREQD))
|
|
||||||
{
|
|
||||||
char ipbuf[IPBUFSIZ];
|
|
||||||
if (niquery->family == AF_INET)
|
|
||||||
ares_inet_ntop(AF_INET, &niquery->addr.addr4.sin_addr, ipbuf, IPBUFSIZ);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ares_inet_ntop(AF_INET6, &niquery->addr.addr6.sin6_addr, ipbuf, IPBUFSIZ);
|
|
||||||
#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID
|
|
||||||
append_scopeid(&niquery->addr.addr6, niquery->flags, ipbuf, sizeof(ipbuf));
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
/* They want a service too */
|
|
||||||
if (niquery->flags & ARES_NI_LOOKUPSERVICE)
|
|
||||||
{
|
|
||||||
if (niquery->family == AF_INET)
|
|
||||||
service = lookup_service(niquery->addr.addr4.sin_port,
|
|
||||||
niquery->flags, srvbuf, sizeof(srvbuf));
|
|
||||||
else
|
|
||||||
service = lookup_service(niquery->addr.addr6.sin6_port,
|
|
||||||
niquery->flags, srvbuf, sizeof(srvbuf));
|
|
||||||
}
|
|
||||||
niquery->callback(niquery->arg, ARES_SUCCESS, niquery->timeouts, ipbuf, service);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
niquery->callback(niquery->arg, status, niquery->timeouts, NULL, NULL);
|
|
||||||
free(niquery);
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *lookup_service(unsigned short port, int flags,
|
|
||||||
char *buf, size_t buflen)
|
|
||||||
{
|
|
||||||
const char *proto;
|
|
||||||
struct servent *sep;
|
|
||||||
#ifdef HAVE_GETSERVBYPORT_R
|
|
||||||
struct servent se;
|
|
||||||
#endif
|
|
||||||
char tmpbuf[4096];
|
|
||||||
|
|
||||||
if (port)
|
|
||||||
{
|
|
||||||
if (flags & ARES_NI_NUMERICSERV)
|
|
||||||
sep = NULL;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (flags & ARES_NI_UDP)
|
|
||||||
proto = "udp";
|
|
||||||
else if (flags & ARES_NI_SCTP)
|
|
||||||
proto = "sctp";
|
|
||||||
else if (flags & ARES_NI_DCCP)
|
|
||||||
proto = "dccp";
|
|
||||||
else
|
|
||||||
proto = "tcp";
|
|
||||||
#ifdef HAVE_GETSERVBYPORT_R
|
|
||||||
sep = &se;
|
|
||||||
memset(tmpbuf, 0, sizeof(tmpbuf));
|
|
||||||
#if GETSERVBYPORT_R_ARGS == 6
|
|
||||||
if (getservbyport_r(port, proto, &se, (void *)tmpbuf, sizeof(tmpbuf), &sep) != 0)
|
|
||||||
sep = NULL;
|
|
||||||
#elif GETSERVBYPORT_R_ARGS == 5
|
|
||||||
sep = getservbyport_r(port, proto, &se, (void *)tmpbuf, sizeof(tmpbuf));
|
|
||||||
#elif GETSERVBYPORT_R_ARGS == 4
|
|
||||||
if (getservbyport_r(port, proto, &se, (void *)tmpbuf) != 0)
|
|
||||||
sep = NULL;
|
|
||||||
#else
|
|
||||||
/* Lets just hope the OS uses TLS! */
|
|
||||||
sep = getservbyport(port, proto);
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
/* Lets just hope the OS uses TLS! */
|
|
||||||
#if (defined(NETWARE) && !defined(__NOVELL_LIBC__))
|
|
||||||
sep = getservbyport(port, (char*)proto);
|
|
||||||
#else
|
|
||||||
sep = getservbyport(port, proto);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
if (sep && sep->s_name)
|
|
||||||
/* get service name */
|
|
||||||
strcpy(tmpbuf, sep->s_name);
|
|
||||||
else
|
|
||||||
/* get port as a string */
|
|
||||||
sprintf(tmpbuf, "%u", (unsigned int)ntohs(port));
|
|
||||||
if (strlen(tmpbuf) < buflen)
|
|
||||||
/* return it if buffer big enough */
|
|
||||||
strcpy(buf, tmpbuf);
|
|
||||||
else
|
|
||||||
/* avoid reusing previous one */
|
|
||||||
buf[0] = '\0';
|
|
||||||
return buf;
|
|
||||||
}
|
|
||||||
buf[0] = '\0';
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID
|
|
||||||
static void append_scopeid(struct sockaddr_in6 *addr6, unsigned int flags,
|
|
||||||
char *buf, size_t buflen)
|
|
||||||
{
|
|
||||||
#ifdef HAVE_IF_INDEXTONAME
|
|
||||||
int is_ll, is_mcll;
|
|
||||||
#endif
|
|
||||||
char fmt_u[] = "%u";
|
|
||||||
char fmt_lu[] = "%lu";
|
|
||||||
char tmpbuf[IF_NAMESIZE + 2];
|
|
||||||
size_t bufl;
|
|
||||||
char *fmt = (sizeof(addr6->sin6_scope_id) > sizeof(unsigned int))?fmt_lu:fmt_u;
|
|
||||||
|
|
||||||
tmpbuf[0] = '%';
|
|
||||||
|
|
||||||
#ifdef HAVE_IF_INDEXTONAME
|
|
||||||
is_ll = IN6_IS_ADDR_LINKLOCAL(&addr6->sin6_addr);
|
|
||||||
is_mcll = IN6_IS_ADDR_MC_LINKLOCAL(&addr6->sin6_addr);
|
|
||||||
if ((flags & ARES_NI_NUMERICSCOPE) ||
|
|
||||||
(!is_ll && !is_mcll))
|
|
||||||
{
|
|
||||||
sprintf(&tmpbuf[1], fmt, addr6->sin6_scope_id);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (if_indextoname(addr6->sin6_scope_id, &tmpbuf[1]) == NULL)
|
|
||||||
sprintf(&tmpbuf[1], fmt, addr6->sin6_scope_id);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
sprintf(&tmpbuf[1], fmt, addr6->sin6_scope_id);
|
|
||||||
(void) flags;
|
|
||||||
#endif
|
|
||||||
tmpbuf[IF_NAMESIZE + 1] = '\0';
|
|
||||||
bufl = strlen(buf);
|
|
||||||
|
|
||||||
if(bufl + strlen(tmpbuf) < buflen)
|
|
||||||
/* only append the scopeid string if it fits in the target buffer */
|
|
||||||
strcpy(&buf[bufl], tmpbuf);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Determines if s1 ends with the string in s2 (case-insensitive) */
|
|
||||||
static char *ares_striendstr(const char *s1, const char *s2)
|
|
||||||
{
|
|
||||||
const char *c1, *c2, *c1_begin;
|
|
||||||
int lo1, lo2;
|
|
||||||
size_t s1_len = strlen(s1), s2_len = strlen(s2);
|
|
||||||
|
|
||||||
/* If the substr is longer than the full str, it can't match */
|
|
||||||
if (s2_len > s1_len)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
/* Jump to the end of s1 minus the length of s2 */
|
|
||||||
c1_begin = s1+s1_len-s2_len;
|
|
||||||
c1 = (const char *)c1_begin;
|
|
||||||
c2 = s2;
|
|
||||||
while (c2 < s2+s2_len)
|
|
||||||
{
|
|
||||||
lo1 = tolower(*c1);
|
|
||||||
lo2 = tolower(*c2);
|
|
||||||
if (lo1 != lo2)
|
|
||||||
return NULL;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
c1++;
|
|
||||||
c2++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (c2 == c1 && c2 == NULL)
|
|
||||||
return (char *)c1_begin;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
@@ -1,123 +0,0 @@
|
|||||||
/*
|
|
||||||
* Original file name getopt.c Initial import into the c-ares source tree
|
|
||||||
* on 2007-04-11. Lifted from version 5.2 of the 'Open Mash' project with
|
|
||||||
* the modified BSD license, BSD license without the advertising clause.
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* getopt.c --
|
|
||||||
*
|
|
||||||
* Standard UNIX getopt function. Code is from BSD.
|
|
||||||
*
|
|
||||||
* Copyright (c) 1987-2001 The Regents of the University of California.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* A. Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* B. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* C. Neither the names of the copyright holders nor the names of its
|
|
||||||
* contributors may be used to endorse or promote products derived from this
|
|
||||||
* software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
|
|
||||||
* IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
|
|
||||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* #if !defined(lint)
|
|
||||||
* static char sccsid[] = "@(#)getopt.c 8.2 (Berkeley) 4/2/94";
|
|
||||||
* #endif
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include "ares_getopt.h"
|
|
||||||
|
|
||||||
int opterr = 1, /* if error message should be printed */
|
|
||||||
optind = 1, /* index into parent argv vector */
|
|
||||||
optopt, /* character checked for validity */
|
|
||||||
optreset; /* reset getopt */
|
|
||||||
char *optarg; /* argument associated with option */
|
|
||||||
|
|
||||||
#define BADCH (int)'?'
|
|
||||||
#define BADARG (int)':'
|
|
||||||
#define EMSG (char *)""
|
|
||||||
|
|
||||||
/*
|
|
||||||
* ares_getopt --
|
|
||||||
* Parse argc/argv argument vector.
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
ares_getopt(int nargc, char * const nargv[], const char *ostr)
|
|
||||||
{
|
|
||||||
static char *place = EMSG; /* option letter processing */
|
|
||||||
char *oli; /* option letter list index */
|
|
||||||
|
|
||||||
if (optreset || !*place) { /* update scanning pointer */
|
|
||||||
optreset = 0;
|
|
||||||
if (optind >= nargc || *(place = nargv[optind]) != '-') {
|
|
||||||
place = EMSG;
|
|
||||||
return (EOF);
|
|
||||||
}
|
|
||||||
if (place[1] && *++place == '-') { /* found "--" */
|
|
||||||
++optind;
|
|
||||||
place = EMSG;
|
|
||||||
return (EOF);
|
|
||||||
}
|
|
||||||
} /* option letter okay? */
|
|
||||||
if ((optopt = (int)*place++) == (int)':' ||
|
|
||||||
(oli = strchr(ostr, optopt)) == NULL) {
|
|
||||||
/*
|
|
||||||
* if the user didn't specify '-' as an option,
|
|
||||||
* assume it means EOF.
|
|
||||||
*/
|
|
||||||
if (optopt == (int)'-')
|
|
||||||
return (EOF);
|
|
||||||
if (!*place)
|
|
||||||
++optind;
|
|
||||||
if (opterr && *ostr != ':')
|
|
||||||
(void)fprintf(stderr,
|
|
||||||
"%s: illegal option -- %c\n", __FILE__, optopt);
|
|
||||||
return (BADCH);
|
|
||||||
}
|
|
||||||
if (*++oli != ':') { /* don't need argument */
|
|
||||||
optarg = NULL;
|
|
||||||
if (!*place)
|
|
||||||
++optind;
|
|
||||||
}
|
|
||||||
else { /* need an argument */
|
|
||||||
if (*place) /* no white space */
|
|
||||||
optarg = place;
|
|
||||||
else if (nargc <= ++optind) { /* no arg */
|
|
||||||
place = EMSG;
|
|
||||||
if (*ostr == ':')
|
|
||||||
return (BADARG);
|
|
||||||
if (opterr)
|
|
||||||
(void)fprintf(stderr,
|
|
||||||
"%s: option requires an argument -- %c\n",
|
|
||||||
__FILE__, optopt);
|
|
||||||
return (BADCH);
|
|
||||||
}
|
|
||||||
else /* white space */
|
|
||||||
optarg = nargv[optind];
|
|
||||||
place = EMSG;
|
|
||||||
++optind;
|
|
||||||
}
|
|
||||||
return (optopt); /* dump back option letter */
|
|
||||||
}
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
#ifndef ARES_GETOPT_H
|
|
||||||
#define ARES_GETOPT_H
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright (c) 1987-2001 The Regents of the University of California.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* A. Redistributions of source code must retain the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer.
|
|
||||||
* B. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
* C. Neither the names of the copyright holders nor the names of its
|
|
||||||
* contributors may be used to endorse or promote products derived from this
|
|
||||||
* software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
|
|
||||||
* IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
|
|
||||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
int ares_getopt(int nargc, char * const nargv[], const char *ostr);
|
|
||||||
|
|
||||||
#if defined(WATT32)
|
|
||||||
#undef optarg
|
|
||||||
#undef optind
|
|
||||||
#undef opterr
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern char *optarg;
|
|
||||||
extern int optind;
|
|
||||||
extern int opterr;
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* ARES_GETOPT_H */
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
.\" $Id$
|
|
||||||
.\"
|
|
||||||
.\" Copyright 1998 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_GETSOCK 3 "22 December 2005"
|
|
||||||
.SH NAME
|
|
||||||
ares_getsock \- get file descriptors to wait on
|
|
||||||
.SH SYNOPSIS
|
|
||||||
.nf
|
|
||||||
.B #include <ares.h>
|
|
||||||
.PP
|
|
||||||
.B int ares_getsock(ares_channel \fIchannel\fP, int *\fIsocks\fP,
|
|
||||||
.B int \fInumsocks\fP);
|
|
||||||
.fi
|
|
||||||
.SH DESCRIPTION
|
|
||||||
The
|
|
||||||
.B ares_getsock
|
|
||||||
function retrieves the set of file descriptors which the calling
|
|
||||||
application should wait on for reading and/or writing for the
|
|
||||||
processing of name service queries pending on the name service channel
|
|
||||||
identified by
|
|
||||||
.IR channel .
|
|
||||||
File descriptors will be set in the integer array pointed to by
|
|
||||||
\fIsocks\fP.
|
|
||||||
\fInumsocks\fP is the size of the given array in number of ints.
|
|
||||||
|
|
||||||
This function can only return information about up to 16 sockets. If more are
|
|
||||||
in use (however unlikely that is), they are simply not reported back.
|
|
||||||
.SH RETURN VALUES
|
|
||||||
\fBares_getsock\fP returns a bitmask for what actions to wait for on the
|
|
||||||
different sockets. The ares.h header file provides these convenience macros to
|
|
||||||
extract the information appropriately:
|
|
||||||
|
|
||||||
.nf
|
|
||||||
#define ARES_GETSOCK_MAXNUM 16 /* ares_getsock() can return info about
|
|
||||||
this many sockets */
|
|
||||||
#define ARES_GETSOCK_READABLE(bits,num) (bits & (1<< (num)))
|
|
||||||
#define ARES_GETSOCK_WRITABLE(bits,num) (bits & (1 << ((num) + \
|
|
||||||
ARES_GETSOCK_MAXNUM)))
|
|
||||||
.fi
|
|
||||||
.SH NOTES
|
|
||||||
This function was added in c-ares 1.3.1
|
|
||||||
.SH SEE ALSO
|
|
||||||
.BR ares_timeout (3),
|
|
||||||
.BR ares_fds (3),
|
|
||||||
.BR ares_process (3)
|
|
||||||
@@ -1,75 +0,0 @@
|
|||||||
/* $Id$ */
|
|
||||||
|
|
||||||
/* Copyright (C) 2005 - 2007, 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 "setup.h"
|
|
||||||
|
|
||||||
#ifdef HAVE_SYS_TIME_H
|
|
||||||
#include <sys/time.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "ares.h"
|
|
||||||
#include "ares_private.h"
|
|
||||||
|
|
||||||
int ares_getsock(ares_channel channel,
|
|
||||||
int *s,
|
|
||||||
int numsocks) /* size of the 'socks' array */
|
|
||||||
{
|
|
||||||
struct server_state *server;
|
|
||||||
int i;
|
|
||||||
int sockindex=0;
|
|
||||||
int bitmap = 0;
|
|
||||||
unsigned int setbits = 0xffffffff;
|
|
||||||
|
|
||||||
ares_socket_t *socks = (ares_socket_t *)s;
|
|
||||||
|
|
||||||
/* Are there any active queries? */
|
|
||||||
int active_queries = !ares__is_list_empty(&(channel->all_queries));
|
|
||||||
|
|
||||||
for (i = 0;
|
|
||||||
(i < channel->nservers) && (sockindex < ARES_GETSOCK_MAXNUM);
|
|
||||||
i++)
|
|
||||||
{
|
|
||||||
server = &channel->servers[i];
|
|
||||||
/* We only need to register interest in UDP sockets if we have
|
|
||||||
* outstanding queries.
|
|
||||||
*/
|
|
||||||
if (active_queries && server->udp_socket != ARES_SOCKET_BAD)
|
|
||||||
{
|
|
||||||
if(sockindex >= numsocks)
|
|
||||||
break;
|
|
||||||
socks[sockindex] = server->udp_socket;
|
|
||||||
bitmap |= ARES_GETSOCK_READABLE(setbits, sockindex);
|
|
||||||
sockindex++;
|
|
||||||
}
|
|
||||||
/* We always register for TCP events, because we want to know
|
|
||||||
* when the other side closes the connection, so we don't waste
|
|
||||||
* time trying to use a broken connection.
|
|
||||||
*/
|
|
||||||
if (server->tcp_socket != ARES_SOCKET_BAD)
|
|
||||||
{
|
|
||||||
if(sockindex >= numsocks)
|
|
||||||
break;
|
|
||||||
socks[sockindex] = server->tcp_socket;
|
|
||||||
bitmap |= ARES_GETSOCK_READABLE(setbits, sockindex);
|
|
||||||
|
|
||||||
if (server->qhead && active_queries)
|
|
||||||
/* then the tcp socket is also writable! */
|
|
||||||
bitmap |= ARES_GETSOCK_WRITABLE(setbits, sockindex);
|
|
||||||
|
|
||||||
sockindex++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return bitmap;
|
|
||||||
}
|
|
||||||
193
ares/ares_init.3
193
ares/ares_init.3
@@ -1,193 +0,0 @@
|
|||||||
.\" $Id$
|
|
||||||
.\"
|
|
||||||
.\" Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||||
.\" Copyright (C) 2007-2008 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_INIT 3 "13 May 2008"
|
|
||||||
.SH NAME
|
|
||||||
ares_init, ares_init_options \- Initialize a resolver channel
|
|
||||||
.SH SYNOPSIS
|
|
||||||
.nf
|
|
||||||
.B #include <ares.h>
|
|
||||||
.PP
|
|
||||||
.B int ares_init(ares_channel *\fIchannel\fP)
|
|
||||||
.B int ares_init_options(ares_channel *\fIchannel\fP,
|
|
||||||
.B struct ares_options *\fIoptions\fP, int \fIoptmask\fP)
|
|
||||||
.PP
|
|
||||||
.B cc file.c -lcares
|
|
||||||
.fi
|
|
||||||
.SH DESCRIPTION
|
|
||||||
The \fBares_init\fP function initializes a communications channel for name
|
|
||||||
service lookups. If it returns successfully, \fBares_init\fP will set the
|
|
||||||
variable pointed to by \fIchannel\fP to a handle used to identify the name
|
|
||||||
service channel. The caller should invoke
|
|
||||||
.BR ares_destroy (3)
|
|
||||||
on the handle when the channel is no longer needed.
|
|
||||||
.PP
|
|
||||||
The \fBares_init_options\fP function also initializes a name service channel,
|
|
||||||
with additional options useful for applications requiring more control over
|
|
||||||
name service configuration. The \fIoptmask\fP parameter specifies which fields
|
|
||||||
in the structure pointed to by \fIoptions\fP are set, as follows:
|
|
||||||
.TP 18
|
|
||||||
.B ARES_OPT_FLAGS
|
|
||||||
.B int \fIflags\fP;
|
|
||||||
.br
|
|
||||||
Flags controlling the behavior of the resolver. See below for a
|
|
||||||
description of possible flag values.
|
|
||||||
.TP 18
|
|
||||||
.B ARES_OPT_TIMEOUT
|
|
||||||
.B int \fItimeout\fP;
|
|
||||||
.br
|
|
||||||
The number of seconds each name server is given to respond to a query on the
|
|
||||||
first try. (After the first try, the timeout algorithm becomes more
|
|
||||||
complicated, but scales linearly with the value of \fItimeout\fP.) The
|
|
||||||
default is five seconds. This option is being deprecated by
|
|
||||||
\fIARES_OPT_TIMEOUTMS\fP starting in c-ares 1.5.2.
|
|
||||||
.TP 18
|
|
||||||
.B ARES_OPT_TIMEOUTMS
|
|
||||||
.B int \fItimeout\fP;
|
|
||||||
.br
|
|
||||||
The number of milliseconds each name server is given to respond to a query on
|
|
||||||
the first try. (After the first try, the timeout algorithm becomes more
|
|
||||||
complicated, but scales linearly with the value of \fItimeout\fP.) The
|
|
||||||
default is five seconds. Note that this option is specified with the same
|
|
||||||
struct field as the former \fIARES_OPT_TIMEOUT\fP, it is but the option bits
|
|
||||||
that tell c-ares how to interpret the number. This option was added in c-ares
|
|
||||||
1.5.2.
|
|
||||||
.TP 18
|
|
||||||
.B ARES_OPT_TRIES
|
|
||||||
.B int \fItries\fP;
|
|
||||||
.br
|
|
||||||
The number of tries the resolver will try contacting each name server
|
|
||||||
before giving up. The default is four tries.
|
|
||||||
.TP 18
|
|
||||||
.B ARES_OPT_NDOTS
|
|
||||||
.B int \fIndots\fP;
|
|
||||||
.br
|
|
||||||
The number of dots which must be present in a domain name for it to be
|
|
||||||
queried for "as is" prior to querying for it with the default domain
|
|
||||||
extensions appended. The default value is 1 unless set otherwise by
|
|
||||||
resolv.conf or the RES_OPTIONS environment variable.
|
|
||||||
.TP 18
|
|
||||||
.B ARES_OPT_PORT
|
|
||||||
.B unsigned short \fIport\fP;
|
|
||||||
.br
|
|
||||||
The port to use for queries (both TCP and UDP), in network byte order.
|
|
||||||
The default value is 53 (in network byte order), the standard name
|
|
||||||
service port.
|
|
||||||
.TP 18
|
|
||||||
.B ARES_OPT_SERVERS
|
|
||||||
.B struct in_addr *\fIservers\fP;
|
|
||||||
.br
|
|
||||||
.B int \fInservers\fP;
|
|
||||||
.br
|
|
||||||
The list of servers to contact, instead of the servers specified in
|
|
||||||
resolv.conf or the local named.
|
|
||||||
.TP 18
|
|
||||||
.B ARES_OPT_DOMAINS
|
|
||||||
.B char **\fIdomains\fP;
|
|
||||||
.br
|
|
||||||
.B int \fIndomains\fP;
|
|
||||||
.br
|
|
||||||
The domains to search, instead of the domains specified in resolv.conf
|
|
||||||
or the domain derived from the kernel hostname variable.
|
|
||||||
.TP 18
|
|
||||||
.B ARES_OPT_LOOKUPS
|
|
||||||
.B char *\fIlookups\fP;
|
|
||||||
.br
|
|
||||||
The lookups to perform for host queries.
|
|
||||||
.I lookups
|
|
||||||
should be set to a string of the characters "b" or "f", where "b"
|
|
||||||
indicates a DNS lookup and "f" indicates a lookup in the hosts file.
|
|
||||||
.TP 18
|
|
||||||
.B ARES_OPT_SOCK_STATE_CB
|
|
||||||
.B void (*\fIsock_state_cb\fP)(void *data, int s, int read, int write);
|
|
||||||
.br
|
|
||||||
.B void *\fIsock_state_cb_data\fP;
|
|
||||||
.br
|
|
||||||
A callback function to be invoked when a socket changes state.
|
|
||||||
.I s
|
|
||||||
will be passed the socket whose state has changed;
|
|
||||||
.I read
|
|
||||||
will be set to true if the socket should listen for read events, and
|
|
||||||
.I write
|
|
||||||
will be set to true if the socket should listen for write events.
|
|
||||||
The value of
|
|
||||||
.I sock_state_cb_data
|
|
||||||
will be passed as the
|
|
||||||
.I data
|
|
||||||
argument.
|
|
||||||
.PP
|
|
||||||
The
|
|
||||||
.I flags
|
|
||||||
field should be the bitwise or of some subset of the following values:
|
|
||||||
.TP 23
|
|
||||||
.B ARES_FLAG_USEVC
|
|
||||||
Always use TCP queries (the "virtual circuit") instead of UDP
|
|
||||||
queries. Normally, TCP is only used if a UDP query yields a truncated
|
|
||||||
result.
|
|
||||||
.TP 23
|
|
||||||
.B ARES_FLAG_PRIMARY
|
|
||||||
Only query the first server in the list of servers to query.
|
|
||||||
.TP 23
|
|
||||||
.B ARES_FLAG_IGNTC
|
|
||||||
If a truncated response to a UDP query is received, do not fall back
|
|
||||||
to TCP; simply continue on with the truncated response.
|
|
||||||
.TP 23
|
|
||||||
.B ARES_FLAG_NORECURSE
|
|
||||||
Do not set the "recursion desired" bit on outgoing queries, so that the name
|
|
||||||
server being contacted will not try to fetch the answer from other servers if
|
|
||||||
it doesn't know the answer locally. Be aware that ares will not do the
|
|
||||||
recursion for you. Recursion must be handled by the application calling ares
|
|
||||||
if \fIARES_FLAG_NORECURSE\fP is set.
|
|
||||||
.TP 23
|
|
||||||
.B ARES_FLAG_STAYOPEN
|
|
||||||
Do not close communications sockets when the number of active queries
|
|
||||||
drops to zero.
|
|
||||||
.TP 23
|
|
||||||
.B ARES_FLAG_NOSEARCH
|
|
||||||
Do not use the default search domains; only query hostnames as-is or
|
|
||||||
as aliases.
|
|
||||||
.TP 23
|
|
||||||
.B ARES_FLAG_NOALIASES
|
|
||||||
Do not honor the HOSTALIASES environment variable, which normally
|
|
||||||
specifies a file of hostname translations.
|
|
||||||
.TP 23
|
|
||||||
.B ARES_FLAG_NOCHECKRESP
|
|
||||||
Do not discard responses with the SERVFAIL, NOTIMP, or REFUSED
|
|
||||||
response code or responses whose questions don't match the questions
|
|
||||||
in the request. Primarily useful for writing clients which might be
|
|
||||||
used to test or debug name servers.
|
|
||||||
.SH RETURN VALUES
|
|
||||||
.I ares_init
|
|
||||||
or
|
|
||||||
.I ares_init_options
|
|
||||||
can return any of the following values:
|
|
||||||
.TP 14
|
|
||||||
.B ARES_SUCCESS
|
|
||||||
Initialization succeeded.
|
|
||||||
.TP 14
|
|
||||||
.B ARES_EFILE
|
|
||||||
A configuration file could not be read.
|
|
||||||
.TP 14
|
|
||||||
.B ARES_ENOMEM
|
|
||||||
The process's available memory was exhausted.
|
|
||||||
.SH SEE ALSO
|
|
||||||
.BR ares_destroy(3),
|
|
||||||
.BR ares_dup(3)
|
|
||||||
.SH AUTHOR
|
|
||||||
Greg Hudson, MIT Information Systems
|
|
||||||
.br
|
|
||||||
Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||||
1557
ares/ares_init.c
1557
ares/ares_init.c
File diff suppressed because it is too large
Load Diff
@@ -1,2 +0,0 @@
|
|||||||
.so man3/ares_init.3
|
|
||||||
.\" $Id$
|
|
||||||
@@ -1,84 +0,0 @@
|
|||||||
/* $Id$ */
|
|
||||||
|
|
||||||
/* Copyright (C) 2005 by Dominick Meglio
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef ARES_IPV6_H
|
|
||||||
#define ARES_IPV6_H
|
|
||||||
|
|
||||||
#ifndef HAVE_PF_INET6
|
|
||||||
#define PF_INET6 AF_INET6
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(HAVE_STRUCT_IN6_ADDR) && !defined(s6_addr)
|
|
||||||
struct in6_addr {
|
|
||||||
union {
|
|
||||||
unsigned char _S6_u8[16];
|
|
||||||
} _S6_un;
|
|
||||||
};
|
|
||||||
#define s6_addr _S6_un._S6_u8
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef HAVE_STRUCT_SOCKADDR_IN6
|
|
||||||
struct sockaddr_in6
|
|
||||||
{
|
|
||||||
unsigned short sin6_family;
|
|
||||||
unsigned short sin6_port;
|
|
||||||
unsigned long sin6_flowinfo;
|
|
||||||
struct in6_addr sin6_addr;
|
|
||||||
unsigned int sin6_scope_id;
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef HAVE_STRUCT_ADDRINFO
|
|
||||||
struct addrinfo
|
|
||||||
{
|
|
||||||
int ai_flags;
|
|
||||||
int ai_family;
|
|
||||||
int ai_socktype;
|
|
||||||
int ai_protocol;
|
|
||||||
ares_socklen_t ai_addrlen; /* Follow rfc3493 struct addrinfo */
|
|
||||||
char *ai_canonname;
|
|
||||||
struct sockaddr *ai_addr;
|
|
||||||
struct addrinfo *ai_next;
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef NS_IN6ADDRSZ
|
|
||||||
#if SIZEOF_STRUCT_IN6_ADDR == 0
|
|
||||||
/* We cannot have it set to zero, so we pick a fixed value here */
|
|
||||||
#define NS_IN6ADDRSZ 16
|
|
||||||
#else
|
|
||||||
#define NS_IN6ADDRSZ SIZEOF_STRUCT_IN6_ADDR
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef NS_INADDRSZ
|
|
||||||
#define NS_INADDRSZ SIZEOF_STRUCT_IN_ADDR
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef NS_INT16SZ
|
|
||||||
#define NS_INT16SZ 2
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef IF_NAMESIZE
|
|
||||||
#ifdef IFNAMSIZ
|
|
||||||
#define IF_NAMESIZE IFNAMSIZ
|
|
||||||
#else
|
|
||||||
#define IF_NAMESIZE 256
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* ARES_IPV6_H */
|
|
||||||
@@ -1,109 +0,0 @@
|
|||||||
/* $Id$ */
|
|
||||||
|
|
||||||
#include "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;
|
|
||||||
}
|
|
||||||
|
|
||||||
hnd_advapi32 = 0;
|
|
||||||
hnd_advapi32 = LoadLibrary("advapi32.dll");
|
|
||||||
if (!hnd_advapi32)
|
|
||||||
{
|
|
||||||
FreeLibrary(hnd_iphlpapi);
|
|
||||||
return ARES_ELOADADVAPI32;
|
|
||||||
}
|
|
||||||
|
|
||||||
fpSystemFunction036 = (fpSystemFunction036_t)
|
|
||||||
GetProcAddress(hnd_advapi32, "SystemFunction036");
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Intentionally avoid checking if the address of SystemFunction036, a.k.a.
|
|
||||||
* RtlGenRandom, has been located or not. This function is only available on
|
|
||||||
* WinXP and later. When unavailable c-ares uses portable rand() function.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#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;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
#ifndef HEADER_CARES_LIBRARY_INIT_H
|
|
||||||
#define HEADER_CARES_LIBRARY_INIT_H
|
|
||||||
|
|
||||||
/* $Id$ */
|
|
||||||
|
|
||||||
#include "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 */
|
|
||||||
|
|
||||||
@@ -1,87 +0,0 @@
|
|||||||
/* $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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "setup.h"
|
|
||||||
|
|
||||||
#include "ares.h"
|
|
||||||
#include "ares_private.h"
|
|
||||||
|
|
||||||
/* Routines for managing doubly-linked circular linked lists with a
|
|
||||||
* dummy head.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Initialize a new head node */
|
|
||||||
void ares__init_list_head(struct list_node* head) {
|
|
||||||
head->prev = head;
|
|
||||||
head->next = head;
|
|
||||||
head->data = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initialize a list node */
|
|
||||||
void ares__init_list_node(struct list_node* node, void* d) {
|
|
||||||
node->prev = NULL;
|
|
||||||
node->next = NULL;
|
|
||||||
node->data = d;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Returns true iff the given list is empty */
|
|
||||||
int ares__is_list_empty(struct list_node* head) {
|
|
||||||
return ((head->next == head) && (head->prev == head));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Inserts new_node before old_node */
|
|
||||||
void ares__insert_in_list(struct list_node* new_node,
|
|
||||||
struct list_node* old_node) {
|
|
||||||
new_node->next = old_node;
|
|
||||||
new_node->prev = old_node->prev;
|
|
||||||
old_node->prev->next = new_node;
|
|
||||||
old_node->prev = new_node;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Removes the node from the list it's in, if any */
|
|
||||||
void ares__remove_from_list(struct list_node* node) {
|
|
||||||
if (node->next != NULL) {
|
|
||||||
node->prev->next = node->next;
|
|
||||||
node->next->prev = node->prev;
|
|
||||||
node->prev = NULL;
|
|
||||||
node->next = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Swap the contents of two lists */
|
|
||||||
void ares__swap_lists(struct list_node* head_a,
|
|
||||||
struct list_node* head_b) {
|
|
||||||
int is_a_empty = ares__is_list_empty(head_a);
|
|
||||||
int is_b_empty = ares__is_list_empty(head_b);
|
|
||||||
struct list_node old_a = *head_a;
|
|
||||||
struct list_node old_b = *head_b;
|
|
||||||
|
|
||||||
if (is_a_empty) {
|
|
||||||
ares__init_list_head(head_b);
|
|
||||||
} else {
|
|
||||||
*head_b = old_a;
|
|
||||||
old_a.next->prev = head_b;
|
|
||||||
old_a.prev->next = head_b;
|
|
||||||
}
|
|
||||||
if (is_b_empty) {
|
|
||||||
ares__init_list_head(head_a);
|
|
||||||
} else {
|
|
||||||
*head_a = old_b;
|
|
||||||
old_b.next->prev = head_a;
|
|
||||||
old_b.prev->next = head_a;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
#ifndef __ARES_LLIST_H
|
|
||||||
#define __ARES_LLIST_H
|
|
||||||
|
|
||||||
/* $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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/* Node definition for circular, doubly-linked list */
|
|
||||||
struct list_node {
|
|
||||||
struct list_node *prev;
|
|
||||||
struct list_node *next;
|
|
||||||
void* data;
|
|
||||||
};
|
|
||||||
|
|
||||||
void ares__init_list_head(struct list_node* head);
|
|
||||||
|
|
||||||
void ares__init_list_node(struct list_node* node, void* d);
|
|
||||||
|
|
||||||
int ares__is_list_empty(struct list_node* head);
|
|
||||||
|
|
||||||
void ares__insert_in_list(struct list_node* new_node,
|
|
||||||
struct list_node* old_node);
|
|
||||||
|
|
||||||
void ares__remove_from_list(struct list_node* node);
|
|
||||||
|
|
||||||
void ares__swap_lists(struct list_node* head_a,
|
|
||||||
struct list_node* head_b);
|
|
||||||
|
|
||||||
#endif /* __ARES_LLIST_H */
|
|
||||||
@@ -1,76 +0,0 @@
|
|||||||
.\" $Id$
|
|
||||||
.\"
|
|
||||||
.\" Copyright 1998, 2000 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_MKQUERY 3 "4 January 2000"
|
|
||||||
.SH NAME
|
|
||||||
ares_mkquery \- Compose a single-question DNS query buffer
|
|
||||||
.SH SYNOPSIS
|
|
||||||
.nf
|
|
||||||
.B #include <ares.h>
|
|
||||||
.PP
|
|
||||||
.B int ares_mkquery(const char *\fIname\fP, int \fIdnsclass\fP, int \fItype\fP,
|
|
||||||
.B unsigned short \fIid\fP, int \fIrd\fP, char **\fIbuf\fP,
|
|
||||||
.B int *\fIbuflen\fP)
|
|
||||||
.fi
|
|
||||||
.SH DESCRIPTION
|
|
||||||
The
|
|
||||||
.B ares_mkquery
|
|
||||||
function composes a DNS query with a single question.
|
|
||||||
The parameter
|
|
||||||
.I name
|
|
||||||
gives the query name as a NUL-terminated C string of period-separated
|
|
||||||
labels optionally ending with a period; periods and backslashes within
|
|
||||||
a label must be escaped with a backlash. The parameters
|
|
||||||
.I dnsclass
|
|
||||||
and
|
|
||||||
.I type
|
|
||||||
give the class and type of the query using the values defined in
|
|
||||||
.BR <arpa/nameser.h> .
|
|
||||||
The parameter
|
|
||||||
.I id
|
|
||||||
gives a 16-bit identifier for the query. The parameter
|
|
||||||
.I rd
|
|
||||||
should be nonzero if recursion is desired, zero if not. The query
|
|
||||||
will be placed in an allocated buffer, a pointer to which will be
|
|
||||||
stored in the variable pointed to by
|
|
||||||
.IR buf ,
|
|
||||||
and the length of which will be stored in the variable pointed to by
|
|
||||||
.IR buflen .
|
|
||||||
It is the caller's responsibility to free this buffer using
|
|
||||||
\fIares_free_string(3)\fP when it is no longer needed.
|
|
||||||
.SH RETURN VALUES
|
|
||||||
.B ares_mkquery
|
|
||||||
can return any of the following values:
|
|
||||||
.TP 15
|
|
||||||
.B ARES_SUCCESS
|
|
||||||
Construction of the DNS query succeeded.
|
|
||||||
.TP 15
|
|
||||||
.B ARES_EBADNAME
|
|
||||||
The query name
|
|
||||||
.I name
|
|
||||||
could not be encoded as a domain name, either because it contained a
|
|
||||||
zero-length label or because it contained a label of more than 63
|
|
||||||
characters.
|
|
||||||
.TP 15
|
|
||||||
.B ARES_ENOMEM
|
|
||||||
Memory was exhausted.
|
|
||||||
.SH SEE ALSO
|
|
||||||
.BR ares_expand_name (3),
|
|
||||||
.BR ares_free_string (3)
|
|
||||||
.SH AUTHOR
|
|
||||||
Greg Hudson, MIT Information Systems
|
|
||||||
.br
|
|
||||||
Copyright 1998, 2000 by the Massachusetts Institute of Technology.
|
|
||||||
@@ -1,196 +0,0 @@
|
|||||||
/* $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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "setup.h"
|
|
||||||
|
|
||||||
#ifdef HAVE_SYS_SOCKET_H
|
|
||||||
# include <sys/socket.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_NETINET_IN_H
|
|
||||||
# include <netinet/in.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"
|
|
||||||
|
|
||||||
/* Header format, from RFC 1035:
|
|
||||||
* 1 1 1 1 1 1
|
|
||||||
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
|
|
||||||
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|
|
||||||
* | ID |
|
|
||||||
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|
|
||||||
* |QR| Opcode |AA|TC|RD|RA| Z | RCODE |
|
|
||||||
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|
|
||||||
* | QDCOUNT |
|
|
||||||
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|
|
||||||
* | ANCOUNT |
|
|
||||||
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|
|
||||||
* | NSCOUNT |
|
|
||||||
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|
|
||||||
* | ARCOUNT |
|
|
||||||
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|
|
||||||
*
|
|
||||||
* AA, TC, RA, and RCODE are only set in responses. Brief description
|
|
||||||
* of the remaining fields:
|
|
||||||
* ID Identifier to match responses with queries
|
|
||||||
* QR Query (0) or response (1)
|
|
||||||
* Opcode For our purposes, always QUERY
|
|
||||||
* RD Recursion desired
|
|
||||||
* Z Reserved (zero)
|
|
||||||
* QDCOUNT Number of queries
|
|
||||||
* ANCOUNT Number of answers
|
|
||||||
* NSCOUNT Number of name server records
|
|
||||||
* ARCOUNT Number of additional records
|
|
||||||
*
|
|
||||||
* Question format, from RFC 1035:
|
|
||||||
* 1 1 1 1 1 1
|
|
||||||
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
|
|
||||||
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|
|
||||||
* | |
|
|
||||||
* / QNAME /
|
|
||||||
* / /
|
|
||||||
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|
|
||||||
* | QTYPE |
|
|
||||||
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|
|
||||||
* | QCLASS |
|
|
||||||
* +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
|
|
||||||
*
|
|
||||||
* The query name is encoded as a series of labels, each represented
|
|
||||||
* as a one-byte length (maximum 63) followed by the text of the
|
|
||||||
* label. The list is terminated by a label of length zero (which can
|
|
||||||
* be thought of as the root domain).
|
|
||||||
*/
|
|
||||||
|
|
||||||
int ares_mkquery(const char *name, int dnsclass, int type, unsigned short id,
|
|
||||||
int rd, unsigned char **buf, int *buflen)
|
|
||||||
{
|
|
||||||
int len;
|
|
||||||
unsigned char *q;
|
|
||||||
const char *p;
|
|
||||||
|
|
||||||
/* Set our results early, in case we bail out early with an error. */
|
|
||||||
*buflen = 0;
|
|
||||||
*buf = NULL;
|
|
||||||
|
|
||||||
/* Compute the length of the encoded name so we can check buflen.
|
|
||||||
* Start counting at 1 for the zero-length label at the end. */
|
|
||||||
len = 1;
|
|
||||||
for (p = name; *p; p++)
|
|
||||||
{
|
|
||||||
if (*p == '\\' && *(p + 1) != 0)
|
|
||||||
p++;
|
|
||||||
len++;
|
|
||||||
}
|
|
||||||
/* If there are n periods in the name, there are n + 1 labels, and
|
|
||||||
* thus n + 1 length fields, unless the name is empty or ends with a
|
|
||||||
* period. So add 1 unless name is empty or ends with a period.
|
|
||||||
*/
|
|
||||||
if (*name && *(p - 1) != '.')
|
|
||||||
len++;
|
|
||||||
|
|
||||||
/* Immediately reject names that are longer than the maximum of 255
|
|
||||||
* bytes that's specified in RFC 1035 ("To simplify implementations,
|
|
||||||
* the total length of a domain name (i.e., label octets and label
|
|
||||||
* length octets) is restricted to 255 octets or less."). We aren't
|
|
||||||
* doing this just to be a stickler about RFCs. For names that are
|
|
||||||
* too long, 'dnscache' closes its TCP connection to us immediately
|
|
||||||
* (when using TCP) and ignores the request when using UDP, and
|
|
||||||
* BIND's named returns ServFail (TCP or UDP). Sending a request
|
|
||||||
* that we know will cause 'dnscache' to close the TCP connection is
|
|
||||||
* painful, since that makes any other outstanding requests on that
|
|
||||||
* connection fail. And sending a UDP request that we know
|
|
||||||
* 'dnscache' will ignore is bad because resources will be tied up
|
|
||||||
* until we time-out the request.
|
|
||||||
*/
|
|
||||||
if (len > MAXCDNAME)
|
|
||||||
return ARES_EBADNAME;
|
|
||||||
|
|
||||||
*buflen = len + HFIXEDSZ + QFIXEDSZ;
|
|
||||||
*buf = malloc(*buflen);
|
|
||||||
if (!*buf)
|
|
||||||
return ARES_ENOMEM;
|
|
||||||
|
|
||||||
/* Set up the header. */
|
|
||||||
q = *buf;
|
|
||||||
memset(q, 0, HFIXEDSZ);
|
|
||||||
DNS_HEADER_SET_QID(q, id);
|
|
||||||
DNS_HEADER_SET_OPCODE(q, QUERY);
|
|
||||||
if (rd) {
|
|
||||||
DNS_HEADER_SET_RD(q, 1);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
DNS_HEADER_SET_RD(q, 0);
|
|
||||||
}
|
|
||||||
DNS_HEADER_SET_QDCOUNT(q, 1);
|
|
||||||
|
|
||||||
/* A name of "." is a screw case for the loop below, so adjust it. */
|
|
||||||
if (strcmp(name, ".") == 0)
|
|
||||||
name++;
|
|
||||||
|
|
||||||
/* Start writing out the name after the header. */
|
|
||||||
q += HFIXEDSZ;
|
|
||||||
while (*name)
|
|
||||||
{
|
|
||||||
if (*name == '.')
|
|
||||||
return ARES_EBADNAME;
|
|
||||||
|
|
||||||
/* Count the number of bytes in this label. */
|
|
||||||
len = 0;
|
|
||||||
for (p = name; *p && *p != '.'; p++)
|
|
||||||
{
|
|
||||||
if (*p == '\\' && *(p + 1) != 0)
|
|
||||||
p++;
|
|
||||||
len++;
|
|
||||||
}
|
|
||||||
if (len > MAXLABEL)
|
|
||||||
return ARES_EBADNAME;
|
|
||||||
|
|
||||||
/* Encode the length and copy the data. */
|
|
||||||
*q++ = (unsigned char)len;
|
|
||||||
for (p = name; *p && *p != '.'; p++)
|
|
||||||
{
|
|
||||||
if (*p == '\\' && *(p + 1) != 0)
|
|
||||||
p++;
|
|
||||||
*q++ = *p;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Go to the next label and repeat, unless we hit the end. */
|
|
||||||
if (!*p)
|
|
||||||
break;
|
|
||||||
name = p + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Add the zero-length label at the end. */
|
|
||||||
*q++ = 0;
|
|
||||||
|
|
||||||
/* Finish off the question with the type and class. */
|
|
||||||
DNS_QUESTION_SET_TYPE(q, type);
|
|
||||||
DNS_QUESTION_SET_CLASS(q, dnsclass);
|
|
||||||
|
|
||||||
return ARES_SUCCESS;
|
|
||||||
}
|
|
||||||
@@ -1,79 +0,0 @@
|
|||||||
.\" $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.
|
|
||||||
.\"
|
|
||||||
.TH ARES_PARSE_A_REPLY 3 "25 July 1998"
|
|
||||||
.SH NAME
|
|
||||||
ares_parse_a_reply \- Parse a reply to a DNS query of type A into a hostent
|
|
||||||
.SH SYNOPSIS
|
|
||||||
.nf
|
|
||||||
.B #include <ares.h>
|
|
||||||
.PP
|
|
||||||
.B int ares_parse_a_reply(const unsigned char *\fIabuf\fP, int \fIalen\fP,
|
|
||||||
.B struct hostent **\fIhost\fP,
|
|
||||||
.B struct addrttl *\fIaddrttls\fB, int *\fInaddrttls\fB);
|
|
||||||
.fi
|
|
||||||
.SH DESCRIPTION
|
|
||||||
The
|
|
||||||
.B ares_parse_a_reply
|
|
||||||
function parses the response to a query of type A into a
|
|
||||||
.BR "struct hostent"
|
|
||||||
and/or an array of
|
|
||||||
.BR "struct addrttls" .
|
|
||||||
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 host ,
|
|
||||||
if host is nonnull.
|
|
||||||
It is the caller's responsibility to free the resulting host structure
|
|
||||||
using
|
|
||||||
.BR ares_free_hostent (3)
|
|
||||||
when it is no longer needed.
|
|
||||||
.PP
|
|
||||||
If
|
|
||||||
.IR addrttls
|
|
||||||
and
|
|
||||||
.IR naddrttls
|
|
||||||
are both nonnull,
|
|
||||||
then up to *naddrttls
|
|
||||||
.BR "struct addrttl"
|
|
||||||
records are stored in the array pointed to by addrttls,
|
|
||||||
and then *naddrttls is set to the number of records so stored.
|
|
||||||
Note that the memory for these records is supplied by the caller.
|
|
||||||
.SH RETURN VALUES
|
|
||||||
.B ares_parse_a_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_gethostbyname (3),
|
|
||||||
.BR ares_free_hostent (3)
|
|
||||||
.SH AUTHOR
|
|
||||||
Greg Hudson, MIT Information Systems
|
|
||||||
.br
|
|
||||||
Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||||
@@ -1,257 +0,0 @@
|
|||||||
/* $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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "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>
|
|
||||||
#ifdef HAVE_LIMITS_H
|
|
||||||
# include <limits.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "ares.h"
|
|
||||||
#include "ares_dns.h"
|
|
||||||
#include "ares_private.h"
|
|
||||||
|
|
||||||
int ares_parse_a_reply(const unsigned char *abuf, int alen,
|
|
||||||
struct hostent **host,
|
|
||||||
struct addrttl *addrttls, int *naddrttls)
|
|
||||||
{
|
|
||||||
unsigned int qdcount, ancount;
|
|
||||||
int status, i, rr_type, rr_class, rr_len, rr_ttl, naddrs;
|
|
||||||
int cname_ttl = INT_MAX; /* the TTL imposed by the CNAME chain */
|
|
||||||
int naliases;
|
|
||||||
long len;
|
|
||||||
const unsigned char *aptr;
|
|
||||||
char *hostname, *rr_name, *rr_data, **aliases;
|
|
||||||
struct in_addr *addrs;
|
|
||||||
struct hostent *hostent;
|
|
||||||
const int max_addr_ttls = (addrttls && naddrttls) ? *naddrttls : 0;
|
|
||||||
|
|
||||||
/* Set *host to NULL for all failure cases. */
|
|
||||||
if (host)
|
|
||||||
*host = NULL;
|
|
||||||
/* Same with *naddrttls. */
|
|
||||||
if (naddrttls)
|
|
||||||
*naddrttls = 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;
|
|
||||||
|
|
||||||
/* Expand the name from the question, and skip past the question. */
|
|
||||||
aptr = abuf + HFIXEDSZ;
|
|
||||||
status = ares__expand_name_for_response(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;
|
|
||||||
|
|
||||||
if (host)
|
|
||||||
{
|
|
||||||
/* Allocate addresses and aliases; ancount gives an upper bound for
|
|
||||||
both. */
|
|
||||||
addrs = malloc(ancount * sizeof(struct in_addr));
|
|
||||||
if (!addrs)
|
|
||||||
{
|
|
||||||
free(hostname);
|
|
||||||
return ARES_ENOMEM;
|
|
||||||
}
|
|
||||||
aliases = malloc((ancount + 1) * sizeof(char *));
|
|
||||||
if (!aliases)
|
|
||||||
{
|
|
||||||
free(hostname);
|
|
||||||
free(addrs);
|
|
||||||
return ARES_ENOMEM;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
addrs = NULL;
|
|
||||||
aliases = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
naddrs = 0;
|
|
||||||
naliases = 0;
|
|
||||||
|
|
||||||
/* 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_for_response(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);
|
|
||||||
rr_ttl = DNS_RR_TTL(aptr);
|
|
||||||
aptr += RRFIXEDSZ;
|
|
||||||
|
|
||||||
if (rr_class == C_IN && rr_type == T_A
|
|
||||||
&& rr_len == sizeof(struct in_addr)
|
|
||||||
&& strcasecmp(rr_name, hostname) == 0)
|
|
||||||
{
|
|
||||||
if (addrs)
|
|
||||||
{
|
|
||||||
if (aptr + sizeof(struct in_addr) > abuf + alen)
|
|
||||||
{
|
|
||||||
status = ARES_EBADRESP;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
memcpy(&addrs[naddrs], aptr, sizeof(struct in_addr));
|
|
||||||
}
|
|
||||||
if (naddrs < max_addr_ttls)
|
|
||||||
{
|
|
||||||
struct addrttl * const at = &addrttls[naddrs];
|
|
||||||
if (aptr + sizeof(struct in_addr) > abuf + alen)
|
|
||||||
{
|
|
||||||
status = ARES_EBADRESP;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
memcpy(&at->ipaddr, aptr, sizeof(struct in_addr));
|
|
||||||
at->ttl = rr_ttl;
|
|
||||||
}
|
|
||||||
naddrs++;
|
|
||||||
status = ARES_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rr_class == C_IN && rr_type == T_CNAME)
|
|
||||||
{
|
|
||||||
/* Record the RR name as an alias. */
|
|
||||||
if (aliases)
|
|
||||||
aliases[naliases] = rr_name;
|
|
||||||
else
|
|
||||||
free(rr_name);
|
|
||||||
naliases++;
|
|
||||||
|
|
||||||
/* Decode the RR data and replace the hostname with it. */
|
|
||||||
status = ares__expand_name_for_response(aptr, abuf, alen, &rr_data,
|
|
||||||
&len);
|
|
||||||
if (status != ARES_SUCCESS)
|
|
||||||
break;
|
|
||||||
free(hostname);
|
|
||||||
hostname = rr_data;
|
|
||||||
|
|
||||||
/* Take the min of the TTLs we see in the CNAME chain. */
|
|
||||||
if (cname_ttl > rr_ttl)
|
|
||||||
cname_ttl = rr_ttl;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
free(rr_name);
|
|
||||||
|
|
||||||
aptr += rr_len;
|
|
||||||
if (aptr > abuf + alen)
|
|
||||||
{
|
|
||||||
status = ARES_EBADRESP;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (status == ARES_SUCCESS && naddrs == 0)
|
|
||||||
status = ARES_ENODATA;
|
|
||||||
if (status == ARES_SUCCESS)
|
|
||||||
{
|
|
||||||
/* We got our answer. */
|
|
||||||
if (naddrttls)
|
|
||||||
{
|
|
||||||
const int n = naddrs < max_addr_ttls ? naddrs : max_addr_ttls;
|
|
||||||
for (i = 0; i < n; i++)
|
|
||||||
{
|
|
||||||
/* Ensure that each A TTL is no larger than the CNAME TTL. */
|
|
||||||
if (addrttls[i].ttl > cname_ttl)
|
|
||||||
addrttls[i].ttl = cname_ttl;
|
|
||||||
}
|
|
||||||
*naddrttls = n;
|
|
||||||
}
|
|
||||||
if (aliases)
|
|
||||||
aliases[naliases] = NULL;
|
|
||||||
if (host)
|
|
||||||
{
|
|
||||||
/* Allocate memory to build the host entry. */
|
|
||||||
hostent = malloc(sizeof(struct hostent));
|
|
||||||
if (hostent)
|
|
||||||
{
|
|
||||||
hostent->h_addr_list = malloc((naddrs + 1) * sizeof(char *));
|
|
||||||
if (hostent->h_addr_list)
|
|
||||||
{
|
|
||||||
/* Fill in the hostent and return successfully. */
|
|
||||||
hostent->h_name = hostname;
|
|
||||||
hostent->h_aliases = aliases;
|
|
||||||
hostent->h_addrtype = AF_INET;
|
|
||||||
hostent->h_length = sizeof(struct in_addr);
|
|
||||||
for (i = 0; i < naddrs; i++)
|
|
||||||
hostent->h_addr_list[i] = (char *) &addrs[i];
|
|
||||||
hostent->h_addr_list[naddrs] = NULL;
|
|
||||||
*host = hostent;
|
|
||||||
return ARES_SUCCESS;
|
|
||||||
}
|
|
||||||
free(hostent);
|
|
||||||
}
|
|
||||||
status = ARES_ENOMEM;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (aliases)
|
|
||||||
{
|
|
||||||
for (i = 0; i < naliases; i++)
|
|
||||||
free(aliases[i]);
|
|
||||||
free(aliases);
|
|
||||||
}
|
|
||||||
free(addrs);
|
|
||||||
free(hostname);
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
@@ -1,79 +0,0 @@
|
|||||||
.\" $Id$
|
|
||||||
.\"
|
|
||||||
.\" Copyright 2005 by Dominick Meglio.
|
|
||||||
.\"
|
|
||||||
.\" 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_AAAA_REPLY 3 "10 March 2005"
|
|
||||||
.SH NAME
|
|
||||||
ares_parse_aaaa_reply \- Parse a reply to a DNS query of type AAAA into a hostent
|
|
||||||
.SH SYNOPSIS
|
|
||||||
.nf
|
|
||||||
.B #include <ares.h>
|
|
||||||
.PP
|
|
||||||
.B int ares_parse_aaaa_reply(const unsigned char *\fIabuf\fP, int \fIalen\fP,
|
|
||||||
.B struct hostent **\fIhost\fP,
|
|
||||||
.B struct addrttl *\fIaddrttls\fB, int *\fInaddrttls\fB);
|
|
||||||
.fi
|
|
||||||
.SH DESCRIPTION
|
|
||||||
The
|
|
||||||
.B ares_parse_aaaa_reply
|
|
||||||
function parses the response to a query of type AAAA into a
|
|
||||||
.BR "struct hostent"
|
|
||||||
and/or an array of
|
|
||||||
.BR "struct addrttls" .
|
|
||||||
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 host ,
|
|
||||||
if host is nonnull.
|
|
||||||
It is the caller's responsibility to free the resulting host structure
|
|
||||||
using
|
|
||||||
.BR ares_free_hostent (3)
|
|
||||||
when it is no longer needed.
|
|
||||||
.PP
|
|
||||||
If
|
|
||||||
.IR addrttls
|
|
||||||
and
|
|
||||||
.IR naddrttls
|
|
||||||
are both nonnull,
|
|
||||||
then up to *naddrttls
|
|
||||||
.BR "struct addr6ttl"
|
|
||||||
records are stored in the array pointed to by addrttls,
|
|
||||||
and then *naddrttls is set to the number of records so stored.
|
|
||||||
Note that the memory for these records is supplied by the caller.
|
|
||||||
.SH RETURN VALUES
|
|
||||||
.B ares_parse_aaaa_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_gethostbyname (3),
|
|
||||||
.BR ares_free_hostent (3)
|
|
||||||
.SH AUTHOR
|
|
||||||
Dominick Meglio
|
|
||||||
.br
|
|
||||||
Copyright 2005 by Dominick Meglio.
|
|
||||||
@@ -1,256 +0,0 @@
|
|||||||
/* $Id$ */
|
|
||||||
|
|
||||||
/* Copyright 2005 Dominick Meglio
|
|
||||||
*
|
|
||||||
* 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 "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>
|
|
||||||
#ifdef HAVE_LIMITS_H
|
|
||||||
# include <limits.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "ares.h"
|
|
||||||
#include "ares_dns.h"
|
|
||||||
#include "inet_net_pton.h"
|
|
||||||
#include "ares_private.h"
|
|
||||||
|
|
||||||
int ares_parse_aaaa_reply(const unsigned char *abuf, int alen,
|
|
||||||
struct hostent **host, struct addr6ttl *addrttls,
|
|
||||||
int *naddrttls)
|
|
||||||
{
|
|
||||||
unsigned int qdcount, ancount;
|
|
||||||
int status, i, rr_type, rr_class, rr_len, rr_ttl, naddrs;
|
|
||||||
int cname_ttl = INT_MAX; /* the TTL imposed by the CNAME chain */
|
|
||||||
int naliases;
|
|
||||||
long len;
|
|
||||||
const unsigned char *aptr;
|
|
||||||
char *hostname, *rr_name, *rr_data, **aliases;
|
|
||||||
struct in6_addr *addrs;
|
|
||||||
struct hostent *hostent;
|
|
||||||
const int max_addr_ttls = (addrttls && naddrttls) ? *naddrttls : 0;
|
|
||||||
|
|
||||||
/* Set *host to NULL for all failure cases. */
|
|
||||||
if (host)
|
|
||||||
*host = NULL;
|
|
||||||
/* Same with *naddrttls. */
|
|
||||||
if (naddrttls)
|
|
||||||
*naddrttls = 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;
|
|
||||||
|
|
||||||
/* Expand the name from the question, and skip past the question. */
|
|
||||||
aptr = abuf + HFIXEDSZ;
|
|
||||||
status = ares__expand_name_for_response(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 addresses and aliases; ancount gives an upper bound for both. */
|
|
||||||
if (host)
|
|
||||||
{
|
|
||||||
addrs = malloc(ancount * sizeof(struct in6_addr));
|
|
||||||
if (!addrs)
|
|
||||||
{
|
|
||||||
free(hostname);
|
|
||||||
return ARES_ENOMEM;
|
|
||||||
}
|
|
||||||
aliases = malloc((ancount + 1) * sizeof(char *));
|
|
||||||
if (!aliases)
|
|
||||||
{
|
|
||||||
free(hostname);
|
|
||||||
free(addrs);
|
|
||||||
return ARES_ENOMEM;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
addrs = NULL;
|
|
||||||
aliases = NULL;
|
|
||||||
}
|
|
||||||
naddrs = 0;
|
|
||||||
naliases = 0;
|
|
||||||
|
|
||||||
/* 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_for_response(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);
|
|
||||||
rr_ttl = DNS_RR_TTL(aptr);
|
|
||||||
aptr += RRFIXEDSZ;
|
|
||||||
|
|
||||||
if (rr_class == C_IN && rr_type == T_AAAA
|
|
||||||
&& rr_len == sizeof(struct in6_addr)
|
|
||||||
&& strcasecmp(rr_name, hostname) == 0)
|
|
||||||
{
|
|
||||||
if (addrs)
|
|
||||||
{
|
|
||||||
if (aptr + sizeof(struct in6_addr) > abuf + alen)
|
|
||||||
{
|
|
||||||
status = ARES_EBADRESP;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
memcpy(&addrs[naddrs], aptr, sizeof(struct in6_addr));
|
|
||||||
}
|
|
||||||
if (naddrs < max_addr_ttls)
|
|
||||||
{
|
|
||||||
struct addr6ttl * const at = &addrttls[naddrs];
|
|
||||||
if (aptr + sizeof(struct in6_addr) > abuf + alen)
|
|
||||||
{
|
|
||||||
status = ARES_EBADRESP;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
memcpy(&at->ip6addr, aptr, sizeof(struct in6_addr));
|
|
||||||
at->ttl = rr_ttl;
|
|
||||||
}
|
|
||||||
naddrs++;
|
|
||||||
status = ARES_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rr_class == C_IN && rr_type == T_CNAME)
|
|
||||||
{
|
|
||||||
/* Record the RR name as an alias. */
|
|
||||||
if (aliases)
|
|
||||||
aliases[naliases] = rr_name;
|
|
||||||
else
|
|
||||||
free(rr_name);
|
|
||||||
naliases++;
|
|
||||||
|
|
||||||
/* Decode the RR data and replace the hostname with it. */
|
|
||||||
status = ares__expand_name_for_response(aptr, abuf, alen, &rr_data,
|
|
||||||
&len);
|
|
||||||
if (status != ARES_SUCCESS)
|
|
||||||
break;
|
|
||||||
free(hostname);
|
|
||||||
hostname = rr_data;
|
|
||||||
|
|
||||||
/* Take the min of the TTLs we see in the CNAME chain. */
|
|
||||||
if (cname_ttl > rr_ttl)
|
|
||||||
cname_ttl = rr_ttl;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
free(rr_name);
|
|
||||||
|
|
||||||
aptr += rr_len;
|
|
||||||
if (aptr > abuf + alen)
|
|
||||||
{
|
|
||||||
status = ARES_EBADRESP;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (status == ARES_SUCCESS && naddrs == 0)
|
|
||||||
status = ARES_ENODATA;
|
|
||||||
if (status == ARES_SUCCESS)
|
|
||||||
{
|
|
||||||
/* We got our answer. */
|
|
||||||
if (naddrttls)
|
|
||||||
{
|
|
||||||
const int n = naddrs < max_addr_ttls ? naddrs : max_addr_ttls;
|
|
||||||
for (i = 0; i < n; i++)
|
|
||||||
{
|
|
||||||
/* Ensure that each A TTL is no larger than the CNAME TTL. */
|
|
||||||
if (addrttls[i].ttl > cname_ttl)
|
|
||||||
addrttls[i].ttl = cname_ttl;
|
|
||||||
}
|
|
||||||
*naddrttls = n;
|
|
||||||
}
|
|
||||||
if (aliases)
|
|
||||||
aliases[naliases] = NULL;
|
|
||||||
if (host)
|
|
||||||
{
|
|
||||||
/* Allocate memory to build the host entry. */
|
|
||||||
hostent = malloc(sizeof(struct hostent));
|
|
||||||
if (hostent)
|
|
||||||
{
|
|
||||||
hostent->h_addr_list = malloc((naddrs + 1) * sizeof(char *));
|
|
||||||
if (hostent->h_addr_list)
|
|
||||||
{
|
|
||||||
/* Fill in the hostent and return successfully. */
|
|
||||||
hostent->h_name = hostname;
|
|
||||||
hostent->h_aliases = aliases;
|
|
||||||
hostent->h_addrtype = AF_INET6;
|
|
||||||
hostent->h_length = sizeof(struct in6_addr);
|
|
||||||
for (i = 0; i < naddrs; i++)
|
|
||||||
hostent->h_addr_list[i] = (char *) &addrs[i];
|
|
||||||
hostent->h_addr_list[naddrs] = NULL;
|
|
||||||
*host = hostent;
|
|
||||||
return ARES_SUCCESS;
|
|
||||||
}
|
|
||||||
free(hostent);
|
|
||||||
}
|
|
||||||
status = ARES_ENOMEM;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (aliases)
|
|
||||||
{
|
|
||||||
for (i = 0; i < naliases; i++)
|
|
||||||
free(aliases[i]);
|
|
||||||
free(aliases);
|
|
||||||
}
|
|
||||||
free(addrs);
|
|
||||||
free(hostname);
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
.\"
|
|
||||||
.\" 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_NS_REPLY 3 "10 February 2007"
|
|
||||||
.SH NAME
|
|
||||||
ares_parse_ns_reply \- Parse a reply to a DNS query of type NS into a hostent
|
|
||||||
.SH SYNOPSIS
|
|
||||||
.nf
|
|
||||||
.B #include <ares.h>
|
|
||||||
.PP
|
|
||||||
.B int ares_parse_ns_reply(const unsigned char *\fIabuf\fP, int \fIalen\fP,
|
|
||||||
.B struct hostent **\fIhost\fP);
|
|
||||||
.fi
|
|
||||||
.SH DESCRIPTION
|
|
||||||
The
|
|
||||||
.B ares_parse_ns_reply
|
|
||||||
function parses the response to a query of type NS into a
|
|
||||||
.BR "struct hostent" .
|
|
||||||
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 host .
|
|
||||||
The nameservers are stored into the
|
|
||||||
.BR aliases
|
|
||||||
field of the
|
|
||||||
.IR host
|
|
||||||
structure.
|
|
||||||
It is the caller's responsibility to free the resulting host structure
|
|
||||||
using
|
|
||||||
.BR ares_free_hostent (3)
|
|
||||||
when it is no longer needed.
|
|
||||||
.SH RETURN VALUES
|
|
||||||
.B ares_parse_ns_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),
|
|
||||||
.BR ares_free_hostent (3)
|
|
||||||
.SH AUTHOR
|
|
||||||
Written by Vlad Dinulescu <vlad.dinulescu@avira.com>, on behalf of AVIRA Gmbh http://www.avira.com
|
|
||||||
@@ -1,180 +0,0 @@
|
|||||||
/* 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_ns_reply created by Vlad Dinulescu <vlad.dinulescu@avira.com>
|
|
||||||
* on behalf of AVIRA Gmbh - http://www.avira.com
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "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"
|
|
||||||
|
|
||||||
int ares_parse_ns_reply( const unsigned char* abuf, int alen,
|
|
||||||
struct hostent** host )
|
|
||||||
{
|
|
||||||
unsigned int qdcount, ancount;
|
|
||||||
int status, i, rr_type, rr_class, rr_len;
|
|
||||||
int nameservers_num;
|
|
||||||
long len;
|
|
||||||
const unsigned char *aptr;
|
|
||||||
char* hostname, *rr_name, *rr_data, **nameservers;
|
|
||||||
struct hostent *hostent;
|
|
||||||
|
|
||||||
/* Set *host to NULL for all failure cases. */
|
|
||||||
*host = NULL;
|
|
||||||
|
|
||||||
/* 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;
|
|
||||||
|
|
||||||
/* Expand the name from the question, and skip past the question. */
|
|
||||||
aptr = abuf + HFIXEDSZ;
|
|
||||||
status = ares__expand_name_for_response( 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 nameservers array; ancount gives an upper bound */
|
|
||||||
nameservers = malloc( ( ancount + 1 ) * sizeof( char * ) );
|
|
||||||
if ( !nameservers )
|
|
||||||
{
|
|
||||||
free( hostname );
|
|
||||||
return ARES_ENOMEM;
|
|
||||||
}
|
|
||||||
nameservers_num = 0;
|
|
||||||
|
|
||||||
/* 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_for_response( 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;
|
|
||||||
|
|
||||||
if ( rr_class == C_IN && rr_type == T_NS )
|
|
||||||
{
|
|
||||||
/* Decode the RR data and add it to the nameservers list */
|
|
||||||
status = ares__expand_name_for_response( aptr, abuf, alen, &rr_data,
|
|
||||||
&len);
|
|
||||||
if ( status != ARES_SUCCESS )
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
nameservers[nameservers_num] = malloc(strlen(rr_data)+1);
|
|
||||||
|
|
||||||
if (nameservers[nameservers_num]==NULL)
|
|
||||||
{
|
|
||||||
free(rr_name);
|
|
||||||
free(rr_data);
|
|
||||||
status=ARES_ENOMEM;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
strcpy(nameservers[nameservers_num],rr_data);
|
|
||||||
free(rr_data);
|
|
||||||
|
|
||||||
nameservers_num++;
|
|
||||||
}
|
|
||||||
|
|
||||||
free( rr_name );
|
|
||||||
|
|
||||||
aptr += rr_len;
|
|
||||||
if ( aptr > abuf + alen )
|
|
||||||
{
|
|
||||||
status = ARES_EBADRESP;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( status == ARES_SUCCESS && nameservers_num == 0 )
|
|
||||||
{
|
|
||||||
status = ARES_ENODATA;
|
|
||||||
}
|
|
||||||
if ( status == ARES_SUCCESS )
|
|
||||||
{
|
|
||||||
/* We got our answer. Allocate memory to build the host entry. */
|
|
||||||
nameservers[nameservers_num] = NULL;
|
|
||||||
hostent = malloc( sizeof( struct hostent ) );
|
|
||||||
if ( hostent )
|
|
||||||
{
|
|
||||||
hostent->h_addr_list = malloc( 1 * sizeof( char * ) );
|
|
||||||
if ( hostent->h_addr_list )
|
|
||||||
{
|
|
||||||
/* Fill in the hostent and return successfully. */
|
|
||||||
hostent->h_name = hostname;
|
|
||||||
hostent->h_aliases = nameservers;
|
|
||||||
hostent->h_addrtype = AF_INET;
|
|
||||||
hostent->h_length = sizeof( struct in_addr );
|
|
||||||
hostent->h_addr_list[0] = NULL;
|
|
||||||
*host = hostent;
|
|
||||||
return ARES_SUCCESS;
|
|
||||||
}
|
|
||||||
free( hostent );
|
|
||||||
}
|
|
||||||
status = ARES_ENOMEM;
|
|
||||||
}
|
|
||||||
for ( i = 0; i < nameservers_num; i++ )
|
|
||||||
free( nameservers[i] );
|
|
||||||
free( nameservers );
|
|
||||||
free( hostname );
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
@@ -1,75 +0,0 @@
|
|||||||
.\" $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.
|
|
||||||
.\"
|
|
||||||
.TH ARES_PARSE_PTR_REPLY 3 "25 July 1998"
|
|
||||||
.SH NAME
|
|
||||||
ares_parse_ptr_reply \- Parse a reply to a DNS query of type PTR into a hostent
|
|
||||||
.SH SYNOPSIS
|
|
||||||
.nf
|
|
||||||
.B #include <ares.h>
|
|
||||||
.PP
|
|
||||||
.B int ares_parse_ptr_reply(const unsigned char *\fIabuf\fP, int \fIalen\fP,
|
|
||||||
.B const void *\fIaddr\fP, int \fIaddrlen\fP, int \fIfamily\fP,
|
|
||||||
.B struct hostent **\fIhost\fP);
|
|
||||||
.fi
|
|
||||||
.SH DESCRIPTION
|
|
||||||
The
|
|
||||||
.B ares_parse_ptr_reply
|
|
||||||
function parses the response to a query of type PTR into a
|
|
||||||
.BR "struct hostent" .
|
|
||||||
The parameters
|
|
||||||
.I abuf
|
|
||||||
and
|
|
||||||
.I alen
|
|
||||||
give the contents of the response. The parameters
|
|
||||||
.IR addr ,
|
|
||||||
.IR addrlen ,
|
|
||||||
and
|
|
||||||
.I family
|
|
||||||
specify which address was queried for; they are not used to verify the
|
|
||||||
response, merely used to fill in the address of the
|
|
||||||
.BR "struct hostent" .
|
|
||||||
The resulting
|
|
||||||
.B struct hostent
|
|
||||||
is stored in allocated memory and a pointer to it stored into the
|
|
||||||
variable pointed to by
|
|
||||||
.IR host .
|
|
||||||
It is the caller's responsibility to free the resulting host structure
|
|
||||||
using
|
|
||||||
.BR ares_free_hostent (3)
|
|
||||||
when it is no longer needed.
|
|
||||||
.SH RETURN VALUES
|
|
||||||
.B ares_parse_ptr_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_gethostbyaddr (3),
|
|
||||||
.BR ares_free_hostent (3)
|
|
||||||
.SH AUTHOR
|
|
||||||
Greg Hudson, MIT Information Systems
|
|
||||||
.br
|
|
||||||
Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||||
@@ -1,209 +0,0 @@
|
|||||||
/* $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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "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_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_ptr_reply(const unsigned char *abuf, int alen, const void *addr,
|
|
||||||
int addrlen, int family, struct hostent **host)
|
|
||||||
{
|
|
||||||
unsigned int qdcount, ancount;
|
|
||||||
int status, i, rr_type, rr_class, rr_len;
|
|
||||||
long len;
|
|
||||||
const unsigned char *aptr;
|
|
||||||
char *ptrname, *hostname, *rr_name, *rr_data;
|
|
||||||
struct hostent *hostent;
|
|
||||||
int aliascnt = 0;
|
|
||||||
int alias_alloc = 8;
|
|
||||||
char ** aliases;
|
|
||||||
|
|
||||||
/* Set *host to NULL for all failure cases. */
|
|
||||||
*host = NULL;
|
|
||||||
|
|
||||||
/* 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;
|
|
||||||
|
|
||||||
/* Expand the name from the question, and skip past the question. */
|
|
||||||
aptr = abuf + HFIXEDSZ;
|
|
||||||
status = ares__expand_name_for_response(aptr, abuf, alen, &ptrname, &len);
|
|
||||||
if (status != ARES_SUCCESS)
|
|
||||||
return status;
|
|
||||||
if (aptr + len + QFIXEDSZ > abuf + alen)
|
|
||||||
{
|
|
||||||
free(ptrname);
|
|
||||||
return ARES_EBADRESP;
|
|
||||||
}
|
|
||||||
aptr += len + QFIXEDSZ;
|
|
||||||
|
|
||||||
/* Examine each answer resource record (RR) in turn. */
|
|
||||||
hostname = NULL;
|
|
||||||
aliases = malloc(alias_alloc * sizeof(char *));
|
|
||||||
if (!aliases)
|
|
||||||
{
|
|
||||||
free(ptrname);
|
|
||||||
return ARES_ENOMEM;
|
|
||||||
}
|
|
||||||
for (i = 0; i < (int)ancount; i++)
|
|
||||||
{
|
|
||||||
/* Decode the RR up to the data field. */
|
|
||||||
status = ares__expand_name_for_response(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;
|
|
||||||
|
|
||||||
if (rr_class == C_IN && rr_type == T_PTR
|
|
||||||
&& strcasecmp(rr_name, ptrname) == 0)
|
|
||||||
{
|
|
||||||
/* Decode the RR data and set hostname to it. */
|
|
||||||
status = ares__expand_name_for_response(aptr, abuf, alen, &rr_data,
|
|
||||||
&len);
|
|
||||||
if (status != ARES_SUCCESS)
|
|
||||||
break;
|
|
||||||
if (hostname)
|
|
||||||
free(hostname);
|
|
||||||
hostname = rr_data;
|
|
||||||
aliases[aliascnt] = malloc((strlen(rr_data)+1) * sizeof(char *));
|
|
||||||
if (!aliases[aliascnt])
|
|
||||||
{
|
|
||||||
status = ARES_ENOMEM;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
strncpy(aliases[aliascnt], rr_data, strlen(rr_data)+1);
|
|
||||||
aliascnt++;
|
|
||||||
if (aliascnt >= alias_alloc) {
|
|
||||||
char **ptr;
|
|
||||||
alias_alloc *= 2;
|
|
||||||
ptr = realloc(aliases, alias_alloc * sizeof(char *));
|
|
||||||
if(!ptr) {
|
|
||||||
status = ARES_ENOMEM;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
aliases = ptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rr_class == C_IN && rr_type == T_CNAME)
|
|
||||||
{
|
|
||||||
/* Decode the RR data and replace ptrname with it. */
|
|
||||||
status = ares__expand_name_for_response(aptr, abuf, alen, &rr_data,
|
|
||||||
&len);
|
|
||||||
if (status != ARES_SUCCESS)
|
|
||||||
break;
|
|
||||||
free(ptrname);
|
|
||||||
ptrname = rr_data;
|
|
||||||
}
|
|
||||||
|
|
||||||
free(rr_name);
|
|
||||||
aptr += rr_len;
|
|
||||||
if (aptr > abuf + alen)
|
|
||||||
{
|
|
||||||
status = ARES_EBADRESP;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (status == ARES_SUCCESS && !hostname)
|
|
||||||
status = ARES_ENODATA;
|
|
||||||
if (status == ARES_SUCCESS)
|
|
||||||
{
|
|
||||||
/* We got our answer. Allocate memory to build the host entry. */
|
|
||||||
hostent = malloc(sizeof(struct hostent));
|
|
||||||
if (hostent)
|
|
||||||
{
|
|
||||||
hostent->h_addr_list = malloc(2 * sizeof(char *));
|
|
||||||
if (hostent->h_addr_list)
|
|
||||||
{
|
|
||||||
hostent->h_addr_list[0] = malloc(addrlen);
|
|
||||||
if (hostent->h_addr_list[0])
|
|
||||||
{
|
|
||||||
hostent->h_aliases = malloc((aliascnt+1) * sizeof (char *));
|
|
||||||
if (hostent->h_aliases)
|
|
||||||
{
|
|
||||||
/* Fill in the hostent and return successfully. */
|
|
||||||
hostent->h_name = hostname;
|
|
||||||
for (i=0 ; i<aliascnt ; i++)
|
|
||||||
hostent->h_aliases[i] = aliases[i];
|
|
||||||
hostent->h_aliases[aliascnt] = NULL;
|
|
||||||
hostent->h_addrtype = family;
|
|
||||||
hostent->h_length = addrlen;
|
|
||||||
memcpy(hostent->h_addr_list[0], addr, addrlen);
|
|
||||||
hostent->h_addr_list[1] = NULL;
|
|
||||||
*host = hostent;
|
|
||||||
free(aliases);
|
|
||||||
free(ptrname);
|
|
||||||
return ARES_SUCCESS;
|
|
||||||
}
|
|
||||||
free(hostent->h_addr_list[0]);
|
|
||||||
}
|
|
||||||
free(hostent->h_addr_list);
|
|
||||||
}
|
|
||||||
free(hostent);
|
|
||||||
}
|
|
||||||
status = ARES_ENOMEM;
|
|
||||||
}
|
|
||||||
for (i=0 ; i<aliascnt ; i++)
|
|
||||||
if (aliases[i])
|
|
||||||
free(aliases[i]);
|
|
||||||
free(aliases);
|
|
||||||
if (hostname)
|
|
||||||
free(hostname);
|
|
||||||
free(ptrname);
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
@@ -1,346 +0,0 @@
|
|||||||
#ifndef __ARES_PRIVATE_H
|
|
||||||
#define __ARES_PRIVATE_H
|
|
||||||
|
|
||||||
/* $Id$ */
|
|
||||||
|
|
||||||
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||||
* Copyright (C) 2004-2008 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Define WIN32 when build target is Win32 API
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
|
|
||||||
#define WIN32
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
|
|
||||||
#if !defined(WIN32) || defined(WATT32)
|
|
||||||
#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
|
|
||||||
|
|
||||||
#ifdef WATT32
|
|
||||||
#include <tcp.h>
|
|
||||||
#include <sys/ioctl.h>
|
|
||||||
#undef closesocket
|
|
||||||
#define closesocket(s) close_s(s)
|
|
||||||
#define writev(s,v,c) writev_s(s,v,c)
|
|
||||||
#define HAVE_WRITEV 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef NETWARE
|
|
||||||
#include <time.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define DEFAULT_TIMEOUT 5000 /* milliseconds */
|
|
||||||
#define DEFAULT_TRIES 4
|
|
||||||
#ifndef INADDR_NONE
|
|
||||||
#define INADDR_NONE 0xffffffff
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(WIN32) && !defined(WATT32)
|
|
||||||
|
|
||||||
#define IS_NT() ((int)GetVersion() > 0)
|
|
||||||
#define WIN_NS_9X "System\\CurrentControlSet\\Services\\VxD\\MSTCP"
|
|
||||||
#define WIN_NS_NT_KEY "System\\CurrentControlSet\\Services\\Tcpip\\Parameters"
|
|
||||||
#define NAMESERVER "NameServer"
|
|
||||||
#define DHCPNAMESERVER "DhcpNameServer"
|
|
||||||
#define DATABASEPATH "DatabasePath"
|
|
||||||
#define WIN_PATH_HOSTS "\\hosts"
|
|
||||||
|
|
||||||
#elif defined(WATT32)
|
|
||||||
|
|
||||||
#define PATH_RESOLV_CONF "/dev/ENV/etc/resolv.conf"
|
|
||||||
|
|
||||||
#elif defined(NETWARE)
|
|
||||||
|
|
||||||
#define PATH_RESOLV_CONF "sys:/etc/resolv.cfg"
|
|
||||||
#define PATH_HOSTS "sys:/etc/hosts"
|
|
||||||
|
|
||||||
#elif defined(__riscos__)
|
|
||||||
|
|
||||||
#define PATH_HOSTS "InetDBase:Hosts"
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
#define PATH_RESOLV_CONF "/etc/resolv.conf"
|
|
||||||
#ifdef ETC_INET
|
|
||||||
#define PATH_HOSTS "/etc/inet/hosts"
|
|
||||||
#else
|
|
||||||
#define PATH_HOSTS "/etc/hosts"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define ARES_ID_KEY_LEN 31
|
|
||||||
|
|
||||||
#include "ares_ipv6.h"
|
|
||||||
#include "ares_llist.h"
|
|
||||||
|
|
||||||
#ifndef HAVE_STRDUP
|
|
||||||
# include "ares_strdup.h"
|
|
||||||
# define strdup(ptr) ares_strdup(ptr)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef HAVE_STRCASECMP
|
|
||||||
# include "ares_strcasecmp.h"
|
|
||||||
# define strcasecmp(p1,p2) ares_strcasecmp(p1,p2)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef HAVE_STRNCASECMP
|
|
||||||
# include "ares_strcasecmp.h"
|
|
||||||
# define strncasecmp(p1,p2,n) ares_strncasecmp(p1,p2,n)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef HAVE_WRITEV
|
|
||||||
# include "ares_writev.h"
|
|
||||||
# define writev(s,ptr,cnt) ares_writev(s,ptr,cnt)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct ares_addr {
|
|
||||||
int family;
|
|
||||||
union {
|
|
||||||
struct in_addr addr4;
|
|
||||||
struct in6_addr addr6;
|
|
||||||
} addr;
|
|
||||||
};
|
|
||||||
#define addrV4 addr.addr4
|
|
||||||
#define addrV6 addr.addr6
|
|
||||||
|
|
||||||
struct query;
|
|
||||||
|
|
||||||
struct send_request {
|
|
||||||
/* Remaining data to send */
|
|
||||||
const unsigned char *data;
|
|
||||||
size_t len;
|
|
||||||
|
|
||||||
/* The query for which we're sending this data */
|
|
||||||
struct query* owner_query;
|
|
||||||
/* The buffer we're using, if we have our own copy of the packet */
|
|
||||||
unsigned char *data_storage;
|
|
||||||
|
|
||||||
/* Next request in queue */
|
|
||||||
struct send_request *next;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct server_state {
|
|
||||||
struct in_addr addr;
|
|
||||||
ares_socket_t udp_socket;
|
|
||||||
ares_socket_t tcp_socket;
|
|
||||||
|
|
||||||
/* Mini-buffer for reading the length word */
|
|
||||||
unsigned char tcp_lenbuf[2];
|
|
||||||
int tcp_lenbuf_pos;
|
|
||||||
int tcp_length;
|
|
||||||
|
|
||||||
/* Buffer for reading actual TCP data */
|
|
||||||
unsigned char *tcp_buffer;
|
|
||||||
int tcp_buffer_pos;
|
|
||||||
|
|
||||||
/* TCP output queue */
|
|
||||||
struct send_request *qhead;
|
|
||||||
struct send_request *qtail;
|
|
||||||
|
|
||||||
/* Which incarnation of this connection is this? We don't want to
|
|
||||||
* retransmit requests into the very same socket, but if the server
|
|
||||||
* closes on us and we re-open the connection, then we do want to
|
|
||||||
* re-send. */
|
|
||||||
int tcp_connection_generation;
|
|
||||||
|
|
||||||
/* Circular, doubly-linked list of outstanding queries to this server */
|
|
||||||
struct list_node queries_to_server;
|
|
||||||
|
|
||||||
/* Link back to owning channel */
|
|
||||||
ares_channel channel;
|
|
||||||
|
|
||||||
/* Is this server broken? We mark connections as broken when a
|
|
||||||
* request that is queued for sending times out.
|
|
||||||
*/
|
|
||||||
int is_broken;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* State to represent a DNS query */
|
|
||||||
struct query {
|
|
||||||
/* Query ID from qbuf, for faster lookup, and current timeout */
|
|
||||||
unsigned short qid;
|
|
||||||
struct timeval timeout;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Links for the doubly-linked lists in which we insert a query.
|
|
||||||
* These circular, doubly-linked lists that are hash-bucketed based
|
|
||||||
* the attributes we care about, help making most important
|
|
||||||
* operations O(1).
|
|
||||||
*/
|
|
||||||
struct list_node queries_by_qid; /* hopefully in same cache line as qid */
|
|
||||||
struct list_node queries_by_timeout;
|
|
||||||
struct list_node queries_to_server;
|
|
||||||
struct list_node all_queries;
|
|
||||||
|
|
||||||
/* Query buf with length at beginning, for TCP transmission */
|
|
||||||
unsigned char *tcpbuf;
|
|
||||||
int tcplen;
|
|
||||||
|
|
||||||
/* Arguments passed to ares_send() (qbuf points into tcpbuf) */
|
|
||||||
const unsigned char *qbuf;
|
|
||||||
int qlen;
|
|
||||||
ares_callback callback;
|
|
||||||
void *arg;
|
|
||||||
|
|
||||||
/* Query status */
|
|
||||||
int try; /* Number of times we tried this query already. */
|
|
||||||
int server; /* Server this query has last been sent to. */
|
|
||||||
struct query_server_info *server_info; /* per-server state */
|
|
||||||
int using_tcp;
|
|
||||||
int error_status;
|
|
||||||
int timeouts; /* number of timeouts we saw for this request */
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Per-server state for a query */
|
|
||||||
struct query_server_info {
|
|
||||||
int skip_server; /* should we skip server, due to errors, etc? */
|
|
||||||
int tcp_connection_generation; /* into which TCP connection did we send? */
|
|
||||||
};
|
|
||||||
|
|
||||||
/* An IP address pattern; matches an IP address X if X & mask == addr */
|
|
||||||
#define PATTERN_MASK 0x1
|
|
||||||
#define PATTERN_CIDR 0x2
|
|
||||||
|
|
||||||
struct apattern {
|
|
||||||
union
|
|
||||||
{
|
|
||||||
struct in_addr addr4;
|
|
||||||
struct in6_addr addr6;
|
|
||||||
} addr;
|
|
||||||
union
|
|
||||||
{
|
|
||||||
struct in_addr addr4;
|
|
||||||
struct in6_addr addr6;
|
|
||||||
unsigned short bits;
|
|
||||||
} mask;
|
|
||||||
int family;
|
|
||||||
unsigned short type;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct rc4_key
|
|
||||||
{
|
|
||||||
unsigned char state[256];
|
|
||||||
unsigned char x;
|
|
||||||
unsigned char y;
|
|
||||||
} rc4_key;
|
|
||||||
|
|
||||||
struct ares_channeldata {
|
|
||||||
/* Configuration data */
|
|
||||||
int flags;
|
|
||||||
int timeout; /* in milliseconds */
|
|
||||||
int tries;
|
|
||||||
int ndots;
|
|
||||||
int rotate; /* if true, all servers specified are used */
|
|
||||||
int udp_port;
|
|
||||||
int tcp_port;
|
|
||||||
int socket_send_buffer_size;
|
|
||||||
int socket_receive_buffer_size;
|
|
||||||
char **domains;
|
|
||||||
int ndomains;
|
|
||||||
struct apattern *sortlist;
|
|
||||||
int nsort;
|
|
||||||
char *lookups;
|
|
||||||
|
|
||||||
int optmask; /* the option bitfield passed in at init time */
|
|
||||||
|
|
||||||
/* Server addresses and communications state */
|
|
||||||
struct server_state *servers;
|
|
||||||
int nservers;
|
|
||||||
|
|
||||||
/* ID to use for next query */
|
|
||||||
unsigned short next_id;
|
|
||||||
/* key to use when generating new ids */
|
|
||||||
rc4_key id_key;
|
|
||||||
|
|
||||||
/* Generation number to use for the next TCP socket open/close */
|
|
||||||
int tcp_connection_generation;
|
|
||||||
|
|
||||||
/* The time at which we last called process_timeouts(). Uses integer seconds
|
|
||||||
just to draw the line somewhere. */
|
|
||||||
time_t last_timeout_processed;
|
|
||||||
|
|
||||||
/* Last server we sent a query to. */
|
|
||||||
int last_server;
|
|
||||||
|
|
||||||
/* Circular, doubly-linked list of queries, bucketed various ways.... */
|
|
||||||
/* All active queries in a single list: */
|
|
||||||
struct list_node all_queries;
|
|
||||||
/* Queries bucketed by qid, for quickly dispatching DNS responses: */
|
|
||||||
#define ARES_QID_TABLE_SIZE 2048
|
|
||||||
struct list_node queries_by_qid[ARES_QID_TABLE_SIZE];
|
|
||||||
/* Queries bucketed by timeout, for quickly handling timeouts: */
|
|
||||||
#define ARES_TIMEOUT_TABLE_SIZE 1024
|
|
||||||
struct list_node queries_by_timeout[ARES_TIMEOUT_TABLE_SIZE];
|
|
||||||
|
|
||||||
ares_sock_state_cb sock_state_cb;
|
|
||||||
void *sock_state_cb_data;
|
|
||||||
|
|
||||||
ares_sock_create_callback sock_create_cb;
|
|
||||||
void *sock_create_cb_data;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* return true if now is exactly check time or later */
|
|
||||||
int ares__timedout(struct timeval *now,
|
|
||||||
struct timeval *check);
|
|
||||||
/* add the specific number of milliseconds to the time in the first argument */
|
|
||||||
int ares__timeadd(struct timeval *now,
|
|
||||||
int millisecs);
|
|
||||||
/* return time offset between now and (future) check, in milliseconds */
|
|
||||||
long ares__timeoffset(struct timeval *now,
|
|
||||||
struct timeval *check);
|
|
||||||
void ares__rc4(rc4_key* key,unsigned char *buffer_ptr, int buffer_len);
|
|
||||||
void ares__send_query(ares_channel channel, struct query *query,
|
|
||||||
struct timeval *now);
|
|
||||||
void ares__close_sockets(ares_channel channel, struct server_state *server);
|
|
||||||
int ares__get_hostent(FILE *fp, int family, struct hostent **host);
|
|
||||||
int ares__read_line(FILE *fp, char **buf, int *bufsize);
|
|
||||||
void ares__free_query(struct query *query);
|
|
||||||
unsigned short ares__generate_new_id(rc4_key* key);
|
|
||||||
struct timeval ares__tvnow(void);
|
|
||||||
int ares__expand_name_for_response(const unsigned char *encoded,
|
|
||||||
const unsigned char *abuf, int alen,
|
|
||||||
char **s, long *enclen);
|
|
||||||
#if 0 /* Not used */
|
|
||||||
long ares__tvdiff(struct timeval t1, struct timeval t2);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define ARES_SWAP_BYTE(a,b) \
|
|
||||||
{ unsigned char swapByte = *(a); *(a) = *(b); *(b) = swapByte; }
|
|
||||||
|
|
||||||
#define SOCK_STATE_CALLBACK(c, s, r, w) \
|
|
||||||
do { \
|
|
||||||
if ((c)->sock_state_cb) \
|
|
||||||
(c)->sock_state_cb((c)->sock_state_cb_data, (s), (r), (w)); \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#ifdef CURLDEBUG
|
|
||||||
/* 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
|
|
||||||
c-ares is built and linked with a similarly debug-build libcurl, but we do
|
|
||||||
this anyway for convenience. */
|
|
||||||
#include "../lib/memdebug.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* __ARES_PRIVATE_H */
|
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
.\" $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.
|
|
||||||
.\"
|
|
||||||
.TH ARES_PROCESS 3 "25 July 1998"
|
|
||||||
.SH NAME
|
|
||||||
ares_process \- Process events for name resolution
|
|
||||||
.SH SYNOPSIS
|
|
||||||
.nf
|
|
||||||
.B #include <ares.h>
|
|
||||||
.PP
|
|
||||||
.B void ares_process(ares_channel \fIchannel\fP, fd_set *\fIread_fds\fP,
|
|
||||||
.B fd_set *\fIwrite_fds\fP)
|
|
||||||
.fi
|
|
||||||
.PP
|
|
||||||
.B void ares_process_fd(ares_channel \fIchannel\fP,
|
|
||||||
.B ares_socket_t \fIread_fd\fP,
|
|
||||||
.B ares_socket_t \fIwrite_fd\fP)
|
|
||||||
.fi
|
|
||||||
.SH DESCRIPTION
|
|
||||||
The \fBares_process(3)\fP function handles input/output events and timeouts
|
|
||||||
associated with queries pending on the name service channel identified by
|
|
||||||
.IR channel .
|
|
||||||
The file descriptor sets pointed to by \fIread_fds\fP and \fIwrite_fds\fP
|
|
||||||
should have file descriptors set in them according to whether the file
|
|
||||||
descriptors specified by \fIares_fds(3)\fP are ready for reading and writing.
|
|
||||||
(The easiest way to determine this information is to invoke
|
|
||||||
.B select
|
|
||||||
with a timeout no greater than the timeout given by \fIares_timeout(3)\fP ).
|
|
||||||
.PP
|
|
||||||
The
|
|
||||||
.B ares_process
|
|
||||||
function will invoke callbacks for pending queries if they complete
|
|
||||||
successfully or fail.
|
|
||||||
|
|
||||||
\fBares_process_fd(3)\fP works the same way but acts and operates only on the
|
|
||||||
specific file descriptors (sockets) you pass in to the function. Use
|
|
||||||
ARES_SOCKET_BAD for "no action". This function is of course provided to allow
|
|
||||||
users of c-ares to void select() in their applications and within c-ares.
|
|
||||||
.SS EXAMPLE
|
|
||||||
The following code fragment waits for all pending queries on a channel
|
|
||||||
to complete:
|
|
||||||
.PP
|
|
||||||
.RS
|
|
||||||
.nf
|
|
||||||
int nfds, count;
|
|
||||||
fd_set readers, writers;
|
|
||||||
struct timeval tv, *tvp;
|
|
||||||
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
FD_ZERO(&readers);
|
|
||||||
FD_ZERO(&writers);
|
|
||||||
nfds = ares_fds(channel, &readers, &writers);
|
|
||||||
if (nfds == 0)
|
|
||||||
break;
|
|
||||||
tvp = ares_timeout(channel, NULL, &tv);
|
|
||||||
count = select(nfds, &readers, &writers, NULL, tvp);
|
|
||||||
ares_process(channel, &readers, &writers);
|
|
||||||
}
|
|
||||||
.fi
|
|
||||||
.RE
|
|
||||||
.SH SEE ALSO
|
|
||||||
.BR ares_fds (3),
|
|
||||||
.BR ares_timeout (3)
|
|
||||||
.SH AUTHOR
|
|
||||||
Greg Hudson, MIT Information Systems
|
|
||||||
.br
|
|
||||||
Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||||
1170
ares/ares_process.c
1170
ares/ares_process.c
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user