blob: 869796fb56a644752b984d2738ca6fc1b5ee937a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
--
-- ~~~ response record utils
--
require("src/utils")
-- setup pawsd
local pawsd = {}
pawsd.tag = require("src/pawsd/tag")
-- get number of tags
function getrecordtagnumber(response, offset)
return tonumber(table.extracthex(response, offset, offset + 1), 16)
end
-- get all record information
function getrecord(response, offset)
local tagcount = getrecordtagnumber(response, offset)
local tagoffset = offset + 2
local tags = {}
for tagindex = 1, tagcount, 1 do
local tag = pawsd.tag.get(response, tagoffset)
tags[tagindex] = tag.tag
tagoffset = tag.endoffset
end
return {
tags = tags,
endoffset = tagoffset
}
end
-- return
return {
get = getrecord
}
|