blob: e387b36cf37339a14379e9ac38e123f82a3e1695 [file] [log] [blame]
Harald Welte5ac31492018-02-15 20:39:13 +01001module LLC_Templates {
2
3import from LLC_Types all;
4import from Osmocom_Types all;
5import from General_Types all;
6
7template Address_field t_LLC_Addr(template BIT4 sapi, template BIT1 cr, template BIT1 pd := '0'B) := {
8 sAPI := sapi,
9 spare := '00'B,
10 cR := cr,
11 pD := '0'B
12}
13
14template (value) Control_field_UI ts_LLC_CtrlUI(uint9_t n_u, boolean encrypted := false,
15 boolean protected := false) := {
16 format := '110'B,
17 spare := '00'B,
18 nU := n_u,
19 e := bool2bit(encrypted),
20 pM := bool2bit(protected)
21}
22
23template Control_field_UI tr_LLC_CtrlUI(template uint9_t n_u,
24 template boolean encrypted := ?,
25 template boolean protected := ?) := {
26 format := '110'B,
27 spare := '00'B,
28 nU := n_u,
29 e := bool2bit_tmpl(encrypted),
30 pM := bool2bit_tmpl(protected)
31}
32
33template PDU_LLC ts_LLC_UI(octetstring payload, BIT4 sapi, BIT1 cr, uint9_t n_u,
34 boolean encrypted := false, boolean protected := false) := {
35 pDU_LLC_UI := {
36 address_field := t_LLC_Addr(sapi, cr),
37 control_field := ts_LLC_CtrlUI(n_u, encrypted, protected),
38 information_field_UI := payload,
39 fCS := omit /* causes encoder to generate FCS */
40 }
41}
42
43template PDU_LLC tr_LLC_UI(template octetstring payload := ?, template BIT4 sapi := ?,
44 template BIT1 cr := ?, template uint9_t n_u := ?,
45 template boolean encrypted := ?, template boolean protected := ?) := {
46 pDU_LLC_UI := {
47 address_field := t_LLC_Addr(sapi, cr),
48 control_field := tr_LLC_CtrlUI(n_u, encrypted, protected),
49 information_field_UI := payload,
50 fCS := '000000'O /* provided by decoder if FCS OK */
51 }
52}
53
54const BIT4 c_LLC_SAPI_LLGMM := '0001'B;
55const BIT4 c_LLC_SAPI_TOM2 := '0010'B;
56const BIT4 c_LLC_SAPI_LL3 := '0011'B;
57const BIT4 c_LLC_SAPI_LL5 := '0101'B;
58const BIT4 c_LLC_SAPI_LLSMS := '0111'B;
59const BIT4 c_LLC_SAPI_TOM8 := '1000'B;
60const BIT4 c_LLC_SAPI_LL9 := '1001'B;
61const BIT4 c_LLC_SAPI_LLSM := '1010'B;
62const BIT4 c_LLC_SAPI_LL11 := '1011'B;
63
64const BIT1 LLC_CR_DL_CMD := '1'B;
65const BIT1 LLC_CR_DL_RSP := '0'B;
66const BIT1 LLC_CR_UL_CMD := '0'B;
67const BIT1 LLC_CR_UL_RSP := '1'B;
68
69/* LLC UI frame with SAPI for L3 payload */
70template PDU_LLC tr_LLC_UI_L3 := ( tr_LLC_UI(?, c_LLC_SAPI_LLGMM), tr_LLC_UI(?, c_LLC_SAPI_LLSM) );
71
72
73}