BSSGP: Add various templates for common messages

This commit is contained in:
Harald Welte 2017-07-23 16:18:46 +02:00
parent 039f6955d8
commit 1067fbd8c9
1 changed files with 53 additions and 0 deletions

View File

@ -318,7 +318,60 @@ module BSSGP_Types {
other, OTHERWISE)"
}
external function enc_BssgpPdu(in BssgpPdu pdu) return octetstring
with { extension "prototype(convert) encode(RAW)" };
external function dec_BssgpPdu(in octetstring stream) return BssgpPdu
with { extension "prototype(convert) decode(RAW)" };
template BssgpPdu t_BSSGP_other(template BssgpPduType pdu_type, template BssgpTLVs tlvs) := {
pdu_type := pdu_type,
u := {
other := {
tlvs := tlvs
}
}
}
template BssgpTLV t_BSSGP_IE_Cause(template BssgpCause cause) := {
iei := CAUSE,
len := 1,
u := { cause := cause }
}
template BssgpTLV t_BSSGP_IE_Bvci(template BssgpBvci bvci) := {
iei := BVCI,
len := 2,
u := { bvci := bvci }
}
template BssgpTLV t_BssgpIE(template BssgpIEI iei, template BssgpIeUnion u) := {
iei := iei,
len := 0,
u := u
}
template BssgpTLV t_BSSGP_IE_PDU(BssgpPdu pdu) :=
t_BssgpIE(PDU_IN_ERROR, { other := f_BSSGP_compact_len(enc_BssgpPdu(pdu)) });
template BssgpTLV t_BSSGP_IE_CellId(template BssgpCellId cid) := t_BssgpIE(CELL_ID, { cell_id := cid });
template BssgpPdu t_BVC_RESET(template BssgpCause cause, template BssgpBvci bvci, template BssgpCellId cell_id) :=
t_BSSGP_other(BVC_RESET, { t_BSSGP_IE_Cause(cause), t_BSSGP_IE_Bvci(bvci), t_BSSGP_IE_CellId(cell_id) });
template BssgpPdu t_BVC_RESET_ACK(template BssgpBvci bvci, template BssgpCellId cell_id) :=
t_BSSGP_other(BVC_RESET_ACK, { t_BSSGP_IE_Bvci(bvci), t_BSSGP_IE_CellId(cell_id) });
template BssgpPdu t_BVC_UNBLOCK(template BssgpBvci bvci) := t_BSSGP_other(BVC_UNBLOCK, { t_BSSGP_IE_Bvci(bvci) });
template BssgpPdu t_BVC_UNBLOCK_ACK(template BssgpBvci bvci) := t_BSSGP_other(BVC_UNBLOCK_ACK, { t_BSSGP_IE_Bvci(bvci) });
template BssgpPdu t_BVC_BLOCK(template BssgpBvci bvci, template BssgpCause cause) :=
t_BSSGP_other(BVC_BLOCK, { t_BSSGP_IE_Bvci(bvci), t_BSSGP_IE_Cause(cause) });
template BssgpPdu t_BVC_BLOCK_ACK(template BssgpBvci bvci) := t_BSSGP_other(BVC_BLOCK_ACK, { t_BSSGP_IE_Bvci(bvci) });
template BssgpPdu tr_BSSGP_type(template BssgpPduType pdu_type) := {
pdu_type := pdu_type,
u := ?
}
template BssgpPdu t_BSSGP_STATUS(template BssgpTLVs tlvs) := t_BSSGP_other(STATUS, tlvs);
} with { encode "RAW" };