sysinfo.c File Reference
`#include <errno.h>`
`#include <string.h>`
`#include <stdio.h>`
`#include <osmocom/core/bitvec.h>`
`#include <osmocom/core/utils.h>`
`#include <osmocom/gsm/sysinfo.h>`
`#include <osmocom/gsm/protocol/gsm_04_08.h>`
`#include <osmocom/gsm/protocol/gsm_08_58.h>`

## Functions

| osmo_static_assert (sizeof(struct gsm48_system_information_type_header)==3, _si_header_size)
| osmo_static_assert (sizeof(struct gsm48_rach_control)==3, _si_rach_control)
| osmo_static_assert (sizeof(struct gsm48_system_information_type_1)==22, _si1_size)
| osmo_static_assert (sizeof(struct gsm48_system_information_type_2)==23, _si2_size)
| osmo_static_assert (sizeof(struct gsm48_system_information_type_3)==19, _si3_size)
| osmo_static_assert (sizeof(struct gsm48_system_information_type_4)==13, _si4_size)
| osmo_static_assert (sizeof(struct gsm48_system_information_type_5)==18, _si5_size)
| osmo_static_assert (sizeof(struct gsm48_system_information_type_6)==11, _si6_size)
| osmo_static_assert (sizeof(struct gsm48_system_information_type_13)==3, _si13_size)
int | osmo_earfcn_add (struct osmo_earfcn_si2q *e, uint16_t arfcn, uint8_t meas_bw)
| Add pair of arfcn and measurement bandwith value to earfcn struct. More...
size_t | osmo_earfcn_bit_size (const struct osmo_earfcn_si2q *e)
| Return number of bits necessary to represent earfcn struct as Repeated E-UTRAN Neighbour Cells IE from 3GPP TS 44.018 Table 10.5.2.33b.1. More...
size_t | osmo_earfcn_bit_size_ext (const struct osmo_earfcn_si2q *e, size_t offset)
| Return number of bits necessary to represent earfcn struct as Repeated E-UTRAN Neighbour Cells IE from 3GPP TS 44.018 Table 10.5.2.33b.1. More...
int | osmo_earfcn_del (struct osmo_earfcn_si2q *e, uint16_t arfcn)
| Delete arfcn (and corresponding measurement bandwith) from earfcn struct. More...
void | osmo_earfcn_init (struct osmo_earfcn_si2q *e)
| Initialize earfcn struct. More...
uint8_t | osmo_sitype2rsl (enum osmo_sysinfo_type si_type)
enum osmo_sysinfo_type | osmo_rsl2sitype (uint8_t rsl_si)

## Variables

static const uint8_t | sitype2rsl [_MAX_SYSINFO_TYPE]
static const uint8_t | rsl2sitype [256]
const struct value_string | osmo_sitype_strs [_MAX_SYSINFO_TYPE]

## Detailed Description

GSM 04.08 System Information (SI) encoding and decoding. 3GPP TS 04.08 version 7.21.0 Release 1998 / ETSI TS 100 940 V7.21.0

## Function Documentation

## osmo_earfcn_add()

int osmo_earfcn_add | ( | struct osmo_earfcn_si2q * | e,
|  | uint16_t | arfcn,
|  | uint8_t | meas_bw
| ) |  |

Add pair of arfcn and measurement bandwith value to earfcn struct.

Parameters

  [in,out] | e | earfcn struct
  [in] | arfcn | EARFCN value, 16 bits
  [in] | meas_bw | measurement bandwith value

Returns
  0 on success, error otherwise

References osmo_earfcn_si2q::arfcn, osmo_earfcn_si2q::length, osmo_earfcn_si2q::meas_bw, and OSMO_EARFCN_INVALID.

## osmo_earfcn_bit_size()

size_t osmo_earfcn_bit_size | ( | const struct osmo_earfcn_si2q * | e | ) |

Return number of bits necessary to represent earfcn struct as Repeated E-UTRAN Neighbour Cells IE from 3GPP TS 44.018 Table 10.5.2.33b.1.

