No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

DNSLabel-class.R 730B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. R6Class(
  2. classname = "DNSLabel",
  3. public = list(
  4. label = NULL,
  5. initialize = function(label) {
  6. if (inherits(label, "DNSLabel")) {
  7. self$label <- label$label
  8. } else if (length(label) > 1) {
  9. self$label <- as.character(label)
  10. } else if (is.character(label)) {
  11. label <- sub("\\.$", "", label)
  12. self$label <- unlist(strsplit(label, "\\."), use.names = FALSE)
  13. }
  14. },
  15. encode = function() {
  16. sz <- nchar(self$label)
  17. out <- raw()
  18. for (i in seq_along(self$label)) {
  19. out <- c(out, as.raw(sz[[i]]), charToRaw(self$label[[i]]))
  20. }
  21. c(out, as.raw(0x00))
  22. },
  23. parse = function(buf, buf_pos) {
  24. }
  25. )
  26. ) -> DNSLabel