Commit Graph

220 Commits

Author SHA1 Message Date
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 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
Kevin Redon 6f074b787a minor: show USB error message instead of number
Change-Id: I272ac1be82b7432934969ea4d204dd20067d9428
2018-11-12 22:53:48 +01:00
Kevin Redon 206c3d7d0a add ATR as command line argument
we could add a function checking the ATR validity
also before updating the (conditional) checksum we should check if
it is actually present in the ATR

Change-Id: Id1084abdf2318e96c22f8e69cc1ef161b12ef5ea
2018-11-12 22:51:42 +01:00
Kevin Redon f120b64b90 remsim: fix TPDU response size transmission
the TDPU response data size can be up to 256.
this length cannot be stored in a uint8_t, which would cause the
length to become 0, no data being send, and the reader reset the
card because of misbehaviour of the card (i.e. no/malformed
response leading to the timeout of the waiting time).

Change-Id: Id38f9e597ffff242e89ea3dd9fbdf0c9f444cc03
2018-10-15 20:02:52 +02:00
Harald Welte c3632a778f rspro_gen_ConnectClientReq(): don't dereference optional 'client'
Change-Id: Id5ff7f1524bc34576095d6812935557c7f03b545
2018-10-15 00:27:20 +00:00
Harald Welte 098ef8780c server_conn_fsm_alloc(): add explicit talloc context argument
The rspro_server_conn might be a static member of a different struct
and hence not suitable as a talloc context.

Change-Id: I9fd78d558f791d452f2a5279f1af13fd596c1cd6
2018-10-15 00:27:20 +00:00
Harald Welte 7f0e82f9d4 move ipa_client_conn_send_rspro() into remsim_client_fsm.c
Change-Id: I805e7dee0e3dd5a591d215ad340da356b19d03dd
2018-10-15 00:27:20 +00:00
Harald Welte fc0ba94dd6 move 'struct rspro_server_conn' to client.h
Change-Id: Iab9183de086e76a214c23b2af340253a0428e445
2018-10-15 00:27:20 +00:00
Harald Welte a4e0a2396b move DMAIN definition to new debug.h
This way both client.h and bankd.h don't conflict with each other

Change-Id: I68ffd64e1f32b90206f98c7f3ea707d7b2e11e61
2018-10-15 00:20:42 +00:00
Harald Welte 8bb639ac3b libusb_util.c: Avoid gcc warning about strncpy()
What we're doing is actually legal: We copy the full size of the
destination array, and then overwrite the last byte with NUL.  However,
gcc isn't smart enough to see that:

libusb_util.c:162:5: warning: ‘strncpy’ specified bound 20 equals destination size [-Wstringop-truncation]
     strncpy(out[out_idx].path, path, sizeof(out[out_idx].path));
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Let's copy one byte less to make it happy.

Change-Id: Iae13f7a4cf89230f308eb0183d993d7c31024907
2018-10-15 01:52:20 +02:00
Martin Hauke 058457542a Fix compiler warning: no-return-in-nonvoid-function main.c
RPM post-build-checks found some issue and marks these as error:
[  31s] I: Program returns random data in a function
[  31s] E: osmo-remsim no-return-in-nonvoid-function main.c:49

Change-Id: I18705488d0ef8a445004e6a7e81dd2483afb9bdb
2018-10-13 20:43:57 +02:00
Kevin Redon 3428e415b3 add sim switch and modem reset for OWHW
Change-Id: I9d395c2c7e10a0e7e5f7c84bc7d951431bfc68ba
2018-10-12 14:58:20 +02:00
Kevin Redon fbca97a87e add client id and slot number as command line argument
Change-Id: I832ea69b303bf52561e4245991bb25af62558ea0
2018-10-12 14:58:20 +02:00
Kevin Redon 3ec265bca1 move main print output closer to main (minor)
Change-Id: Ib866f8b8b879a3a23bdc31eafe8735c7420bb353
2018-10-12 14:58:20 +02:00
Kevin Redon 19c97ed22a set client name (minor)
Change-Id: Iebb486ede19bd44e49a975c1b5e6c5a26378ba09
2018-10-12 14:58:20 +02:00
Kevin Redon efbf249e08 remove duplicate print output (minor)
the URB content is also shown in process_usb_msg

