blob: cdb2e80718519d0b28cbb7dd8f5132753652df73 [file] [log] [blame]
Stefan Sperlingbd6e7a92018-07-27 15:17:09 +02001#pragma once
2
3#include <stdbool.h>
4#include <osmocom/gsm/sysinfo.h>
Pau Espin Pedrol0158b052023-02-17 12:30:57 +01005#include <osmocom/gsm/protocol/gsm_44_060.h>
Stefan Sperlingbd6e7a92018-07-27 15:17:09 +02006
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);
Harald Welte11926872023-05-08 06:22:21 +020016int osmo_gsm48_si1ro_nch_pos_decode(uint8_t value, uint8_t *num_blocks, uint8_t *first_block);
17int osmo_gsm48_si1ro_nch_pos_encode(uint8_t num_blocks, uint8_t first_block);
18
Harald Welte428d03b2019-05-28 18:46:20 +020019int osmo_gsm48_rest_octets_si2quater_encode(uint8_t *data, uint8_t si2q_index, uint8_t si2q_count,
20 const uint16_t *uarfcn_list, size_t *u_offset,
21 size_t uarfcn_length, uint16_t *scramble_list,
22 struct osmo_earfcn_si2q *si2quater_neigh_list,
23 size_t *e_offset);
Harald Welte86156de2019-05-28 19:49:47 +020024
25struct osmo_gsm48_si_pch_nch_info {
26 bool present;
27 bool paging_channel_restructuring;
28 uint8_t nln_sacch;
29 bool call_priority_present;
30 uint8_t call_priority;
31 bool nln_status_sacch;
32};
33
34struct osmo_gsm48_si_vbs_vgcs_options {
35 bool present;
36 bool inband_notifications;
37 bool inband_pagings;
38};
39
40struct osmo_gsm48_si_dtm_support {
41 bool present;
42 uint8_t rac;
43 uint8_t max_lapdm;
44};
45
46struct osmo_gsm48_si_gprs_ms_txpwr_max_ccch {
47 bool present;
48 uint8_t max_txpwr;
49};
50
51struct osmo_gsm48_si6_ro_info {
52 struct osmo_gsm48_si_pch_nch_info pch_nch_info;
53 struct osmo_gsm48_si_vbs_vgcs_options vbs_vgcs_options;
54 struct osmo_gsm48_si_dtm_support dtm_support;
55 bool band_indicator_1900;
56 struct osmo_gsm48_si_gprs_ms_txpwr_max_ccch gprs_ms_txpwr_max_ccch;
57 /* MBMS: not supported in Osmocom */
58 /* AMR config (group channel): not supported in Osmocom */
59};
60
61int osmo_gsm48_rest_octets_si6_encode(uint8_t *data, const struct osmo_gsm48_si6_ro_info *in);
Stefan Sperlingbd6e7a92018-07-27 15:17:09 +020062
63struct osmo_gsm48_si_selection_params {
64 uint16_t penalty_time:5,
65 temp_offs:3,
66 cell_resel_off:6,
67 cbq:1,
68 present:1;
69};
70
71struct osmo_gsm48_si_power_offset {
72 uint8_t power_offset:2,
73 present:1;
74};
75
76struct osmo_gsm48_si3_gprs_ind {
77 uint8_t si13_position:1,
78 ra_colour:3,
79 present:1;
80};
81
82struct osmo_gsm48_lsa_params {
83 uint32_t prio_thr:3,
84 lsa_offset:3,
85 mcc:12,
86 mnc:12;
87 unsigned int present;
88};
89
90struct osmo_gsm48_si_ro_info {
91 struct osmo_gsm48_si_selection_params selection_params;
92 struct osmo_gsm48_si_power_offset power_offset;
93 bool si2ter_indicator;
94 bool early_cm_ctrl;
95 struct {
96 uint8_t where:3,
97 present:1;
98 } scheduling;
99 struct osmo_gsm48_si3_gprs_ind gprs_ind;
100 /* SI 3 specific */
101 bool early_cm_restrict_3g;
102 bool si2quater_indicator;
103 /* SI 4 specific */
104 struct osmo_gsm48_lsa_params lsa_params;
105 uint16_t cell_id;
106 uint8_t break_ind; /* do we have SI7 + SI8 ? */
107};
108
109/* Generate SI3 Rest Octests (Chapter 10.5.2.34 / Table 10.4.72) */
Harald Welte428d03b2019-05-28 18:46:20 +0200110int osmo_gsm48_rest_octets_si3_encode(uint8_t *data, const struct osmo_gsm48_si_ro_info *si3);
Stefan Sperlingbd6e7a92018-07-27 15:17:09 +0200111
112/* Generate SI4 Rest Octets (Chapter 10.5.2.35) */
Harald Welte428d03b2019-05-28 18:46:20 +0200113int 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 +0200114
115struct osmo_gsm48_si13_info {
116 struct osmo_gprs_cell_options cell_opts;
117 struct osmo_gprs_power_ctrl_pars pwr_ctrl_pars;
118 uint8_t bcch_change_mark;
119 uint8_t si_change_field;
120 uint8_t rac;
121 uint8_t spgc_ccch_sup;
122 uint8_t net_ctrl_ord;
123 uint8_t prio_acc_thr;
124};
125
Pau Espin Pedrold7a209b2021-02-09 18:28:25 +0100126/* Parse/Generate SI13 Rest Octests (Chapter 10.5.2.37b) */
127int osmo_gsm48_rest_octets_si13_decode(struct osmo_gsm48_si13_info *si13, const uint8_t *data);
Harald Welte428d03b2019-05-28 18:46:20 +0200128int osmo_gsm48_rest_octets_si13_encode(uint8_t *data, const struct osmo_gsm48_si13_info *si13);
Harald Weltef85b33f2019-05-28 17:56:21 +0200129
130/* Parse SI3 Rest Octets */
131void osmo_gsm48_rest_octets_si3_decode(struct osmo_gsm48_si_ro_info *si3, const uint8_t *data);
Harald Welte5e1cd5e2020-10-11 20:04:04 +0200132
133/* Parse SI4 Rest Octets */
134void osmo_gsm48_rest_octets_si4_decode(struct osmo_gsm48_si_ro_info *si4, const uint8_t *data, int len);