blob: c11e26054410d806a472672b4be23988c4a3cb28 [file] [log] [blame]
Harald Welte707c85a2019-03-09 12:56:35 +01001#pragma once
2
3#include <osmocom/core/fsm.h>
4#include <osmocom/abis/ipa.h>
5#include <osmocom/rspro/RsproPDU.h>
6
7enum server_conn_fsm_event {
Harald Welted2192e22019-11-07 18:10:57 +01008 SRVC_E_ESTABLISH, /* instruct SRVC to (re)etablish TCP connection to bankd */
Harald Welte707c85a2019-03-09 12:56:35 +01009 SRVC_E_TCP_UP,
10 SRVC_E_TCP_DOWN,
11 SRVC_E_KA_TIMEOUT,
12 SRVC_E_CLIENT_CONN_RES,
13};
14
15struct rspro_server_conn;
16
17/* representing a client-side connection to a RSPRO server */
18struct rspro_server_conn {
19 /* state */
20 struct ipa_client_conn *conn;
21 struct osmo_fsm_inst *fi;
22 struct osmo_fsm_inst *keepalive_fi;
23 int (*handle_rx)(struct rspro_server_conn *conn, const RsproPDU_t *pdu);
24 /* IPA protocol identity */
25 struct ipaccess_unit ipa_dev;
26
27 /* our own component ID */
28 struct app_comp_id own_comp_id;
29 /* remote component ID */
30 struct app_comp_id peer_comp_id;
31
32 /* client id and slot number */
33 ClientSlot_t *clslot;
34
35 /* configuration */
36 char *server_host;
37 uint16_t server_port;
Harald Welte2513d812019-04-01 21:03:02 +020038
39 /* only in case we are representing a bankd client */
40 struct {
41 uint16_t bank_id;
42 uint16_t num_slots;
43 } bankd;
Harald Welte707c85a2019-03-09 12:56:35 +010044};
45
Harald Weltea844bb02019-03-09 13:38:50 +010046int ipa_client_conn_send_rspro(struct ipa_client_conn *ipa, RsproPDU_t *rspro);
47int server_conn_send_rspro(struct rspro_server_conn *srvc, RsproPDU_t *rspro);
Harald Welte707c85a2019-03-09 12:56:35 +010048int server_conn_fsm_alloc(void *ctx, struct rspro_server_conn *srvc);