Alexander Couzens | 6a16149 | 2020-07-12 13:45:50 +0200 | [diff] [blame] | 1 | /*! \file gprs_ns2_internal.h */ |
| 2 | |
| 3 | #pragma once |
| 4 | |
| 5 | #include <stdbool.h> |
| 6 | #include <stdint.h> |
| 7 | |
| 8 | #include <osmocom/gprs/protocol/gsm_08_16.h> |
| 9 | #include <osmocom/gprs/gprs_ns2.h> |
| 10 | |
Harald Welte | f294974 | 2021-01-20 14:54:14 +0100 | [diff] [blame] | 11 | #define LOGNSE(nse, lvl, fmt, args ...) \ |
| 12 | LOGP(DLNS, lvl, "NSE(%05u) " fmt, (nse)->nsei, ## args) |
| 13 | |
| 14 | #define LOGBIND(bind, lvl, fmt, args ...) \ |
| 15 | LOGP(DLNS, lvl, "BIND(%s) " fmt, (bind)->name, ## args) |
| 16 | |
| 17 | |
| 18 | #define LOGNSVC(nsvc, lvl, fmt, args ...) \ |
| 19 | do { \ |
| 20 | if ((nsvc)->nsvci_is_valid) { \ |
| 21 | LOGP(DLNS, lvl, "NSE(%05u)-NSVC(%05u) " fmt, \ |
| 22 | (nsvc)->nse->nsei, (nsvc)->nsvci, ## args); \ |
| 23 | } else { \ |
| 24 | LOGP(DLNS, lvl, "NSE(%05u)-NSVC(none) " fmt, \ |
| 25 | (nsvc)->nse->nsei, ## args); \ |
| 26 | } \ |
| 27 | } while (0) |
| 28 | |
Alexander Couzens | 6a16149 | 2020-07-12 13:45:50 +0200 | [diff] [blame] | 29 | struct osmo_fsm_inst; |
| 30 | struct tlv_parsed; |
| 31 | struct vty; |
| 32 | |
| 33 | struct gprs_ns2_vc_driver; |
| 34 | struct gprs_ns2_vc_bind; |
| 35 | |
Alexander Couzens | 90ee963 | 2020-12-07 06:18:32 +0100 | [diff] [blame] | 36 | #define NS_TIMERS_COUNT 10 |
Harald Welte | 3a44d17 | 2020-12-16 12:02:51 +0100 | [diff] [blame] | 37 | #define NS_TIMERS "(tns-block|tns-block-retries|tns-reset|tns-reset-retries|tns-test|tns-alive|tns-alive-retries|tsns-prov|tsns-size-retries|tsns-config-retries)" |
Alexander Couzens | 6a16149 | 2020-07-12 13:45:50 +0200 | [diff] [blame] | 38 | #define NS_TIMERS_HELP \ |
| 39 | "(un)blocking Timer (Tns-block) timeout\n" \ |
| 40 | "(un)blocking Timer (Tns-block) number of retries\n" \ |
| 41 | "Reset Timer (Tns-reset) timeout\n" \ |
| 42 | "Reset Timer (Tns-reset) number of retries\n" \ |
| 43 | "Test Timer (Tns-test) timeout\n" \ |
| 44 | "Alive Timer (Tns-alive) timeout\n" \ |
| 45 | "Alive Timer (Tns-alive) number of retries\n" \ |
Alexander Couzens | 90ee963 | 2020-12-07 06:18:32 +0100 | [diff] [blame] | 46 | "SNS Provision Timer (Tsns-prov) timeout\n" \ |
| 47 | "SNS Size number of retries\n" \ |
| 48 | "SNS Config number of retries\n" \ |
Alexander Couzens | 6a16149 | 2020-07-12 13:45:50 +0200 | [diff] [blame] | 49 | |
| 50 | /* Educated guess - LLC user payload is 1500 bytes plus possible headers */ |
| 51 | #define NS_ALLOC_SIZE 3072 |
| 52 | #define NS_ALLOC_HEADROOM 20 |
| 53 | |
| 54 | enum ns2_timeout { |
| 55 | NS_TOUT_TNS_BLOCK, |
| 56 | NS_TOUT_TNS_BLOCK_RETRIES, |
| 57 | NS_TOUT_TNS_RESET, |
| 58 | NS_TOUT_TNS_RESET_RETRIES, |
| 59 | NS_TOUT_TNS_TEST, |
| 60 | NS_TOUT_TNS_ALIVE, |
| 61 | NS_TOUT_TNS_ALIVE_RETRIES, |
| 62 | NS_TOUT_TSNS_PROV, |
Alexander Couzens | 90ee963 | 2020-12-07 06:18:32 +0100 | [diff] [blame] | 63 | NS_TOUT_TSNS_SIZE_RETRIES, |
| 64 | NS_TOUT_TSNS_CONFIG_RETRIES, |
Alexander Couzens | 6a16149 | 2020-07-12 13:45:50 +0200 | [diff] [blame] | 65 | }; |
| 66 | |
| 67 | enum nsvc_timer_mode { |
| 68 | /* standard timers */ |
| 69 | NSVC_TIMER_TNS_TEST, |
| 70 | NSVC_TIMER_TNS_ALIVE, |
| 71 | NSVC_TIMER_TNS_RESET, |
| 72 | _NSVC_TIMER_NR, |
| 73 | }; |
| 74 | |
| 75 | enum ns_stat { |
| 76 | NS_STAT_ALIVE_DELAY, |
| 77 | }; |
| 78 | |
Alexander Couzens | 6a16149 | 2020-07-12 13:45:50 +0200 | [diff] [blame] | 79 | /*! Osmocom NS2 VC create status */ |
Alexander Couzens | ba5a992 | 2021-01-25 16:03:23 +0100 | [diff] [blame] | 80 | enum ns2_cs { |
| 81 | NS2_CS_CREATED, /*!< A NSVC object has been created */ |
| 82 | NS2_CS_FOUND, /*!< A NSVC object has been found */ |
| 83 | NS2_CS_REJECTED, /*!< Rejected and answered message */ |
| 84 | NS2_CS_SKIPPED, /*!< Skipped message */ |
| 85 | NS2_CS_ERROR, /*!< Failed to process message */ |
Alexander Couzens | 6a16149 | 2020-07-12 13:45:50 +0200 | [diff] [blame] | 86 | }; |
| 87 | |
Harald Welte | 3d5eaee | 2021-01-30 21:33:02 +0100 | [diff] [blame] | 88 | enum ns_ctr { |
| 89 | NS_CTR_PKTS_IN, |
| 90 | NS_CTR_PKTS_OUT, |
| 91 | NS_CTR_BYTES_IN, |
| 92 | NS_CTR_BYTES_OUT, |
| 93 | NS_CTR_BLOCKED, |
| 94 | NS_CTR_DEAD, |
| 95 | NS_CTR_REPLACED, |
| 96 | NS_CTR_NSEI_CHG, |
| 97 | NS_CTR_INV_VCI, |
| 98 | NS_CTR_INV_NSEI, |
| 99 | NS_CTR_LOST_ALIVE, |
| 100 | NS_CTR_LOST_RESET, |
| 101 | }; |
Alexander Couzens | 6a16149 | 2020-07-12 13:45:50 +0200 | [diff] [blame] | 102 | |
| 103 | #define NSE_S_BLOCKED 0x0001 |
| 104 | #define NSE_S_ALIVE 0x0002 |
| 105 | #define NSE_S_RESET 0x0004 |
| 106 | |
| 107 | #define NS_DESC_B(st) ((st) & NSE_S_BLOCKED ? "BLOCKED" : "UNBLOCKED") |
| 108 | #define NS_DESC_A(st) ((st) & NSE_S_ALIVE ? "ALIVE" : "DEAD") |
| 109 | #define NS_DESC_R(st) ((st) & NSE_S_RESET ? "RESET" : "UNRESET") |
| 110 | |
| 111 | /*! An instance of the NS protocol stack */ |
| 112 | struct gprs_ns2_inst { |
| 113 | /*! callback to the user for incoming UNIT DATA IND */ |
| 114 | osmo_prim_cb cb; |
| 115 | |
| 116 | /*! callback data */ |
| 117 | void *cb_data; |
| 118 | |
| 119 | /*! linked lists of all NSVC binds (e.g. IPv4 bind, but could be also E1 */ |
| 120 | struct llist_head binding; |
| 121 | |
| 122 | /*! linked lists of all NSVC in this instance */ |
| 123 | struct llist_head nse; |
| 124 | |
Alexander Couzens | 6a16149 | 2020-07-12 13:45:50 +0200 | [diff] [blame] | 125 | uint16_t timeout[NS_TIMERS_COUNT]; |
| 126 | |
| 127 | /*! workaround for rate counter until rate counter accepts char str as index */ |
| 128 | uint32_t rate_ctr_idx; |
Harald Welte | 53a2fde | 2020-12-01 22:21:14 +0100 | [diff] [blame] | 129 | |
| 130 | /*! libmnl netlink socket for link state monitoring */ |
| 131 | struct osmo_mnl *linkmon_mnl; |
Alexander Couzens | 6a16149 | 2020-07-12 13:45:50 +0200 | [diff] [blame] | 132 | }; |
| 133 | |
Harald Welte | 53a2fde | 2020-12-01 22:21:14 +0100 | [diff] [blame] | 134 | |
Alexander Couzens | 6a16149 | 2020-07-12 13:45:50 +0200 | [diff] [blame] | 135 | /*! Structure repesenting a NSE. The BSS/PCU will only have a single NSE, while SGSN has one for each BSS/PCU */ |
| 136 | struct gprs_ns2_nse { |
| 137 | uint16_t nsei; |
| 138 | |
| 139 | /*! entry back to ns2_inst */ |
| 140 | struct gprs_ns2_inst *nsi; |
| 141 | |
| 142 | /*! llist entry for gprs_ns2_inst */ |
| 143 | struct llist_head list; |
| 144 | |
| 145 | /*! llist head to hold all nsvc */ |
| 146 | struct llist_head nsvc; |
| 147 | |
Alexander Couzens | 8a2a1a4 | 2020-12-26 18:00:17 +0100 | [diff] [blame] | 148 | /*! count all active NSVCs */ |
| 149 | int nsvc_count; |
Alexander Couzens | fc3dd1f | 2020-11-19 00:41:47 +0100 | [diff] [blame] | 150 | |
Alexander Couzens | 6a16149 | 2020-07-12 13:45:50 +0200 | [diff] [blame] | 151 | /*! true if this NSE was created by VTY or pcu socket) */ |
| 152 | bool persistent; |
| 153 | |
Alexander Couzens | da0a285 | 2020-10-01 23:24:07 +0200 | [diff] [blame] | 154 | /*! true if this NSE wasn't yet alive at all. |
| 155 | * Will be true after the first status ind with NS_AFF_CAUSE_RECOVERY */ |
| 156 | bool first; |
| 157 | |
Alexander Couzens | 6a16149 | 2020-07-12 13:45:50 +0200 | [diff] [blame] | 158 | /*! true if this NSE has at least one alive VC */ |
| 159 | bool alive; |
| 160 | |
Alexander Couzens | aac9016 | 2020-11-19 02:44:04 +0100 | [diff] [blame] | 161 | /*! which link-layer are we based on? */ |
| 162 | enum gprs_ns2_ll ll; |
| 163 | |
Alexander Couzens | d923cff | 2020-12-01 01:03:52 +0100 | [diff] [blame] | 164 | /*! which dialect does this NSE speaks? */ |
| 165 | enum gprs_ns2_dialect dialect; |
| 166 | |
Alexander Couzens | 6a16149 | 2020-07-12 13:45:50 +0200 | [diff] [blame] | 167 | struct osmo_fsm_inst *bss_sns_fi; |
Harald Welte | 3221f87 | 2021-01-18 14:58:51 +0100 | [diff] [blame] | 168 | |
| 169 | /*! sum of all the data weight of _active_ NS-VCs */ |
| 170 | uint32_t sum_data_weight; |
| 171 | |
| 172 | /*! sum of all the signalling weight of _active_ NS-VCs */ |
| 173 | uint32_t sum_sig_weight; |
Alexander Couzens | 6a16149 | 2020-07-12 13:45:50 +0200 | [diff] [blame] | 174 | }; |
| 175 | |
| 176 | /*! Structure representing a single NS-VC */ |
| 177 | struct gprs_ns2_vc { |
| 178 | /*! list of NS-VCs within NSE */ |
| 179 | struct llist_head list; |
| 180 | |
| 181 | /*! list of NS-VCs within bind, bind is the owner! */ |
| 182 | struct llist_head blist; |
| 183 | |
| 184 | /*! pointer to NS Instance */ |
| 185 | struct gprs_ns2_nse *nse; |
| 186 | |
| 187 | /*! pointer to NS VL bind. bind own the memory of this instance */ |
| 188 | struct gprs_ns2_vc_bind *bind; |
| 189 | |
| 190 | /*! true if this NS was created by VTY or pcu socket) */ |
| 191 | bool persistent; |
| 192 | |
| 193 | /*! uniquely identifies NS-VC if VC contains nsvci */ |
| 194 | uint16_t nsvci; |
| 195 | |
| 196 | /*! signalling weight. 0 = don't use for signalling (BVCI == 0)*/ |
| 197 | uint8_t sig_weight; |
| 198 | |
Alexander Couzens | fc3dd1f | 2020-11-19 00:41:47 +0100 | [diff] [blame] | 199 | /*! signalling packet counter for the load sharing function */ |
| 200 | uint8_t sig_counter; |
| 201 | |
| 202 | /*! data weight. 0 = don't use for user data (BVCI != 0) */ |
Alexander Couzens | 6a16149 | 2020-07-12 13:45:50 +0200 | [diff] [blame] | 203 | uint8_t data_weight; |
| 204 | |
| 205 | /*! can be used by the bind/driver of the virtual circuit. e.g. ipv4/ipv6/frgre/e1 */ |
| 206 | void *priv; |
| 207 | |
| 208 | bool nsvci_is_valid; |
| 209 | bool sns_only; |
| 210 | |
| 211 | struct rate_ctr_group *ctrg; |
| 212 | struct osmo_stat_item_group *statg; |
| 213 | |
Alexander Couzens | 6a16149 | 2020-07-12 13:45:50 +0200 | [diff] [blame] | 214 | enum gprs_ns2_vc_mode mode; |
| 215 | |
| 216 | struct osmo_fsm_inst *fi; |
| 217 | }; |
| 218 | |
| 219 | /*! Structure repesenting a bind instance. E.g. IPv4 listen port. */ |
| 220 | struct gprs_ns2_vc_bind { |
Alexander Couzens | aaa55a6 | 2020-12-03 06:02:03 +0100 | [diff] [blame] | 221 | /*! unique name */ |
| 222 | const char *name; |
Alexander Couzens | 6a16149 | 2020-07-12 13:45:50 +0200 | [diff] [blame] | 223 | /*! list entry in nsi */ |
| 224 | struct llist_head list; |
| 225 | /*! list of all VC */ |
| 226 | struct llist_head nsvc; |
| 227 | /*! driver private structure */ |
| 228 | void *priv; |
| 229 | /*! a pointer back to the nsi */ |
| 230 | struct gprs_ns2_inst *nsi; |
| 231 | struct gprs_ns2_vc_driver *driver; |
| 232 | |
Alexander Couzens | d923cff | 2020-12-01 01:03:52 +0100 | [diff] [blame] | 233 | bool accept_ipaccess; |
| 234 | bool accept_sns; |
Alexander Couzens | 6a16149 | 2020-07-12 13:45:50 +0200 | [diff] [blame] | 235 | |
Alexander Couzens | 1c8785d | 2020-12-17 06:58:53 +0100 | [diff] [blame] | 236 | /*! transfer capability in mbit */ |
| 237 | int transfer_capability; |
| 238 | |
Alexander Couzens | aac9016 | 2020-11-19 02:44:04 +0100 | [diff] [blame] | 239 | /*! which link-layer are we based on? */ |
| 240 | enum gprs_ns2_ll ll; |
| 241 | |
Alexander Couzens | 6a16149 | 2020-07-12 13:45:50 +0200 | [diff] [blame] | 242 | /*! send a msg over a VC */ |
| 243 | int (*send_vc)(struct gprs_ns2_vc *nsvc, struct msgb *msg); |
| 244 | |
| 245 | /*! free the vc priv data */ |
| 246 | void (*free_vc)(struct gprs_ns2_vc *nsvc); |
Alexander Couzens | 6a16149 | 2020-07-12 13:45:50 +0200 | [diff] [blame] | 247 | |
Alexander Couzens | 22f3471 | 2020-10-02 02:34:39 +0200 | [diff] [blame] | 248 | /*! allow to show information for the vty */ |
| 249 | void (*dump_vty)(const struct gprs_ns2_vc_bind *bind, |
| 250 | struct vty *vty, bool stats); |
| 251 | }; |
Alexander Couzens | 6a16149 | 2020-07-12 13:45:50 +0200 | [diff] [blame] | 252 | |
| 253 | struct gprs_ns2_vc_driver { |
| 254 | const char *name; |
| 255 | void *priv; |
| 256 | void (*free_bind)(struct gprs_ns2_vc_bind *driver); |
| 257 | }; |
| 258 | |
Alexander Couzens | ba5a992 | 2021-01-25 16:03:23 +0100 | [diff] [blame] | 259 | enum ns2_cs ns2_create_vc(struct gprs_ns2_vc_bind *bind, |
Alexander Couzens | 6a16149 | 2020-07-12 13:45:50 +0200 | [diff] [blame] | 260 | struct msgb *msg, |
| 261 | const char *logname, |
| 262 | struct msgb **reject, |
| 263 | struct gprs_ns2_vc **success); |
| 264 | |
Alexander Couzens | ffd49d0 | 2020-09-24 00:47:17 +0200 | [diff] [blame] | 265 | int ns2_recv_vc(struct gprs_ns2_vc *nsvc, |
Alexander Couzens | 6a16149 | 2020-07-12 13:45:50 +0200 | [diff] [blame] | 266 | struct msgb *msg); |
| 267 | |
| 268 | struct gprs_ns2_vc *ns2_vc_alloc(struct gprs_ns2_vc_bind *bind, |
| 269 | struct gprs_ns2_nse *nse, |
Alexander Couzens | d923cff | 2020-12-01 01:03:52 +0100 | [diff] [blame] | 270 | bool initiater, |
Harald Welte | 603f404 | 2020-11-29 17:39:19 +0100 | [diff] [blame] | 271 | enum gprs_ns2_vc_mode vc_mode, |
| 272 | const char *id); |
Alexander Couzens | 6a16149 | 2020-07-12 13:45:50 +0200 | [diff] [blame] | 273 | |
Alexander Couzens | 8dfc24c | 2021-01-25 16:09:23 +0100 | [diff] [blame] | 274 | struct msgb *ns2_msgb_alloc(void); |
Alexander Couzens | 6a16149 | 2020-07-12 13:45:50 +0200 | [diff] [blame] | 275 | |
Alexander Couzens | 8dfc24c | 2021-01-25 16:09:23 +0100 | [diff] [blame] | 276 | void ns2_sns_write_vty(struct vty *vty, const struct gprs_ns2_nse *nse); |
| 277 | void ns2_sns_dump_vty(struct vty *vty, const char *prefix, const struct gprs_ns2_nse *nse, bool stats); |
Alexander Couzens | bf95f0f | 2020-10-01 22:56:03 +0200 | [diff] [blame] | 278 | void ns2_prim_status_ind(struct gprs_ns2_nse *nse, |
Daniel Willmann | 15c09a8 | 2020-11-03 23:05:43 +0100 | [diff] [blame] | 279 | struct gprs_ns2_vc *nsvc, |
Alexander Couzens | bf95f0f | 2020-10-01 22:56:03 +0200 | [diff] [blame] | 280 | uint16_t bvci, |
Alexander Couzens | 6a16149 | 2020-07-12 13:45:50 +0200 | [diff] [blame] | 281 | enum gprs_ns2_affecting_cause cause); |
| 282 | void ns2_nse_notify_alive(struct gprs_ns2_vc *nsvc, bool alive); |
| 283 | |
| 284 | /* message */ |
Alexander Couzens | 8dfc24c | 2021-01-25 16:09:23 +0100 | [diff] [blame] | 285 | int ns2_validate(struct gprs_ns2_vc *nsvc, |
| 286 | uint8_t pdu_type, |
| 287 | struct msgb *msg, |
| 288 | struct tlv_parsed *tp, |
| 289 | uint8_t *cause); |
Alexander Couzens | 6a16149 | 2020-07-12 13:45:50 +0200 | [diff] [blame] | 290 | |
| 291 | /* SNS messages */ |
| 292 | int ns2_tx_sns_ack(struct gprs_ns2_vc *nsvc, uint8_t trans_id, uint8_t *cause, |
| 293 | const struct gprs_ns_ie_ip4_elem *ip4_elems, |
| 294 | unsigned int num_ip4_elems, |
| 295 | const struct gprs_ns_ie_ip6_elem *ip6_elems, |
| 296 | unsigned int num_ip6_elems); |
| 297 | int ns2_tx_sns_config(struct gprs_ns2_vc *nsvc, bool end_flag, |
| 298 | const struct gprs_ns_ie_ip4_elem *ip4_elems, |
| 299 | unsigned int num_ip4_elems, |
| 300 | const struct gprs_ns_ie_ip6_elem *ip6_elems, |
| 301 | unsigned int num_ip6_elems); |
| 302 | int ns2_tx_sns_config_ack(struct gprs_ns2_vc *nsvc, uint8_t *cause); |
| 303 | int ns2_tx_sns_size(struct gprs_ns2_vc *nsvc, bool reset_flag, uint16_t max_nr_nsvc, |
| 304 | int ip4_ep_nr, int ip6_ep_nr); |
| 305 | int ns2_tx_sns_size_ack(struct gprs_ns2_vc *nsvc, uint8_t *cause); |
| 306 | |
| 307 | /* transmit message over a VC */ |
| 308 | int ns2_tx_block(struct gprs_ns2_vc *nsvc, uint8_t cause); |
| 309 | int ns2_tx_block_ack(struct gprs_ns2_vc *nsvc); |
| 310 | |
| 311 | int ns2_tx_reset(struct gprs_ns2_vc *nsvc, uint8_t cause); |
| 312 | int ns2_tx_reset_ack(struct gprs_ns2_vc *nsvc); |
| 313 | |
| 314 | int ns2_tx_unblock(struct gprs_ns2_vc *nsvc); |
| 315 | int ns2_tx_unblock_ack(struct gprs_ns2_vc *nsvc); |
| 316 | |
| 317 | int ns2_tx_alive(struct gprs_ns2_vc *nsvc); |
| 318 | int ns2_tx_alive_ack(struct gprs_ns2_vc *nsvc); |
| 319 | |
| 320 | int ns2_tx_unit_data(struct gprs_ns2_vc *nsvc, |
| 321 | uint16_t bvci, uint8_t sducontrol, |
| 322 | struct msgb *msg); |
| 323 | |
| 324 | int ns2_tx_status(struct gprs_ns2_vc *nsvc, uint8_t cause, |
| 325 | uint16_t bvci, struct msgb *orig_msg); |
| 326 | |
| 327 | /* driver */ |
Alexander Couzens | 8dfc24c | 2021-01-25 16:09:23 +0100 | [diff] [blame] | 328 | struct gprs_ns2_vc *ns2_ip_bind_connect(struct gprs_ns2_vc_bind *bind, |
| 329 | struct gprs_ns2_nse *nse, |
| 330 | const struct osmo_sockaddr *remote); |
Alexander Couzens | e769f52 | 2020-12-07 07:37:07 +0100 | [diff] [blame] | 331 | int ns2_ip_count_bind(struct gprs_ns2_inst *nsi, struct osmo_sockaddr *remote); |
| 332 | struct gprs_ns2_vc_bind *ns2_ip_get_bind_by_index(struct gprs_ns2_inst *nsi, |
| 333 | struct osmo_sockaddr *remote, |
| 334 | int index); |
Alexander Couzens | 6a16149 | 2020-07-12 13:45:50 +0200 | [diff] [blame] | 335 | |
| 336 | /* sns */ |
Alexander Couzens | 8dfc24c | 2021-01-25 16:09:23 +0100 | [diff] [blame] | 337 | int ns2_sns_rx(struct gprs_ns2_vc *nsvc, struct msgb *msg, struct tlv_parsed *tp); |
Alexander Couzens | 6a16149 | 2020-07-12 13:45:50 +0200 | [diff] [blame] | 338 | struct osmo_fsm_inst *ns2_sns_bss_fsm_alloc(struct gprs_ns2_nse *nse, |
| 339 | const char *id); |
Alexander Couzens | 6a16149 | 2020-07-12 13:45:50 +0200 | [diff] [blame] | 340 | void ns2_sns_free_nsvc(struct gprs_ns2_vc *nsvc); |
| 341 | |
| 342 | /* vc */ |
Alexander Couzens | 8dfc24c | 2021-01-25 16:09:23 +0100 | [diff] [blame] | 343 | struct osmo_fsm_inst *ns2_vc_fsm_alloc(struct gprs_ns2_vc *nsvc, |
Alexander Couzens | 6a16149 | 2020-07-12 13:45:50 +0200 | [diff] [blame] | 344 | const char *id, bool initiate); |
Alexander Couzens | 8dfc24c | 2021-01-25 16:09:23 +0100 | [diff] [blame] | 345 | int ns2_vc_fsm_start(struct gprs_ns2_vc *nsvc); |
| 346 | int ns2_vc_force_unconfigured(struct gprs_ns2_vc *nsvc); |
| 347 | int ns2_vc_rx(struct gprs_ns2_vc *nsvc, struct msgb *msg, struct tlv_parsed *tp); |
| 348 | int ns2_vc_is_alive(struct gprs_ns2_vc *nsvc); |
| 349 | int ns2_vc_is_unblocked(struct gprs_ns2_vc *nsvc); |
Alexander Couzens | 47afc42 | 2021-01-17 20:12:46 +0100 | [diff] [blame] | 350 | int ns2_vc_block(struct gprs_ns2_vc *nsvc); |
| 351 | int ns2_vc_unblock(struct gprs_ns2_vc *nsvc); |
Alexander Couzens | 6a16149 | 2020-07-12 13:45:50 +0200 | [diff] [blame] | 352 | |
Alexander Couzens | 6a16149 | 2020-07-12 13:45:50 +0200 | [diff] [blame] | 353 | /* nse */ |
| 354 | void ns2_nse_notify_unblocked(struct gprs_ns2_vc *nsvc, bool unblocked); |
Alexander Couzens | 8dfc24c | 2021-01-25 16:09:23 +0100 | [diff] [blame] | 355 | enum gprs_ns2_vc_mode ns2_dialect_to_vc_mode(enum gprs_ns2_dialect dialect); |
Alexander Couzens | 1c8785d | 2020-12-17 06:58:53 +0100 | [diff] [blame] | 356 | int ns2_count_transfer_cap(struct gprs_ns2_nse *nse, |
| 357 | uint16_t bvci); |