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 | 24173fb | 2018-08-24 20:37:28 +0200 | [diff] [blame] | 19 | }; |
| 20 | |
Harald Welte | fc0ba94 | 2018-10-14 17:47:00 +0200 | [diff] [blame] | 21 | extern struct osmo_fsm remsim_client_bankd_fsm; |
| 22 | |
Harald Welte | 24173fb | 2018-08-24 20:37:28 +0200 | [diff] [blame] | 23 | |
Harald Welte | 24173fb | 2018-08-24 20:37:28 +0200 | [diff] [blame] | 24 | /* main.c */ |
| 25 | |
| 26 | struct bankd_client { |
| 27 | /* connection to the remsim-server (control) */ |
Harald Welte | e56f2b9 | 2019-03-02 17:02:13 +0100 | [diff] [blame] | 28 | struct rspro_server_conn srv_conn; |
Harald Welte | 24173fb | 2018-08-24 20:37:28 +0200 | [diff] [blame] | 29 | |
Harald Welte | e56f2b9 | 2019-03-02 17:02:13 +0100 | [diff] [blame] | 30 | /* remote component ID */ |
| 31 | struct app_comp_id peer_comp_id; |
Harald Welte | 24173fb | 2018-08-24 20:37:28 +0200 | [diff] [blame] | 32 | |
| 33 | /* connection to the remsim-bankd */ |
| 34 | char *bankd_host; |
| 35 | uint16_t bankd_port; |
Harald Welte | 9cf013a | 2019-03-11 22:19:19 +0100 | [diff] [blame] | 36 | struct bank_slot bankd_slot; |
Harald Welte | 24173fb | 2018-08-24 20:37:28 +0200 | [diff] [blame] | 37 | struct ipa_client_conn *bankd_conn; |
| 38 | struct osmo_fsm_inst *bankd_fi; |
| 39 | }; |
| 40 | |
Harald Welte | a844bb0 | 2019-03-09 13:38:50 +0100 | [diff] [blame] | 41 | int bankd_conn_send_rspro(struct bankd_client *bc, RsproPDU_t *pdu); |
Harald Welte | 24173fb | 2018-08-24 20:37:28 +0200 | [diff] [blame] | 42 | int bankd_read_cb(struct ipa_client_conn *conn, struct msgb *msg); |
| 43 | int bankd_conn_fsm_alloc(struct bankd_client *bc); |