summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2018-12-24 03:12:37 +0700
committerHarald Welte <laforge@gnumonks.org>2019-01-07 15:39:52 +0000
commitf1a948f71ad7056a54a51b07e111fa5ee4fa5d0b (patch)
tree73092105e3c5f6ef15714169e7969c4c3c9f7301 /src
parentcec6573cb56d3df4462c9f54b4043d5d880a173b (diff)
layer23/sap_interface.c: prettify value_string definitions
Diffstat (limited to 'src')
-rw-r--r--src/host/layer23/include/osmocom/bb/common/sap_interface.h4
-rw-r--r--src/host/layer23/src/common/sap_interface.c108
2 files changed, 58 insertions, 54 deletions
diff --git a/src/host/layer23/include/osmocom/bb/common/sap_interface.h b/src/host/layer23/include/osmocom/bb/common/sap_interface.h
index e78320e..b8a3420 100644
--- a/src/host/layer23/include/osmocom/bb/common/sap_interface.h
+++ b/src/host/layer23/include/osmocom/bb/common/sap_interface.h
@@ -17,7 +17,7 @@ enum osmosap_state {
SAP_PROCESSING_APDU_REQUEST
};
-/* BTSAP 1.13 */
+/* Table 5.1: Message Overview */
enum osmosap_msg_type {
SAP_CONNECT_REQ = 0x00,
SAP_CONNECT_RESP = 0x01,
@@ -42,7 +42,7 @@ enum osmosap_msg_type {
SAP_SET_TRANSPORT_PROTOCOL_RESP = 0x14
};
-/* BTSAP 5.2 */
+/* Table 5.15: List of Parameter IDs */
enum osmosap_param_type {
SAP_MAX_MSG_SIZE = 0x00,
SAP_CONNECTION_STATUS = 0x01,
diff --git a/src/host/layer23/src/common/sap_interface.c b/src/host/layer23/src/common/sap_interface.c
index b39a57f..6a85bf2 100644
--- a/src/host/layer23/src/common/sap_interface.c
+++ b/src/host/layer23/src/common/sap_interface.c
@@ -47,71 +47,75 @@
static void sap_connect(struct osmocom_ms *ms);
+/* Table 5.15: List of Parameter IDs */
static const struct value_string sap_param_names[] = {
- {SAP_MAX_MSG_SIZE, "MaxMsgSize"},
- {SAP_CONNECTION_STATUS, "ConnectionStatus"},
- {SAP_RESULT_CODE, "ResultCode"},
- {SAP_DISCONNECTION_TYPE, "DisconnectionType"},
- {SAP_COMMAND_APDU, "CommandAPDU"},
- {SAP_COMMAND_APDU_7816, "CommandAPDU7816"},
- {SAP_RESPONSE_APDU, "ResponseAPDU"},
- {SAP_ATR, "ATR"},
- {SAP_CARD_READER_STATUS, "CardReaderStatus"},
- {SAP_STATUS_CHANGE, "StatusChange"},
- {SAP_TRANSPORT_PROTOCOL, "TransportProtocol"}
+ { SAP_MAX_MSG_SIZE, "MaxMsgSize" },
+ { SAP_CONNECTION_STATUS, "ConnectionStatus" },
+ { SAP_RESULT_CODE, "ResultCode" },
+ { SAP_DISCONNECTION_TYPE, "DisconnectionType" },
+ { SAP_COMMAND_APDU, "CommandAPDU" },
+ { SAP_COMMAND_APDU_7816, "CommandAPDU7816" },
+ { SAP_RESPONSE_APDU, "ResponseAPDU" },
+ { SAP_ATR, "ATR" },
+ { SAP_CARD_READER_STATUS, "CardReaderStatus" },
+ { SAP_STATUS_CHANGE, "StatusChange" },
+ { SAP_TRANSPORT_PROTOCOL, "TransportProtocol" },
};
+/* Table 5.1: Message Overview */
static const struct value_string sap_msg_names[] = {
- {SAP_CONNECT_REQ, "CONNECT_REQ"},
- {SAP_CONNECT_RESP, "CONNECT_RESP"},
- {SAP_DISCONNECT_REQ, "DISCONNECT_REQ"},
- {SAP_DISCONNECT_RESP, "DISCONNECT_RESP"},
- {SAP_DISCONNECT_IND, "DISCONNECT_IND"},
- {SAP_TRANSFER_APDU_REQ, "TRANSFER_APDU_REQ"},
- {SAP_TRANSFER_APDU_RESP, "TRANSFER_APDU_RESP"},
- {SAP_TRANSFER_ATR_REQ, "TRANSFER_ATR_REQ"},
- {SAP_TRANSFER_ATR_RESP, "TRANSFER_ATR_RESP"},
- {SAP_POWER_SIM_OFF_REQ, "POWER_SIM_OFF_REQ"},
- {SAP_POWER_SIM_OFF_RESP, "POWER_SIM_OFF_RESP"},
- {SAP_POWER_SIM_ON_REQ, "POWER_SIM_ON_REQ"},
- {SAP_POWER_SIM_ON_RESP, "POWER_SIM_ON_RESP"},
- {SAP_RESET_SIM_REQ, "RESET_SIM_REQ"},
- {SAP_RESET_SIM_RESP, "RESET_SIM_RESP"},
- {SAP_TRANSFER_CARD_READER_STATUS_REQ, "TRANSFER_CARD_READER_STATUS_REQ"},
- {SAP_TRANSFER_CARD_READER_STATUS_RESP, "TRANSFER_CARD_READER_STATUS_RESP"},
- {SAP_STATUS_IND, "STATUS_IND"},
- {SAP_ERROR_RESP, "ERROR_RESP"},
- {SAP_SET_TRANSPORT_PROTOCOL_REQ, "SET_TRANSPORT_PROTOCOL_REQ"},
- {SAP_SET_TRANSPORT_PROTOCOL_RESP, "SET_TRANSPORT_PROTOCOL_RESP"}
+ { SAP_CONNECT_REQ, "CONNECT_REQ" },
+ { SAP_CONNECT_RESP, "CONNECT_RESP" },
+ { SAP_DISCONNECT_REQ, "DISCONNECT_REQ" },
+ { SAP_DISCONNECT_RESP, "DISCONNECT_RESP" },
+ { SAP_DISCONNECT_IND, "DISCONNECT_IND" },
+ { SAP_TRANSFER_APDU_REQ, "TRANSFER_APDU_REQ" },
+ { SAP_TRANSFER_APDU_RESP, "TRANSFER_APDU_RESP" },
+ { SAP_TRANSFER_ATR_REQ, "TRANSFER_ATR_REQ" },
+ { SAP_TRANSFER_ATR_RESP, "TRANSFER_ATR_RESP" },
+ { SAP_POWER_SIM_OFF_REQ, "POWER_SIM_OFF_REQ" },
+ { SAP_POWER_SIM_OFF_RESP, "POWER_SIM_OFF_RESP" },
+ { SAP_POWER_SIM_ON_REQ, "POWER_SIM_ON_REQ" },
+ { SAP_POWER_SIM_ON_RESP, "POWER_SIM_ON_RESP" },
+ { SAP_RESET_SIM_REQ, "RESET_SIM_REQ" },
+ { SAP_RESET_SIM_RESP, "RESET_SIM_RESP" },
+ { SAP_TRANSFER_CARD_READER_STATUS_REQ, "TRANSFER_CARD_READER_STATUS_REQ" },
+ { SAP_TRANSFER_CARD_READER_STATUS_RESP, "TRANSFER_CARD_READER_STATUS_RESP" },
+ { SAP_STATUS_IND, "STATUS_IND" },
+ { SAP_ERROR_RESP, "ERROR_RESP" },
+ { SAP_SET_TRANSPORT_PROTOCOL_REQ, "SET_TRANSPORT_PROTOCOL_REQ" },
+ { SAP_SET_TRANSPORT_PROTOCOL_RESP, "SET_TRANSPORT_PROTOCOL_RESP" },
};
-/* BTSAP table 5.18 */
+/* Table 5.18: Possible values for ResultCode */
static const struct value_string sap_result_names[] = {
- {0, "OK, request processed correctly"},
- {1, "Error, no reason defined"},
- {2, "Error, card not accessible"},
- {3, "Error, card (already) powered off"},
- {4, "Error, card removed"},
- {5, "Error, card already powered on"},
- {6, "Error, data not available"},
- {7, "Error, not supported"}
+ { 0, "OK, request processed correctly" },
+ { 1, "Error, no reason defined" },
+ { 2, "Error, card not accessible" },
+ { 3, "Error, card (already) powered off" },
+ { 4, "Error, card removed" },
+ { 5, "Error, card already powered on" },
+ { 6, "Error, data not available" },
+ { 7, "Error, not supported "},
};
+/* Table 5.19: Possible values for StatusChange */
static const struct value_string sap_status_change_names[] = {
- {0, "Unknown Error"},
- {1, "Card reset"},
- {2, "Card not accessible"},
- {3, "Card removed"},
- {4, "Card inserted"},
- {5, "Card recovered"},
+ { 0, "Unknown Error" },
+ { 1, "Card reset" },
+ { 2, "Card not accessible" },
+ { 3, "Card removed" },
+ { 4, "Card inserted" },
+ { 5, "Card recovered" },
};
+/* Table 5.16: Possible values for ConnectionStatus */
static const struct value_string sap_status_names[] = {
- {0, "OK, Server can fulfill requirements"},
- {1, "Error, Server unable to establish connection"},
- {2, "Error, Server does not support maximum message size"},
- {3, "Error, maximum message size by Client is too small"},
- {4, "OK, ongoing call"}
+ { 0, "OK, Server can fulfill requirements" },
+ { 1, "Error, Server unable to establish connection" },
+ { 2, "Error, Server does not support maximum message size" },
+ { 3, "Error, maximum message size by Client is too small" },
+ { 4, "OK, ongoing call" },
};
static struct msgb *sap_create_msg(uint8_t id, uint8_t num_params, struct sap_param *params)