blob: 8cd74ab571235042357e7ac34fc7c89a077f2d59 [file] [log] [blame]
Neels Hofmeyrc4628a32018-12-07 14:47:34 +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#include <osmocom/gsm/gsm0808.h>
9#include <osmocom/sigtran/sccp_sap.h>
10
11struct vty;
12struct gsm_network;
13
14enum msc_neighbor_type {
15 MSC_NEIGHBOR_TYPE_NONE = 0,
16 MSC_NEIGHBOR_TYPE_LOCAL_RAN_PEER,
17 MSC_NEIGHBOR_TYPE_REMOTE_MSC,
18};
19
20struct msc_ipa_name {
21 char buf[64];
22 size_t len;
23};
24
25int msc_ipa_name_from_str(struct msc_ipa_name *min, const char *name);
26int msc_ipa_name_cmp(const struct msc_ipa_name *a, const struct msc_ipa_name *b);
27
28struct neighbor_ident_addr {
29 enum osmo_rat_type ran_type;
30 enum msc_neighbor_type type;
31 union {
32 char local_ran_peer_pc_str[23];
33 struct msc_ipa_name remote_msc_ipa_name;
34 };
35};
36
37struct neighbor_ident_entry {
38 struct llist_head entry;
39
40 struct neighbor_ident_addr addr;
41
42 /* A list of struct cell_ids_entry. A gsm0808_cell_id_list2 would in principle suffice, but to support
43 * storing more than 127 cell ids and to allow storing IDs of differing types, have a list of any number of
44 * gsm0808_cell_id_list2. */
45 struct llist_head cell_ids;
46};
47
48void neighbor_ident_init(struct gsm_network *net);
49const char *neighbor_ident_addr_name(const struct neighbor_ident_addr *nia);
50
51const struct neighbor_ident_entry *neighbor_ident_add(struct llist_head *ni_list,
52 const struct neighbor_ident_addr *nia,
53 const struct gsm0808_cell_id *cid);
54
55const struct neighbor_ident_entry *neighbor_ident_find_by_cell(const struct llist_head *ni_list,
56 enum osmo_rat_type ran_type,
57 const struct gsm0808_cell_id *cell_id);
58
59const struct neighbor_ident_entry *neighbor_ident_find_by_addr(const struct llist_head *ni_list,
60 const struct neighbor_ident_addr *nia);
61
62void neighbor_ident_del(const struct neighbor_ident_entry *nie);
63
64void neighbor_ident_clear(struct llist_head *ni_list);
65
66void neighbor_ident_vty_init(struct gsm_network *net);
67void neighbor_ident_vty_write(struct vty *vty);
68