blob: 4af50a7286c136997b70544620d2a15d150bccff [file] [log] [blame]
Daniel Willmann97374c02015-12-03 09:37:58 +01001#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 Willmann97374c02015-12-03 09:37:58 +010010enum {
11 DMAIN,
Daniel Willmann32797802015-12-17 12:53:05 +010012 DHNBAP,
Daniel Willmann97374c02015-12-03 09:37:58 +010013};
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
28struct 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
37struct 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 Hofmeyr860a1292016-02-18 23:03:15 +010045struct hnbtest_chan {
46 int is_ps;
47 uint32_t conn_id;
48 char *imsi;
49};
50
Daniel Willmann97374c02015-12-03 09:37:58 +010051struct hnb_test {
Neels Hofmeyr5f9be1e2016-02-29 13:33:44 +010052 const char *gw_addr;
Daniel Willmann97374c02015-12-03 09:37:58 +010053 uint16_t gw_port;
54 /*! SCTP listen socket for incoming connections */
55 struct osmo_fd conn_fd;
56
57 /*! SCTP socket + write queue for Iuh to this specific HNB */
58 struct osmo_wqueue wqueue;
59 /*! copied from HNB-Identity-Info IE */
60 char identity_info[256];
61 /*! copied from Cell Identity IE */
62 struct umts_cell_id id;
63
64 /*! SCTP stream ID for HNBAP */
65 uint16_t hnbap_stream;
66 /*! SCTP stream ID for RUA */
67 uint16_t rua_stream;
Daniel Willmann479cb302015-12-09 17:54:59 +010068
69 uint16_t rnc_id;
Daniel Willmann19dedbb2015-12-17 11:57:41 +010070
71 uint32_t ctx_id;
Daniel Willmann141a0ba2015-12-17 18:03:52 +010072
73 int ues;
Neels Hofmeyr860a1292016-02-18 23:03:15 +010074
75 struct {
76 struct hnbtest_chan *chan;
77 } cs;
Daniel Willmann97374c02015-12-03 09:37:58 +010078};
79
80extern struct hnb_test g_hnb_test;