diff --git a/include/osmocom/hnodeb/hnodeb.h b/include/osmocom/hnodeb/hnodeb.h index 5503020..986c638 100644 --- a/include/osmocom/hnodeb/hnodeb.h +++ b/include/osmocom/hnodeb/hnodeb.h @@ -92,6 +92,9 @@ struct hnb { struct osmo_prim_srv_link *link; struct osmo_prim_srv *srv; uint8_t valid_sapi_mask; + uint16_t sapi_version_iuh; + uint16_t sapi_version_gtp; + uint16_t sapi_version_audio; struct osmo_timer_list defer_configure_ind_timer; } llsk; diff --git a/include/osmocom/hnodeb/llsk.h b/include/osmocom/hnodeb/llsk.h index 78eb065..d9e1a69 100644 --- a/include/osmocom/hnodeb/llsk.h +++ b/include/osmocom/hnodeb/llsk.h @@ -37,8 +37,8 @@ int ll_addr_type2af(enum u_addr_type t); int ll_addr2osa(enum u_addr_type t, const union u_addr *uaddr, uint16_t port, struct osmo_sockaddr *osa); enum u_addr_type osa2_ll_addr(const struct osmo_sockaddr *osa, union u_addr *uaddr, uint16_t *port); - - +#define LLSK_SAPI_IUH_VERSION_MIN 0 +#define LLSK_SAPI_IUH_VERSION_MAX 0 extern const struct value_string hnb_iuh_prim_type_names[]; int llsk_rx_iuh(struct hnb *hnb, struct osmo_prim_hdr *oph); int llsk_iuh_tx_configure_ind(struct hnb *hnb); @@ -50,12 +50,15 @@ struct hnb_iuh_prim *hnb_iuh_makeprim_conn_data_ind(uint32_t context_id, uint32_t data_len); struct hnb_iuh_prim *hnb_iuh_makeprim_unitdata_ind(const uint8_t *data, uint32_t data_len); - +#define LLSK_SAPI_AUDIO_VERSION_MIN 0 +#define LLSK_SAPI_AUDIO_VERSION_MAX 0 extern const struct value_string hnb_audio_prim_type_names[]; int llsk_rx_audio(struct hnb *hnb, struct osmo_prim_hdr *oph); int llsk_audio_tx_conn_data_ind(struct rtp_conn *conn, uint8_t frame_nr, uint8_t fqc, uint8_t rfci, const uint8_t *payload, uint32_t len); +#define LLSK_SAPI_GTP_VERSION_MIN 0 +#define LLSK_SAPI_GTP_VERSION_MAX 0 extern const struct value_string hnb_gtp_prim_type_names[]; int llsk_rx_gtp(struct hnb *hnb, struct osmo_prim_hdr *oph); struct hnb_gtp_prim *hnb_gtp_makeprim_conn_data_ind(uint32_t gtp_conn_id, const uint8_t *data, uint32_t data_len); diff --git a/src/osmo-hnodeb/llsk.c b/src/osmo-hnodeb/llsk.c index 89e8364..b56cae7 100644 --- a/src/osmo-hnodeb/llsk.c +++ b/src/osmo-hnodeb/llsk.c @@ -146,6 +146,33 @@ static int llsk_rx_sapi_version_cb(struct osmo_prim_srv *prim_srv, uint32_t sapi struct hnb *hnb = (struct hnb *)osmo_prim_srv_get_priv(prim_srv); if (sapi > sizeof(hnb->llsk.valid_sapi_mask)*8 - 1) return -1; + + switch (sapi) { + case HNB_PRIM_SAPI_IUH: + if (rem_version < LLSK_SAPI_IUH_VERSION_MIN) + return -1; + if (rem_version > LLSK_SAPI_IUH_VERSION_MAX) + return LLSK_SAPI_IUH_VERSION_MAX; + hnb->llsk.sapi_version_iuh = rem_version; + break; + case HNB_PRIM_SAPI_GTP: + if (rem_version < LLSK_SAPI_GTP_VERSION_MIN) + return -1; + if (rem_version > LLSK_SAPI_GTP_VERSION_MAX) + return LLSK_SAPI_GTP_VERSION_MAX; + hnb->llsk.sapi_version_gtp = rem_version; + break; + case HNB_PRIM_SAPI_AUDIO: + if (rem_version < LLSK_SAPI_AUDIO_VERSION_MIN) + return -1; + if (rem_version > LLSK_SAPI_AUDIO_VERSION_MAX) + return LLSK_SAPI_AUDIO_VERSION_MAX; + hnb->llsk.sapi_version_audio = rem_version; + break; + default: + return -1; + } + hnb->llsk.valid_sapi_mask |= (1 << sapi); /* Defer CONFIGURE.req after we have confirmed the versions */