Neels Hofmeyr | bfa8878 | 2016-05-20 21:38:32 +0200 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <stdbool.h> |
Neels Hofmeyr | 2188a77 | 2016-05-20 21:59:55 +0200 | [diff] [blame^] | 4 | #include <stdint.h> |
| 5 | |
| 6 | #include <osmocom/core/linuxlist.h> |
| 7 | #include <osmocom/gsm/gsm48.h> |
| 8 | |
| 9 | #include <openbsc/common.h> |
Neels Hofmeyr | bfa8878 | 2016-05-20 21:38:32 +0200 | [diff] [blame] | 10 | |
| 11 | struct sgsn_pdp_ctx; |
| 12 | struct msgb; |
Neels Hofmeyr | 2188a77 | 2016-05-20 21:59:55 +0200 | [diff] [blame^] | 13 | struct osmo_sccp_link; |
| 14 | struct gsm_auth_tuple; |
Neels Hofmeyr | bfa8878 | 2016-05-20 21:38:32 +0200 | [diff] [blame] | 15 | |
| 16 | struct RANAP_RAB_SetupOrModifiedItemIEs_s; |
| 17 | struct RANAP_GlobalRNC_ID; |
Neels Hofmeyr | 2188a77 | 2016-05-20 21:59:55 +0200 | [diff] [blame^] | 18 | struct RANAP_Cause; |
| 19 | |
| 20 | /* Debugging switches from asn1c and osmo-iuh */ |
| 21 | extern int asn_debug; |
| 22 | extern int asn1_xer_print; |
Neels Hofmeyr | bfa8878 | 2016-05-20 21:38:32 +0200 | [diff] [blame] | 23 | |
| 24 | struct ue_conn_ctx { |
| 25 | struct llist_head list; |
| 26 | struct osmo_sccp_link *link; |
| 27 | uint32_t conn_id; |
| 28 | int integrity_active; |
| 29 | struct gprs_ra_id ra_id; |
Neels Hofmeyr | 2188a77 | 2016-05-20 21:59:55 +0200 | [diff] [blame^] | 30 | enum nsap_addr_enc rab_assign_addr_enc; |
Neels Hofmeyr | bfa8878 | 2016-05-20 21:38:32 +0200 | [diff] [blame] | 31 | }; |
| 32 | |
| 33 | enum iu_event_type { |
| 34 | IU_EVENT_RAB_ASSIGN, |
| 35 | IU_EVENT_SECURITY_MODE_COMPLETE, |
| 36 | IU_EVENT_IU_RELEASE, /* An actual Iu Release message was received */ |
| 37 | IU_EVENT_LINK_INVALIDATED, /* A SUA link was lost or closed down */ |
Neels Hofmeyr | bfa8878 | 2016-05-20 21:38:32 +0200 | [diff] [blame] | 38 | }; |
| 39 | |
| 40 | extern const struct value_string iu_event_type_names[]; |
| 41 | static inline const char *iu_event_type_str(enum iu_event_type e) |
| 42 | { |
| 43 | return get_value_string(iu_event_type_names, e); |
| 44 | } |
| 45 | |
| 46 | /* Implementations of iu_recv_cb_t shall find the ue_conn_ctx in msg->dst. */ |
| 47 | typedef int (* iu_recv_cb_t )(struct msgb *msg, struct gprs_ra_id *ra_id, |
Neels Hofmeyr | bfa8878 | 2016-05-20 21:38:32 +0200 | [diff] [blame] | 48 | uint16_t *sai); |
| 49 | |
| 50 | typedef int (* iu_event_cb_t )(struct ue_conn_ctx *ue_ctx, |
| 51 | enum iu_event_type type, void *data); |
| 52 | |
| 53 | typedef int (* iu_rab_ass_resp_cb_t )(struct ue_conn_ctx *ue_ctx, uint8_t rab_id, |
| 54 | struct RANAP_RAB_SetupOrModifiedItemIEs_s *setup_ies); |
| 55 | |
| 56 | int iu_init(void *ctx, const char *listen_addr, uint16_t listen_port, |
| 57 | iu_recv_cb_t iu_recv_cb, iu_event_cb_t iu_event_cb); |
| 58 | |
| 59 | void iu_link_del(struct osmo_sccp_link *link); |
| 60 | |
| 61 | int iu_tx(struct msgb *msg, uint8_t sapi); |
| 62 | |
| 63 | int iu_page_cs(const char *imsi, const uint32_t *tmsi, uint16_t lac); |
| 64 | int iu_page_ps(const char *imsi, const uint32_t *ptmsi, uint16_t lac, uint8_t rac); |
| 65 | |
| 66 | int iu_rab_act(struct ue_conn_ctx *ue_ctx, struct msgb *msg); |
| 67 | int iu_rab_deact(struct ue_conn_ctx *ue_ctx, uint8_t rab_id); |
| 68 | int iu_tx_sec_mode_cmd(struct ue_conn_ctx *uectx, struct gsm_auth_tuple *tp, |
| 69 | int send_ck, int new_key); |
Neels Hofmeyr | 2188a77 | 2016-05-20 21:59:55 +0200 | [diff] [blame^] | 70 | int iu_tx_common_id(struct ue_conn_ctx *ue_ctx, const char *imsi); |
| 71 | int iu_tx_release(struct ue_conn_ctx *ctx, const struct RANAP_Cause *cause); |
Neels Hofmeyr | 9bc42ec | 2016-08-29 13:02:12 +0200 | [diff] [blame] | 72 | |
Neels Hofmeyr | 2188a77 | 2016-05-20 21:59:55 +0200 | [diff] [blame^] | 73 | void iu_vty_init(int iu_parent_node, enum nsap_addr_enc *rab_assign_addr_enc); |
| 74 | int iu_vty_config_write(struct vty *vty, const char *indent); |