blob: 5df5e676d74b26b08aeb19d2ae06072ced1fab37 [file] [log] [blame]
Harald Welte24173fb2018-08-24 20:37:28 +02001#pragma once
2
3#include <osmocom/core/fsm.h>
4#include <osmocom/abis/ipa.h>
Harald Weltef9995a32018-10-14 20:40:05 +02005#include <osmocom/rspro/RsproPDU.h>
Harald Welte24173fb2018-08-24 20:37:28 +02006
7#include "rspro_util.h"
Harald Welte3cded632019-03-09 12:59:41 +01008#include "rspro_client_fsm.h"
Harald Welte9cf013a2019-03-11 22:19:19 +01009#include "slotmap.h"
Harald Weltea4e0a232018-10-14 17:44:25 +020010#include "debug.h"
Harald Welte24173fb2018-08-24 20:37:28 +020011
12/* fsm.c */
13
14enum bankd_conn_fsm_event {
Harald Weltee56f2b92019-03-02 17:02:13 +010015 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 Welte24173fb2018-08-24 20:37:28 +020019};
20
Harald Weltefc0ba942018-10-14 17:47:00 +020021extern struct osmo_fsm remsim_client_bankd_fsm;
22
Harald Welte24173fb2018-08-24 20:37:28 +020023
Harald Welte24173fb2018-08-24 20:37:28 +020024/* main.c */
25
26struct bankd_client {
27 /* connection to the remsim-server (control) */
Harald Weltee56f2b92019-03-02 17:02:13 +010028 struct rspro_server_conn srv_conn;
Harald Welte24173fb2018-08-24 20:37:28 +020029
Harald Weltee56f2b92019-03-02 17:02:13 +010030 /* remote component ID */
31 struct app_comp_id peer_comp_id;
Harald Welte24173fb2018-08-24 20:37:28 +020032
33 /* connection to the remsim-bankd */
34 char *bankd_host;
35 uint16_t bankd_port;
Harald Welte9cf013a2019-03-11 22:19:19 +010036 struct bank_slot bankd_slot;
Harald Welte24173fb2018-08-24 20:37:28 +020037 struct ipa_client_conn *bankd_conn;
38 struct osmo_fsm_inst *bankd_fi;
39};
40
Harald Weltea844bb02019-03-09 13:38:50 +010041int bankd_conn_send_rspro(struct bankd_client *bc, RsproPDU_t *pdu);
Harald Welte24173fb2018-08-24 20:37:28 +020042int bankd_read_cb(struct ipa_client_conn *conn, struct msgb *msg);
43int bankd_conn_fsm_alloc(struct bankd_client *bc);