summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2018-12-22 03:24:51 +0700
committerVadim Yanitskiy <axilirator@gmail.com>2018-12-26 20:52:18 +0000
commit28c56e582bb3176957bf372510988be6f99dbc19 (patch)
tree21c0fbb58122cae803f33c6c6b90d9875d089057 /src
parent1bd795c951de88bb47ad1dbad20d742bd44eec3d (diff)
layer23/sap_interface.c: return rc from osmosap_send_apdu()
Diffstat (limited to 'src')
-rw-r--r--src/host/layer23/src/common/sap_interface.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/host/layer23/src/common/sap_interface.c b/src/host/layer23/src/common/sap_interface.c
index a32c3aa..23b482a 100644
--- a/src/host/layer23/src/common/sap_interface.c
+++ b/src/host/layer23/src/common/sap_interface.c
@@ -474,10 +474,11 @@ static void sap_disconnect(struct osmocom_ms *ms)
ms->sap_entity.sap_state = SAP_NOT_CONNECTED;
}
-static void sap_apdu(struct osmocom_ms *ms, uint8_t *data, uint16_t len)
+static int sap_apdu(struct osmocom_ms *ms, uint8_t *data, uint16_t len)
{
struct msgb *msg;
struct sap_param params[1];
+ int rc;
params[0].id = SAP_COMMAND_APDU;
params[0].len = len;
@@ -485,16 +486,20 @@ static void sap_apdu(struct osmocom_ms *ms, uint8_t *data, uint16_t len)
if(ms->sap_entity.sap_state != SAP_IDLE){
LOGP(DSAP, LOGL_ERROR, "Attempting to send APDU request while not being idle.\n");
- return;
+ return -EIO;
}
msg = sap_create_msg(SAP_TRANSFER_APDU_REQ, 1, params);
if(!msg)
- return;
+ return -ENOMEM;
- osmosap_send(ms, msg);
+ rc = osmosap_send(ms, msg);
+ if (rc)
+ return rc;
ms->sap_entity.sap_state = SAP_PROCESSING_APDU_REQUEST;
+
+ return 0;
}
int sap_open(struct osmocom_ms *ms, const char *socket_path)
@@ -538,9 +543,7 @@ int osmosap_send_apdu(struct osmocom_ms *ms, uint8_t *data, uint16_t length)
{
//LOGP(DSAP, LOGL_ERROR, "Received the following APDU from sim.c: %s\n" ,
// osmo_hexdump(data, length));
- sap_apdu(ms, data, length);
-
- return 0;
+ return sap_apdu(ms, data, length);
}
/* register message handler for messages that are sent from L2->L3 */