Parameters

  [in,out] | e | earfcn struct

Returns
  number of bits

References osmo_earfcn_bit_size_ext().

## osmo_earfcn_bit_size_ext()

size_t osmo_earfcn_bit_size_ext | ( | const struct osmo_earfcn_si2q * | e,
|  | size_t | offset
| ) |  |

Return number of bits necessary to represent earfcn struct as Repeated E-UTRAN Neighbour Cells IE from 3GPP TS 44.018 Table 10.5.2.33b.1.

Parameters

  [in,out] | e | earfcn struct
  [in] | offset | into earfcn struct: how many EARFCNs to skip while estimating size

Returns
  number of bits

References osmo_earfcn_si2q::arfcn, osmo_earfcn_si2q::length, osmo_earfcn_si2q::meas_bw, OSMO_EARFCN_INVALID, OSMO_EARFCN_MEAS_INVALID, osmo_earfcn_si2q::prio_valid, osmo_earfcn_si2q::qrxlm_valid, and osmo_earfcn_si2q::thresh_lo_valid.

Referenced by osmo_earfcn_bit_size().

## osmo_earfcn_del()

int osmo_earfcn_del | ( | struct osmo_earfcn_si2q * | e,
|  | uint16_t | arfcn
| ) |  |

Delete arfcn (and corresponding measurement bandwith) from earfcn struct.

Parameters

  [in,out] | e | earfcn struct
  [in] | arfcn | EARFCN value, 16 bits

Returns
  0 on success, error otherwise

References osmo_earfcn_si2q::arfcn, osmo_earfcn_si2q::length, osmo_earfcn_si2q::meas_bw, OSMO_EARFCN_INVALID, and OSMO_EARFCN_MEAS_INVALID.

## osmo_earfcn_init()

void osmo_earfcn_init | ( | struct osmo_earfcn_si2q * | e | ) |

Initialize earfcn struct.

Parameters

  [in,out] | e | earfcn struct

References osmo_earfcn_si2q::arfcn, osmo_earfcn_si2q::length, osmo_earfcn_si2q::meas_bw, OSMO_EARFCN_INVALID, and OSMO_EARFCN_MEAS_INVALID.

## osmo_rsl2sitype()

enum osmo_sysinfo_type osmo_rsl2sitype | ( | uint8_t | rsl_si | ) |

References rsl2sitype.

## osmo_sitype2rsl()

uint8_t osmo_sitype2rsl | ( | enum osmo_sysinfo_type | si_type | ) |

References sitype2rsl.

## osmo_static_assert() [1/9]

osmo_static_assert | ( | sizeof(struct gsm48_rach_control) | = `=3`,
|  | _si_rach_control |
| ) |  |

## osmo_static_assert() [2/9]

osmo_static_assert | ( | sizeof(struct gsm48_system_information_type_1) | = `=22`,
|  | _si1_size |
| ) |  |

## osmo_static_assert() [3/9]

osmo_static_assert | ( | sizeof(struct gsm48_system_information_type_13) | = `=3`,
|  | _si13_size |
| ) |  |

## osmo_static_assert() [4/9]

osmo_static_assert | ( | sizeof(struct gsm48_system_information_type_2) | = `=23`,
|  | _si2_size |
| ) |  |

## osmo_static_assert() [5/9]

osmo_static_assert | ( | sizeof(struct gsm48_system_information_type_3) | = `=19`,
|  | _si3_size |
| ) |  |

## osmo_static_assert() [6/9]

osmo_static_assert | ( | sizeof(struct gsm48_system_information_type_4) | = `=13`,
|  | _si4_size |
| ) |  |

## osmo_static_assert() [7/9]

osmo_static_assert | ( | sizeof(struct gsm48_system_information_type_5) | = `=18`,
|  | _si5_size |
| ) |  |

## osmo_static_assert() [8/9]

