WIP: Add description of TS 48.064 LLC frames in TITAN TTCN-3

This commit is contained in:
Harald Welte 2017-07-23 21:03:02 +02:00
parent 13d391ea87
commit e38fd7b4ce
1 changed files with 132 additions and 0 deletions

132
gprs_gb/LLC_Types.ttcn Normal file
View File

@ -0,0 +1,132 @@
module LLC_Types {
import from General_Types all;
import from Osmocom_Types all;
/* TS 44.064 Chapter 6.2 */
type record LlcAddressField {
boolean pd,
boolean c_r,
BIT2 reserved,
LlcSapi sapi
} with {
variant (pd) "FIELDLENGTH(1)"
variant (c_r) "FIELDLENGTH(1)"
};
type enumerated LlcSapi {
LLC_SAPI_RESERVED_0 ('0000'B),
LLC_SAPI_GMM ('0001'B),
LLC_SAPI_TOM2 ('0010'B),
LLC_SAPI_LL3 ('0011'B),
LLC_SAPI_RESERVED_4 ('0100'B),
LLC_SAPI_LL5 ('0101'B),
LLC_SAPI_RESERVED_6 ('0110'B),
LLC_SAPI_SMS ('0111'B),
LLC_SAPI_TOM8 ('1000'B),
LLC_SAPI_LL9 ('1001'B),
LLC_SAPI_RESERVED_10 ('1010'B),
LLC_SAPI_LL11 ('1011'B),
LLC_SAPI_RESERVED_12 ('1100'B),
LLC_SAPI_RESERVED_13 ('1101'B),
LLC_SAPI_RESERVED_14 ('1110'B),
LLC_SAPI_RESERVED_15 ('1111'B)
} with { variant "FIELDLENGTH(4)" };
/* TS 44.064 Chapter 6.3 */
type record LlcCtrlFieldI {
BIT1 presence ('0'B),
boolean a,
BIT1 spare,
uint9_t n_s,
BIT1 spare2,
uint9_t n_r,
LlcCtrlS s
} with { variant
(a) "FIELDLENGTH(1)"
};
/* TS 44.064 Chapter 6.3 */
type record LlcCtrlFieldS {
BIT2 presence ('10'B),
boolean a,
BIT2 spare,
uint9_t n_r,
LlcCtrlS s
} with {
variant (a) "FIELDLENGTH(1)"
};
/* TS 44.064 Chapter 6.3 */
type record LlcCtrlFieldUI {
BIT3 presence ('110'B),
BIT2 spare,
uint9_t n_u,
boolean e,
boolean pm
} with {
variant (e) "FIELDLENGTH(1)"
variant (pm) "FIELDLENGTH(1)"
};
/* TS 44.064 Chapter 6.3 */
type record LlcCtrlFieldU {
BIT3 presence ('111'B),
boolean p_f,
LlcCtrlM m
} with {
variant (p_f) "FIELDLENGTH(1)"
};
/* TS 44.064 Chapter 6.4 */
type enumerated LlcCtrlS {
LLC_S_RR ('00'B),
LLC_S_ACK ('01'B),
LLC_S_RNR ('10'B),
LLC_S_SACK ('11'B)
} with { variant "FIELDLENGTH(2)" };
/* TS 44.064 Chapter 6.4 */
type enumerated LlcCtrlM {
LLC_M_DM ('0001'B),
LLC_M_DISC ('0100'B),
LLC_M_UA ('0110'B),
LLC_M_SABM ('0111'B),
LLC_M_FRMR ('1000'B),
LLC_M_XID ('1011'B),
LLC_M_NULL ('0000'B)
} with { variant "FIELDLENGTH(4)" };
type union LlcCtrlUnion {
LlcCtrlFieldI i,
LlcCtrlFieldS s,
LlcCtrlFieldUI ui,
LlcCtrlFieldU u
} with { variant "TAG(i, presence = '0'B;
s, presence = '10'B;
ui, presence = '110'B;
u, presence = '111'B)"
variant "FIELDORDER(msb)"
};
external function enc_LlcCtrlUnion(in LlcCtrlUnion pdu) return octetstring
with { extension "prototype(convert) encode(RAW)" };
external function dec_LlcCtrlUnion(in octetstring stream) return LlcCtrlUnion
with { extension "prototype(convert) decode(RAW)" };
type uint24_t LlcFcs;
type record LlcPdu {
LlcAddressField addr,
LlcCtrlUnion ctrl,
octetstring payload,
LlcFcs fcs
} with { variant "" };
external function enc_LlcPdu(in LlcPdu pdu) return octetstring
with { extension "prototype(convert) encode(RAW)" };
external function dec_LlcPdu(in octetstring stream) return LlcPdu
with { extension "prototype(convert) decode(RAW)" };
} with { encode "RAW"; variant "FIELDORDER(msb)" }