blob: f2958249fc0d0dfa206092ab8c708c2f6a938934 [file] [log] [blame]
Stefan Sperlingbd6e7a92018-07-27 15:17:09 +02001#pragma once
2
3#include <stdbool.h>
4#include <osmocom/gsm/sysinfo.h>
5#include <osmocom/gprs/protocol/gsm_04_60.h>
6
7/* 16 is the max. number of SI2quater messages according to 3GPP TS 44.018 Table 10.5.2.33b.1:
8 4-bit index is used (2#1111 = 10#15) */
9#define SI2Q_MAX_NUM 16
10/* length in bits (for single SI2quater message) */
11#define SI2Q_MAX_LEN 160
12#define SI2Q_MIN_LEN 18
13
14/* generate SI1 rest octets */
Harald Welte428d03b2019-05-28 18:46:20 +020015int osmo_gsm48_rest_octets_si1_encode(uint8_t *data, uint8_t *nch_pos, int is1800_net);
16int osmo_gsm48_rest_octets_si2quater_encode(uint8_t *data, uint8_t si2q_index, uint8_t si2q_count,
17 const uint16_t *uarfcn_list, size_t *u_offset,
18 size_t uarfcn_length, uint16_t *scramble_list,
19 struct osmo_earfcn_si2q *si2quater_neigh_list,
20 size_t *e_offset);
Harald Welte86156de2019-05-28 19:49:47 +020021
22struct osmo_gsm48_si_pch_nch_info {
23 bool present;
24 bool paging_channel_restructuring;
25 uint8_t nln_sacch;
26 bool call_priority_present;
27 uint8_t call_priority;
28 bool nln_status_sacch;
29};
30
31struct osmo_gsm48_si_vbs_vgcs_options {
32 bool present;
33 bool inband_notifications;
34 bool inband_pagings;
35};
36
37struct osmo_gsm48_si_dtm_support {
38 bool present;
39 uint8_t rac;
40 uint8_t max_lapdm;
41};
42
43struct osmo_gsm48_si_gprs_ms_txpwr_max_ccch {
44 bool present;
45 uint8_t max_txpwr;
46};
47
48struct osmo_gsm48_si6_ro_info {
49 struct osmo_gsm48_si_pch_nch_info pch_nch_info;
50 struct osmo_gsm48_si_vbs_vgcs_options vbs_vgcs_options;
51 struct osmo_gsm48_si_dtm_support dtm_support;
52 bool band_indicator_1900;
53 struct osmo_gsm48_si_gprs_ms_txpwr_max_ccch gprs_ms_txpwr_max_ccch;
54 /* MBMS: not supported in Osmocom */
55 /* AMR config (group channel): not supported in Osmocom */
56};
57
58int osmo_gsm48_rest_octets_si6_encode(uint8_t *data, const struct osmo_gsm48_si6_ro_info *in);
Stefan Sperlingbd6e7a92018-07-27 15:17:09 +020059
60struct osmo_gsm48_si_selection_params {
61 uint16_t penalty_time:5,
62 temp_offs:3,
63 cell_resel_off:6,
64 cbq:1,
65 present:1;
66};
67
68struct osmo_gsm48_si_power_offset {
69 uint8_t power_offset:2,
70 present:1;
71};
72
73struct osmo_gsm48_si3_gprs_ind {
74 uint8_t si13_position:1,
75 ra_colour:3,
76 present:1;
77};
78
79struct osmo_gsm48_lsa_params {
80 uint32_t prio_thr:3,
81 lsa_offset:3,
82 mcc:12,
83 mnc:12;
84 unsigned int present;
85};
86
87struct osmo_gsm48_si_ro_info {
88 struct osmo_gsm48_si_selection_params selection_params;
89 struct osmo_gsm48_si_power_offset power_offset;
90 bool si2ter_indicator;
91 bool early_cm_ctrl;
92 struct {
93 uint8_t where:3,
94 present:1;
95 } scheduling;
96 struct osmo_gsm48_si3_gprs_ind gprs_ind;
97 /* SI 3 specific */
98 bool early_cm_restrict_3g;
99 bool si2quater_indicator;
100 /* SI 4 specific */
101 struct osmo_gsm48_lsa_params lsa_params;
102 uint16_t cell_id;
103 uint8_t break_ind; /* do we have SI7 + SI8 ? */
104};
105
106/* Generate SI3 Rest Octests (Chapter 10.5.2.34 / Table 10.4.72) */
Harald Welte428d03b2019-05-28 18:46:20 +0200107int osmo_gsm48_rest_octets_si3_encode(uint8_t *data, const struct osmo_gsm48_si_ro_info *si3);
Stefan Sperlingbd6e7a92018-07-27 15:17:09 +0200108
109/* Generate SI4 Rest Octets (Chapter 10.5.2.35) */
Harald Welte428d03b2019-05-28 18:46:20 +0200110int osmo_gsm48_rest_octets_si4_encode(uint8_t *data, const struct osmo_gsm48_si_ro_info *si4, int len);
Stefan Sperlingbd6e7a92018-07-27 15:17:09 +0200111
112struct osmo_gsm48_si13_info {
113 struct osmo_gprs_cell_options cell_opts;
114 struct osmo_gprs_power_ctrl_pars pwr_ctrl_pars;
115 uint8_t bcch_change_mark;
116 uint8_t si_change_field;
117 uint8_t rac;
118 uint8_t spgc_ccch_sup;
119 uint8_t net_ctrl_ord;
120 uint8_t prio_acc_thr;
121};
122
Pau Espin Pedrold7a209b2021-02-09 18:28:25 +0100123/* Parse/Generate SI13 Rest Octests (Chapter 10.5.2.37b) */
124int osmo_gsm48_rest_octets_si13_decode(struct osmo_gsm48_si13_info *si13, const uint8_t *data);
Harald Welte428d03b2019-05-28 18:46:20 +0200125int osmo_gsm48_rest_octets_si13_encode(uint8_t *data, const struct osmo_gsm48_si13_info *si13);
Harald Weltef85b33f2019-05-28 17:56:21 +0200126
127/* Parse SI3 Rest Octets */
128void osmo_gsm48_rest_octets_si3_decode(struct osmo_gsm48_si_ro_info *si3, const uint8_t *data);
Harald Welte5e1cd5e2020-10-11 20:04:04 +0200129
130/* Parse SI4 Rest Octets */
131void osmo_gsm48_rest_octets_si4_decode(struct osmo_gsm48_si_ro_info *si4, const uint8_t *data, int len);