Change in osmocom-bb[master]: layer23/sap_interface.c: define missing enums and use them

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Vadim Yanitskiy gerrit-no-reply at lists.osmocom.org
Mon Dec 24 22:09:23 UTC 2018


Vadim Yanitskiy has uploaded this change for review. ( https://gerrit.osmocom.org/12439


Change subject: layer23/sap_interface.c: define missing enums and use them
......................................................................

layer23/sap_interface.c: define missing enums and use them

Change-Id: I4ba5a8a42bf25d04b152ac3f1f0e4d7eac7f068f
---
M src/host/layer23/include/osmocom/bb/common/sap_interface.h
M src/host/layer23/src/common/sap_interface.c
2 files changed, 50 insertions(+), 19 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/39/12439/1

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 b8a3420..36aa145 100644
--- a/src/host/layer23/include/osmocom/bb/common/sap_interface.h
+++ b/src/host/layer23/include/osmocom/bb/common/sap_interface.h
@@ -57,6 +57,37 @@
 	SAP_TRANSPORT_PROTOCOL = 0x09
 };
 
+/* Table 5.18: Possible values for ResultCode */
+enum sap_result_type {
+	SAP_RESULT_OK_REQ_PROC_CORR = 0x00,
+	SAP_RESULT_ERROR_NO_REASON = 0x01,
+	SAP_RESULT_ERROR_CARD_NOT_ACC = 0x02,
+	SAP_RESULT_ERROR_CARD_POWERED_OFF = 0x03,
+	SAP_RESULT_ERROR_CARD_REMOVED = 0x04,
+	SAP_RESULT_ERROR_CARD_POWERED_ON = 0x05,
+	SAP_RESULT_ERROR_DATA_UNAVAIL = 0x06,
+	SAP_RESULT_ERROR_NOT_SUPPORTED = 0x07,
+};
+
+/* Table 5.19: Possible values for StatusChange */
+enum sap_status_chg_type {
+	SAP_STATUS_CHG_UNKNOWN_ERROR = 0x00,
+	SAP_STATUS_CHG_CARD_RESET = 0x01,
+	SAP_STATUS_CHG_CARD_NOT_ACC = 0x02,
+	SAP_STATUS_CHG_CARD_REMOVED = 0x03,
+	SAP_STATUS_CHG_CARD_INSERTED = 0x04,
+	SAP_STATUS_CHG_CARD_RECOVERED = 0x05,
+};
+
+/* Table 5.16: Possible values for ConnectionStatus */
+enum sap_conn_status_type {
+	SAP_CONN_STATUS_OK_READY = 0x00,
+	SAP_CONN_STATUS_ERROR_CONN = 0x01,
+	SAP_CONN_STATUS_ERROR_MAX_MSG_SIZE = 0x02,
+	SAP_CONN_STATUS_ERROR_SMALL_MSG_SIZE = 0x03,
+	SAP_CONN_STATUS_OK_CALL = 0x04,
+};
+
 struct sap_param {
 	uint8_t id;
 	uint16_t len;
diff --git a/src/host/layer23/src/common/sap_interface.c b/src/host/layer23/src/common/sap_interface.c
index 635b046..2875d55 100644
--- a/src/host/layer23/src/common/sap_interface.c
+++ b/src/host/layer23/src/common/sap_interface.c
@@ -89,33 +89,33 @@
 
 /* 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 "},
+	{ SAP_RESULT_OK_REQ_PROC_CORR,		"OK, request processed correctly" },
+	{ SAP_RESULT_ERROR_NO_REASON,		"Error, no reason defined" },
+	{ SAP_RESULT_ERROR_CARD_NOT_ACC,	"Error, card not accessible" },
+	{ SAP_RESULT_ERROR_CARD_POWERED_OFF,	"Error, card (already) powered off" },
+	{ SAP_RESULT_ERROR_CARD_REMOVED,	"Error, card removed" },
+	{ SAP_RESULT_ERROR_CARD_POWERED_ON,	"Error, card already powered on" },
+	{ SAP_RESULT_ERROR_DATA_UNAVAIL,	"Error, data not available" },
+	{ SAP_RESULT_ERROR_NOT_SUPPORTED,	"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" },
+	{ SAP_STATUS_CHG_UNKNOWN_ERROR,		"Unknown Error" },
+	{ SAP_STATUS_CHG_CARD_RESET,		"Card reset" },
+	{ SAP_STATUS_CHG_CARD_NOT_ACC,		"Card not accessible" },
+	{ SAP_STATUS_CHG_CARD_REMOVED,		"Card removed" },
+	{ SAP_STATUS_CHG_CARD_INSERTED,		"Card inserted" },
+	{ SAP_STATUS_CHG_CARD_RECOVERED,	"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" },
+	{ SAP_CONN_STATUS_OK_READY,		"OK, Server can fulfill requirements" },
+	{ SAP_CONN_STATUS_ERROR_CONN,		"Error, Server unable to establish connection" },
+	{ SAP_CONN_STATUS_ERROR_MAX_MSG_SIZE,	"Error, Server does not support maximum message size" },
+	{ SAP_CONN_STATUS_ERROR_SMALL_MSG_SIZE,	"Error, maximum message size by Client is too small" },
+	{ SAP_CONN_STATUS_OK_CALL,		"OK, ongoing call" },
 };
 
 static struct msgb *sap_create_msg(uint8_t id, uint8_t num_params, struct sap_param *params)

-- 
To view, visit https://gerrit.osmocom.org/12439
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4ba5a8a42bf25d04b152ac3f1f0e4d7eac7f068f
Gerrit-Change-Number: 12439
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181224/fa7a84b4/attachment.htm>


More information about the gerrit-log mailing list