Harald Welte | 707c85a | 2019-03-09 12:56:35 +0100 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <osmocom/core/fsm.h> |
| 4 | #include <osmocom/abis/ipa.h> |
| 5 | #include <osmocom/rspro/RsproPDU.h> |
| 6 | |
| 7 | enum 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 | |
| 14 | struct rspro_server_conn; |
| 15 | |
| 16 | /* representing a client-side connection to a RSPRO server */ |
| 17 | struct 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 Welte | 2513d81 | 2019-04-01 21:03:02 +0200 | [diff] [blame] | 37 | |
| 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 Welte | 707c85a | 2019-03-09 12:56:35 +0100 | [diff] [blame] | 43 | }; |
| 44 | |
Harald Welte | a844bb0 | 2019-03-09 13:38:50 +0100 | [diff] [blame] | 45 | int ipa_client_conn_send_rspro(struct ipa_client_conn *ipa, RsproPDU_t *rspro); |
| 46 | int server_conn_send_rspro(struct rspro_server_conn *srvc, RsproPDU_t *rspro); |
Harald Welte | 707c85a | 2019-03-09 12:56:35 +0100 | [diff] [blame] | 47 | int server_conn_fsm_alloc(void *ctx, struct rspro_server_conn *srvc); |