#pragma once #include #include #include #include struct hnbgw_context_map; enum hnbgw_cnpool_ctr { /* TODO: basic counters completely missing * ... */ /* Counters related to link selection from a CN pool. */ CNPOOL_CTR_SUBSCR_NO_CNLINK, CNPOOL_CTR_EMERG_FORWARDED, CNPOOL_CTR_EMERG_LOST, }; #define CNPOOL_CTR_INC(cnpool, x) rate_ctr_inc2((cnpool)->ctrs, x) /* User provided configuration for struct hnbgw_cnpool. */ struct hnbgw_cnpool_cfg { uint8_t nri_bitlen; struct osmo_nri_ranges *null_nri_ranges; }; /* Collection of CN peers to distribute UE connections across. MSCs for DOMAIN_CS, SGSNs for DOMAIN_PS. */ struct hnbgw_cnpool { RANAP_CN_DomainIndicator_t domain; /* CN pool string used in VTY config and logging, "iucs" or "iups". */ const char *pool_name; /* CN peer string used in VTY config and logging, "msc" or "sgsn". */ const char *peer_name; /* What we use as the remote MSC/SGSN point-code if the user does not configure any address. */ uint32_t default_remote_pc; const char *default_addr_name; struct hnbgw_cnpool_cfg vty; struct hnbgw_cnpool_cfg use; /* List of struct hnbgw_cnlink */ struct llist_head cnlinks; unsigned int round_robin_next_nr; /* Emergency calls potentially select a different set of MSCs, so to not mess up the normal round-robin * behavior, emergency calls need a separate round-robin counter. */ unsigned int round_robin_next_emerg_nr; /* Running counters for this pool */ struct rate_ctr_group *ctrs; }; struct hnbgw_cnpool *hnbgw_cnpool_alloc(RANAP_CN_DomainIndicator_t domain); struct hnbgw_cnlink *hnbgw_cnlink_select(struct hnbgw_context_map *map); void hnbgw_cnpool_start(struct hnbgw_cnpool *cnpool); void hnbgw_cnpool_cnlinks_start_or_restart(struct hnbgw_cnpool *cnpool); struct hnbgw_cnlink *cnlink_get_nr(struct hnbgw_cnpool *cnpool, int nr, bool create_if_missing); void hnbgw_cnpool_apply_cfg(struct hnbgw_cnpool *cnpool);