blob: 8e7f58c07b2d41c048b967fe3a868d0287d13feb [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 {
8 SRVC_E_TCP_UP,
9 SRVC_E_TCP_DOWN,
10 SRVC_E_KA_TIMEOUT,
11 SRVC_E_CLIENT_CONN_RES,
12};
13
14struct rspro_server_conn;
15
16/* representing a client-side connection to a RSPRO server */
17struct rspro_server_conn {
18 /* state */
19 struct ipa_client_conn *conn;
20 struct osmo_fsm_inst *fi;
21 struct osmo_fsm_inst *keepalive_fi;
22 int (*handle_rx)(struct rspro_server_conn *conn, const RsproPDU_t *pdu);
23 /* IPA protocol identity */
24 struct ipaccess_unit ipa_dev;
25
26 /* our own component ID */
27 struct app_comp_id own_comp_id;
28 /* remote component ID */
29 struct app_comp_id peer_comp_id;
30
31 /* client id and slot number */
32 ClientSlot_t *clslot;
33
34 /* configuration */
35 char *server_host;
36 uint16_t server_port;
Harald Welte2513d812019-04-01 21:03:02 +020037
38 /* only in case we are representing a bankd client */
39 struct {
40 uint16_t bank_id;
41 uint16_t num_slots;
42 } bankd;
Harald Welte707c85a2019-03-09 12:56:35 +010043};
44
Harald Weltea844bb02019-03-09 13:38:50 +010045int ipa_client_conn_send_rspro(struct ipa_client_conn *ipa, RsproPDU_t *rspro);
46int server_conn_send_rspro(struct rspro_server_conn *srvc, RsproPDU_t *rspro);
Harald Welte707c85a2019-03-09 12:56:35 +010047int server_conn_fsm_alloc(void *ctx, struct rspro_server_conn *srvc);