Change-Id: I3985449daf71d6a450b3339e9feaa26528b86535
2018-10-12 14:58:20 +02:00
Kevin Redon 21e31de068 indicate more clearly SIMtrace traffic in output log
Change-Id: Ie18c8aaace7c7f7cfef9119a01140b8f500de213
2018-10-12 14:58:20 +02:00
Kevin Redon 193a8c19c3 remove unused remote UDP variable
Change-Id: I3256ead1d6c4b8d64468fe1635b10a47e37e4df8
2018-10-12 14:58:20 +02:00
Kevin Redon 39eb9dce71 add command line arguments to set bankd host and port
these replace the remove UDP port not used in this SIMtrace2 host
application.

Change-Id: I16fef1a13da23e5395985320b59647d29680fc9d
2018-10-12 14:58:20 +02:00
Kevin Redon 79126566f5 minor: disable ASN1 debug
this removes a large number of compiler warnings

Change-Id: I2cf88280ad1d6407c91ff18f476eb3ca145c3aa5
2018-10-12 14:58:20 +02:00
Kevin Redon 9b69a3f4b9 send response APDU from bankd (card) to SIMtrace (modem)
Change-Id: I50270dbba8eb93133d1a48ba62a7f8a7dfc555d0
2018-10-12 14:58:20 +02:00
Kevin Redon bc08db5cee send correct APDU to bankd
Change-Id: I777f739793dfeec85823519f9d3d43b22090f209
2018-10-12 14:58:20 +02:00
Kevin Redon 9e34247231 add missing library flags to compile simtrace2-remsim_client.c
Change-Id: If01aca606ff920941db739baa41de52a1a08c434
2018-10-12 14:58:20 +02:00
Kevin Redon e0b837cfcb adapt remsim-client to use simtrace2 cardem
simtrace2-remsim_client.c combines simtrace2-remsim and
remsim_client.c.
it compiles but is short of sending the modem APDU from simtrace2
cardem to bankd.
2018-10-12 14:58:20 +02:00
Kevin Redon 70a8486cb3 add simtrace2 host libraries
these are copies of files from simtrace2
2018-10-12 14:57:29 +02:00
Harald Welte d6f051edc8 fix 'make distcheck' by adding missing client.h to noinst_HEADERS
Change-Id: Ib2c450c902529f7327a187c612380a1f2b3ca534
2018-10-12 14:57:08 +02:00
Kevin Redon 38cd4f7f63 move ClientSlot_t from fsm to client
this allows to reuse the client slot information in as client for
other rspro_utils methods
2018-10-12 14:09:05 +02:00
Kevin Redon ff5db6e81e ensure the local asn1c library is used
Change-Id: Icc91c8f422965fec9c247aa9006e993c15f86d93
2018-10-12 14:09:04 +02:00
Kevin Redon 6811e4f65c ensure RsproPDU_t client and bank are not NULL
Change-Id: I3ba6cf466e3002911842edff0884b38fee09ba26
2018-10-12 14:07:15 +02:00
Harald Welte 5a3613a57f bankd: Ignore IPA CCM and don't terminate if we receive it
The IPA multiplex has a built-in sub-protocol called "CCM", which
we are not implemnting so far.  We still don't implement it, but
at least we don't terminate the TCP connection anymore if any such
unsupported IPA CCM is received.

Change-Id: Ibf7bf2aa973c3f7503479c35adfdc135d7165618
2018-10-12 14:04:19 +02:00
Harald Welte 43ab79f8c2 remove libasn1c dependency and use asn1c without libasn1c
TODO: re-introduce talloc integration for asn1 runtime

