Commit Graph

307 Commits

Author SHA1 Message Date
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
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 b0cef1d776 configure.ac: Explicitly check for -lcsv and csv.h
unfortuantely libcsv doesn't ship with a pkg-config file, so we have
to resort on those manual checks

Change-Id: I52260a4e3f7a12039f054a55a211045085f1c5ff
2018-10-15 00:19:30 +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
Harald Welte 61df6c309c contrib/jenkins.sh: Fix project name printed during build
Change-Id: I3189ff095559e630fcf1d995fb36b330bceda526
2018-10-15 01:52:20 +02:00
Harald Welte 72f702c243 contrib/jenkins.sh: Ensure PKG_CONFIG_PATH is set before build
... otherwise, there will be trouble finding the 'stow' libraries we
build.

Change-Id: I3ab09c8d35b7835ffbbd1e4bfdd0570a756b43df
2018-10-15 01:52:20 +02:00
Harald Welte 80a83cc166 contrib/jenkins.sh: Harmonize with other projects
In other projects, only libosmocore is called with '""
--disable-doxygen' arguments, no other libraries.

Change-Id: I85ee61fec9c10b283734105eaecd1b8422fbb8a7
2018-10-15 01:48:48 +02:00
Harald Welte c7b5c7aaf2 Add contrib/jenkins.sh for build verification
Change-Id: I09a020966c3903673626e6d6bbe097d4ba69774b
2018-10-14 20:49:25 +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