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 | |
| 10 | #define msgb_ppid(msg) (msg)->cb[0] |
| 11 | |
| 12 | enum { |
| 13 | DMAIN, |
Daniel Willmann | 3279780 | 2015-12-17 12:53:05 +0100 | [diff] [blame] | 14 | DHNBAP, |
Daniel Willmann | 97374c0 | 2015-12-03 09:37:58 +0100 | [diff] [blame] | 15 | }; |
| 16 | |
| 17 | |
| 18 | /* 25.467 Section 7.1 */ |
| 19 | #define IUH_DEFAULT_SCTP_PORT 29169 |
| 20 | #define RNA_DEFAULT_SCTP_PORT 25471 |
| 21 | |
| 22 | #define IUH_PPI_RUA 19 |
| 23 | #define IUH_PPI_HNBAP 20 |
| 24 | #define IUH_PPI_SABP 31 |
| 25 | #define IUH_PPI_RNA 42 |
| 26 | #define IUH_PPI_PUA 55 |
| 27 | |
| 28 | #define IUH_MSGB_SIZE 2048 |
| 29 | |
| 30 | struct umts_cell_id { |
| 31 | uint16_t mcc; /*!< Mobile Country Code */ |
| 32 | uint16_t mnc; /*!< Mobile Network Code */ |
| 33 | uint16_t lac; /*!< Locaton Area Code */ |
| 34 | uint16_t rac; /*!< Routing Area Code */ |
| 35 | uint16_t sac; /*!< Service Area Code */ |
| 36 | uint32_t cid; /*!< Cell ID */ |
| 37 | }; |
| 38 | |
| 39 | struct ue_context { |
| 40 | /*! Entry in the HNB-global list of UE */ |
| 41 | struct llist_head list; |
| 42 | /*! Unique Context ID for this UE */ |
| 43 | uint32_t context_id; |
| 44 | char imsi[16+1]; |
| 45 | }; |
| 46 | |
| 47 | struct hnb_test { |
| 48 | uint16_t gw_port; |
| 49 | /*! SCTP listen socket for incoming connections */ |
| 50 | struct osmo_fd conn_fd; |
| 51 | |
| 52 | /*! SCTP socket + write queue for Iuh to this specific HNB */ |
| 53 | struct osmo_wqueue wqueue; |
| 54 | /*! copied from HNB-Identity-Info IE */ |
| 55 | char identity_info[256]; |
| 56 | /*! copied from Cell Identity IE */ |
| 57 | struct umts_cell_id id; |
| 58 | |
| 59 | /*! SCTP stream ID for HNBAP */ |
| 60 | uint16_t hnbap_stream; |
| 61 | /*! SCTP stream ID for RUA */ |
| 62 | uint16_t rua_stream; |
Daniel Willmann | 479cb30 | 2015-12-09 17:54:59 +0100 | [diff] [blame] | 63 | |
| 64 | uint16_t rnc_id; |
Daniel Willmann | 19dedbb | 2015-12-17 11:57:41 +0100 | [diff] [blame] | 65 | |
| 66 | uint32_t ctx_id; |
Daniel Willmann | 141a0ba | 2015-12-17 18:03:52 +0100 | [diff] [blame] | 67 | |
| 68 | int ues; |
Daniel Willmann | 97374c0 | 2015-12-03 09:37:58 +0100 | [diff] [blame] | 69 | }; |
| 70 | |
| 71 | extern struct hnb_test g_hnb_test; |