Non puoi selezionare più di 25 argomenti
Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
43 righe
730 B
43 righe
730 B
R6Class(
|
|
|
|
classname = "DNSLabel",
|
|
|
|
public = list(
|
|
|
|
label = NULL,
|
|
|
|
initialize = function(label) {
|
|
|
|
if (inherits(label, "DNSLabel")) {
|
|
|
|
self$label <- label$label
|
|
|
|
} else if (length(label) > 1) {
|
|
|
|
self$label <- as.character(label)
|
|
|
|
} else if (is.character(label)) {
|
|
label <- sub("\\.$", "", label)
|
|
self$label <- unlist(strsplit(label, "\\."), use.names = FALSE)
|
|
}
|
|
|
|
},
|
|
|
|
encode = function() {
|
|
|
|
sz <- nchar(self$label)
|
|
out <- raw()
|
|
for (i in seq_along(self$label)) {
|
|
out <- c(out, as.raw(sz[[i]]), charToRaw(self$label[[i]]))
|
|
}
|
|
c(out, as.raw(0x00))
|
|
|
|
},
|
|
|
|
parse = function(buf, buf_pos) {
|
|
|
|
}
|
|
|
|
)
|
|
|
|
) -> DNSLabel
|
|
|