blob: 8d957d6c63f8e7526def01aff97cc9c95e4a46f5 [file] [log] [blame]
Harald Welte90256ba2015-12-23 20:16:36 +01001#pragma once
2
3#include <stdint.h>
4#include <osmocom/core/linuxlist.h>
5
6enum hnbgw_context_map_state {
7 MAP_S_NULL,
8 MAP_S_ACTIVE, /* currently active map */
9 MAP_S_RESERVED1, /* just disconnected, still resrved */
10 MAP_S_RESERVED2, /* still reserved */
11};
12
13struct hnb_context;
14struct hnbgw_cnlink;
15
16struct hnbgw_context_map {
17 /* entry in the per-CN list of mappings */
18 struct llist_head cn_list;
19 /* entry in the per-HNB list of mappings */
20 struct llist_head hnb_list;
21 /* pointer to HNB */
22 struct hnb_context *hnb_ctx;
23 /* pointer to CN */
24 struct hnbgw_cnlink *cn_link;
25 /* RUA contxt ID */
26 uint32_t rua_ctx_id;
Neels Hofmeyr0f88c112017-07-03 16:49:43 +020027 /* False for CS, true for PS */
28 bool is_ps;
Harald Welte90256ba2015-12-23 20:16:36 +010029 /* SCCP User SAP connection ID */
30 uint32_t scu_conn_id;
31
32 enum hnbgw_context_map_state state;
33};
34
35
36struct hnbgw_context_map *
37context_map_alloc_by_hnb(struct hnb_context *hnb, uint32_t rua_ctx_id,
Neels Hofmeyr0f88c112017-07-03 16:49:43 +020038 bool is_ps,
Harald Welte90256ba2015-12-23 20:16:36 +010039 struct hnbgw_cnlink *cn_if_new);
40
41struct hnbgw_context_map *
42context_map_by_cn(struct hnbgw_cnlink *cn, uint32_t scu_conn_id);
43
44void context_map_deactivate(struct hnbgw_context_map *map);
45
46int context_map_init(struct hnb_gw *gw);