Skip to content

Commit

Permalink
Bug fix---fix how RAINS tagged data works.
Browse files Browse the repository at this point in the history
Changed RAINS support to better reflect how it's supposed to be used.
  • Loading branch information
spc476 committed Oct 5, 2016
1 parent 69b1550 commit d60fe1f
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 10 deletions.
5 changes: 5 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@

1.2.0 2016-10-04

* Changed RAINS support to better reflect how it's supposed to be
used.

1.1.2 2016-10-04

* Update CHANGES file.
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ LIBDIR=$(LUA_DIR)/lib/lua/$(shell lua -e "print(_VERSION:match '^Lua (.*)')")
LUADIR=$(LUA_DIR)/share/lua/$(shell lua -e "print(_VERSION:match '^Lua (.*)')")

ifeq ($(VERSION),)
VERSION=1.1.2
VERSION=1.2.0
endif

# ===================================================
Expand Down
9 changes: 5 additions & 4 deletions cbor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1122,12 +1122,13 @@ TAG = setmetatable(

-- =====================================================================

_rains = function()
return cbor_c.encode(0xC0,15309736)
_rains = function(value,sref,stref)
return cbor_c.encode(0xC0,15309736) .. TYPE.MAP(value,sref,stref)
end,

[15309736] = function(_,pos)
return '_rains',pos,'_rains'
[15309736] = function(packet,pos,conv,ref)
local value,npos = decode(packet,pos,conv,ref)
return value,npos,'_rains'
end,
},
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package = "org.conman.cbor"
version = "1.1.2-1"
version = "1.2.0-1"

source =
{
url = "git://github.com/spc476/CBOR.git",
tag = "1.1.2"
tag = "1.2.0"
}

description =
Expand Down
26 changes: 23 additions & 3 deletions test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -627,10 +627,30 @@ test('ARRAY',
return cbor.encode(array,{},{})
end)

local hoade2 = { first = "Sean" , last = "Hoade" , occupation = "writer" }
local hoade2 = { first = "Sean" , last = "Hoade" , occupation = "writer" }
local conner2 = { first = "Sean" , last = "Conner" , occupation = "programmer" }
local array2 = { hoade2 , hoade2 , hoade2 , conner2 , conner2 , conner2 }
rtst('ARRAY',array2,nil,{},{})

test('_rains',"DA00E99BA8","_rains",
function() return cbor.TAG._rains() end)
-- *********************************************************************
-- Read https://britram.github.io/rains-prototype/#cbor-object for
-- context for this test.
-- *********************************************************************

local q =
{
[0] = -- content key
{
{
4 , -- query type
{
[5] = "www.conman.org.", -- query name
[13] = { "." }, -- query context
[14] = { 1 , 2 , 3 } , -- query types
}
}
}
}

test('_rains',"DA00E99BA8A100818204A3056F7777772E636F6E6D616E2E6F72672E0D81612E0E83010203"
,q,function() return cbor.TAG._rains(q) end)

0 comments on commit d60fe1f

Please sign in to comment.