blob: 80edaa38934a9e8de2b6584c2b2b8e2ec117766d [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 Welte2f89b962019-03-30 08:58:40 +010019 BDC_E_RSPRO_TX, /* transmit a RSPRO PDU to the bankd */
Harald Welte24173fb2018-08-24 20:37:28 +020020};
21
Harald Weltefc0ba942018-10-14 17:47:00 +020022extern struct osmo_fsm remsim_client_bankd_fsm;
23
Harald Welte24173fb2018-08-24 20:37:28 +020024
Harald Welte24173fb2018-08-24 20:37:28 +020025/* main.c */
26
27struct bankd_client {
28 /* connection to the remsim-server (control) */
Harald Weltee56f2b92019-03-02 17:02:13 +010029 struct rspro_server_conn srv_conn;
Harald Welte24173fb2018-08-24 20:37:28 +020030
Harald Weltee56f2b92019-03-02 17:02:13 +010031 /* remote component ID */
32 struct app_comp_id peer_comp_id;
Harald Welte24173fb2018-08-24 20:37:28 +020033
34 /* connection to the remsim-bankd */
35 char *bankd_host;
36 uint16_t bankd_port;
Harald Welte9cf013a2019-03-11 22:19:19 +010037 struct bank_slot bankd_slot;
Harald Welte24173fb2018-08-24 20:37:28 +020038 struct ipa_client_conn *bankd_conn;
39 struct osmo_fsm_inst *bankd_fi;
40};
41
Harald Weltea844bb02019-03-09 13:38:50 +010042int bankd_conn_send_rspro(struct bankd_client *bc, RsproPDU_t *pdu);
Harald Welte24173fb2018-08-24 20:37:28 +020043int bankd_read_cb(struct ipa_client_conn *conn, struct msgb *msg);
44int bankd_conn_fsm_alloc(struct bankd_client *bc);