fixeria has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-gprs/+/29411 )
Change subject: llc: add definitions of service primitive parameters ......................................................................
llc: add definitions of service primitive parameters
Change-Id: Iaa520a818b05c962e0d3be9607d3a8c5991f539e --- M include/osmocom/gprs/llc/llc_prim.h 1 file changed, 172 insertions(+), 0 deletions(-)
Approvals: Jenkins Builder: Verified fixeria: Looks good to me, approved pespin: Looks good to me, but someone else must approve laforge: Looks good to me, but someone else must approve
diff --git a/include/osmocom/gprs/llc/llc_prim.h b/include/osmocom/gprs/llc/llc_prim.h index ddb1732..f58c5fa 100644 --- a/include/osmocom/gprs/llc/llc_prim.h +++ b/include/osmocom/gprs/llc/llc_prim.h @@ -1,5 +1,12 @@ #pragma once
+/* 3GPP TS 44.064, section 7.1 "Definition of service primitives and parameters" */ + +#include <stdint.h> +#include <stddef.h> + +#include <osmocom/core/prim.h> + /* TS 04.64 Section 7.1.2 Table 7: LLC layer primitives (GMM/SNDCP/SMS/TOM) */ /* TS 04.65 Section 5.1.2 Table 2: Service primitives used by SNDCP */ enum osmo_gprs_llc_prim_type { @@ -28,3 +35,168 @@ /* LLE <-> BSSGP (SGSN side) */ OSMO_GPRS_LLC_BSSGP_UNITDATA, /* Req/Ind: TLLI, LL-PDU, Cell Id, QoS, RLC Confirm, SAPI, ... */ }; + +/* Parameters for OSMO_GPRS_LLC_LLGMM_* prims */ +struct osmo_gprs_llc_llgmm_prim { + /* Common fields */ + uint32_t tlli; + /* Specific fields */ + union { + /* OSMO_GPRS_LLC_LLGMM_ASSIGN | Req */ + struct { + uint32_t tlli_new; + uint8_t gea; /* GEA/0 = 0, GEA/1 = 1, ... */ + uint8_t kc[16]; /* max 16 * 8 = 128 bits */ + /* TODO: Integrity Key & Algo */ + } assign_req; + /* OSMO_GPRS_LLC_LLGMM_TRIGGER | Req */ + struct { + uint8_t cause; + } trigger_req; + /* OSMO_GPRS_LLC_LLGMM_SUSPEND | Req */ + struct { + uint8_t page; + } suspend_req; + /* OSMO_GPRS_LLC_LLGMM_STATUS | Ind */ + struct { + uint8_t cause; + } status_ind; + /* OSMO_GPRS_LLC_LLGMM_PSHO | Ind */ + struct { + uint8_t gea; /* GEA/0 = 0, GEA/1 = 1, ... */ + } psho_ind; + /* OSMO_GPRS_LLC_LLGMM_PSHO | Req */ + struct { + uint8_t gea; /* GEA/0 = 0, GEA/1 = 1, ... */ + uint8_t kc[16]; /* max 16 * 8 = 128 bits */ + } psho_req; + /* OSMO_GPRS_LLC_LLGMM_PSHO | Cnf */ + struct { + uint32_t iov_ui; + /* TODO: old XID indicator */ + } psho_cnf; + }; +}; + +/* Parameters for OSMO_GPRS_LLC_LL_* prims */ +struct osmo_gprs_llc_ll_prim { + /* Common fields */ + uint32_t tlli; + /* OSMO_GPRS_LLC_LL_[UNIT]DATA */ + uint8_t *l3_pdu; + size_t l3_pdu_len; + /* Specific fields */ + union { + /* OSMO_GPRS_LLC_LL_RESET | Ind */ + struct { + /* TODO: old XID indicator */ + } reset_ind; + /* OSMO_GPRS_LLC_LL_ESTABLISH | { Req, Ind, Rsp, Cnf } */ + struct { + /* TODO: XID Req/Neg */ + uint16_t n201_i; /* only for Ind & Cnf */ + uint16_t n201_u; /* only for Ind & Cnf */ + } establish; + /* OSMO_GPRS_LLC_LL_RELEASE | Req */ + struct { + uint8_t local; + } release_req; + /* OSMO_GPRS_LLC_LL_RELEASE | Ind */ + struct { + uint8_t cause; + } release_ind; + /* OSMO_GPRS_LLC_LL_XID | { Req, Ind, Rsp, Cnf } */ + struct { + /* TODO: XID Req/Neg */ + uint16_t n201_i; /* only for Ind & Cnf */ + uint16_t n201_u; /* only for Ind & Cnf */ + } xid; + /* OSMO_GPRS_LLC_LL_DATA | Req */ + struct { + uint8_t qos_params[3]; + uint8_t reference; /* TODO: confirm type */ + uint8_t radio_prio; /* only for the MS side */ + } data_req; + /* OSMO_GPRS_LLC_LL_DATA | Cnf */ + struct { + uint8_t reference; /* TODO: confirm type */ + } data_cnf; + /* OSMO_GPRS_LLC_LL_UNITDATA | Req */ + struct { + uint8_t qos_params[3]; + uint8_t radio_prio; /* only for the MS side */ + bool apply_gea; /* Cipher */ + bool apply_gia; /* Integrity Protection */ + } unitdata_req; + /* OSMO_GPRS_LLC_LL_UNITDATA | Ind */ + struct { + bool apply_gea; /* Cipher */ + bool apply_gia; /* Integrity Protection */ + /* TODO: MAC Verified */ + /* TODO: LLC MAC */ + } unitdata_ind; + /* OSMO_GPRS_LLC_LL_STATUS | Ind */ + struct { + uint8_t cause; + } status_ind; + }; +}; + +/* Parameters for OSMO_GPRS_LLC_GRR_* prims */ +struct osmo_gprs_llc_grr_prim { + /* Common fields */ + uint32_t tlli; + uint8_t *ll_pdu; + size_t ll_pdu_len; + /* Specific fields */ + union { + /* OSMO_GPRS_LLC_GRR_[UNIT]DATA | Req */ + struct { + uint8_t qos_params[3]; + uint8_t radio_prio; + uint8_t cause; /* only for OSMO_GPRS_LLC_GRR_UNITDATA | Req */ + uint8_t sapi; + } data_req; + }; +}; + +/* Parameters for OSMO_GPRS_LLC_BSSGP_* prims */ +struct osmo_gprs_llc_bssgp_prim { + /* Common fields */ + uint32_t tlli; + uint8_t *ll_pdu; + size_t ll_pdu_len; + /* Specific fields */ + union { + /* OSMO_GPRS_LLC_BSSGP_UNITDATA | Req */ + struct { + uint8_t qos_params[3]; + bool rlc_confirm; + uint8_t sapi; + /* TODO: MOCN specific parameters: + * - Redirect indication + * - IMSI + * - GMM cause + * - V(U) for redirect + * - Redirect complete */ + } unitdata_req; + /* OSMO_GPRS_LLC_BSSGP_UNITDATA | Ind */ + struct { + uint16_t cell_id; + /* TODO: MOCN specific parameters: + * - Redirect attempt + * - IMSI + * - V(U) for redirect */ + } unitdata_ind; + }; +}; + +struct osmo_gprs_llc_prim { + struct osmo_prim_hdr oph; + union { + struct osmo_gprs_llc_llgmm_prim llgmm; + struct osmo_gprs_llc_ll_prim ll; + struct osmo_gprs_llc_grr_prim grr; + struct osmo_gprs_llc_bssgp_prim bssgp; + }; +};