blob: a100f4c3fe38cdfc3c63eb90b43267dc8f2fbe43 [file] [log] [blame]
/******************************************************************************
* Copyright (c) 2000-2019 Ericsson Telecom AB AB
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
*
* Contributors:
* Mate Kovacs - initial implementation and initial documentation
* Antal Wu-Hen Chang
* Naum Spaseski
******************************************************************************/
//
// File: CoAP_Types.ttcn
// Rev: R1A
// Prodnr: CNL 113 829
module CoAP_Types
{
external function f_CoAP_enc(in CoAP_Message msg, out octetstring str) return integer;
external function f_CoAP_dec(in octetstring str, out CoAP_Message msg) return integer;
const Code EMPTY_MESSAGE:={ 0, 0 };
const Code METHOD_GET:={ 0, 1 };
const Code METHOD_POST:={ 0, 2 };
const Code METHOD_PUT:={ 0, 3 };
const Code METHOD_DELETE:={ 0, 4 };
const Code RESPONSE_CODE_Created:={ 2, 1 };
const Code RESPONSE_CODE_Deleted:={ 2, 2 };
const Code RESPONSE_CODE_Valid:={ 2, 3 };
const Code RESPONSE_CODE_Changed:={ 2, 4 };
const Code RESPONSE_CODE_Content:={ 2, 5 };
const Code RESPONSE_CODE_BadRequest:={ 4, 0 };
const Code RESPONSE_CODE_Unauthorized:={ 4, 1 };
const Code RESPONSE_CODE_BadOption:={ 4, 2 };
const Code RESPONSE_CODE_Forbidden:={ 4, 3 };
const Code RESPONSE_CODE_NotFound:={ 4, 4 };
const Code RESPONSE_CODE_MethodNotAllowed:={ 4, 5 };
const Code RESPONSE_CODE_NotAcceptable:={ 4, 6 };
const Code RESPONSE_CODE_PreconditionFailed:={ 4, 12 };
const Code RESPONSE_CODE_RequestEntityTooLarge:={ 4, 13 };
const Code RESPONSE_CODE_UnsupportedContentFormat:={ 4, 15 };
const Code RESPONSE_CODE_InternalServerError:={ 5, 0 };
const Code RESPONSE_CODE_NotImplemented:={ 5, 1 };
const Code RESPONSE_CODE_BadGateway:={ 5, 2 };
const Code RESPONSE_CODE_ServiceUnavailable:={ 5, 3 };
const Code RESPONSE_CODE_GatewayTimeout:={ 5, 4 };
const Code RESPONSE_CODE_ProxyingNotSupported:={ 5, 5 };
type octetstring OCT0 length (0);
type octetstring OCT0_8 length(0..8);
type octetstring OCT1_8 length(1..8);
type universal charstring UCHAR0_255 length(0..255);
type universal charstring UCHAR1_255 length(1..255);
type universal charstring UCHAR1_1034 length(1..1034);
type enumerated Type
{
CONFIRMABLE(0),
NON_CONFIRMABLE(1),
ACKNOWLEDGEMENT(2),
RESET(3)
}
type record Code
{
integer class (0..7),
integer detail (0..31)
}
type record Header
{
integer version (0..3),
Type msg_type,
Code code,
integer message_id
}
type record UnknownOption
{
integer option_code,
octetstring option_value
}
type record BlockOption
{
integer num (0..1048575),
boolean m,
integer szx (0..7)
}
type union CoAP_Options
{
OCT0_8 if_match,
UCHAR1_255 uri_host,
OCT1_8 etag,
OCT0 if_none_match,
integer observe,
integer uri_port,
UCHAR0_255 location_path,
UCHAR0_255 uri_path,
integer content_format,
integer max_age,
UCHAR0_255 uri_query,
integer accept,
UCHAR0_255 location_query,
BlockOption block1,
BlockOption block2,
UCHAR1_1034 proxy_uri,
UCHAR1_255 proxy_scheme,
integer size1,
UnknownOption unknown_option
}
// FIXME: EANTWUH: Option order is not strict: record -> set
type set of CoAP_Options CoAP_OptionsList;
type record CoAP_ReqResp
{
Header header,
OCT0_8 token,
CoAP_OptionsList options optional,
octetstring payload length(1..infinity) optional
}
type union CoAP_Message
{
CoAP_ReqResp msg,
octetstring raw_message
}
}