Commit Graph

235 Commits

Author SHA1 Message Date
Harald Welte d571a3e2e1 RSPRO: split ConfigClient into ConfigClientId and ConfigClientBank
The point is that the ClientId is only set once at start-up (and
also only optionally), while the Bank IP/port/ID/slot can be changed
any number of times during a RSPRO connection.

Change-Id: Ic76207c7dd7c18fe93bc5133b29c5f9438a9fb0e
2019-03-11 22:09:50 +01:00
Harald Welte 19f881a373 bankd: respond to IPA PING from client with IPA PONG
The bankd worker threads handle the RSPRO connection from the
remsim-clients outside of our usual osmo* infrastructure and hence
they don't inherit the common IPA CCM handling.  This means we need
to explicitly implement the keep-alive PONG support.

What this doesn't add is any outbound keepalive handling towards
the client.

Change-Id: I86f8ca28ece62c33ccbf45c9c65172be8a647407
2019-03-11 18:39:13 +01:00
Harald Welte 653d6a0b38 bankd: Disconnect client if we enter state BW_ST_CONN_CLIENT_UNMAPPED
Change-Id: Ifc1741610fc8a3c0413844e0c37a6fcbb2c55067
2019-03-11 18:38:44 +01:00
Harald Welte 2507597c42 bankd: Implement thread-safe SIGUSR1 talloc context reporting
If the main thread receives SIGUSR1, we dump its talloc report and
then signal all worker threads so each can dump their own talloc
report.

Change-Id: I89e7e22de5557376bd5a9625662d99ac0badf00c
2019-03-11 17:39:29 +01:00
Harald Welte 286a2beaa9 bandk: store the worker name as part of 'struct bankd_worker'
Change-Id: Ife981a4d555f96b63aeaedf27c3ebe513191b0c7
2019-03-11 17:39:29 +01:00
Harald Welte 00a9673ac2 bankd: terminate bankd connection once map is deleted
This implements a signal based mechanism by which the main thread can
inform worker threads that their mapping has just been removed and
they should hence terminate the connection and return themselves to the
pool.

Change-Id: Id932810d59e9e5d8994629d57aaf180bc96f90f5
2019-03-11 17:18:02 +01:00
Harald Welte 458e01b611 bankd: Return ConnectClientRes in error paths of worker_handle_connectClientReq
Change-Id: Ic0d3119c1c5fa412a9d14bb26da5f84ba6f55ae3
2019-03-10 11:14:43 +01:00
Harald Welte 942f1ff162 bankd: Actually send the RemoveMappingRes we prepare
Change-Id: I01d1216ab9461a7e3c51c55a1ab33229bd920da7
2019-03-09 21:49:08 +01:00
Harald Welte a025e7008d rspro_client_fsm: Ensure close + reconnect on missing Connect*Res from server
Change-Id: I7f9bbdf246eb206342bd94be0b13ae45dd40084e
2019-03-09 21:39:09 +01:00
Harald Welte 454f5e2543 bankd: Don't use hard-coded slotmaps but receive them from remsim-server
Change-Id: I642476c2935fbaa96ce5986e3e6708eed0d2ffe2
2019-03-09 21:38:34 +01:00
Harald Welte a0f395043e bankd: Don't create 10 workers, but 'num_slots' workers
Change-Id: Ie86321e3f61ed86bbbe2ca8cfbd9edde6060bb9f
2019-03-09 21:01:31 +01:00
Harald Welte f4b16f1c11 bankd_main: Introduce g_bankd global variable
Change-Id: Ib1a94333f107beb695075b30e41396a6d1f4f29d
2019-03-09 20:58:17 +01:00
Harald Welte b49ac9c6bb rspro_util: Add rspro_msgt_name() to get RSPRO message type name + use it
Change-Id: I4b270addd024f9766923183a75381b71ffe1cfae
2019-03-09 20:36:07 +01:00
Harald Welte 229e6abce1 Add asn1c_helpers.c file to get type/enum/choice names for printing
Change-Id: I478d09776e58c86b84e82251f46f8d778b79a04c
2019-03-09 20:19:28 +01:00
Harald Welte 769ab7d04a RSPRO: Add ErrorInd
Change-Id: I5e5e227d188c5f30ae9be60dd0439ae6f6913b8a
2019-03-09 15:10:36 +01:00
Harald Welte 71752ddd2b RSPRO: Add two more ResoltCodes
Change-Id: I1b665b501106a4aac90e642c11f4123e6a77868d
2019-03-09 15:08:01 +01:00
Harald Welte a844bb07d8 Introduce {server,bankd}_conn_send_rspro()
Change-Id: I8cae6f67567dcbf4b6d62fb5a76f5b7134b16f5d
2019-03-09 13:40:34 +01:00
Harald Welte 3dcdd20343 add missing copyright / license headers everywhere
Change-Id: I5c1fceead0ee799a948995f55c6ebee441cfb79a
2019-03-09 13:11:56 +01:00
Harald Welte 3cded63aa6 naming: Distinguish "rspro client" from "remsim client"
"remsim-client" is the client program running next to a phone/modem
which is attaching to the SIM slot.

