mirror of https://github.com/deavmi/doap
Merge branch 'master' into feature/options_full
This commit is contained in:
commit
6adf185073
|
@ -31,6 +31,24 @@ public struct CoapOption
|
|||
// TODO: remove this
|
||||
import std.stdio : writeln;
|
||||
|
||||
|
||||
private enum OptionLenType
|
||||
{
|
||||
ZERO_TO_TWELVE,
|
||||
_8BIT_EXTENDED,
|
||||
_12_BIT_EXTENDED,
|
||||
UPPER_PAYLOAD_MARKER
|
||||
}
|
||||
|
||||
private enum OptionDeltaType
|
||||
{
|
||||
ZERO_TO_TWELVE,
|
||||
_8BIT_EXTENDED,
|
||||
_12_BIT_EXTENDED,
|
||||
UPPER_PAYLOAD_MARKER
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Represents a CoAP packet
|
||||
*/
|
||||
|
@ -669,14 +687,14 @@ public class CoapPacket
|
|||
return packet;
|
||||
}
|
||||
|
||||
private enum OptionLenType
|
||||
{
|
||||
ZERO_TO_TWELVE,
|
||||
_8BIT_EXTENDED,
|
||||
_12_BIT_EXTENDED,
|
||||
UPPER_PAYLOAD_MARKER
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the option length encoding
|
||||
* type from the header
|
||||
*
|
||||
* Params:
|
||||
* hdr = the header
|
||||
* Returns: the `OptionLenType`
|
||||
*/
|
||||
private static OptionLenType getOptionLenType(ubyte hdr)
|
||||
{
|
||||
ubyte type = (hdr&15);
|
||||
|
@ -692,16 +710,10 @@ public class CoapPacket
|
|||
{
|
||||
return OptionLenType._12_BIT_EXTENDED;
|
||||
}
|
||||
else if(type == 15)
|
||||
else
|
||||
{
|
||||
return OptionLenType.UPPER_PAYLOAD_MARKER;
|
||||
}
|
||||
else
|
||||
{
|
||||
writeln("GetOptionLenType(): Major error if this happens");
|
||||
assert(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue