Daniel Willmann | 97374c0 | 2015-12-03 09:37:58 +0100 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <osmocom/core/select.h> |
| 4 | #include <osmocom/core/linuxlist.h> |
| 5 | #include <osmocom/core/write_queue.h> |
| 6 | |
| 7 | #define DEBUG |
| 8 | #include <osmocom/core/logging.h> |
| 9 | |
Daniel Willmann | 97374c0 | 2015-12-03 09:37:58 +0100 | [diff] [blame] | 10 | enum { |
| 11 | DMAIN, |
Daniel Willmann | 3279780 | 2015-12-17 12:53:05 +0100 | [diff] [blame] | 12 | DHNBAP, |
Daniel Willmann | 97374c0 | 2015-12-03 09:37:58 +0100 | [diff] [blame] | 13 | }; |
| 14 | |
| 15 | |
| 16 | /* 25.467 Section 7.1 */ |
| 17 | #define IUH_DEFAULT_SCTP_PORT 29169 |
| 18 | #define RNA_DEFAULT_SCTP_PORT 25471 |
| 19 | |
| 20 | #define IUH_PPI_RUA 19 |
| 21 | #define IUH_PPI_HNBAP 20 |
| 22 | #define IUH_PPI_SABP 31 |
| 23 | #define IUH_PPI_RNA 42 |
| 24 | #define IUH_PPI_PUA 55 |
| 25 | |
| 26 | #define IUH_MSGB_SIZE 2048 |
| 27 | |
| 28 | struct umts_cell_id { |
| 29 | uint16_t mcc; /*!< Mobile Country Code */ |
| 30 | uint16_t mnc; /*!< Mobile Network Code */ |
| 31 | uint16_t lac; /*!< Locaton Area Code */ |
| 32 | uint16_t rac; /*!< Routing Area Code */ |
| 33 | uint16_t sac; /*!< Service Area Code */ |
| 34 | uint32_t cid; /*!< Cell ID */ |
| 35 | }; |
| 36 | |
| 37 | struct ue_context { |
| 38 | /*! Entry in the HNB-global list of UE */ |
| 39 | struct llist_head list; |
| 40 | /*! Unique Context ID for this UE */ |
| 41 | uint32_t context_id; |
| 42 | char imsi[16+1]; |
| 43 | }; |
| 44 | |
Neels Hofmeyr | 860a129 | 2016-02-18 23:03:15 +0100 | [diff] [blame] | 45 | struct hnbtest_chan { |
| 46 | int is_ps; |
| 47 | uint32_t conn_id; |
| 48 | char *imsi; |
| 49 | }; |
| 50 | |
Daniel Willmann | 97374c0 | 2015-12-03 09:37:58 +0100 | [diff] [blame] | 51 | struct hnb_test { |
| 52 | uint16_t gw_port; |
| 53 | /*! SCTP listen socket for incoming connections */ |
| 54 | struct osmo_fd conn_fd; |
| 55 | |
| 56 | /*! SCTP socket + write queue for Iuh to this specific HNB */ |
| 57 | struct osmo_wqueue wqueue; |
| 58 | /*! copied from HNB-Identity-Info IE */ |
| 59 | char identity_info[256]; |
| 60 | /*! copied from Cell Identity IE */ |
| 61 | struct umts_cell_id id; |
| 62 | |
| 63 | /*! SCTP stream ID for HNBAP */ |
| 64 | uint16_t hnbap_stream; |
| 65 | /*! SCTP stream ID for RUA */ |
| 66 | uint16_t rua_stream; |
Daniel Willmann | 479cb30 | 2015-12-09 17:54:59 +0100 | [diff] [blame] | 67 | |
| 68 | uint16_t rnc_id; |
Daniel Willmann | 19dedbb | 2015-12-17 11:57:41 +0100 | [diff] [blame] | 69 | |
| 70 | uint32_t ctx_id; |
Daniel Willmann | 141a0ba | 2015-12-17 18:03:52 +0100 | [diff] [blame] | 71 | |
| 72 | int ues; |
Neels Hofmeyr | 860a129 | 2016-02-18 23:03:15 +0100 | [diff] [blame] | 73 | |
| 74 | struct { |
| 75 | struct hnbtest_chan *chan; |
| 76 | } cs; |
Daniel Willmann | 97374c0 | 2015-12-03 09:37:58 +0100 | [diff] [blame] | 77 | }; |
| 78 | |
| 79 | extern struct hnb_test g_hnb_test; |