blob: aa3827635750bd0a1d21d07f2640238d97ac144e [file] [log] [blame]
Neels Hofmeyr19bed232018-03-22 04:54:57 +01001/* Manage identity of neighboring BSS cells for inter-BSC handover */
2#pragma once
3
4#include <stdint.h>
5#include <stdbool.h>
6
7#include <osmocom/core/linuxlist.h>
8
9struct vty;
10struct gsm_network;
11struct gsm_bts;
12struct neighbor_ident_list;
13struct gsm0808_cell_id_list2;
14
Neels Hofmeyr19bed232018-03-22 04:54:57 +010015#define NEIGHBOR_IDENT_KEY_ANY_BTS -1
16
Neels Hofmeyr431e0852018-03-22 04:54:57 +010017#define BSIC_ANY 0xff
18
Neels Hofmeyr19bed232018-03-22 04:54:57 +010019struct neighbor_ident_key {
20 int from_bts; /*< BTS nr 0..255 or NEIGHBOR_IDENT_KEY_ANY_BTS */
21 uint16_t arfcn;
Neels Hofmeyr431e0852018-03-22 04:54:57 +010022 uint8_t bsic;
Neels Hofmeyr19bed232018-03-22 04:54:57 +010023};
24
25const char *neighbor_ident_key_name(const struct neighbor_ident_key *ni_key);
26
27struct neighbor_ident_list *neighbor_ident_init(void *talloc_ctx);
28void neighbor_ident_free(struct neighbor_ident_list *nil);
29
30bool neighbor_ident_key_match(const struct neighbor_ident_key *entry,
31 const struct neighbor_ident_key *search_for,
32 bool exact_match);
33
34int neighbor_ident_add(struct neighbor_ident_list *nil, const struct neighbor_ident_key *key,
35 const struct gsm0808_cell_id_list2 *val);
36const struct gsm0808_cell_id_list2 *neighbor_ident_get(const struct neighbor_ident_list *nil,
37 const struct neighbor_ident_key *key);
38bool neighbor_ident_del(struct neighbor_ident_list *nil, const struct neighbor_ident_key *key);
39void neighbor_ident_clear(struct neighbor_ident_list *nil);
40
41void neighbor_ident_iter(const struct neighbor_ident_list *nil,
42 bool (* iter_cb )(const struct neighbor_ident_key *key,
43 const struct gsm0808_cell_id_list2 *val,
44 void *cb_data),
45 void *cb_data);
46
47void neighbor_ident_vty_init(struct gsm_network *net, struct neighbor_ident_list *nil);
48void neighbor_ident_vty_write(struct vty *vty, const char *indent, struct gsm_bts *bts);
49
Neels Hofmeyr91a202d2019-07-13 01:12:53 +020050bool neighbor_ident_bts_entry_exists(uint8_t from_bts);
51
Neels Hofmeyr431e0852018-03-22 04:54:57 +010052#define NEIGHBOR_IDENT_VTY_KEY_PARAMS "arfcn <0-1023> bsic (<0-63>|any)"
Neels Hofmeyr19bed232018-03-22 04:54:57 +010053#define NEIGHBOR_IDENT_VTY_KEY_DOC \
54 "ARFCN of neighbor cell\n" "ARFCN value\n" \
Neels Hofmeyr431e0852018-03-22 04:54:57 +010055 "BSIC of neighbor cell\n" "BSIC value\n" \
Neels Hofmeyr19bed232018-03-22 04:54:57 +010056 "for all BSICs / use any BSIC in this ARFCN\n"
57bool neighbor_ident_vty_parse_key_params(struct vty *vty, const char **argv,
58 struct neighbor_ident_key *key);
59bool neighbor_ident_bts_parse_key_params(struct vty *vty, struct gsm_bts *bts, const char **argv,
60 struct neighbor_ident_key *key);