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