osmo_static_assert | ( | sizeof(struct gsm48_system_information_type_6) | = `=11`,
|  | _si6_size |
| ) |  |

## osmo_static_assert() [9/9]

osmo_static_assert | ( | sizeof(struct gsm48_system_information_type_header) | = `=3`,
|  | _si_header_size |
| ) |  |

## Variable Documentation

## osmo_sitype_strs

const struct value_string osmo_sitype_strs[_MAX_SYSINFO_TYPE]

Initial value:
= {
{ SYSINFO_TYPE_1, "1" },
{ SYSINFO_TYPE_2, "2" },
{ SYSINFO_TYPE_3, "3" },
{ SYSINFO_TYPE_4, "4" },
{ SYSINFO_TYPE_5, "5" },
{ SYSINFO_TYPE_6, "6" },
{ SYSINFO_TYPE_7, "7" },
{ SYSINFO_TYPE_8, "8" },
{ SYSINFO_TYPE_9, "9" },
{ SYSINFO_TYPE_10, "10" },
{ SYSINFO_TYPE_13, "13" },
{ SYSINFO_TYPE_16, "16" },
{ SYSINFO_TYPE_17, "17" },
{ SYSINFO_TYPE_18, "18" },
{ SYSINFO_TYPE_19, "19" },
{ SYSINFO_TYPE_20, "20" },
{ SYSINFO_TYPE_2bis, "2bis" },
{ SYSINFO_TYPE_2ter, "2ter" },
{ SYSINFO_TYPE_2quater, "2quater" },
{ SYSINFO_TYPE_5bis, "5bis" },
{ SYSINFO_TYPE_5ter, "5ter" },
{ SYSINFO_TYPE_EMO, "EMO" },
{ SYSINFO_TYPE_MEAS_INFO, "MI" },
{ 0, NULL }
}

## rsl2sitype

const uint8_t rsl2sitype[256]

static

Initial value:
= {
[RSL_SYSTEM_INFO_1] = SYSINFO_TYPE_1,
[RSL_SYSTEM_INFO_2] = SYSINFO_TYPE_2,
[RSL_SYSTEM_INFO_3] = SYSINFO_TYPE_3,
[RSL_SYSTEM_INFO_4] = SYSINFO_TYPE_4,
[RSL_SYSTEM_INFO_5] = SYSINFO_TYPE_5,
[RSL_SYSTEM_INFO_6] = SYSINFO_TYPE_6,
[RSL_SYSTEM_INFO_7] = SYSINFO_TYPE_7,
[RSL_SYSTEM_INFO_8] = SYSINFO_TYPE_8,
[RSL_SYSTEM_INFO_9] = SYSINFO_TYPE_9,
[RSL_SYSTEM_INFO_10] = SYSINFO_TYPE_10,
[RSL_SYSTEM_INFO_13] = SYSINFO_TYPE_13,
[RSL_SYSTEM_INFO_16] = SYSINFO_TYPE_16,
[RSL_SYSTEM_INFO_17] = SYSINFO_TYPE_17,
[RSL_SYSTEM_INFO_18] = SYSINFO_TYPE_18,
[RSL_SYSTEM_INFO_19] = SYSINFO_TYPE_19,
[RSL_SYSTEM_INFO_20] = SYSINFO_TYPE_20,
[RSL_SYSTEM_INFO_2bis] = SYSINFO_TYPE_2bis,
[RSL_SYSTEM_INFO_2ter] = SYSINFO_TYPE_2ter,
[RSL_SYSTEM_INFO_2quater] = SYSINFO_TYPE_2quater,
[RSL_SYSTEM_INFO_5bis] = SYSINFO_TYPE_5bis,
[RSL_SYSTEM_INFO_5ter] = SYSINFO_TYPE_5ter,
[RSL_EXT_MEAS_ORDER] = SYSINFO_TYPE_EMO,
[RSL_MEAS_INFO] = SYSINFO_TYPE_MEAS_INFO,
}

Referenced by osmo_rsl2sitype().