Change-Id: I2140509c5359727f304470249be2a726b9a8deb1
2018-10-03 23:34:21 +02:00
Harald Welte 8f893ff208 bankd: Add FIXME to the main thread
Change-Id: I5d36afdf2417023d09e7029244e2e649f08266b2
2018-10-03 23:23:44 +02:00
Harald Welte 511c51313d remove rspro_client.c which is not used anyway.
This was more or less a copy+paste of other related code we already
have for other IPA based protocols in libosmo*.

Change-Id: I21ade32fec3c1badfcf6bc9cd4ec845efed138e0
2018-10-03 23:21:02 +02:00
Harald Welte 7b41d9c863 bankd: Remove second \n after PC/SC OK statements
Change-Id: I80cc727d0260599d8114b1050f04cf17977944f2
2018-10-03 23:15:10 +02:00
Harald Welte 150d6d6788 bankd: more timeout/retry handling, including resolving slotmap
Change-Id: I6541456700d2615a391d8163424b3e39561a29c0
2018-10-03 23:13:21 +02:00
Harald Welte 694df83f35 bankd: Implement re-opening/connecting to card/reader
Change-Id: I5f4b12a76f82776cfd929bd56a4a1f0d4217be65
2018-10-03 22:47:52 +02:00
Harald Welte 31c9eca75a bankd_main: Set the pthread name for easier debugging
Change-Id: Ib1bf2b392ee161ba0d2d01bec927c2c0293a8f3b
2018-10-03 21:03:34 +02:00
Harald Welte f94b9ee67b bankd: Initialize logging early.
In case libosmocore wants to log e.g. a failure to bind the port,
we must have initialized logging before that point.

Change-Id: I86e805a66da6269748e6bd3164e5c0342e014f77
2018-09-25 15:04:21 +02:00
Harald Welte 703d686c20 fix double-free of msgb
Change-Id: I3eefed9ed2954a378327569949c944847e78dcf3
2018-09-24 17:46:05 +02:00
Harald Welte 9ebbacc801 correctly use asn1c API: PDU pointers must be NULL when calling decoder
If the pointers are != NULL, asn1c assumes their memory has already been
allocated, rather than dynamically allocating storage for it.

