dnsruby 1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (520) hide show
  1. data/EVENTMACHINE +64 -0
  2. data/README +63 -0
  3. data/doc/classes/Dnsruby.html +463 -0
  4. data/doc/classes/Dnsruby/Algorithms.html +171 -0
  5. data/doc/classes/Dnsruby/Classes.html +197 -0
  6. data/doc/classes/Dnsruby/Classes.src/M000209.html +23 -0
  7. data/doc/classes/Dnsruby/Classes.src/M000210.html +19 -0
  8. data/doc/classes/Dnsruby/CodeMapper.html +375 -0
  9. data/doc/classes/Dnsruby/CodeMapper.src/M000186.html +18 -0
  10. data/doc/classes/Dnsruby/CodeMapper.src/M000187.html +33 -0
  11. data/doc/classes/Dnsruby/CodeMapper.src/M000188.html +21 -0
  12. data/doc/classes/Dnsruby/CodeMapper.src/M000189.html +19 -0
  13. data/doc/classes/Dnsruby/CodeMapper.src/M000190.html +19 -0
  14. data/doc/classes/Dnsruby/CodeMapper.src/M000191.html +18 -0
  15. data/doc/classes/Dnsruby/CodeMapper.src/M000192.html +22 -0
  16. data/doc/classes/Dnsruby/CodeMapper.src/M000193.html +22 -0
  17. data/doc/classes/Dnsruby/CodeMapper.src/M000194.html +22 -0
  18. data/doc/classes/Dnsruby/CodeMapper.src/M000195.html +31 -0
  19. data/doc/classes/Dnsruby/CodeMapper.src/M000196.html +19 -0
  20. data/doc/classes/Dnsruby/Config.html +413 -0
  21. data/doc/classes/Dnsruby/Config.src/M000148.html +18 -0
  22. data/doc/classes/Dnsruby/Config.src/M000149.html +19 -0
  23. data/doc/classes/Dnsruby/Config.src/M000150.html +19 -0
  24. data/doc/classes/Dnsruby/Config.src/M000151.html +25 -0
  25. data/doc/classes/Dnsruby/Config.src/M000152.html +21 -0
  26. data/doc/classes/Dnsruby/Config.src/M000153.html +38 -0
  27. data/doc/classes/Dnsruby/Config.src/M000154.html +26 -0
  28. data/doc/classes/Dnsruby/Config.src/M000155.html +22 -0
  29. data/doc/classes/Dnsruby/Config.src/M000156.html +27 -0
  30. data/doc/classes/Dnsruby/Config.src/M000157.html +22 -0
  31. data/doc/classes/Dnsruby/Config.src/M000158.html +21 -0
  32. data/doc/classes/Dnsruby/DNS.html +571 -0
  33. data/doc/classes/Dnsruby/DNS.src/M000258.html +24 -0
  34. data/doc/classes/Dnsruby/DNS.src/M000259.html +18 -0
  35. data/doc/classes/Dnsruby/DNS.src/M000260.html +18 -0
  36. data/doc/classes/Dnsruby/DNS.src/M000261.html +20 -0
  37. data/doc/classes/Dnsruby/DNS.src/M000262.html +19 -0
  38. data/doc/classes/Dnsruby/DNS.src/M000263.html +20 -0
  39. data/doc/classes/Dnsruby/DNS.src/M000264.html +18 -0
  40. data/doc/classes/Dnsruby/DNS.src/M000265.html +19 -0
  41. data/doc/classes/Dnsruby/DNS.src/M000266.html +20 -0
  42. data/doc/classes/Dnsruby/DNS.src/M000267.html +28 -0
  43. data/doc/classes/Dnsruby/DNS.src/M000268.html +19 -0
  44. data/doc/classes/Dnsruby/DNS.src/M000269.html +20 -0
  45. data/doc/classes/Dnsruby/DNS.src/M000270.html +31 -0
  46. data/doc/classes/Dnsruby/DecodeError.html +120 -0
  47. data/doc/classes/Dnsruby/Dnssec.html +287 -0
  48. data/doc/classes/Dnsruby/Dnssec.src/M000249.html +23 -0
  49. data/doc/classes/Dnsruby/Dnssec.src/M000250.html +19 -0
  50. data/doc/classes/Dnsruby/Dnssec.src/M000251.html +90 -0
  51. data/doc/classes/Dnsruby/Dnssec.src/M000252.html +76 -0
  52. data/doc/classes/Dnsruby/EncodeError.html +120 -0
  53. data/doc/classes/Dnsruby/FormErr.html +119 -0
  54. data/doc/classes/Dnsruby/Header.html +501 -0
  55. data/doc/classes/Dnsruby/Header.src/M000231.html +35 -0
  56. data/doc/classes/Dnsruby/Header.src/M000232.html +18 -0
  57. data/doc/classes/Dnsruby/Header.src/M000233.html +18 -0
  58. data/doc/classes/Dnsruby/Header.src/M000234.html +21 -0
  59. data/doc/classes/Dnsruby/Header.src/M000235.html +20 -0
  60. data/doc/classes/Dnsruby/Header.src/M000236.html +32 -0
  61. data/doc/classes/Dnsruby/Header.src/M000237.html +27 -0
  62. data/doc/classes/Dnsruby/Header.src/M000238.html +26 -0
  63. data/doc/classes/Dnsruby/Header.src/M000239.html +47 -0
  64. data/doc/classes/Dnsruby/Header.src/M000240.html +28 -0
  65. data/doc/classes/Dnsruby/Header.src/M000241.html +30 -0
  66. data/doc/classes/Dnsruby/Hosts.html +316 -0
  67. data/doc/classes/Dnsruby/Hosts.src/M000197.html +20 -0
  68. data/doc/classes/Dnsruby/Hosts.src/M000198.html +19 -0
  69. data/doc/classes/Dnsruby/Hosts.src/M000199.html +20 -0
  70. data/doc/classes/Dnsruby/Hosts.src/M000200.html +21 -0
  71. data/doc/classes/Dnsruby/Hosts.src/M000201.html +19 -0
  72. data/doc/classes/Dnsruby/Hosts.src/M000202.html +20 -0
  73. data/doc/classes/Dnsruby/Hosts.src/M000203.html +21 -0
  74. data/doc/classes/Dnsruby/IPv4.html +233 -0
  75. data/doc/classes/Dnsruby/IPv4.src/M000204.html +32 -0
  76. data/doc/classes/Dnsruby/IPv4.src/M000205.html +19 -0
  77. data/doc/classes/Dnsruby/IPv4.src/M000206.html +18 -0
  78. data/doc/classes/Dnsruby/IPv4.src/M000207.html +18 -0
  79. data/doc/classes/Dnsruby/IPv4.src/M000208.html +18 -0
  80. data/doc/classes/Dnsruby/IPv6.html +281 -0
  81. data/doc/classes/Dnsruby/IPv6.src/M000242.html +60 -0
  82. data/doc/classes/Dnsruby/IPv6.src/M000243.html +22 -0
  83. data/doc/classes/Dnsruby/IPv6.src/M000244.html +20 -0
  84. data/doc/classes/Dnsruby/IPv6.src/M000245.html +18 -0
  85. data/doc/classes/Dnsruby/Message.html +803 -0
  86. data/doc/classes/Dnsruby/Message.src/M000119.html +38 -0
  87. data/doc/classes/Dnsruby/Message.src/M000120.html +26 -0
  88. data/doc/classes/Dnsruby/Message.src/M000121.html +22 -0
  89. data/doc/classes/Dnsruby/Message.src/M000122.html +22 -0
  90. data/doc/classes/Dnsruby/Message.src/M000123.html +20 -0
  91. data/doc/classes/Dnsruby/Message.src/M000124.html +20 -0
  92. data/doc/classes/Dnsruby/Message.src/M000125.html +20 -0
  93. data/doc/classes/Dnsruby/Message.src/M000126.html +20 -0
  94. data/doc/classes/Dnsruby/Message.src/M000127.html +18 -0
  95. data/doc/classes/Dnsruby/Message.src/M000128.html +20 -0
  96. data/doc/classes/Dnsruby/Message.src/M000129.html +23 -0
  97. data/doc/classes/Dnsruby/Message.src/M000130.html +30 -0
  98. data/doc/classes/Dnsruby/Message.src/M000131.html +20 -0
  99. data/doc/classes/Dnsruby/Message.src/M000132.html +18 -0
  100. data/doc/classes/Dnsruby/Message.src/M000133.html +56 -0
  101. data/doc/classes/Dnsruby/Message.src/M000134.html +35 -0
  102. data/doc/classes/Dnsruby/Message.src/M000135.html +46 -0
  103. data/doc/classes/Dnsruby/Message/Section.html +160 -0
  104. data/doc/classes/Dnsruby/Message/Section.src/M000141.html +29 -0
  105. data/doc/classes/Dnsruby/Message/Section.src/M000142.html +30 -0
  106. data/doc/classes/Dnsruby/MetaTypes.html +136 -0
  107. data/doc/classes/Dnsruby/Modes.html +171 -0
  108. data/doc/classes/Dnsruby/NXDomain.html +119 -0
  109. data/doc/classes/Dnsruby/Name.html +330 -0
  110. data/doc/classes/Dnsruby/Name.src/M000104.html +28 -0
  111. data/doc/classes/Dnsruby/Name.src/M000105.html +20 -0
  112. data/doc/classes/Dnsruby/Name.src/M000106.html +18 -0
  113. data/doc/classes/Dnsruby/Name.src/M000107.html +21 -0
  114. data/doc/classes/Dnsruby/Name.src/M000108.html +22 -0
  115. data/doc/classes/Dnsruby/Name.src/M000109.html +18 -0
  116. data/doc/classes/Dnsruby/Name/Label.html +300 -0
  117. data/doc/classes/Dnsruby/Name/Label.src/M000110.html +21 -0
  118. data/doc/classes/Dnsruby/Name/Label.src/M000111.html +18 -0
  119. data/doc/classes/Dnsruby/Name/Label.src/M000112.html +22 -0
  120. data/doc/classes/Dnsruby/Name/Label.src/M000113.html +18 -0
  121. data/doc/classes/Dnsruby/Name/Label.src/M000114.html +18 -0
  122. data/doc/classes/Dnsruby/Name/Label.src/M000115.html +18 -0
  123. data/doc/classes/Dnsruby/Name/Label.src/M000116.html +18 -0
  124. data/doc/classes/Dnsruby/Name/Label.src/M000117.html +18 -0
  125. data/doc/classes/Dnsruby/Name/Label.src/M000118.html +18 -0
  126. data/doc/classes/Dnsruby/NotImp.html +119 -0
  127. data/doc/classes/Dnsruby/OpCode.html +146 -0
  128. data/doc/classes/Dnsruby/OtherResolvError.html +119 -0
  129. data/doc/classes/Dnsruby/QTypes.html +146 -0
  130. data/doc/classes/Dnsruby/Question.html +301 -0
  131. data/doc/classes/Dnsruby/Question.src/M000226.html +47 -0
  132. data/doc/classes/Dnsruby/Question.src/M000227.html +18 -0
  133. data/doc/classes/Dnsruby/Question.src/M000228.html +18 -0
  134. data/doc/classes/Dnsruby/Question.src/M000229.html +32 -0
  135. data/doc/classes/Dnsruby/Question.src/M000230.html +18 -0
  136. data/doc/classes/Dnsruby/RCode.html +211 -0
  137. data/doc/classes/Dnsruby/RR.html +648 -0
  138. data/doc/classes/Dnsruby/RR.src/M000001.html +18 -0
  139. data/doc/classes/Dnsruby/RR.src/M000002.html +22 -0
  140. data/doc/classes/Dnsruby/RR.src/M000003.html +18 -0
  141. data/doc/classes/Dnsruby/RR.src/M000004.html +18 -0
  142. data/doc/classes/Dnsruby/RR.src/M000005.html +26 -0
  143. data/doc/classes/Dnsruby/RR.src/M000006.html +18 -0
  144. data/doc/classes/Dnsruby/RR.src/M000007.html +36 -0
  145. data/doc/classes/Dnsruby/RR.src/M000008.html +100 -0
  146. data/doc/classes/Dnsruby/RR.src/M000009.html +18 -0
  147. data/doc/classes/Dnsruby/RR.src/M000010.html +18 -0
  148. data/doc/classes/Dnsruby/RR.src/M000011.html +22 -0
  149. data/doc/classes/Dnsruby/RR.src/M000012.html +29 -0
  150. data/doc/classes/Dnsruby/RR.src/M000013.html +24 -0
  151. data/doc/classes/Dnsruby/RR/ANY.html +133 -0
  152. data/doc/classes/Dnsruby/RR/CERT.html +180 -0
  153. data/doc/classes/Dnsruby/RR/CERT/CertificateTypes.html +169 -0
  154. data/doc/classes/Dnsruby/RR/CNAME.html +151 -0
  155. data/doc/classes/Dnsruby/RR/DNAME.html +150 -0
  156. data/doc/classes/Dnsruby/RR/DNSKEY.html +422 -0
  157. data/doc/classes/Dnsruby/RR/DNSKEY.src/M000044.html +20 -0
  158. data/doc/classes/Dnsruby/RR/DNSKEY.src/M000045.html +21 -0
  159. data/doc/classes/Dnsruby/RR/DNSKEY.src/M000046.html +28 -0
  160. data/doc/classes/Dnsruby/RR/DNSKEY.src/M000047.html +22 -0
  161. data/doc/classes/Dnsruby/RR/DNSKEY.src/M000048.html +18 -0
  162. data/doc/classes/Dnsruby/RR/DNSKEY.src/M000049.html +22 -0
  163. data/doc/classes/Dnsruby/RR/DNSKEY.src/M000050.html +18 -0
  164. data/doc/classes/Dnsruby/RR/DNSKEY.src/M000051.html +26 -0
  165. data/doc/classes/Dnsruby/RR/DNSKEY.src/M000052.html +38 -0
  166. data/doc/classes/Dnsruby/RR/DNSKEY.src/M000053.html +45 -0
  167. data/doc/classes/Dnsruby/RR/DNSKEY.src/M000054.html +21 -0
  168. data/doc/classes/Dnsruby/RR/DNSKEY.src/M000055.html +24 -0
  169. data/doc/classes/Dnsruby/RR/DNSKEY.src/M000056.html +32 -0
  170. data/doc/classes/Dnsruby/RR/DNSKEY.src/M000057.html +24 -0
  171. data/doc/classes/Dnsruby/RR/DS.html +286 -0
  172. data/doc/classes/Dnsruby/RR/DS.src/M000039.html +22 -0
  173. data/doc/classes/Dnsruby/RR/DS.src/M000040.html +28 -0
  174. data/doc/classes/Dnsruby/RR/DS.src/M000041.html +24 -0
  175. data/doc/classes/Dnsruby/RR/DS.src/M000042.html +28 -0
  176. data/doc/classes/Dnsruby/RR/DS.src/M000043.html +36 -0
  177. data/doc/classes/Dnsruby/RR/DomainName.html +175 -0
  178. data/doc/classes/Dnsruby/RR/DomainName.src/M000083.html +18 -0
  179. data/doc/classes/Dnsruby/RR/Generic.html +133 -0
  180. data/doc/classes/Dnsruby/RR/HINFO.html +155 -0
  181. data/doc/classes/Dnsruby/RR/IN.html +155 -0
  182. data/doc/classes/Dnsruby/RR/IN/A.html +200 -0
  183. data/doc/classes/Dnsruby/RR/IN/A.src/M000017.html +18 -0
  184. data/doc/classes/Dnsruby/RR/IN/A.src/M000018.html +18 -0
  185. data/doc/classes/Dnsruby/RR/IN/A.src/M000019.html +18 -0
  186. data/doc/classes/Dnsruby/RR/IN/AAAA.html +139 -0
  187. data/doc/classes/Dnsruby/RR/IN/AFSDB.html +145 -0
  188. data/doc/classes/Dnsruby/RR/IN/PX.html +143 -0
  189. data/doc/classes/Dnsruby/RR/IN/SRV.html +238 -0
  190. data/doc/classes/Dnsruby/RR/IN/SRV.src/M000014.html +29 -0
  191. data/doc/classes/Dnsruby/RR/IN/SRV.src/M000015.html +26 -0
  192. data/doc/classes/Dnsruby/RR/IN/SRV.src/M000016.html +22 -0
  193. data/doc/classes/Dnsruby/RR/IN/WKS.html +166 -0
  194. data/doc/classes/Dnsruby/RR/IN/WKS.src/M000020.html +20 -0
  195. data/doc/classes/Dnsruby/RR/ISDN.html +155 -0
  196. data/doc/classes/Dnsruby/RR/LOC.html +395 -0
  197. data/doc/classes/Dnsruby/RR/LOC.src/M000025.html +32 -0
  198. data/doc/classes/Dnsruby/RR/LOC.src/M000026.html +23 -0
  199. data/doc/classes/Dnsruby/RR/LOC.src/M000027.html +25 -0
  200. data/doc/classes/Dnsruby/RR/LOC.src/M000028.html +21 -0
  201. data/doc/classes/Dnsruby/RR/LOC.src/M000029.html +20 -0
  202. data/doc/classes/Dnsruby/RR/LOC.src/M000030.html +23 -0
  203. data/doc/classes/Dnsruby/RR/MB.html +150 -0
  204. data/doc/classes/Dnsruby/RR/MG.html +150 -0
  205. data/doc/classes/Dnsruby/RR/MINFO.html +156 -0
  206. data/doc/classes/Dnsruby/RR/MR.html +150 -0
  207. data/doc/classes/Dnsruby/RR/MX.html +155 -0
  208. data/doc/classes/Dnsruby/RR/NAPTR.html +190 -0
  209. data/doc/classes/Dnsruby/RR/NS.html +151 -0
  210. data/doc/classes/Dnsruby/RR/NSAP.html +293 -0
  211. data/doc/classes/Dnsruby/RR/NSAP.src/M000093.html +19 -0
  212. data/doc/classes/Dnsruby/RR/NSAP.src/M000094.html +19 -0
  213. data/doc/classes/Dnsruby/RR/NSAP.src/M000095.html +22 -0
  214. data/doc/classes/Dnsruby/RR/NSAP.src/M000096.html +31 -0
  215. data/doc/classes/Dnsruby/RR/NSEC.html +301 -0
  216. data/doc/classes/Dnsruby/RR/NSEC.src/M000031.html +19 -0
  217. data/doc/classes/Dnsruby/RR/NSEC.src/M000032.html +18 -0
  218. data/doc/classes/Dnsruby/RR/NSEC.src/M000033.html +34 -0
  219. data/doc/classes/Dnsruby/RR/NSEC.src/M000034.html +18 -0
  220. data/doc/classes/Dnsruby/RR/NSEC.src/M000035.html +71 -0
  221. data/doc/classes/Dnsruby/RR/NSEC.src/M000036.html +18 -0
  222. data/doc/classes/Dnsruby/RR/NSEC.src/M000037.html +80 -0
  223. data/doc/classes/Dnsruby/RR/NSEC.src/M000038.html +23 -0
  224. data/doc/classes/Dnsruby/RR/NSEC3.html +366 -0
  225. data/doc/classes/Dnsruby/RR/NSEC3.src/M000085.html +28 -0
  226. data/doc/classes/Dnsruby/RR/NSEC3.src/M000086.html +18 -0
  227. data/doc/classes/Dnsruby/RR/NSEC3.src/M000087.html +18 -0
  228. data/doc/classes/Dnsruby/RR/NSEC3.src/M000088.html +22 -0
  229. data/doc/classes/Dnsruby/RR/NSEC3.src/M000089.html +18 -0
  230. data/doc/classes/Dnsruby/RR/NSEC3.src/M000090.html +21 -0
  231. data/doc/classes/Dnsruby/RR/NSEC3.src/M000091.html +21 -0
  232. data/doc/classes/Dnsruby/RR/NSEC3.src/M000092.html +29 -0
  233. data/doc/classes/Dnsruby/RR/NSEC3PARAM.html +279 -0
  234. data/doc/classes/Dnsruby/RR/NSEC3PARAM.src/M000077.html +28 -0
  235. data/doc/classes/Dnsruby/RR/NSEC3PARAM.src/M000078.html +18 -0
  236. data/doc/classes/Dnsruby/RR/NSEC3PARAM.src/M000079.html +22 -0
  237. data/doc/classes/Dnsruby/RR/NSEC3PARAM.src/M000080.html +21 -0
  238. data/doc/classes/Dnsruby/RR/NSEC3PARAM.src/M000081.html +25 -0
  239. data/doc/classes/Dnsruby/RR/PTR.html +132 -0
  240. data/doc/classes/Dnsruby/RR/RP.html +183 -0
  241. data/doc/classes/Dnsruby/RR/RP.src/M000082.html +19 -0
  242. data/doc/classes/Dnsruby/RR/RRSIG.html +357 -0
  243. data/doc/classes/Dnsruby/RR/RRSIG.src/M000097.html +26 -0
  244. data/doc/classes/Dnsruby/RR/RRSIG.src/M000098.html +28 -0
  245. data/doc/classes/Dnsruby/RR/RRSIG.src/M000099.html +23 -0
  246. data/doc/classes/Dnsruby/RR/RRSIG.src/M000100.html +23 -0
  247. data/doc/classes/Dnsruby/RR/RRSIG.src/M000101.html +46 -0
  248. data/doc/classes/Dnsruby/RR/RRSIG.src/M000102.html +50 -0
  249. data/doc/classes/Dnsruby/RR/RRSIG.src/M000103.html +27 -0
  250. data/doc/classes/Dnsruby/RR/RT.html +155 -0
  251. data/doc/classes/Dnsruby/RR/SOA.html +233 -0
  252. data/doc/classes/Dnsruby/RR/SOA.src/M000066.html +24 -0
  253. data/doc/classes/Dnsruby/RR/SOA.src/M000067.html +27 -0
  254. data/doc/classes/Dnsruby/RR/SPF.html +138 -0
  255. data/doc/classes/Dnsruby/RR/TKEY.html +313 -0
  256. data/doc/classes/Dnsruby/RR/TKEY.src/M000021.html +19 -0
  257. data/doc/classes/Dnsruby/RR/TKEY.src/M000022.html +29 -0
  258. data/doc/classes/Dnsruby/RR/TKEY.src/M000023.html +21 -0
  259. data/doc/classes/Dnsruby/RR/TKEY.src/M000024.html +29 -0
  260. data/doc/classes/Dnsruby/RR/TSIG.html +524 -0
  261. data/doc/classes/Dnsruby/RR/TSIG.src/M000068.html +24 -0
  262. data/doc/classes/Dnsruby/RR/TSIG.src/M000069.html +32 -0
  263. data/doc/classes/Dnsruby/RR/TSIG.src/M000070.html +54 -0
  264. data/doc/classes/Dnsruby/RR/TSIG.src/M000071.html +121 -0
  265. data/doc/classes/Dnsruby/RR/TSIG.src/M000072.html +33 -0
  266. data/doc/classes/Dnsruby/RR/TSIG.src/M000073.html +25 -0
  267. data/doc/classes/Dnsruby/RR/TSIG.src/M000074.html +36 -0
  268. data/doc/classes/Dnsruby/RR/TSIG.src/M000075.html +22 -0
  269. data/doc/classes/Dnsruby/RR/TSIG.src/M000076.html +29 -0
  270. data/doc/classes/Dnsruby/RR/TXT.html +233 -0
  271. data/doc/classes/Dnsruby/RR/TXT.src/M000061.html +18 -0
  272. data/doc/classes/Dnsruby/RR/TXT.src/M000062.html +18 -0
  273. data/doc/classes/Dnsruby/RR/TXT.src/M000063.html +20 -0
  274. data/doc/classes/Dnsruby/RR/TXT.src/M000064.html +27 -0
  275. data/doc/classes/Dnsruby/RR/TXT.src/M000065.html +25 -0
  276. data/doc/classes/Dnsruby/RR/X25.html +203 -0
  277. data/doc/classes/Dnsruby/RR/X25.src/M000058.html +18 -0
  278. data/doc/classes/Dnsruby/RR/X25.src/M000059.html +18 -0
  279. data/doc/classes/Dnsruby/RR/X25.src/M000060.html +22 -0
  280. data/doc/classes/Dnsruby/RRSet.html +404 -0
  281. data/doc/classes/Dnsruby/RRSet.src/M000211.html +23 -0
  282. data/doc/classes/Dnsruby/RRSet.src/M000212.html +18 -0
  283. data/doc/classes/Dnsruby/RRSet.src/M000213.html +18 -0
  284. data/doc/classes/Dnsruby/RRSet.src/M000214.html +47 -0
  285. data/doc/classes/Dnsruby/RRSet.src/M000215.html +42 -0
  286. data/doc/classes/Dnsruby/RRSet.src/M000216.html +18 -0
  287. data/doc/classes/Dnsruby/RRSet.src/M000217.html +20 -0
  288. data/doc/classes/Dnsruby/RRSet.src/M000218.html +18 -0
  289. data/doc/classes/Dnsruby/RRSet.src/M000219.html +18 -0
  290. data/doc/classes/Dnsruby/RRSet.src/M000220.html +18 -0
  291. data/doc/classes/Dnsruby/RRSet.src/M000221.html +18 -0
  292. data/doc/classes/Dnsruby/RRSet.src/M000222.html +22 -0
  293. data/doc/classes/Dnsruby/RRSet.src/M000223.html +18 -0
  294. data/doc/classes/Dnsruby/RRSet.src/M000224.html +22 -0
  295. data/doc/classes/Dnsruby/RRSet.src/M000225.html +18 -0
  296. data/doc/classes/Dnsruby/Refused.html +119 -0
  297. data/doc/classes/Dnsruby/Resolv.html +401 -0
  298. data/doc/classes/Dnsruby/Resolv.src/M000159.html +18 -0
  299. data/doc/classes/Dnsruby/Resolv.src/M000160.html +18 -0
  300. data/doc/classes/Dnsruby/Resolv.src/M000161.html +18 -0
  301. data/doc/classes/Dnsruby/Resolv.src/M000162.html +18 -0
  302. data/doc/classes/Dnsruby/Resolv.src/M000163.html +18 -0
  303. data/doc/classes/Dnsruby/Resolv.src/M000164.html +18 -0
  304. data/doc/classes/Dnsruby/Resolv.src/M000165.html +18 -0
  305. data/doc/classes/Dnsruby/Resolv.src/M000166.html +19 -0
  306. data/doc/classes/Dnsruby/Resolv.src/M000167.html +20 -0
  307. data/doc/classes/Dnsruby/Resolv.src/M000168.html +29 -0
  308. data/doc/classes/Dnsruby/Resolv.src/M000169.html +19 -0
  309. data/doc/classes/Dnsruby/Resolv.src/M000170.html +20 -0
  310. data/doc/classes/Dnsruby/Resolv.src/M000171.html +25 -0
  311. data/doc/classes/Dnsruby/ResolvError.html +117 -0
  312. data/doc/classes/Dnsruby/ResolvTimeout.html +117 -0
  313. data/doc/classes/Dnsruby/Resolver.html +1055 -0
  314. data/doc/classes/Dnsruby/Resolver.src/M000271.html +21 -0
  315. data/doc/classes/Dnsruby/Resolver.src/M000272.html +27 -0
  316. data/doc/classes/Dnsruby/Resolver.src/M000273.html +28 -0
  317. data/doc/classes/Dnsruby/Resolver.src/M000274.html +18 -0
  318. data/doc/classes/Dnsruby/Resolver.src/M000275.html +51 -0
  319. data/doc/classes/Dnsruby/Resolver.src/M000276.html +21 -0
  320. data/doc/classes/Dnsruby/Resolver.src/M000277.html +22 -0
  321. data/doc/classes/Dnsruby/Resolver.src/M000278.html +18 -0
  322. data/doc/classes/Dnsruby/Resolver.src/M000279.html +20 -0
  323. data/doc/classes/Dnsruby/Resolver.src/M000280.html +19 -0
  324. data/doc/classes/Dnsruby/Resolver.src/M000281.html +19 -0
  325. data/doc/classes/Dnsruby/Resolver.src/M000282.html +19 -0
  326. data/doc/classes/Dnsruby/Resolver.src/M000283.html +19 -0
  327. data/doc/classes/Dnsruby/Resolver.src/M000284.html +19 -0
  328. data/doc/classes/Dnsruby/Resolver.src/M000285.html +19 -0
  329. data/doc/classes/Dnsruby/Resolver.src/M000286.html +19 -0
  330. data/doc/classes/Dnsruby/Resolver.src/M000287.html +19 -0
  331. data/doc/classes/Dnsruby/Resolver.src/M000288.html +19 -0
  332. data/doc/classes/Dnsruby/Resolver.src/M000289.html +19 -0
  333. data/doc/classes/Dnsruby/Resolver.src/M000290.html +19 -0
  334. data/doc/classes/Dnsruby/Resolver.src/M000291.html +19 -0
  335. data/doc/classes/Dnsruby/Resolver.src/M000292.html +26 -0
  336. data/doc/classes/Dnsruby/Resolver.src/M000293.html +18 -0
  337. data/doc/classes/Dnsruby/Resolver.src/M000294.html +23 -0
  338. data/doc/classes/Dnsruby/Resolver.src/M000295.html +18 -0
  339. data/doc/classes/Dnsruby/ServFail.html +119 -0
  340. data/doc/classes/Dnsruby/SingleResolver.html +674 -0
  341. data/doc/classes/Dnsruby/SingleResolver.src/M000172.html +18 -0
  342. data/doc/classes/Dnsruby/SingleResolver.src/M000173.html +24 -0
  343. data/doc/classes/Dnsruby/SingleResolver.src/M000174.html +36 -0
  344. data/doc/classes/Dnsruby/SingleResolver.src/M000175.html +18 -0
  345. data/doc/classes/Dnsruby/SingleResolver.src/M000176.html +19 -0
  346. data/doc/classes/Dnsruby/SingleResolver.src/M000177.html +50 -0
  347. data/doc/classes/Dnsruby/SingleResolver.src/M000178.html +19 -0
  348. data/doc/classes/Dnsruby/SingleResolver.src/M000179.html +21 -0
  349. data/doc/classes/Dnsruby/SingleResolver.src/M000180.html +25 -0
  350. data/doc/classes/Dnsruby/SingleResolver.src/M000181.html +54 -0
  351. data/doc/classes/Dnsruby/SingleResolver.src/M000182.html +27 -0
  352. data/doc/classes/Dnsruby/SingleResolver.src/M000183.html +27 -0
  353. data/doc/classes/Dnsruby/SingleResolver.src/M000184.html +35 -0
  354. data/doc/classes/Dnsruby/SingleResolver.src/M000185.html +21 -0
  355. data/doc/classes/Dnsruby/TheLog.html +196 -0
  356. data/doc/classes/Dnsruby/TheLog.src/M000246.html +20 -0
  357. data/doc/classes/Dnsruby/TheLog.src/M000247.html +20 -0
  358. data/doc/classes/Dnsruby/TheLog.src/M000248.html +20 -0
  359. data/doc/classes/Dnsruby/Types.html +436 -0
  360. data/doc/classes/Dnsruby/Update.html +368 -0
  361. data/doc/classes/Dnsruby/Update.src/M000253.html +32 -0
  362. data/doc/classes/Dnsruby/Update.src/M000254.html +36 -0
  363. data/doc/classes/Dnsruby/Update.src/M000255.html +32 -0
  364. data/doc/classes/Dnsruby/Update.src/M000256.html +41 -0
  365. data/doc/classes/Dnsruby/Update.src/M000257.html +34 -0
  366. data/doc/classes/Dnsruby/VerifyError.html +119 -0
  367. data/doc/classes/Dnsruby/ZoneTransfer.html +300 -0
  368. data/doc/classes/Dnsruby/ZoneTransfer.src/M000143.html +18 -0
  369. data/doc/classes/Dnsruby/ZoneTransfer.src/M000144.html +24 -0
  370. data/doc/classes/Dnsruby/ZoneTransfer.src/M000145.html +35 -0
  371. data/doc/classes/Dnsruby/ZoneTransfer/Delta.html +200 -0
  372. data/doc/classes/Dnsruby/ZoneTransfer/Delta.src/M000146.html +19 -0
  373. data/doc/classes/Dnsruby/ZoneTransfer/Delta.src/M000147.html +19 -0
  374. data/doc/created.rid +1 -0
  375. data/doc/files/lib/Dnsruby/Config_rb.html +101 -0
  376. data/doc/files/lib/Dnsruby/DNS_rb.html +110 -0
  377. data/doc/files/lib/Dnsruby/Hosts_rb.html +108 -0
  378. data/doc/files/lib/Dnsruby/Resolver_rb.html +109 -0
  379. data/doc/files/lib/Dnsruby/SingleResolver_rb.html +108 -0
  380. data/doc/files/lib/Dnsruby/TheLog_rb.html +110 -0
  381. data/doc/files/lib/Dnsruby/code_mapper_rb.html +101 -0
  382. data/doc/files/lib/Dnsruby/dnssec_rb.html +107 -0
  383. data/doc/files/lib/Dnsruby/event_machine_interface_rb.html +108 -0
  384. data/doc/files/lib/Dnsruby/ipv4_rb.html +101 -0
  385. data/doc/files/lib/Dnsruby/ipv6_rb.html +101 -0
  386. data/doc/files/lib/Dnsruby/message_rb.html +109 -0
  387. data/doc/files/lib/Dnsruby/name_rb.html +101 -0
  388. data/doc/files/lib/Dnsruby/resource/AAAA_rb.html +101 -0
  389. data/doc/files/lib/Dnsruby/resource/AFSDB_rb.html +101 -0
  390. data/doc/files/lib/Dnsruby/resource/A_rb.html +101 -0
  391. data/doc/files/lib/Dnsruby/resource/CERT_rb.html +101 -0
  392. data/doc/files/lib/Dnsruby/resource/DNSKEY_rb.html +101 -0
  393. data/doc/files/lib/Dnsruby/resource/DS_rb.html +101 -0
  394. data/doc/files/lib/Dnsruby/resource/HINFO_rb.html +101 -0
  395. data/doc/files/lib/Dnsruby/resource/IN_rb.html +112 -0
  396. data/doc/files/lib/Dnsruby/resource/ISDN_rb.html +101 -0
  397. data/doc/files/lib/Dnsruby/resource/LOC_rb.html +101 -0
  398. data/doc/files/lib/Dnsruby/resource/MINFO_rb.html +101 -0
  399. data/doc/files/lib/Dnsruby/resource/MX_rb.html +101 -0
  400. data/doc/files/lib/Dnsruby/resource/NAPTR_rb.html +101 -0
  401. data/doc/files/lib/Dnsruby/resource/NSAP_rb.html +101 -0
  402. data/doc/files/lib/Dnsruby/resource/NSEC3PARAM_rb.html +101 -0
  403. data/doc/files/lib/Dnsruby/resource/NSEC3_rb.html +101 -0
  404. data/doc/files/lib/Dnsruby/resource/NSEC_rb.html +101 -0
  405. data/doc/files/lib/Dnsruby/resource/OPT_rb.html +101 -0
  406. data/doc/files/lib/Dnsruby/resource/PX_rb.html +101 -0
  407. data/doc/files/lib/Dnsruby/resource/RP_rb.html +101 -0
  408. data/doc/files/lib/Dnsruby/resource/RRSIG_rb.html +101 -0
  409. data/doc/files/lib/Dnsruby/resource/RT_rb.html +101 -0
  410. data/doc/files/lib/Dnsruby/resource/SOA_rb.html +101 -0
  411. data/doc/files/lib/Dnsruby/resource/SPF_rb.html +101 -0
  412. data/doc/files/lib/Dnsruby/resource/SRV_rb.html +101 -0
  413. data/doc/files/lib/Dnsruby/resource/TKEY_rb.html +101 -0
  414. data/doc/files/lib/Dnsruby/resource/TSIG_rb.html +114 -0
  415. data/doc/files/lib/Dnsruby/resource/TXT_rb.html +108 -0
  416. data/doc/files/lib/Dnsruby/resource/X25_rb.html +101 -0
  417. data/doc/files/lib/Dnsruby/resource/domain_name_rb.html +101 -0
  418. data/doc/files/lib/Dnsruby/resource/generic_rb.html +131 -0
  419. data/doc/files/lib/Dnsruby/resource/resource_rb.html +110 -0
  420. data/doc/files/lib/Dnsruby/select_thread_rb.html +111 -0
  421. data/doc/files/lib/Dnsruby/update_rb.html +101 -0
  422. data/doc/files/lib/Dnsruby/zone_transfer_rb.html +101 -0
  423. data/doc/files/lib/dnsruby_rb.html +118 -0
  424. data/doc/fr_class_index.html +108 -0
  425. data/doc/fr_file_index.html +75 -0
  426. data/doc/fr_method_index.html +321 -0
  427. data/doc/index.html +24 -0
  428. data/lib/Dnsruby/Config.rb +363 -0
  429. data/lib/Dnsruby/DNS.rb +293 -0
  430. data/lib/Dnsruby/Hosts.rb +126 -0
  431. data/lib/Dnsruby/Resolver.rb +999 -0
  432. data/lib/Dnsruby/SingleResolver.rb +493 -0
  433. data/lib/Dnsruby/TheLog.rb +60 -0
  434. data/lib/Dnsruby/code_mapper.rb +165 -0
  435. data/lib/Dnsruby/dnssec.rb +357 -0
  436. data/lib/Dnsruby/event_machine_interface.rb +264 -0
  437. data/lib/Dnsruby/ipv4.rb +74 -0
  438. data/lib/Dnsruby/ipv6.rb +144 -0
  439. data/lib/Dnsruby/message.rb +961 -0
  440. data/lib/Dnsruby/name.rb +332 -0
  441. data/lib/Dnsruby/resource/A.rb +56 -0
  442. data/lib/Dnsruby/resource/AAAA.rb +54 -0
  443. data/lib/Dnsruby/resource/AFSDB.rb +68 -0
  444. data/lib/Dnsruby/resource/CERT.rb +89 -0
  445. data/lib/Dnsruby/resource/DNSKEY.rb +242 -0
  446. data/lib/Dnsruby/resource/DS.rb +162 -0
  447. data/lib/Dnsruby/resource/HINFO.rb +52 -0
  448. data/lib/Dnsruby/resource/IN.rb +70 -0
  449. data/lib/Dnsruby/resource/ISDN.rb +54 -0
  450. data/lib/Dnsruby/resource/LOC.rb +255 -0
  451. data/lib/Dnsruby/resource/MINFO.rb +70 -0
  452. data/lib/Dnsruby/resource/MX.rb +66 -0
  453. data/lib/Dnsruby/resource/NAPTR.rb +90 -0
  454. data/lib/Dnsruby/resource/NSAP.rb +172 -0
  455. data/lib/Dnsruby/resource/NSEC.rb +243 -0
  456. data/lib/Dnsruby/resource/NSEC3.rb +173 -0
  457. data/lib/Dnsruby/resource/NSEC3PARAM.rb +120 -0
  458. data/lib/Dnsruby/resource/OPT.rb +210 -0
  459. data/lib/Dnsruby/resource/PX.rb +71 -0
  460. data/lib/Dnsruby/resource/RP.rb +67 -0
  461. data/lib/Dnsruby/resource/RRSIG.rb +256 -0
  462. data/lib/Dnsruby/resource/RT.rb +67 -0
  463. data/lib/Dnsruby/resource/SOA.rb +95 -0
  464. data/lib/Dnsruby/resource/SPF.rb +29 -0
  465. data/lib/Dnsruby/resource/SRV.rb +112 -0
  466. data/lib/Dnsruby/resource/TKEY.rb +163 -0
  467. data/lib/Dnsruby/resource/TSIG.rb +584 -0
  468. data/lib/Dnsruby/resource/TXT.rb +76 -0
  469. data/lib/Dnsruby/resource/X25.rb +53 -0
  470. data/lib/Dnsruby/resource/domain_name.rb +54 -0
  471. data/lib/Dnsruby/resource/generic.rb +151 -0
  472. data/lib/Dnsruby/resource/resource.rb +561 -0
  473. data/lib/Dnsruby/select_thread.rb +449 -0
  474. data/lib/Dnsruby/update.rb +262 -0
  475. data/lib/Dnsruby/zone_transfer.rb +332 -0
  476. data/lib/dnsruby.rb +512 -0
  477. data/test/custom.txt +4 -0
  478. data/test/resolv.conf +4 -0
  479. data/test/tc_axfr.rb +32 -0
  480. data/test/tc_dns.rb +230 -0
  481. data/test/tc_dnskey.rb +52 -0
  482. data/test/tc_dnsruby.rb +42 -0
  483. data/test/tc_dnssec.rb +88 -0
  484. data/test/tc_ds.rb +38 -0
  485. data/test/tc_escapedchars.rb +484 -0
  486. data/test/tc_event_machine_deferrable.rb +85 -0
  487. data/test/tc_event_machine_res.rb +174 -0
  488. data/test/tc_event_machine_single_res.rb +101 -0
  489. data/test/tc_event_machine_soak.rb +98 -0
  490. data/test/tc_header.rb +104 -0
  491. data/test/tc_misc.rb +139 -0
  492. data/test/tc_name.rb +53 -0
  493. data/test/tc_nsec.rb +36 -0
  494. data/test/tc_nsec3.rb +63 -0
  495. data/test/tc_nsec3param.rb +30 -0
  496. data/test/tc_packet.rb +179 -0
  497. data/test/tc_packet_unique_push.rb +102 -0
  498. data/test/tc_question.rb +51 -0
  499. data/test/tc_res_config.rb +92 -0
  500. data/test/tc_res_env.rb +51 -0
  501. data/test/tc_res_file.rb +42 -0
  502. data/test/tc_res_opt.rb +187 -0
  503. data/test/tc_resolver.rb +184 -0
  504. data/test/tc_rr-opt.rb +82 -0
  505. data/test/tc_rr-txt.rb +137 -0
  506. data/test/tc_rr-unknown.rb +99 -0
  507. data/test/tc_rr.rb +258 -0
  508. data/test/tc_rrset.rb +58 -0
  509. data/test/tc_rrsig.rb +32 -0
  510. data/test/tc_single_resolver.rb +169 -0
  511. data/test/tc_soak.rb +200 -0
  512. data/test/tc_soak_base.rb +136 -0
  513. data/test/tc_tcp.rb +35 -0
  514. data/test/tc_tkey.rb +75 -0
  515. data/test/tc_tsig.rb +237 -0
  516. data/test/tc_update.rb +215 -0
  517. data/test/ts_dnsruby.rb +17 -0
  518. data/test/ts_offline.rb +42 -0
  519. data/test/ts_online.rb +107 -0
  520. metadata +627 -0