## sitype2rsl

const uint8_t sitype2rsl[_MAX_SYSINFO_TYPE]

static

Initial value:
= {
[SYSINFO_TYPE_1] = RSL_SYSTEM_INFO_1,
[SYSINFO_TYPE_2] = RSL_SYSTEM_INFO_2,
[SYSINFO_TYPE_3] = RSL_SYSTEM_INFO_3,
[SYSINFO_TYPE_4] = RSL_SYSTEM_INFO_4,
[SYSINFO_TYPE_5] = RSL_SYSTEM_INFO_5,
[SYSINFO_TYPE_6] = RSL_SYSTEM_INFO_6,
[SYSINFO_TYPE_7] = RSL_SYSTEM_INFO_7,
[SYSINFO_TYPE_8] = RSL_SYSTEM_INFO_8,
[SYSINFO_TYPE_9] = RSL_SYSTEM_INFO_9,
[SYSINFO_TYPE_10] = RSL_SYSTEM_INFO_10,
[SYSINFO_TYPE_13] = RSL_SYSTEM_INFO_13,
[SYSINFO_TYPE_16] = RSL_SYSTEM_INFO_16,
[SYSINFO_TYPE_17] = RSL_SYSTEM_INFO_17,
[SYSINFO_TYPE_18] = RSL_SYSTEM_INFO_18,
[SYSINFO_TYPE_19] = RSL_SYSTEM_INFO_19,
[SYSINFO_TYPE_20] = RSL_SYSTEM_INFO_20,
[SYSINFO_TYPE_2bis] = RSL_SYSTEM_INFO_2bis,
[SYSINFO_TYPE_2ter] = RSL_SYSTEM_INFO_2ter,
[SYSINFO_TYPE_2quater] = RSL_SYSTEM_INFO_2quater,
[SYSINFO_TYPE_5bis] = RSL_SYSTEM_INFO_5bis,
[SYSINFO_TYPE_5ter] = RSL_SYSTEM_INFO_5ter,
[SYSINFO_TYPE_EMO] = RSL_EXT_MEAS_ORDER,
[SYSINFO_TYPE_MEAS_INFO]= RSL_MEAS_INFO,
}

Referenced by osmo_sitype2rsl().

