[lib] apdu_dispatch: Don't print APDU state to stdout

The printing was always only done at the end of osmo_apdu_segment_in(),
so let's leave the decision up to the user if he wants to print the
state at every iteration or not.

We now provide osmo_apdu_dump_context_buf() to the user so he can obtain
a string representation of the internal state for logging at any time he
requires.

Change-Id: Id3e3cf1605dec84077b158c1c5715f8eef2641d5
This commit is contained in:
Harald Welte
2019-12-16 15:11:00 +01:00
committed by laforge
parent e9556efe88
commit 563601cff2
2 changed files with 16 additions and 9 deletions

View File

@@ -1,6 +1,6 @@
/* apdu_dispatch - State machine to determine Rx/Tx phases of APDU
*
* (C) 2016 by Harald Welte <hwelte@hmw-consulting.de>
* (C) 2016-2019 by Harald Welte <hwelte@hmw-consulting.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -44,6 +44,8 @@ enum osmo_apdu_action {
APDU_ACT_RX_MORE_CAPDU_FROM_READER = 0x0002,
};
const char *osmo_apdu_dump_context_buf(char *buf, unsigned int buf_len,
const struct osmo_apdu_context *ac);
int osmo_apdu_segment_in(struct osmo_apdu_context *ac, const uint8_t *apdu_buf,
unsigned int apdu_len, bool new_apdu);