blob: 3fb0b94a37a462465562525ac4a4f1b629b591a5 [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
10#define msgb_ppid(msg) (msg)->cb[0]
11
12enum {
13 DMAIN,
Daniel Willmann32797802015-12-17 12:53:05 +010014 DHNBAP,
Daniel Willmann97374c02015-12-03 09:37:58 +010015};
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
30struct 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
39struct 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
47struct 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 Willmann479cb302015-12-09 17:54:59 +010063
64 uint16_t rnc_id;
Daniel Willmann97374c02015-12-03 09:37:58 +010065};
66
67extern struct hnb_test g_hnb_test;