@@ -0,0 +1,95 @@
1
+ #--
2
+ #Copyright 2007 Nominet UK
3
+ #
4
+ #Licensed under the Apache License, Version 2.0 (the "License");
5
+ #you may not use this file except in compliance with the License.
6
+ #You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ #Unless required by applicable law or agreed to in writing, software
11
+ #distributed under the License is distributed on an "AS IS" BASIS,
12
+ #WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ #See the License for the specific language governing permissions and
14
+ #limitations under the License.
15
+ #++
16
+ module Dnsruby
17
+ class RR
18
+ class SOA < RR
19
+ ClassValue = nil #:nodoc: all
20
+ TypeValue = Types::SOA #:nodoc: all
21
+
22
+ #The domain name of the original or primary nameserver for
23
+ #this zone.
24
+ attr_accessor :mname
25
+ #A domain name that specifies the mailbox for the person
26
+ #responsible for this zone.
27
+ attr_accessor :rname
28
+ #The zone's serial number.
29
+ attr_accessor :serial
30
+ #The zone's refresh interval.
31
+ #How often, in seconds, a secondary nameserver is to check for
32
+ #updates from the primary nameserver.
33
+ attr_accessor :refresh
34
+ #The zone's retry interval.
35
+ #How often, in seconds, a secondary nameserver is to retry, after a
36
+ #failure to check for a refresh
37
+ attr_accessor :retry
38
+ #The zone's expire interval.
39
+ #How often, in seconds, a secondary nameserver is to use the data
40
+ #before refreshing from the primary nameserver
41
+ attr_accessor :expire
42
+ #The minimum (default) TTL for records in this zone.
43
+ attr_accessor :minimum
44
+
45
+ def from_data(data) #:nodoc: all
46
+ @mname, @rname, @serial, @refresh, @retry, @expire, @minimum = data
47
+ end
48
+
49
+ def from_hash(hash)
50
+ @mname = Name.create(hash[:mname])
51
+ @rname = Name.create(hash[:rname])
52
+ @serial = hash[:serial]
53
+ @refresh = hash[:refresh]
54
+ @retry = hash[:retry]
55
+ @expire = hash[:expire]
56
+ @minimum = hash[:minimum]
57
+ end
58
+
59
+ def from_string(input)
60
+ if (input.length > 0)
61
+ names = input.split(" ")
62
+ @mname = Name.create(names[0])
63
+ @rname = Name.create(names[1])
64
+ @serial = names[2].to_i
65
+ @refresh = names[3].to_i
66
+ @retry = names[4].to_i
67
+ @expire = names[5].to_i
68
+ @minimum = names[6].to_i
69
+ end
70
+ end
71
+
72
+ def rdata_to_string #:nodoc: all
73
+ if (@mname!=nil)
74
+ return "#{@mname} #{@rname} #{@serial} #{@refresh} #{@retry} #{@expire} #{@minimum}"
75
+ else
76
+ return ""
77
+ end
78
+ end
79
+
80
+ def encode_rdata(msg, canonical=false) #:nodoc: all
81
+ msg.put_name(@mname, canonical)
82
+ msg.put_name(@rname, canonical)
83
+ msg.put_pack('NNNNN', @serial, @refresh, @retry, @expire, @minimum)
84
+ end
85
+
86
+ def self.decode_rdata(msg) #:nodoc: all
87
+ mname = msg.get_name
88
+ rname = msg.get_name
89
+ serial, refresh, retry_, expire, minimum = msg.get_unpack('NNNNN')
90
+ return self.new(
91
+ [mname, rname, serial, refresh, retry_, expire, minimum])
92
+ end
93
+ end
94
+ end
95
+ end
@@ -0,0 +1,29 @@
1
+ #--
2
+ #Copyright 2007 Nominet UK
3
+ #
4
+ #Licensed under the Apache License, Version 2.0 (the "License");
5
+ #you may not use this file except in compliance with the License.
6
+ #You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ #Unless required by applicable law or agreed to in writing, software
11
+ #distributed under the License is distributed on an "AS IS" BASIS,
12
+ #WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ #See the License for the specific language governing permissions and
14
+ #limitations under the License.
15
+ #++
16
+ module Dnsruby
17
+ class RR
18
+ #DNS SPF resource record
19
+
20
+ #This is a clone of the TXT record. This class therfore completely inherits
21
+ #all properties of the Dnsruby::Resource::TXT class.
22
+ #
23
+ #Please see the Dnsruby::Resource::TXT documentation for details
24
+ #RFC 1035 Section 3.3.14, draft-schlitt-ospf-classic-02.txt
25
+ class SPF < TXT
26
+ TypeValue = Types::SPF #:nodoc: all
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,112 @@
1
+ #--
2
+ #Copyright 2007 Nominet UK
3
+ #
4
+ #Licensed under the Apache License, Version 2.0 (the "License");
5
+ #you may not use this file except in compliance with the License.
6
+ #You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ #Unless required by applicable law or agreed to in writing, software
11
+ #distributed under the License is distributed on an "AS IS" BASIS,
12
+ #WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ #See the License for the specific language governing permissions and
14
+ #limitations under the License.
15
+ #++
16
+ module Dnsruby
17
+ class RR
18
+ module IN
19
+ # SRV resource record defined in RFC 2782
20
+ #
21
+ # These records identify the hostname and port that a service is
22
+ # available at.
23
+ #
24
+ # The format is:
25
+ # _Service._Proto.Name TTL Class SRV Priority Weight Port Target
26
+ #
27
+ # The fields specific to SRV are defined in RFC 2782
28
+ class SRV < RR
29
+ ClassHash[[TypeValue = Types::SRV, ClassValue = ClassValue]] = self #:nodoc: all
30
+
31
+ # The priority of this target host.
32
+ # A client MUST attempt
33
+ # to contact the target host with the lowest-numbered priority it can
34
+ # reach; target hosts with the same priority SHOULD be tried in an
35
+ # order defined by the weight field. The range is 0-65535. Note that
36
+ # it is not widely implemented and should be set to zero.
37
+ attr_accessor :priority
38
+
39
+ # A server selection mechanism.
40
+ # The weight field specifies
41
+ # a relative weight for entries with the same priority. Larger weights
42
+ # SHOULD be given a proportionately higher probability of being
43
+ # selected. The range of this number is 0-65535. Domain administrators
44
+ # SHOULD use Weight 0 when there isn't any server selection to do, to
45
+ # make the RR easier to read for humans (less noisy). Note that it is
46
+ # not widely implemented and should be set to zero.
47
+ attr_accessor :weight
48
+
49
+ # The port on this target host of this service. The range is 0-65535.
50
+ attr_accessor :port
51
+
52
+ # The domain name of the target host. A target of "." means
53
+ # that the service is decidedly not available at this domain.
54
+ attr_accessor :target
55
+
56
+ def from_data(data) #:nodoc: all
57
+ @priority, @weight, @port, @target = data
58
+ end
59
+
60
+ def from_hash(hash)
61
+ if hash[:priority]
62
+ @priority = hash[:priority].to_int
63
+ end
64
+ if hash[:weight]
65
+ @weight = hash[:weight].to_int
66
+ end
67
+ if hash[:port]
68
+ @port = hash[:port].to_int
69
+ end
70
+ if hash[:target]
71
+ @target= Name.create(hash[:target])
72
+ end
73
+ end
74
+
75
+ def from_string(input)
76
+ if (input.length > 0)
77
+ names = input.split(" ")
78
+ @priority = names[0]
79
+ @weight = names[1]
80
+ @port = names[2]
81
+ if (names[3])
82
+ @target = Name.create(names[3])
83
+ end
84
+ end
85
+ end
86
+
87
+ def rdata_to_string
88
+ if (@target!=nil)
89
+ return "#{@priority} #{@weight} #{@port} #{@target}"
90
+ else
91
+ return ""
92
+ end
93
+ end
94
+
95
+ def encode_rdata(msg, canonical=false) #:nodoc: all
96
+ msg.put_pack("n", @priority)
97
+ msg.put_pack("n", @weight)
98
+ msg.put_pack("n", @port)
99
+ msg.put_name(@target,canonical)
100
+ end
101
+
102
+ def self.decode_rdata(msg) #:nodoc: all
103
+ priority, = msg.get_unpack("n")
104
+ weight, = msg.get_unpack("n")
105
+ port, = msg.get_unpack("n")
106
+ target = msg.get_name
107
+ return self.new([priority, weight, port, target])
108
+ end
109
+ end
110
+ end
111
+ end
112
+ end
@@ -0,0 +1,163 @@
1
+ #--
2
+ #Copyright 2007 Nominet UK
3
+ #
4
+ #Licensed under the Apache License, Version 2.0 (the "License");
5
+ #you may not use this file except in compliance with the License.
6
+ #You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ #Unless required by applicable law or agreed to in writing, software
11
+ #distributed under the License is distributed on an "AS IS" BASIS,
12
+ #WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ #See the License for the specific language governing permissions and
14
+ #limitations under the License.
15
+ #++
16
+ module Dnsruby
17
+
18
+ class Modes < CodeMapper
19
+ # The key is assigned by the server (unimplemented)
20
+ SERVERASSIGNED = 1
21
+
22
+ # The key is computed using a Diffie-Hellman key exchange
23
+ DIFFIEHELLMAN = 2
24
+
25
+ # The key is computed using GSS_API (unimplemented)
26
+ GSSAPI = 3
27
+
28
+ # The key is assigned by the resolver (unimplemented)
29
+ RESOLVERASSIGNED = 4
30
+
31
+ # The key should be deleted
32
+ DELETE = 5
33
+ update()
34
+ end
35
+
36
+ class RR
37
+ #RFC2930
38
+ class TKEY < RR
39
+ TypeValue = Types::TKEY #:nodoc: all
40
+ ClassValue = nil #:nodoc: all
41
+ ClassHash[[TypeValue, Classes::ANY]] = self #:nodoc: all
42
+
43
+ attr_reader :key_size
44
+ attr_accessor :key
45
+ #Gets or sets the domain name that specifies the name of the algorithm.
46
+ #The default algorithm is gss.microsoft.com
47
+ #
48
+ # rr.algorithm=(algorithm_name)
49
+ # print "algorithm = ", rr.algorithm, "\n"
50
+ #
51
+ attr_accessor :algorithm
52
+ #Gets or sets the inception time as the number of seconds since 1 Jan 1970
53
+ #00:00:00 UTC.
54
+ #
55
+ #The default inception time is the current time.
56
+ #
57
+ # rr.inception=(time)
58
+ # print "inception = ", rr.inception, "\n"
59
+ #
60
+ attr_accessor :inception
61
+ #Gets or sets the expiration time as the number of seconds since 1 Jan 1970
62
+ #00:00:00 UTC.
63
+ #
64
+ #The default expiration time is the current time plus 1 day.
65
+ #
66
+ # rr.expiration=(time)
67
+ # print "expiration = ", rr.expiration, "\n"
68
+ #
69
+ attr_accessor :expiration
70
+ #Sets the key mode (see rfc2930). The default is 3 which corresponds to GSSAPI
71
+ #
72
+ # rr.mode=(3)
73
+ # print "mode = ", rr.mode, "\n"
74
+ #
75
+ attr_accessor :mode
76
+ #Returns the RCODE covering TKEY processing. See RFC 2930 for details.
77
+ #
78
+ # print "error = ", rr.error, "\n"
79
+ #
80
+ attr_accessor :error
81
+ #Returns the length of the Other Data. Should be zero.
82
+ #
83
+ # print "other size = ", rr.other_size, "\n"
84
+ #
85
+ attr_reader :other_size
86
+ #Returns the Other Data. This field should be empty.
87
+ #
88
+ # print "other data = ", rr.other_data, "\n"
89
+ #
90
+ attr_reader :other_data
91
+
92
+ def other_data=(od)
93
+ @other_data=od
94
+ @other_size=@other_data.length
95
+ end
96
+
97
+ def initialize
98
+ @algorithm = "gss.microsoft.com"
99
+ @inception = Time.now
100
+ @expiration = Time.now + 24*60*60
101
+ @mode = Modes.GSSAPI
102
+ @error = 0
103
+ @other_size = 0
104
+ @other_data = ""
105
+
106
+ # RFC 2845 Section 2.3
107
+ @klass = Classes.ANY
108
+ # RFC 2845 Section 2.3
109
+ @ttl = 0
110
+ end
111
+
112
+ def from_hash(hash)
113
+ super(hash)
114
+ if (algorithm)
115
+ @algorithm = Name.create(hash[:algorithm])
116
+ end
117
+ end
118
+
119
+ def from_data(data) #:nodoc: all
120
+ @algorithm, @inception, @expiration, @mode, @error, @key_size, @key, @other_size, @other_data = data
121
+ end
122
+
123
+ # Create the RR from a standard string
124
+ def from_string(string) #:nodoc: all
125
+ TheLog.error("Dnsruby::RR::TKEY#from_string called, but no text format defined for TKEY")
126
+ end
127
+
128
+ def rdata_to_string
129
+ rdatastr=""
130
+
131
+ if (@algorithm!=nil)
132
+ error = @error
133
+ error = "UNDEFINED" unless error!=nil
134
+ rdatastr = "#{@algorithm}. #{error}"
135
+ if (@other_size != nil && @other_size >0 && @other_data!=nil)
136
+ rdatastr += " #{@other_data}"
137
+ end
138
+ end
139
+
140
+ return rdatastr
141
+ end
142
+
143
+ def encode_rdata(msg, canonical=false) #:nodoc: all
144
+ msg.put_name(@algorithm, canonical)
145
+ msg.put_pack("NNnn", @inception, @expiration, @mode, @error)
146
+ msg.put_pack("n", @key.length)
147
+ msg.put_bytes(@key)
148
+ msg.put_pack("n", @other_data.length)
149
+ msg.put_bytes(@other_data)
150
+ end
151
+
152
+ def self.decode_rdata(msg) #:nodoc: all
153
+ alg=msg.get_name
154
+ inc, exp, mode, error = msg.get_unpack("NNnn")
155
+ key_size, =msg.get_unpack("n")
156
+ key=msg.get_bytes(key_size)
157
+ other_size, =msg.get_unpack("n")
158
+ other=msg.get_bytes(other_size)
159
+ return self.new([alg, inc, exp, mode, error, key_size, key, other_size, other])
160
+ end
161
+ end
162
+ end
163
+ end
@@ -0,0 +1,584 @@
1
+ #--
2
+ #Copyright 2007 Nominet UK
3
+ #
4
+ #Licensed under the Apache License, Version 2.0 (the "License");
5
+ #you may not use this file except in compliance with the License.
6
+ #You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ #Unless required by applicable law or agreed to in writing, software
11
+ #distributed under the License is distributed on an "AS IS" BASIS,
12
+ #WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ #See the License for the specific language governing permissions and
14
+ #limitations under the License.
15
+ #++
16
+ #require 'base64'
17
+ require 'openssl'
18
+ module Dnsruby
19
+ class RR
20
+ #TSIG implements RFC2845.
21
+ #
22
+ #"This protocol allows for transaction level authentication using
23
+ #shared secrets and one way hashing. It can be used to authenticate
24
+ #dynamic updates as coming from an approved client, or to authenticate
25
+ #responses as coming from an approved recursive name server."
26
+ #
27
+ #A Dnsruby::RR::TSIG can represent the data present in a TSIG RR.
28
+ #However, it can also represent the data (specified in RFC2845) used
29
+ #to sign or verify a DNS message.
30
+ #
31
+ #
32
+ #Example code :
33
+ # res = Dnsruby::Resolver.new("ns0.validation-test-servers.nominet.org.uk")
34
+ #
35
+ # # Now configure the resolver with the TSIG key for signing/verifying
36
+ # KEY_NAME="rubytsig"
37
+ # KEY = "8n6gugn4aJ7MazyNlMccGKH1WxD2B3UvN/O/RA6iBupO2/03u9CTa3Ewz3gBWTSBCH3crY4Kk+tigNdeJBAvrw=="
38
+ # res.tsig=KEY_NAME, KEY
39
+ #
40
+ # update = Dnsruby::Update.new("validation-test-servers.nominet.org.uk")
41
+ # # Generate update record name, and test it has been made. Then delete it and check it has been deleted
42
+ # update_name = generate_update_name
43
+ # update.absent(update_name)
44
+ # update.add(update_name, 'TXT', 100, "test signed update")
45
+ #
46
+ # # Resolver will automatically sign message and verify response
47
+ # response = res.send_message(update)
48
+ # assert(response.verified?) # Check that the response has been verified
49
+ class TSIG < RR
50
+ HMAC_MD5 = Name.create("HMAC-MD5.SIG-ALG.REG.INT.")
51
+ HMAC_SHA1 = Name.create("hmac-sha1.")
52
+ HMAC_SHA256 = Name.create("hmac-sha256.")
53
+
54
+ DEFAULT_FUDGE = 300
55
+
56
+ DEFAULT_ALGORITHM = HMAC_MD5
57
+
58
+ #Generates a TSIG record and adds it to the message.
59
+ #Takes an optional original_request argument for the case where this is
60
+ #a response to a query (RFC2845 3.4.1)
61
+ #
62
+ #Message#tsigstate will be set to :Signed.
63
+ def apply(message, original_request=nil)
64
+ if (!message.signed?)
65
+ tsig_rr = generate(message, original_request)
66
+ message.add_additional(tsig_rr)
67
+ message.tsigstate = :Signed
68
+ @query = message
69
+ tsig_rr.query = message
70
+ end
71
+ end
72
+
73
+ def query=q#:nodoc: all
74
+ @query = q
75
+ end
76
+
77
+
78
+ #Generates a TSIG record
79
+ def generate(msg, original_request = nil, data="", msg_bytes=nil, tsig_rr=self)#:nodoc: all
80
+ time_signed=@time_signed
81
+ if (!time_signed)
82
+ time_signed=Time.now.to_i
83
+ end
84
+ if (tsig_rr.time_signed)
85
+ time_signed = tsig_rr.time_signed
86
+ end
87
+
88
+ if (original_request)
89
+ # # Add the request MAC if present (used to validate responses).
90
+ # hmac.update(pack("H*", request_mac))
91
+ mac_bytes = MessageEncoder.new {|m|
92
+ m.put_pack('n', original_request.tsig.mac_size)
93
+ m.put_bytes(original_request.tsig.mac)
94
+ }.to_s
95
+ data += mac_bytes
96
+ # Original ID - should we set message ID to original ID?
97
+ if (tsig_rr != self)
98
+ msg.header.id = tsig_rr.original_id
99
+ else
100
+ msg.header.id = original_request.header.id
101
+ end
102
+ end
103
+
104
+ if (!msg_bytes)
105
+ msg_bytes = msg.encode
106
+ data += msg_bytes
107
+ else
108
+ # If msg_bytes came in, we need somehow to remove the TSIG RR
109
+ # It is the last record, so we can strip it if we know where it starts
110
+ # We must also poke the header ARcount to decrement it
111
+ msg_bytes = Header.decrement_arcount_encoded(msg_bytes)
112
+ data += msg_bytes[0, msg.tsigstart]
113
+ end
114
+
115
+ data += sig_data(tsig_rr, time_signed)
116
+
117
+ mac = calculate_mac(tsig_rr.algorithm, data)
118
+
119
+ mac_size = mac.length
120
+
121
+ new_tsig_rr = Dnsruby::RR.create({
122
+ :name => tsig_rr.name,
123
+ :type => Types.TSIG,
124
+ :ttl => tsig_rr.ttl,
125
+ :klass => tsig_rr.klass,
126
+ :algorithm => tsig_rr.algorithm,
127
+ :fudge => tsig_rr.fudge,
128
+ :key => @key,
129
+ :mac => mac,
130
+ :mac_size => mac_size,
131
+ :error => tsig_rr.error,
132
+ :time_signed => time_signed,
133
+ :original_id => msg.header.id
134
+ })
135
+ return new_tsig_rr
136
+
137
+ end
138
+
139
+ def calculate_mac(algorithm, data)
140
+ mac=nil
141
+ key = @key.gsub(" ", "")
142
+ # key = Base64::decode64(key)
143
+ key = key.unpack("m*")[0]
144
+ if (algorithm == HMAC_MD5)
145
+ mac = OpenSSL::HMAC.digest(OpenSSL::Digest::MD5.new, key, data)
146
+ elsif (algorithm == HMAC_SHA1)
147
+ mac = OpenSSL::HMAC.digest(OpenSSL::Digest::SHA1.new, key, data)
148
+ elsif (algorithm == HMAC_SHA256)
149
+ mac = OpenSSL::HMAC.digest(OpenSSL::Digest::SHA256.new, key, data)
150
+ else
151
+ # Should we allow client to pass in their own signing function?
152
+ raise VerifyError.new("Algorithm #{algorithm} unsupported by TSIG")
153
+ end
154
+ return mac
155
+ end
156
+
157
+ # Private method to return the TSIG RR data to be signed
158
+ def sig_data(tsig_rr, time_signed=@time_signed) #:nodoc: all
159
+ return MessageEncoder.new { |msg|
160
+ msg.put_name(tsig_rr.name.downcase, true)
161
+ msg.put_pack('nN', tsig_rr.klass.code, tsig_rr.ttl)
162
+ msg.put_name(tsig_rr.algorithm.downcase, true)
163
+
164
+ time_high = (time_signed >> 32)
165
+ time_low = (time_signed & 0xFFFFFFFF)
166
+ msg.put_pack('nN', time_high, time_low)
167
+ msg.put_pack('n', tsig_rr.fudge)
168
+ msg.put_pack('n', tsig_rr.error)
169
+ msg.put_pack('n', tsig_rr.other_size)
170
+ msg.put_bytes(tsig_rr.other_data)
171
+ }.to_s
172
+ end
173
+
174
+ #Verify a response. This method will be called by Dnsruby::SingleResolver
175
+ #before passing a response to the client code.
176
+ #The TSIG record will be removed from packet before passing to client, and
177
+ #the Message#tsigstate and Message#tsigerror will be set accordingly.
178
+ #Message#tsigstate will be set to one of :
179
+ #* :Failed
180
+ #* :Verified
181
+ def verify(query, response, response_bytes, buf="")
182
+ # 4.6. Client processing of answer
183
+ #
184
+ # When a client receives a response from a server and expects to see a
185
+ # TSIG, it first checks if the TSIG RR is present in the response.
186
+ # Otherwise, the response is treated as having a format error and
187
+ # discarded. The client then extracts the TSIG, adjusts the ARCOUNT,
188
+ # and calculates the keyed digest in the same way as the server. If
189
+ # the TSIG does not validate, that response MUST be discarded, unless
190
+ # the RCODE is 9 (NOTAUTH), in which case the client SHOULD attempt to
191
+ # verify the response as if it were a TSIG Error response, as specified
192
+ # in [4.3]. A message containing an unsigned TSIG record or a TSIG
193
+ # record which fails verification SHOULD not be considered an
194
+ # acceptable response; the client SHOULD log an error and continue to
195
+ # wait for a signed response until the request times out.
196
+
197
+ # So, this verify method should simply remove the TSIG RR and calculate
198
+ # the MAC (using original request MAC if required).
199
+ # Should set tsigstate on packet appropriately, and return error.
200
+ # Side effect is packet is stripped of TSIG.
201
+ # Resolver (or client) can then decide what to do...
202
+
203
+ msg_tsig_rr = response.tsig
204
+ if (!verify_common(response))
205
+ return false
206
+ end
207
+
208
+ new_msg_tsig_rr = generate(response, query, buf, response_bytes, msg_tsig_rr)
209
+
210
+ if (msg_tsig_rr.mac == new_msg_tsig_rr.mac)
211
+ response.tsigstate = :Verified
212
+ response.tsigerror = RCode.NOERROR
213
+ return true
214
+ else
215
+ response.tsigstate = :Failed
216
+ response.tsigerror = RCode.BADSIG
217
+ return false
218
+ end
219
+ end
220
+
221
+ def verify_common(response)#:nodoc: all
222
+ tsig_rr = response.tsig
223
+
224
+ if (!tsig_rr)
225
+ response.tsigerror = RCode.FORMERR
226
+ response.tsigstate = :Failed
227
+ return false
228
+ end
229
+
230
+ response.additional.delete(tsig_rr)
231
+ response.header.arcount-=1
232
+
233
+ # First, check the TSIG error in the RR
234
+ if (tsig_rr.error != RCode.NOERROR)
235
+ response.tsigstate = :Failed
236
+ response.tsigerror = tsig_rr.error
237
+ return false
238
+ end
239
+
240
+ if ((tsig_rr.name != @name) || (tsig_rr.algorithm.downcase != @algorithm.downcase))
241
+ TheLog.error("BADKEY failure")
242
+ response.tsigstate = :Failed
243
+ response.tsigerror = RCode.BADKEY
244
+ return false
245
+ end
246
+
247
+ # Check time_signed (RFC2845, 4.5.2) - only really necessary for server
248
+ if (Time.now.to_i > tsig_rr.time_signed + tsig_rr.fudge ||
249
+ Time.now.to_i < tsig_rr.time_signed - tsig_rr.fudge)
250
+ TheLog.error("TSIG failed with BADTIME")
251
+ response.tsigstate = :Failed
252
+ response.tsigerror = RCode.BADTIME
253
+ return false
254
+ end
255
+
256
+ return true
257
+ end
258
+
259
+ #Checks TSIG signatures across sessions of multiple DNS envelopes.
260
+ #This method is called each time a new envelope comes in. The envelope
261
+ #is checked - if a TSIG is present, them the stream so far is verified,
262
+ #and the response#tsigstate set to :Verified. If a TSIG is not present,
263
+ #and does not need to be present, then the message is added to the digest
264
+ #stream and the response#tsigstate is set to :Intermediate.
265
+ #If there is an error with the TSIG verification, then the response#tsigstate
266
+ #is set to :Failed.
267
+ #Like verify, this method will only be called by the Dnsruby::SingleResolver
268
+ #class. Client code need not call this method directly.
269
+ def verify_envelope(response, response_bytes)
270
+ #RFC2845 Section 4.4
271
+ #-----
272
+ #A DNS TCP session can include multiple DNS envelopes. This is, for
273
+ #example, commonly used by zone transfer. Using TSIG on such a
274
+ #connection can protect the connection from hijacking and provide data
275
+ #integrity. The TSIG MUST be included on the first and last DNS
276
+ #envelopes. It can be optionally placed on any intermediary
277
+ #envelopes. It is expensive to include it on every envelopes, but it
278
+ #MUST be placed on at least every 100'th envelope. The first envelope
279
+ #is processed as a standard answer, and subsequent messages have the
280
+ #following digest components:
281
+ #
282
+ #* Prior Digest (running)
283
+ #* DNS Messages (any unsigned messages since the last TSIG)
284
+ #* TSIG Timers (current message)
285
+ #
286
+ #This allows the client to rapidly detect when the session has been
287
+ #altered; at which point it can close the connection and retry. If a
288
+ #client TSIG verification fails, the client MUST close the connection.
289
+ #If the client does not receive TSIG records frequently enough (as
290
+ #specified above) it SHOULD assume the connection has been hijacked
291
+ #and it SHOULD close the connection. The client SHOULD treat this the
292
+ #same way as they would any other interrupted transfer (although the
293
+ #exact behavior is not specified).
294
+ #-----
295
+ #
296
+ # Each time a new envelope comes in, this method is called on the QUERY TSIG RR.
297
+ # It will set the response tsigstate to :Verified :Intermediate or :Failed
298
+ # as appropriate.
299
+
300
+ # Keep digest going of messages as they come in (and mark them intermediate)
301
+ # When TSIG comes in, work out what key should be and check. If OK, mark
302
+ # verified. Can reset digest then.
303
+ if (!@buf)
304
+ @num_envelopes = 0
305
+ @last_signed = 0
306
+ end
307
+ @num_envelopes += 1
308
+ if (!response.tsig)
309
+ if ((@num_envelopes > 1) && (@num_envelopes - @last_signed < 100))
310
+ TheLog.debug("Receiving intermediate envelope in TSIG TCP session")
311
+ response.tsigstate = :Intermediate
312
+ response.tsigerror = RCode.NOERROR
313
+ @buf = @buf + response_bytes
314
+ return
315
+ else
316
+ response.tsigstate = :Failed
317
+ TheLog.error("Expecting signed packet")
318
+ return false
319
+ end
320
+ end
321
+ @last_signed = @num_envelopes
322
+
323
+ # We have a TSIG - process it!
324
+ tsig = response.tsig
325
+ if (@num_envelopes == 1)
326
+ TheLog.debug("First response in TSIG TCP session - verifying normally")
327
+ # Process it as a standard answer
328
+ ok = verify(@query, response, response_bytes)
329
+ if (ok)
330
+ mac_bytes = MessageEncoder.new {|m|
331
+ m.put_pack('n', tsig.mac_size)
332
+ m.put_bytes(tsig.mac)
333
+ }.to_s
334
+ @buf = mac_bytes
335
+ else
336
+ end
337
+ return ok
338
+ end
339
+ TheLog.debug("Processing TSIG on TSIG TCP session")
340
+
341
+ if (!verify_common(response))
342
+ return false
343
+ end
344
+
345
+ # Now add the current message data - remember to frig the arcount
346
+ response_bytes = Header.decrement_arcount_encoded(response_bytes)
347
+ @buf += response_bytes[0, response.tsigstart]
348
+
349
+ # Let's add the timers
350
+ timers_data = MessageEncoder.new { |msg|
351
+ time_high = (tsig.time_signed >> 32)
352
+ time_low = (tsig.time_signed & 0xFFFFFFFF)
353
+ msg.put_pack('nN', time_high, time_low)
354
+ msg.put_pack('n', tsig.fudge)
355
+ }.to_s
356
+ @buf += timers_data
357
+
358
+ mac = calculate_mac(tsig.algorithm, @buf)
359
+
360
+ if (mac != tsig.mac)
361
+ TheLog.error("TSIG Verify error on TSIG TCP session")
362
+ response.tsigstate = :Failed
363
+ return false
364
+ end
365
+ mac_bytes = MessageEncoder.new {|m|
366
+ m.put_pack('n', mac.length)
367
+ m.put_bytes(mac)
368
+ }.to_s
369
+ @buf=mac_bytes
370
+
371
+ response.tsigstate = :Verified
372
+ response.tsigerror = RCode.NOERROR
373
+ return true
374
+ end
375
+
376
+
377
+ TypeValue = Types::TSIG #:nodoc: all
378
+ ClassValue = nil #:nodoc: all
379
+ ClassHash[[TypeValue, Classes::ANY]] = self #:nodoc: all
380
+
381
+ #Gets or sets the domain name that specifies the name of the algorithm.
382
+ #The only algorithms currently supported are hmac-md5 and hmac-sha1.
383
+ #
384
+ # rr.algorithm=(algorithm_name)
385
+ # print "algorithm = ", rr.algorithm, "\n"
386
+ #
387
+ attr_reader :algorithm
388
+
389
+ #Gets or sets the signing time as the number of seconds since 1 Jan 1970
390
+ #00:00:00 UTC.
391
+ #
392
+ #The default signing time is the current time.
393
+ #
394
+ # rr.time_signed=(time)
395
+ # print "time signed = ", rr.time_signed, "\n"
396
+ #
397
+ attr_accessor :time_signed
398
+
399
+ #Gets or sets the "fudge", i.e., the seconds of error permitted in the
400
+ #signing time.
401
+ #
402
+ #The default fudge is 300 seconds.
403
+ #
404
+ # rr.fudge=(60)
405
+ # print "fudge = ", rr.fudge, "\n"
406
+ #
407
+ attr_reader :fudge
408
+
409
+ #Returns the number of octets in the message authentication code (MAC).
410
+ #The programmer must call a Net::DNS::Packet object's data method
411
+ #before this will return anything meaningful.
412
+ #
413
+ # print "MAC size = ", rr.mac_size, "\n"
414
+ #
415
+ attr_accessor :mac_size
416
+
417
+ #Returns the message authentication code (MAC) as a string of hex
418
+ #characters. The programmer must call a Net::DNS::Packet object's
419
+ #data method before this will return anything meaningful.
420
+ #
421
+ # print "MAC = ", rr.mac, "\n"
422
+ #
423
+ attr_accessor :mac
424
+
425
+ #Gets or sets the original message ID.
426
+ #
427
+ # rr.original_id(12345)
428
+ # print "original ID = ", rr.original_id, "\n"
429
+ #
430
+ attr_accessor :original_id
431
+
432
+ #Returns the RCODE covering TSIG processing. Common values are
433
+ #NOERROR, BADSIG, BADKEY, and BADTIME. See RFC 2845 for details.
434
+ #
435
+ # print "error = ", rr.error, "\n"
436
+ #
437
+ attr_accessor :error
438
+
439
+ #Returns the length of the Other Data. Should be zero unless the
440
+ #error is BADTIME.
441
+ #
442
+ # print "other len = ", rr.other_size, "\n"
443
+ #
444
+ attr_accessor :other_size
445
+
446
+ #Returns the Other Data. This field should be empty unless the
447
+ #error is BADTIME, in which case it will contain the server's
448
+ #time as the number of seconds since 1 Jan 1970 00:00:00 UTC.
449
+ #
450
+ # print "other data = ", rr.other_data, "\n"
451
+ #
452
+ attr_accessor :other_data
453
+
454
+ #Stores the secret key used for signing/verifying messages.
455
+ attr_accessor :key
456
+
457
+ def init_defaults
458
+ # @TODO@ Have new() method which takes key_name and key?
459
+ @algorithm = DEFAULT_ALGORITHM
460
+ @fudge = DEFAULT_FUDGE
461
+ @mac_size = 0
462
+ @mac = ""
463
+ @original_id = rand(65536)
464
+ @error = 0
465
+ @other_size = 0
466
+ @other_data = ""
467
+ @time_signed = nil
468
+ @buf = nil
469
+
470
+ # RFC 2845 Section 2.3
471
+ @klass = "ANY"
472
+
473
+ @ttl = 0 # RFC 2845 Section 2.3
474
+ end
475
+
476
+ def from_data(data) #:nodoc: all
477
+ @algorithm, @time_signed, @fudge, @mac_size, @mac, @original_id, @error, @other_size, @other_data = data
478
+ end
479
+
480
+ def name=(n)
481
+ if (n.instance_of?String)
482
+ n = Name.create(n)
483
+ end
484
+ if (!n.absolute?)
485
+ @name = Name.create(n.to_s + ".")
486
+ else
487
+ @name = n
488
+ end
489
+ end
490
+
491
+ # Create the RR from a standard string
492
+ def from_string(str) #:nodoc: all
493
+ parts = str.split("[:/]")
494
+ if (parts.length < 2 || parts.length > 3)
495
+ raise ArgumentException.new("Invalid TSIG key specification")
496
+ end
497
+ if (parts.length == 3)
498
+ return TSIG.new(parts[0], parts[1], parts[2]);
499
+ else
500
+ return TSIG.new(HMAC_MD5, parts[0], parts[1]);
501
+ end
502
+ end
503
+
504
+ #Set the algorithm to use to generate the HMAC
505
+ #Supported values are :
506
+ #* hmac-md5
507
+ #* hmac-sha1
508
+ #* hmac-sha256
509
+ def algorithm=(alg)
510
+ if (alg.class == String)
511
+ if (alg.downcase=="hmac-md5")
512
+ @algorithm = HMAC_MD5;
513
+ elsif (alg.downcase=="hmac-sha1")
514
+ @algorithm = HMAC_SHA1;
515
+ elsif (alg.downcase=="hmac-sha256")
516
+ @algorithm = HMAC_SHA256;
517
+ else
518
+ raise ArgumentError.new("Invalid TSIG algorithm")
519
+ end
520
+ elsif (alg.class == Name)
521
+ if (alg!=HMAC_MD5 && alg!=HMAC_SHA1 && alg!=HMAC_SHA256)
522
+ raise ArgumentException.new("Invalid TSIG algorithm")
523
+ end
524
+ @algorithm=alg
525
+ else
526
+ raise ArgumentError.new("#{alg.class} not valid type for Dnsruby::RR::TSIG#algorithm= - use String or Name")
527
+ end
528
+ TheLog.debug("Using #{@algorithm.to_s} algorithm")
529
+ end
530
+
531
+ def fudge=(f)
532
+ if (f < 0 || f > 0x7FFF)
533
+ @fudge = DEFAULT_FUDGE
534
+ else
535
+ @fudge = f
536
+ end
537
+ end
538
+
539
+ def rdata_to_string
540
+ rdatastr=""
541
+ if (@algorithm!=nil)
542
+ error = @error
543
+ error = "UNDEFINED" unless error!=nil
544
+ rdatastr = "#{@original_id} #{@time_signed} #{@algorithm}. #{error}";
545
+ if (@other_size > 0 && @other_data!=nil)
546
+ rdatastr += " #{@other_data}"
547
+ end
548
+ rdatastr += " " + mac.unpack("H*").to_s
549
+ end
550
+
551
+ return rdatastr
552
+ end
553
+
554
+ def encode_rdata(msg, canonical=false) #:nodoc: all
555
+ # Name needs to be added with no compression - done in Dnsruby::Message#encode
556
+ msg.put_name(@algorithm.downcase, true)
557
+ time_high = (@time_signed >> 32)
558
+ time_low = (@time_signed & 0xFFFFFFFF)
559
+ msg.put_pack('nN', time_high, time_low)
560
+ msg.put_pack('n', @fudge)
561
+ msg.put_pack('n', @mac_size)
562
+ msg.put_bytes(@mac)
563
+ msg.put_pack('n', @original_id)
564
+ msg.put_pack('n', @error)
565
+ msg.put_pack('n', @other_size)
566
+ msg.put_bytes(@other_data)
567
+ end
568
+
569
+ def self.decode_rdata(msg) #:nodoc: all
570
+ alg=msg.get_name
571
+ time_high, time_low = msg.get_unpack("nN")
572
+ time_signed = (time_high << 32) + time_low
573
+ fudge, = msg.get_unpack("n")
574
+ mac_size, = msg.get_unpack("n")
575
+ mac = msg.get_bytes(mac_size)
576
+ original_id, = msg.get_unpack("n")
577
+ error, = msg.get_unpack("n")
578
+ other_size, = msg.get_unpack("n")
579
+ other_data = msg.get_bytes(other_size)
580
+ return self.new([alg, time_signed, fudge, mac_size, mac, original_id, error, other_size, other_data])
581
+ end
582
+ end
583
+ end
584
+ end