blob: f973ac1baea17511509496c75b0655556f819c37 [file] [log] [blame]
Neels Hofmeyrbfa88782016-05-20 21:38:32 +02001#pragma once
2
3#include <stdbool.h>
4
5struct sgsn_pdp_ctx;
6struct msgb;
7struct gprs_ra_id;
8
9struct RANAP_RAB_SetupOrModifiedItemIEs_s;
10struct RANAP_GlobalRNC_ID;
11
12struct ue_conn_ctx {
13 struct llist_head list;
14 struct osmo_sccp_link *link;
15 uint32_t conn_id;
16 int integrity_active;
17 struct gprs_ra_id ra_id;
18};
19
20enum iu_event_type {
21 IU_EVENT_RAB_ASSIGN,
22 IU_EVENT_SECURITY_MODE_COMPLETE,
23 IU_EVENT_IU_RELEASE, /* An actual Iu Release message was received */
24 IU_EVENT_LINK_INVALIDATED, /* A SUA link was lost or closed down */
25 /* FIXME: maybe IU_EVENT_IU_RELEASE and IU_EVENT_LINK_INVALIDATED
26 * should be combined to one generic event that simply means the
27 * ue_conn_ctx should no longer be used, for whatever reason. */
28};
29
30extern const struct value_string iu_event_type_names[];
31static inline const char *iu_event_type_str(enum iu_event_type e)
32{
33 return get_value_string(iu_event_type_names, e);
34}
35
36/* Implementations of iu_recv_cb_t shall find the ue_conn_ctx in msg->dst. */
37typedef int (* iu_recv_cb_t )(struct msgb *msg, struct gprs_ra_id *ra_id,
38 /* TODO "gprs_" in generic CS+PS domain ^ */
39 uint16_t *sai);
40
41typedef int (* iu_event_cb_t )(struct ue_conn_ctx *ue_ctx,
42 enum iu_event_type type, void *data);
43
44typedef int (* iu_rab_ass_resp_cb_t )(struct ue_conn_ctx *ue_ctx, uint8_t rab_id,
45 struct RANAP_RAB_SetupOrModifiedItemIEs_s *setup_ies);
46
47int iu_init(void *ctx, const char *listen_addr, uint16_t listen_port,
48 iu_recv_cb_t iu_recv_cb, iu_event_cb_t iu_event_cb);
49
50void iu_link_del(struct osmo_sccp_link *link);
51
52int iu_tx(struct msgb *msg, uint8_t sapi);
53
54int iu_page_cs(const char *imsi, const uint32_t *tmsi, uint16_t lac);
55int iu_page_ps(const char *imsi, const uint32_t *ptmsi, uint16_t lac, uint8_t rac);
56
57int iu_rab_act(struct ue_conn_ctx *ue_ctx, struct msgb *msg);
58int iu_rab_deact(struct ue_conn_ctx *ue_ctx, uint8_t rab_id);
59int iu_tx_sec_mode_cmd(struct ue_conn_ctx *uectx, struct gsm_auth_tuple *tp,
60 int send_ck, int new_key);
Neels Hofmeyr9bc42ec2016-08-29 13:02:12 +020061
62void iu_vty_init(int *asn_debug_p);