Change-Id: I6b78be75d8927f032ca4051520a3053b3fbf9e13
2018-09-24 17:46:05 +02:00
Harald Welte 10f6c21736 rspro_util: Add rspro_gen_ConnectClientRes() function
Change-Id: I32fe32b24c87e20c57a2e448c2b183050b84adaf
2018-09-24 14:56:04 +02:00
Harald Welte 7585286466 rspro_util: More error messages
Change-Id: I5006bbf88df17a6e76954ca51af7f443dcc526f9
2018-09-24 14:55:34 +02:00
Harald Welte e1176cf510 bankd: Print error messages in more error cases during IPA read
Change-Id: I5b9720688ebda8ad37109c0cd32e8804678f46ac
2018-09-24 14:54:58 +02:00
Harald Welte f1dd16291e bankd: Add app_comp_id to use repro_util helpers
Change-Id: Ie981388220ed0612e427d076f8741fec73e6026b
2018-09-24 14:54:23 +02:00
Harald Welte 417b961ef2 client: Generate CLIENT_CONN_RES event to FSM on RSPR rx of ClientConnRes
Change-Id: Ic17c72f4fc8bbd43187552892186cdb3e50e2efe
2018-09-24 14:53:41 +02:00
Harald Welte 3e689874ff bankd: Handle errors during PC/SC open/connect
Change-Id: I304b4f73433d6027409aeef7faf04d4e8acd2e54
2018-09-24 14:52:56 +02:00
Harald Welte fd47119111 use msb->l2h as pointer to the RSPRO part inside msgb
Change-Id: Ib8d02047ec64178f9ee235534dab3d9bf4ead296
2018-09-24 14:52:17 +02:00
Harald Welte 293478cf76 RSPRO: don't use "default 1" for protocol version
I suspect there may be some bugs in the handling of DEFAULT values
in asn1c (or maybe I don't understand them fully?), so let's simply
make the version field a normal ASN.1 field.

Change-Id: I08077e715a901dfa5193855be7040d550f6fc2e8
2018-09-24 14:49:41 +02:00
Harald Welte 52cc7db6ed remsim_client_fsm: Handle re-connect timeout and initial connection failure
Change-Id: Id229459a8fa484276c0ca0413356c16930269c36
2018-09-24 11:51:51 +02:00
Harald Welte e72e57383d bankd: Add hack for hard-coded slotmap
As we don't yet have any software that would dynamically install
slot mappings into bankd, let's add a bunch of them as compiled-in
defaults during bankd_init().   This must of course be removed once
the dynamic slot mapping configuration from remsim-server exists.

Change-Id: I04d6ed68c9b9bfb559a41c705884cce4394ea926
2018-09-23 19:31:55 +02:00
Harald Welte 796a7492c7 bankd: Add code to handle TPDUs in rx and tx direction
Change-Id: Icb35ad28939392e75a17b732834d9d570452164f
2018-09-23 19:31:28 +02:00
Harald Welte 57593f0ce9 bankd_main: Missing state transition to BW_ST_CONN_CLIENT_MAPPED_CARD
After we opened the card, we need to transition in this state.

Change-Id: I2de62045bae6313620e81b24d883cec9e4b6017f
2018-09-23 19:30:31 +02:00
Harald Welte 48865c284b bankd_main: Fix SCardConnect(): Needs dwActiveProtocol output param
Change-Id: I4d07d75966afbf4af7ac592ecdef61074a329186
2018-09-23 19:30:07 +02:00
Harald Welte 45c948cc10 bankd_pcsc: Add CSV based mapping of bank-id/slot-nr to PC/SC reader name
In the PC/SC world, each slot is associated with a string name. In the
bankd for PC/SC readers, we need to establish a mapping which
bank_id/slot_nr maps to which given string name.  We use a minimalistic
CSV file for defining those mappings.  The file is read only once at
bankd startup time.

Change-Id: Ifd2caab670625e2e3fbc57b966dce2f43b690417
2018-09-23 19:29:51 +02:00
Harald Welte 1266952242 bankd_slotmap: Fix debug statements
Change-Id: Ia383c851f16967893e3ed50acd18199d848bd1b3
2018-09-23 19:26:09 +02:00
Harald Welte 5d16b1c865 rspro_util: Add functions to generate TDPU transfer messages
Change-Id: I35daf740724e4914b09e3c7eaaac4f933116f48d
2018-09-23 19:25:46 +02:00
Harald Welte 84ba234c2c More progress on code of the server_conn_fsm
Change-Id: Ibad10383fe9c4ab9e6b94382114747c21dae6c31
2018-08-24 22:20:20 +02:00
Harald Welte f29e0d0c26 client: bankd_send_rspro -> ipa_client_conn_send_rspro
Change-Id: Ib481401f8b201719fe1edf76a6d73359947fda15
2018-08-24 21:42:22 +02:00
Harald Welte 24173fbba7 client: Introduce FSMs for managing connections to server + bankd
Change-Id: I705d2dde6d7285bbb1be328181c6d09bccaf26fb
2018-08-24 20:37:28 +02:00
Harald Welte 2ff0ab98d2 Add initial remsim-client skeleton
Doesn't rally do much but to connect to bankd and send a
ConnectClientReq to it.

Change-Id: Ia67011ca690d90b7b670eb85dd0bc507d6c96d49
2018-08-17 22:10:49 +02:00
Harald Welte af61473729 bankd: Resolve slot mapping after client identifies itself.
If mapping cannot be resolved, transition to new
BW_ST_CONN_CLIENT_WAIT_MAP state

Change-Id: I27b4bc301a784712808881a40636e9299816fe72
2018-08-17 22:10:05 +02:00
Harald Welte a2b23c3c50 rspro_util: Print error message in case of encoder errror
Change-Id: Ia2eabd86dd143d5241756f406aa5388cf49d3ba1
2018-08-17 22:09:06 +02:00
Harald Welte 6b8d4f82de rspro_util.c: Fix encoding to msgb. Use tailroom, not length!
Change-Id: I955b76499b1370a9453a50204ccee0e9e8769468
2018-08-17 22:06:24 +02:00
Harald Welte 57555aa60c rspro_util: Add ASN_ALLOC_COPY macro and add clientSlot to ConnectClientReq
Change-Id: I0bc2ba7b7e7787fc5ef9d730af35767b00137513
2018-08-17 22:05:06 +02:00
Harald Welte d5c5c0b790 rspro_util: DER encoder returns size in bytes, no need to divide by 8
Change-Id: I559afe17981a77024b6d14058f89c5f103767939
2018-08-17 22:04:01 +02:00
Harald Welte 137c4402d9 rspro_util: Add header file
Change-Id: I2f66531008943fa6bdc3c286aee2afd254384018
2018-08-17 21:26:49 +02:00
Harald Welte 371d026c6b RSPRO: Use ClientSlot in ConnectClientReq, ConfigClientReq
Change-Id: I33b44009eea338627b0ccbe69b9e4114e4fb85d8
2018-08-16 15:30:41 +02:00
Harald Welte 415e8f66ce bankd: Re-initialize client.peer_addr when recycling the thread
Change-Id: I56ed45bda4323326c42283f160f4b99a4138add1
2018-08-16 14:47:38 +02:00
Harald Welte ceb3e68fab bankd: Include worker state and file/line in LOGW output
Change-Id: I00974d7f567ec1d3142727d455549c76ec974a03
2018-08-16 14:47:11 +02:00
Harald Welte d6dfb8c045 bankd: use getnameinfo() to print client IP/port on connect
Change-Id: Ia721f993b4e4c0addf429fbd6179d7d379c0ccd0
2018-08-16 14:46:53 +02:00
Harald Welte fe3df992fe RSPRO.asn: Add optional ClientId field to ConnectClientReq
This is required when the client connects to the bankd, so the bankd
can figure out who the client is.

Change-Id: Ie87b775d2996a62128e2506ad4b0e48e2f704561
2018-08-16 14:45:49 +02:00
Harald Welte cce2aadbb3 bankd: Add client.id to bankd_worker
Change-Id: I1461f626b579d92621df21b53bbbe8062fb97d72
2018-08-16 14:44:37 +02:00
Harald Welte 7f684a0021 bankd: Don't consume 100% CPU in main thread
Change-Id: I4586a4c00fcdd4540f84caa005d2f116a63aa59c
2018-08-16 14:43:50 +02:00
Harald Welte 12534e776d bankd: Actually create + listen to a socket
Change-Id: I3b6a2b8bd74afafe9575ab00a7f3738a8fac0861
2018-08-15 23:37:29 +02:00
Harald Welte 8d85829821 bankd: Log worker number; Add formal state + state transition function
Change-Id: Ib18e3ad79657e9423a1c1ac75438abcd2e4fdbbd
2018-08-15 23:36:46 +02:00
Harald Welte 77911b0091 Add initial remsim-bankd skeleton
This is not a complete program yet, but a rough initial skeleton with
the key data structures in place, as well as the thread / locking model
in place.

Change-Id: I5ad5a1a4918b8eacdaeb7e709ff05dc056346752
2018-08-15 08:56:31 +02:00
Harald Welte 3aa901da56 initial checkin of osmo-remsim
This adds some initial code, particularly the ASN.1 definition of the
RSPRO protocol, related makefile to build it using ffasn1c, and our
usual autoconf infrastructure to build it.

Change-Id: Ibaa993b59e9a65a0242b0f42b27d9cd29f8e1878
2018-08-15 08:54:50 +02:00