166 lines
4.0 KiB
Plaintext
166 lines
4.0 KiB
Plaintext
module LLC_Types {
|
|
import from General_Types all;
|
|
import from Osmocom_Types all;
|
|
|
|
/* TS 44.064 Chapter 6.2 */
|
|
type record LlcAddressField {
|
|
BIT1 pd ('0'B),
|
|
boolean c_r,
|
|
BIT2 reserved,
|
|
LlcSapi sapi
|
|
} with {
|
|
variant (c_r) "FIELDLENGTH(1)"
|
|
};
|
|
|
|
template LlcAddressField t_LLC_Addr(template boolean c_r, template LlcSapi sapi) := {
|
|
pd := '0'B,
|
|
c_r := c_r,
|
|
reserved := '00'B,
|
|
sapi := sapi
|
|
};
|
|
|
|
const boolean LLC_CR_DL_CMD := true;
|
|
const boolean LLC_CR_DL_RSP := false;
|
|
const boolean LLC_CR_UL_CMD := false;
|
|
const boolean LLC_CR_UL_RSP := true;
|
|
|
|
template LlcAddressField t_LLC_Addr_DlCmd(template LlcSapi sapi) := t_LLC_Addr(true, sapi);
|
|
template LlcAddressField t_LLC_Addr_DlRsp(template LlcSapi sapi) := t_LLC_Addr(false, sapi);
|
|
template LlcAddressField t_LLC_Addr_UlCmd(template LlcSapi sapi) := t_LLC_Addr(false, sapi);
|
|
template LlcAddressField t_LLC_Addr_UlRsp(template LlcSapi sapi) := t_LLC_Addr(true, sapi);
|
|
|
|
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)"
|
|
};
|
|
|
|
template LlcCtrlFieldUI t_LlcCtrlUI(template uint8_t n_u) := {
|
|
presence := '110'B,
|
|
spare := '00'B,
|
|
n_u := n_u,
|
|
e := false,
|
|
pm := true
|
|
};
|
|
|
|
/* 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)" };
|
|
|
|
|
|
template LlcPdu t_LLC_UI(template boolean c_r, template uint8_t n_u, template octetstring payload,
|
|
template LlcSapi sapi := LLC_SAPI_GMM) := {
|
|
addr := t_LLC_Addr(c_r, sapi),
|
|
ctrl := {
|
|
ui := t_LlcCtrlUI(n_u)
|
|
},
|
|
payload := payload
|
|
};
|
|
} with { encode "RAW"; variant "FIELDORDER(msb)" }
|