blob: 5756190cfe0e5cc1744169670c3f8b59723227dc [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 Weltea4e0a232018-10-14 17:44:25 +02009#include "debug.h"
Harald Welte24173fb2018-08-24 20:37:28 +020010
11/* fsm.c */
12
13enum bankd_conn_fsm_event {
Harald Weltee56f2b92019-03-02 17:02:13 +010014 BDC_E_ESTABLISH, /* instruct BDC to (re)etablish TCP connection to bankd */
15 BDC_E_TCP_UP, /* notify BDC that TCP connection is up/connected */
16 BDC_E_TCP_DOWN, /* notify BDC that TCP connection is down/disconnected */
17 BDC_E_CLIENT_CONN_RES, /* notify BDC that ClientConnectRes has been received */
Harald Welte24173fb2018-08-24 20:37:28 +020018};
19
Harald Weltefc0ba942018-10-14 17:47:00 +020020extern struct osmo_fsm remsim_client_bankd_fsm;
21
Harald Welte24173fb2018-08-24 20:37:28 +020022
Harald Welte24173fb2018-08-24 20:37:28 +020023/* main.c */
24
25struct bankd_client {
26 /* connection to the remsim-server (control) */
Harald Weltee56f2b92019-03-02 17:02:13 +010027 struct rspro_server_conn srv_conn;
Harald Welte24173fb2018-08-24 20:37:28 +020028
Harald Weltee56f2b92019-03-02 17:02:13 +010029 /* remote component ID */
30 struct app_comp_id peer_comp_id;
Harald Welte24173fb2018-08-24 20:37:28 +020031
32 /* connection to the remsim-bankd */
33 char *bankd_host;
34 uint16_t bankd_port;
35 struct ipa_client_conn *bankd_conn;
36 struct osmo_fsm_inst *bankd_fi;
37};
38
Harald Weltef29e0d02018-08-24 21:42:22 +020039void ipa_client_conn_send_rspro(struct ipa_client_conn *ipa, RsproPDU_t *rspro);
Harald Welte24173fb2018-08-24 20:37:28 +020040int bankd_read_cb(struct ipa_client_conn *conn, struct msgb *msg);
41int bankd_conn_fsm_alloc(struct bankd_client *bc);