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> |
| 5 | |
| 6 | #include "rspro_util.h" |
Harald Welte | a4e0a23 | 2018-10-14 17:44:25 +0200 | [diff] [blame] | 7 | #include "debug.h" |
Harald Welte | 24173fb | 2018-08-24 20:37:28 +0200 | [diff] [blame] | 8 | |
| 9 | /* fsm.c */ |
| 10 | |
| 11 | enum bankd_conn_fsm_event { |
| 12 | BDC_E_TCP_UP, |
| 13 | BDC_E_TCP_DOWN, |
| 14 | BDC_E_CLIENT_CONN_RES, |
| 15 | }; |
| 16 | |
Harald Welte | fc0ba94 | 2018-10-14 17:47:00 +0200 | [diff] [blame] | 17 | extern struct osmo_fsm remsim_client_bankd_fsm; |
| 18 | |
Harald Welte | 24173fb | 2018-08-24 20:37:28 +0200 | [diff] [blame] | 19 | |
| 20 | enum server_conn_fsm_event { |
| 21 | SRVC_E_TCP_UP, |
| 22 | SRVC_E_TCP_DOWN, |
| 23 | SRVC_E_CLIENT_CONN_RES, |
| 24 | }; |
| 25 | |
Harald Welte | fc0ba94 | 2018-10-14 17:47:00 +0200 | [diff] [blame] | 26 | /* representing a client-side connection to a RSPRO server */ |
| 27 | struct rspro_server_conn { |
| 28 | /* state */ |
| 29 | struct ipa_client_conn *conn; |
| 30 | struct osmo_fsm_inst *fi; |
| 31 | |
| 32 | /* our own component ID */ |
| 33 | struct app_comp_id own_comp_id; |
| 34 | |
| 35 | /* configuration */ |
| 36 | char *server_host; |
| 37 | uint16_t server_port; |
| 38 | }; |
| 39 | |
Harald Welte | 098ef87 | 2018-10-14 20:08:50 +0200 | [diff] [blame] | 40 | int server_conn_fsm_alloc(void *ctx, struct rspro_server_conn *srvc); |
Harald Welte | 24173fb | 2018-08-24 20:37:28 +0200 | [diff] [blame] | 41 | extern struct osmo_fsm remsim_client_server_fsm; |
| 42 | |
| 43 | /* main.c */ |
| 44 | |
| 45 | struct bankd_client { |
| 46 | /* connection to the remsim-server (control) */ |
| 47 | struct ipa_client_conn *srv_conn; |
| 48 | struct osmo_fsm_inst *srv_fi; |
| 49 | |
| 50 | /* our own component ID */ |
| 51 | struct app_comp_id own_comp_id; |
| 52 | |
| 53 | /* connection to the remsim-bankd */ |
| 54 | char *bankd_host; |
| 55 | uint16_t bankd_port; |
| 56 | struct ipa_client_conn *bankd_conn; |
| 57 | struct osmo_fsm_inst *bankd_fi; |
Kévin Redon | 38cd4f7 | 2018-10-10 00:36:46 +0200 | [diff] [blame] | 58 | |
| 59 | /* client id and slot number */ |
| 60 | ClientSlot_t *clslot; |
Harald Welte | 24173fb | 2018-08-24 20:37:28 +0200 | [diff] [blame] | 61 | }; |
| 62 | |
Harald Welte | f29e0d0 | 2018-08-24 21:42:22 +0200 | [diff] [blame] | 63 | void ipa_client_conn_send_rspro(struct ipa_client_conn *ipa, RsproPDU_t *rspro); |
Harald Welte | 24173fb | 2018-08-24 20:37:28 +0200 | [diff] [blame] | 64 | int bankd_read_cb(struct ipa_client_conn *conn, struct msgb *msg); |
| 65 | int bankd_conn_fsm_alloc(struct bankd_client *bc); |