"RSPRO client" is a protocl-level client of the RSPRO protocol:
* the remsim-client connects as RSPRO client to the remsim-server
* the remsim-client connects as RSPRO client to the remsim-bankd
* the remsim-bankd connects as RSPRO client to the remsim-server

Let's clarify this in naming.

Change-Id: I10462d4669a0a30c46f3f8d3df67e9c1d4ce8c4b
2019-03-09 13:11:56 +01:00
Harald Welte 707c85a49b Split "RSPRO client FSM" from "BANKD client FSM"
This allows the RSPRO client FSM to be used by both remsim-client
as well as remsim-bankd -- both of which connect as RSPRO client to
remsim-server.

Change-Id: I57b5f8dc9de522b6ae8ceb030e639b5b8001b55a
2019-03-09 13:11:48 +01:00
Harald Welte 228af8a19b remsim-client: Add command-line options for server ip/port and client id/slot
Change-Id: I26d6e0d2ad92e7164e0d8ac710361f9c5f5200df
2019-03-08 22:20:21 +01:00
Harald Welte ec628e964e client: move ClientSlot from bankd_conn to srv_conn
If the client uses a locally-configured (static) ClientId, then
the bankd_client_fsm.c code needs access to this information
at time of the connect to the server, not just when connecting
to the bankd.

Change-Id: I8238b4c56c723f9edcf1042f8a7793208c42f15c
2019-03-08 22:18:31 +01:00
Harald Welte c7995e7112 client: Early call to osmo_init_logging2()
Change-Id: I8f6ee5a95c23821efb02872c41b3121ed532a819
2019-03-08 20:45:46 +01:00
Harald Welte 03b24114b3 client: Add IPA Keepalive handling
Change-Id: I4acf862bc575741e57ef76c1709d3a00e1850566
2019-03-08 20:43:00 +01:00
Harald Welte 1a17104639 client: Restructure {srvc,bankd}_read_cb()
Introduce some switch statements to make code more extensable.

Change-Id: I9d1a6c29cbfc2f01995a2093978fae8577f1771f
2019-03-08 19:18:52 +01:00
Harald Welte 15b75e1e5c remsim-server: Add support for keepalive
This ensures that any RSPRO client (remsim-client or remsim-bankd) is
disconnected if he's no longer responding to IPA PING requests.

Change-Id: I324f0f2a0613d6310e1d191103b136c539b6ec05
Depends: libosmocore Change-Id I2763da49a74de85046ac07d53592c89973314ca6
2019-03-08 17:09:07 +01:00
Harald Welte 7bfcc65227 slotmap: restructure read_cb()
Change-Id: I7fb457f028f9aabc7b4b53bf036e5eac9d785299
2019-03-08 16:55:01 +01:00
Harald Welte e5c7773c7f client slot
Change-Id: I40f0589b2014a1df5ce4de745ec46642c68ad0c5
2019-03-07 23:58:24 +01:00
Harald Welte f5a0fa37c4 Initial version of remsim-server
Change-Id: I1caadc528d5e61a4129c32c53283250cd37f3a3c
2019-03-07 21:35:48 +01:00
Harald Welte 648f4e33b4 slotmap: Introduce slotmap_{rd,wr,un}lock() wrappers for lock debugging
Change-Id: I8dde90d62e673e60e026979c74074f7084490467
2019-03-07 21:15:32 +01:00
Harald Welte 4b676bc6f1 slotmap: Log file/line when changing state
Change-Id: Idc7b350b464ddc50076f92dae592a0d5ad4d486a
2019-03-07 21:15:32 +01:00
Harald Welte 294298c4af slotmap: Add _slotmap_del() for callers that already have a lock
Change-Id: Id05872c3676d0afe4c7abe74677fee62b4f03e53
2019-03-07 10:09:26 +01:00
Harald Welte c86568359c slotmap: Add slotmap_get_id() function to get numeric ID of slot map
Change-Id: Ie476244d9ade30eed9215923275aa82a5d10176f
2019-03-07 10:09:26 +01:00
Harald Welte 2bf39e0fe0 slotmap: Add "DELETE_REQ" state
Change-Id: I953e72e304d6403b2e47f7546a36abfdf246e44b
2019-03-07 10:09:26 +01:00
Harald Welte f4e75043de slotmap: Return newly-created map from slotmap_add()
Change-Id: I1bc66fee1f457bcf9693491031d7d4c411fc582e
2019-03-05 15:23:12 +01:00
Harald Welte 91a0a4adda slotmap: Introduce the concept of a slotmap state
... which is required in remsim-server

