Harald Welte has uploaded this change for review. ( 
https://gerrit.osmocom.org/13757


Change subject: LLC_Templates: Add SABM, UA, FRMR, DM templates
......................................................................

LLC_Templates: Add SABM, UA, FRMR, DM templates

Change-Id: Idb40dcd53310b76ea9df6c0090e31175a4382460
---
M library/LLC_Templates.ttcn
1 file changed, 59 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/57/13757/1

diff --git a/library/LLC_Templates.ttcn b/library/LLC_Templates.ttcn
index 086207c..1ea238e 100644
--- a/library/LLC_Templates.ttcn
+++ b/library/LLC_Templates.ttcn
@@ -10,6 +10,14 @@
        cR := cr,
        pD := '0'B
 }
+template (value) Address_field ts_LLC_Addr(template (value) BIT4 sapi,
+                                          template (value) BIT1 cr,
+                                          template (value) BIT1 pd := '0'B) := 
{
+       sAPI := sapi,
+       spare := '00'B,
+       cR := cr,
+       pD := '0'B
+}

 template (value) Control_field_UI ts_LLC_CtrlUI(uint9_t n_u, boolean encrypted 
:= false,
                                        boolean protected := false) := {
@@ -20,7 +28,7 @@
        pM := bool2bit(protected)
 }

-template (value) Control_field_U ts_LLC_CtrlU(BIT4 m_bits, BIT1 p_f) := {
+template (value) Control_field_U ts_LLC_CtrlU(template (value) BIT4 m_bits, 
template (value) BIT1 p_f) := {
        mBits := m_bits,
        pF := p_f,
        format := '111'B
@@ -47,7 +55,7 @@
 template PDU_LLC ts_LLC_UI(octetstring payload, BIT4 sapi, BIT1 cr, uint9_t 
n_u,
                           boolean encrypted := false, boolean protected := 
false) := {
        pDU_LLC_UI := {
-               address_field := t_LLC_Addr(sapi, cr),
+               address_field := ts_LLC_Addr(sapi, cr),
                control_field := ts_LLC_CtrlUI(n_u, encrypted, protected),
                information_field_UI := payload,
                fCS := omit /* causes encoder to generate FCS */
@@ -77,6 +85,55 @@
        }
 }

+template PDU_LLC tr_LLC_U(template BIT4 m_bits, template BIT1 p_f, template 
Information_field_U u,
+                         template BIT4 sapi, template BIT1 cr) := {
+       pDU_LLC_U := {
+               address_field := t_LLC_Addr(sapi, cr),
+               control_field := tr_LLC_CtrlU(m_bits, p_f),
+               information_field_U := u,
+               fCS := omit /* causes encoder to generate FCS */
+       }
+}
+template (value) PDU_LLC ts_LLC_U(template (value) BIT4 m_bits, template 
(value) BIT1 p_f,
+                                 template (value) Information_field_U u,
+                                 template (value) BIT4 sapi, template (value) 
BIT1 cr) := {
+       pDU_LLC_U := {
+               address_field := ts_LLC_Addr(sapi, cr),
+               control_field := ts_LLC_CtrlU(m_bits, p_f),
+               information_field_U := u,
+               fCS := omit /* causes encoder to generate FCS */
+       }
+}
+
+template PDU_LLC tr_LLC_SABM(template SABM_Information sabm_xid, template BIT1 
p_f,
+                            template BIT4 sapi, template BIT1 cr) :=
+       tr_LLC_U('0111'B, p_f, Information_field_U:{sABM := sabm_xid}, sapi, 
cr);
+template (value) PDU_LLC ts_LLC_SABM(template (value) SABM_Information 
sabm_xid,
+                                    template (value) BIT1 p_f,
+                                    template (value) BIT4 sapi, template 
(value) BIT1 cr) :=
+       ts_LLC_U('0111'B, p_f, Information_field_U:{sABM := sabm_xid}, sapi, 
cr);
+
+template PDU_LLC tr_LLC_UA(template UA_Information ua_xid, template BIT1 p_f,
+                          template BIT4 sapi, template BIT1 cr) :=
+       tr_LLC_U('0110'B, p_f, Information_field_U:{uA := ua_xid}, sapi, cr);
+template (value) PDU_LLC ts_LLC_UA(template (value) UA_Information ua_xid,
+                                  template (value) BIT1 p_f,
+                                  template (value) BIT4 sapi, template (value) 
BIT1 cr) :=
+       ts_LLC_U('0110'B, p_f, Information_field_U:{uA := ua_xid}, sapi, cr);
+
+template PDU_LLC tr_LLC_FRMR(template FRMR_Information frmr, template BIT1 p_f,
+                            template BIT4 sapi, template BIT1 cr) :=
+       tr_LLC_U('1000'B, p_f, Information_field_U:{fRMR := frmr}, sapi, cr);
+template (value) PDU_LLC ts_LLC_FRMR(template (value) FRMR_Information frmr,
+                                    template (value) BIT1 p_f,
+                                    template (value) BIT4 sapi, template 
(value) BIT1 cr) :=
+       ts_LLC_U('1000'B, p_f, Information_field_U:{fRMR := frmr}, sapi, cr);
+
+template PDU_LLC tr_LLC_DM(template BIT1 p_f, template BIT4 sapi, template 
BIT1 cr) :=
+       tr_LLC_U('1000'B, p_f, Information_field_U:{dM := ''O}, sapi, cr);
+template (value) PDU_LLC ts_LLC_DM(template (value) BIT1 p_f, template (value) 
BIT4 sapi,
+                                  template (value) BIT1 cr) :=
+       ts_LLC_U('1000'B, p_f, Information_field_U:{dM := ''O}, sapi, cr);

 const BIT4 c_LLC_SAPI_LLGMM := '0001'B;
 const BIT4 c_LLC_SAPI_TOM2 := '0010'B;

--
To view, visit https://gerrit.osmocom.org/13757
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Idb40dcd53310b76ea9df6c0090e31175a4382460
Gerrit-Change-Number: 13757
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte <[email protected]>

Reply via email to