SYSINFO_TYPE_MEAS_INFO
@ SYSINFO_TYPE_MEAS_INFO
Definition: sysinfo.h:38
RSL_EXT_MEAS_ORDER
#define RSL_EXT_MEAS_ORDER
Definition: gsm_08_58.h:527
SYSINFO_TYPE_13
@ SYSINFO_TYPE_13
Definition: sysinfo.h:26
SYSINFO_TYPE_2ter
@ SYSINFO_TYPE_2ter
Definition: sysinfo.h:33
RSL_SYSTEM_INFO_5ter
#define RSL_SYSTEM_INFO_5ter
Definition: gsm_08_58.h:525
SYSINFO_TYPE_17
@ SYSINFO_TYPE_17
Definition: sysinfo.h:28
RSL_SYSTEM_INFO_9
#define RSL_SYSTEM_INFO_9
Definition: gsm_08_58.h:532
RSL_SYSTEM_INFO_5bis
#define RSL_SYSTEM_INFO_5bis
Definition: gsm_08_58.h:524
RSL_MEAS_INFO
#define RSL_MEAS_INFO
Definition: gsm_08_58.h:528
SYSINFO_TYPE_16
@ SYSINFO_TYPE_16
Definition: sysinfo.h:27
RSL_SYSTEM_INFO_6
#define RSL_SYSTEM_INFO_6
Definition: gsm_08_58.h:518
RSL_SYSTEM_INFO_20
#define RSL_SYSTEM_INFO_20
Definition: gsm_08_58.h:535
SYSINFO_TYPE_EMO
@ SYSINFO_TYPE_EMO
Definition: sysinfo.h:37
RSL_SYSTEM_INFO_8
#define RSL_SYSTEM_INFO_8
Definition: gsm_08_58.h:512
SYSINFO_TYPE_8
@ SYSINFO_TYPE_8
Definition: sysinfo.h:23
RSL_SYSTEM_INFO_2
#define RSL_SYSTEM_INFO_2
Definition: gsm_08_58.h:514
SYSINFO_TYPE_7
@ SYSINFO_TYPE_7
Definition: sysinfo.h:22
SYSINFO_TYPE_2bis
@ SYSINFO_TYPE_2bis
Definition: sysinfo.h:32
RSL_SYSTEM_INFO_18
#define RSL_SYSTEM_INFO_18
Definition: gsm_08_58.h:533
SYSINFO_TYPE_6
@ SYSINFO_TYPE_6
Definition: sysinfo.h:21
SYSINFO_TYPE_10
@ SYSINFO_TYPE_10
Definition: sysinfo.h:25
RSL_SYSTEM_INFO_2bis
#define RSL_SYSTEM_INFO_2bis
Definition: gsm_08_58.h:522
SYSINFO_TYPE_18
@ SYSINFO_TYPE_18
Definition: sysinfo.h:29
RSL_SYSTEM_INFO_13
#define RSL_SYSTEM_INFO_13
Definition: gsm_08_58.h:529
SYSINFO_TYPE_19
@ SYSINFO_TYPE_19
Definition: sysinfo.h:30
SYSINFO_TYPE_1
@ SYSINFO_TYPE_1
Definition: sysinfo.h:16
RSL_SYSTEM_INFO_19
#define RSL_SYSTEM_INFO_19
Definition: gsm_08_58.h:534
SYSINFO_TYPE_20
@ SYSINFO_TYPE_20
Definition: sysinfo.h:31
SYSINFO_TYPE_3
@ SYSINFO_TYPE_3
Definition: sysinfo.h:18
RSL_SYSTEM_INFO_7
#define RSL_SYSTEM_INFO_7
Definition: gsm_08_58.h:519
SYSINFO_TYPE_2quater
@ SYSINFO_TYPE_2quater
Definition: sysinfo.h:34
RSL_SYSTEM_INFO_5
#define RSL_SYSTEM_INFO_5
Definition: gsm_08_58.h:517
RSL_SYSTEM_INFO_3
#define RSL_SYSTEM_INFO_3
Definition: gsm_08_58.h:515
SYSINFO_TYPE_5
@ SYSINFO_TYPE_5
Definition: sysinfo.h:20
RSL_SYSTEM_INFO_2ter
#define RSL_SYSTEM_INFO_2ter
Definition: gsm_08_58.h:523
RSL_SYSTEM_INFO_1
#define RSL_SYSTEM_INFO_1
Definition: gsm_08_58.h:513
RSL_SYSTEM_INFO_10
#define RSL_SYSTEM_INFO_10
Definition: gsm_08_58.h:526
SYSINFO_TYPE_2
@ SYSINFO_TYPE_2
Definition: sysinfo.h:17
SYSINFO_TYPE_5ter
@ SYSINFO_TYPE_5ter
Definition: sysinfo.h:36
SYSINFO_TYPE_5bis
@ SYSINFO_TYPE_5bis
Definition: sysinfo.h:35
RSL_SYSTEM_INFO_16
#define RSL_SYSTEM_INFO_16
Definition: gsm_08_58.h:520
RSL_SYSTEM_INFO_2quater
#define RSL_SYSTEM_INFO_2quater
Definition: gsm_08_58.h:531
RSL_SYSTEM_INFO_17
#define RSL_SYSTEM_INFO_17
Definition: gsm_08_58.h:521
SYSINFO_TYPE_9
@ SYSINFO_TYPE_9
Definition: sysinfo.h:24
RSL_SYSTEM_INFO_4
#define RSL_SYSTEM_INFO_4
Definition: gsm_08_58.h:516
SYSINFO_TYPE_4
@ SYSINFO_TYPE_4
Definition: sysinfo.h:19