Compare commits
1473 Commits
curl-7_19_
...
curl-7_21_
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6d7d0eba6d | ||
|
|
a865bd9fba | ||
|
|
0fd439ebac | ||
|
|
012f9b7f04 | ||
|
|
573a2900cd | ||
|
|
c28443c551 | ||
|
|
0b5901bec6 | ||
|
|
5965d4554d | ||
|
|
34127c7adc | ||
|
|
315e5277dc | ||
|
|
5c7c9a768d | ||
|
|
bf1c102b80 | ||
|
|
2271b60b71 | ||
|
|
c2bfe60086 | ||
|
|
63598059cd | ||
|
|
c1901f7ed0 | ||
|
|
9c4ff4874e | ||
|
|
46a0062dff | ||
|
|
d97fa56fd4 | ||
|
|
d534cd0027 | ||
|
|
afd6e738f7 | ||
|
|
de670efeab | ||
|
|
421d918da3 | ||
|
|
99a07a1fdf | ||
|
|
81c16c2e30 | ||
|
|
dd5d3518e4 | ||
|
|
07f60235b0 | ||
|
|
5580fb2b9c | ||
|
|
7e3f0bffe5 | ||
|
|
5d47bf3776 | ||
|
|
11cddb68e0 | ||
|
|
1b2b93e074 | ||
|
|
c328214a2d | ||
|
|
f6f5d7874f | ||
|
|
5db0a412ff | ||
|
|
cbe67a1b71 | ||
|
|
23245ca83a | ||
|
|
3590874999 | ||
|
|
e39ab6f203 | ||
|
|
c9081a8280 | ||
|
|
5088e3709d | ||
|
|
c2ba8ca81f | ||
|
|
ef24ecde68 | ||
|
|
e8bc33d0a3 | ||
|
|
5087f89ac8 | ||
|
|
b3d39275f5 | ||
|
|
1d75d30816 | ||
|
|
6fe18add71 | ||
|
|
d212fe43af | ||
|
|
13d537e404 | ||
|
|
46041ee918 | ||
|
|
1bb05ac16f | ||
|
|
091c52fef7 | ||
|
|
a83870ef9d | ||
|
|
a768e39b2d | ||
|
|
1c4fa240be | ||
|
|
5046dd02b9 | ||
|
|
4d6c0bdf74 | ||
|
|
cbf4961bf3 | ||
|
|
add5766dd4 | ||
|
|
8d59d69449 | ||
|
|
465865c3cb | ||
|
|
c539b83138 | ||
|
|
0a2edfc348 | ||
|
|
64520e43d4 | ||
|
|
c79f816c32 | ||
|
|
c8a7df108f | ||
|
|
8636742256 | ||
|
|
a1f32ffee5 | ||
|
|
fec5f03e22 | ||
|
|
2b2ac9068e | ||
|
|
890425ecd7 | ||
|
|
1df1032444 | ||
|
|
b1e4dce671 | ||
|
|
0b20de0194 | ||
|
|
d596a523b9 | ||
|
|
592df29f9c | ||
|
|
f1db21218b | ||
|
|
892cacef43 | ||
|
|
12b2412c52 | ||
|
|
7d8343934b | ||
|
|
7cebf22d57 | ||
|
|
c6b97a8278 | ||
|
|
f96a2641fc | ||
|
|
fc6c4c10f9 | ||
|
|
152578fb33 | ||
|
|
0a41318f1d | ||
|
|
4bde456f73 | ||
|
|
689ee8345c | ||
|
|
5d4355f19b | ||
|
|
710ecb6946 | ||
|
|
1b24b89cca | ||
|
|
dc3e7df1c9 | ||
|
|
1171bc5c8a | ||
|
|
3adb68c605 | ||
|
|
34498c13be | ||
|
|
517d3eb0a4 | ||
|
|
6a07e704ca | ||
|
|
95719fbea6 | ||
|
|
fbf51696ef | ||
|
|
1786950759 | ||
|
|
87374a47c9 | ||
|
|
368f5a8547 | ||
|
|
68a485b00a | ||
|
|
7b823badbc | ||
|
|
b0fd03f5b8 | ||
|
|
4b2fbe1e97 | ||
|
|
afecd1aa13 | ||
|
|
68cde058f6 | ||
|
|
809a748124 | ||
|
|
542318b113 | ||
|
|
909e711e74 | ||
|
|
d95b67f409 | ||
|
|
96945c98d5 | ||
|
|
1db61aca3b | ||
|
|
bbb6eb3aaa | ||
|
|
a4765b0551 | ||
|
|
29de7dd288 | ||
|
|
52e3c60c86 | ||
|
|
282b41c69b | ||
|
|
13e9571dd0 | ||
|
|
36420330de | ||
|
|
cc87913294 | ||
|
|
ca9f9cb875 | ||
|
|
0c8e5f7e6a | ||
|
|
59db31902c | ||
|
|
c36b00a166 | ||
|
|
59f07ddf28 | ||
|
|
e214cd4a73 | ||
|
|
5997f54a71 | ||
|
|
e8c442952d | ||
|
|
98d9dc7840 | ||
|
|
6164d40fce | ||
|
|
65ca4b547b | ||
|
|
d09a905751 | ||
|
|
0152dbbe23 | ||
|
|
2261ddf9db | ||
|
|
295496fa34 | ||
|
|
09a2d93a0f | ||
|
|
b0ccd24a72 | ||
|
|
11e131c9f9 | ||
|
|
4b0c411ce6 | ||
|
|
0f2e35b305 | ||
|
|
0cb3d7913c | ||
|
|
7e46061cac | ||
|
|
7b79c8bf96 | ||
|
|
04ae23afff | ||
|
|
987168d6b9 | ||
|
|
ea07fde40b | ||
|
|
e3df610ada | ||
|
|
72d9c96ad5 | ||
|
|
d371458348 | ||
|
|
ecd624b8e7 | ||
|
|
81f151c912 | ||
|
|
b804906414 | ||
|
|
2869b6ea2b | ||
|
|
2d3c7b7e01 | ||
|
|
edf9566c3b | ||
|
|
331531f70e | ||
|
|
51b8d30dc4 | ||
|
|
450c994a49 | ||
|
|
6a43ffa0d5 | ||
|
|
6a90aa3f3d | ||
|
|
1998de9993 | ||
|
|
61f4cdb73a | ||
|
|
cda02fb78b | ||
|
|
a5f96b49d1 | ||
|
|
18e7b52e8e | ||
|
|
6d272e53a2 | ||
|
|
9bce615f46 | ||
|
|
81e107010e | ||
|
|
70e8814e44 | ||
|
|
fc137ee272 | ||
|
|
79cd7ef9ab | ||
|
|
4b69f641a6 | ||
|
|
2ae6c47d5d | ||
|
|
15622e69a9 | ||
|
|
8500586251 | ||
|
|
3aef3ed8f6 | ||
|
|
488f9545a2 | ||
|
|
588402585b | ||
|
|
750c9179ca | ||
|
|
5f0ae7a062 | ||
|
|
8fa519dce4 | ||
|
|
5fb4279ec7 | ||
|
|
67c83eb9eb | ||
|
|
9e1083488f | ||
|
|
dfaaa99ded | ||
|
|
87badbef84 | ||
|
|
e3811ed7c3 | ||
|
|
dacc44ddc2 | ||
|
|
fc9f369829 | ||
|
|
bfbc4c7e00 | ||
|
|
05b72a6af2 | ||
|
|
1e2056fecb | ||
|
|
5df13c3173 | ||
|
|
ed4eecc05e | ||
|
|
7e1a45e224 | ||
|
|
e329586489 | ||
|
|
397e61128f | ||
|
|
578e833d3b | ||
|
|
4d58f97f60 | ||
|
|
33c3bb057b | ||
|
|
6bf2014745 | ||
|
|
a10f5b34ff | ||
|
|
b1df37c60e | ||
|
|
31d59fb2cc | ||
|
|
562d40e671 | ||
|
|
612832e4c0 | ||
|
|
3c69a08e3b | ||
|
|
5ea9e78bd7 | ||
|
|
69d7c48072 | ||
|
|
7d4f8c2809 | ||
|
|
d23c59ecfc | ||
|
|
1d95a48fe9 | ||
|
|
512a82d395 | ||
|
|
fbb38de415 | ||
|
|
0006cdddee | ||
|
|
b684ccd8b1 | ||
|
|
3f64d05d34 | ||
|
|
e4128f90ba | ||
|
|
e991a3536d | ||
|
|
8665d4e593 | ||
|
|
0e36bb71f2 | ||
|
|
19f45eaa79 | ||
|
|
70a025f3df | ||
|
|
95e230c591 | ||
|
|
5fcc4332d6 | ||
|
|
7d84113e1d | ||
|
|
f3df524b62 | ||
|
|
c47148f142 | ||
|
|
8a00c94b0f | ||
|
|
9de4b26643 | ||
|
|
3208757c1a | ||
|
|
fae19aed8d | ||
|
|
c59dba338e | ||
|
|
a76f852ca4 | ||
|
|
3880dd3741 | ||
|
|
d8041a7ea5 | ||
|
|
abde4c9d84 | ||
|
|
6d88d58dd5 | ||
|
|
fbefd816e4 | ||
|
|
296b246b9c | ||
|
|
5393f08df8 | ||
|
|
b5da54e6c9 | ||
|
|
22085f7d6e | ||
|
|
2c1b4e74e4 | ||
|
|
aca67e2775 | ||
|
|
8e2f16e66f | ||
|
|
a7f6747019 | ||
|
|
c3c4626fab | ||
|
|
9808480860 | ||
|
|
6ce76e6996 | ||
|
|
64f12a3b9f | ||
|
|
18a758d907 | ||
|
|
7aea2d522d | ||
|
|
f3e3f5f1b2 | ||
|
|
62ef465262 | ||
|
|
c6fa1952a1 | ||
|
|
d47bd396ce | ||
|
|
6882ae8dee | ||
|
|
a00297158e | ||
|
|
413cbdce3c | ||
|
|
864d5add0d | ||
|
|
3238ef5b69 | ||
|
|
ca10e28f06 | ||
|
|
5e92015711 | ||
|
|
ce00c2ef5d | ||
|
|
0db9140747 | ||
|
|
55c266de6d | ||
|
|
3af696f7c4 | ||
|
|
09cee1633b | ||
|
|
8d121b6f8f | ||
|
|
892d6930e7 | ||
|
|
200e9b5dd1 | ||
|
|
b0873cb657 | ||
|
|
19d2bf4ee4 | ||
|
|
ae467115bb | ||
|
|
f43ecac175 | ||
|
|
d2a7fd2fe6 | ||
|
|
29439acfeb | ||
|
|
a049528e94 | ||
|
|
2fbbddbe85 | ||
|
|
ecb3fe63d7 | ||
|
|
6ed72fd7fa | ||
|
|
40e1623649 | ||
|
|
53151db167 | ||
|
|
cb64c987a0 | ||
|
|
67d1616018 | ||
|
|
65629f2915 | ||
|
|
795107453d | ||
|
|
201637d468 | ||
|
|
6b6a3bcb61 | ||
|
|
0cbdcd07a8 | ||
|
|
d106189a47 | ||
|
|
ddb810ab70 | ||
|
|
77ba147e76 | ||
|
|
bed311eda2 | ||
|
|
9a0b6e42af | ||
|
|
cfdc4aca45 | ||
|
|
ab6681c2c8 | ||
|
|
eeb2cb05a1 | ||
|
|
daa96f9928 | ||
|
|
f37affab8c | ||
|
|
dc4adc484f | ||
|
|
d0dea8f869 | ||
|
|
ab81f6c7c4 | ||
|
|
ebbe694e78 | ||
|
|
70baf46d8d | ||
|
|
280d2cff2e | ||
|
|
ac20f52ed3 | ||
|
|
59842d4d5f | ||
|
|
2b6208a6de | ||
|
|
2f0532a072 | ||
|
|
6b490ed33c | ||
|
|
4d703ee100 | ||
|
|
13b8fc46a3 | ||
|
|
9f4a174698 | ||
|
|
8f6189600f | ||
|
|
41572648db | ||
|
|
b980c9a027 | ||
|
|
9124bfba45 | ||
|
|
232ad6549a | ||
|
|
03da3ba1c0 | ||
|
|
4d53dc5d80 | ||
|
|
5907777153 | ||
|
|
72da720b4a | ||
|
|
a6e088e855 | ||
|
|
4342a2087a | ||
|
|
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 |
22
.cvsignore
22
.cvsignore
@@ -1,22 +0,0 @@
|
|||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
aclocal.m4
|
|
||||||
aclocal.m4.bak
|
|
||||||
autom4te.cache
|
|
||||||
compile
|
|
||||||
config.guess
|
|
||||||
curl_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
|
||||||
57
Android.mk
57
Android.mk
@@ -1,15 +1,48 @@
|
|||||||
# Google Android makefile for curl and libcurl
|
# Google Android makefile for curl and libcurl
|
||||||
|
#
|
||||||
# Place the curl source (including this makefile) into external/curl/ in the
|
# 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'
|
# Android source tree. Then build them with 'make curl' or just 'make libcurl'
|
||||||
# from the Android root.
|
# 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
|
# Note: you must first create a curl_config.h file by running configure in the
|
||||||
# Android environment. I haven't found an easy way to do this yet. If there is
|
# Android environment. The only way I've found to do this is tricky. Perform a
|
||||||
# no easy way, a static config-android.h may need to be created and checked in
|
# normal Android build with libcurl in the source tree, providing the target
|
||||||
# to the libcurl source tree.
|
# "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
|
# Dan Fandrich
|
||||||
# July 2009
|
# August 2010
|
||||||
|
|
||||||
LOCAL_PATH:= $(call my-dir)
|
LOCAL_PATH:= $(call my-dir)
|
||||||
|
|
||||||
@@ -41,6 +74,14 @@ LOCAL_COPY_HEADERS := $(addprefix include/curl/,$(CURL_HEADERS))
|
|||||||
|
|
||||||
LOCAL_MODULE:= libcurl
|
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)
|
include $(BUILD_STATIC_LIBRARY)
|
||||||
|
|
||||||
|
|
||||||
@@ -49,7 +90,7 @@ include $(BUILD_STATIC_LIBRARY)
|
|||||||
|
|
||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
include $(LOCAL_PATH)/src/Makefile.inc
|
include $(LOCAL_PATH)/src/Makefile.inc
|
||||||
LOCAL_SRC_FILES := $(addprefix src/,$(CURL_SOURCES))
|
LOCAL_SRC_FILES := $(addprefix src/,$(CURL_CFILES))
|
||||||
|
|
||||||
LOCAL_MODULE := curl
|
LOCAL_MODULE := curl
|
||||||
LOCAL_STATIC_LIBRARIES := libcurl
|
LOCAL_STATIC_LIBRARIES := libcurl
|
||||||
@@ -57,8 +98,8 @@ LOCAL_SYSTEM_SHARED_LIBRARIES := libc
|
|||||||
|
|
||||||
LOCAL_C_INCLUDES += $(LOCAL_PATH)/include $(LOCAL_PATH)/lib
|
LOCAL_C_INCLUDES += $(LOCAL_PATH)/include $(LOCAL_PATH)/lib
|
||||||
|
|
||||||
# This will also need to include $(CURLX_ONES) in order to correctly build
|
# This may also need to include $(CURLX_ONES) in order to correctly link
|
||||||
# a dynamic library
|
# if libcurl is changed to be built as a dynamic library
|
||||||
LOCAL_CFLAGS += $(common_CFLAGS)
|
LOCAL_CFLAGS += $(common_CFLAGS)
|
||||||
|
|
||||||
include $(BUILD_EXECUTABLE)
|
include $(BUILD_EXECUTABLE)
|
||||||
|
|||||||
@@ -6,6 +6,9 @@
|
|||||||
# 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
|
#ifdef _WIN32
|
||||||
# include <winsock2.h>
|
# include <winsock2.h>
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ macro(CHECK_TYPE_SIZE TYPE 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
|
||||||
|
HAVE_STDINT_H HAVE_STDDEF_H HAVE_SYS_SOCKET_H)
|
||||||
if("${def}")
|
if("${def}")
|
||||||
set(MACRO_CHECK_TYPE_SIZE_FLAGS
|
set(MACRO_CHECK_TYPE_SIZE_FLAGS
|
||||||
"${MACRO_CHECK_TYPE_SIZE_FLAGS} -D${def}")
|
"${MACRO_CHECK_TYPE_SIZE_FLAGS} -D${def}")
|
||||||
|
|||||||
@@ -55,10 +55,7 @@ message(STATUS "curl version=[${CURL_VERSION}]")
|
|||||||
set(OPERATING_SYSTEM "${CMAKE_SYSTEM_NAME}")
|
set(OPERATING_SYSTEM "${CMAKE_SYSTEM_NAME}")
|
||||||
set(OS "\"${CMAKE_SYSTEM_NAME}\"")
|
set(OS "\"${CMAKE_SYSTEM_NAME}\"")
|
||||||
|
|
||||||
# Make the base headers visible to everything
|
include_directories(${PROJECT_BINARY_DIR}/include/curl)
|
||||||
# IF(NOT ${PROJECT_BINARY_DIR} EQUAL ${PROJECT_SOURCE_DIR})
|
|
||||||
# INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR}/include)
|
|
||||||
# ENDIF()
|
|
||||||
include_directories( ${CURL_SOURCE_DIR}/include )
|
include_directories( ${CURL_SOURCE_DIR}/include )
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
@@ -123,16 +120,11 @@ if(WIN32)
|
|||||||
if( NOT HAVE_WLDAP32)
|
if( NOT HAVE_WLDAP32)
|
||||||
set(CURL_DISABLE_LDAP ON CACHE BOOL "" FORCE)
|
set(CURL_DISABLE_LDAP ON CACHE BOOL "" FORCE)
|
||||||
message(STATUS "wldap32 not found CURL_DISABLE_LDAP set ON")
|
message(STATUS "wldap32 not found CURL_DISABLE_LDAP set ON")
|
||||||
option(CURL_LDAP_WIN "Use W$ LDAP implementation" OFF)
|
option(CURL_LDAP_WIN "Use Windows LDAP implementation" OFF)
|
||||||
else()
|
else()
|
||||||
option(CURL_LDAP_WIN "Use W$ LDAP implementation" ON)
|
option(CURL_LDAP_WIN "Use Windows LDAP implementation" ON)
|
||||||
endif()
|
endif()
|
||||||
mark_as_advanced(CURL_LDAP_WIN)
|
mark_as_advanced(CURL_LDAP_WIN)
|
||||||
set(CURL_LDAP_HYBRID OFF)
|
|
||||||
else()
|
|
||||||
option(CURL_LDAP_HYBRID "W$ LDAP with non-W$ compiler" OFF)
|
|
||||||
mark_as_advanced(CURL_LDAP_HYBRID)
|
|
||||||
set(CURL_LDAP_WIN OFF)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(HTTP_ONLY)
|
if(HTTP_ONLY)
|
||||||
@@ -216,7 +208,6 @@ endmacro(CHECK_LIBRARY_EXISTS_CONCAT)
|
|||||||
|
|
||||||
# Check for all needed libraries
|
# Check for all needed libraries
|
||||||
check_library_exists_concat("dl" dlopen HAVE_LIBDL)
|
check_library_exists_concat("dl" dlopen HAVE_LIBDL)
|
||||||
#CHECK_LIBRARY_EXISTS_CONCAT("ucb" gethostname HAVE_LIBUCB)
|
|
||||||
check_library_exists_concat("socket" connect HAVE_LIBSOCKET)
|
check_library_exists_concat("socket" connect HAVE_LIBSOCKET)
|
||||||
check_library_exists("c" gethostbyname "" NOT_NEED_LIBNSL)
|
check_library_exists("c" gethostbyname "" NOT_NEED_LIBNSL)
|
||||||
|
|
||||||
@@ -248,9 +239,10 @@ if(CMAKE_USE_OPENSSL)
|
|||||||
set(USE_SSLEAY TRUE)
|
set(USE_SSLEAY TRUE)
|
||||||
set(USE_OPENSSL TRUE)
|
set(USE_OPENSSL TRUE)
|
||||||
list(APPEND CURL_LIBS ${OPENSSL_LIBRARIES} )
|
list(APPEND CURL_LIBS ${OPENSSL_LIBRARIES} )
|
||||||
|
else()
|
||||||
|
set(CMAKE_USE_OPENSSL FALSE)
|
||||||
|
message(STATUS "OpenSSL NOT Found, disabling CMAKE_USE_OPENSSL")
|
||||||
endif()
|
endif()
|
||||||
#FIND_LIBRARY(LIBEAY NAMES libeay32)
|
|
||||||
#LIST(APPEND CURL_LIBS ${LIBEAY} )
|
|
||||||
else(WIN32)
|
else(WIN32)
|
||||||
check_library_exists_concat("crypto" CRYPTO_lock HAVE_LIBCRYPTO)
|
check_library_exists_concat("crypto" CRYPTO_lock HAVE_LIBCRYPTO)
|
||||||
check_library_exists_concat("ssl" SSL_connect HAVE_LIBSSL)
|
check_library_exists_concat("ssl" SSL_connect HAVE_LIBSSL)
|
||||||
@@ -395,11 +387,17 @@ if(CMAKE_USE_OPENSSL)
|
|||||||
check_include_file_concat("openssl/rand.h" HAVE_OPENSSL_RAND_H)
|
check_include_file_concat("openssl/rand.h" HAVE_OPENSSL_RAND_H)
|
||||||
endif(CMAKE_USE_OPENSSL)
|
endif(CMAKE_USE_OPENSSL)
|
||||||
|
|
||||||
|
if(NOT HAVE_LDAP_H)
|
||||||
|
message(STATUS "LDAP_H not found CURL_DISABLE_LDAP set ON")
|
||||||
|
set(CURL_DISABLE_LDAP ON CACHE BOOL "" FORCE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
check_type_size(size_t SIZEOF_SIZE_T)
|
check_type_size(size_t SIZEOF_SIZE_T)
|
||||||
check_type_size(ssize_t SIZEOF_SSIZE_T)
|
check_type_size(ssize_t SIZEOF_SSIZE_T)
|
||||||
check_type_size("long long" SIZEOF_LONG_LONG)
|
check_type_size("long long" SIZEOF_LONG_LONG)
|
||||||
check_type_size("long" SIZEOF_LONG)
|
check_type_size("long" SIZEOF_LONG)
|
||||||
|
check_type_size("short" SIZEOF_SHORT)
|
||||||
check_type_size("int" SIZEOF_INT)
|
check_type_size("int" SIZEOF_INT)
|
||||||
check_type_size("__int64" SIZEOF___INT64)
|
check_type_size("__int64" SIZEOF___INT64)
|
||||||
check_type_size("long double" SIZEOF_LONG_DOUBLE)
|
check_type_size("long double" SIZEOF_LONG_DOUBLE)
|
||||||
@@ -784,6 +782,10 @@ endif(CMAKE_COMPILER_IS_GNUCC AND APPLE)
|
|||||||
if(HAVE_SOCKLEN_T)
|
if(HAVE_SOCKLEN_T)
|
||||||
set(CURL_TYPEOF_CURL_SOCKLEN_T "socklen_t")
|
set(CURL_TYPEOF_CURL_SOCKLEN_T "socklen_t")
|
||||||
check_type_size("socklen_t" CURL_SIZEOF_CURL_SOCKLEN_T)
|
check_type_size("socklen_t" CURL_SIZEOF_CURL_SOCKLEN_T)
|
||||||
|
if(NOT HAVE_CURL_SIZEOF_CURL_SOCKLEN_T)
|
||||||
|
message(FATAL_ERROR
|
||||||
|
"Check for sizeof socklen_t failed, see CMakeFiles/CMakerror.log")
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
set(CURL_TYPEOF_CURL_SOCKLEN_T int)
|
set(CURL_TYPEOF_CURL_SOCKLEN_T int)
|
||||||
set(CURL_SIZEOF_CURL_SOCKLEN_T ${SIZEOF_INT})
|
set(CURL_SIZEOF_CURL_SOCKLEN_T ${SIZEOF_INT})
|
||||||
@@ -829,45 +831,13 @@ function(TRANSFORM_MAKEFILE_INC INPUT_FILE OUTPUT_FILE)
|
|||||||
string(REPLACE "$(top_builddir)" "\${CURL_BINARY_DIR}" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})
|
string(REPLACE "$(top_builddir)" "\${CURL_BINARY_DIR}" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})
|
||||||
|
|
||||||
string(REGEX REPLACE "\\\\\n" "<22>!<21>" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})
|
string(REGEX REPLACE "\\\\\n" "<22>!<21>" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})
|
||||||
string(REGEX REPLACE "([a-zA-Z_][a-zA-Z0-9_]*)[\t ]*=[\t ]*([^\n]*\n)" "SET(\\1 \\2)\n" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})
|
string(REGEX REPLACE "([a-zA-Z_][a-zA-Z0-9_]*)[\t ]*=[\t ]*([^\n]*)" "SET(\\1 \\2)" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})
|
||||||
string(REPLACE "<22>!<21>" "\n" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})
|
string(REPLACE "<22>!<21>" "\n" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})
|
||||||
|
|
||||||
string(REGEX REPLACE "\\$\\(([a-zA-Z_][a-zA-Z0-9_]*)\\)" "\${\\1}" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT}) # Replace $() with ${}
|
string(REGEX REPLACE "\\$\\(([a-zA-Z_][a-zA-Z0-9_]*)\\)" "\${\\1}" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT}) # Replace $() with ${}
|
||||||
string(REGEX REPLACE "@([a-zA-Z_][a-zA-Z0-9_]*)@" "\${\\1}" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT}) # Replace @@ with ${}, even if that may not be read by CMake scripts.
|
string(REGEX REPLACE "@([a-zA-Z_][a-zA-Z0-9_]*)@" "\${\\1}" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT}) # Replace @@ with ${}, even if that may not be read by CMake scripts.
|
||||||
file(WRITE ${OUTPUT_FILE} ${MAKEFILE_INC_TEXT})
|
file(WRITE ${OUTPUT_FILE} ${MAKEFILE_INC_TEXT})
|
||||||
|
|
||||||
### BUGGY METHOD 1
|
|
||||||
# FILE(STRINGS Makefile.inc MAKEFILE_INC_TEXT)
|
|
||||||
# STRING(REPLACE "# ./lib/Makefile.inc" "" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})
|
|
||||||
# STRING(REPLACE " " " " MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT}) # Replace tabs with spaces
|
|
||||||
|
|
||||||
# #STRING(REGEX MATCH "CSOURCES *=" AAA ${MAKEFILE_INC_TEXT})
|
|
||||||
# #MESSAGE(STATUS ${AAA})
|
|
||||||
|
|
||||||
# STRING(REPLACE "CSOURCES =" "" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})
|
|
||||||
# STRING(REPLACE "HHEADERS =" "" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})
|
|
||||||
|
|
||||||
# STRING(REGEX REPLACE "[^ ]+\\.c" "" ${HEADERS_VAR} ${MAKEFILE_INC_TEXT}) # Remove source files and store into headers var
|
|
||||||
# STRING(REGEX REPLACE " +" " " ${HEADERS_VAR} ${${HEADERS_VAR}})
|
|
||||||
# STRING(REGEX REPLACE " " ";" ${HEADERS_VAR} ${${HEADERS_VAR}})
|
|
||||||
|
|
||||||
# STRING(REGEX REPLACE "[^ ]+\\.h" "" ${SOURCES_VAR} ${MAKEFILE_INC_TEXT}) # Remove headers and store into source files var
|
|
||||||
# STRING(REGEX REPLACE " +" " " ${SOURCES_VAR} ${${SOURCES_VAR}})
|
|
||||||
# STRING(REGEX REPLACE " " ";" ${SOURCES_VAR} ${${SOURCES_VAR}})
|
|
||||||
|
|
||||||
# SET(${HEADERS_VAR} ${${HEADERS_VAR}} PARENT_SCOPE)
|
|
||||||
# SET(${SOURCES_VAR} ${${SOURCES_VAR}} PARENT_SCOPE)
|
|
||||||
|
|
||||||
### BUGGY METHOD 2
|
|
||||||
# FILE(READ Makefile.inc MAKEFILE_INC_TEXT)
|
|
||||||
# #STRING(REPLACE "\t" " " MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT}) # Replace tabs with spaces
|
|
||||||
# #STRING(REGEX REPLACE "\n+" "\n" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT}) # Remove empty lines (allow a simplification in the script)
|
|
||||||
# STRING(REGEX REPLACE "([A-Z]+)[\t ]*=[\t ]*" "SET(\\1 " MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})
|
|
||||||
# #STRING(REGEX REPLACE "^(.*)[\t ]*[^\\]$" ")" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})
|
|
||||||
# STRING(REGEX REPLACE "([^\\])\n" "\\1)\n" MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})
|
|
||||||
# # STRING(REGEX REPLACE "CSOURCES *=" "SET(libCurl_SRCS " MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})
|
|
||||||
# # STRING(REGEX REPLACE "HHEADERS *=" "SET(libCurl_HEADERS " MAKEFILE_INC_TEXT ${MAKEFILE_INC_TEXT})
|
|
||||||
# FILE(WRITE Makefile.inc.cmake ${MAKEFILE_INC_TEXT})
|
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
add_subdirectory(lib)
|
add_subdirectory(lib)
|
||||||
|
|||||||
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.
|
||||||
|
|
||||||
|
|||||||
@@ -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"
|
||||||
118
MacOSX-Framework
118
MacOSX-Framework
@@ -1,26 +1,76 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# This script performs all of the steps needed to build a
|
# This script performs all of the steps needed to build a
|
||||||
# universal binary libcurl.framework for Mac OS X 10.4 or greater.
|
# universal binary libcurl.framework for Mac OS X 10.4 or greater.
|
||||||
|
#
|
||||||
|
# Hendrik Visage:
|
||||||
|
# Generalizations added since Snowleopard (10.6) do not include
|
||||||
|
# the 10.4u SDK.
|
||||||
|
#
|
||||||
|
# Also note:
|
||||||
|
# 10.5 is the *ONLY* SDK that support PPC64 :( -- 10.6 do not have ppc64 support
|
||||||
|
#If you need to have PPC64 support then change below to 1
|
||||||
|
PPC64_NEEDED=0
|
||||||
|
|
||||||
|
# For me the default is to develop for the platform I am on, and if you
|
||||||
|
#desire compatibility with older versions then change USE_OLD to 1 :)
|
||||||
|
USE_OLD=0
|
||||||
|
|
||||||
VERSION=`/usr/bin/sed -ne 's/^#define LIBCURL_VERSION "\(.*\)"/\1/p' include/curl/curlver.h`
|
VERSION=`/usr/bin/sed -ne 's/^#define LIBCURL_VERSION "\(.*\)"/\1/p' include/curl/curlver.h`
|
||||||
|
FRAMEWORK_VERSION=Versions/Release-$VERSION
|
||||||
|
|
||||||
SDK32='/Developer/SDKs/MacOSX10.4u.sdk'
|
#I also wanted to "copy over" the system, and thus the reason I added the
|
||||||
|
# version to Versions/Release-7.20.1 etc.
|
||||||
|
# now a simple rsync -vaP libcurl.framework /Library/Frameworks will install it
|
||||||
|
# and setup the right paths to this version, leaving the system version
|
||||||
|
# "intact", so you can "fix" it later with the links to Versions/A/...
|
||||||
|
|
||||||
MINVER32='-mmacosx-version-min=10.4'
|
|
||||||
|
|
||||||
ARCHES32='-arch ppc -arch i386'
|
OLD_SDK=`ls /Developer/SDKs|head -1`
|
||||||
|
NEW_SDK=`ls -r /Developer/SDKs|head -1`
|
||||||
|
|
||||||
SDK64='/Developer/SDKs/MacOSX10.5.sdk'
|
if test "0"$USE_OLD -gt 0
|
||||||
|
then
|
||||||
|
SDK32=$OLD_SDK
|
||||||
|
else
|
||||||
|
SDK32=$NEW_SDK
|
||||||
|
fi
|
||||||
|
|
||||||
MINVER64='-mmacosx-version-min=10.5'
|
MACVER=`echo $SDK32|sed -e s/[a-zA-Z]//g -e s/.\$//`
|
||||||
|
|
||||||
ARCHES64='-arch ppc64 -arch x86_64'
|
SDK32_DIR='/Developer/SDKs/'$SDK32
|
||||||
|
MINVER32='-mmacosx-version-min='$MACVER
|
||||||
|
ARCHES32='-arch i386 -arch ppc'
|
||||||
|
|
||||||
if test -d $SDK32; then
|
|
||||||
|
if test $PPC64_NEEDED -gt 0
|
||||||
|
then
|
||||||
|
SDK64=10.5
|
||||||
|
ARCHES64='-arch x86_64 -arch ppc64'
|
||||||
|
SDK64=`ls /Developer/SDKs|grep 10.5|head -1`
|
||||||
|
else
|
||||||
|
ARCHES64='-arch x86_64'
|
||||||
|
#We "know" that 10.4 and earlier do not support 64bit
|
||||||
|
OLD_SDK64=`ls /Developer/SDKs|egrep -v "10.[0-4]"|head -1`
|
||||||
|
NEW_SDK64=`ls -r /Developer/SDKs|egrep -v "10.[0-4]"|head -1`
|
||||||
|
if test $USE_OLD -gt 0
|
||||||
|
then
|
||||||
|
SDK64=$OLD_SDK64
|
||||||
|
else
|
||||||
|
SDK64=$NEW_SDK64
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
SDK64_DIR='/Developer/SDKs/'$SDK64
|
||||||
|
MACVER64=`echo $SDK64|sed -e s/[a-zA-Z]//g -e s/.\$//`
|
||||||
|
|
||||||
|
MINVER64='-mmacosx-version-min='$MACVER64
|
||||||
|
|
||||||
|
if test ! -z $SDK32; then
|
||||||
echo "----Configuring libcurl for 32 bit universal framework..."
|
echo "----Configuring libcurl for 32 bit universal framework..."
|
||||||
|
make clean
|
||||||
./configure --disable-dependency-tracking --disable-static --with-gssapi \
|
./configure --disable-dependency-tracking --disable-static --with-gssapi \
|
||||||
CFLAGS="-Os -isysroot $SDK32 $ARCHES32 $MINVER32" \
|
CFLAGS="-Os -isysroot $SDK32_DIR $ARCHES32 $MINVER32" \
|
||||||
LDFLAGS="-Wl,-syslibroot,$SDK32 $ARCHES32 $MINVER32 -Wl,-headerpad_max_install_names" \
|
LDFLAGS="-Wl,-syslibroot,$SDK32_DIR $ARCHES32 $MINVER32 -Wl,-headerpad_max_install_names" \
|
||||||
CC=$CC
|
CC=$CC
|
||||||
|
|
||||||
echo "----Building 32 bit libcurl..."
|
echo "----Building 32 bit libcurl..."
|
||||||
@@ -28,40 +78,43 @@ if test -d $SDK32; then
|
|||||||
|
|
||||||
echo "----Creating 32 bit framework..."
|
echo "----Creating 32 bit framework..."
|
||||||
rm -r libcurl.framework
|
rm -r libcurl.framework
|
||||||
mkdir -p libcurl.framework/Versions/A/Resources
|
mkdir -p libcurl.framework/${FRAMEWORK_VERSION}/Resources
|
||||||
cp lib/.libs/libcurl.dylib libcurl.framework/Versions/A/libcurl
|
cp lib/.libs/libcurl.dylib libcurl.framework/${FRAMEWORK_VERSION}/libcurl
|
||||||
install_name_tool -id @executable_path/../Frameworks/libcurl.framework/Versions/A/libcurl libcurl.framework/Versions/A/libcurl
|
install_name_tool -id @executable_path/../Frameworks/libcurl.framework/${FRAMEWORK_VERSION}/libcurl libcurl.framework/${FRAMEWORK_VERSION}/libcurl
|
||||||
/usr/bin/sed -e "s/7\.12\.3/$VERSION/" lib/libcurl.plist >libcurl.framework/Versions/A/Resources/Info.plist
|
/usr/bin/sed -e "s/7\.12\.3/$VERSION/" lib/libcurl.plist >libcurl.framework/${FRAMEWORK_VERSION}/Resources/Info.plist
|
||||||
mkdir -p libcurl.framework/Versions/A/Headers/curl
|
mkdir -p libcurl.framework/${FRAMEWORK_VERSION}/Headers/curl
|
||||||
cp include/curl/*.h libcurl.framework/Versions/A/Headers/curl
|
cp include/curl/*.h libcurl.framework/${FRAMEWORK_VERSION}/Headers/curl
|
||||||
pushd libcurl.framework
|
pushd libcurl.framework
|
||||||
ln -fs Versions/A/libcurl libcurl
|
ln -fs ${FRAMEWORK_VERSION}/libcurl libcurl
|
||||||
ln -fs Versions/A/Resources Resources
|
ln -fs ${FRAMEWORK_VERSION}/Resources Resources
|
||||||
ln -fs Versions/A/Headers Headers
|
ln -fs ${FRAMEWORK_VERSION}/Headers Headers
|
||||||
cd Versions
|
cd Versions
|
||||||
ln -fs A Current
|
ln -fs ${FRAMEWORK_VERSION} Current
|
||||||
|
|
||||||
if test -d $SDK64; then
|
echo TEsting for SDK64
|
||||||
|
if test -d $SDK64_DIR; then
|
||||||
|
echo entering...
|
||||||
popd
|
popd
|
||||||
make clean
|
make clean
|
||||||
echo "----Configuring libcurl for 64 bit universal framework..."
|
echo "----Configuring libcurl for 64 bit universal framework..."
|
||||||
./configure --disable-dependency-tracking --disable-static --with-gssapi \
|
./configure --disable-dependency-tracking --disable-static --with-gssapi \
|
||||||
CFLAGS="-Os -isysroot $SDK64 $ARCHES64 $MINVER64" \
|
CFLAGS="-Os -isysroot $SDK64_DIR $ARCHES64 $MINVER64" \
|
||||||
LDFLAGS="-Wl,-syslibroot,$SDK64 $ARCHES64 $MINVER64 -Wl,-headerpad_max_install_names" \
|
LDFLAGS="-Wl,-syslibroot,$SDK64_DIR $ARCHES64 $MINVER64 -Wl,-headerpad_max_install_names" \
|
||||||
CC=$CC
|
CC=$CC
|
||||||
|
|
||||||
echo "----Building 64 bit libcurl..."
|
echo "----Building 64 bit libcurl..."
|
||||||
make
|
make
|
||||||
|
|
||||||
echo "----Appending 64 bit framework to 32 bit framework..."
|
echo "----Appending 64 bit framework to 32 bit framework..."
|
||||||
cp lib/.libs/libcurl.dylib libcurl.framework/Versions/A/libcurl64
|
cp lib/.libs/libcurl.dylib libcurl.framework/${FRAMEWORK_VERSION}/libcurl64
|
||||||
install_name_tool -id @executable_path/../Frameworks/libcurl.framework/Versions/A/libcurl libcurl.framework/Versions/A/libcurl64
|
install_name_tool -id @executable_path/../Frameworks/libcurl.framework/${FRAMEWORK_VERSION}/libcurl libcurl.framework/${FRAMEWORK_VERSION}/libcurl64
|
||||||
cp libcurl.framework/Versions/A/libcurl libcurl.framework/Versions/A/libcurl32
|
cp libcurl.framework/${FRAMEWORK_VERSION}/libcurl libcurl.framework/${FRAMEWORK_VERSION}/libcurl32
|
||||||
lipo libcurl.framework/Versions/A/libcurl32 libcurl.framework/Versions/A/libcurl64 -create -output libcurl.framework/Versions/A/libcurl
|
pwd
|
||||||
rm libcurl.framework/Versions/A/libcurl32 libcurl.framework/Versions/A/libcurl64
|
lipo libcurl.framework/${FRAMEWORK_VERSION}/libcurl32 libcurl.framework/${FRAMEWORK_VERSION}/libcurl64 -create -output libcurl.framework/${FRAMEWORK_VERSION}/libcurl
|
||||||
cp libcurl.framework/Versions/A/Headers/curl/curlbuild.h libcurl.framework/Versions/A/Headers/curl/curlbuild32.h
|
rm libcurl.framework/${FRAMEWORK_VERSION}/libcurl32 libcurl.framework/${FRAMEWORK_VERSION}/libcurl64
|
||||||
cp include/curl/curlbuild.h libcurl.framework/Versions/A/Headers/curl/curlbuild64.h
|
cp libcurl.framework/${FRAMEWORK_VERSION}/Headers/curl/curlbuild.h libcurl.framework/${FRAMEWORK_VERSION}/Headers/curl/curlbuild32.h
|
||||||
cat >libcurl.framework/Versions/A/Headers/curl/curlbuild.h <<EOF
|
cp include/curl/curlbuild.h libcurl.framework/${FRAMEWORK_VERSION}/Headers/curl/curlbuild64.h
|
||||||
|
cat >libcurl.framework/${FRAMEWORK_VERSION}/Headers/curl/curlbuild.h <<EOF
|
||||||
#ifdef __LP64__
|
#ifdef __LP64__
|
||||||
#include "curl/curlbuild64.h"
|
#include "curl/curlbuild64.h"
|
||||||
#else
|
#else
|
||||||
@@ -70,9 +123,10 @@ if test -d $SDK32; then
|
|||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
lipo -info libcurl.framework/Versions/A/libcurl
|
pwd
|
||||||
|
lipo -info libcurl.framework/${FRAMEWORK_VERSION}/libcurl
|
||||||
echo "libcurl.framework is built and can now be included in other projects."
|
echo "libcurl.framework is built and can now be included in other projects."
|
||||||
echo "Copy libcurl.framework to your bundle's Contents/Frameworks folder, ~/Library/Frameworks or /Library/Frameworks."
|
echo "Copy libcurl.framework to your bundle's Contents/Frameworks folder, ~/Library/Frameworks or /Library/Frameworks."
|
||||||
else
|
else
|
||||||
echo "Building libcurl.framework requires Mac OS X 10.4 or later with the MacOSX10.4u SDK installed."
|
echo "Building libcurl.framework requires Mac OS X 10.4 or later with the MacOSX10.4/5/6 SDK installed."
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -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; \
|
||||||
|
|||||||
106
Makefile.dist
106
Makefile.dist
@@ -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,17 @@ borland-clean:
|
|||||||
cd ..\src
|
cd ..\src
|
||||||
make -f Makefile.b32 clean
|
make -f Makefile.b32 clean
|
||||||
|
|
||||||
watcom:
|
watcom: .SYMBOLIC
|
||||||
cd lib
|
cd lib && $(MAKE) -u -f Makefile.Watcom
|
||||||
wmake -f Makefile.Watcom
|
cd src && $(MAKE) -u -f Makefile.Watcom
|
||||||
cd ..\src
|
|
||||||
wmake -f Makefile.Watcom
|
|
||||||
|
|
||||||
watcom-clean:
|
watcom-clean: .SYMBOLIC
|
||||||
cd lib
|
cd lib && $(MAKE) -u -f Makefile.Watcom clean
|
||||||
wmake -f Makefile.Watcom clean
|
cd src && $(MAKE) -u -f Makefile.Watcom clean
|
||||||
cd ..\src
|
|
||||||
wmake -f Makefile.Watcom clean
|
watcom-vclean: .SYMBOLIC
|
||||||
|
cd lib && $(MAKE) -u -f Makefile.Watcom vclean
|
||||||
|
cd src && $(MAKE) -u -f Makefile.Watcom vclean
|
||||||
|
|
||||||
mingw32:
|
mingw32:
|
||||||
$(MAKE) -C lib -f Makefile.m32
|
$(MAKE) -C lib -f Makefile.m32
|
||||||
@@ -87,17 +86,21 @@ mingw32-ssh2-ssl-sspi-zlib:
|
|||||||
$(MAKE) -C lib -f Makefile.m32 SSH2=1 SSL=1 SSPI=1 ZLIB=1
|
$(MAKE) -C lib -f Makefile.m32 SSH2=1 SSL=1 SSPI=1 ZLIB=1
|
||||||
$(MAKE) -C src -f Makefile.m32 SSH2=1 SSL=1 SSPI=1 ZLIB=1
|
$(MAKE) -C src -f Makefile.m32 SSH2=1 SSL=1 SSPI=1 ZLIB=1
|
||||||
|
|
||||||
|
mingw32-rtmp-ssh2-ssl-sspi-zlib:
|
||||||
|
$(MAKE) -C lib -f Makefile.m32 RTMP=1 SSH2=1 SSL=1 SSPI=1 ZLIB=1
|
||||||
|
$(MAKE) -C src -f Makefile.m32 RTMP=1 SSH2=1 SSL=1 SSPI=1 ZLIB=1
|
||||||
|
|
||||||
mingw32-clean:
|
mingw32-clean:
|
||||||
$(MAKE) -C lib -f Makefile.m32 clean
|
$(MAKE) -C lib -f Makefile.m32 clean
|
||||||
$(MAKE) -C src -f Makefile.m32 clean
|
$(MAKE) -C src -f Makefile.m32 clean
|
||||||
|
|
||||||
vc-clean:
|
vc-clean: $(VC)
|
||||||
cd lib
|
cd lib
|
||||||
nmake -f Makefile.$(VC) clean
|
nmake -f Makefile.$(VC) clean
|
||||||
cd ..\src
|
cd ..\src
|
||||||
nmake -f Makefile.$(VC) clean
|
nmake -f Makefile.$(VC) clean
|
||||||
|
|
||||||
vc-all:
|
vc-all: $(VC)
|
||||||
cd lib
|
cd lib
|
||||||
nmake -f Makefile.$(VC) cfg=release
|
nmake -f Makefile.$(VC) cfg=release
|
||||||
nmake -f Makefile.$(VC) cfg=release-ssl
|
nmake -f Makefile.$(VC) cfg=release-ssl
|
||||||
@@ -122,79 +125,85 @@ vc-all:
|
|||||||
nmake -f Makefile.$(VC) cfg=debug-dll-zlib-dll
|
nmake -f Makefile.$(VC) cfg=debug-dll-zlib-dll
|
||||||
nmake -f Makefile.$(VC) cfg=debug-dll-ssl-dll-zlib-dll
|
nmake -f Makefile.$(VC) cfg=debug-dll-ssl-dll-zlib-dll
|
||||||
|
|
||||||
vc:
|
vc: $(VC)
|
||||||
cd lib
|
cd lib
|
||||||
nmake /f Makefile.$(VC) cfg=release
|
nmake /f Makefile.$(VC) cfg=release
|
||||||
cd ..\src
|
cd ..\src
|
||||||
nmake /f Makefile.$(VC)
|
nmake /f Makefile.$(VC)
|
||||||
|
|
||||||
vc-x64:
|
vc-x64: $(VC)
|
||||||
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: $(VC)
|
||||||
cd lib
|
cd lib
|
||||||
nmake /f Makefile.$(VC) cfg=release-zlib
|
nmake /f Makefile.$(VC) cfg=release-zlib
|
||||||
cd ..\src
|
cd ..\src
|
||||||
nmake /f Makefile.$(VC) cfg=release-zlib
|
nmake /f Makefile.$(VC) cfg=release-zlib
|
||||||
|
|
||||||
vc-ssl:
|
vc-ssl: $(VC)
|
||||||
cd lib
|
cd lib
|
||||||
nmake /f Makefile.$(VC) cfg=release-ssl
|
nmake /f Makefile.$(VC) cfg=release-ssl
|
||||||
cd ..\src
|
cd ..\src
|
||||||
nmake /f Makefile.$(VC) cfg=release-ssl
|
nmake /f Makefile.$(VC) cfg=release-ssl
|
||||||
|
|
||||||
vc-ssl-zlib:
|
vc-ssl-zlib: $(VC)
|
||||||
cd lib
|
cd lib
|
||||||
nmake /f Makefile.$(VC) cfg=release-ssl-zlib
|
nmake /f Makefile.$(VC) cfg=release-ssl-zlib
|
||||||
cd ..\src
|
cd ..\src
|
||||||
nmake /f Makefile.$(VC) cfg=release-ssl-zlib
|
nmake /f Makefile.$(VC) cfg=release-ssl-zlib
|
||||||
|
|
||||||
vc-ssl-dll:
|
vc-x64-ssl-zlib: $(VC)
|
||||||
|
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)
|
||||||
cd lib
|
cd lib
|
||||||
nmake /f Makefile.$(VC) cfg=release-ssl-dll
|
nmake /f Makefile.$(VC) cfg=release-ssl-dll
|
||||||
cd ..\src
|
cd ..\src
|
||||||
nmake /f Makefile.$(VC) cfg=release-ssl-dll
|
nmake /f Makefile.$(VC) cfg=release-ssl-dll
|
||||||
|
|
||||||
vc-dll-ssl-dll:
|
vc-dll-ssl-dll: $(VC)
|
||||||
cd lib
|
cd lib
|
||||||
nmake /f Makefile.$(VC) cfg=release-dll-ssl-dll
|
nmake /f Makefile.$(VC) cfg=release-dll-ssl-dll
|
||||||
cd ..\src
|
cd ..\src
|
||||||
nmake /f Makefile.$(VC) cfg=release-dll-ssl-dll
|
nmake /f Makefile.$(VC) cfg=release-dll-ssl-dll
|
||||||
|
|
||||||
vc-dll:
|
vc-dll: $(VC)
|
||||||
cd lib
|
cd lib
|
||||||
nmake /f Makefile.$(VC) cfg=release-dll
|
nmake /f Makefile.$(VC) cfg=release-dll
|
||||||
cd ..\src
|
cd ..\src
|
||||||
nmake /f Makefile.$(VC) cfg=release-dll
|
nmake /f Makefile.$(VC) cfg=release-dll
|
||||||
|
|
||||||
vc-dll-zlib-dll:
|
vc-dll-zlib-dll: $(VC)
|
||||||
cd lib
|
cd lib
|
||||||
nmake /f Makefile.$(VC) cfg=release-dll-zlib-dll
|
nmake /f Makefile.$(VC) cfg=release-dll-zlib-dll
|
||||||
cd ..\src
|
cd ..\src
|
||||||
nmake /f Makefile.$(VC) cfg=release-dll-zlib-dll
|
nmake /f Makefile.$(VC) cfg=release-dll-zlib-dll
|
||||||
|
|
||||||
vc-dll-ssl-dll-zlib-dll:
|
vc-dll-ssl-dll-zlib-dll: $(VC)
|
||||||
cd lib
|
cd lib
|
||||||
nmake /f Makefile.$(VC) cfg=release-dll-ssl-dll-zlib-dll
|
nmake /f Makefile.$(VC) cfg=release-dll-ssl-dll-zlib-dll
|
||||||
cd ..\src
|
cd ..\src
|
||||||
nmake /f Makefile.$(VC) cfg=release-dll-ssl-dll-zlib-dll
|
nmake /f Makefile.$(VC) cfg=release-dll-ssl-dll-zlib-dll
|
||||||
|
|
||||||
vc-ssl-dll-zlib-dll:
|
vc-ssl-dll-zlib-dll: $(VC)
|
||||||
cd lib
|
cd lib
|
||||||
nmake /f Makefile.$(VC) cfg=release-ssl-dll-zlib-dll
|
nmake /f Makefile.$(VC) cfg=release-ssl-dll-zlib-dll
|
||||||
cd ..\src
|
cd ..\src
|
||||||
nmake /f Makefile.$(VC) cfg=release-ssl-dll-zlib-dll
|
nmake /f Makefile.$(VC) cfg=release-ssl-dll-zlib-dll
|
||||||
|
|
||||||
vc-zlib-dll:
|
vc-zlib-dll: $(VC)
|
||||||
cd lib
|
cd lib
|
||||||
nmake /f Makefile.$(VC) cfg=release-zlib-dll
|
nmake /f Makefile.$(VC) cfg=release-zlib-dll
|
||||||
cd ..\src
|
cd ..\src
|
||||||
nmake /f Makefile.$(VC) cfg=release-zlib-dll
|
nmake /f Makefile.$(VC) cfg=release-zlib-dll
|
||||||
|
|
||||||
vc-sspi:
|
vc-sspi: $(VC)
|
||||||
cd lib
|
cd lib
|
||||||
nmake /f Makefile.$(VC) cfg=release WINDOWS_SSPI=1
|
nmake /f Makefile.$(VC) cfg=release WINDOWS_SSPI=1
|
||||||
cd ..\src
|
cd ..\src
|
||||||
@@ -256,17 +265,40 @@ linux: all
|
|||||||
|
|
||||||
linux-ssl: ssl
|
linux-ssl: ssl
|
||||||
|
|
||||||
|
# We don't need to do anything for vc6.
|
||||||
|
vc6:
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
|
# VC10 makefiles are for use with VS2010
|
||||||
|
vc10: lib/Makefile.vc10 src/Makefile.vc10
|
||||||
|
|
||||||
|
lib/Makefile.vc10: lib/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/vc10/g" -e "s/VC6/VC10/g" lib/Makefile.vc6 > lib/Makefile.vc10
|
||||||
|
|
||||||
|
src/Makefile.vc10: 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/vc10/g" -e "s/VC6/VC10/g" src/Makefile.vc6 > src/Makefile.vc10
|
||||||
|
|
||||||
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)
|
||||||
|
|
||||||
|
|||||||
@@ -1,50 +1,51 @@
|
|||||||
Curl and libcurl 7.19.6
|
Curl and libcurl 7.21.3
|
||||||
|
|
||||||
Public curl releases: 112
|
Public curl releases: 119
|
||||||
Command line options: 132
|
Command line options: 143
|
||||||
curl_easy_setopt() options: 163
|
curl_easy_setopt() options: 185
|
||||||
Public functions in libcurl: 58
|
Public functions in libcurl: 58
|
||||||
Known libcurl bindings: 38
|
Known libcurl bindings: 39
|
||||||
Contributors: 715
|
Contributors: 827
|
||||||
|
|
||||||
This release includes the following changes:
|
This release includes the following changes:
|
||||||
|
|
||||||
o CURLOPT_FTPPORT (and curl's -P/--ftpport) support port ranges
|
o Added --noconfigure switch to testcurl.pl
|
||||||
o Added CURLOPT_SSH_KNOWNHOSTS, CURLOPT_SSH_KEYFUNCTION, CURLOPT_SSH_KEYDATA
|
o Added --xattr option
|
||||||
o CURLOPT_QUOTE, CURLOPT_POSTQUOTE and CURLOPT_PREQUOTE can be told to ignore
|
o Added CURLOPT_RESOLVE and --resolve
|
||||||
error responses when used with FTP
|
o Added CURLAUTH_ONLY
|
||||||
|
o Added version-check.pl to the examples dir
|
||||||
|
|
||||||
This release includes the following bugfixes:
|
This release includes the following bugfixes:
|
||||||
|
|
||||||
o crash on bad socket close with FTP
|
o check for libcurl features for some command line options
|
||||||
o leaking cookie memory when duplicate domains or paths were used
|
o Curl_setopt: disallow CURLOPT_USE_SSL without SSL support
|
||||||
o build fix for Symbian
|
o http_chunks: remove debug output
|
||||||
o CURLOPT_USERPWD set to NULL clears auth credentials
|
o URL-parsing: consider ? a divider
|
||||||
o libcurl-NSS build fixes
|
o SSH: avoid using the libssh2_ prefix
|
||||||
o configure script fixed for VMS
|
o SSH: use libssh2_session_handshake() to work on win64
|
||||||
o set Content-Length: with POST and PUT failed with NTLM auth
|
o ftp: prevent server from hanging on closed data connection when stopping
|
||||||
o allow building libcurl for VxWorks
|
a transfer before the end of the full transfer (ranges)
|
||||||
o curl tool exit codes fixed for VMS
|
o LDAP: detect non-binary attributes properly
|
||||||
o --no-buffer treated correctly
|
o ftp: treat server's response 421 as CURLE_OPERATION_TIMEDOUT
|
||||||
o djgpp build fix
|
o gnutls->handshake: improved timeout handling
|
||||||
o configure detection of GnuTLS now based on pkg-config as well
|
o security: Pass the right parameter to init
|
||||||
o libcurl-NSS client cert handling segfaults
|
o krb5: Use GSS_ERROR to check for error
|
||||||
o curl uploading from stdin/pipes now works in non-blocking way so that it
|
o TFTP: resend the correct data
|
||||||
continues the downloading even when the read stalls
|
o configure: fix autoconf 2.68 warning: no AC_LANG_SOURCE call detected
|
||||||
o ftp credentials are added to the url if needed for http proxies
|
o GnuTLS: now detects socket errors on Windows
|
||||||
o curl -o - sends data to stdout using binary mode on windows
|
o symbols-in-versions: updated en masse
|
||||||
o fixed the separators for "array" style string that CURLINFO_CERTINFO returns
|
o added a couple examples that were missing from the tar ball
|
||||||
o auth problem over several hosts with re-used connection
|
o Curl_send/recv_plain: return errno on failure
|
||||||
o improved the support for client certificates in libcurl+NSS
|
o Curl_wait_for_resolv (for c-ares): correct timeout
|
||||||
o fix leak in gtls code
|
o ossl_connect_common: detect connection re-use
|
||||||
o missing algorithms in libcurl+OpenSSL
|
o configure: Prevent link errors with --librtmp
|
||||||
o with noproxy set you could still get a proxy if a proxy env was set
|
o openldap: use remote port in URL passed to ldap_init_fd()
|
||||||
o rand seeding on libcurl on windows built with OpenSSL was not thread-safe
|
o url: provide dead_connection flag in Curl_handler::disconnect
|
||||||
o fixed the zero byte inserted in cert name flaw in libcurl+OpenSSL
|
o lots of compiler warning fixes
|
||||||
o don't try SNI with SSLv2 or SSLv3 (OpenSSL and GnuTLS builds)
|
o ssh: fix a download resume point calculation
|
||||||
o libcurl+OpenSSL would wrongly acknowledge a cert if CN matched but
|
o fix getinfo CURLINFO_LOCAL* for reused connections
|
||||||
subjectAltName didn't
|
o multi: the returned running handles conuter could turn negative
|
||||||
o TFTP upload sent illegal TSIZE packets
|
o multi: only ever consider pipelining for connections doing HTTP(S)
|
||||||
|
|
||||||
This release includes the following known bugs:
|
This release includes the following known bugs:
|
||||||
|
|
||||||
@@ -53,12 +54,8 @@ 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:
|
||||||
|
|
||||||
Yang Tse, Daniel Fandrich, Kamil Dudka, Caolan McNamara, Frank McGeough,
|
Dan Fandrich, Guenter Knauf, Pat Ray, Hongli Lai, Kamil Dudka,
|
||||||
Andre Guibert de Bruet, Mike Crowe, Claes Jakobsson, John E. Malmberg,
|
Stefan Tomanek, Alfred Gebert, Yang Tse, Julien Chaffraix, Adam Light,
|
||||||
Aaron Oneal, Igor Novoseltsev, Eric Wong, Bill Hoffman, Daniel Steinberg,
|
Rutger Hofman, Matthias Bolte, Heinrich Ko, Dmitri Shubin
|
||||||
Fabian Keil, Michal Marek, Reuven Wachtfogel, Markus Koetter,
|
|
||||||
Constantine Sapuntzakis, David Binderman, Johan van Selst, Alexander Beedie,
|
|
||||||
Tanguy Fautre, Scott Cantor, Curt Bogmine, Peter Sylvester, Benbuck Nason,
|
|
||||||
Carsten Lange
|
|
||||||
|
|
||||||
Thanks! (and sorry if I forgot to mention someone)
|
Thanks! (and sorry if I forgot to mention someone)
|
||||||
|
|||||||
31
TODO-RELEASE
31
TODO-RELEASE
@@ -1,31 +1,10 @@
|
|||||||
To be addressed in 7.19.7 (planned release: October 2009)
|
To be addressed in 7.21.3
|
||||||
=========================
|
=========================
|
||||||
|
|
||||||
248 - "Pausing pipeline problems."
|
263 - Support binding DNS to local interface/IP
|
||||||
http://curl.haxx.se/mail/lib-2009-07/0214.html
|
|
||||||
|
|
||||||
251 - TFTP block size / better integration in transfer
|
265 - 1. FTP cmd channel and data channel validation
|
||||||
http://curl.haxx.se/mail/lib-2009-08/0028.html
|
|
||||||
|
|
||||||
254 - Problem re-using easy handle after call to curl_multi_remove_handle
|
267 - 2. Cert chain for data channel
|
||||||
http://curl.haxx.se/mail/lib-2009-07/0249.html
|
|
||||||
|
|
||||||
255 - debugging a crash in Curl_pgrsTime/checkPendPipeline?
|
|
||||||
http://curl.haxx.se/mail/lib-2009-08/0066.html
|
|
||||||
|
|
||||||
256 - "More questions about ares behavior"
|
|
||||||
http://curl.haxx.se/mail/lib-2009-08/0012.html
|
|
||||||
|
|
||||||
244 - patch for [out] parameters
|
|
||||||
http://curl.haxx.se/mail/lib-2009-06/0342.html
|
|
||||||
|
|
||||||
245 - HTTP version getinfo
|
|
||||||
http://curl.haxx.se/mail/lib-2009-06/0312.html
|
|
||||||
|
|
||||||
247 - Using CURLINFO_ERROR in Curl_failf
|
|
||||||
http://curl.haxx.se/mail/lib-2009-06/0065.html
|
|
||||||
|
|
||||||
253 - add option to disable SNI for TLS handshakes
|
|
||||||
|
|
||||||
257 -
|
|
||||||
|
|
||||||
|
271 -
|
||||||
|
|||||||
91
acinclude.m4
91
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$
|
|
||||||
#***************************************************************************
|
#***************************************************************************
|
||||||
|
|
||||||
|
|
||||||
@@ -2146,6 +2145,7 @@ AC_DEFUN([CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC], [
|
|||||||
else
|
else
|
||||||
LIBS="$curl_cv_gclk_LIBS $curl_cv_save_LIBS"
|
LIBS="$curl_cv_gclk_LIBS $curl_cv_save_LIBS"
|
||||||
fi
|
fi
|
||||||
|
CURL_LIBS="$CURL_LIBS $curl_cv_gclk_LIBS"
|
||||||
AC_MSG_RESULT([$curl_cv_gclk_LIBS])
|
AC_MSG_RESULT([$curl_cv_gclk_LIBS])
|
||||||
ac_cv_func_clock_gettime="yes"
|
ac_cv_func_clock_gettime="yes"
|
||||||
;;
|
;;
|
||||||
@@ -3190,25 +3190,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"
|
||||||
@@ -3217,8 +3245,45 @@ AC_DEFUN([CURL_CHECK_PKGCONFIG], [
|
|||||||
AC_MSG_RESULT([found])
|
AC_MSG_RESULT([found])
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
])
|
||||||
else
|
|
||||||
PKGCONFIG="no"
|
|
||||||
fi
|
dnl CURL_GENERATE_CONFIGUREHELP_PM
|
||||||
|
dnl -------------------------------------------------
|
||||||
|
dnl Generate test harness configurehelp.pm module, defining and
|
||||||
|
dnl initializing some perl variables with values which are known
|
||||||
|
dnl when the configure script runs. For portability reasons, test
|
||||||
|
dnl harness needs information on how to run the C preprocessor.
|
||||||
|
|
||||||
|
AC_DEFUN([CURL_GENERATE_CONFIGUREHELP_PM], [
|
||||||
|
AC_REQUIRE([AC_PROG_CPP])dnl
|
||||||
|
tmp_cpp=`eval echo "$ac_cpp" 2>/dev/null`
|
||||||
|
if test -z "$tmp_cpp"; then
|
||||||
|
tmp_cpp='cpp'
|
||||||
|
fi
|
||||||
|
cat >./tests/configurehelp.pm <<_EOF
|
||||||
|
[@%:@] This is a generated file. Do not edit.
|
||||||
|
|
||||||
|
package configurehelp;
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Exporter;
|
||||||
|
|
||||||
|
use vars qw(
|
||||||
|
@ISA
|
||||||
|
@EXPORT_OK
|
||||||
|
\$Cpreprocessor
|
||||||
|
);
|
||||||
|
|
||||||
|
@ISA = qw(Exporter);
|
||||||
|
|
||||||
|
@EXPORT_OK = qw(
|
||||||
|
\$Cpreprocessor
|
||||||
|
);
|
||||||
|
|
||||||
|
\$Cpreprocessor = '$tmp_cpp';
|
||||||
|
|
||||||
|
1;
|
||||||
|
_EOF
|
||||||
])
|
])
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
*.html
|
|
||||||
*.lo
|
|
||||||
*.pdf
|
|
||||||
.deps
|
|
||||||
.libs
|
|
||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
aclocal.m4
|
|
||||||
adig
|
|
||||||
ahost
|
|
||||||
ares_build.h
|
|
||||||
ares_version.h.dist
|
|
||||||
autom4te.cache
|
|
||||||
config.guess
|
|
||||||
ares_config.h
|
|
||||||
ares_config.h.in
|
|
||||||
config.log
|
|
||||||
config.lt
|
|
||||||
config.status
|
|
||||||
config.sub
|
|
||||||
configure
|
|
||||||
depcomp
|
|
||||||
libcares.la
|
|
||||||
libcares.pc
|
|
||||||
libtool
|
|
||||||
ltmain.sh
|
|
||||||
man3
|
|
||||||
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
|
|
||||||
984
ares/CHANGES
984
ares/CHANGES
@@ -1,984 +0,0 @@
|
|||||||
Changelog for the c-ares project
|
|
||||||
|
|
||||||
* 3 Aug 2009 (Daniel Stenberg)
|
|
||||||
- Joshua Kwan fixed the init routine to fill in the defaults for stuff that
|
|
||||||
fails to get inited by other means. This fixes a case of when the c-ares
|
|
||||||
init fails when internet access is fone.
|
|
||||||
|
|
||||||
- Timo Teras changed the reason code used in the resolve callback done when
|
|
||||||
ares_cancel() is used, to be ARES_ECANCELLED instead of ARES_ETIMEOUT to
|
|
||||||
better allow the callback to know what's happening.
|
|
||||||
|
|
||||||
* 14 Jul 2009 (Guenter Knauf)
|
|
||||||
- renamed generated config.h to ares_config.h to avoid any future clashes
|
|
||||||
with config.h from other projects.
|
|
||||||
|
|
||||||
* June 8 2009 (Yang Tse)
|
|
||||||
- Removed buildconf.bat from release and daily snapshot archives. This
|
|
||||||
file is only for CVS tree checkout builds.
|
|
||||||
|
|
||||||
* May 26 2009 (Yang Tse)
|
|
||||||
- Added --enable-curldebug configure option to enable and disable building
|
|
||||||
with the low-level curl debug memory tracking 'feature' to allow decoupled
|
|
||||||
setting from --enable-debug, allowing again to build c-ares independently
|
|
||||||
out of the CVS tree.
|
|
||||||
|
|
||||||
For the c-ares library option --enable-debug enables debug build features
|
|
||||||
which are _not_ related with memory tracking. For the c-ares library when
|
|
||||||
--enable-debug is given it does not enable the memory tracking feature. If
|
|
||||||
you wish to enable the curl debug memory tracking you must use configure
|
|
||||||
option --enable-curldebug explicitily to do so.
|
|
||||||
|
|
||||||
Internally, definition of preprocessor symbol DEBUGBUILD restricts code
|
|
||||||
which is only compiled for debug enabled builds. And symbol CURLDEBUG is
|
|
||||||
used to differentiate code which is _only_ used for memory tracking.
|
|
||||||
|
|
||||||
* May 19 2009 (Yang Tse)
|
|
||||||
- Introduced ares_library_init() and ares_library_cleanup() functions.
|
|
||||||
|
|
||||||
This is an API and ABI break for Win32/64 systems. Non-Win32/64 build targets
|
|
||||||
using c-ares 1.6.1 can still survive without calling these functions. Read all
|
|
||||||
the details on ares_library_init(3) and ares_library_cleanup(3) man pages that
|
|
||||||
are included.
|
|
||||||
|
|
||||||
curl/libcurl 7.19.5 is fully compatible with c-ares 1.6.1 on all systems.
|
|
||||||
|
|
||||||
In order to use c-ares 1.6.1 with curl/libcurl on Win32/64 systems it is
|
|
||||||
required that curl/libcurl is 7.19.5 or newer. In other words, it is not
|
|
||||||
possible on Win32/64 to use c-ares 1.6.1 with a curl/libcurl version less
|
|
||||||
than 7.19.5
|
|
||||||
|
|
||||||
* May 11 2009 (Daniel Stenberg)
|
|
||||||
- Gregor Jasny made c-ares link with libtool 's -export-symbols-regex option to
|
|
||||||
only expose functions starting with ares_.
|
|
||||||
|
|
||||||
* May 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
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
|
|
||||||
CVS-INFO
|
|
||||||
|
|
||||||
This file is only present in the CVS - never in release archives. It is used
|
|
||||||
as a sentinel file in buildconf.bat in order to differentiate a CVS checkout
|
|
||||||
from release and daily snapshot archives.
|
|
||||||
|
|
||||||
164
ares/Makefile.am
164
ares/Makefile.am
@@ -1,164 +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_srcdir)/../include is for libcurl's external include files
|
|
||||||
# $(top_builddir) is for c-ares's generated ares_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_srcdir)/../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 CURLDEBUG
|
|
||||||
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 $(PDFPAGES)
|
|
||||||
|
|
||||||
CLEANFILES = $(PDFPAGES) $(HTMLPAGES)
|
|
||||||
|
|
||||||
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)/libcares.la
|
|
||||||
|
|
||||||
adig_SOURCES = adig.c ares_getopt.c ares_getopt.h
|
|
||||||
adig_LDADD = $(top_builddir)/libcares.la
|
|
||||||
|
|
||||||
acountry_SOURCES = acountry.c ares_getopt.c ares_getopt.h
|
|
||||||
acountry_LDADD = $(top_builddir)/libcares.la
|
|
||||||
|
|
||||||
SOURCEDMANDIR = man3
|
|
||||||
SOURCEDMANPAGES = ares_init.3
|
|
||||||
|
|
||||||
clean-local: clean-sourced-manpages
|
|
||||||
|
|
||||||
clean-sourced-manpages:
|
|
||||||
@srcdmandir='$(SOURCEDMANDIR)'; \
|
|
||||||
echo "rm -rf $(top_builddir)/$$srcdmandir"; \
|
|
||||||
rm -rf $(top_builddir)/$$srcdmandir
|
|
||||||
|
|
||||||
sourced-manpages: clean-sourced-manpages
|
|
||||||
@srcdmandir='$(SOURCEDMANDIR)'; \
|
|
||||||
srcdmanfiles='$(SOURCEDMANPAGES)'; \
|
|
||||||
mkdir $(top_builddir)/$$srcdmandir; \
|
|
||||||
for file in $$srcdmanfiles; do \
|
|
||||||
if test -f $(top_srcdir)/$$file; then \
|
|
||||||
echo "cp $(top_srcdir)/$$file $(top_builddir)/$$srcdmandir/$$file"; \
|
|
||||||
cp $(top_srcdir)/$$file $(top_builddir)/$$srcdmandir/$$file; \
|
|
||||||
fi; \
|
|
||||||
done
|
|
||||||
|
|
||||||
MAN2HTML = roffit --mandir=. < $< >$@
|
|
||||||
|
|
||||||
SUFFIXES = .3 .html
|
|
||||||
|
|
||||||
html: sourced-manpages $(HTMLPAGES)
|
|
||||||
|
|
||||||
.3.html:
|
|
||||||
$(MAN2HTML)
|
|
||||||
|
|
||||||
pdf: sourced-manpages $(PDFPAGES)
|
|
||||||
|
|
||||||
.3.pdf:
|
|
||||||
@(foo=`echo $@ | sed -e 's/\.[0-9]$$//g'`; \
|
|
||||||
groff -Tps -man $< >$$foo.ps; \
|
|
||||||
ps2pdf $$foo.ps $@; \
|
|
||||||
rm $$foo.ps; \
|
|
||||||
echo "converted $< to $@")
|
|
||||||
|
|
||||||
# Make files named *.dist replace the file without .dist extension
|
|
||||||
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,84 +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 -Dselect=select_s
|
|
||||||
|
|
||||||
LDFLAGS = -s
|
|
||||||
|
|
||||||
ifeq ($(USE_CURLDEBUG),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) ares_config.h libcares.a ahost.exe adig.exe acountry.exe
|
|
||||||
@echo Welcome to c-ares.
|
|
||||||
|
|
||||||
libcares.a: $(OBJECTS)
|
|
||||||
ar rs $@ $?
|
|
||||||
|
|
||||||
ares_config.h: config.dos
|
|
||||||
$(COPY) $^ $@
|
|
||||||
|
|
||||||
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 generated files
|
|
||||||
#
|
|
||||||
genclean:
|
|
||||||
- $(DELETE) ares_config.h
|
|
||||||
|
|
||||||
# clean object files and subdir
|
|
||||||
#
|
|
||||||
objclean: genclean
|
|
||||||
- $(DELETE) $(OBJ_DIR)$(DS)*.o
|
|
||||||
- $(RMDIR) $(OBJ_DIR)
|
|
||||||
|
|
||||||
# clean without removing built library and programs
|
|
||||||
#
|
|
||||||
clean: objclean
|
|
||||||
- $(DELETE) depend.dj
|
|
||||||
|
|
||||||
# clean everything
|
|
||||||
#
|
|
||||||
realclean vclean: clean
|
|
||||||
- $(DELETE) libcares.a
|
|
||||||
- $(DELETE) acountry.exe
|
|
||||||
- $(DELETE) adig.exe
|
|
||||||
- $(DELETE) ahost.exe
|
|
||||||
- $(DELETE) libcares.a
|
|
||||||
|
|
||||||
-include depend.dj
|
|
||||||
|
|
||||||
@@ -1,157 +0,0 @@
|
|||||||
|
|
||||||
CSOURCES = ares__close_sockets.c \
|
|
||||||
ares__get_hostent.c \
|
|
||||||
ares__read_line.c \
|
|
||||||
ares__timeval.c \
|
|
||||||
ares_cancel.c \
|
|
||||||
ares_destroy.c \
|
|
||||||
ares_expand_name.c \
|
|
||||||
ares_expand_string.c \
|
|
||||||
ares_fds.c \
|
|
||||||
ares_free_hostent.c \
|
|
||||||
ares_free_string.c \
|
|
||||||
ares_gethostbyaddr.c \
|
|
||||||
ares_gethostbyname.c \
|
|
||||||
ares_getnameinfo.c \
|
|
||||||
ares_getsock.c \
|
|
||||||
ares_init.c \
|
|
||||||
ares_library_init.c \
|
|
||||||
ares_llist.c \
|
|
||||||
ares_mkquery.c \
|
|
||||||
ares_parse_a_reply.c \
|
|
||||||
ares_parse_aaaa_reply.c \
|
|
||||||
ares_parse_ns_reply.c \
|
|
||||||
ares_parse_ptr_reply.c \
|
|
||||||
ares_process.c \
|
|
||||||
ares_query.c \
|
|
||||||
ares_search.c \
|
|
||||||
ares_send.c \
|
|
||||||
ares_strcasecmp.c \
|
|
||||||
ares_strdup.c \
|
|
||||||
ares_strerror.c \
|
|
||||||
ares_timeout.c \
|
|
||||||
ares_version.c \
|
|
||||||
ares_writev.c \
|
|
||||||
bitncmp.c \
|
|
||||||
inet_net_pton.c \
|
|
||||||
inet_ntop.c \
|
|
||||||
windows_port.c
|
|
||||||
|
|
||||||
HHEADERS = ares.h \
|
|
||||||
ares_build.h \
|
|
||||||
ares_dns.h \
|
|
||||||
ares_ipv6.h \
|
|
||||||
ares_library_init.h \
|
|
||||||
ares_llist.h \
|
|
||||||
ares_private.h \
|
|
||||||
ares_rules.h \
|
|
||||||
ares_strcasecmp.h \
|
|
||||||
ares_strdup.h \
|
|
||||||
ares_version.h \
|
|
||||||
ares_writev.h \
|
|
||||||
bitncmp.h \
|
|
||||||
inet_net_pton.h \
|
|
||||||
inet_ntop.h \
|
|
||||||
nameser.h \
|
|
||||||
setup.h \
|
|
||||||
setup_once.h
|
|
||||||
|
|
||||||
MANPAGES = ares_cancel.3 \
|
|
||||||
ares_destroy.3 \
|
|
||||||
ares_destroy_options.3 \
|
|
||||||
ares_dup.3 \
|
|
||||||
ares_expand_name.3 \
|
|
||||||
ares_expand_string.3 \
|
|
||||||
ares_fds.3 \
|
|
||||||
ares_free_hostent.3 \
|
|
||||||
ares_free_string.3 \
|
|
||||||
ares_gethostbyaddr.3 \
|
|
||||||
ares_gethostbyname.3 \
|
|
||||||
ares_gethostbyname_file.3 \
|
|
||||||
ares_getnameinfo.3 \
|
|
||||||
ares_getsock.3 \
|
|
||||||
ares_init.3 \
|
|
||||||
ares_init_options.3 \
|
|
||||||
ares_library_cleanup.3 \
|
|
||||||
ares_library_init.3 \
|
|
||||||
ares_mkquery.3 \
|
|
||||||
ares_parse_a_reply.3 \
|
|
||||||
ares_parse_aaaa_reply.3 \
|
|
||||||
ares_parse_ns_reply.3 \
|
|
||||||
ares_parse_ptr_reply.3 \
|
|
||||||
ares_process.3 \
|
|
||||||
ares_query.3 \
|
|
||||||
ares_save_options.3 \
|
|
||||||
ares_search.3 \
|
|
||||||
ares_send.3 \
|
|
||||||
ares_set_socket_callback.3 \
|
|
||||||
ares_strerror.3 \
|
|
||||||
ares_timeout.3 \
|
|
||||||
ares_version.3
|
|
||||||
|
|
||||||
HTMLPAGES = ares_cancel.html \
|
|
||||||
ares_destroy.html \
|
|
||||||
ares_destroy_options.html \
|
|
||||||
ares_dup.html \
|
|
||||||
ares_expand_name.html \
|
|
||||||
ares_expand_string.html \
|
|
||||||
ares_fds.html \
|
|
||||||
ares_free_hostent.html \
|
|
||||||
ares_free_string.html \
|
|
||||||
ares_gethostbyaddr.html \
|
|
||||||
ares_gethostbyname.html \
|
|
||||||
ares_gethostbyname_file.html \
|
|
||||||
ares_getnameinfo.html \
|
|
||||||
ares_getsock.html \
|
|
||||||
ares_init.html \
|
|
||||||
ares_init_options.html \
|
|
||||||
ares_library_cleanup.html \
|
|
||||||
ares_library_init.html \
|
|
||||||
ares_mkquery.html \
|
|
||||||
ares_parse_a_reply.html \
|
|
||||||
ares_parse_aaaa_reply.html \
|
|
||||||
ares_parse_ns_reply.html \
|
|
||||||
ares_parse_ptr_reply.html \
|
|
||||||
ares_process.html \
|
|
||||||
ares_query.html \
|
|
||||||
ares_save_options.html \
|
|
||||||
ares_search.html \
|
|
||||||
ares_send.html \
|
|
||||||
ares_set_socket_callback.html \
|
|
||||||
ares_strerror.html \
|
|
||||||
ares_timeout.html \
|
|
||||||
ares_version.html
|
|
||||||
|
|
||||||
PDFPAGES = ares_cancel.pdf \
|
|
||||||
ares_destroy.pdf \
|
|
||||||
ares_destroy_options.pdf \
|
|
||||||
ares_dup.pdf \
|
|
||||||
ares_expand_name.pdf \
|
|
||||||
ares_expand_string.pdf \
|
|
||||||
ares_fds.pdf \
|
|
||||||
ares_free_hostent.pdf \
|
|
||||||
ares_free_string.pdf \
|
|
||||||
ares_gethostbyaddr.pdf \
|
|
||||||
ares_gethostbyname.pdf \
|
|
||||||
ares_gethostbyname_file.pdf \
|
|
||||||
ares_getnameinfo.pdf \
|
|
||||||
ares_getsock.pdf \
|
|
||||||
ares_init.pdf \
|
|
||||||
ares_init_options.pdf \
|
|
||||||
ares_library_cleanup.pdf \
|
|
||||||
ares_library_init.pdf \
|
|
||||||
ares_mkquery.pdf \
|
|
||||||
ares_parse_a_reply.pdf \
|
|
||||||
ares_parse_aaaa_reply.pdf \
|
|
||||||
ares_parse_ns_reply.pdf \
|
|
||||||
ares_parse_ptr_reply.pdf \
|
|
||||||
ares_process.pdf \
|
|
||||||
ares_query.pdf \
|
|
||||||
ares_save_options.pdf \
|
|
||||||
ares_search.pdf \
|
|
||||||
ares_send.pdf \
|
|
||||||
ares_set_socket_callback.pdf \
|
|
||||||
ares_strerror.pdf \
|
|
||||||
ares_timeout.pdf \
|
|
||||||
ares_version.pdf
|
|
||||||
|
|
||||||
@@ -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 ares_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) ares_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
|
|
||||||
|
|
||||||
ares_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 (not available on VC-2008+)
|
|
||||||
# -MLd - libc, no threads, debug (not available on VC-2008+)
|
|
||||||
# -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 -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) -DDEBUGBUILD -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,27 +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
|
|
||||||
o new ares_library_init() and ares_library_cleanup() functions
|
|
||||||
o new --enable-curldebug configure option
|
|
||||||
o ARES_ECANCELLED is now sent as reason for ares_cancel()
|
|
||||||
|
|
||||||
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_'
|
|
||||||
o fix \Device\TCP handle leaks triggered by buggy iphlpapi.dll
|
|
||||||
o init without internet gone no longer fails
|
|
||||||
|
|
||||||
Thanks go to these friendly people for their efforts and contributions:
|
|
||||||
|
|
||||||
Phil Blundell, Japheth Cleaver, Yang Tse, Gregor Jasny, Joshua Kwan,
|
|
||||||
Timo Teras
|
|
||||||
|
|
||||||
Have fun!
|
|
||||||
18
ares/TODO
18
ares/TODO
@@ -1,18 +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.
|
|
||||||
|
|
||||||
ares_process
|
|
||||||
|
|
||||||
- Upon next ABI breakage ares_process() should be changed to return 'int'
|
|
||||||
and return ARES_ENOTINITIALIZED if ares_library_init() has not been called.
|
|
||||||
|
|
||||||
ares_process_fd
|
|
||||||
|
|
||||||
- Upon next ABI breakage ares_process_fd() should be changed to return
|
|
||||||
'int' and return ARES_ENOTINITIALIZED if library has not been initialized.
|
|
||||||
1925
ares/acinclude.m4
1925
ares/acinclude.m4
File diff suppressed because it is too large
Load Diff
628
ares/acountry.c
628
ares/acountry.c
@@ -1,628 +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 is in <CC> and the ISO-3166 country
|
|
||||||
* number is 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)
|
|
||||||
{
|
|
||||||
if ((country->short_name[0] != ccode_A2[0]) ||
|
|
||||||
(country->short_name[1] != ccode_A2[1]) ||
|
|
||||||
(country->short_name[2] != ccode_A2[2]))
|
|
||||||
printf("short-name mismatch; %s vs %s\n",
|
|
||||||
country->short_name, ccode_A2);
|
|
||||||
}
|
|
||||||
printf("%s (%s), number %d.\n",
|
|
||||||
country->long_name, country->short_name, cnumber);
|
|
||||||
}
|
|
||||||
free(ccopy);
|
|
||||||
}
|
|
||||||
|
|
||||||
738
ares/adig.c
738
ares/adig.c
@@ -1,738 +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
|
|
||||||
|
|
||||||
/* AIX portability check */
|
|
||||||
#ifndef T_NAPTR
|
|
||||||
#define T_NAPTR 35 /* naming authority pointer */
|
|
||||||
#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)
|
|
||||||
options.flags |= flags[i].value;
|
|
||||||
else
|
|
||||||
usage();
|
|
||||||
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)
|
|
||||||
dnsclass = classes[i].value;
|
|
||||||
else
|
|
||||||
usage();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 't':
|
|
||||||
/* Set the query type. */
|
|
||||||
for (i = 0; i < ntypes; i++)
|
|
||||||
{
|
|
||||||
if (strcasecmp(types[i].name, optarg) == 0)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (i < ntypes)
|
|
||||||
type = types[i].value;
|
|
||||||
else
|
|
||||||
usage();
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
350
ares/ares.h
350
ares/ares.h
@@ -1,350 +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
|
|
||||||
#define ARES_ECANCELLED 21
|
|
||||||
|
|
||||||
/* ares_getnameinfo error codes */
|
|
||||||
#define ARES_EBADFLAGS 18
|
|
||||||
|
|
||||||
/* ares_getaddrinfo error codes */
|
|
||||||
#define ARES_ENONAME 19
|
|
||||||
#define ARES_EBADHINTS 20
|
|
||||||
|
|
||||||
/* Uninitialized library error code */
|
|
||||||
#define ARES_ENOTINITIALIZED 21
|
|
||||||
|
|
||||||
/* ares_library_init error codes */
|
|
||||||
#define ARES_ELOADIPHLPAPI 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);
|
|
||||||
sclose(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);
|
|
||||||
sclose(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,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_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_ECANCELLED .
|
|
||||||
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
|
|
||||||
|
|
||||||
c-ares 1.6.0 and earlier pass a status of
|
|
||||||
.BR ARES_ETIMEOUT
|
|
||||||
instead of
|
|
||||||
.BR ARES_ECANCELLED .
|
|
||||||
.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_ECANCELLED, 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,44 +0,0 @@
|
|||||||
.\" $Id$
|
|
||||||
.\"
|
|
||||||
.\" Copyright (C) 2004-2009 by Daniel Stenberg
|
|
||||||
.\"
|
|
||||||
.\" Permission to use, copy, modify, and distribute this
|
|
||||||
.\" software and its documentation for any purpose and without
|
|
||||||
.\" fee is hereby granted, provided that the above copyright
|
|
||||||
.\" notice appear in all copies and that both that copyright
|
|
||||||
.\" notice and this permission notice appear in supporting
|
|
||||||
.\" documentation, and that the name of M.I.T. not be used in
|
|
||||||
.\" advertising or publicity pertaining to distribution of the
|
|
||||||
.\" software without specific, written prior permission.
|
|
||||||
.\" M.I.T. makes no representations about the suitability of
|
|
||||||
.\" this software for any purpose. It is provided "as is"
|
|
||||||
.\" without express or implied warranty.
|
|
||||||
.\"
|
|
||||||
.TH ARES_DUP 3 "26 May 2009"
|
|
||||||
.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),
|
|
||||||
.BR ares_library_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;
|
|
||||||
}
|
|
||||||
199
ares/ares_init.3
199
ares/ares_init.3
@@ -1,199 +0,0 @@
|
|||||||
.\" $Id$
|
|
||||||
.\"
|
|
||||||
.\" Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||||
.\" Copyright (C) 2004-2009 by Daniel Stenberg
|
|
||||||
.\"
|
|
||||||
.\" Permission to use, copy, modify, and distribute this
|
|
||||||
.\" software and its documentation for any purpose and without
|
|
||||||
.\" fee is hereby granted, provided that the above copyright
|
|
||||||
.\" notice appear in all copies and that both that copyright
|
|
||||||
.\" notice and this permission notice appear in supporting
|
|
||||||
.\" documentation, and that the name of M.I.T. not be used in
|
|
||||||
.\" advertising or publicity pertaining to distribution of the
|
|
||||||
.\" software without specific, written prior permission.
|
|
||||||
.\" M.I.T. makes no representations about the suitability of
|
|
||||||
.\" this software for any purpose. It is provided "as is"
|
|
||||||
.\" without express or implied warranty.
|
|
||||||
.\"
|
|
||||||
.TH ARES_INIT 3 "26 May 2009"
|
|
||||||
.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.
|
|
||||||
.TP 14
|
|
||||||
.B ARES_ENOTINITIALIZED
|
|
||||||
c-ares library initialization not yet performed.
|
|
||||||
.SH SEE ALSO
|
|
||||||
.BR ares_destroy(3),
|
|
||||||
.BR ares_dup(3),
|
|
||||||
.BR ares_library_init(3)
|
|
||||||
.SH AUTHOR
|
|
||||||
Greg Hudson, MIT Information Systems
|
|
||||||
.br
|
|
||||||
Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||||
.br
|
|
||||||
Copyright (C) 2004-2009 by Daniel Stenberg.
|
|
||||||
1563
ares/ares_init.c
1563
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,74 +0,0 @@
|
|||||||
.\" $Id$
|
|
||||||
.\"
|
|
||||||
.\" Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||||
.\" Copyright (C) 2004-2009 by Daniel Stenberg
|
|
||||||
.\"
|
|
||||||
.\" Permission to use, copy, modify, and distribute this
|
|
||||||
.\" software and its documentation for any purpose and without
|
|
||||||
.\" fee is hereby granted, provided that the above copyright
|
|
||||||
.\" notice appear in all copies and that both that copyright
|
|
||||||
.\" notice and this permission notice appear in supporting
|
|
||||||
.\" documentation, and that the name of M.I.T. not be used in
|
|
||||||
.\" advertising or publicity pertaining to distribution of the
|
|
||||||
.\" software without specific, written prior permission.
|
|
||||||
.\" M.I.T. makes no representations about the suitability of
|
|
||||||
.\" this software for any purpose. It is provided "as is"
|
|
||||||
.\" without express or implied warranty.
|
|
||||||
.\"
|
|
||||||
.TH ARES_LIBRARY_CLEANUP 3 "19 May 2009"
|
|
||||||
.SH NAME
|
|
||||||
ares_library_cleanup \- c-ares library deinitialization
|
|
||||||
.SH SYNOPSIS
|
|
||||||
.nf
|
|
||||||
.B #include <ares.h>
|
|
||||||
.PP
|
|
||||||
.B void ares_library_cleanup(void)
|
|
||||||
.PP
|
|
||||||
.B cc file.c -lcares
|
|
||||||
.fi
|
|
||||||
.SH DESCRIPTION
|
|
||||||
.PP
|
|
||||||
The
|
|
||||||
.B ares_library_cleanup
|
|
||||||
function uninitializes the c-ares library, freeing all resources
|
|
||||||
previously aquired by \fIares_library_init(3)\fP when the library
|
|
||||||
was initialized.
|
|
||||||
.PP
|
|
||||||
This function must be called when the program using c-ares will
|
|
||||||
no longer need any c-ares function. Once the program has called
|
|
||||||
\fIares_library_cleanup(3)\fP it shall not make any further call to any
|
|
||||||
c-ares function.
|
|
||||||
.PP
|
|
||||||
This function does not cancel any pending c-ares lookups or requests
|
|
||||||
previously done. Program must use \fIares_cancel(3)\fP for this purpose.
|
|
||||||
.PP
|
|
||||||
.B This function is not thread safe.
|
|
||||||
You have to call it once the program is about to terminate, but this call must
|
|
||||||
be done once the program has terminated every single thread that it could have
|
|
||||||
initiated. This is required to avoid potential race conditions in library
|
|
||||||
deinitialization, and also due to the fact that \fIares_library_cleanup(3)\fP
|
|
||||||
might call functions from other libraries that are thread unsafe, and could
|
|
||||||
conflict with any other thread that is already using these other libraries.
|
|
||||||
.PP
|
|
||||||
Win32/64 application DLLs shall not call \fIares_library_cleanup(3)\fP from
|
|
||||||
the DllMain function. Doing so will produce deadlocks and other problems.
|
|
||||||
.SH AVAILABILITY
|
|
||||||
This function was first introduced in c-ares version 1.6.1 along with the
|
|
||||||
definition of preprocessor symbol \fICARES_HAVE_ARES_LIBRARY_CLEANUP\fP as an
|
|
||||||
indication of the availability of this function.
|
|
||||||
.PP
|
|
||||||
Since the introduction of this function, it is absolutely mandatory to call it
|
|
||||||
for any Win32/64 program using c-ares.
|
|
||||||
.PP
|
|
||||||
Non-Win32/64 systems can still use c-ares version 1.6.1 without calling
|
|
||||||
\fIares_library_cleanup(3)\fP due to the fact that it is nearly a do-nothing
|
|
||||||
function on non-Win32/64 platforms.
|
|
||||||
.SH SEE ALSO
|
|
||||||
.BR ares_library_init(3),
|
|
||||||
.BR ares_cancel(3)
|
|
||||||
.SH AUTHOR
|
|
||||||
Yang Tse
|
|
||||||
.PP
|
|
||||||
Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||||
.br
|
|
||||||
Copyright (C) 2004-2009 by Daniel Stenberg.
|
|
||||||
@@ -1,97 +0,0 @@
|
|||||||
.\" $Id$
|
|
||||||
.\"
|
|
||||||
.\" Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||||
.\" Copyright (C) 2004-2009 by Daniel Stenberg
|
|
||||||
.\"
|
|
||||||
.\" Permission to use, copy, modify, and distribute this
|
|
||||||
.\" software and its documentation for any purpose and without
|
|
||||||
.\" fee is hereby granted, provided that the above copyright
|
|
||||||
.\" notice appear in all copies and that both that copyright
|
|
||||||
.\" notice and this permission notice appear in supporting
|
|
||||||
.\" documentation, and that the name of M.I.T. not be used in
|
|
||||||
.\" advertising or publicity pertaining to distribution of the
|
|
||||||
.\" software without specific, written prior permission.
|
|
||||||
.\" M.I.T. makes no representations about the suitability of
|
|
||||||
.\" this software for any purpose. It is provided "as is"
|
|
||||||
.\" without express or implied warranty.
|
|
||||||
.\"
|
|
||||||
.TH ARES_LIBRARY_INIT 3 "19 May 2009"
|
|
||||||
.SH NAME
|
|
||||||
ares_library_init \- c-ares library initialization
|
|
||||||
.SH SYNOPSIS
|
|
||||||
.nf
|
|
||||||
.B #include <ares.h>
|
|
||||||
.PP
|
|
||||||
.B int ares_library_init(int \fIflags\fP)
|
|
||||||
.PP
|
|
||||||
.B cc file.c -lcares
|
|
||||||
.fi
|
|
||||||
.SH DESCRIPTION
|
|
||||||
.PP
|
|
||||||
The
|
|
||||||
.B ares_library_init
|
|
||||||
function performs initializations internally required by the c-ares
|
|
||||||
library that must take place before any other function provided by
|
|
||||||
c-ares can be used in a program.
|
|
||||||
.PP
|
|
||||||
This function must be called one time within the life of a program,
|
|
||||||
before the program actually executes any other c-ares library function.
|
|
||||||
Initializations done by this function remain effective until a
|
|
||||||
call to \fIares_library_cleanup(3)\fP is performed.
|
|
||||||
.PP
|
|
||||||
Successive calls to this function do nothing, only the first call done
|
|
||||||
when c-ares is in an uninitialized state is actually effective.
|
|
||||||
.PP
|
|
||||||
The
|
|
||||||
.I flags
|
|
||||||
parameter is a bit pattern that tells c-ares exactly which features
|
|
||||||
should be initialized, as described below. Set the desired bits by
|
|
||||||
ORing the values together. In normal operation you should specify
|
|
||||||
\fIARES_LIB_INIT_ALL\fP. Don't use any other value unless you are
|
|
||||||
familiar with it and trying to control some internal c-ares feature.
|
|
||||||
.PP
|
|
||||||
.B This function is not thread safe.
|
|
||||||
You have to call it once the program has started, but this call must be done
|
|
||||||
before the program starts any other thread. This is required to avoid
|
|
||||||
potential race conditions in library initialization, and also due to the fact
|
|
||||||
that \fIares_library_init(3)\fP might call functions from other libraries that
|
|
||||||
are thread unsafe, and could conflict with any other thread that is already
|
|
||||||
using these other libraries.
|
|
||||||
.PP
|
|
||||||
Win32/64 application DLLs shall not call \fIares_library_init(3)\fP from the
|
|
||||||
DllMain function. Doing so will produce deadlocks and other problems.
|
|
||||||
.SH FLAGS
|
|
||||||
.TP 5
|
|
||||||
.B ARES_LIB_INIT_ALL
|
|
||||||
Initialize everything possible. This sets all known bits.
|
|
||||||
.TP
|
|
||||||
.B ARES_LIB_INIT_WIN32
|
|
||||||
Initialize Win32/64 specific libraries.
|
|
||||||
.TP
|
|
||||||
.B ARES_LIB_INIT_NONE
|
|
||||||
Initialize nothing extra. This sets no bit.
|
|
||||||
.SH RETURN VALUE
|
|
||||||
Upon successful completion, ares_library_init() will return 0. Otherwise, a
|
|
||||||
non-zero error number will be returned to indicate the error. Except for
|
|
||||||
\fIares_strerror(3)\fP, you shall not call any other c-ares function upon
|
|
||||||
\fIares_library_init(3)\fP failure.
|
|
||||||
.SH AVAILABILITY
|
|
||||||
This function was first introduced in c-ares version 1.6.1 along with the
|
|
||||||
definition of preprocessor symbol \fICARES_HAVE_ARES_LIBRARY_INIT\fP as an
|
|
||||||
indication of the availability of this function.
|
|
||||||
.PP
|
|
||||||
Since the introduction of this function it is absolutely mandatory to
|
|
||||||
call it for any Win32/64 program using c-ares.
|
|
||||||
.PP
|
|
||||||
Non-Win32/64 systems can still use c-ares version 1.6.1 without calling
|
|
||||||
\fIares_library_init(3)\fP due to the fact that it is nearly a do-nothing
|
|
||||||
function on non-Win32/64 platforms at this point.
|
|
||||||
.SH SEE ALSO
|
|
||||||
.BR ares_library_cleanup(3),
|
|
||||||
.BR ares_strerror(3)
|
|
||||||
.SH AUTHOR
|
|
||||||
Yang Tse
|
|
||||||
.PP
|
|
||||||
Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||||
.br
|
|
||||||
Copyright (C) 2004-2009 by Daniel Stenberg.
|
|
||||||
@@ -1,133 +0,0 @@
|
|||||||
/* $Id$ */
|
|
||||||
|
|
||||||
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||||
* Copyright (C) 2004-2009 by Daniel Stenberg
|
|
||||||
*
|
|
||||||
* Permission to use, copy, modify, and distribute this
|
|
||||||
* software and its documentation for any purpose and without
|
|
||||||
* fee is hereby granted, provided that the above copyright
|
|
||||||
* notice appear in all copies and that both that copyright
|
|
||||||
* notice and this permission notice appear in supporting
|
|
||||||
* documentation, and that the name of M.I.T. not be used in
|
|
||||||
* advertising or publicity pertaining to distribution of the
|
|
||||||
* software without specific, written prior permission.
|
|
||||||
* M.I.T. makes no representations about the suitability of
|
|
||||||
* this software for any purpose. It is provided "as is"
|
|
||||||
* without express or implied warranty.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "setup.h"
|
|
||||||
|
|
||||||
#include "ares.h"
|
|
||||||
#include "ares_library_init.h"
|
|
||||||
#include "ares_private.h"
|
|
||||||
|
|
||||||
/* library-private global and unique instance vars */
|
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
fpGetNetworkParams_t fpGetNetworkParams = ZERO_NULL;
|
|
||||||
fpSystemFunction036_t fpSystemFunction036 = ZERO_NULL;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* library-private global vars with source visibility restricted to this file */
|
|
||||||
|
|
||||||
static unsigned int ares_initialized;
|
|
||||||
static int ares_init_flags;
|
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
static HMODULE hnd_iphlpapi;
|
|
||||||
static HMODULE hnd_advapi32;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
static int ares_win32_init(void)
|
|
||||||
{
|
|
||||||
#ifdef WIN32
|
|
||||||
|
|
||||||
hnd_iphlpapi = 0;
|
|
||||||
hnd_iphlpapi = LoadLibrary("iphlpapi.dll");
|
|
||||||
if (!hnd_iphlpapi)
|
|
||||||
return ARES_ELOADIPHLPAPI;
|
|
||||||
|
|
||||||
fpGetNetworkParams = (fpGetNetworkParams_t)
|
|
||||||
GetProcAddress(hnd_iphlpapi, "GetNetworkParams");
|
|
||||||
if (!fpGetNetworkParams)
|
|
||||||
{
|
|
||||||
FreeLibrary(hnd_iphlpapi);
|
|
||||||
return ARES_EADDRGETNETWORKPARAMS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* When advapi32.dll is unavailable or advapi32.dll has no SystemFunction036,
|
|
||||||
* also known as RtlGenRandom, which is the case for Windows versions prior
|
|
||||||
* to WinXP then c-ares uses portable rand() function. Then don't error here.
|
|
||||||
*/
|
|
||||||
|
|
||||||
hnd_advapi32 = 0;
|
|
||||||
hnd_advapi32 = LoadLibrary("advapi32.dll");
|
|
||||||
if (hnd_advapi32)
|
|
||||||
{
|
|
||||||
fpSystemFunction036 = (fpSystemFunction036_t)
|
|
||||||
GetProcAddress(hnd_advapi32, "SystemFunction036");
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
return ARES_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void ares_win32_cleanup(void)
|
|
||||||
{
|
|
||||||
#ifdef WIN32
|
|
||||||
if (hnd_advapi32)
|
|
||||||
FreeLibrary(hnd_advapi32);
|
|
||||||
if (hnd_iphlpapi)
|
|
||||||
FreeLibrary(hnd_iphlpapi);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int ares_library_init(int flags)
|
|
||||||
{
|
|
||||||
int res;
|
|
||||||
|
|
||||||
if (ares_initialized)
|
|
||||||
return ARES_SUCCESS;
|
|
||||||
ares_initialized++;
|
|
||||||
|
|
||||||
if (flags & ARES_LIB_INIT_WIN32)
|
|
||||||
{
|
|
||||||
res = ares_win32_init();
|
|
||||||
if (res != ARES_SUCCESS)
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
ares_init_flags = flags;
|
|
||||||
|
|
||||||
return ARES_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ares_library_cleanup(void)
|
|
||||||
{
|
|
||||||
if (!ares_initialized)
|
|
||||||
return;
|
|
||||||
ares_initialized--;
|
|
||||||
|
|
||||||
if (ares_init_flags & ARES_LIB_INIT_WIN32)
|
|
||||||
ares_win32_cleanup();
|
|
||||||
|
|
||||||
ares_init_flags = ARES_LIB_INIT_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int ares_library_initialized(void)
|
|
||||||
{
|
|
||||||
#ifdef WIN32
|
|
||||||
if (!ares_initialized)
|
|
||||||
return ARES_ENOTINITIALIZED;
|
|
||||||
#endif
|
|
||||||
return ARES_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
#ifndef HEADER_CARES_LIBRARY_INIT_H
|
|
||||||
#define HEADER_CARES_LIBRARY_INIT_H
|
|
||||||
|
|
||||||
/* $Id$ */
|
|
||||||
|
|
||||||
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||||
* Copyright (C) 2004-2009 by Daniel Stenberg
|
|
||||||
*
|
|
||||||
* Permission to use, copy, modify, and distribute this
|
|
||||||
* software and its documentation for any purpose and without
|
|
||||||
* fee is hereby granted, provided that the above copyright
|
|
||||||
* notice appear in all copies and that both that copyright
|
|
||||||
* notice and this permission notice appear in supporting
|
|
||||||
* documentation, and that the name of M.I.T. not be used in
|
|
||||||
* advertising or publicity pertaining to distribution of the
|
|
||||||
* software without specific, written prior permission.
|
|
||||||
* M.I.T. makes no representations about the suitability of
|
|
||||||
* this software for any purpose. It is provided "as is"
|
|
||||||
* without express or implied warranty.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "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,343 +0,0 @@
|
|||||||
#ifndef __ARES_PRIVATE_H
|
|
||||||
#define __ARES_PRIVATE_H
|
|
||||||
|
|
||||||
/* $Id$ */
|
|
||||||
|
|
||||||
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||||
* Copyright (C) 2004-2009 by Daniel Stenberg
|
|
||||||
*
|
|
||||||
* Permission to use, copy, modify, and distribute this
|
|
||||||
* software and its documentation for any purpose and without
|
|
||||||
* fee is hereby granted, provided that the above copyright
|
|
||||||
* notice appear in all copies and that both that copyright
|
|
||||||
* notice and this permission notice appear in supporting
|
|
||||||
* documentation, and that the name of M.I.T. not be used in
|
|
||||||
* advertising or publicity pertaining to distribution of the
|
|
||||||
* software without specific, written prior permission.
|
|
||||||
* M.I.T. makes no representations about the suitability of
|
|
||||||
* this software for any purpose. It is provided "as is"
|
|
||||||
* without express or implied warranty.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 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>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WATT32
|
|
||||||
#include <tcp.h>
|
|
||||||
#include <sys/ioctl.h>
|
|
||||||
#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);
|
|
||||||
/* returns ARES_SUCCESS if library has been initialized */
|
|
||||||
int ares_library_initialized(void);
|
|
||||||
void ares__rc4(rc4_key* key,unsigned char *buffer_ptr, int buffer_len);
|
|
||||||
void ares__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 curldebug-enabled 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
@@ -1,147 +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_QUERY 3 "24 July 1998"
|
|
||||||
.SH NAME
|
|
||||||
ares_query \- Initiate a single-question DNS query
|
|
||||||
.SH SYNOPSIS
|
|
||||||
.nf
|
|
||||||
.B #include <ares.h>
|
|
||||||
.PP
|
|
||||||
.B typedef void (*ares_callback)(void *\fIarg\fP, int \fIstatus\fP,
|
|
||||||
.B int \fItimeouts\fP, unsigned char *\fIabuf\fP, int \fIalen\fP)
|
|
||||||
.PP
|
|
||||||
.B void ares_query(ares_channel \fIchannel\fP, const char *\fIname\fP,
|
|
||||||
.B int \fIdnsclass\fP, int \fItype\fP, ares_callback \fIcallback\fP,
|
|
||||||
.B void *\fIarg\fP)
|
|
||||||
.fi
|
|
||||||
.SH DESCRIPTION
|
|
||||||
The
|
|
||||||
.B ares_query
|
|
||||||
function initiates a single-question DNS query on the name service
|
|
||||||
channel identified by
|
|
||||||
.IR channel .
|
|
||||||
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 backslash. The parameters
|
|
||||||
.I dnsclass
|
|
||||||
and
|
|
||||||
.I type
|
|
||||||
give the class and type of the query using the values defined in
|
|
||||||
.BR <arpa/nameser.h> .
|
|
||||||
When the query is complete or has failed, the ares library will invoke
|
|
||||||
.IR callback .
|
|
||||||
Completion or failure of the query may happen immediately, or may
|
|
||||||
happen during a later call to
|
|
||||||
.BR ares_process (3)
|
|
||||||
or
|
|
||||||
.BR ares_destroy (3).
|
|
||||||
.PP
|
|
||||||
The callback argument
|
|
||||||
.I arg
|
|
||||||
is copied from the
|
|
||||||
.B ares_query
|
|
||||||
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 query completed successfully.
|
|
||||||
.TP 19
|
|
||||||
.B ARES_ENODATA
|
|
||||||
The query completed but contains no answers.
|
|
||||||
.TP 19
|
|
||||||
.B ARES_EFORMERR
|
|
||||||
The query completed but the server claims that the query was
|
|
||||||
malformatted.
|
|
||||||
.TP 19
|
|
||||||
.B ARES_ESERVFAIL
|
|
||||||
The query completed but the server claims to have experienced a
|
|
||||||
failure. (This code can only occur if the
|
|
||||||
.B ARES_FLAG_NOCHECKRESP
|
|
||||||
flag was specified at channel initialization time; otherwise, such
|
|
||||||
responses are ignored at the
|
|
||||||
.BR ares_send (3)
|
|
||||||
level.)
|
|
||||||
.TP 19
|
|
||||||
.B ARES_ENOTFOUND
|
|
||||||
The query completed but the queried-for domain name was not found.
|
|
||||||
.TP 19
|
|
||||||
.B ARES_ENOTIMP
|
|
||||||
The query completed but the server does not implement the operation
|
|
||||||
requested by the query. (This code can only occur if the
|
|
||||||
.B ARES_FLAG_NOCHECKRESP
|
|
||||||
flag was specified at channel initialization time; otherwise, such
|
|
||||||
responses are ignored at the
|
|
||||||
.BR ares_send (3)
|
|
||||||
level.)
|
|
||||||
.TP 19
|
|
||||||
.B ARES_EREFUSED
|
|
||||||
The query completed but the server refused the query. (This code can
|
|
||||||
only occur if the
|
|
||||||
.B ARES_FLAG_NOCHECKRESP
|
|
||||||
flag was specified at channel initialization time; otherwise, such
|
|
||||||
responses are ignored at the
|
|
||||||
.BR ares_send (3)
|
|
||||||
level.)
|
|
||||||
.TP 19
|
|
||||||
.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 19
|
|
||||||
.B ARES_ETIMEOUT
|
|
||||||
No name servers responded within the timeout period.
|
|
||||||
.TP 19
|
|
||||||
.B ARES_ECONNREFUSED
|
|
||||||
No name servers could be contacted.
|
|
||||||
.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
|
|
||||||
If the query completed (even if there was something wrong with it, as
|
|
||||||
indicated by some of the above error codes), the callback argument
|
|
||||||
.I abuf
|
|
||||||
points to a result buffer of length
|
|
||||||
.IR alen .
|
|
||||||
If the query did not complete,
|
|
||||||
.I abuf
|
|
||||||
will be NULL and
|
|
||||||
.I alen
|
|
||||||
will be 0.
|
|
||||||
.SH SEE ALSO
|
|
||||||
.BR ares_process (3)
|
|
||||||
.SH AUTHOR
|
|
||||||
Greg Hudson, MIT Information Systems
|
|
||||||
.br
|
|
||||||
Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||||
@@ -1,184 +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_dns.h"
|
|
||||||
#include "ares_private.h"
|
|
||||||
|
|
||||||
struct qquery {
|
|
||||||
ares_callback callback;
|
|
||||||
void *arg;
|
|
||||||
};
|
|
||||||
|
|
||||||
static void qcallback(void *arg, int status, int timeouts, unsigned char *abuf, int alen);
|
|
||||||
|
|
||||||
void ares__rc4(rc4_key* key, unsigned char *buffer_ptr, int buffer_len)
|
|
||||||
{
|
|
||||||
unsigned char x;
|
|
||||||
unsigned char y;
|
|
||||||
unsigned char* state;
|
|
||||||
unsigned char xorIndex;
|
|
||||||
short counter;
|
|
||||||
|
|
||||||
x = key->x;
|
|
||||||
y = key->y;
|
|
||||||
|
|
||||||
state = &key->state[0];
|
|
||||||
for(counter = 0; counter < buffer_len; counter ++)
|
|
||||||
{
|
|
||||||
x = (unsigned char)((x + 1) % 256);
|
|
||||||
y = (unsigned char)((state[x] + y) % 256);
|
|
||||||
ARES_SWAP_BYTE(&state[x], &state[y]);
|
|
||||||
|
|
||||||
xorIndex = (unsigned char)((state[x] + state[y]) % 256);
|
|
||||||
|
|
||||||
buffer_ptr[counter] = (unsigned char)(buffer_ptr[counter]^state[xorIndex]);
|
|
||||||
}
|
|
||||||
key->x = x;
|
|
||||||
key->y = y;
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct query* find_query_by_id(ares_channel channel, unsigned short id)
|
|
||||||
{
|
|
||||||
unsigned short qid;
|
|
||||||
struct list_node* list_head;
|
|
||||||
struct list_node* list_node;
|
|
||||||
DNS_HEADER_SET_QID(((unsigned char*)&qid), id);
|
|
||||||
|
|
||||||
/* Find the query corresponding to this packet. */
|
|
||||||
list_head = &(channel->queries_by_qid[qid % ARES_QID_TABLE_SIZE]);
|
|
||||||
for (list_node = list_head->next; list_node != list_head;
|
|
||||||
list_node = list_node->next)
|
|
||||||
{
|
|
||||||
struct query *q = list_node->data;
|
|
||||||
if (q->qid == qid)
|
|
||||||
return q;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* a unique query id is generated using an rc4 key. Since the id may already
|
|
||||||
be used by a running query (as infrequent as it may be), a lookup is
|
|
||||||
performed per id generation. In practice this search should happen only
|
|
||||||
once per newly generated id
|
|
||||||
*/
|
|
||||||
static unsigned short generate_unique_id(ares_channel channel)
|
|
||||||
{
|
|
||||||
unsigned short id;
|
|
||||||
|
|
||||||
do {
|
|
||||||
id = ares__generate_new_id(&channel->id_key);
|
|
||||||
} while (find_query_by_id(channel, id));
|
|
||||||
|
|
||||||
return (unsigned short)id;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ares_query(ares_channel channel, const char *name, int dnsclass,
|
|
||||||
int type, ares_callback callback, void *arg)
|
|
||||||
{
|
|
||||||
struct qquery *qquery;
|
|
||||||
unsigned char *qbuf;
|
|
||||||
int qlen, rd, status;
|
|
||||||
|
|
||||||
/* Compose the query. */
|
|
||||||
rd = !(channel->flags & ARES_FLAG_NORECURSE);
|
|
||||||
status = ares_mkquery(name, dnsclass, type, channel->next_id, rd, &qbuf,
|
|
||||||
&qlen);
|
|
||||||
if (status != ARES_SUCCESS)
|
|
||||||
{
|
|
||||||
if (qbuf != NULL) free(qbuf);
|
|
||||||
callback(arg, status, 0, NULL, 0);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
channel->next_id = generate_unique_id(channel);
|
|
||||||
|
|
||||||
/* Allocate and fill in the query structure. */
|
|
||||||
qquery = malloc(sizeof(struct qquery));
|
|
||||||
if (!qquery)
|
|
||||||
{
|
|
||||||
ares_free_string(qbuf);
|
|
||||||
callback(arg, ARES_ENOMEM, 0, NULL, 0);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
qquery->callback = callback;
|
|
||||||
qquery->arg = arg;
|
|
||||||
|
|
||||||
/* Send it off. qcallback will be called when we get an answer. */
|
|
||||||
ares_send(channel, qbuf, qlen, qcallback, qquery);
|
|
||||||
ares_free_string(qbuf);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void qcallback(void *arg, int status, int timeouts, unsigned char *abuf, int alen)
|
|
||||||
{
|
|
||||||
struct qquery *qquery = (struct qquery *) arg;
|
|
||||||
unsigned int ancount;
|
|
||||||
int rcode;
|
|
||||||
|
|
||||||
if (status != ARES_SUCCESS)
|
|
||||||
qquery->callback(qquery->arg, status, timeouts, abuf, alen);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Pull the response code and answer count from the packet. */
|
|
||||||
rcode = DNS_HEADER_RCODE(abuf);
|
|
||||||
ancount = DNS_HEADER_ANCOUNT(abuf);
|
|
||||||
|
|
||||||
/* Convert errors. */
|
|
||||||
switch (rcode)
|
|
||||||
{
|
|
||||||
case NOERROR:
|
|
||||||
status = (ancount > 0) ? ARES_SUCCESS : ARES_ENODATA;
|
|
||||||
break;
|
|
||||||
case FORMERR:
|
|
||||||
status = ARES_EFORMERR;
|
|
||||||
break;
|
|
||||||
case SERVFAIL:
|
|
||||||
status = ARES_ESERVFAIL;
|
|
||||||
break;
|
|
||||||
case NXDOMAIN:
|
|
||||||
status = ARES_ENOTFOUND;
|
|
||||||
break;
|
|
||||||
case NOTIMP:
|
|
||||||
status = ARES_ENOTIMP;
|
|
||||||
break;
|
|
||||||
case REFUSED:
|
|
||||||
status = ARES_EREFUSED;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
qquery->callback(qquery->arg, status, timeouts, abuf, alen);
|
|
||||||
}
|
|
||||||
free(qquery);
|
|
||||||
}
|
|
||||||
@@ -1,145 +0,0 @@
|
|||||||
#ifndef __CARES_RULES_H
|
|
||||||
#define __CARES_RULES_H
|
|
||||||
|
|
||||||
/* $Id$ */
|
|
||||||
|
|
||||||
/* Copyright (C) 2009 by Daniel Stenberg et al
|
|
||||||
*
|
|
||||||
* Permission to use, copy, modify, and distribute this software and its
|
|
||||||
* documentation for any purpose and without fee is hereby granted, provided
|
|
||||||
* that the above copyright notice appear in all copies and that both that
|
|
||||||
* copyright notice and this permission notice appear in supporting
|
|
||||||
* documentation, and that the name of M.I.T. not be used in advertising or
|
|
||||||
* publicity pertaining to distribution of the software without specific,
|
|
||||||
* written prior permission. M.I.T. makes no representations about the
|
|
||||||
* suitability of this software for any purpose. It is provided "as is"
|
|
||||||
* without express or implied warranty.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* ================================================================ */
|
|
||||||
/* COMPILE TIME SANITY CHECKS */
|
|
||||||
/* ================================================================ */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* NOTE 1:
|
|
||||||
* -------
|
|
||||||
*
|
|
||||||
* All checks done in this file are intentionally placed in a public
|
|
||||||
* header file which is pulled by ares.h when an application is
|
|
||||||
* being built using an already built c-ares library. Additionally
|
|
||||||
* this file is also included and used when building the library.
|
|
||||||
*
|
|
||||||
* If compilation fails on this file it is certainly sure that the
|
|
||||||
* problem is elsewhere. It could be a problem in the ares_build.h
|
|
||||||
* header file, or simply that you are using different compilation
|
|
||||||
* settings than those used to build the library.
|
|
||||||
*
|
|
||||||
* Nothing in this file is intended to be modified or adjusted by the
|
|
||||||
* c-ares library user nor by the c-ares library builder.
|
|
||||||
*
|
|
||||||
* Do not deactivate any check, these are done to make sure that the
|
|
||||||
* library is properly built and used.
|
|
||||||
*
|
|
||||||
* You can find further help on the c-ares development mailing list:
|
|
||||||
* http://cool.haxx.se/mailman/listinfo/c-ares/
|
|
||||||
*
|
|
||||||
* NOTE 2
|
|
||||||
* ------
|
|
||||||
*
|
|
||||||
* Some of the following compile time checks are based on the fact
|
|
||||||
* that the dimension of a constant array can not be a negative one.
|
|
||||||
* In this way if the compile time verification fails, the compilation
|
|
||||||
* will fail issuing an error. The error description wording is compiler
|
|
||||||
* dependant but it will be quite similar to one of the following:
|
|
||||||
*
|
|
||||||
* "negative subscript or subscript is too large"
|
|
||||||
* "array must have at least one element"
|
|
||||||
* "-1 is an illegal array size"
|
|
||||||
* "size of array is negative"
|
|
||||||
*
|
|
||||||
* If you are building an application which tries to use an already
|
|
||||||
* built c-ares library and you are getting this kind of errors on
|
|
||||||
* this file, it is a clear indication that there is a mismatch between
|
|
||||||
* how the library was built and how you are trying to use it for your
|
|
||||||
* application. Your already compiled or binary library provider is the
|
|
||||||
* only one who can give you the details you need to properly use it.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Verify that some macros are actually defined.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef CARES_SIZEOF_LONG
|
|
||||||
# error "CARES_SIZEOF_LONG definition is missing!"
|
|
||||||
Error Compilation_aborted_CARES_SIZEOF_LONG_is_missing
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef CARES_TYPEOF_ARES_SOCKLEN_T
|
|
||||||
# error "CARES_TYPEOF_ARES_SOCKLEN_T definition is missing!"
|
|
||||||
Error Compilation_aborted_CARES_TYPEOF_ARES_SOCKLEN_T_is_missing
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef CARES_SIZEOF_ARES_SOCKLEN_T
|
|
||||||
# error "CARES_SIZEOF_ARES_SOCKLEN_T definition is missing!"
|
|
||||||
Error Compilation_aborted_CARES_SIZEOF_ARES_SOCKLEN_T_is_missing
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Macros private to this header file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define CareschkszEQ(t, s) sizeof(t) == s ? 1 : -1
|
|
||||||
|
|
||||||
#define CareschkszGE(t1, t2) sizeof(t1) >= sizeof(t2) ? 1 : -1
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Verify that the size previously defined and expected for long
|
|
||||||
* is the same as the one reported by sizeof() at compile time.
|
|
||||||
*/
|
|
||||||
|
|
||||||
typedef char
|
|
||||||
__cares_rule_01__
|
|
||||||
[CareschkszEQ(long, CARES_SIZEOF_LONG)];
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Verify that the size previously defined and expected for
|
|
||||||
* ares_socklen_t is actually the the same as the one reported
|
|
||||||
* by sizeof() at compile time.
|
|
||||||
*/
|
|
||||||
|
|
||||||
typedef char
|
|
||||||
__cares_rule_02__
|
|
||||||
[CareschkszEQ(ares_socklen_t, CARES_SIZEOF_ARES_SOCKLEN_T)];
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Verify at compile time that the size of ares_socklen_t as reported
|
|
||||||
* by sizeof() is greater or equal than the one reported for int for
|
|
||||||
* the current compilation.
|
|
||||||
*/
|
|
||||||
|
|
||||||
typedef char
|
|
||||||
__cares_rule_03__
|
|
||||||
[CareschkszGE(ares_socklen_t, int)];
|
|
||||||
|
|
||||||
/* ================================================================ */
|
|
||||||
/* EXTERNALLY AND INTERNALLY VISIBLE DEFINITIONS */
|
|
||||||
/* ================================================================ */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get rid of macros private to this header file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#undef CareschkszEQ
|
|
||||||
#undef CareschkszGE
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get rid of macros not intended to exist beyond this point.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#undef CARES_PULL_WS2TCPIP_H
|
|
||||||
#undef CARES_PULL_SYS_TYPES_H
|
|
||||||
#undef CARES_PULL_SYS_SOCKET_H
|
|
||||||
|
|
||||||
#undef CARES_TYPEOF_ARES_SOCKLEN_T
|
|
||||||
|
|
||||||
#endif /* __CARES_RULES_H */
|
|
||||||
@@ -1,54 +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_SAVE_OPTIONS 3 "1 June 2007"
|
|
||||||
.SH NAME
|
|
||||||
ares_save_options \- Save configuration values obtained from initialized ares_channel
|
|
||||||
.SH SYNOPSIS
|
|
||||||
.nf
|
|
||||||
.B #include <ares.h>
|
|
||||||
.PP
|
|
||||||
.B void ares_save_options(ares_channel \fIchannel\fP, struct ares_options *\fIoptions\fP, int *\fIoptmask\fP)
|
|
||||||
.fi
|
|
||||||
.SH DESCRIPTION
|
|
||||||
The \fBares_save_options(3)\fP function saves the channel data identified by
|
|
||||||
.IR channel ,
|
|
||||||
into the options struct identified by
|
|
||||||
.IR options ,
|
|
||||||
and saves the mask of options which are set to the integer
|
|
||||||
pointer (passed by reference) identified by
|
|
||||||
.IR optmask .
|
|
||||||
|
|
||||||
The resultant options and optmask are then able to be
|
|
||||||
passed directly to ares_init_options. When the options
|
|
||||||
are no longer needed, ares_destroy_options should be called
|
|
||||||
to free any associated memory.
|
|
||||||
.SH NOTE
|
|
||||||
Since c-ares 1.6.0 the ares_options struct has been "locked" meaning that it
|
|
||||||
won't be extended to cover new funtions. This function will remain
|
|
||||||
functioning, but it can only return config data that can be represented in
|
|
||||||
this config struct, which may no longer be the complete set of config
|
|
||||||
options. \fBares_dup(3)\fP will not have that restriction.
|
|
||||||
.SH SEE ALSO
|
|
||||||
.BR ares_destroy_options (3),
|
|
||||||
.BR ares_init_options (3),
|
|
||||||
.BR ares_dup (3)
|
|
||||||
.SH AVAILABILITY
|
|
||||||
ares_save_options(3) was added in c-ares 1.4.0
|
|
||||||
.SH AUTHOR
|
|
||||||
Brad House
|
|
||||||
.br
|
|
||||||
Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||||
@@ -1,149 +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_SEARCH 3 "24 July 1998"
|
|
||||||
.SH NAME
|
|
||||||
ares_search \- Initiate a DNS query with domain search
|
|
||||||
.SH SYNOPSIS
|
|
||||||
.nf
|
|
||||||
.B #include <ares.h>
|
|
||||||
.PP
|
|
||||||
.B typedef void (*ares_callback)(void *\fIarg\fP, int \fIstatus\fP,
|
|
||||||
.B int \fItimeouts\fP, unsigned char *\fIabuf\fP, int \fIalen\fP)
|
|
||||||
.PP
|
|
||||||
.B void ares_search(ares_channel \fIchannel\fP, const char *\fIname\fP,
|
|
||||||
.B int \fIdnsclass\fP, int \fItype\fP, ares_callback \fIcallback\fP,
|
|
||||||
.B void *\fIarg\fP)
|
|
||||||
.fi
|
|
||||||
.SH DESCRIPTION
|
|
||||||
The
|
|
||||||
.B ares_search
|
|
||||||
function initiates a series of single-question DNS queries on the name
|
|
||||||
service channel identified by
|
|
||||||
.IR channel ,
|
|
||||||
using the channel's search domains as well as a host alias file given
|
|
||||||
by the HOSTALIAS environment variable. The parameter
|
|
||||||
.I name
|
|
||||||
gives the alias name or the base of the query name as a NUL-terminated
|
|
||||||
C string of period-separated labels; if it ends with a period, the
|
|
||||||
channel's search domains will not be used. Periods and backslashes
|
|
||||||
within a label must be escaped with a backslash. The parameters
|
|
||||||
.I dnsclass
|
|
||||||
and
|
|
||||||
.I type
|
|
||||||
give the class and type of the query using the values defined in
|
|
||||||
.BR <arpa/nameser.h> .
|
|
||||||
When the query sequence is complete or has failed, the ares library
|
|
||||||
will invoke
|
|
||||||
.IR callback .
|
|
||||||
Completion or failure of the query sequence may happen immediately, or
|
|
||||||
may happen during a later call to
|
|
||||||
.BR ares_process (3)
|
|
||||||
or
|
|
||||||
.BR ares_destroy (3).
|
|
||||||
.PP
|
|
||||||
The callback argument
|
|
||||||
.I arg
|
|
||||||
is copied from the
|
|
||||||
.B ares_search
|
|
||||||
argument
|
|
||||||
.IR arg .
|
|
||||||
The callback argument
|
|
||||||
.I status
|
|
||||||
indicates whether the query sequence ended with a successful query
|
|
||||||
and, if not, how the query sequence failed. It may have any of the
|
|
||||||
following values:
|
|
||||||
.TP 19
|
|
||||||
.B ARES_SUCCESS
|
|
||||||
A query completed successfully.
|
|
||||||
.TP 19
|
|
||||||
.B ARES_ENODATA
|
|
||||||
No query completed successfully; when the query was tried without a
|
|
||||||
search domain appended, a response was returned with no answers.
|
|
||||||
.TP 19
|
|
||||||
.B ARES_EFORMERR
|
|
||||||
A query completed but the server claimed that the query was
|
|
||||||
malformatted.
|
|
||||||
.TP 19
|
|
||||||
.B ARES_ESERVFAIL
|
|
||||||
No query completed successfully; when the query was tried without a
|
|
||||||
search domain appended, the server claimed to have experienced a
|
|
||||||
failure. (This code can only occur if the
|
|
||||||
.B ARES_FLAG_NOCHECKRESP
|
|
||||||
flag was specified at channel initialization time; otherwise, such
|
|
||||||
responses are ignored at the
|
|
||||||
.BR ares_send (3)
|
|
||||||
level.)
|
|
||||||
.TP 19
|
|
||||||
.B ARES_ENOTFOUND
|
|
||||||
No query completed successfully; when the query was tried without a
|
|
||||||
search domain appended, the server reported that the queried-for
|
|
||||||
domain name was not found.
|
|
||||||
.TP 19
|
|
||||||
.B ARES_ENOTIMP
|
|
||||||
A query completed but the server does not implement the operation
|
|
||||||
requested by the query. (This code can only occur if the
|
|
||||||
.B ARES_FLAG_NOCHECKRESP
|
|
||||||
flag was specified at channel initialization time; otherwise, such
|
|
||||||
responses are ignored at the
|
|
||||||
.BR ares_send (3)
|
|
||||||
level.)
|
|
||||||
.TP 19
|
|
||||||
.B ARES_EREFUSED
|
|
||||||
A query completed but the server refused the query. (This code can
|
|
||||||
only occur returned if the
|
|
||||||
.B ARES_FLAG_NOCHECKRESP
|
|
||||||
flag was specified at channel initialization time; otherwise, such
|
|
||||||
responses are ignored at the
|
|
||||||
.BR ares_send (3)
|
|
||||||
level.)
|
|
||||||
.TP 19
|
|
||||||
.B ARES_TIMEOUT
|
|
||||||
No name servers responded to a query within the timeout period.
|
|
||||||
.TP 19
|
|
||||||
.B ARES_ECONNREFUSED
|
|
||||||
No name servers could be contacted.
|
|
||||||
.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
|
|
||||||
If a query completed successfully, the callback argument
|
|
||||||
.I abuf
|
|
||||||
points to a result buffer of length
|
|
||||||
.IR alen .
|
|
||||||
If the query did not complete successfully,
|
|
||||||
.I abuf
|
|
||||||
will usually be NULL and
|
|
||||||
.I alen
|
|
||||||
will usually be 0, but in some cases an unsuccessful query result may
|
|
||||||
be placed in
|
|
||||||
.IR abuf .
|
|
||||||
.SH SEE ALSO
|
|
||||||
.BR ares_process (3)
|
|
||||||
.SH AUTHOR
|
|
||||||
Greg Hudson, MIT Information Systems
|
|
||||||
.br
|
|
||||||
Copyright 1998 by the Massachusetts Institute of Technology.
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user