Change-Id: I56f5ecd6194ef62c87d87d2965ca0315e3d0fc2d
2019-03-05 15:23:12 +01:00
Harald Welte faef8f06ed slotmap: Introduce slotmap-printing function and use it
... avoid code duplication

Change-Id: I6458b9d222ed9f4113c3bb1c538b4b710559c6b2
2019-03-03 21:59:37 +01:00
Harald Welte cbd18960e7 generalize slotmap to make use of it outside of bankd
Change-Id: I0ca7feaa38dfd0468814ef5a1eff997ce854cedf
2019-03-03 19:38:40 +01:00
Harald Welte 61d98e9f3e share debug.[ch] across all executables
This avoids us having to re-define log_info/log_info_cat for each
program.

Change-Id: I22f4f8a51b91ee09c5be26b1ed1bfca41730c577
2019-03-03 15:43:07 +01:00
Harald Welte e56f2b9b46 client: Connect to server before connecting to bankd
So far we skipped the client->server connection and related
configuration transfer from server to client.  Now, the server
instructs the client to which bankd ip/port to connect.

Change-Id: I76c9498089515d1a6190f3e79e143b7df3a531bd
2019-03-02 17:02:13 +01:00
Harald Welte 0eaa0ef796 rspro_util: Add rspro_IpAddr2str() to get stringified version of IpAddr_t
Change-Id: Ic6cccb00d1d65bdab84178acb1e0525e11bc1315
2019-03-02 15:12:42 +01:00
Harald Welte 92bd881c23 rspro_util: Add rspro_comp_id_retrieve()
This function can be used to obtain an 'sturct app_comp_id' from
received/decoded asn1c ComponentIdentity_t.

Change-Id: I7c68cee171a65cb83a802285531b677cdf37108b
2019-03-02 14:52:17 +01:00
Harald Welte c0097b1e55 respro_util: Add rspro_gen_ConfigClientRes() function
Change-Id: Ib14bc617ed60c64d3b69094f30901f78cafba3b3
2019-03-02 14:22:24 +01:00
Harald Welte 7fc64bc5b2 move osmo_fsm_register() into constructor function
This way each application doesn't have to explicitly call it.

Change-Id: I20753d7f7f485e7e495b64fa74b24858cd22ffa9
2019-03-02 12:55:59 +01:00
Harald Welte 3ac66a1bb7 Add dotty graphs on osmo-remsim to 'doc' subdirectory
Change-Id: Ib0478f1afb17c490cc3ac5a7bbbe3f4de1b30406
2019-03-02 12:42:42 +01:00
Harald Welte ec786eb8a0 update .gitignore to include .libs and executable names
Change-Id: I46baac93985c4a608738e85e2bcc65b94937e6db
2019-03-02 12:40:30 +01:00
Harald Welte c0a4ae4c3b add rspro_gen_{Remove,Create}Mapping{Req,Res}()
Change-Id: If86d34a1e723b7202b5fa2c40ea1d0b152381773
2019-03-02 12:37:30 +01:00
Harald Welte 62e3f5f51c rspro_util.c: Set pdu version to 2 for all generator functions
Change-Id: I83b87875b81491217315390f9ccefeeb39fb610b
2019-03-02 12:37:30 +01:00
Harald Welte f9995a36fd rspro_server_conn: Add handle_rx() call-back
This call-back receives all already-decoded RSPRO PDUs from the server.

Change-Id: I5f410aa6071c9a987c2811f22fb2f3ff018b3cc1
2019-03-02 12:37:30 +01:00
Max 4248bec905 Add git-review config
Change-Id: Iceb58eba5922687aefae7e086a64ea9ae0d225c3
2019-02-14 19:07:32 +01:00