blob: 0239b55ec1cc20e7d2da21a30e47ba7ab4b587f1 [file] [log] [blame]
Harald Welte24173fb2018-08-24 20:37:28 +02001#pragma once
2
Harald Welte8e46ab62020-02-14 12:55:43 +01003#include <osmocom/core/linuxlist.h>
Harald Welte24173fb2018-08-24 20:37:28 +02004#include <osmocom/core/fsm.h>
5#include <osmocom/abis/ipa.h>
Harald Weltef9995a32018-10-14 20:40:05 +02006#include <osmocom/rspro/RsproPDU.h>
Harald Welte24173fb2018-08-24 20:37:28 +02007
8#include "rspro_util.h"
Harald Welte3cded632019-03-09 12:59:41 +01009#include "rspro_client_fsm.h"
Harald Welte9cf013a2019-03-11 22:19:19 +010010#include "slotmap.h"
Harald Weltea4e0a232018-10-14 17:44:25 +020011#include "debug.h"
Harald Welte24173fb2018-08-24 20:37:28 +020012
Harald Welte24173fb2018-08-24 20:37:28 +020013/* main.c */
14
Harald Welte5ed46932019-12-17 00:02:36 +010015struct cardem_inst;
16
Harald Welte6a0248b2019-12-17 01:11:24 +010017#define ATR_SIZE_MAX 55
18struct client_config {
19 char *server_host;
20 int server_port;
21
22 int client_id;
23 int client_slot;
24
25 char *gsmtap_host;
26 bool keep_running;
27
28 char *event_script;
29
30 struct {
31 uint8_t data[ATR_SIZE_MAX];
32 uint8_t len;
33 } atr;
34
35 struct {
36 int vendor_id;
37 int product_id;
38 int config_id;
39 int if_num;
40 int altsetting;
41 int addr;
42 char *path;
43 } usb;
44};
45
Harald Welte24173fb2018-08-24 20:37:28 +020046struct bankd_client {
47 /* connection to the remsim-server (control) */
Harald Weltee56f2b92019-03-02 17:02:13 +010048 struct rspro_server_conn srv_conn;
Harald Welte3e9860b2019-12-02 23:04:54 +010049 /* connection to the remsim-bankd (data) */
50 struct rspro_server_conn bankd_conn;
Harald Welte24173fb2018-08-24 20:37:28 +020051
Harald Weltee56f2b92019-03-02 17:02:13 +010052 /* remote component ID */
53 struct app_comp_id peer_comp_id;
Harald Welte24173fb2018-08-24 20:37:28 +020054
Harald Welte9cf013a2019-03-11 22:19:19 +010055 struct bank_slot bankd_slot;
Harald Welte5ed46932019-12-17 00:02:36 +010056
Harald Welte6a0248b2019-12-17 01:11:24 +010057 struct client_config *cfg;
Harald Welte5ed46932019-12-17 00:02:36 +010058 struct cardem_inst *cardem;
Harald Welte24173fb2018-08-24 20:37:28 +020059};
Harald Welte1200c822020-02-13 20:43:27 +010060
Harald Welte8e46ab62020-02-14 12:55:43 +010061#define srvc2bankd_client(srvc) container_of(srvc, struct bankd_client, srv_conn)
62#define bankdc2bankd_client(bdc) container_of(bdc, struct bankd_client, bankd_conn)
Harald Welte1200c822020-02-13 20:43:27 +010063
Harald Welte1200c822020-02-13 20:43:27 +010064
65extern int client_user_bankd_handle_rx(struct rspro_server_conn *bankdc, const RsproPDU_t *pdu);
66
67extern int client_user_main(struct bankd_client *g_client);