Harald Welte | 24173fb | 2018-08-24 20:37:28 +0200 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <osmocom/core/fsm.h> |
| 4 | #include <osmocom/abis/ipa.h> |
Harald Welte | f9995a3 | 2018-10-14 20:40:05 +0200 | [diff] [blame] | 5 | #include <osmocom/rspro/RsproPDU.h> |
Harald Welte | 24173fb | 2018-08-24 20:37:28 +0200 | [diff] [blame] | 6 | |
| 7 | #include "rspro_util.h" |
Harald Welte | 3cded63 | 2019-03-09 12:59:41 +0100 | [diff] [blame] | 8 | #include "rspro_client_fsm.h" |
Harald Welte | 9cf013a | 2019-03-11 22:19:19 +0100 | [diff] [blame] | 9 | #include "slotmap.h" |
Harald Welte | a4e0a23 | 2018-10-14 17:44:25 +0200 | [diff] [blame] | 10 | #include "debug.h" |
Harald Welte | 24173fb | 2018-08-24 20:37:28 +0200 | [diff] [blame] | 11 | |
| 12 | /* fsm.c */ |
| 13 | |
| 14 | enum bankd_conn_fsm_event { |
Harald Welte | e56f2b9 | 2019-03-02 17:02:13 +0100 | [diff] [blame] | 15 | BDC_E_ESTABLISH, /* instruct BDC to (re)etablish TCP connection to bankd */ |
| 16 | BDC_E_TCP_UP, /* notify BDC that TCP connection is up/connected */ |
| 17 | BDC_E_TCP_DOWN, /* notify BDC that TCP connection is down/disconnected */ |
| 18 | BDC_E_CLIENT_CONN_RES, /* notify BDC that ClientConnectRes has been received */ |
Harald Welte | 2f89b96 | 2019-03-30 08:58:40 +0100 | [diff] [blame] | 19 | BDC_E_RSPRO_TX, /* transmit a RSPRO PDU to the bankd */ |
Harald Welte | 24173fb | 2018-08-24 20:37:28 +0200 | [diff] [blame] | 20 | }; |
| 21 | |
Harald Welte | fc0ba94 | 2018-10-14 17:47:00 +0200 | [diff] [blame] | 22 | extern struct osmo_fsm remsim_client_bankd_fsm; |
| 23 | |
Harald Welte | 24173fb | 2018-08-24 20:37:28 +0200 | [diff] [blame] | 24 | |
Harald Welte | 24173fb | 2018-08-24 20:37:28 +0200 | [diff] [blame] | 25 | /* main.c */ |
| 26 | |
| 27 | struct bankd_client { |
| 28 | /* connection to the remsim-server (control) */ |
Harald Welte | e56f2b9 | 2019-03-02 17:02:13 +0100 | [diff] [blame] | 29 | struct rspro_server_conn srv_conn; |
Harald Welte | 24173fb | 2018-08-24 20:37:28 +0200 | [diff] [blame] | 30 | |
Harald Welte | e56f2b9 | 2019-03-02 17:02:13 +0100 | [diff] [blame] | 31 | /* remote component ID */ |
| 32 | struct app_comp_id peer_comp_id; |
Harald Welte | 24173fb | 2018-08-24 20:37:28 +0200 | [diff] [blame] | 33 | |
| 34 | /* connection to the remsim-bankd */ |
| 35 | char *bankd_host; |
| 36 | uint16_t bankd_port; |
Harald Welte | 9cf013a | 2019-03-11 22:19:19 +0100 | [diff] [blame] | 37 | struct bank_slot bankd_slot; |
Harald Welte | 24173fb | 2018-08-24 20:37:28 +0200 | [diff] [blame] | 38 | struct ipa_client_conn *bankd_conn; |
| 39 | struct osmo_fsm_inst *bankd_fi; |
| 40 | }; |
| 41 | |
Harald Welte | a844bb0 | 2019-03-09 13:38:50 +0100 | [diff] [blame] | 42 | int bankd_conn_send_rspro(struct bankd_client *bc, RsproPDU_t *pdu); |
Harald Welte | 24173fb | 2018-08-24 20:37:28 +0200 | [diff] [blame] | 43 | int bankd_read_cb(struct ipa_client_conn *conn, struct msgb *msg); |
| 44 | int bankd_conn_fsm_alloc(struct bankd_client *bc); |