Neels Hofmeyr | 19bed23 | 2018-03-22 04:54:57 +0100 | [diff] [blame] | 1 | /* 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 | |
| 9 | struct vty; |
| 10 | struct gsm_network; |
| 11 | struct gsm_bts; |
| 12 | struct neighbor_ident_list; |
| 13 | struct gsm0808_cell_id_list2; |
| 14 | |
Neels Hofmeyr | 19bed23 | 2018-03-22 04:54:57 +0100 | [diff] [blame] | 15 | #define NEIGHBOR_IDENT_KEY_ANY_BTS -1 |
| 16 | |
Neels Hofmeyr | 431e085 | 2018-03-22 04:54:57 +0100 | [diff] [blame] | 17 | #define BSIC_ANY 0xff |
| 18 | |
Neels Hofmeyr | 19bed23 | 2018-03-22 04:54:57 +0100 | [diff] [blame] | 19 | struct neighbor_ident_key { |
| 20 | int from_bts; /*< BTS nr 0..255 or NEIGHBOR_IDENT_KEY_ANY_BTS */ |
| 21 | uint16_t arfcn; |
Neels Hofmeyr | 431e085 | 2018-03-22 04:54:57 +0100 | [diff] [blame] | 22 | uint8_t bsic; |
Neels Hofmeyr | 19bed23 | 2018-03-22 04:54:57 +0100 | [diff] [blame] | 23 | }; |
| 24 | |
| 25 | const char *neighbor_ident_key_name(const struct neighbor_ident_key *ni_key); |
| 26 | |
| 27 | struct neighbor_ident_list *neighbor_ident_init(void *talloc_ctx); |
| 28 | void neighbor_ident_free(struct neighbor_ident_list *nil); |
| 29 | |
| 30 | bool neighbor_ident_key_match(const struct neighbor_ident_key *entry, |
| 31 | const struct neighbor_ident_key *search_for, |
| 32 | bool exact_match); |
| 33 | |
| 34 | int neighbor_ident_add(struct neighbor_ident_list *nil, const struct neighbor_ident_key *key, |
| 35 | const struct gsm0808_cell_id_list2 *val); |
| 36 | const struct gsm0808_cell_id_list2 *neighbor_ident_get(const struct neighbor_ident_list *nil, |
| 37 | const struct neighbor_ident_key *key); |
| 38 | bool neighbor_ident_del(struct neighbor_ident_list *nil, const struct neighbor_ident_key *key); |
| 39 | void neighbor_ident_clear(struct neighbor_ident_list *nil); |
| 40 | |
| 41 | void 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 | |
| 47 | void neighbor_ident_vty_init(struct gsm_network *net, struct neighbor_ident_list *nil); |
| 48 | void neighbor_ident_vty_write(struct vty *vty, const char *indent, struct gsm_bts *bts); |
| 49 | |
Neels Hofmeyr | 431e085 | 2018-03-22 04:54:57 +0100 | [diff] [blame] | 50 | #define NEIGHBOR_IDENT_VTY_KEY_PARAMS "arfcn <0-1023> bsic (<0-63>|any)" |
Neels Hofmeyr | 19bed23 | 2018-03-22 04:54:57 +0100 | [diff] [blame] | 51 | #define NEIGHBOR_IDENT_VTY_KEY_DOC \ |
| 52 | "ARFCN of neighbor cell\n" "ARFCN value\n" \ |
Neels Hofmeyr | 431e085 | 2018-03-22 04:54:57 +0100 | [diff] [blame] | 53 | "BSIC of neighbor cell\n" "BSIC value\n" \ |
Neels Hofmeyr | 19bed23 | 2018-03-22 04:54:57 +0100 | [diff] [blame] | 54 | "for all BSICs / use any BSIC in this ARFCN\n" |
| 55 | bool neighbor_ident_vty_parse_key_params(struct vty *vty, const char **argv, |
| 56 | struct neighbor_ident_key *key); |
| 57 | bool neighbor_ident_bts_parse_key_params(struct vty *vty, struct gsm_bts *bts, const char **argv, |
| 58 | struct neighbor_ident_key *key); |