zcompress.go 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. // Code generated by "go run compress_generate.go"; DO NOT EDIT.
  2. package dns
  3. func compressionLenHelperType(c map[string]int, r RR, initLen int) int {
  4. currentLen := initLen
  5. switch x := r.(type) {
  6. case *AFSDB:
  7. currentLen -= len(x.Hostname) + 1
  8. currentLen += compressionLenHelper(c, x.Hostname, currentLen)
  9. case *CNAME:
  10. currentLen -= len(x.Target) + 1
  11. currentLen += compressionLenHelper(c, x.Target, currentLen)
  12. case *DNAME:
  13. currentLen -= len(x.Target) + 1
  14. currentLen += compressionLenHelper(c, x.Target, currentLen)
  15. case *HIP:
  16. for i := range x.RendezvousServers {
  17. currentLen -= len(x.RendezvousServers[i]) + 1
  18. }
  19. for i := range x.RendezvousServers {
  20. currentLen += compressionLenHelper(c, x.RendezvousServers[i], currentLen)
  21. }
  22. case *KX:
  23. currentLen -= len(x.Exchanger) + 1
  24. currentLen += compressionLenHelper(c, x.Exchanger, currentLen)
  25. case *LP:
  26. currentLen -= len(x.Fqdn) + 1
  27. currentLen += compressionLenHelper(c, x.Fqdn, currentLen)
  28. case *MB:
  29. currentLen -= len(x.Mb) + 1
  30. currentLen += compressionLenHelper(c, x.Mb, currentLen)
  31. case *MD:
  32. currentLen -= len(x.Md) + 1
  33. currentLen += compressionLenHelper(c, x.Md, currentLen)
  34. case *MF:
  35. currentLen -= len(x.Mf) + 1
  36. currentLen += compressionLenHelper(c, x.Mf, currentLen)
  37. case *MG:
  38. currentLen -= len(x.Mg) + 1
  39. currentLen += compressionLenHelper(c, x.Mg, currentLen)
  40. case *MINFO:
  41. currentLen -= len(x.Rmail) + 1
  42. currentLen += compressionLenHelper(c, x.Rmail, currentLen)
  43. currentLen -= len(x.Email) + 1
  44. currentLen += compressionLenHelper(c, x.Email, currentLen)
  45. case *MR:
  46. currentLen -= len(x.Mr) + 1
  47. currentLen += compressionLenHelper(c, x.Mr, currentLen)
  48. case *MX:
  49. currentLen -= len(x.Mx) + 1
  50. currentLen += compressionLenHelper(c, x.Mx, currentLen)
  51. case *NAPTR:
  52. currentLen -= len(x.Replacement) + 1
  53. currentLen += compressionLenHelper(c, x.Replacement, currentLen)
  54. case *NS:
  55. currentLen -= len(x.Ns) + 1
  56. currentLen += compressionLenHelper(c, x.Ns, currentLen)
  57. case *NSAPPTR:
  58. currentLen -= len(x.Ptr) + 1
  59. currentLen += compressionLenHelper(c, x.Ptr, currentLen)
  60. case *NSEC:
  61. currentLen -= len(x.NextDomain) + 1
  62. currentLen += compressionLenHelper(c, x.NextDomain, currentLen)
  63. case *PTR:
  64. currentLen -= len(x.Ptr) + 1
  65. currentLen += compressionLenHelper(c, x.Ptr, currentLen)
  66. case *PX:
  67. currentLen -= len(x.Map822) + 1
  68. currentLen += compressionLenHelper(c, x.Map822, currentLen)
  69. currentLen -= len(x.Mapx400) + 1
  70. currentLen += compressionLenHelper(c, x.Mapx400, currentLen)
  71. case *RP:
  72. currentLen -= len(x.Mbox) + 1
  73. currentLen += compressionLenHelper(c, x.Mbox, currentLen)
  74. currentLen -= len(x.Txt) + 1
  75. currentLen += compressionLenHelper(c, x.Txt, currentLen)
  76. case *RRSIG:
  77. currentLen -= len(x.SignerName) + 1
  78. currentLen += compressionLenHelper(c, x.SignerName, currentLen)
  79. case *RT:
  80. currentLen -= len(x.Host) + 1
  81. currentLen += compressionLenHelper(c, x.Host, currentLen)
  82. case *SIG:
  83. currentLen -= len(x.SignerName) + 1
  84. currentLen += compressionLenHelper(c, x.SignerName, currentLen)
  85. case *SOA:
  86. currentLen -= len(x.Ns) + 1
  87. currentLen += compressionLenHelper(c, x.Ns, currentLen)
  88. currentLen -= len(x.Mbox) + 1
  89. currentLen += compressionLenHelper(c, x.Mbox, currentLen)
  90. case *SRV:
  91. currentLen -= len(x.Target) + 1
  92. currentLen += compressionLenHelper(c, x.Target, currentLen)
  93. case *TALINK:
  94. currentLen -= len(x.PreviousName) + 1
  95. currentLen += compressionLenHelper(c, x.PreviousName, currentLen)
  96. currentLen -= len(x.NextName) + 1
  97. currentLen += compressionLenHelper(c, x.NextName, currentLen)
  98. case *TKEY:
  99. currentLen -= len(x.Algorithm) + 1
  100. currentLen += compressionLenHelper(c, x.Algorithm, currentLen)
  101. case *TSIG:
  102. currentLen -= len(x.Algorithm) + 1
  103. currentLen += compressionLenHelper(c, x.Algorithm, currentLen)
  104. }
  105. return currentLen - initLen
  106. }
  107. func compressionLenSearchType(c map[string]int, r RR) (int, bool, int) {
  108. switch x := r.(type) {
  109. case *AFSDB:
  110. k1, ok1, sz1 := compressionLenSearch(c, x.Hostname)
  111. return k1, ok1, sz1
  112. case *CNAME:
  113. k1, ok1, sz1 := compressionLenSearch(c, x.Target)
  114. return k1, ok1, sz1
  115. case *MB:
  116. k1, ok1, sz1 := compressionLenSearch(c, x.Mb)
  117. return k1, ok1, sz1
  118. case *MD:
  119. k1, ok1, sz1 := compressionLenSearch(c, x.Md)
  120. return k1, ok1, sz1
  121. case *MF:
  122. k1, ok1, sz1 := compressionLenSearch(c, x.Mf)
  123. return k1, ok1, sz1
  124. case *MG:
  125. k1, ok1, sz1 := compressionLenSearch(c, x.Mg)
  126. return k1, ok1, sz1
  127. case *MINFO:
  128. k1, ok1, sz1 := compressionLenSearch(c, x.Rmail)
  129. k2, ok2, sz2 := compressionLenSearch(c, x.Email)
  130. return k1 + k2, ok1 && ok2, sz1 + sz2
  131. case *MR:
  132. k1, ok1, sz1 := compressionLenSearch(c, x.Mr)
  133. return k1, ok1, sz1
  134. case *MX:
  135. k1, ok1, sz1 := compressionLenSearch(c, x.Mx)
  136. return k1, ok1, sz1
  137. case *NS:
  138. k1, ok1, sz1 := compressionLenSearch(c, x.Ns)
  139. return k1, ok1, sz1
  140. case *PTR:
  141. k1, ok1, sz1 := compressionLenSearch(c, x.Ptr)
  142. return k1, ok1, sz1
  143. case *RT:
  144. k1, ok1, sz1 := compressionLenSearch(c, x.Host)
  145. return k1, ok1, sz1
  146. case *SOA:
  147. k1, ok1, sz1 := compressionLenSearch(c, x.Ns)
  148. k2, ok2, sz2 := compressionLenSearch(c, x.Mbox)
  149. return k1 + k2, ok1 && ok2, sz1 + sz2
  150. }
  151. return 0, false, 0
  152. }