blob: 7a3c476a4dd1614088bc022493805b1f8fef57f7 [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>
5
6#include "rspro_util.h"
Harald Weltea4e0a232018-10-14 17:44:25 +02007#include "debug.h"
Harald Welte24173fb2018-08-24 20:37:28 +02008
9/* fsm.c */
10
11enum bankd_conn_fsm_event {
12 BDC_E_TCP_UP,
13 BDC_E_TCP_DOWN,
14 BDC_E_CLIENT_CONN_RES,
15};
16
Harald Weltefc0ba942018-10-14 17:47:00 +020017extern struct osmo_fsm remsim_client_bankd_fsm;
18
Harald Welte24173fb2018-08-24 20:37:28 +020019
20enum server_conn_fsm_event {
21 SRVC_E_TCP_UP,
22 SRVC_E_TCP_DOWN,
23 SRVC_E_CLIENT_CONN_RES,
24};
25
Harald Weltefc0ba942018-10-14 17:47:00 +020026/* representing a client-side connection to a RSPRO server */
27struct 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 Welte24173fb2018-08-24 20:37:28 +020040extern struct osmo_fsm remsim_client_server_fsm;
41
42/* main.c */
43
44struct bankd_client {
45 /* connection to the remsim-server (control) */
46 struct ipa_client_conn *srv_conn;
47 struct osmo_fsm_inst *srv_fi;
48
49 /* our own component ID */
50 struct app_comp_id own_comp_id;
51
52 /* connection to the remsim-bankd */
53 char *bankd_host;
54 uint16_t bankd_port;
55 struct ipa_client_conn *bankd_conn;
56 struct osmo_fsm_inst *bankd_fi;
Kévin Redon38cd4f72018-10-10 00:36:46 +020057
58 /* client id and slot number */
59 ClientSlot_t *clslot;
Harald Welte24173fb2018-08-24 20:37:28 +020060};
61
Harald Weltef29e0d02018-08-24 21:42:22 +020062void ipa_client_conn_send_rspro(struct ipa_client_conn *ipa, RsproPDU_t *rspro);
Harald Welte24173fb2018-08-24 20:37:28 +020063int bankd_read_cb(struct ipa_client_conn *conn, struct msgb *msg);
64int bankd_conn_fsm_alloc(struct bankd_client *bc);