Let's open the cards in EXCLUSIVE mode, we don't want other applications
tinkering with the card state while we have a bankd worker running on
it. This change also means that no two bankd workers can trip on
each other accidentially anymore.
Related: OS#5527
Change-Id: I43a1c8c7bd1c0124ee5f605e2e5b04ed8f7836ab
This way we'll get a full trace of commands and repsonses.
Right now the log only shows one direction which is a bit odd.
Related: OS#5615
Change-Id: Ia2de0b850ce78074a411cf0edebfb3ad19253d34
The RSPRO ComponentIdentity includes a 'name' for each remsim component.
So far we always used "fixme-name" instead of something meaningful.
Let's use the hostname of the system instead.
Change-Id: I14925f16ae242dae89fa853a2fe31c5c1b32981d
If something goes wrong during startup (missing CSV file, ...)
let's print a more human-readable error message than just asserting.
Change-Id: I95222d44eefc60ad3857fa70ccebbacce60820df
If one component connects to another component, verify that the
remote component type (bank/server/client) matches our expectation.
This is important in order to detect a misconfiguration of port numbers,
for example.
Closes: OS#5548
Change-Id: I89a4fc4331e8a0622f8f146c7fc235d34d990497
The RSPRO.asn protocol defines the ranges 0..1023 for slot, bank
and client IDs. Don't make misleading claims in manual and/or
help messages.
Change-Id: Id383b2bea4c014e7b61ae02e7062ba4db5c2dc20
Remove the paragraph about writing to the Free Software Foundation's
mailing address. The FSF has changed addresses in the past, and may do
so again. In 2021 this is not useful, let's rather have a bit less
boilerplate at the start of source files.
Change-Id: I2e98f89f6738d03c45a2106820af0912692093f3
When osmo-remsim was originally developed, libosmocore logging was
not yet thread-safe. This meant that the worker threads of remsim-bankd
and remsim-server could not log via the libosmocore logging framework
but directly used stderr/stdout, which produced rather inconsistent log
output.
However, since 1.3.0, libosmocore has received support for
multi-threaded applications. Let's make use of this and consistently
use it in remsim-server and remsim-bankd. This obviously also means
adding some more log categories.
Change-Id: I7bd5264c559b756927046563a2d00c54826bee9b
Right now we get duplicate log lines like
[000 CONN_CLIENT_MAPPED_CARD] bankd_main.c:662 Rx RSPRO tpduModemToCard
[000 CONN_CLIENT_MAPPED_CARD] bankd_main.c:623 tpduModemToCard(0070000001)
Where the first line is printed by the generic receive handler for RSPRO
messages, while the second line is from the specific handler function
handling the specific message type.
Let's only print from the generic message handler if no specific
handler function exists.
Change-Id: I992c847e0081bd1cd8a0b70212618c4980d9db81
The '-d' option is pretty much tradition in most osmocom programs,
particularly for those without a VTY / config file it is the only
option to configure per-subsystem logging verbosity.
Change-Id: I0abecc26a5d8b6a5607e1eb8982af4c05909afed
If a client is sending us a clientSlotStatusInd indicating that
the modem has switched off VCC or activated RST, bankd will
now issue a respective PC/SC command to perform a cold or warm
reset of the card.
Change-Id: Ifa615d239ec3ad6daebd8e99e4f7d5b99d32c0e1
Closes: OS#4330
So far the wokrer used to sleep 10s and only check in those intervals
if [finally] a mapping had arrived. Using SIGMAPADD, we can
directly break the worker out of its select() call and hence make
it pick up a new mapping instantaneously.
This also makes RemsimBankd_Tests.TC_removeMapping_connected() pass
Change-Id: If0130ab4b49ffcae6ab7a8b9926a6d9477eb3981
So far, the rspor_client_fsm immediately attempted to establish a
TCP connection to the RSPRO server when calling server_conn_fsm_alloc().
Let's make this implicit auto-connect an explicit request to connect
using the newly-introduced SRVC_E_ESTABLISH.
Let's also change all three existing users of server_conn_fsm_alloc()
to send SRVC_E_ESTABLISH after calling it.
The rationale of this change is to use the same rspro_client_fsm also
for the client->bankd RSPRO connection, where we don't want to
automatically connect at startup, but connect only at a later point, after the
server a has told us to do so.
Change-Id: Icd882405f2ef54e10a66054829c089e4985f1d1f
Otherwise the loop for SIGMAPDEL delivery code will match any
unused worker for bank_id=0/slot_nr=0, which is not what we want.
This also makes repeated RemsimBankd_Tests.TC_removeMapping_connected
runs work reliably.
Change-Id: I6976eb96feae6a3b66bacf787e436a2df29f9ce0
It's a bit of a matter of taste whether we should simply log + ignore
if the Client of a removeMappingReq doesn't match what the bankd
currently has configured. I chose to reject it, as a new createMapping
for the same bandk+slot will overwrite any existing mapping anyway,
at least as of I83e319d22896b881c0d882542842f500075aa546
Change-Id: I892282821f4650614d1d08ed4bdf11eaabf947c0
As explained in OS#4278, a remsim-bankd currently doesn't recover after
a remsim-server resetart, since old mappings remain in the bankd, and
the server has no chance of removing them.
To avoid this problem, a createMapping now always implicitly removes
any existing mapping that may exist for the given bankdSlot.
Change-Id: I83e319d22896b881c0d882542842f500075aa546
Closes: OS#4278
It is customary in the IPA protocol that a a server side
responds with an ID_ACK if the client sends an ID_ACK. Due
to the lack of any protocol specification, it's unclear why
exactly, but we know it does happen.
osmo-remsim-bankd so far failed to implement this, which is
not directly a problem as the only user (osmo-remsim-client)
didn't care. However, when executing TTCN3 test cases,
the IPA_Emulation expects that ID_ACK and related test fail.
Change-Id: Ie55c9d5c435df786e97ec3900837bb21ab80140a
This allows builds on small/embedded platforms to avoid all the
dependencies required by remsim-bankd, including libpcsc-lite
Change-Id: I29a1a0131fdfea6742ec12d81228879066b1ff7e