All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/10] Re-factoring of gril and rilmodem
@ 2015-10-15 16:46 Alfonso Sanchez-Beato
  2015-10-15 16:46 ` [PATCH 01/10] gril: Move parcel processing to rilmodem Alfonso Sanchez-Beato
                   ` (9 more replies)
  0 siblings, 10 replies; 16+ messages in thread
From: Alfonso Sanchez-Beato @ 2015-10-15 16:46 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 3506 bytes --]

The attached patches include:

* Moving parcel processing code to the rilmodem driver
* Unit tests for parcel processing
* Removing of assertions

The unit tests illustrate one of the reasons for creating separate
modules for building/parsing parcels.

Alfonso Sanchez-Beato (10):
  gril: Move parcel processing to rilmodem
  gril: Adapt to movement of parcel processing
  rilmodem: Adapt to movement of parcel processing
  ril: Adapt to movement of parcel processing
  gril: Remove asserts
  rilmodem: Remove asserts
  ril: Remove asserts
  unit: Add unit tests for ril parcel processing
  build: Add rilmodem unit tests
  gitignore: Ignore rilmodem unit tests

 .gitignore                                         |    3 +
 Makefile.am                                        |   43 +-
 drivers/rilmodem/call-barring.c                    |    4 +-
 drivers/rilmodem/call-forwarding.c                 |    6 +-
 drivers/rilmodem/call-settings.c                   |    4 +-
 drivers/rilmodem/call-volume.c                     |    4 +-
 drivers/rilmodem/devinfo.c                         |    2 +-
 drivers/rilmodem/gprs-context.c                    |    9 +-
 drivers/rilmodem/gprs.c                            |    6 +-
 drivers/rilmodem/network-registration.c            |    6 +-
 drivers/rilmodem/radio-settings.c                  |    4 +-
 {gril => drivers/rilmodem}/ril_constants.h         |    0
 gril/grilreply.c => drivers/rilmodem/rilreply.c    |    5 +-
 gril/grilreply.h => drivers/rilmodem/rilreply.h    |    1 +
 .../grilrequest.c => drivers/rilmodem/rilrequest.c |    3 +-
 .../grilrequest.h => drivers/rilmodem/rilrequest.h |    1 +
 gril/grilunsol.c => drivers/rilmodem/rilunsol.c    |    3 +-
 gril/grilunsol.h => drivers/rilmodem/rilunsol.h    |    1 +
 drivers/rilmodem/rilutil.c                         |  623 ++++++
 drivers/rilmodem/rilutil.h                         |   14 +
 drivers/rilmodem/sim.c                             |    6 +-
 drivers/rilmodem/sms.c                             |    6 +-
 drivers/rilmodem/ussd.c                            |    4 +-
 drivers/rilmodem/voicecall.c                       |    6 +-
 gril/gril.c                                        |   47 +-
 gril/gril.h                                        |    1 -
 gril/grilio.c                                      |    3 +-
 gril/grilio.h                                      |    2 +
 gril/grilutil.c                                    |  628 ------
 gril/grilutil.h                                    |   15 -
 plugins/ril.c                                      |   16 +-
 unit/test-rilreply.c                               | 2141 ++++++++++++++++++++
 unit/test-rilrequest.c                             | 1737 ++++++++++++++++
 unit/test-rilunsol.c                               |  698 +++++++
 34 files changed, 5331 insertions(+), 721 deletions(-)
 rename {gril => drivers/rilmodem}/ril_constants.h (100%)
 rename gril/grilreply.c => drivers/rilmodem/rilreply.c (99%)
 rename gril/grilreply.h => drivers/rilmodem/rilreply.h (99%)
 rename gril/grilrequest.c => drivers/rilmodem/rilrequest.c (99%)
 rename gril/grilrequest.h => drivers/rilmodem/rilrequest.h (99%)
 rename gril/grilunsol.c => drivers/rilmodem/rilunsol.c (99%)
 rename gril/grilunsol.h => drivers/rilmodem/rilunsol.h (98%)
 create mode 100644 unit/test-rilreply.c
 create mode 100644 unit/test-rilrequest.c
 create mode 100644 unit/test-rilunsol.c

-- 
2.1.4


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 01/10] gril: Move parcel processing to rilmodem
  2015-10-15 16:46 [PATCH 00/10] Re-factoring of gril and rilmodem Alfonso Sanchez-Beato
@ 2015-10-15 16:46 ` Alfonso Sanchez-Beato
  2015-10-15 16:46 ` [PATCH 02/10] gril: Adapt to movement of parcel processing Alfonso Sanchez-Beato
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 16+ messages in thread
From: Alfonso Sanchez-Beato @ 2015-10-15 16:46 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 5034 bytes --]

Move parcel creation/parsing from gril to rilmodem driver to make gril
more driver-agnostic.
---
 Makefile.am                                         | 14 +++++++++-----
 {gril => drivers/rilmodem}/ril_constants.h          |  0
 gril/grilreply.c => drivers/rilmodem/rilreply.c     |  4 ++--
 gril/grilreply.h => drivers/rilmodem/rilreply.h     |  1 +
 gril/grilrequest.c => drivers/rilmodem/rilrequest.c |  3 ++-
 gril/grilrequest.h => drivers/rilmodem/rilrequest.h |  1 +
 gril/grilunsol.c => drivers/rilmodem/rilunsol.c     |  3 ++-
 gril/grilunsol.h => drivers/rilmodem/rilunsol.h     |  1 +
 8 files changed, 18 insertions(+), 9 deletions(-)
 rename {gril => drivers/rilmodem}/ril_constants.h (100%)
 rename gril/grilreply.c => drivers/rilmodem/rilreply.c (99%)
 rename gril/grilreply.h => drivers/rilmodem/rilreply.h (99%)
 rename gril/grilrequest.c => drivers/rilmodem/rilrequest.c (99%)
 rename gril/grilrequest.h => drivers/rilmodem/rilrequest.h (99%)
 rename gril/grilunsol.c => drivers/rilmodem/rilunsol.c (99%)
 rename gril/grilunsol.h => drivers/rilmodem/rilunsol.h (98%)

diff --git a/Makefile.am b/Makefile.am
index 3ad1302..35ec7ce 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -99,10 +99,7 @@ gril_sources = gril/gril.h gril/gril.c gril/grilio.h \
 				gril/grilio.c gril/grilutil.h \
 				gril/grilutil.c gril/ringbuffer.h \
 				gril/gfunc.h gril/ril.h \
-				gril/parcel.c gril/parcel.h \
-				gril/grilreply.c gril/grilreply.h \
-				gril/grilrequest.c gril/grilrequest.h \
-				gril/grilunsol.c gril/grilunsol.h
+				gril/parcel.c gril/parcel.h
 
 btio_sources = btio/btio.h btio/btio.c
 
@@ -146,7 +143,14 @@ builtin_sources += drivers/rilmodem/rilmodem.h \
 			drivers/rilmodem/call-settings.c \
 			drivers/rilmodem/call-forwarding.c \
 			drivers/rilmodem/radio-settings.c \
-			drivers/rilmodem/call-barring.c
+			drivers/rilmodem/call-barring.c \
+			drivers/rilmodem/drivers/ril_constants.h \
+			drivers/rilmodem/rilreply.c \
+			drivers/rilmodem/rilreply.h \
+			drivers/rilmodem/rilrequest.c \
+			drivers/rilmodem/rilrequest.h \
+			drivers/rilmodem/rilunsol.c \
+			drivers/rilmodem/rilunsol.h
 endif
 
 if ISIMODEM
diff --git a/gril/ril_constants.h b/drivers/rilmodem/ril_constants.h
similarity index 100%
rename from gril/ril_constants.h
rename to drivers/rilmodem/ril_constants.h
diff --git a/gril/grilreply.c b/drivers/rilmodem/rilreply.c
similarity index 99%
rename from gril/grilreply.c
rename to drivers/rilmodem/rilreply.c
index 8792f47..9ac9ea6 100644
--- a/gril/grilreply.c
+++ b/drivers/rilmodem/rilreply.c
@@ -40,8 +40,8 @@
 
 #include "common.h"
 #include "util.h"
-#include "grilreply.h"
-#include "grilutil.h"
+#include "rilreply.h"
+#include "rilutil.h"
 
 #define OPERATOR_NUM_PARAMS 3
 
diff --git a/gril/grilreply.h b/drivers/rilmodem/rilreply.h
similarity index 99%
rename from gril/grilreply.h
rename to drivers/rilmodem/rilreply.h
index b419762..ef6a980 100644
--- a/gril/grilreply.h
+++ b/drivers/rilmodem/rilreply.h
@@ -26,6 +26,7 @@
 #include <ofono/types.h>
 #include <ofono/sim.h>
 
+#include "ril_constants.h"
 #include "gril.h"
 
 #ifdef __cplusplus
diff --git a/gril/grilrequest.c b/drivers/rilmodem/rilrequest.c
similarity index 99%
rename from gril/grilrequest.c
rename to drivers/rilmodem/rilrequest.c
index a0a0540..ad37fce 100644
--- a/gril/grilrequest.c
+++ b/drivers/rilmodem/rilrequest.c
@@ -36,10 +36,11 @@
 #include <ofono/modem.h>
 #include <ofono/gprs-context.h>
 
-#include "grilrequest.h"
+#include "rilrequest.h"
 #include "simutil.h"
 #include "util.h"
 #include "common.h"
+#include "rilutil.h"
 
 /* DEACTIVATE_DATA_CALL request parameters */
 #define DEACTIVATE_DATA_CALL_NUM_PARAMS 2
diff --git a/gril/grilrequest.h b/drivers/rilmodem/rilrequest.h
similarity index 99%
rename from gril/grilrequest.h
rename to drivers/rilmodem/rilrequest.h
index 1de214e..1485524 100644
--- a/gril/grilrequest.h
+++ b/drivers/rilmodem/rilrequest.h
@@ -28,6 +28,7 @@
 #include <ofono/modem.h>
 #include <ofono/sim.h>
 
+#include "ril_constants.h"
 #include "gril.h"
 
 #ifdef __cplusplus
diff --git a/gril/grilunsol.c b/drivers/rilmodem/rilunsol.c
similarity index 99%
rename from gril/grilunsol.c
rename to drivers/rilmodem/rilunsol.c
index 9fd8900..3b844f6 100644
--- a/gril/grilunsol.c
+++ b/drivers/rilmodem/rilunsol.c
@@ -37,7 +37,8 @@
 #include "util.h"
 
 #include "common.h"
-#include "grilunsol.h"
+#include "rilutil.h"
+#include "rilunsol.h"
 
 /* Minimum size is two int32s version/number of calls */
 #define MIN_DATA_CALL_LIST_SIZE 8
diff --git a/gril/grilunsol.h b/drivers/rilmodem/rilunsol.h
similarity index 98%
rename from gril/grilunsol.h
rename to drivers/rilmodem/rilunsol.h
index a7ddfc9..f69aead 100644
--- a/gril/grilunsol.h
+++ b/drivers/rilmodem/rilunsol.h
@@ -25,6 +25,7 @@
 
 #include <ofono/types.h>
 
+#include "ril_constants.h"
 #include "gril.h"
 
 #ifdef __cplusplus
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 02/10] gril: Adapt to movement of parcel processing
  2015-10-15 16:46 [PATCH 00/10] Re-factoring of gril and rilmodem Alfonso Sanchez-Beato
  2015-10-15 16:46 ` [PATCH 01/10] gril: Move parcel processing to rilmodem Alfonso Sanchez-Beato
@ 2015-10-15 16:46 ` Alfonso Sanchez-Beato
  2015-10-15 16:46 ` [PATCH 03/10] rilmodem: " Alfonso Sanchez-Beato
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 16+ messages in thread
From: Alfonso Sanchez-Beato @ 2015-10-15 16:46 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 24956 bytes --]

---
 gril/gril.c     |  24 +--
 gril/gril.h     |   1 -
 gril/grilutil.c | 628 --------------------------------------------------------
 gril/grilutil.h |  15 --
 4 files changed, 12 insertions(+), 656 deletions(-)

diff --git a/gril/gril.c b/gril/gril.c
index ddedc66..2d9f4b2 100644
--- a/gril/gril.c
+++ b/gril/gril.c
@@ -127,28 +127,34 @@ static void ril_wakeup_writer(struct ril_s *ril);
 
 static const char *request_id_to_string(struct ril_s *ril, int req)
 {
+	static char req_num[16];
 	const char *str = NULL;
 
 	if (ril->req_to_string)
 		str = ril->req_to_string(req);
 
-	if (str == NULL)
-		str = ril_request_id_to_string(req);
+	if (str != NULL)
+		return str;
 
-	return str;
+	snprintf(req_num, sizeof(req_num), "%d", req);
+
+	return req_num;
 }
 
 static const char *unsol_request_to_string(struct ril_s *ril, int req)
 {
+	static char req_num[16];
 	const char *str = NULL;
 
 	if (ril->unsol_to_string)
 		str = ril->unsol_to_string(req);
 
-	if (str == NULL)
-		str = ril_unsol_request_to_string(req);
+	if (str != NULL)
+		return str;
+
+	snprintf(req_num, sizeof(req_num), "%d", req);
 
-	return str;
+	return req_num;
 }
 
 static void ril_notify_node_destroy(gpointer data, gpointer user_data)
@@ -373,12 +379,6 @@ static void handle_response(struct ril_s *p, struct ril_msg *message)
 			found = TRUE;
 			message->req = req->req;
 
-			if (message->error != RIL_E_SUCCESS)
-				RIL_TRACE(p, "[%d,%04d]< %s failed %s",
-					p->slot, message->serial_no,
-					request_id_to_string(p, message->req),
-					ril_error_to_string(message->error));
-
 			req = g_queue_pop_nth(p->command_queue, i);
 			if (req->callback)
 				req->callback(message, req->user_data);
diff --git a/gril/gril.h b/gril/gril.h
index 7d64e7e..3d0bd17 100644
--- a/gril/gril.h
+++ b/gril/gril.h
@@ -30,7 +30,6 @@ extern "C" {
 #include "grilio.h"
 #include "grilutil.h"
 #include "parcel.h"
-#include "ril_constants.h"
 #include "drivers/rilmodem/vendor.h"
 
 #define RIL_MAX_NUM_ACTIVE_DATA_CALLS 2
diff --git a/gril/grilutil.c b/gril/grilutil.c
index 6ef3875..82bbc12 100644
--- a/gril/grilutil.c
+++ b/gril/grilutil.c
@@ -30,635 +30,7 @@
 
 #include <glib.h>
 
-#include <ofono/modem.h>
-#include <ofono/gprs-context.h>
-#include <ofono/types.h>
-
 #include "grilutil.h"
-#include "ril_constants.h"
-
-/* Constants used by CALL_LIST, and SETUP_DATA_CALL RIL requests */
-#define PROTO_IP_STR "IP"
-#define PROTO_IPV6_STR "IPV6"
-#define PROTO_IPV4V6_STR "IPV4V6"
-
-static char temp_str[32];
-
-const char *ril_ofono_protocol_to_ril_string(guint protocol)
-{
-	char *result;
-
-	switch (protocol) {
-	case OFONO_GPRS_PROTO_IPV6:
-		result = PROTO_IPV6_STR;
-		break;
-	case OFONO_GPRS_PROTO_IPV4V6:
-		result = PROTO_IPV4V6_STR;
-		break;
-	case OFONO_GPRS_PROTO_IP:
-		result = PROTO_IP_STR;
-		break;
-	default:
-		result = NULL;
-	}
-
-	return result;
-}
-
-int ril_protocol_string_to_ofono_protocol(gchar *protocol_str)
-{
-	int result;
-
-	if (g_strcmp0(protocol_str, PROTO_IPV6_STR) == 0)
-		result = OFONO_GPRS_PROTO_IPV6;
-	else if (g_strcmp0(protocol_str, PROTO_IPV4V6_STR) == 0)
-		result = OFONO_GPRS_PROTO_IPV4V6;
-	else if (g_strcmp0(protocol_str, PROTO_IP_STR) == 0)
-		result = OFONO_GPRS_PROTO_IP;
-	else
-		result = -1;
-
-	return result;
-}
-
-const char *ril_appstate_to_string(int app_state)
-{
-	switch (app_state) {
-	case RIL_APPSTATE_UNKNOWN:
-		return "UNKNOWN";
-	case RIL_APPSTATE_DETECTED:
-		return "DETECTED";
-	case RIL_APPSTATE_PIN:
-		return "PIN";
-	case RIL_APPSTATE_PUK:
-		return "PUK";
-	case RIL_APPSTATE_SUBSCRIPTION_PERSO:
-		return "";
-	case RIL_APPSTATE_READY:
-		return "READY";
-	default:
-		return "<INVALID>";
-	}
-}
-
-const char *ril_apptype_to_string(int app_type)
-{
-
-	switch (app_type) {
-	case RIL_APPTYPE_UNKNOWN:
-		return "UNKNOWN";
-	case RIL_APPTYPE_SIM:
-		return "SIM";
-	case RIL_APPTYPE_USIM:
-		return "USIM";
-	case RIL_APPTYPE_RUIM:
-		return "RUIM";
-	case RIL_APPTYPE_CSIM:
-		return "CSIM";
-	case RIL_APPTYPE_ISIM:
-		return "ISIM";
-	default:
-		return "<INVALID>";
-	}
-}
-
-const char *ril_authtype_to_string(int auth_type)
-{
-	switch (auth_type) {
-	case RIL_AUTH_NONE:
-		return "NONE";
-	case RIL_AUTH_PAP:
-		return "PAP";
-	case RIL_AUTH_CHAP:
-		return "CHAP";
-	case RIL_AUTH_BOTH:
-		return "BOTH";
-	case RIL_AUTH_ANY:
-		return "ANY";
-	default:
-		return "<INVALID>";
-	}
-}
-
-const char *ril_cardstate_to_string(int card_state)
-{
-	switch (card_state) {
-	case RIL_CARDSTATE_ABSENT:
-		return "ABSENT";
-	case RIL_CARDSTATE_PRESENT:
-		return "PRESENT";
-	case RIL_CARDSTATE_ERROR:
-		return "ERROR";
-	default:
-		return "<INVALID>";
-	}
-}
-
-const char *ril_error_to_string(int error)
-{
-	switch (error) {
-	case RIL_E_SUCCESS: return "SUCCESS";
-	case RIL_E_RADIO_NOT_AVAILABLE: return "RADIO_NOT_AVAILABLE";
-	case RIL_E_GENERIC_FAILURE: return "GENERIC_FAILURE";
-	case RIL_E_PASSWORD_INCORRECT: return "PASSWORD_INCORRECT";
-	case RIL_E_SIM_PIN2: return "SIM_PIN2";
-	case RIL_E_SIM_PUK2: return "SIM_PUK2";
-	case RIL_E_REQUEST_NOT_SUPPORTED: return "REQUEST_NOT_SUPPORTED";
-	case RIL_E_CANCELLED: return "CANCELLED";
-	case RIL_E_OP_NOT_ALLOWED_DURING_VOICE_CALL:
-		return "OP_NOT_ALLOWED_DURING_VOICE_CALL";
-	case RIL_E_OP_NOT_ALLOWED_BEFORE_REG_TO_NW:
-		return "OP_NOT_ALLOWED_BEFORE_REG_TO_NW";
-	case RIL_E_SMS_SEND_FAIL_RETRY: return "SMS_SEND_FAIL_RETRY";
-	case RIL_E_SIM_ABSENT: return "SIM_ABSENT";
-	case RIL_E_SUBSCRIPTION_NOT_AVAILABLE:
-		return "SUBSCRIPTION_NOT_AVAILABLE";
-	case RIL_E_MODE_NOT_SUPPORTED: return "MODE_NOT_SUPPORTED";
-	case RIL_E_FDN_CHECK_FAILURE: return "FDN_CHECK_FAILURE";
-	case RIL_E_ILLEGAL_SIM_OR_ME: return "ILLEGAL_SIM_OR_ME";
-	case RIL_E_DIAL_MODIFIED_TO_USSD: return "DIAL_MODIFIED_TO_USSD";
-	case RIL_E_DIAL_MODIFIED_TO_SS: return "DIAL_MODIFIED_TO_SS";
-	case RIL_E_DIAL_MODIFIED_TO_DIAL: return "DIAL_MODIFIED_TO_DIAL";
-	case RIL_E_USSD_MODIFIED_TO_DIAL: return "USSD_MODIFIED_TO_DIAL";
-	case RIL_E_USSD_MODIFIED_TO_SS: return "USSD_MODIFIED_TO_SS";
-	case RIL_E_USSD_MODIFIED_TO_USSD: return "USSD_MODIFIED_TO_USSD";
-	case RIL_E_SS_MODIFIED_TO_DIAL: return "SS_MODIFIED_TO_DIAL";
-	case RIL_E_SS_MODIFIED_TO_USSD: return "SS_MODIFIED_TO_USSD";
-	case RIL_E_SS_MODIFIED_TO_SS: return "SS_MODIFIED_TO_SS";
-	case RIL_E_SUBSCRIPTION_NOT_SUPPORTED:
-		return "SUBSCRIPTION_NOT_SUPPORTED";
-	default: return "<unknown errno>";
-	}
-}
-
-const char *ril_pinstate_to_string(int pin_state)
-{
-	switch (pin_state) {
-	case RIL_PINSTATE_UNKNOWN:
-		return "UNKNOWN";
-	case RIL_PINSTATE_ENABLED_NOT_VERIFIED:
-		return "ENABLED_NOT_VERIFIED";
-	case RIL_PINSTATE_ENABLED_VERIFIED:
-		return "ENABLED_VERIFIED";
-	case RIL_PINSTATE_DISABLED:
-		return "DISABLED";
-	case RIL_PINSTATE_ENABLED_BLOCKED:
-		return "ENABLED_BLOCKED";
-	case RIL_PINSTATE_ENABLED_PERM_BLOCKED:
-		return "ENABLED_PERM_BLOCKED";
-	default:
-		return "<INVALID>";
-	}
-}
-
-const char *ril_radio_state_to_string(int radio_state)
-{
-	switch (radio_state) {
-	case RADIO_STATE_OFF:
-		return "OFF";
-	case RADIO_STATE_UNAVAILABLE:
-		return "UNAVAILABLE";
-	case RADIO_STATE_SIM_NOT_READY:
-		return "SIM_NOT_READY";
-	case RADIO_STATE_SIM_LOCKED_OR_ABSENT:
-		return "SIM_LOCKED_OR_ABSENT";
-	case RADIO_STATE_SIM_READY:
-		return "SIM_READY";
-	case RADIO_STATE_ON:
-		return "ON";
-	default:
-		return "<INVALID>";
-	}
-}
-
-const char *ril_radio_tech_to_string(int radio_tech)
-{
-	switch (radio_tech) {
-	case RADIO_TECH_UNKNOWN:
-		return "UNKNOWN";
-	case RADIO_TECH_GPRS:
-		return "GPRS";
-	case RADIO_TECH_EDGE:
-		return	"EDGE";
-	case RADIO_TECH_UMTS:
-		return "UMTS";
-	case RADIO_TECH_IS95A:
-		return "IS95A";
-	case RADIO_TECH_IS95B:
-		return "IS95B";
-	case RADIO_TECH_1xRTT:
-		return "1xRTT";
-	case RADIO_TECH_EVDO_0:
-		return "EVDO_0";
-	case RADIO_TECH_EVDO_A:
-		return "EVDO_A";
-	case RADIO_TECH_HSDPA:
-		return "HSDPA";
-	case RADIO_TECH_HSUPA:
-		return "HSUPA";
-	case RADIO_TECH_HSPA:
-		return "HSPA";
-	case RADIO_TECH_EVDO_B:
-		return "EVDO_B";
-	case RADIO_TECH_EHRPD:
-		return "EHRPD";
-	case RADIO_TECH_LTE:
-		return "LTE";
-	case RADIO_TECH_HSPAP:
-		return "HSPAP";
-	case RADIO_TECH_GSM:
-		return "GSM";
-	case MTK_RADIO_TECH_HSDPAP:
-		return "MTK_HSDPAP";
-	case MTK_RADIO_TECH_HSDPAP_UPA:
-		return "MTK_HSDPAP_UPA";
-	case MTK_RADIO_TECH_HSUPAP:
-		return "MTK_HSUPAP";
-	case MTK_RADIO_TECH_HSUPAP_DPA:
-		return "MTK_HSUPAP_DPA";
-	case MTK_RADIO_TECH_DC_DPA:
-		return "MTK_DC_DPA";
-	case MTK_RADIO_TECH_DC_UPA:
-		return "MTK_DC_UPA";
-	case MTK_RADIO_TECH_DC_HSDPAP:
-		return "MTK_DC_HSDPAP";
-	case MTK_RADIO_TECH_DC_HSDPAP_UPA:
-		return "MTK_DC_HSDPAP_UPA";
-	case MTK_RADIO_TECH_DC_HSDPAP_DPA:
-		return "MTK_DC_HSDPAP_DPA";
-	case MTK_RADIO_TECH_DC_HSPAP:
-		return "MTK_DC_HSPAP";
-	default:
-		if (g_snprintf(temp_str, sizeof(temp_str),
-				"<INVALID (%d)>",
-				radio_tech))
-			return temp_str;
-		else
-			return "<INVALID>";
-	}
-}
-
-const char *ril_request_id_to_string(int req)
-{
-	switch (req) {
-	case RIL_REQUEST_GET_SIM_STATUS:
-		return "RIL_REQUEST_GET_SIM_STATUS";
-	case RIL_REQUEST_ENTER_SIM_PIN:
-		return "RIL_REQUEST_ENTER_SIM_PIN";
-	case RIL_REQUEST_ENTER_SIM_PUK:
-		return "RIL_REQUEST_ENTER_SIM_PUK";
-	case RIL_REQUEST_ENTER_SIM_PIN2:
-		return "RIL_REQUEST_ENTER_SIM_PIN2";
-	case RIL_REQUEST_ENTER_SIM_PUK2:
-		return "RIL_REQUEST_ENTER_SIM_PUK2";
-	case RIL_REQUEST_CHANGE_SIM_PIN:
-		return "RIL_REQUEST_CHANGE_SIM_PIN";
-	case RIL_REQUEST_CHANGE_SIM_PIN2:
-		return "RIL_REQUEST_CHANGE_SIM_PIN2";
-	case RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION:
-		return "RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION";
-	case RIL_REQUEST_GET_CURRENT_CALLS:
-		return "RIL_REQUEST_GET_CURRENT_CALLS";
-	case RIL_REQUEST_DIAL:
-		return "RIL_REQUEST_DIAL";
-	case RIL_REQUEST_GET_IMSI:
-		return "RIL_REQUEST_GET_IMSI";
-	case RIL_REQUEST_HANGUP:
-		return "RIL_REQUEST_HANGUP";
-	case RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND:
-		return "RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND";
-	case RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND:
-		return "RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND";
-	case RIL_REQUEST_SWITCH_HOLDING_AND_ACTIVE:
-		return "RIL_REQUEST_SWITCH_HOLDING_AND_ACTIVE";
-	case RIL_REQUEST_CONFERENCE:
-		return "RIL_REQUEST_CONFERENCE";
-	case RIL_REQUEST_UDUB:
-		return "RIL_REQUEST_UDUB";
-	case RIL_REQUEST_LAST_CALL_FAIL_CAUSE:
-		return "RIL_REQUEST_LAST_CALL_FAIL_CAUSE";
-	case RIL_REQUEST_SIGNAL_STRENGTH:
-		return "RIL_REQUEST_SIGNAL_STRENGTH";
-	case RIL_REQUEST_VOICE_REGISTRATION_STATE:
-		return "RIL_REQUEST_VOICE_REGISTRATION_STATE";
-	case RIL_REQUEST_DATA_REGISTRATION_STATE:
-		return "RIL_REQUEST_DATA_REGISTRATION_STATE";
-	case RIL_REQUEST_OPERATOR:
-		return "RIL_REQUEST_OPERATOR";
-	case RIL_REQUEST_RADIO_POWER:
-		return "RIL_REQUEST_RADIO_POWER";
-	case RIL_REQUEST_DTMF:
-		return "RIL_REQUEST_DTMF";
-	case RIL_REQUEST_SEND_SMS:
-		return "RIL_REQUEST_SEND_SMS";
-	case RIL_REQUEST_SEND_SMS_EXPECT_MORE:
-		return "RIL_REQUEST_SEND_SMS_EXPECT_MORE";
-	case RIL_REQUEST_SETUP_DATA_CALL:
-		return "RIL_REQUEST_SETUP_DATA_CALL";
-	case RIL_REQUEST_SIM_IO:
-		return "RIL_REQUEST_SIM_IO";
-	case RIL_REQUEST_SEND_USSD:
-		return "RIL_REQUEST_SEND_USSD";
-	case RIL_REQUEST_CANCEL_USSD:
-		return "RIL_REQUEST_CANCEL_USSD";
-	case RIL_REQUEST_GET_CLIR:
-		return "RIL_REQUEST_GET_CLIR";
-	case RIL_REQUEST_SET_CLIR:
-		return "RIL_REQUEST_SET_CLIR";
-	case RIL_REQUEST_QUERY_CALL_FORWARD_STATUS:
-		return "RIL_REQUEST_QUERY_CALL_FORWARD_STATUS";
-	case RIL_REQUEST_SET_CALL_FORWARD:
-		return "RIL_REQUEST_SET_CALL_FORWARD";
-	case RIL_REQUEST_QUERY_CALL_WAITING:
-		return "RIL_REQUEST_QUERY_CALL_WAITING";
-	case RIL_REQUEST_SET_CALL_WAITING:
-		return "RIL_REQUEST_SET_CALL_WAITING";
-	case RIL_REQUEST_SMS_ACKNOWLEDGE:
-		return "RIL_REQUEST_SMS_ACKNOWLEDGE ";
-	case RIL_REQUEST_GET_IMEI:
-		return "RIL_REQUEST_GET_IMEI";
-	case RIL_REQUEST_GET_IMEISV:
-		return "RIL_REQUEST_GET_IMEISV";
-	case RIL_REQUEST_ANSWER:
-		return "RIL_REQUEST_ANSWER";
-	case RIL_REQUEST_DEACTIVATE_DATA_CALL:
-		return "RIL_REQUEST_DEACTIVATE_DATA_CALL";
-	case RIL_REQUEST_QUERY_FACILITY_LOCK:
-		return "RIL_REQUEST_QUERY_FACILITY_LOCK";
-	case RIL_REQUEST_SET_FACILITY_LOCK:
-		return "RIL_REQUEST_SET_FACILITY_LOCK";
-	case RIL_REQUEST_CHANGE_BARRING_PASSWORD:
-		return "RIL_REQUEST_CHANGE_BARRING_PASSWORD";
-	case RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE:
-		return "RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE";
-	case RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC:
-		return "RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC";
-	case RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL:
-		return "RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL";
-	case RIL_REQUEST_QUERY_AVAILABLE_NETWORKS:
-		return "RIL_REQUEST_QUERY_AVAILABLE_NETWORKS";
-	case RIL_REQUEST_DTMF_START:
-		return "RIL_REQUEST_DTMF_START";
-	case RIL_REQUEST_DTMF_STOP:
-		return "RIL_REQUEST_DTMF_STOP";
-	case RIL_REQUEST_BASEBAND_VERSION:
-		return "RIL_REQUEST_BASEBAND_VERSION";
-	case RIL_REQUEST_SEPARATE_CONNECTION:
-		return "RIL_REQUEST_SEPARATE_CONNECTION";
-	case RIL_REQUEST_SET_MUTE:
-		return "RIL_REQUEST_SET_MUTE";
-	case RIL_REQUEST_GET_MUTE:
-		return "RIL_REQUEST_GET_MUTE";
-	case RIL_REQUEST_QUERY_CLIP:
-		return "RIL_REQUEST_QUERY_CLIP";
-	case RIL_REQUEST_LAST_DATA_CALL_FAIL_CAUSE:
-		return "RIL_REQUEST_LAST_DATA_CALL_FAIL_CAUSE";
-	case RIL_REQUEST_DATA_CALL_LIST:
-		return "RIL_REQUEST_DATA_CALL_LIST";
-	case RIL_REQUEST_RESET_RADIO:
-		return "RIL_REQUEST_RESET_RADIO";
-	case RIL_REQUEST_OEM_HOOK_RAW:
-		return "RIL_REQUEST_OEM_HOOK_RAW";
-	case RIL_REQUEST_OEM_HOOK_STRINGS:
-		return "RIL_REQUEST_OEM_HOOK_STRINGS";
-	case RIL_REQUEST_SCREEN_STATE:
-		return "RIL_REQUEST_SCREEN_STATE";
-	case RIL_REQUEST_SET_SUPP_SVC_NOTIFICATION:
-		return "RIL_REQUEST_SET_SUPP_SVC_NOTIFICATION";
-	case RIL_REQUEST_WRITE_SMS_TO_SIM:
-		return "RIL_REQUEST_WRITE_SMS_TO_SIM";
-	case RIL_REQUEST_DELETE_SMS_ON_SIM:
-		return "RIL_REQUEST_DELETE_SMS_ON_SIM";
-	case RIL_REQUEST_SET_BAND_MODE:
-		return "RIL_REQUEST_SET_BAND_MODE";
-	case RIL_REQUEST_QUERY_AVAILABLE_BAND_MODE:
-		return "RIL_REQUEST_QUERY_AVAILABLE_BAND_MODE";
-	case RIL_REQUEST_STK_GET_PROFILE:
-		return "RIL_REQUEST_STK_GET_PROFILE";
-	case RIL_REQUEST_STK_SET_PROFILE:
-		return "RIL_REQUEST_STK_SET_PROFILE";
-	case RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND:
-		return "RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND";
-	case RIL_REQUEST_STK_SEND_TERMINAL_RESPONSE:
-		return "RIL_REQUEST_STK_SEND_TERMINAL_RESPONSE";
-	case RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM:
-		return "RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM";
-	case RIL_REQUEST_EXPLICIT_CALL_TRANSFER:
-		return "RIL_REQUEST_EXPLICIT_CALL_TRANSFER";
-	case RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE:
-		return "RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE";
-	case RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE:
-		return "RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE";
-	case RIL_REQUEST_GET_NEIGHBORING_CELL_IDS:
-		return "RIL_REQUEST_GET_NEIGHBORING_CELL_IDS";
-	case RIL_REQUEST_SET_LOCATION_UPDATES:
-		return "RIL_REQUEST_SET_LOCATION_UPDATES";
-	case RIL_REQUEST_CDMA_SET_SUBSCRIPTION_SOURCE:
-		return "RIL_REQUEST_CDMA_SET_SUBSCRIPTION_SOURCE";
-	case RIL_REQUEST_CDMA_SET_ROAMING_PREFERENCE:
-		return "RIL_REQUEST_CDMA_SET_ROAMING_PREFERENCE";
-	case RIL_REQUEST_CDMA_QUERY_ROAMING_PREFERENCE:
-		return "RIL_REQUEST_CDMA_QUERY_ROAMING_PREFERENCE";
-	case RIL_REQUEST_SET_TTY_MODE:
-		return "RIL_REQUEST_SET_TTY_MODE";
-	case RIL_REQUEST_QUERY_TTY_MODE:
-		return "RIL_REQUEST_QUERY_TTY_MODE";
-	case RIL_REQUEST_CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE:
-		return "RIL_REQUEST_CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE";
-	case RIL_REQUEST_CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE:
-		return "RIL_REQUEST_CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE";
-	case RIL_REQUEST_CDMA_FLASH:
-		return "RIL_REQUEST_CDMA_FLASH";
-	case RIL_REQUEST_CDMA_BURST_DTMF:
-		return "RIL_REQUEST_CDMA_BURST_DTMF";
-	case RIL_REQUEST_CDMA_VALIDATE_AND_WRITE_AKEY:
-		return "RIL_REQUEST_CDMA_VALIDATE_AND_WRITE_AKEY";
-	case RIL_REQUEST_CDMA_SEND_SMS:
-		return "RIL_REQUEST_CDMA_SEND_SMS";
-	case RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE:
-		return "RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE";
-	case RIL_REQUEST_GSM_GET_BROADCAST_SMS_CONFIG:
-		return "RIL_REQUEST_GSM_GET_BROADCAST_SMS_CONFIG";
-	case RIL_REQUEST_GSM_SET_BROADCAST_SMS_CONFIG:
-		return "RIL_REQUEST_GSM_SET_BROADCAST_SMS_CONFIG";
-	case RIL_REQUEST_GSM_SMS_BROADCAST_ACTIVATION:
-		return "RIL_REQUEST_GSM_SMS_BROADCAST_ACTIVATION";
-	case RIL_REQUEST_CDMA_GET_BROADCAST_SMS_CONFIG:
-		return "RIL_REQUEST_CDMA_GET_BROADCAST_SMS_CONFIG";
-	case RIL_REQUEST_CDMA_SET_BROADCAST_SMS_CONFIG:
-		return "RIL_REQUEST_CDMA_SET_BROADCAST_SMS_CONFIG";
-	case RIL_REQUEST_CDMA_SMS_BROADCAST_ACTIVATION:
-		return "RIL_REQUEST_CDMA_SMS_BROADCAST_ACTIVATION";
-	case RIL_REQUEST_CDMA_SUBSCRIPTION:
-		return "RIL_REQUEST_CDMA_SUBSCRIPTION";
-	case RIL_REQUEST_CDMA_WRITE_SMS_TO_RUIM:
-		return "RIL_REQUEST_CDMA_WRITE_SMS_TO_RUIM";
-	case RIL_REQUEST_CDMA_DELETE_SMS_ON_RUIM:
-		return "RIL_REQUEST_CDMA_DELETE_SMS_ON_RUIM";
-	case RIL_REQUEST_DEVICE_IDENTITY:
-		return "RIL_REQUEST_DEVICE_IDENTITY";
-	case RIL_REQUEST_EXIT_EMERGENCY_CALLBACK_MODE:
-		return "RIL_REQUEST_EXIT_EMERGENCY_CALLBACK_MODE";
-	case RIL_REQUEST_GET_SMSC_ADDRESS:
-		return "RIL_REQUEST_GET_SMSC_ADDRESS";
-	case RIL_REQUEST_SET_SMSC_ADDRESS:
-		return "RIL_REQUEST_SET_SMSC_ADDRESS";
-	case RIL_REQUEST_REPORT_SMS_MEMORY_STATUS:
-		return "RIL_REQUEST_REPORT_SMS_MEMORY_STATUS";
-	case RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING:
-		return "RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING";
-	case RIL_REQUEST_CDMA_GET_SUBSCRIPTION_SOURCE:
-		return "RIL_REQUEST_CDMA_GET_SUBSCRIPTION_SOURCE";
-	case RIL_REQUEST_ISIM_AUTHENTICATION:
-		return "RIL_REQUEST_ISIM_AUTHENTICATION";
-	case RIL_REQUEST_ACKNOWLEDGE_INCOMING_GSM_SMS_WITH_PDU:
-		return "RIL_REQUEST_ACKNOWLEDGE_INCOMING_GSM_SMS_WITH_PDU";
-	case RIL_REQUEST_STK_SEND_ENVELOPE_WITH_STATUS:
-		return "RIL_REQUEST_STK_SEND_ENVELOPE_WITH_STATUS";
-	case RIL_REQUEST_SET_INITIAL_ATTACH_APN:
-		return "RIL_REQUEST_SET_INITIAL_ATTACH_APN";
-	default:
-		return "<INVALID>";
-	}
-}
-
-const char *ril_unsol_request_to_string(int request)
-{
-	switch (request) {
-	case RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED:
-		return "UNSOL_RESPONSE_RADIO_STATE_CHANGED";
-	case RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED:
-		return "UNSOL_RESPONSE_CALL_STATE_CHANGED";
-	case RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED:
-		return "UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED";
-	case RIL_UNSOL_RESPONSE_NEW_SMS:
-		return "UNSOL_RESPONSE_NEW_SMS";
-	case RIL_UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT:
-		return "UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT";
-	case RIL_UNSOL_RESPONSE_NEW_SMS_ON_SIM:
-		return "UNSOL_RESPONSE_NEW_SMS_ON_SIM";
-	case RIL_UNSOL_ON_USSD:
-		return "UNSOL_ON_USSD";
-	case RIL_UNSOL_ON_USSD_REQUEST:
-		return "UNSOL_ON_USSD_REQUEST(obsolete)";
-	case RIL_UNSOL_NITZ_TIME_RECEIVED:
-		return "UNSOL_NITZ_TIME_RECEIVED";
-	case RIL_UNSOL_SIGNAL_STRENGTH:
-		return "UNSOL_SIGNAL_STRENGTH";
-	case RIL_UNSOL_SUPP_SVC_NOTIFICATION:
-		return "UNSOL_SUPP_SVC_NOTIFICATION";
-	case RIL_UNSOL_STK_SESSION_END:
-		return "UNSOL_STK_SESSION_END";
-	case RIL_UNSOL_STK_PROACTIVE_COMMAND:
-		return "UNSOL_STK_PROACTIVE_COMMAND";
-	case RIL_UNSOL_STK_EVENT_NOTIFY:
-		return "UNSOL_STK_EVENT_NOTIFY";
-	case RIL_UNSOL_STK_CALL_SETUP:
-		return "UNSOL_STK_CALL_SETUP";
-	case RIL_UNSOL_SIM_SMS_STORAGE_FULL:
-		return "UNSOL_SIM_SMS_STORAGE_FUL";
-	case RIL_UNSOL_SIM_REFRESH:
-		return "UNSOL_SIM_REFRESH";
-	case RIL_UNSOL_DATA_CALL_LIST_CHANGED:
-		return "UNSOL_DATA_CALL_LIST_CHANGED";
-	case RIL_UNSOL_CALL_RING:
-		return "UNSOL_CALL_RING";
-	case RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED:
-		return "UNSOL_RESPONSE_SIM_STATUS_CHANGED";
-	case RIL_UNSOL_RESPONSE_CDMA_NEW_SMS:
-		return "UNSOL_NEW_CDMA_SMS";
-	case RIL_UNSOL_RESPONSE_NEW_BROADCAST_SMS:
-		return "UNSOL_NEW_BROADCAST_SMS";
-	case RIL_UNSOL_CDMA_RUIM_SMS_STORAGE_FULL:
-		return "UNSOL_CDMA_RUIM_SMS_STORAGE_FULL";
-	case RIL_UNSOL_RESTRICTED_STATE_CHANGED:
-		return "UNSOL_RESTRICTED_STATE_CHANGED";
-	case RIL_UNSOL_ENTER_EMERGENCY_CALLBACK_MODE:
-		return "UNSOL_ENTER_EMERGENCY_CALLBACK_MODE";
-	case RIL_UNSOL_CDMA_CALL_WAITING:
-		return "UNSOL_CDMA_CALL_WAITING";
-	case RIL_UNSOL_CDMA_OTA_PROVISION_STATUS:
-		return "UNSOL_CDMA_OTA_PROVISION_STATUS";
-	case RIL_UNSOL_CDMA_INFO_REC:
-		return "UNSOL_CDMA_INFO_REC";
-	case RIL_UNSOL_OEM_HOOK_RAW:
-		return "UNSOL_OEM_HOOK_RAW";
-	case RIL_UNSOL_RINGBACK_TONE:
-		return "UNSOL_RINGBACK_TONE";
-	case RIL_UNSOL_RESEND_INCALL_MUTE:
-		return "UNSOL_RESEND_INCALL_MUTE";
-	case RIL_UNSOL_CDMA_SUBSCRIPTION_SOURCE_CHANGED:
-		return "UNSOL_CDMA_SUBSCRIPTION_SOURCE_CHANGED";
-	case RIL_UNSOL_CDMA_PRL_CHANGED:
-		return "UNSOL_CDMA_PRL_CHANGED";
-	case RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE:
-		return "UNSOL_EXIT_EMERGENCY_CALLBACK_MODE";
-	case RIL_UNSOL_RIL_CONNECTED:
-		return "UNSOL_RIL_CONNECTED";
-	default:
-		return "<unknown request>";
-	}
-}
-
-const char *ril_pdp_fail_to_string(int status)
-{
-	switch (status) {
-	case PDP_FAIL_NONE:
-		return "NONE";
-	case PDP_FAIL_OPERATOR_BARRED:
-		return "OPERATOR_BARRED";
-	case PDP_FAIL_INSUFFICIENT_RESOURCES:
-		return "INSUFFICIENT_RESOURCES";
-	case PDP_FAIL_MISSING_UKNOWN_APN:
-		return "MISSING_UKNOWN_APN";
-	case PDP_FAIL_UNKNOWN_PDP_ADDRESS_TYPE:
-		return "UNKNOWN_PDP_ADDRESS_TYPE";
-	case PDP_FAIL_USER_AUTHENTICATION:
-		return "USER_AUTHENTICATION";
-	case PDP_FAIL_ACTIVATION_REJECT_GGSN:
-		return "ACTIVATION_REJECT_GGSN";
-	case PDP_FAIL_ACTIVATION_REJECT_UNSPECIFIED:
-		return "ACTIVATION_REJECT_UNSPECIFIED";
-	case PDP_FAIL_SERVICE_OPTION_NOT_SUPPORTED:
-		return "SERVICE_OPTION_NOT_SUPPORTED";
-	case PDP_FAIL_SERVICE_OPTION_NOT_SUBSCRIBED:
-		return "SERVICE_OPTION_NOT_SUBSCRIBED";
-	case PDP_FAIL_SERVICE_OPTION_OUT_OF_ORDER:
-		return "SERVICE_OPTION_OUT_OF_ORDER";
-	case PDP_FAIL_NSAPI_IN_USE:
-		return "NSAPI_IN_USE";
-	case PDP_FAIL_REGULAR_DEACTIVATION:
-		return "REGULAR_DEACTIVATION";
-	case PDP_FAIL_ONLY_IPV4_ALLOWED:
-		return "ONLY_IPV4_ALLOWED";
-	case PDP_FAIL_ONLY_IPV6_ALLOWED:
-		return "ONLY_IPV6_ALLOWED";
-	case PDP_FAIL_ONLY_SINGLE_BEARER_ALLOWED:
-		return "ONLY_SINGLE_BEARER_ALLOWED";
-	case PDP_FAIL_PROTOCOL_ERRORS:
-		return "PROTOCOL_ERRORS";
-	case PDP_FAIL_VOICE_REGISTRATION_FAIL:
-		return "VOICE_REGISTRATION_FAIL";
-	case PDP_FAIL_DATA_REGISTRATION_FAIL:
-		return "DATA_REGISTRATION_FAIL";
-	case PDP_FAIL_SIGNAL_LOST:
-		return "SIGNAL_LOST";
-	case PDP_FAIL_PREF_RADIO_TECH_CHANGED:
-		return "PREF_RADIO_TECH_CHANGED";
-	case PDP_FAIL_RADIO_POWER_OFF:
-		return "RADIO_POWER_OFF";
-	case PDP_FAIL_TETHERED_CALL_ACTIVE:
-		return "TETHERED_CALL_ACTIVE";
-	case PDP_FAIL_ERROR_UNSPECIFIED:
-		return "ERROR_UNSPECIFIED";
-	default:
-		if (g_snprintf(temp_str, sizeof(temp_str),
-				"<UNKNOWN (%d)>", status))
-			return temp_str;
-		else
-			return "<UNKNOWN>";
-	}
-}
 
 void g_ril_util_debug_hexdump(gboolean in, const unsigned char *buf, gsize len,
 				GRilDebugFunc debugf, gpointer user_data)
diff --git a/gril/grilutil.h b/gril/grilutil.h
index 8251c6d..623afc7 100644
--- a/gril/grilutil.h
+++ b/gril/grilutil.h
@@ -28,23 +28,8 @@ extern "C" {
 #endif
 
 #include "gfunc.h"
-#include "parcel.h"
 #include "gril.h"
 
-const char *ril_ofono_protocol_to_ril_string(guint protocol);
-int ril_protocol_string_to_ofono_protocol(gchar *protocol_str);
-const char *ril_appstate_to_string(int app_state);
-const char *ril_apptype_to_string(int app_type);
-const char *ril_authtype_to_string(int auth_type);
-const char *ril_cardstate_to_string(int card_state);
-const char *ril_error_to_string(int error);
-const char *ril_pinstate_to_string(int pin_state);
-const char *ril_radio_state_to_string(int radio_state);
-const char *ril_radio_tech_to_string(int radio_tech);
-const char *ril_request_id_to_string(int req);
-const char *ril_unsol_request_to_string(int request);
-const char *ril_pdp_fail_to_string(int status);
-
 void g_ril_util_debug_hexdump(gboolean in, const unsigned char *buf, gsize len,
 				GRilDebugFunc debugf, gpointer user_data);
 
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 03/10] rilmodem: Adapt to movement of parcel processing
  2015-10-15 16:46 [PATCH 00/10] Re-factoring of gril and rilmodem Alfonso Sanchez-Beato
  2015-10-15 16:46 ` [PATCH 01/10] gril: Move parcel processing to rilmodem Alfonso Sanchez-Beato
  2015-10-15 16:46 ` [PATCH 02/10] gril: Adapt to movement of parcel processing Alfonso Sanchez-Beato
@ 2015-10-15 16:46 ` Alfonso Sanchez-Beato
  2015-10-15 16:46 ` [PATCH 04/10] ril: " Alfonso Sanchez-Beato
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 16+ messages in thread
From: Alfonso Sanchez-Beato @ 2015-10-15 16:46 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 29500 bytes --]

---
 drivers/rilmodem/call-barring.c         |   4 +-
 drivers/rilmodem/call-forwarding.c      |   6 +-
 drivers/rilmodem/call-settings.c        |   4 +-
 drivers/rilmodem/call-volume.c          |   4 +-
 drivers/rilmodem/devinfo.c              |   2 +-
 drivers/rilmodem/gprs-context.c         |   6 +-
 drivers/rilmodem/gprs.c                 |   6 +-
 drivers/rilmodem/network-registration.c |   6 +-
 drivers/rilmodem/radio-settings.c       |   4 +-
 drivers/rilmodem/rilutil.c              | 623 ++++++++++++++++++++++++++++++++
 drivers/rilmodem/rilutil.h              |  14 +
 drivers/rilmodem/sim.c                  |   6 +-
 drivers/rilmodem/sms.c                  |   6 +-
 drivers/rilmodem/ussd.c                 |   4 +-
 drivers/rilmodem/voicecall.c            |   6 +-
 15 files changed, 669 insertions(+), 32 deletions(-)

diff --git a/drivers/rilmodem/call-barring.c b/drivers/rilmodem/call-barring.c
index 6a19556..c2bd9bc 100644
--- a/drivers/rilmodem/call-barring.c
+++ b/drivers/rilmodem/call-barring.c
@@ -28,8 +28,8 @@
 #include <ofono/modem.h>
 
 #include "common.h"
-#include "grilrequest.h"
-#include "grilreply.h"
+#include "rilrequest.h"
+#include "rilreply.h"
 #include "call-barring.h"
 #include "rilmodem.h"
 #include "ril_constants.h"
diff --git a/drivers/rilmodem/call-forwarding.c b/drivers/rilmodem/call-forwarding.c
index 7965e7d..6a66514 100644
--- a/drivers/rilmodem/call-forwarding.c
+++ b/drivers/rilmodem/call-forwarding.c
@@ -38,9 +38,9 @@
 #include <ofono/call-forwarding.h>
 
 #include "gril.h"
-#include "grilrequest.h"
-#include "grilreply.h"
-#include "grilunsol.h"
+#include "rilrequest.h"
+#include "rilreply.h"
+#include "rilunsol.h"
 
 #include "rilmodem.h"
 
diff --git a/drivers/rilmodem/call-settings.c b/drivers/rilmodem/call-settings.c
index 5603fbd..9f3f79b 100644
--- a/drivers/rilmodem/call-settings.c
+++ b/drivers/rilmodem/call-settings.c
@@ -40,8 +40,8 @@
 
 #include "gril.h"
 #include "grilutil.h"
-#include "grilrequest.h"
-#include "grilreply.h"
+#include "rilrequest.h"
+#include "rilreply.h"
 
 #include "rilmodem.h"
 #include "ril_constants.h"
diff --git a/drivers/rilmodem/call-volume.c b/drivers/rilmodem/call-volume.c
index 4e88772..06452d2 100644
--- a/drivers/rilmodem/call-volume.c
+++ b/drivers/rilmodem/call-volume.c
@@ -42,8 +42,8 @@
 
 #include "rilmodem.h"
 #include "parcel.h"
-#include "grilrequest.h"
-#include "grilreply.h"
+#include "rilrequest.h"
+#include "rilreply.h"
 
 struct cv_data {
 	GRil *ril;
diff --git a/drivers/rilmodem/devinfo.c b/drivers/rilmodem/devinfo.c
index 2811837..4d2bcf5 100644
--- a/drivers/rilmodem/devinfo.c
+++ b/drivers/rilmodem/devinfo.c
@@ -39,7 +39,7 @@
 #include "gril.h"
 
 #include "rilmodem.h"
-#include "grilreply.h"
+#include "rilreply.h"
 
 /*
  * TODO: The functions in this file are stubbed out, and
diff --git a/drivers/rilmodem/gprs-context.c b/drivers/rilmodem/gprs-context.c
index 2021533..ad2499c 100644
--- a/drivers/rilmodem/gprs-context.c
+++ b/drivers/rilmodem/gprs-context.c
@@ -40,9 +40,9 @@
 
 #include "ofono.h"
 
-#include "grilreply.h"
-#include "grilrequest.h"
-#include "grilunsol.h"
+#include "rilreply.h"
+#include "rilrequest.h"
+#include "rilunsol.h"
 
 #include "gprs.h"
 #include "rilmodem.h"
diff --git a/drivers/rilmodem/gprs.c b/drivers/rilmodem/gprs.c
index 75dcfcc..76db3d1 100644
--- a/drivers/rilmodem/gprs.c
+++ b/drivers/rilmodem/gprs.c
@@ -44,9 +44,9 @@
 #include "common.h"
 #include "rilmodem.h"
 
-#include "grilreply.h"
-#include "grilrequest.h"
-#include "grilunsol.h"
+#include "rilreply.h"
+#include "rilrequest.h"
+#include "rilunsol.h"
 #include "gprs.h"
 
 /* Time between get data status retries */
diff --git a/drivers/rilmodem/network-registration.c b/drivers/rilmodem/network-registration.c
index 6808a29..de93540 100644
--- a/drivers/rilmodem/network-registration.c
+++ b/drivers/rilmodem/network-registration.c
@@ -41,9 +41,9 @@
 #include "gril.h"
 #include "rilmodem.h"
 
-#include "grilreply.h"
-#include "grilrequest.h"
-#include "grilunsol.h"
+#include "rilreply.h"
+#include "rilrequest.h"
+#include "rilunsol.h"
 
 struct netreg_data {
 	GRil *ril;
diff --git a/drivers/rilmodem/radio-settings.c b/drivers/rilmodem/radio-settings.c
index 9153e5b..4feeea8 100644
--- a/drivers/rilmodem/radio-settings.c
+++ b/drivers/rilmodem/radio-settings.c
@@ -41,8 +41,8 @@
 
 #include "rilmodem.h"
 
-#include "grilrequest.h"
-#include "grilreply.h"
+#include "rilrequest.h"
+#include "rilreply.h"
 #include "radio-settings.h"
 
 static void ril_set_rat_cb(struct ril_msg *message, gpointer user_data)
diff --git a/drivers/rilmodem/rilutil.c b/drivers/rilmodem/rilutil.c
index c173940..7b00dc0 100644
--- a/drivers/rilmodem/rilutil.c
+++ b/drivers/rilmodem/rilutil.c
@@ -39,6 +39,13 @@
 #include "util.h"
 #include "ril_constants.h"
 
+/* Constants used by CALL_LIST, and SETUP_DATA_CALL RIL requests */
+#define PROTO_IP_STR "IP"
+#define PROTO_IPV6_STR "IPV6"
+#define PROTO_IPV4V6_STR "IPV4V6"
+
+static char temp_str[32];
+
 struct ril_util_sim_state_query {
 	GRil *ril;
 	guint cpin_poll_source;
@@ -192,3 +199,619 @@ void ril_util_sim_state_query_free(struct ril_util_sim_state_query *req)
 
 	g_free(req);
 }
+
+const char *ril_ofono_protocol_to_ril_string(guint protocol)
+{
+	char *result;
+
+	switch (protocol) {
+	case OFONO_GPRS_PROTO_IPV6:
+		result = PROTO_IPV6_STR;
+		break;
+	case OFONO_GPRS_PROTO_IPV4V6:
+		result = PROTO_IPV4V6_STR;
+		break;
+	case OFONO_GPRS_PROTO_IP:
+		result = PROTO_IP_STR;
+		break;
+	default:
+		result = NULL;
+	}
+
+	return result;
+}
+
+int ril_protocol_string_to_ofono_protocol(gchar *protocol_str)
+{
+	int result;
+
+	if (g_strcmp0(protocol_str, PROTO_IPV6_STR) == 0)
+		result = OFONO_GPRS_PROTO_IPV6;
+	else if (g_strcmp0(protocol_str, PROTO_IPV4V6_STR) == 0)
+		result = OFONO_GPRS_PROTO_IPV4V6;
+	else if (g_strcmp0(protocol_str, PROTO_IP_STR) == 0)
+		result = OFONO_GPRS_PROTO_IP;
+	else
+		result = -1;
+
+	return result;
+}
+
+const char *ril_appstate_to_string(int app_state)
+{
+	switch (app_state) {
+	case RIL_APPSTATE_UNKNOWN:
+		return "UNKNOWN";
+	case RIL_APPSTATE_DETECTED:
+		return "DETECTED";
+	case RIL_APPSTATE_PIN:
+		return "PIN";
+	case RIL_APPSTATE_PUK:
+		return "PUK";
+	case RIL_APPSTATE_SUBSCRIPTION_PERSO:
+		return "";
+	case RIL_APPSTATE_READY:
+		return "READY";
+	default:
+		return "<INVALID>";
+	}
+}
+
+const char *ril_apptype_to_string(int app_type)
+{
+
+	switch (app_type) {
+	case RIL_APPTYPE_UNKNOWN:
+		return "UNKNOWN";
+	case RIL_APPTYPE_SIM:
+		return "SIM";
+	case RIL_APPTYPE_USIM:
+		return "USIM";
+	case RIL_APPTYPE_RUIM:
+		return "RUIM";
+	case RIL_APPTYPE_CSIM:
+		return "CSIM";
+	case RIL_APPTYPE_ISIM:
+		return "ISIM";
+	default:
+		return "<INVALID>";
+	}
+}
+
+const char *ril_authtype_to_string(int auth_type)
+{
+	switch (auth_type) {
+	case RIL_AUTH_NONE:
+		return "NONE";
+	case RIL_AUTH_PAP:
+		return "PAP";
+	case RIL_AUTH_CHAP:
+		return "CHAP";
+	case RIL_AUTH_BOTH:
+		return "BOTH";
+	case RIL_AUTH_ANY:
+		return "ANY";
+	default:
+		return "<INVALID>";
+	}
+}
+
+const char *ril_cardstate_to_string(int card_state)
+{
+	switch (card_state) {
+	case RIL_CARDSTATE_ABSENT:
+		return "ABSENT";
+	case RIL_CARDSTATE_PRESENT:
+		return "PRESENT";
+	case RIL_CARDSTATE_ERROR:
+		return "ERROR";
+	default:
+		return "<INVALID>";
+	}
+}
+
+const char *ril_error_to_string(int error)
+{
+	switch (error) {
+	case RIL_E_SUCCESS: return "SUCCESS";
+	case RIL_E_RADIO_NOT_AVAILABLE: return "RADIO_NOT_AVAILABLE";
+	case RIL_E_GENERIC_FAILURE: return "GENERIC_FAILURE";
+	case RIL_E_PASSWORD_INCORRECT: return "PASSWORD_INCORRECT";
+	case RIL_E_SIM_PIN2: return "SIM_PIN2";
+	case RIL_E_SIM_PUK2: return "SIM_PUK2";
+	case RIL_E_REQUEST_NOT_SUPPORTED: return "REQUEST_NOT_SUPPORTED";
+	case RIL_E_CANCELLED: return "CANCELLED";
+	case RIL_E_OP_NOT_ALLOWED_DURING_VOICE_CALL:
+		return "OP_NOT_ALLOWED_DURING_VOICE_CALL";
+	case RIL_E_OP_NOT_ALLOWED_BEFORE_REG_TO_NW:
+		return "OP_NOT_ALLOWED_BEFORE_REG_TO_NW";
+	case RIL_E_SMS_SEND_FAIL_RETRY: return "SMS_SEND_FAIL_RETRY";
+	case RIL_E_SIM_ABSENT: return "SIM_ABSENT";
+	case RIL_E_SUBSCRIPTION_NOT_AVAILABLE:
+		return "SUBSCRIPTION_NOT_AVAILABLE";
+	case RIL_E_MODE_NOT_SUPPORTED: return "MODE_NOT_SUPPORTED";
+	case RIL_E_FDN_CHECK_FAILURE: return "FDN_CHECK_FAILURE";
+	case RIL_E_ILLEGAL_SIM_OR_ME: return "ILLEGAL_SIM_OR_ME";
+	case RIL_E_DIAL_MODIFIED_TO_USSD: return "DIAL_MODIFIED_TO_USSD";
+	case RIL_E_DIAL_MODIFIED_TO_SS: return "DIAL_MODIFIED_TO_SS";
+	case RIL_E_DIAL_MODIFIED_TO_DIAL: return "DIAL_MODIFIED_TO_DIAL";
+	case RIL_E_USSD_MODIFIED_TO_DIAL: return "USSD_MODIFIED_TO_DIAL";
+	case RIL_E_USSD_MODIFIED_TO_SS: return "USSD_MODIFIED_TO_SS";
+	case RIL_E_USSD_MODIFIED_TO_USSD: return "USSD_MODIFIED_TO_USSD";
+	case RIL_E_SS_MODIFIED_TO_DIAL: return "SS_MODIFIED_TO_DIAL";
+	case RIL_E_SS_MODIFIED_TO_USSD: return "SS_MODIFIED_TO_USSD";
+	case RIL_E_SS_MODIFIED_TO_SS: return "SS_MODIFIED_TO_SS";
+	case RIL_E_SUBSCRIPTION_NOT_SUPPORTED:
+		return "SUBSCRIPTION_NOT_SUPPORTED";
+	default: return "<unknown errno>";
+	}
+}
+
+const char *ril_pinstate_to_string(int pin_state)
+{
+	switch (pin_state) {
+	case RIL_PINSTATE_UNKNOWN:
+		return "UNKNOWN";
+	case RIL_PINSTATE_ENABLED_NOT_VERIFIED:
+		return "ENABLED_NOT_VERIFIED";
+	case RIL_PINSTATE_ENABLED_VERIFIED:
+		return "ENABLED_VERIFIED";
+	case RIL_PINSTATE_DISABLED:
+		return "DISABLED";
+	case RIL_PINSTATE_ENABLED_BLOCKED:
+		return "ENABLED_BLOCKED";
+	case RIL_PINSTATE_ENABLED_PERM_BLOCKED:
+		return "ENABLED_PERM_BLOCKED";
+	default:
+		return "<INVALID>";
+	}
+}
+
+const char *ril_radio_state_to_string(int radio_state)
+{
+	switch (radio_state) {
+	case RADIO_STATE_OFF:
+		return "OFF";
+	case RADIO_STATE_UNAVAILABLE:
+		return "UNAVAILABLE";
+	case RADIO_STATE_SIM_NOT_READY:
+		return "SIM_NOT_READY";
+	case RADIO_STATE_SIM_LOCKED_OR_ABSENT:
+		return "SIM_LOCKED_OR_ABSENT";
+	case RADIO_STATE_SIM_READY:
+		return "SIM_READY";
+	case RADIO_STATE_ON:
+		return "ON";
+	default:
+		return "<INVALID>";
+	}
+}
+
+const char *ril_radio_tech_to_string(int radio_tech)
+{
+	switch (radio_tech) {
+	case RADIO_TECH_UNKNOWN:
+		return "UNKNOWN";
+	case RADIO_TECH_GPRS:
+		return "GPRS";
+	case RADIO_TECH_EDGE:
+		return	"EDGE";
+	case RADIO_TECH_UMTS:
+		return "UMTS";
+	case RADIO_TECH_IS95A:
+		return "IS95A";
+	case RADIO_TECH_IS95B:
+		return "IS95B";
+	case RADIO_TECH_1xRTT:
+		return "1xRTT";
+	case RADIO_TECH_EVDO_0:
+		return "EVDO_0";
+	case RADIO_TECH_EVDO_A:
+		return "EVDO_A";
+	case RADIO_TECH_HSDPA:
+		return "HSDPA";
+	case RADIO_TECH_HSUPA:
+		return "HSUPA";
+	case RADIO_TECH_HSPA:
+		return "HSPA";
+	case RADIO_TECH_EVDO_B:
+		return "EVDO_B";
+	case RADIO_TECH_EHRPD:
+		return "EHRPD";
+	case RADIO_TECH_LTE:
+		return "LTE";
+	case RADIO_TECH_HSPAP:
+		return "HSPAP";
+	case RADIO_TECH_GSM:
+		return "GSM";
+	case MTK_RADIO_TECH_HSDPAP:
+		return "MTK_HSDPAP";
+	case MTK_RADIO_TECH_HSDPAP_UPA:
+		return "MTK_HSDPAP_UPA";
+	case MTK_RADIO_TECH_HSUPAP:
+		return "MTK_HSUPAP";
+	case MTK_RADIO_TECH_HSUPAP_DPA:
+		return "MTK_HSUPAP_DPA";
+	case MTK_RADIO_TECH_DC_DPA:
+		return "MTK_DC_DPA";
+	case MTK_RADIO_TECH_DC_UPA:
+		return "MTK_DC_UPA";
+	case MTK_RADIO_TECH_DC_HSDPAP:
+		return "MTK_DC_HSDPAP";
+	case MTK_RADIO_TECH_DC_HSDPAP_UPA:
+		return "MTK_DC_HSDPAP_UPA";
+	case MTK_RADIO_TECH_DC_HSDPAP_DPA:
+		return "MTK_DC_HSDPAP_DPA";
+	case MTK_RADIO_TECH_DC_HSPAP:
+		return "MTK_DC_HSPAP";
+	default:
+		if (g_snprintf(temp_str, sizeof(temp_str),
+				"<INVALID (%d)>",
+				radio_tech))
+			return temp_str;
+		else
+			return "<INVALID>";
+	}
+}
+
+const char *ril_request_id_to_string(int req)
+{
+	switch (req) {
+	case RIL_REQUEST_GET_SIM_STATUS:
+		return "RIL_REQUEST_GET_SIM_STATUS";
+	case RIL_REQUEST_ENTER_SIM_PIN:
+		return "RIL_REQUEST_ENTER_SIM_PIN";
+	case RIL_REQUEST_ENTER_SIM_PUK:
+		return "RIL_REQUEST_ENTER_SIM_PUK";
+	case RIL_REQUEST_ENTER_SIM_PIN2:
+		return "RIL_REQUEST_ENTER_SIM_PIN2";
+	case RIL_REQUEST_ENTER_SIM_PUK2:
+		return "RIL_REQUEST_ENTER_SIM_PUK2";
+	case RIL_REQUEST_CHANGE_SIM_PIN:
+		return "RIL_REQUEST_CHANGE_SIM_PIN";
+	case RIL_REQUEST_CHANGE_SIM_PIN2:
+		return "RIL_REQUEST_CHANGE_SIM_PIN2";
+	case RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION:
+		return "RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION";
+	case RIL_REQUEST_GET_CURRENT_CALLS:
+		return "RIL_REQUEST_GET_CURRENT_CALLS";
+	case RIL_REQUEST_DIAL:
+		return "RIL_REQUEST_DIAL";
+	case RIL_REQUEST_GET_IMSI:
+		return "RIL_REQUEST_GET_IMSI";
+	case RIL_REQUEST_HANGUP:
+		return "RIL_REQUEST_HANGUP";
+	case RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND:
+		return "RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND";
+	case RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND:
+		return "RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND";
+	case RIL_REQUEST_SWITCH_HOLDING_AND_ACTIVE:
+		return "RIL_REQUEST_SWITCH_HOLDING_AND_ACTIVE";
+	case RIL_REQUEST_CONFERENCE:
+		return "RIL_REQUEST_CONFERENCE";
+	case RIL_REQUEST_UDUB:
+		return "RIL_REQUEST_UDUB";
+	case RIL_REQUEST_LAST_CALL_FAIL_CAUSE:
+		return "RIL_REQUEST_LAST_CALL_FAIL_CAUSE";
+	case RIL_REQUEST_SIGNAL_STRENGTH:
+		return "RIL_REQUEST_SIGNAL_STRENGTH";
+	case RIL_REQUEST_VOICE_REGISTRATION_STATE:
+		return "RIL_REQUEST_VOICE_REGISTRATION_STATE";
+	case RIL_REQUEST_DATA_REGISTRATION_STATE:
+		return "RIL_REQUEST_DATA_REGISTRATION_STATE";
+	case RIL_REQUEST_OPERATOR:
+		return "RIL_REQUEST_OPERATOR";
+	case RIL_REQUEST_RADIO_POWER:
+		return "RIL_REQUEST_RADIO_POWER";
+	case RIL_REQUEST_DTMF:
+		return "RIL_REQUEST_DTMF";
+	case RIL_REQUEST_SEND_SMS:
+		return "RIL_REQUEST_SEND_SMS";
+	case RIL_REQUEST_SEND_SMS_EXPECT_MORE:
+		return "RIL_REQUEST_SEND_SMS_EXPECT_MORE";
+	case RIL_REQUEST_SETUP_DATA_CALL:
+		return "RIL_REQUEST_SETUP_DATA_CALL";
+	case RIL_REQUEST_SIM_IO:
+		return "RIL_REQUEST_SIM_IO";
+	case RIL_REQUEST_SEND_USSD:
+		return "RIL_REQUEST_SEND_USSD";
+	case RIL_REQUEST_CANCEL_USSD:
+		return "RIL_REQUEST_CANCEL_USSD";
+	case RIL_REQUEST_GET_CLIR:
+		return "RIL_REQUEST_GET_CLIR";
+	case RIL_REQUEST_SET_CLIR:
+		return "RIL_REQUEST_SET_CLIR";
+	case RIL_REQUEST_QUERY_CALL_FORWARD_STATUS:
+		return "RIL_REQUEST_QUERY_CALL_FORWARD_STATUS";
+	case RIL_REQUEST_SET_CALL_FORWARD:
+		return "RIL_REQUEST_SET_CALL_FORWARD";
+	case RIL_REQUEST_QUERY_CALL_WAITING:
+		return "RIL_REQUEST_QUERY_CALL_WAITING";
+	case RIL_REQUEST_SET_CALL_WAITING:
+		return "RIL_REQUEST_SET_CALL_WAITING";
+	case RIL_REQUEST_SMS_ACKNOWLEDGE:
+		return "RIL_REQUEST_SMS_ACKNOWLEDGE ";
+	case RIL_REQUEST_GET_IMEI:
+		return "RIL_REQUEST_GET_IMEI";
+	case RIL_REQUEST_GET_IMEISV:
+		return "RIL_REQUEST_GET_IMEISV";
+	case RIL_REQUEST_ANSWER:
+		return "RIL_REQUEST_ANSWER";
+	case RIL_REQUEST_DEACTIVATE_DATA_CALL:
+		return "RIL_REQUEST_DEACTIVATE_DATA_CALL";
+	case RIL_REQUEST_QUERY_FACILITY_LOCK:
+		return "RIL_REQUEST_QUERY_FACILITY_LOCK";
+	case RIL_REQUEST_SET_FACILITY_LOCK:
+		return "RIL_REQUEST_SET_FACILITY_LOCK";
+	case RIL_REQUEST_CHANGE_BARRING_PASSWORD:
+		return "RIL_REQUEST_CHANGE_BARRING_PASSWORD";
+	case RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE:
+		return "RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE";
+	case RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC:
+		return "RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC";
+	case RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL:
+		return "RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL";
+	case RIL_REQUEST_QUERY_AVAILABLE_NETWORKS:
+		return "RIL_REQUEST_QUERY_AVAILABLE_NETWORKS";
+	case RIL_REQUEST_DTMF_START:
+		return "RIL_REQUEST_DTMF_START";
+	case RIL_REQUEST_DTMF_STOP:
+		return "RIL_REQUEST_DTMF_STOP";
+	case RIL_REQUEST_BASEBAND_VERSION:
+		return "RIL_REQUEST_BASEBAND_VERSION";
+	case RIL_REQUEST_SEPARATE_CONNECTION:
+		return "RIL_REQUEST_SEPARATE_CONNECTION";
+	case RIL_REQUEST_SET_MUTE:
+		return "RIL_REQUEST_SET_MUTE";
+	case RIL_REQUEST_GET_MUTE:
+		return "RIL_REQUEST_GET_MUTE";
+	case RIL_REQUEST_QUERY_CLIP:
+		return "RIL_REQUEST_QUERY_CLIP";
+	case RIL_REQUEST_LAST_DATA_CALL_FAIL_CAUSE:
+		return "RIL_REQUEST_LAST_DATA_CALL_FAIL_CAUSE";
+	case RIL_REQUEST_DATA_CALL_LIST:
+		return "RIL_REQUEST_DATA_CALL_LIST";
+	case RIL_REQUEST_RESET_RADIO:
+		return "RIL_REQUEST_RESET_RADIO";
+	case RIL_REQUEST_OEM_HOOK_RAW:
+		return "RIL_REQUEST_OEM_HOOK_RAW";
+	case RIL_REQUEST_OEM_HOOK_STRINGS:
+		return "RIL_REQUEST_OEM_HOOK_STRINGS";
+	case RIL_REQUEST_SCREEN_STATE:
+		return "RIL_REQUEST_SCREEN_STATE";
+	case RIL_REQUEST_SET_SUPP_SVC_NOTIFICATION:
+		return "RIL_REQUEST_SET_SUPP_SVC_NOTIFICATION";
+	case RIL_REQUEST_WRITE_SMS_TO_SIM:
+		return "RIL_REQUEST_WRITE_SMS_TO_SIM";
+	case RIL_REQUEST_DELETE_SMS_ON_SIM:
+		return "RIL_REQUEST_DELETE_SMS_ON_SIM";
+	case RIL_REQUEST_SET_BAND_MODE:
+		return "RIL_REQUEST_SET_BAND_MODE";
+	case RIL_REQUEST_QUERY_AVAILABLE_BAND_MODE:
+		return "RIL_REQUEST_QUERY_AVAILABLE_BAND_MODE";
+	case RIL_REQUEST_STK_GET_PROFILE:
+		return "RIL_REQUEST_STK_GET_PROFILE";
+	case RIL_REQUEST_STK_SET_PROFILE:
+		return "RIL_REQUEST_STK_SET_PROFILE";
+	case RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND:
+		return "RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND";
+	case RIL_REQUEST_STK_SEND_TERMINAL_RESPONSE:
+		return "RIL_REQUEST_STK_SEND_TERMINAL_RESPONSE";
+	case RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM:
+		return "RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM";
+	case RIL_REQUEST_EXPLICIT_CALL_TRANSFER:
+		return "RIL_REQUEST_EXPLICIT_CALL_TRANSFER";
+	case RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE:
+		return "RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE";
+	case RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE:
+		return "RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE";
+	case RIL_REQUEST_GET_NEIGHBORING_CELL_IDS:
+		return "RIL_REQUEST_GET_NEIGHBORING_CELL_IDS";
+	case RIL_REQUEST_SET_LOCATION_UPDATES:
+		return "RIL_REQUEST_SET_LOCATION_UPDATES";
+	case RIL_REQUEST_CDMA_SET_SUBSCRIPTION_SOURCE:
+		return "RIL_REQUEST_CDMA_SET_SUBSCRIPTION_SOURCE";
+	case RIL_REQUEST_CDMA_SET_ROAMING_PREFERENCE:
+		return "RIL_REQUEST_CDMA_SET_ROAMING_PREFERENCE";
+	case RIL_REQUEST_CDMA_QUERY_ROAMING_PREFERENCE:
+		return "RIL_REQUEST_CDMA_QUERY_ROAMING_PREFERENCE";
+	case RIL_REQUEST_SET_TTY_MODE:
+		return "RIL_REQUEST_SET_TTY_MODE";
+	case RIL_REQUEST_QUERY_TTY_MODE:
+		return "RIL_REQUEST_QUERY_TTY_MODE";
+	case RIL_REQUEST_CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE:
+		return "RIL_REQUEST_CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE";
+	case RIL_REQUEST_CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE:
+		return "RIL_REQUEST_CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE";
+	case RIL_REQUEST_CDMA_FLASH:
+		return "RIL_REQUEST_CDMA_FLASH";
+	case RIL_REQUEST_CDMA_BURST_DTMF:
+		return "RIL_REQUEST_CDMA_BURST_DTMF";
+	case RIL_REQUEST_CDMA_VALIDATE_AND_WRITE_AKEY:
+		return "RIL_REQUEST_CDMA_VALIDATE_AND_WRITE_AKEY";
+	case RIL_REQUEST_CDMA_SEND_SMS:
+		return "RIL_REQUEST_CDMA_SEND_SMS";
+	case RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE:
+		return "RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE";
+	case RIL_REQUEST_GSM_GET_BROADCAST_SMS_CONFIG:
+		return "RIL_REQUEST_GSM_GET_BROADCAST_SMS_CONFIG";
+	case RIL_REQUEST_GSM_SET_BROADCAST_SMS_CONFIG:
+		return "RIL_REQUEST_GSM_SET_BROADCAST_SMS_CONFIG";
+	case RIL_REQUEST_GSM_SMS_BROADCAST_ACTIVATION:
+		return "RIL_REQUEST_GSM_SMS_BROADCAST_ACTIVATION";
+	case RIL_REQUEST_CDMA_GET_BROADCAST_SMS_CONFIG:
+		return "RIL_REQUEST_CDMA_GET_BROADCAST_SMS_CONFIG";
+	case RIL_REQUEST_CDMA_SET_BROADCAST_SMS_CONFIG:
+		return "RIL_REQUEST_CDMA_SET_BROADCAST_SMS_CONFIG";
+	case RIL_REQUEST_CDMA_SMS_BROADCAST_ACTIVATION:
+		return "RIL_REQUEST_CDMA_SMS_BROADCAST_ACTIVATION";
+	case RIL_REQUEST_CDMA_SUBSCRIPTION:
+		return "RIL_REQUEST_CDMA_SUBSCRIPTION";
+	case RIL_REQUEST_CDMA_WRITE_SMS_TO_RUIM:
+		return "RIL_REQUEST_CDMA_WRITE_SMS_TO_RUIM";
+	case RIL_REQUEST_CDMA_DELETE_SMS_ON_RUIM:
+		return "RIL_REQUEST_CDMA_DELETE_SMS_ON_RUIM";
+	case RIL_REQUEST_DEVICE_IDENTITY:
+		return "RIL_REQUEST_DEVICE_IDENTITY";
+	case RIL_REQUEST_EXIT_EMERGENCY_CALLBACK_MODE:
+		return "RIL_REQUEST_EXIT_EMERGENCY_CALLBACK_MODE";
+	case RIL_REQUEST_GET_SMSC_ADDRESS:
+		return "RIL_REQUEST_GET_SMSC_ADDRESS";
+	case RIL_REQUEST_SET_SMSC_ADDRESS:
+		return "RIL_REQUEST_SET_SMSC_ADDRESS";
+	case RIL_REQUEST_REPORT_SMS_MEMORY_STATUS:
+		return "RIL_REQUEST_REPORT_SMS_MEMORY_STATUS";
+	case RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING:
+		return "RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING";
+	case RIL_REQUEST_CDMA_GET_SUBSCRIPTION_SOURCE:
+		return "RIL_REQUEST_CDMA_GET_SUBSCRIPTION_SOURCE";
+	case RIL_REQUEST_ISIM_AUTHENTICATION:
+		return "RIL_REQUEST_ISIM_AUTHENTICATION";
+	case RIL_REQUEST_ACKNOWLEDGE_INCOMING_GSM_SMS_WITH_PDU:
+		return "RIL_REQUEST_ACKNOWLEDGE_INCOMING_GSM_SMS_WITH_PDU";
+	case RIL_REQUEST_STK_SEND_ENVELOPE_WITH_STATUS:
+		return "RIL_REQUEST_STK_SEND_ENVELOPE_WITH_STATUS";
+	case RIL_REQUEST_SET_INITIAL_ATTACH_APN:
+		return "RIL_REQUEST_SET_INITIAL_ATTACH_APN";
+	default:
+		return "<INVALID>";
+	}
+}
+
+const char *ril_unsol_request_to_string(int request)
+{
+	switch (request) {
+	case RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED:
+		return "UNSOL_RESPONSE_RADIO_STATE_CHANGED";
+	case RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED:
+		return "UNSOL_RESPONSE_CALL_STATE_CHANGED";
+	case RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED:
+		return "UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED";
+	case RIL_UNSOL_RESPONSE_NEW_SMS:
+		return "UNSOL_RESPONSE_NEW_SMS";
+	case RIL_UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT:
+		return "UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT";
+	case RIL_UNSOL_RESPONSE_NEW_SMS_ON_SIM:
+		return "UNSOL_RESPONSE_NEW_SMS_ON_SIM";
+	case RIL_UNSOL_ON_USSD:
+		return "UNSOL_ON_USSD";
+	case RIL_UNSOL_ON_USSD_REQUEST:
+		return "UNSOL_ON_USSD_REQUEST(obsolete)";
+	case RIL_UNSOL_NITZ_TIME_RECEIVED:
+		return "UNSOL_NITZ_TIME_RECEIVED";
+	case RIL_UNSOL_SIGNAL_STRENGTH:
+		return "UNSOL_SIGNAL_STRENGTH";
+	case RIL_UNSOL_SUPP_SVC_NOTIFICATION:
+		return "UNSOL_SUPP_SVC_NOTIFICATION";
+	case RIL_UNSOL_STK_SESSION_END:
+		return "UNSOL_STK_SESSION_END";
+	case RIL_UNSOL_STK_PROACTIVE_COMMAND:
+		return "UNSOL_STK_PROACTIVE_COMMAND";
+	case RIL_UNSOL_STK_EVENT_NOTIFY:
+		return "UNSOL_STK_EVENT_NOTIFY";
+	case RIL_UNSOL_STK_CALL_SETUP:
+		return "UNSOL_STK_CALL_SETUP";
+	case RIL_UNSOL_SIM_SMS_STORAGE_FULL:
+		return "UNSOL_SIM_SMS_STORAGE_FUL";
+	case RIL_UNSOL_SIM_REFRESH:
+		return "UNSOL_SIM_REFRESH";
+	case RIL_UNSOL_DATA_CALL_LIST_CHANGED:
+		return "UNSOL_DATA_CALL_LIST_CHANGED";
+	case RIL_UNSOL_CALL_RING:
+		return "UNSOL_CALL_RING";
+	case RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED:
+		return "UNSOL_RESPONSE_SIM_STATUS_CHANGED";
+	case RIL_UNSOL_RESPONSE_CDMA_NEW_SMS:
+		return "UNSOL_NEW_CDMA_SMS";
+	case RIL_UNSOL_RESPONSE_NEW_BROADCAST_SMS:
+		return "UNSOL_NEW_BROADCAST_SMS";
+	case RIL_UNSOL_CDMA_RUIM_SMS_STORAGE_FULL:
+		return "UNSOL_CDMA_RUIM_SMS_STORAGE_FULL";
+	case RIL_UNSOL_RESTRICTED_STATE_CHANGED:
+		return "UNSOL_RESTRICTED_STATE_CHANGED";
+	case RIL_UNSOL_ENTER_EMERGENCY_CALLBACK_MODE:
+		return "UNSOL_ENTER_EMERGENCY_CALLBACK_MODE";
+	case RIL_UNSOL_CDMA_CALL_WAITING:
+		return "UNSOL_CDMA_CALL_WAITING";
+	case RIL_UNSOL_CDMA_OTA_PROVISION_STATUS:
+		return "UNSOL_CDMA_OTA_PROVISION_STATUS";
+	case RIL_UNSOL_CDMA_INFO_REC:
+		return "UNSOL_CDMA_INFO_REC";
+	case RIL_UNSOL_OEM_HOOK_RAW:
+		return "UNSOL_OEM_HOOK_RAW";
+	case RIL_UNSOL_RINGBACK_TONE:
+		return "UNSOL_RINGBACK_TONE";
+	case RIL_UNSOL_RESEND_INCALL_MUTE:
+		return "UNSOL_RESEND_INCALL_MUTE";
+	case RIL_UNSOL_CDMA_SUBSCRIPTION_SOURCE_CHANGED:
+		return "UNSOL_CDMA_SUBSCRIPTION_SOURCE_CHANGED";
+	case RIL_UNSOL_CDMA_PRL_CHANGED:
+		return "UNSOL_CDMA_PRL_CHANGED";
+	case RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE:
+		return "UNSOL_EXIT_EMERGENCY_CALLBACK_MODE";
+	case RIL_UNSOL_RIL_CONNECTED:
+		return "UNSOL_RIL_CONNECTED";
+	default:
+		return "<unknown request>";
+	}
+}
+
+const char *ril_pdp_fail_to_string(int status)
+{
+	switch (status) {
+	case PDP_FAIL_NONE:
+		return "NONE";
+	case PDP_FAIL_OPERATOR_BARRED:
+		return "OPERATOR_BARRED";
+	case PDP_FAIL_INSUFFICIENT_RESOURCES:
+		return "INSUFFICIENT_RESOURCES";
+	case PDP_FAIL_MISSING_UKNOWN_APN:
+		return "MISSING_UKNOWN_APN";
+	case PDP_FAIL_UNKNOWN_PDP_ADDRESS_TYPE:
+		return "UNKNOWN_PDP_ADDRESS_TYPE";
+	case PDP_FAIL_USER_AUTHENTICATION:
+		return "USER_AUTHENTICATION";
+	case PDP_FAIL_ACTIVATION_REJECT_GGSN:
+		return "ACTIVATION_REJECT_GGSN";
+	case PDP_FAIL_ACTIVATION_REJECT_UNSPECIFIED:
+		return "ACTIVATION_REJECT_UNSPECIFIED";
+	case PDP_FAIL_SERVICE_OPTION_NOT_SUPPORTED:
+		return "SERVICE_OPTION_NOT_SUPPORTED";
+	case PDP_FAIL_SERVICE_OPTION_NOT_SUBSCRIBED:
+		return "SERVICE_OPTION_NOT_SUBSCRIBED";
+	case PDP_FAIL_SERVICE_OPTION_OUT_OF_ORDER:
+		return "SERVICE_OPTION_OUT_OF_ORDER";
+	case PDP_FAIL_NSAPI_IN_USE:
+		return "NSAPI_IN_USE";
+	case PDP_FAIL_REGULAR_DEACTIVATION:
+		return "REGULAR_DEACTIVATION";
+	case PDP_FAIL_ONLY_IPV4_ALLOWED:
+		return "ONLY_IPV4_ALLOWED";
+	case PDP_FAIL_ONLY_IPV6_ALLOWED:
+		return "ONLY_IPV6_ALLOWED";
+	case PDP_FAIL_ONLY_SINGLE_BEARER_ALLOWED:
+		return "ONLY_SINGLE_BEARER_ALLOWED";
+	case PDP_FAIL_PROTOCOL_ERRORS:
+		return "PROTOCOL_ERRORS";
+	case PDP_FAIL_VOICE_REGISTRATION_FAIL:
+		return "VOICE_REGISTRATION_FAIL";
+	case PDP_FAIL_DATA_REGISTRATION_FAIL:
+		return "DATA_REGISTRATION_FAIL";
+	case PDP_FAIL_SIGNAL_LOST:
+		return "SIGNAL_LOST";
+	case PDP_FAIL_PREF_RADIO_TECH_CHANGED:
+		return "PREF_RADIO_TECH_CHANGED";
+	case PDP_FAIL_RADIO_POWER_OFF:
+		return "RADIO_POWER_OFF";
+	case PDP_FAIL_TETHERED_CALL_ACTIVE:
+		return "TETHERED_CALL_ACTIVE";
+	case PDP_FAIL_ERROR_UNSPECIFIED:
+		return "ERROR_UNSPECIFIED";
+	default:
+		if (g_snprintf(temp_str, sizeof(temp_str),
+				"<UNKNOWN (%d)>", status))
+			return temp_str;
+		else
+			return "<UNKNOWN>";
+	}
+}
diff --git a/drivers/rilmodem/rilutil.h b/drivers/rilmodem/rilutil.h
index 25aed2e..e94af24 100644
--- a/drivers/rilmodem/rilutil.h
+++ b/drivers/rilmodem/rilutil.h
@@ -26,6 +26,7 @@
 #include <modem.h>
 #include <sim.h>
 #include <gprs-context.h>
+#include <gril.h>
 
 /* TODO: create a table lookup*/
 #define PREFIX_30_NETMASK "255.255.255.252"
@@ -109,6 +110,19 @@ struct ril_util_sim_state_query *ril_util_sim_state_query_new(GRil *ril,
 						void *userdata,
 						GDestroyNotify destroy);
 void ril_util_sim_state_query_free(struct ril_util_sim_state_query *req);
+const char *ril_ofono_protocol_to_ril_string(guint protocol);
+int ril_protocol_string_to_ofono_protocol(gchar *protocol_str);
+const char *ril_appstate_to_string(int app_state);
+const char *ril_apptype_to_string(int app_type);
+const char *ril_authtype_to_string(int auth_type);
+const char *ril_cardstate_to_string(int card_state);
+const char *ril_error_to_string(int error);
+const char *ril_pinstate_to_string(int pin_state);
+const char *ril_radio_state_to_string(int radio_state);
+const char *ril_radio_tech_to_string(int radio_tech);
+const char *ril_request_id_to_string(int req);
+const char *ril_unsol_request_to_string(int request);
+const char *ril_pdp_fail_to_string(int status);
 
 struct cb_data {
 	void *cb;
diff --git a/drivers/rilmodem/sim.c b/drivers/rilmodem/sim.c
index 1014845..af40397 100644
--- a/drivers/rilmodem/sim.c
+++ b/drivers/rilmodem/sim.c
@@ -48,9 +48,9 @@
 #include "ril_constants.h"
 #include "rilmodem.h"
 
-#include "grilreply.h"
-#include "grilrequest.h"
-#include "grilunsol.h"
+#include "rilreply.h"
+#include "rilrequest.h"
+#include "rilunsol.h"
 
 #include "drivers/infineonmodem/infineon_constants.h"
 
diff --git a/drivers/rilmodem/sms.c b/drivers/rilmodem/sms.c
index 14816e5..232a3f0 100644
--- a/drivers/rilmodem/sms.c
+++ b/drivers/rilmodem/sms.c
@@ -42,9 +42,9 @@
 #include "util.h"
 
 #include "rilmodem.h"
-#include "grilrequest.h"
-#include "grilreply.h"
-#include "grilunsol.h"
+#include "rilrequest.h"
+#include "rilreply.h"
+#include "rilunsol.h"
 
 struct sms_data {
 	GRil *ril;
diff --git a/drivers/rilmodem/ussd.c b/drivers/rilmodem/ussd.c
index 04985ec..1fa602f 100644
--- a/drivers/rilmodem/ussd.c
+++ b/drivers/rilmodem/ussd.c
@@ -40,8 +40,8 @@
 
 #include "gril.h"
 #include "grilutil.h"
-#include "grilrequest.h"
-#include "grilunsol.h"
+#include "rilrequest.h"
+#include "rilunsol.h"
 
 #include "rilmodem.h"
 
diff --git a/drivers/rilmodem/voicecall.c b/drivers/rilmodem/voicecall.c
index 3fa4b37..7aa10ce 100644
--- a/drivers/rilmodem/voicecall.c
+++ b/drivers/rilmodem/voicecall.c
@@ -40,9 +40,9 @@
 #include <ofono/voicecall.h>
 
 #include "gril.h"
-#include "grilrequest.h"
-#include "grilreply.h"
-#include "grilunsol.h"
+#include "rilrequest.h"
+#include "rilreply.h"
+#include "rilunsol.h"
 
 #include "common.h"
 #include "rilmodem.h"
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 04/10] ril: Adapt to movement of parcel processing
  2015-10-15 16:46 [PATCH 00/10] Re-factoring of gril and rilmodem Alfonso Sanchez-Beato
                   ` (2 preceding siblings ...)
  2015-10-15 16:46 ` [PATCH 03/10] rilmodem: " Alfonso Sanchez-Beato
@ 2015-10-15 16:46 ` Alfonso Sanchez-Beato
  2015-10-15 16:46 ` [PATCH 05/10] gril: Remove asserts Alfonso Sanchez-Beato
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 16+ messages in thread
From: Alfonso Sanchez-Beato @ 2015-10-15 16:46 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 921 bytes --]

---
 plugins/ril.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/plugins/ril.c b/plugins/ril.c
index e27c98c..e31f24b 100644
--- a/plugins/ril.c
+++ b/plugins/ril.c
@@ -58,9 +58,9 @@
 
 #include "ofono.h"
 
-#include <grilreply.h>
-#include <grilrequest.h>
-#include <grilunsol.h>
+#include <drivers/rilmodem/rilreply.h>
+#include <drivers/rilmodem/rilrequest.h>
+#include <drivers/rilmodem/rilunsol.h>
 
 #include "ril.h"
 #include "drivers/rilmodem/rilmodem.h"
@@ -364,8 +364,13 @@ static int create_gril(struct ofono_modem *modem)
 		ofono_error("g_ril_new() failed to create modem!");
 		return -EIO;
 	}
+
 	g_ril_set_slot(rd->ril, slot_id);
 
+	g_ril_set_vendor_print_msg_id_funcs(rd->ril,
+						ril_request_id_to_string,
+						ril_unsol_request_to_string);
+
 	if (getenv("OFONO_RIL_TRACE"))
 		g_ril_set_trace(rd->ril, TRUE);
 
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 05/10] gril: Remove asserts
  2015-10-15 16:46 [PATCH 00/10] Re-factoring of gril and rilmodem Alfonso Sanchez-Beato
                   ` (3 preceding siblings ...)
  2015-10-15 16:46 ` [PATCH 04/10] ril: " Alfonso Sanchez-Beato
@ 2015-10-15 16:46 ` Alfonso Sanchez-Beato
  2015-10-19 13:53   ` Denis Kenzior
  2015-10-15 16:46 ` [PATCH 06/10] rilmodem: " Alfonso Sanchez-Beato
                   ` (4 subsequent siblings)
  9 siblings, 1 reply; 16+ messages in thread
From: Alfonso Sanchez-Beato @ 2015-10-15 16:46 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 3023 bytes --]

---
 gril/gril.c   | 23 +++++++++++------------
 gril/grilio.c |  3 +--
 gril/grilio.h |  2 ++
 3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/gril/gril.c b/gril/gril.c
index 2d9f4b2..2e4459c 100644
--- a/gril/gril.c
+++ b/gril/gril.c
@@ -29,7 +29,6 @@
 #include <stdio.h>
 #include <unistd.h>
 #include <string.h>
-#include <assert.h>
 #include <ctype.h>
 #include <errno.h>
 #include <sys/socket.h>
@@ -364,14 +363,12 @@ static void io_disconnect(gpointer user_data)
 
 static void handle_response(struct ril_s *p, struct ril_msg *message)
 {
-	gsize count = g_queue_get_length(p->command_queue);
+	guint count = g_queue_get_length(p->command_queue);
 	struct ril_request *req;
 	gboolean found = FALSE;
 	guint i, len;
 	gint id;
 
-	g_assert(count > 0);
-
 	for (i = 0; i < count; i++) {
 		req = g_queue_peek_nth(p->command_queue, i);
 
@@ -560,16 +557,20 @@ static struct ril_msg *read_fixed_record(struct ril_s *p,
 	bytes += 4;
 
 	/*
-	 * TODO: Verify that 4k is the max message size from rild.
+	 * TODO: Verify that 8k is the max message size from rild.
 	 *
-	 * These conditions shouldn't happen.  If it does
+	 * This condition shouldn't happen.  If it does
 	 * there are three options:
 	 *
-	 * 1) ASSERT; ofono will restart via DBus
+	 * 1) Exit; ofono will restart via DBus (this is what we do now)
 	 * 2) Consume the bytes & continue
 	 * 3) force a disconnect
 	 */
-	g_assert(plen >= 8 && plen <= 4092);
+	if (plen > GRIL_BUFFER_SIZE - 4) {
+		ofono_error("ERROR RIL parcel bigger than buffer (%u), exiting",
+				plen);
+		exit(1);
+	}
 
 	/*
 	 * If we don't have the whole fixed record in the ringbuffer
@@ -580,13 +581,11 @@ static struct ril_msg *read_fixed_record(struct ril_s *p,
 	if (message_len < plen)
 		return NULL;
 
-	message = g_try_malloc(sizeof(struct ril_msg));
-	g_assert(message != NULL);
+	message = g_malloc(sizeof(struct ril_msg));
 
 	/* allocate ril_msg->buffer */
 	message->buf_len = plen;
-	message->buf = g_try_malloc(plen);
-	g_assert(message->buf != NULL);
+	message->buf = g_malloc(plen);
 
 	/* Copy bytes into message buffer */
 	memmove(message->buf, (const void *) bytes, plen);
diff --git a/gril/grilio.c b/gril/grilio.c
index f02d0e4..9f7f116 100644
--- a/gril/grilio.c
+++ b/gril/grilio.c
@@ -27,7 +27,6 @@
 #include <stdio.h>
 #include <unistd.h>
 #include <string.h>
-#include <assert.h>
 #include <ctype.h>
 #include <errno.h>
 
@@ -206,7 +205,7 @@ static GRilIO *create_io(GIOChannel *channel, GIOFlags flags)
 		io->use_write_watch = FALSE;
 	}
 
-	io->buf = ring_buffer_new(8192);
+	io->buf = ring_buffer_new(GRIL_BUFFER_SIZE);
 
 	if (!io->buf)
 		goto error;
diff --git a/gril/grilio.h b/gril/grilio.h
index 22fb60e..58e42a1 100644
--- a/gril/grilio.h
+++ b/gril/grilio.h
@@ -29,6 +29,8 @@ extern "C" {
 
 #include "gfunc.h"
 
+#define GRIL_BUFFER_SIZE 8192
+
 struct _GRilIO;
 
 typedef struct _GRilIO GRilIO;
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 06/10] rilmodem: Remove asserts
  2015-10-15 16:46 [PATCH 00/10] Re-factoring of gril and rilmodem Alfonso Sanchez-Beato
                   ` (4 preceding siblings ...)
  2015-10-15 16:46 ` [PATCH 05/10] gril: Remove asserts Alfonso Sanchez-Beato
@ 2015-10-15 16:46 ` Alfonso Sanchez-Beato
  2015-10-15 16:47 ` [PATCH 07/10] ril: " Alfonso Sanchez-Beato
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 16+ messages in thread
From: Alfonso Sanchez-Beato @ 2015-10-15 16:46 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1099 bytes --]

---
 drivers/rilmodem/gprs-context.c | 3 ---
 drivers/rilmodem/rilreply.c     | 1 -
 2 files changed, 4 deletions(-)

diff --git a/drivers/rilmodem/gprs-context.c b/drivers/rilmodem/gprs-context.c
index ad2499c..1c642e8 100644
--- a/drivers/rilmodem/gprs-context.c
+++ b/drivers/rilmodem/gprs-context.c
@@ -247,11 +247,8 @@ static void ril_gprs_context_activate_primary(struct ofono_gprs_context *gc,
 	struct ofono_error error;
 	int ret = 0;
 
-	g_assert(gprs_atom != NULL);
 	gprs = __ofono_atom_get_data(gprs_atom);
-	g_assert(gprs != NULL);
 	gd = ofono_gprs_get_data(gprs);
-	g_assert(gd != NULL);
 
 	/*
 	 * 0: CDMA 1: GSM/UMTS, 2...
diff --git a/drivers/rilmodem/rilreply.c b/drivers/rilmodem/rilreply.c
index 9ac9ea6..471991c 100644
--- a/drivers/rilmodem/rilreply.c
+++ b/drivers/rilmodem/rilreply.c
@@ -1351,7 +1351,6 @@ int *g_ril_reply_parse_retries(GRil *gril, const struct ril_msg *message,
 	case OFONO_RIL_VENDOR_INFINEON:
 		ofono_error("%s: infineon type should not arrive here",
 				__func__);
-		g_assert(FALSE);
 		break;
 	}
 
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 07/10] ril: Remove asserts
  2015-10-15 16:46 [PATCH 00/10] Re-factoring of gril and rilmodem Alfonso Sanchez-Beato
                   ` (5 preceding siblings ...)
  2015-10-15 16:46 ` [PATCH 06/10] rilmodem: " Alfonso Sanchez-Beato
@ 2015-10-15 16:47 ` Alfonso Sanchez-Beato
  2015-10-19 13:55   ` Denis Kenzior
  2015-10-15 16:47 ` [PATCH 08/10] unit: Add unit tests for ril parcel processing Alfonso Sanchez-Beato
                   ` (2 subsequent siblings)
  9 siblings, 1 reply; 16+ messages in thread
From: Alfonso Sanchez-Beato @ 2015-10-15 16:47 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 797 bytes --]

---
 plugins/ril.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/plugins/ril.c b/plugins/ril.c
index e31f24b..2edb0a9 100644
--- a/plugins/ril.c
+++ b/plugins/ril.c
@@ -144,7 +144,9 @@ static void ril_radio_state_changed(struct ril_msg *message, gpointer user_data)
 			break;
 		default:
 			/* Malformed parcel; no radio state == broken rild */
-			g_assert(FALSE);
+			ofono_error("%s: Bad radio state (%d), exiting",
+							__func__, radio_state);
+			exit(1);
 		}
 	}
 }
@@ -213,7 +215,6 @@ void ril_pre_sim(struct ofono_modem *modem)
 	sim_data.ril_state_watch = NULL;
 
 	rd->sim = ofono_sim_create(modem, rd->vendor, RILMODEM, &sim_data);
-	g_assert(rd->sim != NULL);
 }
 
 void ril_post_sim(struct ofono_modem *modem)
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 08/10] unit: Add unit tests for ril parcel processing
  2015-10-15 16:46 [PATCH 00/10] Re-factoring of gril and rilmodem Alfonso Sanchez-Beato
                   ` (6 preceding siblings ...)
  2015-10-15 16:47 ` [PATCH 07/10] ril: " Alfonso Sanchez-Beato
@ 2015-10-15 16:47 ` Alfonso Sanchez-Beato
  2015-10-15 16:47 ` [PATCH 09/10] build: Add rilmodem unit tests Alfonso Sanchez-Beato
  2015-10-15 16:47 ` [PATCH 10/10] gitignore: Ignore " Alfonso Sanchez-Beato
  9 siblings, 0 replies; 16+ messages in thread
From: Alfonso Sanchez-Beato @ 2015-10-15 16:47 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 157127 bytes --]

---
 unit/test-rilreply.c   | 2141 ++++++++++++++++++++++++++++++++++++++++++++++++
 unit/test-rilrequest.c | 1737 +++++++++++++++++++++++++++++++++++++++
 unit/test-rilunsol.c   |  698 ++++++++++++++++
 3 files changed, 4576 insertions(+)
 create mode 100644 unit/test-rilreply.c
 create mode 100644 unit/test-rilrequest.c
 create mode 100644 unit/test-rilunsol.c

diff --git a/unit/test-rilreply.c b/unit/test-rilreply.c
new file mode 100644
index 0000000..4def06e
--- /dev/null
+++ b/unit/test-rilreply.c
@@ -0,0 +1,2141 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2013 Canonical Ltd.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string.h>
+#include <stdio.h>
+#include <assert.h>
+#include <glib.h>
+#include <errno.h>
+
+#include <ofono/modem.h>
+#include <ofono/gprs-context.h>
+#include <ofono/types.h>
+
+#include "common.h"
+#include "drivers/rilmodem/rilreply.h"
+
+/*
+ * TODO: It may make sense to split this file into
+ * domain-specific files ( eg. test-grilreply-gprs-context.c )
+ * once more tests are added.
+ */
+
+/*
+ * As all our architectures are little-endian except for
+ * PowerPC, and the Binder wire-format differs slightly
+ * depending on endian-ness, the following guards against test
+ * failures when run on PowerPC.
+ */
+#if BYTE_ORDER == LITTLE_ENDIAN
+
+typedef struct reg_state_test reg_state_test;
+struct reg_state_test {
+	int status;
+	int tech;
+	const struct ril_msg msg;
+};
+
+typedef struct get_preferred_network_test get_preferred_network_test;
+struct get_preferred_network_test {
+	int preferred;
+	const struct ril_msg msg;
+};
+
+struct query_facility_lock_test {
+	int status;
+	const struct ril_msg msg;
+};
+
+struct set_facility_lock_test {
+	int retries;
+	const struct ril_msg msg;
+};
+
+struct sim_password_test {
+	int retries;
+	enum ofono_sim_password_type passwd_type;
+	const struct ril_msg msg;
+};
+
+struct oem_hook_raw_test {
+	const unsigned char *data;
+	int size;
+	const struct ril_msg msg;
+};
+
+struct oem_hook_strings_test {
+	int num_str;
+	const char **str;
+	const struct ril_msg msg;
+};
+
+/* Invalid RIL_REQUEST_DATA_REGISTRATION_STATE: buffer too small */
+static const struct ril_msg reply_data_reg_state_invalid_1 = {
+	.buf = "XYZ",
+	.buf_len = 3,
+	.unsolicited = FALSE,
+	.req = RIL_REQUEST_DATA_REGISTRATION_STATE,
+	.serial_no = 0,
+	.error = 0,
+};
+
+/*
+ * The following hex data represents a RIL_REQUEST_DATA_REGISTRATION_STATE
+ * reply with an invalid number of parameters ( 0 ).
+ */
+static const guchar reply_data_reg_state_invalid_parcel2[] = {
+	0x00, 0x00, 0x00, 0x00
+};
+
+static const struct ril_msg reply_data_reg_state_invalid_2 = {
+	.buf = (gchar *) &reply_data_reg_state_invalid_parcel2,
+	.buf_len = sizeof(reply_data_reg_state_invalid_parcel2),
+	.unsolicited = FALSE,
+	.req = RIL_REQUEST_DATA_REGISTRATION_STATE,
+	.serial_no = 0,
+	.error = 0,
+};
+
+/*
+ * The following hex data represents a RIL_REQUEST_DATA_REGISTRATION_STATE
+ * reply with a null status parameter:
+ *
+ * {(null),1b3f,07eaf3dc,HSPA,(null),20}
+ */
+static const guchar reply_data_reg_state_invalid_parcel3[] = {
+	0x06, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00,
+	0x31, 0x00, 0x62, 0x00, 0x33, 0x00, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x08, 0x00, 0x00, 0x00, 0x30, 0x00, 0x37, 0x00, 0x65, 0x00, 0x61, 0x00,
+	0x66, 0x00, 0x33, 0x00, 0x64, 0x00, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x02, 0x00, 0x00, 0x00, 0x31, 0x00, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0x32, 0x00, 0x30, 0x00,
+	0x00, 0x00, 0x00, 0x00
+};
+
+static const struct ril_msg reply_data_reg_state_invalid_3 = {
+	.buf = (gchar *) &reply_data_reg_state_invalid_parcel3,
+	.buf_len = sizeof(reply_data_reg_state_invalid_parcel3),
+	.unsolicited = FALSE,
+	.req = RIL_REQUEST_DATA_REGISTRATION_STATE,
+	.serial_no = 0,
+	.error = 0,
+};
+
+/*
+ * The following hex data represents a valid RIL_REQUEST_DATA_REGISTRATION_STATE
+ * reply with the following parameters:
+ *
+ * RADIO_TECH_UNKNOWN (0)
+ *
+ * {registered,1b3f,07eaf3dc,UNKNOWN,(null),20}
+ */
+static const guchar reply_data_reg_state_valid_parcel1[] = {
+	0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00,
+	0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x62, 0x00, 0x33, 0x00, 0x66, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x30, 0x00, 0x37, 0x00,
+	0x65, 0x00, 0x61, 0x00, 0x66, 0x00, 0x33, 0x00, 0x64, 0x00, 0x63, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00,
+	0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0x32, 0x00, 0x30, 0x00,
+	0x00, 0x00, 0x00, 0x00
+};
+
+static const reg_state_test data_reg_valid_1 = {
+	.status = NETWORK_REGISTRATION_STATUS_REGISTERED,
+	.tech = RADIO_TECH_UNKNOWN,
+	.msg = {
+		.buf = (gchar *) &reply_data_reg_state_valid_parcel1,
+		.buf_len = sizeof(reply_data_reg_state_valid_parcel1),
+		.unsolicited = FALSE,
+		.req = RIL_REQUEST_DATA_REGISTRATION_STATE,
+		.serial_no = 0,
+		.error = 0,
+	}
+};
+
+/*
+ * The following hex data represents a valid RIL_REQUEST_DATA_REGISTRATION_STATE
+ * reply with the following parameters:
+ *
+ * RADIO_TECH_GSM (16)
+ *
+ * {registered,1b3f,07eaf3dc,GSM,(null),20}
+ */
+static const guchar reply_data_reg_state_valid_parcel2[] = {
+	0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00,
+	0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x62, 0x00, 0x33, 0x00, 0x66, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x30, 0x00, 0x37, 0x00,
+	0x65, 0x00, 0x61, 0x00, 0x66, 0x00, 0x33, 0x00, 0x64, 0x00, 0x63, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x31, 0x00, 0x36, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00,
+	0x32, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+static const reg_state_test data_reg_valid_2 = {
+	.status = NETWORK_REGISTRATION_STATUS_REGISTERED,
+	.tech = RADIO_TECH_GSM,
+	.msg = {
+		.buf = (gchar *) &reply_data_reg_state_valid_parcel2,
+		.buf_len = sizeof(reply_data_reg_state_valid_parcel2),
+		.unsolicited = FALSE,
+		.req = RIL_REQUEST_DATA_REGISTRATION_STATE,
+		.serial_no = 0,
+		.error = 0,
+	}
+};
+
+/*
+ * The following hex data represents a valid RIL_REQUEST_DATA_REGISTRATION_STATE
+ * reply with the following parameters:
+ *
+ * RADIO_TECH_GPRS (1)
+ *
+ * {registered,1b3f,07eaf3dc,GPRS,(null),20}
+ */
+static const guchar reply_data_reg_state_valid_parcel3[] = {
+	0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00,
+	0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x62, 0x00, 0x33, 0x00, 0x66, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x30, 0x00, 0x37, 0x00,
+	0x65, 0x00, 0x61, 0x00, 0x66, 0x00, 0x33, 0x00, 0x64, 0x00, 0x63, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00,
+	0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0x32, 0x00, 0x30, 0x00,
+	0x00, 0x00, 0x00, 0x00
+};
+
+static const reg_state_test data_reg_valid_3 = {
+	.status = NETWORK_REGISTRATION_STATUS_REGISTERED,
+	.tech = RADIO_TECH_GPRS,
+	.msg = {
+		.buf = (gchar *) &reply_data_reg_state_valid_parcel3,
+		.buf_len = sizeof(reply_data_reg_state_valid_parcel3),
+		.unsolicited = FALSE,
+		.req = RIL_REQUEST_DATA_REGISTRATION_STATE,
+		.serial_no = 0,
+		.error = 0,
+	}
+};
+
+/*
+ * The following hex data represents a valid RIL_REQUEST_DATA_REGISTRATION_STATE
+ * reply with the following parameters:
+ *
+ * RADIO_TECH_EDGE (2)
+ *
+ * {registered,1b3f,07eaf3dc,EDGE,(null),20}
+ */
+static const guchar reply_data_reg_state_valid_parcel4[] = {
+	0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00,
+	0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x62, 0x00, 0x33, 0x00, 0x66, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x30, 0x00, 0x37, 0x00,
+	0x65, 0x00, 0x61, 0x00, 0x66, 0x00, 0x33, 0x00, 0x64, 0x00, 0x63, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00,
+	0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0x32, 0x00, 0x30, 0x00,
+	0x00, 0x00, 0x00, 0x00
+};
+
+static const reg_state_test data_reg_valid_4 = {
+	.status = NETWORK_REGISTRATION_STATUS_REGISTERED,
+	.tech = RADIO_TECH_EDGE,
+	.msg = {
+		.buf = (gchar *) &reply_data_reg_state_valid_parcel4,
+		.buf_len = sizeof(reply_data_reg_state_valid_parcel4),
+		.unsolicited = FALSE,
+		.req = RIL_REQUEST_DATA_REGISTRATION_STATE,
+		.serial_no = 0,
+		.error = 0,
+	}
+};
+
+/*
+ * The following hex data represents a valid RIL_REQUEST_DATA_REGISTRATION_STATE
+ * reply with the following parameters:
+ *
+ * RADIO_TECH_UMTS (3)
+ *
+ * {registered,1b3f,07eaf3dc,UMTS,(null),20}
+ */
+static const guchar reply_data_reg_state_valid_parcel5[] = {
+	0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00,
+	0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x62, 0x00, 0x33, 0x00, 0x66, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x30, 0x00, 0x37, 0x00,
+	0x65, 0x00, 0x61, 0x00, 0x66, 0x00, 0x33, 0x00, 0x64, 0x00, 0x63, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00,
+	0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0x32, 0x00, 0x30, 0x00,
+	0x00, 0x00, 0x00, 0x00
+};
+
+static const reg_state_test data_reg_valid_5 = {
+	.status = NETWORK_REGISTRATION_STATUS_REGISTERED,
+	.tech = RADIO_TECH_UMTS,
+	.msg = {
+		.buf = (gchar *) &reply_data_reg_state_valid_parcel5,
+		.buf_len = sizeof(reply_data_reg_state_valid_parcel5),
+		.unsolicited = FALSE,
+		.req = RIL_REQUEST_DATA_REGISTRATION_STATE,
+		.serial_no = 0,
+		.error = 0,
+	}
+};
+
+/*
+ * The following hex data represents a valid RIL_REQUEST_DATA_REGISTRATION_STATE
+ * reply with the following parameters:
+ *
+ * RADIO_TECH_HSDPA (9)
+ *
+ * {registered,1b3f,07eaf3dc,HSDPA,(null),20}
+ */
+static const guchar reply_data_reg_state_valid_parcel6[] = {
+	0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00,
+	0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x62, 0x00, 0x33, 0x00, 0x66, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x30, 0x00, 0x37, 0x00,
+	0x65, 0x00, 0x61, 0x00, 0x66, 0x00, 0x33, 0x00, 0x64, 0x00, 0x63, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x39, 0x00, 0x00, 0x00,
+	0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, 0x32, 0x00, 0x30, 0x00,
+	0x00, 0x00, 0x00, 0x00
+};
+
+static const reg_state_test data_reg_valid_6 = {
+	.status = NETWORK_REGISTRATION_STATUS_REGISTERED,
+	.tech = RADIO_TECH_HSDPA,
+	.msg = {
+		.buf = (gchar *) &reply_data_reg_state_valid_parcel6,
+		.buf_len = sizeof(reply_data_reg_state_valid_parcel6),
+		.unsolicited = FALSE,
+		.req = RIL_REQUEST_DATA_REGISTRATION_STATE,
+		.serial_no = 0,
+		.error = 0,
+	}
+};
+
+/*
+ * The following hex data represents a valid RIL_REQUEST_DATA_REGISTRATION_STATE
+ * reply with the following parameters:
+ *
+ * RADIO_TECH_HSUPA (10)
+ *
+ * {registered,1b3f,07eaf3dc,HSUPA,(null),20}
+ */
+static const guchar reply_data_reg_state_valid_parcel7[] = {
+	0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00,
+	0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x62, 0x00, 0x33, 0x00, 0x66, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x30, 0x00, 0x37, 0x00,
+	0x65, 0x00, 0x61, 0x00, 0x66, 0x00, 0x33, 0x00, 0x64, 0x00, 0x63, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x31, 0x00, 0x30, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00,
+	0x32, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+static const reg_state_test data_reg_valid_7 = {
+	.status = NETWORK_REGISTRATION_STATUS_REGISTERED,
+	.tech = RADIO_TECH_HSUPA,
+	.msg = {
+		.buf = (gchar *) &reply_data_reg_state_valid_parcel7,
+		.buf_len = sizeof(reply_data_reg_state_valid_parcel7),
+		.unsolicited = FALSE,
+		.req = RIL_REQUEST_DATA_REGISTRATION_STATE,
+		.serial_no = 0,
+		.error = 0,
+	}
+};
+
+/*
+ * The following hex data represents a valid RIL_REQUEST_DATA_REGISTRATION_STATE
+ * reply with the following parameters:
+ *
+ * RADIO_TECH_HSPA (11)
+ *
+ * {registered,1b3f,07eaf3dc,HSPA,(null),20}
+ */
+static const guchar reply_data_reg_state_valid_parcel8[] = {
+	0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00,
+	0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x62, 0x00, 0x33, 0x00, 0x66, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x30, 0x00, 0x37, 0x00,
+	0x65, 0x00, 0x61, 0x00, 0x66, 0x00, 0x33, 0x00, 0x64, 0x00, 0x63, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x31, 0x00, 0x31, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00,
+	0x32, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+
+static const reg_state_test data_reg_valid_8 = {
+	.status = NETWORK_REGISTRATION_STATUS_REGISTERED,
+	.tech = RADIO_TECH_HSPA,
+	.msg = {
+		.buf = (gchar *) &reply_data_reg_state_valid_parcel8,
+		.buf_len = sizeof(reply_data_reg_state_valid_parcel8),
+		.unsolicited = FALSE,
+		.req = RIL_REQUEST_DATA_REGISTRATION_STATE,
+		.serial_no = 0,
+		.error = 0,
+	}
+};
+
+/*
+ * The following hex data represents a valid RIL_REQUEST_DATA_REGISTRATION_STATE
+ * reply with the following parameters:
+ *
+ * RADIO_TECH_LTE (14)
+ *
+ * {registered,1b3f,07eaf3dc,LTE,(null),20}
+ */
+static const guchar reply_data_reg_state_valid_parcel9[] = {
+	0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00,
+	0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x62, 0x00, 0x33, 0x00, 0x66, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x30, 0x00, 0x37, 0x00,
+	0x65, 0x00, 0x61, 0x00, 0x66, 0x00, 0x33, 0x00, 0x64, 0x00, 0x63, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x31, 0x00, 0x34, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00,
+	0x32, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+
+static const reg_state_test data_reg_valid_9 = {
+	.status = NETWORK_REGISTRATION_STATUS_REGISTERED,
+	.tech = RADIO_TECH_LTE,
+	.msg = {
+		.buf = (gchar *) &reply_data_reg_state_valid_parcel9,
+		.buf_len = sizeof(reply_data_reg_state_valid_parcel9),
+		.unsolicited = FALSE,
+		.req = RIL_REQUEST_DATA_REGISTRATION_STATE,
+		.serial_no = 0,
+		.error = 0,
+	}
+};
+
+/*
+ * The following hex data represents a valid RIL_REQUEST_DATA_REGISTRATION_STATE
+ * reply with the following parameters:
+ *
+ * RADIO_TECH_HSPAP (15)
+ *
+ * Note, as ofono currently doesn't define a bearer enum that represents HSPA+,
+ * it's currently mapped to HSPA.
+ *
+ * {registered,1b3f,07eaf3dc,HSPAP,(null),20}
+ */
+static const guchar reply_data_reg_state_valid_parcel10[] = {
+	0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00,
+	0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x62, 0x00, 0x33, 0x00, 0x66, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x30, 0x00, 0x37, 0x00,
+	0x65, 0x00, 0x61, 0x00, 0x66, 0x00, 0x33, 0x00, 0x64, 0x00, 0x63, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x31, 0x00, 0x35, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00,
+	0x32, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+
+static const reg_state_test data_reg_valid_10 = {
+	.status = NETWORK_REGISTRATION_STATUS_REGISTERED,
+	.tech = RADIO_TECH_HSPAP,
+	.msg = {
+		.buf = (gchar *) &reply_data_reg_state_valid_parcel10,
+		.buf_len = sizeof(reply_data_reg_state_valid_parcel10),
+		.unsolicited = FALSE,
+		.req = RIL_REQUEST_DATA_REGISTRATION_STATE,
+		.serial_no = 0,
+		.error = 0,
+	}
+};
+
+/*
+ * TODO: investigate creation of a base reply, which could
+ * then be modified for each test, as opposed to duplicating
+ * the bulk of the data for each test.
+ */
+
+/*
+ * The following hex data represents a valid
+ * RIL_REQUEST_VOICE_REGISTRATION_STATE reply with the following parameters:
+ *
+ * RADIO_TECH_UMTS (3)
+ *
+ * {registered,1b3f,07eaf3dc,UMTS,(null),(null)}
+ */
+static const guchar reply_voice_reg_state_valid_parcel1[] = {
+	0x0f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00,
+	0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x62, 0x00, 0x33, 0x00, 0x66, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x30, 0x00, 0x37, 0x00,
+	0x65, 0x00, 0x61, 0x00, 0x35, 0x00, 0x31, 0x00, 0x37, 0x00, 0x61, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00,
+	0x03, 0x00, 0x00, 0x00, 0x31, 0x00, 0x32, 0x00, 0x35, 0x00, 0x00, 0x00
+};
+
+static const reg_state_test voice_reg_valid_1 = {
+	.status = NETWORK_REGISTRATION_STATUS_REGISTERED,
+	.tech = RADIO_TECH_UMTS,
+	.msg = {
+		.buf = (gchar *) &reply_voice_reg_state_valid_parcel1,
+		.buf_len = sizeof(reply_voice_reg_state_valid_parcel1),
+		.unsolicited = FALSE,
+		.req = RIL_REQUEST_VOICE_REGISTRATION_STATE,
+		.serial_no = 0,
+		.error = 0,
+	}
+};
+
+/*
+ * The following hex data represents a valid
+ * RIL_REQUEST_VOICE_REGISTRATION_STATE reply with the following parameters:
+ *
+ *
+ * RADIO_TECH_GPRS (1)
+ *
+ * {unregistered,1b3f,07eaf3dc,GPRS,(null),(null)}
+ */
+static const guchar reply_voice_reg_state_valid_parcel2[] = {
+	0x0f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00,
+	0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x62, 0x00, 0x33, 0x00, 0x66, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x30, 0x00, 0x37, 0x00,
+	0x65, 0x00, 0x61, 0x00, 0x35, 0x00, 0x31, 0x00, 0x37, 0x00, 0x61, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00,
+	0x03, 0x00, 0x00, 0x00, 0x31, 0x00, 0x32, 0x00, 0x35, 0x00, 0x00, 0x00
+};
+
+static const reg_state_test voice_reg_valid_2 = {
+	.status = (int) NETWORK_REGISTRATION_STATUS_NOT_REGISTERED,
+	.tech = RADIO_TECH_GPRS,
+	.msg = {
+		.buf = (gchar *) &reply_voice_reg_state_valid_parcel2,
+		.buf_len = sizeof(reply_voice_reg_state_valid_parcel2),
+		.unsolicited = FALSE,
+		.req = RIL_REQUEST_VOICE_REGISTRATION_STATE,
+		.serial_no = 0,
+		.error = 0,
+	}
+};
+
+/*
+ * The following hex data represents a valid
+ * RIL_REQUEST_VOICE_REGISTRATION_STATE reply with the following parameters:
+ *
+ * RADIO_TECH_GSM (16)
+ *
+ * {searching,1b3f,07eaf3dc,GSM,(null),(null)}
+ */
+static const guchar reply_voice_reg_state_valid_parcel3[] = {
+	0x0f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00,
+	0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x62, 0x00, 0x33, 0x00, 0x66, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x30, 0x00, 0x37, 0x00,
+	0x65, 0x00, 0x61, 0x00, 0x35, 0x00, 0x31, 0x00, 0x30, 0x00, 0x61, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x31, 0x00, 0x36, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00,
+	0x30, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x31, 0x00, 0x32, 0x00,
+	0x35, 0x00, 0x00, 0x00
+};
+
+static const reg_state_test voice_reg_valid_3 = {
+	.status = NETWORK_REGISTRATION_STATUS_SEARCHING,
+	.tech = RADIO_TECH_GSM,
+	.msg = {
+		.buf = (gchar *) &reply_voice_reg_state_valid_parcel3,
+		.buf_len = sizeof(reply_voice_reg_state_valid_parcel3),
+		.unsolicited = FALSE,
+		.req = RIL_REQUEST_VOICE_REGISTRATION_STATE,
+		.serial_no = 0,
+		.error = 0,
+	}
+};
+
+/*
+ * The following hex data represents a valid
+ * RIL_REQUEST_VOICE_REGISTRATION_STATE reply with the following parameters:
+ *
+ * RADIO_TECH_EDGE (2)
+ *
+ * {denied,1b3f,07eaf3dc,EDGE,(null),(null)}
+ */
+static const guchar reply_voice_reg_state_valid_parcel4[] = {
+	0x0f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00,
+	0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x62, 0x00, 0x33, 0x00, 0x66, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x30, 0x00, 0x37, 0x00,
+	0x65, 0x00, 0x61, 0x00, 0x35, 0x00, 0x31, 0x00, 0x30, 0x00, 0x61, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00,
+	0x03, 0x00, 0x00, 0x00, 0x31, 0x00, 0x32, 0x00, 0x35, 0x00, 0x00, 0x00
+};
+
+static const reg_state_test voice_reg_valid_4 = {
+	.status = NETWORK_REGISTRATION_STATUS_DENIED,
+	.tech = RADIO_TECH_EDGE,
+	.msg = {
+		.buf = (gchar *) &reply_voice_reg_state_valid_parcel4,
+		.buf_len = sizeof(reply_voice_reg_state_valid_parcel4),
+		.unsolicited = FALSE,
+		.req = RIL_REQUEST_VOICE_REGISTRATION_STATE,
+		.serial_no = 0,
+		.error = 0,
+	}
+};
+
+/*
+ * The following hex data represents a valid
+ * RIL_REQUEST_VOICE_REGISTRATION_STATE reply with the following parameters:
+ *
+ * RADIO_TECH_UNKNOWN (0)
+ *
+ * {unknown,1b3f,07eaf3dc,UNKNOWN,(null),(null)}
+ */
+static const guchar reply_voice_reg_state_valid_parcel5[] = {
+	0x0f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00,
+	0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x62, 0x00, 0x33, 0x00, 0x66, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x30, 0x00, 0x37, 0x00,
+	0x65, 0x00, 0x61, 0x00, 0x35, 0x00, 0x31, 0x00, 0x30, 0x00, 0x61, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00,
+	0x03, 0x00, 0x00, 0x00, 0x31, 0x00, 0x32, 0x00, 0x35, 0x00, 0x00, 0x00
+};
+
+static const reg_state_test voice_reg_valid_5 = {
+	.status = NETWORK_REGISTRATION_STATUS_UNKNOWN,
+	.tech = RADIO_TECH_UNKNOWN,
+	.msg = {
+		.buf = (gchar *) &reply_voice_reg_state_valid_parcel5,
+		.buf_len = sizeof(reply_voice_reg_state_valid_parcel5),
+		.unsolicited = FALSE,
+		.req = RIL_REQUEST_VOICE_REGISTRATION_STATE,
+		.serial_no = 0,
+		.error = 0,
+	}
+};
+
+/*
+ * The following hex data represents a valid
+ * RIL_REQUEST_VOICE_REGISTRATION_STATE reply with the following parameters:
+ *
+ * RADIO_TECH_LTE (14)
+ *
+ * {roaming,1b3f,07eaf3dc,LTE,(null),(null)}
+ */
+static const guchar reply_voice_reg_state_valid_parcel6[] = {
+	0x0f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x35, 0x00, 0x00, 0x00,
+	0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x62, 0x00, 0x33, 0x00, 0x66, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x30, 0x00, 0x37, 0x00,
+	0x65, 0x00, 0x61, 0x00, 0x35, 0x00, 0x31, 0x00, 0x30, 0x00, 0x61, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x31, 0x00, 0x34, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00,
+	0x30, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x31, 0x00, 0x32, 0x00,
+	0x35, 0x00, 0x00, 0x00
+};
+
+static const reg_state_test voice_reg_valid_6 = {
+	.status = NETWORK_REGISTRATION_STATUS_ROAMING,
+	.tech = RADIO_TECH_LTE,
+	.msg = {
+		.buf = (gchar *) &reply_voice_reg_state_valid_parcel6,
+		.buf_len = sizeof(reply_voice_reg_state_valid_parcel6),
+		.unsolicited = FALSE,
+		.req = RIL_REQUEST_VOICE_REGISTRATION_STATE,
+		.serial_no = 0,
+		.error = 0,
+	}
+};
+
+/*
+ * The following hex data represents a valid
+ * RIL_REQUEST_VOICE_REGISTRATION_STATE reply with the following parameters:
+ *
+ * RADIO_TECH_HSDPA (9)
+ *
+ * {roaming,1b3f,07eaf3dc,HSDPA,(null),(null)}
+ */
+static const guchar reply_voice_reg_state_valid_parcel7[] = {
+	0x0f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x35, 0x00, 0x00, 0x00,
+	0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x62, 0x00, 0x33, 0x00, 0x66, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x30, 0x00, 0x37, 0x00,
+	0x65, 0x00, 0x61, 0x00, 0x35, 0x00, 0x31, 0x00, 0x30, 0x00, 0x61, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x39, 0x00, 0x00, 0x00,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00,
+	0x03, 0x00, 0x00, 0x00, 0x31, 0x00, 0x32, 0x00, 0x35, 0x00, 0x00, 0x00
+};
+
+static const reg_state_test voice_reg_valid_7 = {
+	.status = NETWORK_REGISTRATION_STATUS_ROAMING,
+	.tech = RADIO_TECH_HSDPA,
+	.msg = {
+		.buf = (gchar *) &reply_voice_reg_state_valid_parcel7,
+		.buf_len = sizeof(reply_voice_reg_state_valid_parcel7),
+		.unsolicited = FALSE,
+		.req = RIL_REQUEST_VOICE_REGISTRATION_STATE,
+		.serial_no = 0,
+		.error = 0,
+	}
+};
+
+/*
+ * The following hex data represents a valid
+ * RIL_REQUEST_VOICE_REGISTRATION_STATE reply with the following parameters:
+ *
+ * RADIO_TECH_HSUPA (10)
+ *
+ * {roaming,1b3f,07eaf3dc,HSUPA,(null),(null)}
+ */
+static const guchar reply_voice_reg_state_valid_parcel8[] = {
+	0x0f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x35, 0x00, 0x00, 0x00,
+	0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x62, 0x00, 0x33, 0x00, 0x66, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x30, 0x00, 0x37, 0x00,
+	0x65, 0x00, 0x61, 0x00, 0x35, 0x00, 0x31, 0x00, 0x30, 0x00, 0x61, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x31, 0x00, 0x30, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00,
+	0x30, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x31, 0x00, 0x32, 0x00,
+	0x35, 0x00, 0x00, 0x00
+};
+
+static const reg_state_test voice_reg_valid_8 = {
+	.status = NETWORK_REGISTRATION_STATUS_ROAMING,
+	.tech = RADIO_TECH_HSUPA,
+	.msg = {
+		.buf = (gchar *) &reply_voice_reg_state_valid_parcel8,
+		.buf_len = sizeof(reply_voice_reg_state_valid_parcel8),
+		.unsolicited = FALSE,
+		.req = RIL_REQUEST_VOICE_REGISTRATION_STATE,
+		.serial_no = 0,
+		.error = 0,
+	}
+};
+
+/*
+ * The following hex data represents a valid
+ * RIL_REQUEST_VOICE_REGISTRATION_STATE reply with the following parameters:
+ *
+ * RADIO_TECH_HSPA (11)
+ *
+ * {roaming,1b3f,07eaf3dc,HSPA,(null),(null)}
+ */
+static const guchar reply_voice_reg_state_valid_parcel9[] = {
+	0x0f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x35, 0x00, 0x00, 0x00,
+	0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x62, 0x00, 0x33, 0x00, 0x66, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x30, 0x00, 0x37, 0x00,
+	0x65, 0x00, 0x61, 0x00, 0x35, 0x00, 0x31, 0x00, 0x30, 0x00, 0x61, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x31, 0x00, 0x31, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00,
+	0x30, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x31, 0x00, 0x32, 0x00,
+	0x35, 0x00, 0x00, 0x00
+};
+
+static const reg_state_test voice_reg_valid_9 = {
+	.status = NETWORK_REGISTRATION_STATUS_ROAMING,
+	.tech = RADIO_TECH_HSPA,
+	.msg = {
+		.buf = (gchar *) &reply_voice_reg_state_valid_parcel9,
+		.buf_len = sizeof(reply_voice_reg_state_valid_parcel9),
+		.unsolicited = FALSE,
+		.req = RIL_REQUEST_VOICE_REGISTRATION_STATE,
+		.serial_no = 0,
+		.error = 0,
+	}
+};
+
+/*
+ * The following hex data represents a valid
+ * RIL_REQUEST_VOICE_REGISTRATION_STATE reply with the following parameters:
+ *
+ * RADIO_TECH_HSPAP (15)
+ *
+ * {roaming,1b3f,07eaf3dc,HSPAP,(null),(null)}
+ */
+static const guchar reply_voice_reg_state_valid_parcel10[] = {
+	0x0f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x35, 0x00, 0x00, 0x00,
+	0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x62, 0x00, 0x33, 0x00, 0x66, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x30, 0x00, 0x37, 0x00,
+	0x65, 0x00, 0x61, 0x00, 0x35, 0x00, 0x31, 0x00, 0x30, 0x00, 0x61, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x31, 0x00, 0x35, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00,
+	0x30, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x31, 0x00, 0x32, 0x00,
+	0x35, 0x00, 0x00, 0x00
+};
+
+static const reg_state_test voice_reg_valid_10 = {
+	.status = NETWORK_REGISTRATION_STATUS_ROAMING,
+	.tech = RADIO_TECH_HSPAP,
+	.msg = {
+		.buf = (gchar *) &reply_voice_reg_state_valid_parcel10,
+		.buf_len = sizeof(reply_voice_reg_state_valid_parcel10),
+		.unsolicited = FALSE,
+		.req = RIL_REQUEST_VOICE_REGISTRATION_STATE,
+		.serial_no = 0,
+		.error = 0,
+	}
+};
+
+/*
+ * The following hex data represents a valid
+ * RIL_REQUEST_VOICE_REGISTRATION_STATE reply with the following parameters:
+ *
+ * {unregistered,(null),(null),UNKNOWN,(null),(null)}
+ */
+static const guchar reply_voice_reg_state_valid_parcel11[] = {
+	0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
+};
+
+static const reg_state_test voice_reg_valid_11 = {
+	.status = NETWORK_REGISTRATION_STATUS_NOT_REGISTERED,
+	.tech = RADIO_TECH_UNKNOWN,
+	.msg = {
+		.buf = (gchar *) &reply_voice_reg_state_valid_parcel11,
+		.buf_len = sizeof(reply_voice_reg_state_valid_parcel11),
+		.unsolicited = FALSE,
+		.req = RIL_REQUEST_VOICE_REGISTRATION_STATE,
+		.serial_no = 0,
+		.error = 0,
+	}
+};
+
+/*
+ * The following hex data represents a valid
+ * RIL_REQUEST_VOICE_REGISTRATION_STATE reply with the following parameters:
+ *
+ * {13,(null),(null),UNKNOWN,(null),(null)}
+ */
+static const guchar reply_voice_reg_state_valid_parcel12[] = {
+	0x0f, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x31, 0x00, 0x33, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0x01, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00,
+	0x31, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
+	0x31, 0x00, 0x62, 0x00, 0x65, 0x00, 0x00, 0x00
+};
+
+static const reg_state_test voice_reg_valid_12 = {
+	.status = NETWORK_REGISTRATION_STATUS_DENIED,
+	.tech = RADIO_TECH_UNKNOWN,
+	.msg = {
+		.buf = (gchar *) &reply_voice_reg_state_valid_parcel12,
+		.buf_len = sizeof(reply_voice_reg_state_valid_parcel12),
+		.unsolicited = FALSE,
+		.req = RIL_REQUEST_VOICE_REGISTRATION_STATE,
+		.serial_no = 0,
+		.error = 0,
+	}
+};
+
+static const struct ril_msg reply_operator_invalid_1 = {
+	.buf = "",
+	.buf_len = 0,
+	.unsolicited = FALSE,
+	.req = RIL_REQUEST_OPERATOR,
+	.serial_no = 0,
+	.error = 0,
+};
+
+/*
+ * The following hexadecimal data contains the event data of an
+ * invalid RIL_REQUEST_OPERATOR with an invald number of parameters
+ *
+ * {lalpha=AT&T, salpha=}
+ */
+static const guchar reply_operator_invalid_parcel2[] = {
+	0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x41, 0x00, 0x54, 0x00,
+	0x26, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00
+};
+
+static const struct ril_msg reply_operator_invalid_2 = {
+	.buf = (char *) &reply_operator_invalid_parcel2,
+	.buf_len = sizeof(reply_operator_invalid_parcel2),
+	.unsolicited = FALSE,
+	.req = RIL_REQUEST_OPERATOR,
+	.serial_no = 0,
+	.error = 0,
+};
+
+/*
+ * The following hexadecimal data contains the event data of a
+ * valid RIL_REQUEST_OPERATOR with the following parameters:
+ *
+ * {lalpha=AT&T, salpha=, numeric=310410}
+ */
+static const guchar reply_operator_valid_parcel1[] = {
+	0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x41, 0x00, 0x54, 0x00,
+	0x26, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x33, 0x00, 0x31, 0x00,
+	0x30, 0x00, 0x34, 0x00, 0x31, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+static const struct ril_msg reply_operator_valid_1 = {
+	.buf = (char *) &reply_operator_valid_parcel1,
+	.buf_len = sizeof(reply_operator_valid_parcel1),
+	.unsolicited = FALSE,
+	.req = RIL_REQUEST_OPERATOR,
+	.serial_no = 0,
+	.error = 0,
+};
+
+static const struct ril_msg reply_avail_ops_invalid_1 = {
+	.buf = "",
+	.buf_len = 0,
+	.unsolicited = FALSE,
+	.req = RIL_REQUEST_QUERY_AVAILABLE_NETWORKS,
+	.serial_no = 0,
+	.error = 0,
+};
+
+/*
+ * The following hexadecimal data contains the event data of an
+ * invalid RIL_REQUEST_QUERY_AVAILABLE_NETWORKS with an invald
+ * number of strings ( not evenly divisible by 4, the count of
+ * strings per operator ).
+ */
+static const guchar reply_avail_ops_invalid_parcel2[] = {
+	0x0b, 0x00, 0x00, 0x00
+};
+
+static const struct ril_msg reply_avail_ops_invalid_2 = {
+	.buf = (char *) &reply_avail_ops_invalid_parcel2,
+	.buf_len = sizeof(reply_avail_ops_invalid_parcel2),
+	.unsolicited = FALSE,
+	.req = RIL_REQUEST_QUERY_AVAILABLE_NETWORKS,
+	.serial_no = 0,
+	.error = 0,
+};
+
+/*
+ * The following hexadecimal data contains the event data of a
+ * valid RIL_REQUEST_AVAILABLE_NETWORKS with the following parameters:
+ *
+ * {lalpha=AT&T, salpha=, numeric=310410, status=available}
+ */
+static const guchar reply_avail_ops_valid_parcel1[] = {
+	0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x41, 0x00, 0x54, 0x00,
+	0x26, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x33, 0x00, 0x31, 0x00,
+	0x30, 0x00, 0x34, 0x00, 0x31, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x09, 0x00, 0x00, 0x00, 0x61, 0x00, 0x76, 0x00, 0x61, 0x00, 0x69, 0x00,
+	0x6c, 0x00, 0x61, 0x00, 0x62, 0x00, 0x6c, 0x00, 0x65, 0x00, 0x00, 0x00
+};
+
+static const struct ril_msg reply_avail_ops_valid_1 = {
+	.buf = (char *) &reply_avail_ops_valid_parcel1,
+	.buf_len = sizeof(reply_avail_ops_valid_parcel1),
+	.unsolicited = FALSE,
+	.req = RIL_REQUEST_QUERY_AVAILABLE_NETWORKS,
+	.serial_no = 0,
+	.error = 0,
+};
+
+/*
+ * The following hexadecimal data contains the event data of a valid
+ * RIL_REQUEST_SIM_IO reply with the following parameters:
+ *
+ * {sw1=0x90,sw2=0x00,0000000a2fe2040000000005020000}
+ * This is a reply to a select file for EF_ICCID.
+ */
+static const guchar reply_sim_io_valid_parcel1[] = {
+	0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00,
+	0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00,
+	0x30, 0x00, 0x61, 0x00, 0x32, 0x00, 0x66, 0x00, 0x65, 0x00, 0x32, 0x00,
+	0x30, 0x00, 0x34, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00,
+	0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x35, 0x00,
+	0x30, 0x00, 0x32, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00,
+	0x00, 0x00, 0x00, 0x00
+};
+
+static const struct ril_msg reply_sim_io_valid_1 = {
+	.buf = (gchar *) reply_sim_io_valid_parcel1,
+	.buf_len = sizeof(reply_sim_io_valid_parcel1),
+	.unsolicited = FALSE,
+	.req = RIL_REQUEST_SIM_IO,
+	.serial_no = 0,
+	.error = 0,
+};
+
+/*
+ * The following hexadecimal data contains the event data of an valid
+ * RIL_REQUEST_SIM_IO reply with the following parameters:
+ *
+ * {sw1=0x90,sw2=0x00,(null)}
+ * This is a reply to a select file for EF_ICCID.
+ */
+static const guchar reply_sim_io_valid_parcel2[] = {
+	0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
+};
+
+static const struct ril_msg reply_sim_io_valid_2 = {
+	.buf = (gchar *) reply_sim_io_valid_parcel2,
+	.buf_len = sizeof(reply_sim_io_valid_parcel2),
+	.unsolicited = FALSE,
+	.req = RIL_REQUEST_SIM_IO,
+	.serial_no = 0,
+	.error = 0,
+};
+
+/*
+ * The following hexadecimal data contains the event data of an invalid
+ * RIL_REQUEST_SIM_IO reply with the following parameters:
+ *
+ * Note - this is invalid because the response includes a non-hex char ('Z').
+ *
+ * {sw1=0x90,sw2=0x00,Z000000a2fe2040000000005020000}
+ * This is a reply to a select file for EF_ICCID.
+ */
+static const guchar reply_sim_io_invalid_parcel1[] = {
+	0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00,
+	0x5A, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00,
+	0x30, 0x00, 0x61, 0x00, 0x32, 0x00, 0x66, 0x00, 0x65, 0x00, 0x32, 0x00,
+	0x30, 0x00, 0x34, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00,
+	0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x35, 0x00,
+	0x30, 0x00, 0x32, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00,
+	0x00, 0x00, 0x00, 0x00
+};
+
+static const struct ril_msg reply_sim_io_invalid_1 = {
+	.buf = (gchar *) reply_sim_io_invalid_parcel1,
+	.buf_len = sizeof(reply_sim_io_invalid_parcel1),
+	.unsolicited = FALSE,
+	.req = RIL_REQUEST_SIM_IO,
+	.serial_no = 0,
+	.error = 0,
+};
+
+/*
+ * The following hexadecimal data contains the event data of an invalid
+ * RIL_REQUEST_SIM_IO reply with the following parameters:
+ *
+ * {sw1=0x90,sw2=0x00,<malformed length>}
+ * This is a reply to a select file for EF_ICCID.
+ */
+static const guchar reply_sim_io_invalid_parcel2[] = {
+	0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff
+};
+
+static const struct ril_msg reply_sim_io_invalid_2 = {
+	.buf = (gchar *) reply_sim_io_invalid_parcel2,
+	.buf_len = sizeof(reply_sim_io_invalid_parcel2),
+	.unsolicited = FALSE,
+	.req = RIL_REQUEST_SIM_IO,
+	.serial_no = 0,
+	.error = 0,
+};
+
+/*
+ * The following hexadecimal data contains the event data of a valid
+ * RIL_REQUEST_GET_IMSI reply with the following parameters:
+ *
+ * {214060200695834}
+ */
+static const guchar reply_imsi_valid_parcel1[] = {
+	0x0f, 0x00, 0x00, 0x00, 0x32, 0x00, 0x31, 0x00, 0x34, 0x00, 0x30, 0x00,
+	0x36, 0x00, 0x30, 0x00, 0x32, 0x00, 0x30, 0x00, 0x30, 0x00, 0x36, 0x00,
+	0x39, 0x00, 0x35, 0x00, 0x38, 0x00, 0x33, 0x00, 0x34, 0x00, 0x00, 0x00
+};
+
+static const struct ril_msg reply_imsi_valid_1 = {
+	.buf = (gchar *) reply_imsi_valid_parcel1,
+	.buf_len = sizeof(reply_imsi_valid_parcel1),
+	.unsolicited = FALSE,
+	.req = RIL_REQUEST_GET_IMSI,
+	.serial_no = 0,
+	.error = 0,
+};
+
+/*
+ * The following hexadecimal data contains the event data of a valid
+ * RIL_REQUEST_GET_SIM_STATUS reply with the following parameters:
+ *
+ * {card_state=1,universal_pin_state=0,gsm_umts_index=0,cdma_index=-1,
+ *  ims_index=-1, [app_type=1,app_state=5,perso_substate=2,aid_ptr=,
+ *  app_label_ptr=(null),pin1_replaced=0,pin1=3,pin2=1],}
+ */
+static const guchar reply_sim_status_valid_parcel1[] = {
+	0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00,
+	0x01, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+	0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00
+};
+
+static const struct ril_msg reply_sim_status_valid_1 = {
+	.buf = (gchar *) reply_sim_status_valid_parcel1,
+	.buf_len = sizeof(reply_sim_status_valid_parcel1),
+	.unsolicited = FALSE,
+	.req = RIL_REQUEST_GET_SIM_STATUS,
+	.serial_no = 0,
+	.error = 0,
+};
+
+/*
+ * The following hexadecimal data contains the event data of a valid
+ * RIL_REQUEST_GET_SMSC_ADDRESS reply with the following parameters:
+ *
+ * {type=145,number=34607003110}
+ */
+static const guchar reply_get_smsc_address_valid_parcel1[] = {
+	0x12, 0x00, 0x00, 0x00, 0x22, 0x00, 0x2b, 0x00, 0x33, 0x00, 0x34, 0x00,
+	0x36, 0x00, 0x30, 0x00, 0x37, 0x00, 0x30, 0x00, 0x30, 0x00, 0x33, 0x00,
+	0x31, 0x00, 0x31, 0x00, 0x30, 0x00, 0x22, 0x00, 0x2c, 0x00, 0x31, 0x00,
+	0x34, 0x00, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+static const struct ril_msg reply_get_smsc_address_valid_1 = {
+	.buf = (gchar *) reply_get_smsc_address_valid_parcel1,
+	.buf_len = sizeof(reply_get_smsc_address_valid_parcel1),
+	.unsolicited = FALSE,
+	.req = RIL_REQUEST_GET_SMSC_ADDRESS,
+	.serial_no = 0,
+	.error = 0,
+};
+
+/*
+ * The following hexadecimal data contains the event data of a valid
+ * RIL_REQUEST_GET_CURRENT_CALLS reply with the following parameters:
+ *
+ * {[id=2,status=0,type=1,number=686732222,name=]
+ *  [id=1,status=1,type=1,number=917525555,name=]}
+ */
+static const guchar reply_get_current_calls_valid_parcel1[] = {
+	0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+	0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x09, 0x00, 0x00, 0x00, 0x36, 0x00, 0x38, 0x00, 0x36, 0x00, 0x37, 0x00,
+	0x33, 0x00, 0x32, 0x00, 0x32, 0x00, 0x32, 0x00, 0x32, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+	0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x09, 0x00, 0x00, 0x00, 0x39, 0x00, 0x31, 0x00, 0x37, 0x00, 0x35, 0x00,
+	0x32, 0x00, 0x35, 0x00, 0x35, 0x00, 0x35, 0x00, 0x35, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00
+};
+
+static const struct ril_msg reply_get_current_calls_valid_1 = {
+	.buf = (gchar *) reply_get_current_calls_valid_parcel1,
+	.buf_len = sizeof(reply_get_current_calls_valid_parcel1),
+	.unsolicited = FALSE,
+	.req = RIL_REQUEST_GET_CURRENT_CALLS,
+	.serial_no = 0,
+	.error = 0,
+};
+
+/* RIL_REQUEST_GET_CURRENT_CALLS NULL reply */
+static const struct ril_msg reply_get_current_calls_invalid_1 = {
+	.buf = NULL,
+	.buf_len = 0,
+	.unsolicited = FALSE,
+	.req = RIL_REQUEST_GET_CURRENT_CALLS,
+	.serial_no = 0,
+	.error = 0,
+};
+
+/* RIL_REQUEST_GET_CURRENT_CALLS no calls */
+static const guchar reply_get_current_calls_invalid_parcel2[] = {
+	0x00, 0x00, 0x00, 0x00,
+};
+
+static const struct ril_msg reply_get_current_calls_invalid_2 = {
+	.buf = (gchar *) reply_get_current_calls_invalid_parcel2,
+	.buf_len = sizeof(reply_get_current_calls_invalid_parcel2),
+	.unsolicited = FALSE,
+	.req = RIL_REQUEST_GET_CURRENT_CALLS,
+	.serial_no = 0,
+	.error = 0,
+};
+
+/*
+ * The following hexadecimal data contains the event data of a valid
+ * RIL_REQUEST_LAST_CALL_FAIL_CAUSE reply with the following parameters:
+ *
+ * {16}
+ */
+static const guchar reply_call_fail_cause_valid_parcel1[] = {
+	0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00
+};
+
+static const struct ril_msg reply_call_fail_cause_valid_1 = {
+	.buf = (gchar *) reply_call_fail_cause_valid_parcel1,
+	.buf_len = sizeof(reply_call_fail_cause_valid_parcel1),
+	.unsolicited = FALSE,
+	.req = RIL_REQUEST_LAST_CALL_FAIL_CAUSE,
+	.serial_no = 0,
+	.error = 0,
+};
+
+/*
+ * The following hexadecimal data contains the event data of a valid
+ * RIL_REQUEST_GET_MUTE reply with the following parameters:
+ *
+ * {muted=0}
+ */
+static const guchar reply_get_mute_off_parcel1[] = {
+	0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+static const struct ril_msg reply_get_mute_off_1 = {
+	.buf = (gchar *) reply_get_mute_off_parcel1,
+	.buf_len = sizeof(reply_get_mute_off_parcel1),
+	.unsolicited = FALSE,
+	.req = RIL_REQUEST_GET_MUTE,
+	.serial_no = 0,
+	.error = 0,
+};
+
+/*
+ * The following hexadecimal data contains the event data of a valid
+ * RIL_REQUEST_GET_MUTE reply with the following parameters:
+ *
+ * {muted=1}
+ */
+static const guchar reply_get_mute_on_parcel1[] = {
+	0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00
+};
+
+static const struct ril_msg reply_get_mute_on_1 = {
+	.buf = (gchar *) reply_get_mute_on_parcel1,
+	.buf_len = sizeof(reply_get_mute_on_parcel1),
+	.unsolicited = FALSE,
+	.req = RIL_REQUEST_GET_MUTE,
+	.serial_no = 0,
+	.error = 0,
+};
+
+/*
+ * The following hexadecimal data contains the event data of a valid
+ * RIL_REQUEST_BASEBAND_VERSION reply with the following parameters:
+ *
+ * {M9615A-CEFWMAZM-2.0.1700.48}
+ */
+static const guchar reply_baseband_version_valid_parcel1[] = {
+	0x1b, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x39, 0x00, 0x36, 0x00, 0x31, 0x00,
+	0x35, 0x00, 0x41, 0x00, 0x2d, 0x00, 0x43, 0x00, 0x45, 0x00, 0x46, 0x00,
+	0x57, 0x00, 0x4d, 0x00, 0x41, 0x00, 0x5a, 0x00, 0x4d, 0x00, 0x2d, 0x00,
+	0x32, 0x00, 0x2e, 0x00, 0x30, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x37, 0x00,
+	0x30, 0x00, 0x30, 0x00, 0x2e, 0x00, 0x34, 0x00, 0x38, 0x00, 0x00, 0x00
+};
+
+static const struct ril_msg reply_baseband_version_valid_1 = {
+	.buf = (gchar *) reply_baseband_version_valid_parcel1,
+	.buf_len = sizeof(reply_baseband_version_valid_parcel1),
+	.unsolicited = FALSE,
+	.req = RIL_REQUEST_BASEBAND_VERSION,
+	.serial_no = 0,
+	.error = 0,
+};
+
+/*
+ * The following hexadecimal data contains the event data of a valid
+ * RIL_REQUEST_GET_IMEI reply with the following parameters:
+ *
+ * {355136050779043}
+ */
+static const guchar reply_get_imei_valid_parcel1[] = {
+	0x0f, 0x00, 0x00, 0x00, 0x33, 0x00, 0x35, 0x00, 0x35, 0x00, 0x31, 0x00,
+	0x33, 0x00, 0x36, 0x00, 0x30, 0x00, 0x35, 0x00, 0x30, 0x00, 0x37, 0x00,
+	0x37, 0x00, 0x39, 0x00, 0x30, 0x00, 0x34, 0x00, 0x33, 0x00, 0x00, 0x00
+};
+
+static const struct ril_msg reply_get_imei_valid_1 = {
+	.buf = (gchar *) reply_get_imei_valid_parcel1,
+	.buf_len = sizeof(reply_get_imei_valid_parcel1),
+	.unsolicited = FALSE,
+	.req = RIL_REQUEST_GET_IMEI,
+	.serial_no = 0,
+	.error = 0,
+};
+
+/*
+ * The following hexadecimal data contains the event data of a valid
+ * RIL_REQUEST_QUERY_CALL_WAITING reply with the following parameters:
+ *
+ * {1,0x30}
+ */
+static const guchar reply_query_call_waiting_valid_parcel1[] = {
+	0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00
+};
+
+static const struct ril_msg reply_query_call_waiting_valid_1 = {
+	.buf = (gchar *) reply_query_call_waiting_valid_parcel1,
+	.buf_len = sizeof(reply_query_call_waiting_valid_parcel1),
+	.unsolicited = FALSE,
+	.req = RIL_REQUEST_QUERY_CALL_WAITING,
+	.serial_no = 0,
+	.error = 0,
+};
+
+/*
+ * The following hexadecimal data contains the event data of a valid
+ * RIL_REQUEST_QUERY_CLIP reply with the following parameters:
+ *
+ * {1}
+ */
+static const guchar reply_query_clip_valid_parcel1[] = {
+	0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00
+};
+
+static const struct ril_msg reply_query_clip_valid_1 = {
+	.buf = (gchar *) reply_query_clip_valid_parcel1,
+	.buf_len = sizeof(reply_query_clip_valid_parcel1),
+	.unsolicited = FALSE,
+	.req = RIL_REQUEST_QUERY_CLIP,
+	.serial_no = 0,
+	.error = 0,
+};
+
+/*
+ * The following hexadecimal data contains the event data of a valid
+ * RIL_REQUEST_GET_CLIR reply with the following parameters:
+ *
+ * {2,4}
+ */
+static const guchar reply_get_clir_valid_parcel1[] = {
+	0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00
+};
+
+static const struct ril_msg reply_get_clir_valid_1 = {
+	.buf = (gchar *) reply_get_clir_valid_parcel1,
+	.buf_len = sizeof(reply_get_clir_valid_parcel1),
+	.unsolicited = FALSE,
+	.req = RIL_REQUEST_GET_CLIR,
+	.serial_no = 0,
+	.error = 0,
+};
+
+/*
+ * The following hexadecimal data contains the event data of a valid
+ * RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE reply with the following parameters:
+ *
+ * {0}
+ */
+static const guchar reply_get_preferred_network_type_valid_parcel1[] = {
+	0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+static const get_preferred_network_test
+		reply_get_preferred_network_type_valid_1 = {
+	.preferred = 0,
+	.msg = {
+		.buf = (gchar *) reply_get_preferred_network_type_valid_parcel1,
+		.buf_len =
+			sizeof(reply_get_preferred_network_type_valid_parcel1),
+		.unsolicited = FALSE,
+		.req = RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE,
+		.serial_no = 0,
+		.error = 0,
+	}
+};
+
+/*
+ * The following hexadecimal data contains the event data of a valid
+ * RIL_REQUEST_QUERY_FACILITY_LOCK reply with the following parameters:
+ *
+ * {0}
+ */
+static const guchar reply_query_facility_lock_valid_parcel1[] = {
+	0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+static const struct query_facility_lock_test
+				reply_query_facility_lock_valid_1 = {
+	.status = 0,
+	.msg = {
+		.buf = (gchar *) reply_query_facility_lock_valid_parcel1,
+		.buf_len = sizeof(reply_query_facility_lock_valid_parcel1),
+		.unsolicited = FALSE,
+		.req = RIL_REQUEST_QUERY_FACILITY_LOCK,
+		.serial_no = 0,
+		.error = 0,
+	}
+};
+
+/*
+ * The following hexadecimal data contains the event data of a valid
+ * RIL_REQUEST_QUERY_FACILITY_LOCK reply with the following parameters:
+ *
+ * {0,0} (infineon: two integers are returned)
+ */
+static const guchar reply_query_facility_lock_valid_parcel2[] = {
+	0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+static const struct query_facility_lock_test
+				reply_query_facility_lock_valid_2 = {
+	.status = 0,
+	.msg = {
+		.buf = (gchar *) reply_query_facility_lock_valid_parcel2,
+		.buf_len = sizeof(reply_query_facility_lock_valid_parcel2),
+		.unsolicited = FALSE,
+		.req = RIL_REQUEST_QUERY_FACILITY_LOCK,
+		.serial_no = 0,
+		.error = 0,
+	}
+};
+
+/*
+ * The following structure contains test data for a valid
+ * RIL_REQUEST_SET_FACILITY_LOCK reply with no parameters.
+ */
+static const struct set_facility_lock_test reply_set_facility_lock_valid_1 = {
+	.retries = -1,
+	.msg = {
+		.buf = NULL,
+		.buf_len = 0,
+		.unsolicited = FALSE,
+		.req = RIL_REQUEST_SET_FACILITY_LOCK,
+		.serial_no = 0,
+		.error = 0,
+	}
+};
+
+/*
+ * The following structure contains test data for a valid
+ * RIL_REQUEST_SET_FACILITY_LOCK reply with parameter {2}
+ */
+static const guchar reply_set_facility_lock_valid_parcel2[] = {
+	0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00
+};
+
+static const struct set_facility_lock_test reply_set_facility_lock_valid_2 = {
+	.retries = 2,
+	.msg = {
+		.buf = (gchar *) reply_set_facility_lock_valid_parcel2,
+		.buf_len = sizeof(reply_set_facility_lock_valid_parcel2),
+		.unsolicited = FALSE,
+		.req = RIL_REQUEST_SET_FACILITY_LOCK,
+		.serial_no = 0,
+		.error = 0,
+	}
+};
+
+/*
+ * The following structure contains test data for a valid
+ * RIL_REQUEST_ENTER_SIM_PIN reply with parameter {0}
+ */
+static const guchar reply_enter_sim_pin_valid_parcel1[] = {
+	0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+static const struct sim_password_test reply_enter_sim_pin_valid_1 = {
+	.retries = -1,
+	.passwd_type = OFONO_SIM_PASSWORD_SIM_PIN,
+	.msg = {
+		.buf = (gchar *) reply_enter_sim_pin_valid_parcel1,
+		.buf_len = sizeof(reply_enter_sim_pin_valid_parcel1),
+		.unsolicited = FALSE,
+		.req = RIL_REQUEST_ENTER_SIM_PIN,
+		.serial_no = 0,
+		.error = RIL_E_SUCCESS,
+	}
+};
+
+/*
+ * The following structure contains test data for a valid
+ * RIL_REQUEST_ENTER_SIM_PIN reply with parameter {2}
+ */
+static const guchar reply_enter_sim_pin_valid_parcel2[] = {
+	0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00
+};
+
+static const struct sim_password_test reply_enter_sim_pin_valid_2 = {
+	.retries = 2,
+	.passwd_type = OFONO_SIM_PASSWORD_SIM_PIN,
+	.msg = {
+		.buf = (gchar *) reply_enter_sim_pin_valid_parcel2,
+		.buf_len = sizeof(reply_enter_sim_pin_valid_parcel2),
+		.unsolicited = FALSE,
+		.req = RIL_REQUEST_ENTER_SIM_PIN,
+		.serial_no = 0,
+		.error = RIL_E_PASSWORD_INCORRECT,
+	}
+};
+
+/*
+ * The following structure contains test data for a valid
+ * RIL_REQUEST_OEM_HOOK_RAW reply with parameter {4,0x11111111}
+ */
+static const guchar reply_oem_hook_raw_valid_parcel1[] = {
+	0x04, 0x00, 0x00, 0x00, 0x11, 0x11, 0x11, 0x11
+};
+
+static const struct oem_hook_raw_test reply_oem_hook_raw_valid_1 = {
+	.data = reply_oem_hook_raw_valid_parcel1 + sizeof(int32_t),
+	.size = (int) (sizeof(reply_oem_hook_raw_valid_parcel1)
+			- sizeof(int32_t)),
+	.msg = {
+		.buf = (gchar *) reply_oem_hook_raw_valid_parcel1,
+		.buf_len = sizeof(reply_oem_hook_raw_valid_parcel1),
+		.unsolicited = FALSE,
+		.req = RIL_REQUEST_OEM_HOOK_RAW,
+		.serial_no = 0,
+		.error = RIL_E_SUCCESS,
+	}
+};
+
+/*
+ * The following structure contains test data for a valid
+ * RIL_REQUEST_OEM_HOOK_RAW reply with parameter {-1}
+ */
+static const guchar reply_oem_hook_raw_valid_parcel2[] = {
+	0xFF, 0xFF, 0xFF, 0xFF
+};
+
+static const struct oem_hook_raw_test reply_oem_hook_raw_valid_2 = {
+	.data = NULL,
+	.size = -1,
+	.msg = {
+		.buf = (gchar *) reply_oem_hook_raw_valid_parcel2,
+		.buf_len = sizeof(reply_oem_hook_raw_valid_parcel2),
+		.unsolicited = FALSE,
+		.req = RIL_REQUEST_OEM_HOOK_RAW,
+		.serial_no = 0,
+		.error = RIL_E_SUCCESS,
+	}
+};
+
+/*
+ * The following structure contains test data for a valid
+ * RIL_REQUEST_OEM_HOOK_STRINGS reply with parameter {+EPINC: 3, 3, 10, 10}
+ */
+static const guchar reply_oem_hook_strings_valid_parcel1[] = {
+	0x01, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x45, 0x00,
+	0x50, 0x00, 0x49, 0x00, 0x4e, 0x00, 0x43, 0x00, 0x3a, 0x00, 0x20, 0x00,
+	0x33, 0x00, 0x2c, 0x00, 0x20, 0x00, 0x33, 0x00, 0x2c, 0x00, 0x20, 0x00,
+	0x31, 0x00, 0x30, 0x00, 0x2c, 0x00, 0x20, 0x00, 0x31, 0x00, 0x30, 0x00,
+	0x00, 0x00, 0x00, 0x00
+};
+
+static const char *strings_valid_parcel1[] = { "+EPINC: 3, 3, 10, 10" };
+
+static const struct oem_hook_strings_test reply_oem_hook_strings_valid_1 = {
+	.msg = {
+		.buf = (gchar *) reply_oem_hook_strings_valid_parcel1,
+		.buf_len = sizeof(reply_oem_hook_strings_valid_parcel1),
+		.unsolicited = FALSE,
+		.req = RIL_REQUEST_OEM_HOOK_STRINGS,
+		.serial_no = 0,
+		.error = RIL_E_SUCCESS,
+	},
+	.num_str = G_N_ELEMENTS(strings_valid_parcel1),
+	.str = strings_valid_parcel1
+};
+
+static void test_reply_voice_reg_state_valid(gconstpointer data)
+{
+	const reg_state_test *test = data;
+	struct reply_reg_state *reply =
+		g_ril_reply_parse_voice_reg_state(NULL, &test->msg);
+
+	g_assert(reply != NULL);
+	g_assert(reply->status == test->status);
+
+	g_assert(reply->tech == test->tech);
+	g_free(reply);
+}
+
+static void test_reply_data_reg_state_invalid(gconstpointer data)
+{
+	struct reply_data_reg_state *reply =
+		g_ril_reply_parse_data_reg_state(NULL, data);
+	g_assert(reply == NULL);
+}
+
+static void test_reply_data_reg_state_valid(gconstpointer data)
+{
+	const reg_state_test *test = data;
+	struct reply_data_reg_state *reply =
+		g_ril_reply_parse_data_reg_state(NULL, &test->msg);
+
+	g_assert(reply != NULL);
+	g_assert(reply->reg_state.status == test->status);
+
+	g_assert(reply->reg_state.tech == test->tech);
+	g_free(reply);
+}
+
+static void test_reply_operator_invalid(gconstpointer data)
+{
+	struct reply_operator *reply = g_ril_reply_parse_operator(NULL, data);
+	g_assert(reply == NULL);
+}
+
+static void test_reply_operator_valid(gconstpointer data)
+{
+	struct reply_operator *reply = g_ril_reply_parse_operator(NULL, data);
+	g_assert(reply != NULL);
+}
+
+static void test_reply_avail_ops_invalid(gconstpointer data)
+{
+	struct reply_avail_ops *reply = g_ril_reply_parse_avail_ops(NULL, data);
+	g_assert(reply == NULL);
+}
+
+static void test_reply_avail_ops_valid(gconstpointer data)
+{
+	struct reply_avail_ops *reply = g_ril_reply_parse_avail_ops(NULL, data);
+	g_assert(reply != NULL);
+}
+
+static void test_reply_sim_io_valid(gconstpointer data)
+{
+	struct reply_sim_io *reply = g_ril_reply_parse_sim_io(NULL, data);
+	g_assert(reply != NULL);
+	g_ril_reply_free_sim_io(reply);
+}
+
+static void test_reply_sim_io_invalid(gconstpointer data)
+{
+	struct reply_sim_io *reply = g_ril_reply_parse_sim_io(NULL, data);
+	g_assert(reply == NULL);
+}
+
+static void test_reply_imsi_valid(gconstpointer data)
+{
+	gchar *reply = g_ril_reply_parse_imsi(NULL, data);
+	g_assert(reply != NULL);
+	g_free(reply);
+}
+
+static void test_reply_sim_status_valid(gconstpointer data)
+{
+	struct reply_sim_status *reply;
+
+	reply = g_ril_reply_parse_sim_status(NULL, data);
+	g_assert(reply != NULL);
+	g_ril_reply_free_sim_status(reply);
+}
+
+static void test_reply_get_smsc_address_valid(gconstpointer data)
+{
+	struct ofono_phone_number *reply;
+
+	reply = g_ril_reply_parse_get_smsc_address(NULL, data);
+
+	g_assert(reply != NULL);
+	g_free(reply);
+}
+
+static void test_reply_get_current_calls_valid(gconstpointer data)
+{
+	GSList *calls;
+
+	calls = g_ril_reply_parse_get_calls(NULL, data);
+
+	g_assert(calls != NULL);
+
+	g_slist_foreach(calls, (GFunc) g_free, NULL);
+	g_slist_free(calls);
+}
+
+static void test_reply_get_current_calls_invalid(gconstpointer data)
+{
+	GSList *calls;
+
+	calls = g_ril_reply_parse_get_calls(NULL, data);
+
+	g_assert(calls == NULL);
+}
+
+static void test_reply_call_fail_cause_valid(gconstpointer data)
+{
+	enum ofono_disconnect_reason reason;
+
+	reason = g_ril_reply_parse_call_fail_cause(NULL, data);
+
+	g_assert(reason >= 0);
+}
+
+static void test_reply_get_mute_off(gconstpointer data)
+{
+	int muted;
+
+	muted = g_ril_reply_parse_get_mute(NULL, data);
+
+	g_assert(muted == 0);
+}
+
+static void test_reply_get_mute_on(gconstpointer data)
+{
+	int muted;
+
+	muted = g_ril_reply_parse_get_mute(NULL, data);
+
+	g_assert(muted == 1);
+}
+
+static void test_reply_baseband_version_valid(gconstpointer data)
+{
+	char *version;
+
+	version = g_ril_reply_parse_baseband_version(NULL, data);
+
+	g_assert(version != NULL);
+
+	g_free(version);
+}
+
+static void test_reply_get_imei_valid(gconstpointer data)
+{
+	char *imei;
+
+	imei = g_ril_reply_parse_get_imei(NULL, data);
+
+	g_assert(imei != NULL);
+
+	g_free(imei);
+}
+
+static void test_reply_query_call_waiting_valid(gconstpointer data)
+{
+	int cls;
+
+	cls = g_ril_reply_parse_query_call_waiting(NULL, data);
+
+	g_assert(cls != -1);
+}
+
+static void test_reply_query_clip_valid(gconstpointer data)
+{
+	int clip_status;
+
+	clip_status = g_ril_reply_parse_query_clip(NULL, data);
+
+	g_assert(clip_status != -1);
+}
+
+static void test_reply_get_clir_valid(gconstpointer data)
+{
+	struct reply_clir *reply;
+
+	reply = g_ril_reply_parse_get_clir(NULL, data);
+
+	g_assert(reply != NULL);
+
+	g_ril_reply_free_get_clir(reply);
+}
+
+static void test_reply_get_preferred_network_type_valid(gconstpointer data)
+{
+	const get_preferred_network_test *test = data;
+	int type =
+		g_ril_reply_parse_get_preferred_network_type(NULL, &test->msg);
+
+	g_assert(type == test->preferred);
+}
+
+static void test_reply_query_facility_lock_valid(gconstpointer data)
+{
+	const struct query_facility_lock_test *test = data;
+	int status = g_ril_reply_parse_query_facility_lock(NULL, &test->msg);
+
+	g_assert(status == test->status);
+}
+
+static void test_reply_set_facility_lock_valid(gconstpointer data)
+{
+	const struct set_facility_lock_test *test = data;
+	int retries = g_ril_reply_parse_set_facility_lock(NULL, &test->msg);
+
+	g_assert(retries == test->retries);
+}
+
+static void test_reply_enter_sim_pin_valid(gconstpointer data)
+{
+	const struct sim_password_test *test = data;
+	int *retries = g_ril_reply_parse_retries(NULL, &test->msg,
+							test->passwd_type);
+
+	g_assert(retries != NULL);
+	g_assert(retries[test->passwd_type] == test->retries);
+
+	g_free(retries);
+}
+
+static void test_reply_oem_hook_raw_valid(gconstpointer data)
+{
+	const struct oem_hook_raw_test *test = data;
+	struct reply_oem_hook *reply =
+		g_ril_reply_oem_hook_raw(NULL, &test->msg);
+
+	g_assert(reply->length == test->size);
+	if (reply->length >= 0)
+		g_assert(!memcmp(reply->data, test->data, test->size));
+	else
+		g_assert(reply->data == NULL);
+
+	g_ril_reply_free_oem_hook(reply);
+}
+
+static void test_reply_oem_hook_strings_valid(gconstpointer data)
+{
+	int i;
+	const struct oem_hook_strings_test *test = data;
+	struct parcel_str_array *reply =
+		g_ril_reply_oem_hook_strings(NULL, &test->msg);
+
+	g_assert(reply != NULL);
+	g_assert(reply->num_str == test->num_str);
+
+	for (i = 0; i < reply->num_str; ++i)
+		g_assert(strcmp(reply->str[i], test->str[i]) == 0);
+
+	parcel_free_str_array(reply);
+}
+
+#endif
+
+int main(int argc, char **argv)
+{
+	g_test_init(&argc, &argv, NULL);
+
+/*
+ * As all our architectures are little-endian except for
+ * PowerPC, and the Binder wire-format differs slightly
+ * depending on endian-ness, the following guards against test
+ * failures when run on PowerPC.
+ */
+#if BYTE_ORDER == LITTLE_ENDIAN
+
+	g_test_add_data_func("/testgrilreply/gprs: "
+				"invalid DATA_REG_STATE Test 1",
+				&reply_data_reg_state_invalid_1,
+				test_reply_data_reg_state_invalid);
+
+	g_test_add_data_func("/testgrilreply/gprs: "
+				"invalid DATA_REG_STATE Test 2",
+				&reply_data_reg_state_invalid_2,
+				test_reply_data_reg_state_invalid);
+
+	g_test_add_data_func("/testgrilreply/gprs: "
+				"invalid DATA_REG_STATE Test 3",
+				&reply_data_reg_state_invalid_3,
+				test_reply_data_reg_state_invalid);
+
+	g_test_add_data_func("/testgrilreply/gprs: "
+				"valid DATA_REG_STATE Test 1",
+				&data_reg_valid_1,
+				test_reply_data_reg_state_valid);
+
+	g_test_add_data_func("/testgrilreply/gprs: "
+				"valid DATA_REG_STATE Test 2",
+				&data_reg_valid_2,
+				test_reply_data_reg_state_valid);
+
+	g_test_add_data_func("/testgrilreply/gprs: "
+				"valid DATA_REG_STATE Test 3",
+				&data_reg_valid_3,
+				test_reply_data_reg_state_valid);
+
+	g_test_add_data_func("/testgrilreply/gprs: "
+				"valid DATA_REG_STATE Test 4",
+				&data_reg_valid_4,
+				test_reply_data_reg_state_valid);
+
+	g_test_add_data_func("/testgrilreply/gprs: "
+				"valid DATA_REG_STATE Test 5",
+				&data_reg_valid_5,
+				test_reply_data_reg_state_valid);
+
+	g_test_add_data_func("/testgrilreply/gprs: "
+				"valid DATA_REG_STATE Test 6",
+				&data_reg_valid_6,
+				test_reply_data_reg_state_valid);
+
+	g_test_add_data_func("/testgrilreply/gprs: "
+				"valid DATA_REG_STATE Test 7",
+				&data_reg_valid_7,
+				test_reply_data_reg_state_valid);
+
+	g_test_add_data_func("/testgrilreply/gprs: "
+				"valid DATA_REG_STATE Test 8",
+				&data_reg_valid_8,
+				test_reply_data_reg_state_valid);
+
+	g_test_add_data_func("/testgrilreply/gprs: "
+				"valid DATA_REG_STATE Test 9",
+				&data_reg_valid_9,
+				test_reply_data_reg_state_valid);
+
+	g_test_add_data_func("/testgrilreply/gprs: "
+				"valid DATA_REG_STATE Test 10",
+				&data_reg_valid_10,
+				test_reply_data_reg_state_valid);
+
+	g_test_add_data_func("/testgrilreply/netreg: "
+				"valid VOICE_REG_STATE Test 1",
+				&voice_reg_valid_1,
+				test_reply_voice_reg_state_valid);
+
+	g_test_add_data_func("/testgrilreply/netreg: "
+				"valid VOICE_REG_STATE Test 2",
+				&voice_reg_valid_2,
+				test_reply_voice_reg_state_valid);
+
+	g_test_add_data_func("/testgrilreply/netreg: "
+				"valid VOICE_REG_STATE Test 3",
+				&voice_reg_valid_3,
+				test_reply_voice_reg_state_valid);
+
+	g_test_add_data_func("/testgrilreply/netreg: "
+				"valid VOICE_REG_STATE Test 4",
+				&voice_reg_valid_4,
+				test_reply_voice_reg_state_valid);
+
+	g_test_add_data_func("/testgrilreply/netreg: "
+				"valid VOICE_REG_STATE Test 5",
+				&voice_reg_valid_5,
+				test_reply_voice_reg_state_valid);
+
+	g_test_add_data_func("/testgrilreply/netreg: "
+				"valid VOICE_REG_STATE Test 6",
+				&voice_reg_valid_6,
+				test_reply_voice_reg_state_valid);
+
+	g_test_add_data_func("/testgrilreply/netreg: "
+				"valid VOICE_REG_STATE Test 7",
+				&voice_reg_valid_7,
+				test_reply_voice_reg_state_valid);
+
+	g_test_add_data_func("/testgrilreply/netreg: "
+				"valid VOICE_REG_STATE Test 8",
+				&voice_reg_valid_8,
+				test_reply_voice_reg_state_valid);
+
+	g_test_add_data_func("/testgrilreply/netreg: "
+				"valid VOICE_REG_STATE Test 9",
+				&voice_reg_valid_9,
+				test_reply_voice_reg_state_valid);
+
+	g_test_add_data_func("/testgrilreply/netreg: "
+				"valid VOICE_REG_STATE Test 10",
+				&voice_reg_valid_10,
+				test_reply_voice_reg_state_valid);
+
+	g_test_add_data_func("/testgrilreply/netreg: "
+				"valid VOICE_REG_STATE Test 11",
+				&voice_reg_valid_11,
+				test_reply_voice_reg_state_valid);
+
+	g_test_add_data_func("/testgrilreply/netreg: "
+				"valid VOICE_REG_STATE Test 12",
+				&voice_reg_valid_12,
+				test_reply_voice_reg_state_valid);
+
+	g_test_add_data_func("/testgrilreply/netreg: "
+				"invalid GET_OPERATOR Test 1",
+				&reply_operator_invalid_1,
+				test_reply_operator_invalid);
+
+	g_test_add_data_func("/testgrilreply/netreg: "
+				"invalid GET_OPERATOR Test 2",
+				&reply_operator_invalid_2,
+				test_reply_operator_invalid);
+
+	g_test_add_data_func("/testgrilreply/netreg: "
+				"valid GET_OPERATOR Test 1",
+				&reply_operator_valid_1,
+				test_reply_operator_valid);
+
+	g_test_add_data_func("/testgrilreply/netreg: "
+				"invalid QUERY_AVAIL_OPS Test 1",
+				&reply_avail_ops_invalid_1,
+				test_reply_avail_ops_invalid);
+
+	g_test_add_data_func("/testgrilreply/netreg: "
+				"invalid QUERY_AVAIL_OPS Test 2",
+				&reply_avail_ops_invalid_2,
+				test_reply_avail_ops_invalid);
+
+	g_test_add_data_func("/testgrilreply/netreg: "
+				"valid QUERY_AVAIL_OPS Test 1",
+				&reply_avail_ops_valid_1,
+				test_reply_avail_ops_valid);
+
+	g_test_add_data_func("/testgrilreply/sim: "
+				"valid SIM_IO Test 1",
+				&reply_sim_io_valid_1,
+				test_reply_sim_io_valid);
+
+	g_test_add_data_func("/testgrilreply/sim: "
+				"valid SIM_IO Test 2",
+				&reply_sim_io_valid_2,
+				test_reply_sim_io_valid);
+
+	g_test_add_data_func("/testgrilreply/sim: "
+				"invalid SIM_IO Test 1",
+				&reply_sim_io_invalid_1,
+				test_reply_sim_io_invalid);
+
+	g_test_add_data_func("/testgrilreply/sim: "
+				"invalid SIM_IO Test 2",
+				&reply_sim_io_invalid_2,
+				test_reply_sim_io_invalid);
+
+	g_test_add_data_func("/testgrilreply/sim: "
+				"valid GET_IMSI Test 1",
+				&reply_imsi_valid_1,
+				test_reply_imsi_valid);
+
+	g_test_add_data_func("/testgrilreply/sim: "
+				"valid GET_SIM_STATUS Test 1",
+				&reply_sim_status_valid_1,
+				test_reply_sim_status_valid);
+
+	g_test_add_data_func("/testgrilreply/sim: "
+				"valid GET_SMSC_ADDRESS Test 1",
+				&reply_get_smsc_address_valid_1,
+				test_reply_get_smsc_address_valid);
+
+	g_test_add_data_func("/testgrilreply/voicecall: "
+				"valid GET_CURRENT_CALLS Test 1",
+				&reply_get_current_calls_valid_1,
+				test_reply_get_current_calls_valid);
+
+	g_test_add_data_func("/testgrilreply/voicecall: "
+				"invalid GET_CURRENT_CALLS Test 1",
+				&reply_get_current_calls_invalid_1,
+				test_reply_get_current_calls_invalid);
+
+	g_test_add_data_func("/testgrilreply/voicecall: "
+				"invalid GET_CURRENT_CALLS Test 2",
+				&reply_get_current_calls_invalid_2,
+				test_reply_get_current_calls_invalid);
+
+	g_test_add_data_func("/testgrilreply/voicecall: "
+				"valid CALL_FAIL_CAUSE Test 1",
+				&reply_call_fail_cause_valid_1,
+				test_reply_call_fail_cause_valid);
+
+	g_test_add_data_func("/testgrilreply/call-volume: "
+				"off GET_MUTE Test 1",
+				&reply_get_mute_off_1,
+				test_reply_get_mute_off);
+
+	g_test_add_data_func("/testgrilreply/call-volume: "
+				"on GET_MUTE Test 1",
+				&reply_get_mute_on_1,
+				test_reply_get_mute_on);
+
+	g_test_add_data_func("/testgrilreply/devinfo: "
+				"valid BASEBAND_VERSION Test 1",
+				&reply_baseband_version_valid_1,
+				test_reply_baseband_version_valid);
+
+	g_test_add_data_func("/testgrilreply/devinfo: "
+				"valid GET_IMEI Test 1",
+				&reply_get_imei_valid_1,
+				test_reply_get_imei_valid);
+
+	g_test_add_data_func("/testgrilreply/call-settings: "
+				"valid QUERY_CALL_WAITING Test 1",
+				&reply_query_call_waiting_valid_1,
+				test_reply_query_call_waiting_valid);
+
+	g_test_add_data_func("/testgrilreply/call-settings: "
+				"valid QUERY_CLIP Test 1",
+				&reply_query_clip_valid_1,
+				test_reply_query_clip_valid);
+
+	g_test_add_data_func("/testgrilreply/call-settings: "
+				"valid GET_CLIR Test 1",
+				&reply_get_clir_valid_1,
+				test_reply_get_clir_valid);
+
+	g_test_add_data_func("/testgrilreply/radio-settings: "
+				"valid GET_PREFERRED_NETWORK_TYPE Test 1",
+				&reply_get_preferred_network_type_valid_1,
+				test_reply_get_preferred_network_type_valid);
+
+	g_test_add_data_func("/testgrilreply/call-barring: "
+				"valid QUERY_FACILITY_LOCK Test 1",
+				&reply_query_facility_lock_valid_1,
+				test_reply_query_facility_lock_valid);
+
+	g_test_add_data_func("/testgrilreply/call-barring: "
+				"valid QUERY_FACILITY_LOCK Test 2",
+				&reply_query_facility_lock_valid_2,
+				test_reply_query_facility_lock_valid);
+
+	g_test_add_data_func("/testgrilreply/call-barring: "
+				"valid SET_FACILITY_LOCK Test 1",
+				&reply_set_facility_lock_valid_1,
+				test_reply_set_facility_lock_valid);
+
+	g_test_add_data_func("/testgrilreply/call-barring: "
+				"valid SET_FACILITY_LOCK Test 2",
+				&reply_set_facility_lock_valid_2,
+				test_reply_set_facility_lock_valid);
+
+	g_test_add_data_func("/testgrilreply/sim: "
+				"valid ENTER_SIM_PIN Test 1",
+				&reply_enter_sim_pin_valid_1,
+				test_reply_enter_sim_pin_valid);
+
+	g_test_add_data_func("/testgrilreply/sim: "
+				"valid ENTER_SIM_PIN Test 2",
+				&reply_enter_sim_pin_valid_2,
+				test_reply_enter_sim_pin_valid);
+
+	g_test_add_data_func("/testgrilreply/oem: "
+				"valid OEM_HOOK_RAW Test 1",
+				&reply_oem_hook_raw_valid_1,
+				test_reply_oem_hook_raw_valid);
+
+	g_test_add_data_func("/testgrilreply/oem: "
+				"valid OEM_HOOK_RAW Test 2",
+				&reply_oem_hook_raw_valid_2,
+				test_reply_oem_hook_raw_valid);
+
+	g_test_add_data_func("/testgrilreply/oem: "
+				"valid OEM_HOOK_STRINGS Test 1",
+				&reply_oem_hook_strings_valid_1,
+				test_reply_oem_hook_strings_valid);
+
+#endif
+
+	return g_test_run();
+}
diff --git a/unit/test-rilrequest.c b/unit/test-rilrequest.c
new file mode 100644
index 0000000..00bd5e1
--- /dev/null
+++ b/unit/test-rilrequest.c
@@ -0,0 +1,1737 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2013 Canonical Ltd.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#define _GNU_SOURCE
+#include <string.h>
+#include <stdio.h>
+#include <assert.h>
+#include <glib.h>
+#include <errno.h>
+
+#include <ofono/modem.h>
+#include <ofono/gprs-context.h>
+#include <ofono/types.h>
+
+#include "drivers/rilmodem/rilrequest.h"
+
+/*
+ * TODO: It may make sense to split this file into
+ * domain-specific files ( eg. test-grilrequest-gprs-context.c )
+ * once more tests are added.
+ */
+
+/*
+ * As all our architectures are little-endian except for
+ * PowerPC, and the Binder wire-format differs slightly
+ * depending on endian-ness, the following guards against test
+ * failures when run on PowerPC.
+ */
+#if BYTE_ORDER == LITTLE_ENDIAN
+
+struct request_test_data {
+	gconstpointer request;
+	const guchar *parcel_data;
+	gsize parcel_size;
+};
+
+static const struct req_deactivate_data_call req_deact_data_call_invalid_1 = {
+	.cid = 1,
+	.reason = 10,
+};
+
+/*
+ * The following hexadecimal data represents a serialized Binder parcel
+ * instance containing a valid RIL_REQUEST_DEACTIVATE_DATA_CALL message
+ * with the following parameters:
+ *
+ * (cid=1,reason=0)
+ */
+static const guchar req_deact_data_call_valid_parcel1[] = {
+	0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00,
+	0x01, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00
+};
+
+static const struct req_deactivate_data_call req_deact_data_call_valid_1 = {
+	.cid = 1,
+	.reason = RIL_DEACTIVATE_DATA_CALL_NO_REASON,
+};
+
+static const struct request_test_data deact_data_call_valid_test_1 = {
+	.request = &req_deact_data_call_valid_1,
+	.parcel_data = (guchar *) &req_deact_data_call_valid_parcel1,
+	.parcel_size = sizeof(req_deact_data_call_valid_parcel1),
+};
+
+
+static const struct req_setup_data_call req_setup_data_call_invalid_1 = {
+	.tech = RADIO_TECH_UNKNOWN,
+};
+
+static const struct req_setup_data_call req_setup_data_call_invalid_2 = {
+	.tech = 2112,
+};
+
+static const struct req_setup_data_call req_setup_data_call_invalid_3 = {
+	.tech = RADIO_TECH_GPRS,
+	.data_profile = 5,
+};
+
+static const struct req_setup_data_call req_setup_data_call_invalid_4 = {
+	.tech = RADIO_TECH_GPRS,
+	.data_profile = RIL_DATA_PROFILE_DEFAULT,
+	.apn = NULL,
+};
+
+static const struct req_setup_data_call req_setup_data_call_invalid_5 = {
+	.tech = RADIO_TECH_GPRS,
+	.data_profile = RIL_DATA_PROFILE_DEFAULT,
+	.apn = "test.apn",
+	.auth_type = 4,
+};
+
+static const struct req_setup_data_call req_setup_data_call_invalid_6 = {
+	.tech = RADIO_TECH_GPRS,
+	.data_profile = RIL_DATA_PROFILE_DEFAULT,
+	.apn = "test.apn",
+	.auth_type = RIL_AUTH_BOTH,
+	.protocol = 3,
+};
+
+static const struct req_setup_data_call req_setup_data_call_valid_1 = {
+	.tech = RADIO_TECH_GPRS,
+	.data_profile = RIL_DATA_PROFILE_DEFAULT,
+	.apn = "test.apn",
+	.username = NULL,
+	.password = NULL,
+	.auth_type = RIL_AUTH_BOTH,
+	.protocol = OFONO_GPRS_PROTO_IP,
+
+};
+
+static const struct req_setup_data_call req_setup_data_call_valid_2 = {
+	.tech = RADIO_TECH_GPRS,
+	.data_profile = RIL_DATA_PROFILE_DEFAULT,
+	.apn = "test.apn",
+	.username = "",
+	.password = "",
+	.auth_type = RIL_AUTH_NONE,
+	.protocol = OFONO_GPRS_PROTO_IP,
+};
+
+static const struct req_setup_data_call req_setup_data_call_valid_3 = {
+	.tech = RADIO_TECH_GPRS,
+	.data_profile = RIL_DATA_PROFILE_DEFAULT,
+	.apn = "test.apn",
+	.username = "phablet",
+	.password = "phablet",
+	.auth_type = RIL_AUTH_BOTH,
+	.protocol = OFONO_GPRS_PROTO_IPV4V6,
+};
+
+static const struct req_setup_data_call req_setup_data_call_valid_4 = {
+	.tech = RADIO_TECH_GPRS,
+	.data_profile = RIL_DATA_PROFILE_DEFAULT,
+	.apn = "test.apn",
+	.username = "phablet",
+	.password = "phablet",
+	.auth_type = RIL_AUTH_BOTH,
+	.protocol = OFONO_GPRS_PROTO_IPV6,
+};
+
+static const struct req_setup_data_call req_setup_data_call_valid_5 = {
+	.tech = RADIO_TECH_GPRS,
+	.data_profile = RIL_DATA_PROFILE_DEFAULT,
+	.apn = "",
+};
+
+static const struct req_setup_data_call req_setup_data_call_valid_6 = {
+	.tech = RADIO_TECH_GPRS,
+	.data_profile = RIL_DATA_PROFILE_DEFAULT,
+	.apn = "12345678901234567890123456789012345678901234567890"
+		"123456789012345678901234567890123456789012345678901",
+};
+
+static const char sim_read_info_path_valid_1[] = {0x3F, 0x00};
+
+static const struct req_sim_read_info req_sim_read_info_valid_1 = {
+	.app_type = RIL_APPTYPE_USIM,
+	.aid_str = "1234567890123456",
+	.fileid = 0x7F01,
+	.path = (const unsigned char *) sim_read_info_path_valid_1,
+	.path_len = sizeof(sim_read_info_path_valid_1),
+};
+
+static const unsigned char sim_read_info_path_invalid_1[] =
+	{0x3F, 0x00, 0x11, 0x22, 0x7F, 0x00, 0x11, 0x22};
+
+static const struct req_sim_read_info req_sim_read_info_invalid_1 = {
+	.app_type = RIL_APPTYPE_ISIM + 10,
+	.aid_str = "1234567890123456",
+	.fileid = 0x7F01,
+	.path = sim_read_info_path_invalid_1,
+	.path_len = sizeof(sim_read_info_path_invalid_1),
+};
+
+/* sim_read_binary tests */
+
+static const guchar req_sim_read_binary_parcel_valid_1[] = {
+	0xb0, 0x00, 0x00, 0x00, 0xe2, 0x2f, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+	0x33, 0x00, 0x46, 0x00, 0x30, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+};
+
+static const unsigned char sim_read_binary_path_valid_1[] = {0x3F, 0x00};
+
+static const struct req_sim_read_binary req_sim_read_binary_valid_1 = {
+	.app_type = RIL_APPTYPE_UNKNOWN,
+	.aid_str = "",
+	.fileid = 0x2FE2,
+	.path = sim_read_binary_path_valid_1,
+	.path_len = sizeof(sim_read_binary_path_valid_1),
+	.start = 0,
+	.length = 0x0A,
+};
+
+static const struct request_test_data sim_read_binary_valid_test_1 = {
+	.request = &req_sim_read_binary_valid_1,
+	.parcel_data = (guchar *) &req_sim_read_binary_parcel_valid_1,
+	.parcel_size = sizeof(req_sim_read_binary_parcel_valid_1),
+};
+
+/* sim_read_record tests */
+
+static const guchar req_sim_read_record_parcel_valid_1[] = {
+	0xb2, 0x00, 0x00, 0x00, 0xe2, 0x2f, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+	0x33, 0x00, 0x46, 0x00, 0x30, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+};
+
+static const unsigned char sim_read_record_path_valid_1[] = {0x3F, 0x00};
+
+static const struct req_sim_read_record req_sim_read_record_valid_1 = {
+	.app_type = RIL_APPTYPE_UNKNOWN,
+	.aid_str = "",
+	.fileid = 0x2FE2,
+	.path = sim_read_record_path_valid_1,
+	.path_len = sizeof(sim_read_record_path_valid_1),
+	.record = 5,
+	.length = 0x0A,
+};
+
+static const struct request_test_data sim_read_record_valid_test_1 = {
+	.request = &req_sim_read_record_valid_1,
+	.parcel_data = (guchar *) &req_sim_read_record_parcel_valid_1,
+	.parcel_size = sizeof(req_sim_read_record_parcel_valid_1),
+};
+
+/* sim_write_binary tests */
+
+static const guchar req_sim_write_binary_parcel_valid_1[] = {
+	0xd6, 0x00, 0x00, 0x00, 0xcb, 0x6f, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+	0x33, 0x00, 0x46, 0x00, 0x30, 0x00, 0x30, 0x00, 0x37, 0x00, 0x46, 0x00,
+	0x46, 0x00, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+	0x30, 0x00, 0x31, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x31, 0x00,
+	0x38, 0x00, 0x30, 0x00, 0x46, 0x00, 0x46, 0x00, 0x46, 0x00, 0x46, 0x00,
+	0x46, 0x00, 0x46, 0x00, 0x46, 0x00, 0x46, 0x00, 0x46, 0x00, 0x46, 0x00,
+	0x46, 0x00, 0x46, 0x00, 0x46, 0x00, 0x46, 0x00, 0x46, 0x00, 0x46, 0x00,
+	0x46, 0x00, 0x46, 0x00, 0x46, 0x00, 0x46, 0x00, 0x46, 0x00, 0x46, 0x00,
+	0x46, 0x00, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+	0x20, 0x00, 0x00, 0x00, 0x61, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00,
+	0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x38, 0x00, 0x37, 0x00,
+	0x31, 0x00, 0x30, 0x00, 0x30, 0x00, 0x32, 0x00, 0x66, 0x00, 0x66, 0x00,
+	0x34, 0x00, 0x34, 0x00, 0x66, 0x00, 0x66, 0x00, 0x31, 0x00, 0x32, 0x00,
+	0x38, 0x00, 0x39, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00,
+	0x30, 0x00, 0x31, 0x00, 0x30, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+static const unsigned char sim_write_binary_path_valid_1[] =
+	{ 0x3F, 0x00, 0x7F, 0xFF };
+
+static const struct req_sim_write_binary req_sim_write_binary_valid_1 = {
+	.app_type = RIL_APPTYPE_UNKNOWN,
+	.aid_str = "a0000000871002ff44ff128900000100",
+	.fileid = 0x6FCB,
+	.path = sim_write_binary_path_valid_1,
+	.path_len = sizeof(sim_write_binary_path_valid_1),
+	.start = 0,
+	.length = 16,
+	.data = (unsigned char[]) {
+		0x01, 0x00, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0xFF,
+		0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }
+};
+
+static const struct request_test_data sim_write_binary_valid_test_1 = {
+	.request = &req_sim_write_binary_valid_1,
+	.parcel_data = (guchar *) &req_sim_write_binary_parcel_valid_1,
+	.parcel_size = sizeof(req_sim_write_binary_parcel_valid_1),
+};
+
+/* sim_write_record tests */
+
+static const guchar req_sim_write_record_parcel_valid_1[] = {
+	0xdc, 0x00, 0x00, 0x00, 0xcb, 0x6f, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
+	0x33, 0x00, 0x46, 0x00, 0x30, 0x00, 0x30, 0x00, 0x37, 0x00, 0x46, 0x00,
+	0x46, 0x00, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+	0x04, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
+	0x30, 0x00, 0x31, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x31, 0x00,
+	0x38, 0x00, 0x30, 0x00, 0x46, 0x00, 0x46, 0x00, 0x46, 0x00, 0x46, 0x00,
+	0x46, 0x00, 0x46, 0x00, 0x46, 0x00, 0x46, 0x00, 0x46, 0x00, 0x46, 0x00,
+	0x46, 0x00, 0x46, 0x00, 0x46, 0x00, 0x46, 0x00, 0x46, 0x00, 0x46, 0x00,
+	0x46, 0x00, 0x46, 0x00, 0x46, 0x00, 0x46, 0x00, 0x46, 0x00, 0x46, 0x00,
+	0x46, 0x00, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+	0x20, 0x00, 0x00, 0x00, 0x61, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00,
+	0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x38, 0x00, 0x37, 0x00,
+	0x31, 0x00, 0x30, 0x00, 0x30, 0x00, 0x32, 0x00, 0x66, 0x00, 0x66, 0x00,
+	0x34, 0x00, 0x34, 0x00, 0x66, 0x00, 0x66, 0x00, 0x31, 0x00, 0x32, 0x00,
+	0x38, 0x00, 0x39, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00,
+	0x30, 0x00, 0x31, 0x00, 0x30, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+static const unsigned char sim_write_record_path_valid_1[] =
+	{0x3F, 0x00, 0x7F, 0xFF};
+
+static const struct req_sim_write_record req_sim_write_record_valid_1 = {
+	.app_type = RIL_APPTYPE_UNKNOWN,
+	.aid_str = "a0000000871002ff44ff128900000100",
+	.fileid = 0x6FCB,
+	.path = sim_write_record_path_valid_1,
+	.path_len = sizeof(sim_write_record_path_valid_1),
+	.mode = GRIL_REC_ACCESS_MODE_ABSOLUTE,
+	.record = 1,
+	.length = 16,
+	.data = (unsigned char[]) {
+		0x01, 0x00, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0xFF,
+		0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }
+};
+
+static const struct request_test_data sim_write_record_valid_test_1 = {
+	.request = &req_sim_write_record_valid_1,
+	.parcel_data = (guchar *) &req_sim_write_record_parcel_valid_1,
+	.parcel_size = sizeof(req_sim_write_record_parcel_valid_1),
+};
+
+/* read_imsi tests */
+
+static const guchar req_read_imsi_parcel_valid_1[] = {
+	0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+
+static const char read_imsi_aid_str_1[] = "";
+
+static const struct request_test_data read_imsi_valid_test_1 = {
+	.request = &read_imsi_aid_str_1,
+	.parcel_data = (guchar *) &req_read_imsi_parcel_valid_1,
+	.parcel_size = sizeof(req_read_imsi_parcel_valid_1),
+};
+
+/* pin_send tests */
+
+struct request_test_pin_send_data {
+	const char *passwd;
+	const gchar *aid_str;
+	guchar *parcel_data;
+	gsize parcel_size;
+};
+
+static const guchar req_pin_send_parcel_valid_1[] = {
+	0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x32, 0x00,
+	0x33, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+};
+
+static const struct request_test_pin_send_data pin_send_record_valid_test_1 = {
+	.passwd = "1234",
+	.aid_str = "",
+	.parcel_data = (guchar *) &req_pin_send_parcel_valid_1,
+	.parcel_size = sizeof(req_pin_send_parcel_valid_1),
+};
+
+/* pin_change_state tests */
+
+static const guchar req_pin_change_state_valid_1[] = {
+	0x05, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, 0x53, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00,
+	0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x32, 0x00, 0x33, 0x00, 0x34, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00,
+	0xFF, 0xFF, 0xFF, 0xFF,
+};
+
+static const struct req_pin_change_state req_pin_change_state_valid1 = {
+	.aid_str = NULL,
+	.passwd_type = OFONO_SIM_PASSWORD_PHSIM_PIN,
+	.enable = 0,
+	.passwd = "1234",
+};
+
+static const struct request_test_data pin_change_state_valid_test_1 = {
+	.request = &req_pin_change_state_valid1,
+	.parcel_data = (guchar *) &req_pin_change_state_valid_1,
+	.parcel_size = sizeof(req_pin_change_state_valid_1),
+};
+
+/* pin_send_puk tests */
+
+struct request_test_pin_send_puk_data {
+	const char *puk;
+	const char *passwd;
+	const gchar *aid_str;
+	const guchar *parcel_data;
+	gsize parcel_size;
+};
+
+static const guchar req_pin_send_puk_parcel_valid_1[] = {
+	0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x31, 0x00, 0x32, 0x00,
+	0x33, 0x00, 0x34, 0x00, 0x35, 0x00, 0x36, 0x00, 0x37, 0x00, 0x38, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x32, 0x00,
+	0x33, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00,
+};
+
+static const struct request_test_pin_send_puk_data pin_send_puk_valid_test_1 = {
+	.puk = "12345678",
+	.passwd = "1234",
+	.aid_str = "",
+	.parcel_data = req_pin_send_puk_parcel_valid_1,
+	.parcel_size = sizeof(req_pin_send_puk_parcel_valid_1),
+};
+
+/* change_passwd tests */
+
+struct request_test_change_passwd_data {
+	const char *old_passwd;
+	const char *new_passwd;
+	const gchar *aid_str;
+	const guchar *parcel_data;
+	gsize parcel_size;
+};
+
+static const guchar req_change_passwd_parcel_valid_1[] = {
+	0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x32, 0x00,
+	0x33, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+	0x35, 0x00, 0x36, 0x00, 0x37, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+
+static const struct request_test_change_passwd_data
+						change_passwd_valid_test_1 = {
+	.old_passwd = "1234",
+	.new_passwd = "5678",
+	.aid_str = "",
+	.parcel_data = req_change_passwd_parcel_valid_1,
+	.parcel_size = sizeof(req_change_passwd_parcel_valid_1),
+};
+
+/* sms_cmgs tests */
+
+static const unsigned char req_sms_cmgs_pdu_valid_1[] = {
+	0x00, 0x11, 0x00, 0x09, 0x81, 0x36, 0x54, 0x39, 0x80, 0xf5, 0x00, 0x00,
+	0xa7, 0x0a, 0xc8, 0x37, 0x3b, 0x0c, 0x6a, 0xd7, 0xdd, 0xe4, 0x37
+};
+
+static const guchar req_sms_cmgs_parcel_valid_1[] = {
+	0x02, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x2c, 0x00, 0x00, 0x00,
+	0x31, 0x00, 0x31, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x39, 0x00,
+	0x38, 0x00, 0x31, 0x00, 0x33, 0x00, 0x36, 0x00, 0x35, 0x00, 0x34, 0x00,
+	0x33, 0x00, 0x39, 0x00, 0x38, 0x00, 0x30, 0x00, 0x46, 0x00, 0x35, 0x00,
+	0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x41, 0x00, 0x37, 0x00,
+	0x30, 0x00, 0x41, 0x00, 0x43, 0x00, 0x38, 0x00, 0x33, 0x00, 0x37, 0x00,
+	0x33, 0x00, 0x42, 0x00, 0x30, 0x00, 0x43, 0x00, 0x36, 0x00, 0x41, 0x00,
+	0x44, 0x00, 0x37, 0x00, 0x44, 0x00, 0x44, 0x00, 0x45, 0x00, 0x34, 0x00,
+	0x33, 0x00, 0x37, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+static const struct req_sms_cmgs req_sms_cmgs_valid1 = {
+	.pdu = req_sms_cmgs_pdu_valid_1,
+	.pdu_len = sizeof(req_sms_cmgs_pdu_valid_1),
+	.tpdu_len = sizeof(req_sms_cmgs_pdu_valid_1) - 1,
+};
+
+static const struct request_test_data sms_cmgs_valid_test_1 = {
+	.request = &req_sms_cmgs_valid1,
+	.parcel_data = (guchar *) &req_sms_cmgs_parcel_valid_1,
+	.parcel_size = sizeof(req_sms_cmgs_parcel_valid_1),
+};
+
+/* sms_acknowledge tests */
+
+static const guchar req_sms_acknowledge_parcel_valid_1[] = {
+	0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+static const struct request_test_data sms_acknowledge_valid_test_1 = {
+	.request = NULL,
+	.parcel_data = (guchar *) &req_sms_acknowledge_parcel_valid_1,
+	.parcel_size = sizeof(req_sms_acknowledge_parcel_valid_1),
+};
+
+/* set_smsc_address tests */
+
+static const guchar req_set_smsc_address_valid_parcel1[] = {
+	0x0e, 0x00, 0x00, 0x00, 0x22, 0x00, 0x2b, 0x00, 0x33, 0x00, 0x34, 0x00,
+	0x36, 0x00, 0x30, 0x00, 0x37, 0x00, 0x30, 0x00, 0x30, 0x00, 0x33, 0x00,
+	0x31, 0x00, 0x31, 0x00, 0x30, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+static const struct ofono_phone_number smsc_address_valid1 = {
+	.type = 145,
+	.number = "34607003110"
+};
+
+static const struct request_test_data smsc_address_valid_test_1 = {
+	.request = &smsc_address_valid1,
+	.parcel_data = (guchar *) &req_set_smsc_address_valid_parcel1,
+	.parcel_size = sizeof(req_set_smsc_address_valid_parcel1),
+};
+
+/* dial tests */
+
+struct request_test_dial_data {
+	const struct ofono_phone_number ph;
+	enum ofono_clir_option clir;
+	const guchar *parcel_data;
+	size_t parcel_size;
+};
+
+static const guchar req_dial_parcel_valid_1[] = {
+	0x09, 0x00, 0x00, 0x00, 0x39, 0x00, 0x31, 0x00, 0x37, 0x00, 0x35, 0x00,
+	0x32, 0x00, 0x35, 0x00, 0x35, 0x00, 0x35, 0x00, 0x35, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+
+static const struct request_test_dial_data dial_valid_test_1 = {
+	.ph = { .number = "917525555", .type = 129 },
+	.clir = OFONO_CLIR_OPTION_DEFAULT,
+	.parcel_data = req_dial_parcel_valid_1,
+	.parcel_size = sizeof(req_dial_parcel_valid_1),
+};
+
+/* hangup tests */
+
+static const guchar req_hangup_parcel_valid_1[] = {
+	0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00
+};
+
+static unsigned hangup_call_id_valid_1 = 1;
+
+static const struct request_test_data set_hangup_valid_test_1 = {
+	.request = &hangup_call_id_valid_1,
+	.parcel_data = req_hangup_parcel_valid_1,
+	.parcel_size = sizeof(req_hangup_parcel_valid_1),
+};
+
+/* dtmf tests */
+
+static const guchar req_dtmf_parcel_valid_1[] = {
+	0x01, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00
+};
+
+static char dtmf_char_valid_1 = '4';
+
+static const struct request_test_data dtmf_valid_test_1 = {
+	.request = &dtmf_char_valid_1,
+	.parcel_data = req_dtmf_parcel_valid_1,
+	.parcel_size = sizeof(req_dtmf_parcel_valid_1),
+};
+
+/* separate_conn tests */
+
+static const guchar req_separate_conn_parcel_valid_1[] = {
+	0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00
+};
+
+static unsigned separate_conn_call_id_valid_1 = 1;
+
+static const struct request_test_data separate_conn_valid_test_1 = {
+	.request = &separate_conn_call_id_valid_1,
+	.parcel_data = req_separate_conn_parcel_valid_1,
+	.parcel_size = sizeof(req_separate_conn_parcel_valid_1),
+};
+
+/* set_supp_svc_notif tests */
+
+static const guchar req_set_supp_svc_notif_parcel_valid_1[] = {
+	0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00
+};
+
+static const struct request_test_data set_supp_svc_notif_valid_test_1 = {
+	.request = NULL,
+	.parcel_data = req_set_supp_svc_notif_parcel_valid_1,
+	.parcel_size = sizeof(req_set_supp_svc_notif_parcel_valid_1),
+};
+
+/* set_mute tests */
+
+static const int mute_off = 0;
+static const int mute_on = 1;
+
+static const guchar req_set_mute_valid_parcel1[] = {
+	0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+static const struct request_test_data set_mute_valid_test_1 = {
+	.request = &mute_off,
+	.parcel_data = (guchar *) &req_set_mute_valid_parcel1,
+	.parcel_size = sizeof(req_set_mute_valid_parcel1),
+};
+
+static const guchar req_set_mute_valid_parcel2[] = {
+	0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00
+};
+
+static const struct request_test_data set_mute_valid_test_2 = {
+	.request = &mute_on,
+	.parcel_data = (guchar *) &req_set_mute_valid_parcel2,
+	.parcel_size = sizeof(req_set_mute_valid_parcel2),
+};
+
+/* send_ussd tests */
+
+static const guchar req_send_ussd_parcel_valid_1[] = {
+	0x05, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x31, 0x00, 0x31, 0x00, 0x38, 0x00,
+	0x23, 0x00, 0x00, 0x00
+};
+
+static const struct request_test_data send_ussd_valid_test_1 = {
+	.request = "*118#",
+	.parcel_data = req_send_ussd_parcel_valid_1,
+	.parcel_size = sizeof(req_send_ussd_parcel_valid_1),
+};
+
+/* set_call_waiting tests */
+
+struct request_test_set_call_waiting {
+	int enabled;
+	int serviceclass;
+	const char *parcel_data;
+	size_t parcel_size;
+};
+
+static const char req_set_call_waiting_parcel_valid_1[] = {
+	0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00
+};
+
+static const struct request_test_set_call_waiting
+		set_call_waiting_valid_test_1 = {
+	.enabled = 0,
+	.serviceclass = 0x01,
+	.parcel_data = req_set_call_waiting_parcel_valid_1,
+	.parcel_size = sizeof(req_set_call_waiting_parcel_valid_1),
+};
+
+/* query_call_waiting tests */
+
+const int query_call_waiting_mode_0 = 0;
+
+static const guchar req_query_call_waiting_parcel_valid_1[] = {
+	0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+static const struct request_test_data query_call_waiting_valid_test_1 = {
+	.request = &query_call_waiting_mode_0,
+	.parcel_data = req_query_call_waiting_parcel_valid_1,
+	.parcel_size = sizeof(req_query_call_waiting_parcel_valid_1),
+};
+
+/* set_clir tests */
+
+const int set_clir_mode_0 = 0;
+
+static const guchar req_set_clir_parcel_valid_1[] = {
+	0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+static const struct request_test_data set_clir_valid_test_1 = {
+	.request = &set_clir_mode_0,
+	.parcel_data = req_set_clir_parcel_valid_1,
+	.parcel_size = sizeof(req_set_clir_parcel_valid_1),
+};
+
+/* screen_state tests */
+
+const int screen_state_0 = 0;
+const int screen_state_1 = 1;
+
+static const guchar req_screen_state_parcel_valid_1[] = {
+	0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+static const struct request_test_data screen_state_valid_test_1 = {
+	.request = &screen_state_0,
+	.parcel_data = req_screen_state_parcel_valid_1,
+	.parcel_size = sizeof(req_screen_state_parcel_valid_1),
+};
+
+static const guchar req_screen_state_parcel_valid_2[] = {
+	0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00
+};
+
+static const struct request_test_data screen_state_valid_test_2 = {
+	.request = &screen_state_1,
+	.parcel_data = req_screen_state_parcel_valid_2,
+	.parcel_size = sizeof(req_screen_state_parcel_valid_2),
+};
+
+/* set_preferred_network_type tests */
+
+const int preferred_network_type_gsm_only = PREF_NET_TYPE_GSM_ONLY;
+
+static const guchar req_set_preferred_network_type_valid_1[] = {
+	0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00
+};
+
+static const struct request_test_data
+		set_preferred_network_type_valid_test_1 = {
+	.request = &preferred_network_type_gsm_only,
+	.parcel_data = req_set_preferred_network_type_valid_1,
+	.parcel_size = sizeof(req_set_preferred_network_type_valid_1),
+};
+
+/* query_facility_lock tests */
+
+struct request_test_query_facility_lock_data {
+	const char *facility;
+	int services;
+	const guchar *parcel_data;
+	gsize parcel_size;
+};
+
+static const guchar req_query_facility_lock_valid_1[] = {
+	0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x41, 0x00, 0x4f, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x01, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
+};
+
+static const struct request_test_query_facility_lock_data
+		query_facility_lock_valid_test_1 = {
+	.facility = "AO",
+	.services = SERVICE_CLASS_NONE,
+	.parcel_data = req_query_facility_lock_valid_1,
+	.parcel_size = sizeof(req_query_facility_lock_valid_1),
+};
+
+/* set_facility_lock tests */
+
+struct request_test_set_facility_lock_data {
+	const char *facility;
+	int enable;
+	const char *passwd;
+	int services;
+	const guchar *parcel_data;
+	gsize parcel_size;
+};
+
+static const guchar req_set_facility_lock_valid_1[] = {
+	0x05, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x49, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00,
+	0x04, 0x00, 0x00, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00,
+	0xff, 0xff, 0xff, 0xff
+};
+
+static const struct request_test_set_facility_lock_data
+		set_facility_lock_valid_test_1 = {
+	.facility = "OI",
+	.enable = 0,
+	.passwd = "0000",
+	.services = SERVICE_CLASS_NONE,
+	.parcel_data = req_set_facility_lock_valid_1,
+	.parcel_size = sizeof(req_set_facility_lock_valid_1),
+};
+
+/* change_barring_password tests */
+
+struct request_test_change_barring_password_data {
+	const char *facility;
+	const char *old_passwd;
+	const char *new_passwd;
+	const guchar *parcel_data;
+	gsize parcel_size;
+};
+
+static const guchar req_change_barring_password_valid_1[] = {
+	0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x41, 0x00, 0x42, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x31, 0x00, 0x31, 0x00,
+	0x31, 0x00, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+	0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+static const struct request_test_change_barring_password_data
+		change_barring_password_valid_test_1 = {
+	.facility = "AB",
+	.old_passwd = "1111",
+	.new_passwd = "0000",
+	.parcel_data = req_change_barring_password_valid_1,
+	.parcel_size = sizeof(req_change_barring_password_valid_1),
+};
+
+/* oem_hook_raw tests */
+
+struct request_test_oem_hook_raw_data {
+	const guchar *data;
+	gsize size;
+	const guchar *parcel_data;
+	gsize parcel_size;
+};
+
+static const guchar req_oem_hook_raw_valid_1[] = {
+	0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+static const struct request_test_oem_hook_raw_data oem_hook_raw_valid_test_1 = {
+	.data = req_oem_hook_raw_valid_1 + sizeof(int32_t),
+	.size = sizeof(req_oem_hook_raw_valid_1) - sizeof(int32_t),
+	.parcel_data = (guchar *) &req_oem_hook_raw_valid_1,
+	.parcel_size = sizeof(req_oem_hook_raw_valid_1),
+};
+
+static const guchar req_oem_hook_raw_valid_2[] = {
+	0xFF, 0xFF, 0xFF, 0xFF
+};
+
+static const struct request_test_oem_hook_raw_data oem_hook_raw_valid_test_2 = {
+	.data = NULL,
+	.size = 0,
+	.parcel_data = (guchar *) &req_oem_hook_raw_valid_2,
+	.parcel_size = sizeof(req_oem_hook_raw_valid_2),
+};
+
+/* set_initial_attach_apn tests */
+
+struct request_test_set_initial_attach_apn {
+	const char *apn;
+	const int proto;
+	const char *user;
+	const char *passwd;
+	const char *mccmnc;
+	const guchar *parcel_data;
+	gsize parcel_size;
+};
+
+static const guchar req_set_initial_attach_apn_valid_1[] = {
+	0x0c, 0x00, 0x00, 0x00, 0x61, 0x00, 0x69, 0x00, 0x72, 0x00, 0x74, 0x00,
+	0x65, 0x00, 0x6c, 0x00, 0x77, 0x00, 0x61, 0x00, 0x70, 0x00, 0x2e, 0x00,
+	0x65, 0x00, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+	0x49, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+	0x07, 0x00, 0x00, 0x00, 0x77, 0x00, 0x61, 0x00, 0x70, 0x00, 0x40, 0x00,
+	0x77, 0x00, 0x61, 0x00, 0x70, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+	0x77, 0x00, 0x61, 0x00, 0x70, 0x00, 0x31, 0x00, 0x32, 0x00, 0x35, 0x00,
+	0x00, 0x00, 0x00, 0x00
+};
+
+static const struct request_test_set_initial_attach_apn
+					set_initial_attach_apn_valid_test_1 = {
+	.apn = "airtelwap.es",
+	.proto = OFONO_GPRS_PROTO_IP,
+	.user = "wap(a)wap",
+	.passwd = "wap125",
+	.mccmnc = "21401",
+	.parcel_data = req_set_initial_attach_apn_valid_1,
+	.parcel_size = sizeof(req_set_initial_attach_apn_valid_1),
+};
+
+/* oem_hook_strings tests */
+
+struct request_test_oem_hook_strings {
+	const int num_str;
+	const char **str;
+	const guchar *parcel_data;
+	gsize parcel_size;
+};
+
+static const guchar req_oem_hook_strings_valid_1[] = {
+	0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x41, 0x00, 0x54, 0x00,
+	0x2b, 0x00, 0x45, 0x00, 0x50, 0x00, 0x49, 0x00, 0x4e, 0x00, 0x43, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x2b, 0x00, 0x45, 0x00,
+	0x50, 0x00, 0x49, 0x00, 0x4e, 0x00, 0x43, 0x00, 0x3a, 0x00, 0x00, 0x00
+};
+
+static const char *oem_hook_strings_valid_1[] = { "AT+EPINC", "+EPINC:" };
+
+static const struct request_test_oem_hook_strings
+					oem_hook_strings_valid_test_1 = {
+	.num_str = G_N_ELEMENTS(oem_hook_strings_valid_1),
+	.str = oem_hook_strings_valid_1,
+	.parcel_data = req_oem_hook_strings_valid_1,
+	.parcel_size = sizeof(req_oem_hook_strings_valid_1),
+};
+
+/*
+ * The following hexadecimal data represents a serialized Binder parcel
+ * instance containing a valid RIL_REQUEST_RADIO_POWER 'OFF' message.
+ */
+static const guchar req_power_off_valid_parcel1[] = {
+	0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+/*
+ * The following hexadecimal data represents a serialized Binder parcel
+ * instance containing a valid RIL_REQUEST_RADIO_POWER 'ON' message.
+ */
+static const guchar req_power_on_valid_parcel2[] = {
+	0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00
+};
+
+static const gboolean power_off = FALSE;
+static const gboolean power_on = TRUE;
+
+static const struct request_test_data power_valid_test_1 = {
+	.request = &power_off,
+	.parcel_data = (guchar *) &req_power_off_valid_parcel1,
+	.parcel_size = sizeof(req_power_off_valid_parcel1),
+};
+
+static const struct request_test_data power_valid_test_2 = {
+	.request = &power_on,
+	.parcel_data = (guchar *) &req_power_on_valid_parcel2,
+	.parcel_size = sizeof(req_power_on_valid_parcel2),
+};
+
+static void test_deactivate_data_call_invalid(gconstpointer data)
+{
+	const struct req_deactivate_data_call *request = data;
+	gboolean result;
+	struct parcel rilp;
+	struct ofono_error error;
+
+	/*
+	 * No parcel_init needed, as these tests all fail during
+	 * param validation
+	 */
+	result = g_ril_request_deactivate_data_call(NULL, request,
+								&rilp, &error);
+	g_assert(result == FALSE);
+	g_assert(error.type == OFONO_ERROR_TYPE_FAILURE &&
+			error.error == -EINVAL);
+}
+
+static void test_deactivate_data_call_valid(gconstpointer data)
+{
+	const struct request_test_data *test_data = data;
+	const struct req_deactivate_data_call *request = test_data->request;
+	gboolean result;
+	struct parcel rilp;
+	struct ofono_error error;
+
+	result = g_ril_request_deactivate_data_call(NULL, request,
+								&rilp, &error);
+	g_assert(result == TRUE);
+	g_assert(error.type == OFONO_ERROR_TYPE_NO_ERROR &&
+			error.error == 0);
+
+	g_assert(!memcmp(rilp.data, test_data->parcel_data,
+						test_data->parcel_size));
+
+	parcel_free(&rilp);
+}
+
+static void test_request_setup_data_call_invalid(gconstpointer data)
+{
+	const struct req_setup_data_call *request = data;
+	gboolean result;
+	struct parcel rilp;
+	struct ofono_error error;
+
+	/*
+	 * No parcel_init needed, as these tests all fail during
+	 * param validation
+	 */
+	result = g_ril_request_setup_data_call(NULL, request, &rilp, &error);
+	g_assert(result == FALSE);
+	g_assert(error.type == OFONO_ERROR_TYPE_FAILURE &&
+			error.error == -EINVAL);
+}
+
+static void test_request_setup_data_call_valid(gconstpointer data)
+{
+	const struct req_setup_data_call *request = data;
+	gboolean result;
+	struct parcel rilp;
+	struct ofono_error error;
+
+	result = g_ril_request_setup_data_call(NULL, request, &rilp, &error);
+	g_assert(result == TRUE);
+	g_assert(error.type == OFONO_ERROR_TYPE_NO_ERROR &&
+			error.error == 0);
+
+	parcel_free(&rilp);
+
+	/* TODO: add unit 3 tests to validate binary parcel result */
+}
+
+static void test_request_power_valid(gconstpointer data)
+{
+	const struct request_test_data *test_data = data;
+	const gboolean *online = test_data->request;
+	struct parcel rilp;
+
+	g_ril_request_power(NULL, *online, &rilp);
+
+	g_assert(!memcmp(rilp.data, test_data->parcel_data,
+						test_data->parcel_size));
+
+	parcel_free(&rilp);
+}
+
+static void test_request_sim_read_info_valid(gconstpointer data)
+{
+	const struct req_sim_read_info *req = data;
+	gboolean result;
+	struct parcel rilp;
+
+	result = g_ril_request_sim_read_info(NULL, req, &rilp);
+	g_assert(result == TRUE);
+
+	parcel_free(&rilp);
+}
+
+static void test_request_sim_read_info_invalid(gconstpointer data)
+{
+	const struct req_sim_read_info *req = data;
+	gboolean result;
+	struct parcel rilp;
+
+	result = g_ril_request_sim_read_info(NULL, req, &rilp);
+	g_assert(result == FALSE);
+
+	parcel_free(&rilp);
+}
+
+static void test_request_sim_read_binary_valid(gconstpointer data)
+{
+	const struct request_test_data *test_data = data;
+	const struct req_sim_read_binary *req = test_data->request;
+	struct parcel rilp;
+	gboolean result;
+
+	result = g_ril_request_sim_read_binary(NULL, req, &rilp);
+
+	g_assert(result == TRUE);
+	g_assert(!memcmp(rilp.data, test_data->parcel_data,
+			test_data->parcel_size));
+
+	parcel_free(&rilp);
+}
+
+static void test_request_sim_read_record_valid(gconstpointer data)
+{
+	const struct request_test_data *test_data = data;
+	const struct req_sim_read_record *req = test_data->request;
+	struct parcel rilp;
+	gboolean result;
+
+	result = g_ril_request_sim_read_record(NULL, req, &rilp);
+
+	g_assert(result == TRUE);
+	g_assert(!memcmp(rilp.data, test_data->parcel_data,
+			test_data->parcel_size));
+
+	parcel_free(&rilp);
+}
+
+static void test_request_sim_write_binary_valid(gconstpointer data)
+{
+	const struct request_test_data *test_data = data;
+	const struct req_sim_write_binary *req = test_data->request;
+	struct parcel rilp;
+	gboolean result;
+
+	result = g_ril_request_sim_write_binary(NULL, req, &rilp);
+
+	g_assert(result == TRUE);
+	g_assert(!memcmp(rilp.data, test_data->parcel_data,
+				test_data->parcel_size));
+
+	parcel_free(&rilp);
+}
+
+static void test_request_sim_write_record_valid(gconstpointer data)
+{
+	const struct request_test_data *test_data = data;
+	const struct req_sim_write_record *req = test_data->request;
+	struct parcel rilp;
+	gboolean result;
+
+	result = g_ril_request_sim_write_record(NULL, req, &rilp);
+
+	g_assert(result == TRUE);
+	g_assert(!memcmp(rilp.data, test_data->parcel_data,
+				test_data->parcel_size));
+
+	parcel_free(&rilp);
+}
+
+static void test_request_read_imsi(gconstpointer data)
+{
+	const struct request_test_data *test_data = data;
+	const char *aid_str = test_data->request;
+	struct parcel rilp;
+
+	g_ril_request_read_imsi(NULL, aid_str, &rilp);
+
+	g_assert(!memcmp(rilp.data, test_data->parcel_data,
+			test_data->parcel_size));
+
+	parcel_free(&rilp);
+}
+
+static void test_request_pin_send(gconstpointer data)
+{
+	const struct request_test_pin_send_data *test_data = data;
+	const char *passwd = test_data->passwd;
+	const char *aid_str = test_data->aid_str;
+	struct parcel rilp;
+
+	g_ril_request_pin_send(NULL, passwd, aid_str, &rilp);
+
+	g_assert(!memcmp(rilp.data, test_data->parcel_data,
+			test_data->parcel_size));
+
+	parcel_free(&rilp);
+}
+
+static void test_request_pin_change_state(gconstpointer data)
+{
+	const struct request_test_data *test_data = data;
+	const struct req_pin_change_state *req = test_data->request;
+	struct parcel rilp;
+	gboolean result;
+
+	result = g_ril_request_pin_change_state(NULL, req, &rilp);
+
+	g_assert(result == TRUE);
+	g_assert(!memcmp(rilp.data, test_data->parcel_data,
+			test_data->parcel_size));
+
+	parcel_free(&rilp);
+}
+
+static void test_request_pin_send_puk(gconstpointer data)
+{
+	const struct request_test_pin_send_puk_data *test_data = data;
+	const char *puk = test_data->puk;
+	const char *passwd = test_data->passwd;
+	const char *aid_str = test_data->aid_str;
+	struct parcel rilp;
+
+	g_ril_request_pin_send_puk(NULL, puk, passwd, aid_str, &rilp);
+
+	g_assert(!memcmp(rilp.data, test_data->parcel_data,
+			test_data->parcel_size));
+
+	parcel_free(&rilp);
+}
+
+static void test_request_change_passwd(gconstpointer data)
+{
+	const struct request_test_change_passwd_data *test_data = data;
+	const char *old_passwd = test_data->old_passwd;
+	const char *new_passwd = test_data->new_passwd;
+	const char *aid_str = test_data->aid_str;
+	struct parcel rilp;
+
+	g_ril_request_change_passwd(NULL, old_passwd, new_passwd,
+					aid_str, &rilp);
+
+	g_assert(!memcmp(rilp.data, test_data->parcel_data,
+			test_data->parcel_size));
+
+	parcel_free(&rilp);
+}
+
+static void test_request_sms_cmgs(gconstpointer data)
+{
+	const struct request_test_data *test_data = data;
+	const struct req_sms_cmgs *req = test_data->request;
+	struct parcel rilp;
+
+	g_ril_request_sms_cmgs(NULL, req, &rilp);
+
+	g_assert(!memcmp(rilp.data, test_data->parcel_data,
+			test_data->parcel_size));
+
+	parcel_free(&rilp);
+}
+
+static void test_request_sms_acknowledge(gconstpointer data)
+{
+	const struct request_test_data *test_data = data;
+	struct parcel rilp;
+
+	g_ril_request_sms_acknowledge(NULL, &rilp);
+
+	g_assert(!memcmp(rilp.data, test_data->parcel_data,
+			test_data->parcel_size));
+
+	parcel_free(&rilp);
+}
+
+static void test_request_set_smsc_address(gconstpointer data)
+{
+	const struct request_test_data *test_data = data;
+	const struct ofono_phone_number *number = test_data->request;
+	struct parcel rilp;
+
+	g_ril_request_set_smsc_address(NULL, number, &rilp);
+
+	g_assert(!memcmp(rilp.data, test_data->parcel_data,
+			test_data->parcel_size));
+
+	parcel_free(&rilp);
+}
+
+static void test_request_dial(gconstpointer data)
+{
+	const struct request_test_dial_data *test_data = data;
+	const struct ofono_phone_number *ph = &test_data->ph;
+	enum ofono_clir_option clir = test_data->clir;
+	struct parcel rilp;
+
+	g_ril_request_dial(NULL, ph, clir, &rilp);
+
+	g_assert(!memcmp(rilp.data, test_data->parcel_data,
+			test_data->parcel_size));
+
+	parcel_free(&rilp);
+}
+
+static void test_request_hangup(gconstpointer data)
+{
+	const struct request_test_data *test_data = data;
+	const unsigned *call_id = test_data->request;
+	struct parcel rilp;
+
+	g_ril_request_hangup(NULL, *call_id, &rilp);
+
+	g_assert(!memcmp(rilp.data, test_data->parcel_data,
+			test_data->parcel_size));
+
+	parcel_free(&rilp);
+}
+
+static void test_request_dtmf(gconstpointer data)
+{
+	const struct request_test_data *test_data = data;
+	const char *dtmf_char = test_data->request;
+	struct parcel rilp;
+
+	g_ril_request_dtmf(NULL, *dtmf_char, &rilp);
+
+	g_assert(!memcmp(rilp.data, test_data->parcel_data,
+			test_data->parcel_size));
+
+	parcel_free(&rilp);
+}
+
+static void test_request_separate_conn(gconstpointer data)
+{
+	const struct request_test_data *test_data = data;
+	const unsigned *call_id = test_data->request;
+	struct parcel rilp;
+
+	g_ril_request_separate_conn(NULL, *call_id, &rilp);
+
+	g_assert(!memcmp(rilp.data, test_data->parcel_data,
+			test_data->parcel_size));
+
+	parcel_free(&rilp);
+}
+
+static void test_request_set_supp_svc_notif(gconstpointer data)
+{
+	const struct request_test_data *test_data = data;
+	struct parcel rilp;
+
+	g_ril_request_set_supp_svc_notif(NULL, &rilp);
+
+	g_assert(!memcmp(rilp.data, test_data->parcel_data,
+			test_data->parcel_size));
+
+	parcel_free(&rilp);
+}
+
+static void test_request_set_mute_valid(gconstpointer data)
+{
+	const struct request_test_data *test_data = data;
+	const int *muted = test_data->request;
+	struct parcel rilp;
+
+	g_ril_request_set_mute(NULL, *muted, &rilp);
+
+	g_assert(!memcmp(rilp.data, test_data->parcel_data,
+				test_data->parcel_size));
+
+	parcel_free(&rilp);
+}
+
+static void test_request_send_ussd(gconstpointer data)
+{
+	const struct request_test_data *test_data = data;
+	struct parcel rilp;
+
+	g_ril_request_send_ussd(NULL, test_data->request, &rilp);
+
+	g_assert(!memcmp(rilp.data, test_data->parcel_data,
+				test_data->parcel_size));
+
+	parcel_free(&rilp);
+}
+
+static void test_request_set_call_waiting(gconstpointer data)
+{
+	const struct request_test_set_call_waiting *test_data = data;
+	struct parcel rilp;
+
+	g_ril_request_set_call_waiting(NULL, test_data->enabled,
+					test_data->serviceclass, &rilp);
+
+	g_assert(!memcmp(rilp.data, test_data->parcel_data,
+				test_data->parcel_size));
+
+	parcel_free(&rilp);
+}
+
+static void test_request_query_call_waiting(gconstpointer data)
+{
+	const struct request_test_data *test_data = data;
+	int mode = *(int *) test_data->request;
+	struct parcel rilp;
+
+	g_ril_request_query_call_waiting(NULL, mode, &rilp);
+
+	g_assert(!memcmp(rilp.data, test_data->parcel_data,
+				test_data->parcel_size));
+
+	parcel_free(&rilp);
+}
+
+static void test_request_set_clir(gconstpointer data)
+{
+	const struct request_test_data *test_data = data;
+	int mode = *(int *) test_data->request;
+	struct parcel rilp;
+
+	g_ril_request_set_clir(NULL, mode, &rilp);
+
+	g_assert(!memcmp(rilp.data, test_data->parcel_data,
+				test_data->parcel_size));
+
+	parcel_free(&rilp);
+}
+
+static void test_request_screen_state(gconstpointer data)
+{
+	const struct request_test_data *test_data = data;
+	int state = *(int *) test_data->request;
+	struct parcel rilp;
+
+	g_ril_request_screen_state(NULL, state, &rilp);
+
+	g_assert(!memcmp(rilp.data, test_data->parcel_data,
+				test_data->parcel_size));
+
+	parcel_free(&rilp);
+}
+
+static void test_request_set_preferred_network_type(gconstpointer data)
+{
+	const struct request_test_data *test_data = data;
+	int preferred_network_type = *(int *) test_data->request;
+	struct parcel rilp;
+
+	g_ril_request_set_preferred_network_type(NULL, preferred_network_type,
+							&rilp);
+
+	g_assert(!memcmp(rilp.data, test_data->parcel_data,
+				test_data->parcel_size));
+
+	parcel_free(&rilp);
+}
+
+static void test_request_query_facility_lock(gconstpointer data)
+{
+	const struct request_test_query_facility_lock_data *test_data = data;
+	struct parcel rilp;
+
+	g_ril_request_query_facility_lock(NULL, test_data->facility, "",
+						test_data->services, &rilp);
+
+	g_assert(!memcmp(rilp.data, test_data->parcel_data,
+				test_data->parcel_size));
+
+	parcel_free(&rilp);
+}
+
+static void test_request_set_facility_lock(gconstpointer data)
+{
+	const struct request_test_set_facility_lock_data *test_data = data;
+	struct parcel rilp;
+
+	g_ril_request_set_facility_lock(NULL, test_data->facility,
+					test_data->enable, test_data->passwd,
+					test_data->services, &rilp);
+
+	g_assert(!memcmp(rilp.data, test_data->parcel_data,
+				test_data->parcel_size));
+
+	parcel_free(&rilp);
+}
+
+static void test_request_set_initial_attach_apn(gconstpointer data)
+{
+	const struct request_test_set_initial_attach_apn *test_data = data;
+	struct parcel rilp;
+
+	g_ril_request_set_initial_attach_apn(NULL, test_data->apn,
+					test_data->proto, test_data->user,
+					test_data->passwd, test_data->mccmnc,
+					&rilp);
+
+	g_assert(!memcmp(rilp.data, test_data->parcel_data,
+				test_data->parcel_size));
+
+	parcel_free(&rilp);
+}
+
+static void test_request_change_barring_password(gconstpointer data)
+{
+	const struct request_test_change_barring_password_data *test_data =
+									data;
+	struct parcel rilp;
+
+	g_ril_request_change_barring_password(NULL, test_data->facility,
+						test_data->old_passwd,
+						test_data->new_passwd, &rilp);
+
+	g_assert(!memcmp(rilp.data, test_data->parcel_data,
+				test_data->parcel_size));
+
+	parcel_free(&rilp);
+}
+
+static void test_request_oem_hook_raw(gconstpointer data)
+{
+	const struct request_test_oem_hook_raw_data *test_data = data;
+	struct parcel rilp;
+
+	g_ril_request_oem_hook_raw(NULL, test_data->data,
+					test_data->size, &rilp);
+
+	g_assert(!memcmp(rilp.data, test_data->parcel_data,
+				test_data->parcel_size));
+
+	parcel_free(&rilp);
+}
+
+static void test_request_oem_hook_strings(gconstpointer data)
+{
+	const struct request_test_oem_hook_strings *test_data = data;
+	struct parcel rilp;
+
+	g_ril_request_oem_hook_strings(NULL, test_data->str,
+					test_data->num_str, &rilp);
+
+	g_assert(!memcmp(rilp.data, test_data->parcel_data,
+				test_data->parcel_size));
+
+	parcel_free(&rilp);
+}
+
+#endif
+
+int main(int argc, char **argv)
+{
+	g_test_init(&argc, &argv, NULL);
+
+/*
+ * As all our architectures are little-endian except for
+ * PowerPC, and the Binder wire-format differs slightly
+ * depending on endian-ness, the following guards against test
+ * failures when run on PowerPC.
+ */
+#if BYTE_ORDER == LITTLE_ENDIAN
+
+	g_test_add_data_func("/testgrilrequest/gprs-context: "
+				"invalid DEACTIVATE_DATA_CALL Test 1",
+				&req_deact_data_call_invalid_1,
+				test_deactivate_data_call_invalid);
+
+	g_test_add_data_func("/testgrilrequest/gprs-context: "
+				"valid DEACTIVATE_DATA_CALL Test 1",
+				&deact_data_call_valid_test_1,
+				test_deactivate_data_call_valid);
+
+	g_test_add_data_func("/testgrilrequest/gprs-context: "
+				"invalid SETUP_DATA_CALL Test 1",
+				&req_setup_data_call_invalid_1,
+				test_request_setup_data_call_invalid);
+
+	g_test_add_data_func("/testgrilrequest/gprs-context: "
+				"invalid SETUP_DATA_CALL Test 2",
+				&req_setup_data_call_invalid_2,
+				test_request_setup_data_call_invalid);
+
+	g_test_add_data_func("/testgrilrequest/gprs-context: "
+				"invalid SETUP_DATA_CALL Test 3",
+				&req_setup_data_call_invalid_3,
+				test_request_setup_data_call_invalid);
+
+	g_test_add_data_func("/testgrilrequest/gprs-context: "
+				"invalid SETUP_DATA_CALL Test 4",
+				&req_setup_data_call_invalid_4,
+				test_request_setup_data_call_invalid);
+
+	g_test_add_data_func("/testgrilrequest/gprs-context: "
+				"invalid SETUP_DATA_CALL Test 5",
+				&req_setup_data_call_invalid_5,
+				test_request_setup_data_call_invalid);
+
+	g_test_add_data_func("/testgrilrequest/gprs-context: "
+				"invalid SETUP_DATA_CALL Test 6",
+				&req_setup_data_call_invalid_6,
+				test_request_setup_data_call_invalid);
+
+	g_test_add_data_func("/testgrilrequest/gprs-context: "
+				"valid SETUP_DATA_CALL Test 1",
+				&req_setup_data_call_valid_1,
+				test_request_setup_data_call_valid);
+
+	g_test_add_data_func("/testgrilrequest/gprs-context: "
+				"valid SETUP_DATA_CALL Test 2",
+				&req_setup_data_call_valid_2,
+				test_request_setup_data_call_valid);
+
+	g_test_add_data_func("/testgrilrequest/gprs-context: "
+				"valid SETUP_DATA_CALL Test 3",
+				&req_setup_data_call_valid_3,
+				test_request_setup_data_call_valid);
+
+	g_test_add_data_func("/testgrilrequest/gprs-context: "
+				"valid SETUP_DATA_CALL Test 4",
+				&req_setup_data_call_valid_4,
+				test_request_setup_data_call_valid);
+
+	g_test_add_data_func("/testgrilrequest/gprs-context: "
+				"valid SETUP_DATA_CALL Test 5",
+				&req_setup_data_call_valid_5,
+				test_request_setup_data_call_valid);
+
+	g_test_add_data_func("/testgrilrequest/gprs-context: "
+				"valid SETUP_DATA_CALL Test 6",
+				&req_setup_data_call_valid_6,
+				test_request_setup_data_call_valid);
+
+	g_test_add_data_func("/testgrilrequest/power: "
+				"valid POWER Test 1",
+				&power_valid_test_1,
+				test_request_power_valid);
+
+	g_test_add_data_func("/testgrilrequest/power: "
+				"valid POWER Test 2",
+				&power_valid_test_2,
+				test_request_power_valid);
+
+	g_test_add_data_func("/testgrilrequest/sim: "
+				"valid SIM_READ_INFO Test 1",
+				&req_sim_read_info_valid_1,
+				test_request_sim_read_info_valid);
+
+	g_test_add_data_func("/testgrilrequest/sim: "
+				"invalid SIM_READ_INFO Test 1",
+				&req_sim_read_info_invalid_1,
+				test_request_sim_read_info_invalid);
+
+	g_test_add_data_func("/testgrilrequest/sim: "
+				"valid SIM_READ_BINARY Test 1",
+				&sim_read_binary_valid_test_1,
+				test_request_sim_read_binary_valid);
+
+	g_test_add_data_func("/testgrilrequest/sim: "
+				"valid SIM_READ_RECORD Test 1",
+				&sim_read_record_valid_test_1,
+				test_request_sim_read_record_valid);
+
+	g_test_add_data_func("/testgrilrequest/sim: "
+				"valid SIM_WRITE_BINARY Test 1",
+				&sim_write_binary_valid_test_1,
+				test_request_sim_write_binary_valid);
+
+	g_test_add_data_func("/testgrilrequest/sim: "
+				"valid SIM_WRITE_RECORD Test 1",
+				&sim_write_record_valid_test_1,
+				test_request_sim_write_record_valid);
+
+	g_test_add_data_func("/testgrilrequest/sim: "
+				"valid READ_IMSI Test 1",
+				&read_imsi_valid_test_1,
+				test_request_read_imsi);
+
+	g_test_add_data_func("/testgrilrequest/sim: "
+				"valid PIN_SEND Test 1",
+				&pin_send_record_valid_test_1,
+				test_request_pin_send);
+
+	g_test_add_data_func("/testgrilrequest/sim: "
+				"valid PIN_CHANGE_STATE Test 1",
+				&pin_change_state_valid_test_1,
+				test_request_pin_change_state);
+
+	g_test_add_data_func("/testgrilrequest/sim: "
+				"valid PIN_SEND_PUK Test 1",
+				&pin_send_puk_valid_test_1,
+				test_request_pin_send_puk);
+
+	g_test_add_data_func("/testgrilrequest/sim: "
+				"valid CHANGE_PASSWD Test 1",
+				&change_passwd_valid_test_1,
+				test_request_change_passwd);
+
+	g_test_add_data_func("/testgrilrequest/sms: "
+				"valid SMS_CMGS Test 1",
+				&sms_cmgs_valid_test_1,
+				test_request_sms_cmgs);
+
+	g_test_add_data_func("/testgrilrequest/sms: "
+				"valid SMS_ACKNOWLEDGE Test 1",
+				&sms_acknowledge_valid_test_1,
+				test_request_sms_acknowledge);
+
+	g_test_add_data_func("/testgrilrequest/sms: "
+				"valid SET_SMSC_ADDRESS Test 1",
+				&smsc_address_valid_test_1,
+				test_request_set_smsc_address);
+
+	g_test_add_data_func("/testgrilrequest/voicecall: "
+				"valid DIAL Test 1",
+				&dial_valid_test_1,
+				test_request_dial);
+
+	g_test_add_data_func("/testgrilrequest/voicecall: "
+				"valid HANGUP Test 1",
+				&set_hangup_valid_test_1,
+				test_request_hangup);
+
+	g_test_add_data_func("/testgrilrequest/voicecall: "
+				"valid DTMF Test 1",
+				&dtmf_valid_test_1,
+				test_request_dtmf);
+
+	g_test_add_data_func("/testgrilrequest/voicecall: "
+				"valid SEPARATE_CONN Test 1",
+				&separate_conn_valid_test_1,
+				test_request_separate_conn);
+
+	g_test_add_data_func("/testgrilrequest/voicecall: "
+				"valid SET_SUPP_SVC_NOTIF Test 1",
+				&set_supp_svc_notif_valid_test_1,
+				test_request_set_supp_svc_notif);
+
+	g_test_add_data_func("/testgrilrequest/call-volume: "
+				"valid SET_MUTE Test 1",
+				&set_mute_valid_test_1,
+				test_request_set_mute_valid);
+
+	g_test_add_data_func("/testgrilrequest/call-volume: "
+				"valid SET_MUTE Test 2",
+				&set_mute_valid_test_2,
+				test_request_set_mute_valid);
+
+	g_test_add_data_func("/testgrilrequest/ussd: "
+				"valid SEND_USSD Test 1",
+				&send_ussd_valid_test_1,
+				test_request_send_ussd);
+
+	g_test_add_data_func("/testgrilrequest/call-settings: "
+				"valid SET_CALL_WAITING Test 1",
+				&set_call_waiting_valid_test_1,
+				test_request_set_call_waiting);
+
+	g_test_add_data_func("/testgrilrequest/call-settings: "
+				"valid QUERY_CALL_WAITING Test 1",
+				&query_call_waiting_valid_test_1,
+				test_request_query_call_waiting);
+
+	g_test_add_data_func("/testgrilrequest/call-settings: "
+				"valid SET_CLIR Test 1",
+				&set_clir_valid_test_1,
+				test_request_set_clir);
+
+	g_test_add_data_func("/testgrilrequest/radio-settings: "
+				"valid SCREEN_STATE Test 1",
+				&screen_state_valid_test_1,
+				test_request_screen_state);
+
+	g_test_add_data_func("/testgrilrequest/radio-settings: "
+				"valid SCREEN_STATE Test 2",
+				&screen_state_valid_test_2,
+				test_request_screen_state);
+
+	g_test_add_data_func("/testgrilrequest/radio-settings: "
+				"valid SET_PREFERRED_NETWORK_TYPE Test 1",
+				&set_preferred_network_type_valid_test_1,
+				test_request_set_preferred_network_type);
+
+	g_test_add_data_func("/testgrilrequest/call-barring: "
+				"valid QUERY_FACILITY_LOCK Test 1",
+				&query_facility_lock_valid_test_1,
+				test_request_query_facility_lock);
+
+	g_test_add_data_func("/testgrilrequest/call-barring: "
+				"valid SET_FACILITY_LOCK Test 1",
+				&set_facility_lock_valid_test_1,
+				test_request_set_facility_lock);
+
+	g_test_add_data_func("/testgrilrequest/call-barring: "
+				"valid CHANGE_BARRING_PASSWORD Test 1",
+				&change_barring_password_valid_test_1,
+				test_request_change_barring_password);
+
+	g_test_add_data_func("/testgrilrequest/oem-hook-raw: "
+				"valid OEM_HOOK_RAW Test 1",
+				&oem_hook_raw_valid_test_1,
+				test_request_oem_hook_raw);
+
+	g_test_add_data_func("/testgrilrequest/oem-hook-raw: "
+				"valid OEM_HOOK_RAW Test 2",
+				&oem_hook_raw_valid_test_2,
+				test_request_oem_hook_raw);
+
+	g_test_add_data_func("/testgrilrequest/set-ia-apn: "
+				"valid SET_INITIAL_ATTACH_APN Test 1",
+				&set_initial_attach_apn_valid_test_1,
+				test_request_set_initial_attach_apn);
+
+	g_test_add_data_func("/testgrilrequest/oem-hook-strings: "
+				"valid OEM_HOOK_STRINGS Test 1",
+				&oem_hook_strings_valid_test_1,
+				test_request_oem_hook_strings);
+
+#endif
+	return g_test_run();
+}
diff --git a/unit/test-rilunsol.c b/unit/test-rilunsol.c
new file mode 100644
index 0000000..415fb63
--- /dev/null
+++ b/unit/test-rilunsol.c
@@ -0,0 +1,698 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2013 Canonical Ltd.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string.h>
+#include <stdio.h>
+#include <assert.h>
+#include <glib.h>
+#include <errno.h>
+
+#include <ofono/modem.h>
+#include <ofono/gprs-context.h>
+#include <ofono/types.h>
+
+#include "gril.h"
+#include "drivers/rilmodem/rilunsol.h"
+
+/*
+ * TODO: It may make sense to split this file into
+ * domain-specific files ( eg. test-grilrequest-gprs-context.c )
+ * once more tests are added.
+ */
+
+/*
+ * As all our architectures are little-endian except for
+ * PowerPC, and the Binder wire-format differs slightly
+ * depending on endian-ness, the following guards against test
+ * failures when run on PowerPC.
+ */
+#if BYTE_ORDER == LITTLE_ENDIAN
+
+typedef struct signal_strength_test signal_strength_test;
+struct signal_strength_test {
+	int strength;
+	int ril_tech;
+	const struct ril_msg msg;
+};
+
+static const struct ril_msg reply_data_call_invalid_1 = {
+	.buf = "",
+	.buf_len = 0,
+	.unsolicited = FALSE,
+	.req = RIL_REQUEST_SETUP_DATA_CALL,
+	.serial_no = 0,
+	.error = 0,
+};
+
+/*
+ * The following hexadecimal data equates te the following
+ * RIL_REQUEST_SETUP_DATA_CALL reply parameters:
+ *
+ * {version=2,num=2 [status=0,retry=-1,cid=0,active=2,type=IP}
+ * Parcel is truncated, as num=2 should trigger a failure.
+ */
+static const guchar reply_data_call_invalid_parcel2[] = {
+	0x07, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+	0x02, 0x00, 0x00, 0x00, 0x49, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+static const struct ril_msg reply_data_call_invalid_2 = {
+	.buf = (gchar *) &reply_data_call_invalid_parcel2,
+	.buf_len = sizeof(reply_data_call_invalid_parcel2),
+	.unsolicited = FALSE,
+	.req = RIL_REQUEST_SETUP_DATA_CALL,
+	.serial_no = 0,
+	.error = 0,
+};
+
+/*
+ * The following hexadecimal data is a binary representation of
+ * a parcel containing an invalid RIL_REQUEST_SETUP_DATA_CALL reply
+ * with a NULL string specified for 'type':
+ *
+ * {version=7,num=1 [status=0,retry=-1,cid=0,active=2,type=NULL
+ * ifname=rmnet_usb0,address=10.181.235.154/30,
+ * dns=172.16.145.103 172.16.145.103,gateways=10.181.235.153]}
+ */
+static const guchar reply_data_call_invalid_parcel3[] = {
+	0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+	0xff, 0xff, 0xff, 0xff,
+	0x0a, 0x00, 0x00, 0x00, 0x72, 0x00, 0x6d, 0x00, 0x6e, 0x00, 0x65, 0x00,
+	0x74, 0x00, 0x5f, 0x00, 0x75, 0x00, 0x73, 0x00, 0x62, 0x00, 0x30, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x31, 0x00, 0x30, 0x00,
+	0x2e, 0x00, 0x31, 0x00, 0x38, 0x00, 0x31, 0x00, 0x2e, 0x00, 0x32, 0x00,
+	0x33, 0x00, 0x35, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x35, 0x00, 0x34, 0x00,
+	0x2f, 0x00, 0x33, 0x00, 0x30, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00,
+	0x31, 0x00, 0x37, 0x00, 0x32, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x36, 0x00,
+	0x2e, 0x00, 0x31, 0x00, 0x34, 0x00, 0x35, 0x00, 0x2e, 0x00, 0x31, 0x00,
+	0x30, 0x00, 0x33, 0x00, 0x20, 0x00, 0x31, 0x00, 0x37, 0x00, 0x32, 0x00,
+	0x2e, 0x00, 0x31, 0x00, 0x36, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x34, 0x00,
+	0x35, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x30, 0x00, 0x33, 0x00, 0x00, 0x00,
+	0x0e, 0x00, 0x00, 0x00, 0x31, 0x00, 0x30, 0x00, 0x2e, 0x00, 0x31, 0x00,
+	0x38, 0x00, 0x31, 0x00, 0x2e, 0x00, 0x32, 0x00, 0x33, 0x00, 0x35, 0x00,
+	0x2e, 0x00, 0x31, 0x00, 0x35, 0x00, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+static const struct ril_msg reply_data_call_invalid_3 = {
+	.buf = (gchar *) &reply_data_call_invalid_parcel3,
+	.buf_len = sizeof(reply_data_call_invalid_parcel3),
+	.unsolicited = FALSE,
+	.req = RIL_REQUEST_SETUP_DATA_CALL,
+	.serial_no = 0,
+	.error = 0,
+};
+
+/*
+ * The following hexadecimal data is a binary representation of
+ * a parcel containing an invalid RIL_REQUEST_SETUP_DATA_CALL reply
+ * with a NULL string specified for 'ifname':
+ *
+ * {version=7,num=1 [status=0,retry=-1,cid=0,active=2,type=IP
+ * ifname=NULL,address=10.181.235.154/30,
+ * dns=172.16.145.103 172.16.145.103,gateways=10.181.235.153]}
+ */
+static const guchar reply_data_call_invalid_parcel4[] = {
+	0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+	0x02, 0x00, 0x00, 0x00, 0x49, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0xff, 0xff, 0xff, 0xff, 0x11, 0x00, 0x00, 0x00, 0x31, 0x00, 0x30, 0x00,
+	0x2e, 0x00, 0x31, 0x00, 0x38, 0x00, 0x31, 0x00, 0x2e, 0x00, 0x32, 0x00,
+	0x33, 0x00, 0x35, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x35, 0x00, 0x34, 0x00,
+	0x2f, 0x00, 0x33, 0x00, 0x30, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00,
+	0x31, 0x00, 0x37, 0x00, 0x32, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x36, 0x00,
+	0x2e, 0x00, 0x31, 0x00, 0x34, 0x00, 0x35, 0x00, 0x2e, 0x00, 0x31, 0x00,
+	0x30, 0x00, 0x33, 0x00, 0x20, 0x00, 0x31, 0x00, 0x37, 0x00, 0x32, 0x00,
+	0x2e, 0x00, 0x31, 0x00, 0x36, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x34, 0x00,
+	0x35, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x30, 0x00, 0x33, 0x00, 0x00, 0x00,
+	0x0e, 0x00, 0x00, 0x00, 0x31, 0x00, 0x30, 0x00, 0x2e, 0x00, 0x31, 0x00,
+	0x38, 0x00, 0x31, 0x00, 0x2e, 0x00, 0x32, 0x00, 0x33, 0x00, 0x35, 0x00,
+	0x2e, 0x00, 0x31, 0x00, 0x35, 0x00, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+static const struct ril_msg reply_data_call_invalid_4 = {
+	.buf = (gchar *) &reply_data_call_invalid_parcel4,
+	.buf_len = sizeof(reply_data_call_invalid_parcel4),
+	.unsolicited = FALSE,
+	.req = RIL_REQUEST_SETUP_DATA_CALL,
+	.serial_no = 0,
+	.error = 0,
+};
+
+/*
+ * The following hexadecimal data is a binary representation of
+ * a parcel containing an invalid RIL_REQUEST_SETUP_DATA_CALL reply
+ * with a NULL string specified for 'address':
+ *
+ * {version=7,num=1 [status=0,retry=-1,cid=0,active=2,type=IP
+ * ifname=rmnet_usb0,address=NULL,
+ * dns=172.16.145.103 172.16.145.103,gateways=10.181.235.153]}
+ */
+static const guchar reply_data_call_invalid_parcel5[] = {
+	0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+	0x02, 0x00, 0x00, 0x00, 0x49, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x0a, 0x00, 0x00, 0x00, 0x72, 0x00, 0x6d, 0x00, 0x6e, 0x00, 0x65, 0x00,
+	0x74, 0x00, 0x5f, 0x00, 0x75, 0x00, 0x73, 0x00, 0x62, 0x00, 0x30, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x1d, 0x00, 0x00, 0x00,
+	0x31, 0x00, 0x37, 0x00, 0x32, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x36, 0x00,
+	0x2e, 0x00, 0x31, 0x00, 0x34, 0x00, 0x35, 0x00, 0x2e, 0x00, 0x31, 0x00,
+	0x30, 0x00, 0x33, 0x00, 0x20, 0x00, 0x31, 0x00, 0x37, 0x00, 0x32, 0x00,
+	0x2e, 0x00, 0x31, 0x00, 0x36, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x34, 0x00,
+	0x35, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x30, 0x00, 0x33, 0x00, 0x00, 0x00,
+	0x0e, 0x00, 0x00, 0x00, 0x31, 0x00, 0x30, 0x00, 0x2e, 0x00, 0x31, 0x00,
+	0x38, 0x00, 0x31, 0x00, 0x2e, 0x00, 0x32, 0x00, 0x33, 0x00, 0x35, 0x00,
+	0x2e, 0x00, 0x31, 0x00, 0x35, 0x00, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+static const struct ril_msg reply_data_call_invalid_5 = {
+	.buf = (gchar *) &reply_data_call_invalid_parcel5,
+	.buf_len = sizeof(reply_data_call_invalid_parcel5),
+	.unsolicited = FALSE,
+	.req = RIL_REQUEST_SETUP_DATA_CALL,
+	.serial_no = 0,
+	.error = 0,
+};
+
+/*
+ * The following hexadecimal data represents a serialized Binder parcel
+ * instance containing an invalid RIL_REQUEST_SETUP_DATA_CALL reply
+ * with a NULL string specified for 'gateways':
+ *
+ * {version=7,num=1 [status=0,retry=-1,cid=0,active=2,type=IP
+ * ifname=rmnet_usb0,address=10.181.235.154/30,
+ * dns=172.16.145.103 172.16.145.103,gateways=NULL]}
+ */
+static const guchar reply_data_call_invalid_parcel6[] = {
+	0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+	0x02, 0x00, 0x00, 0x00, 0x49, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x0a, 0x00, 0x00, 0x00, 0x72, 0x00, 0x6d, 0x00, 0x6e, 0x00, 0x65, 0x00,
+	0x74, 0x00, 0x5f, 0x00, 0x75, 0x00, 0x73, 0x00, 0x62, 0x00, 0x30, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x31, 0x00, 0x30, 0x00,
+	0x2e, 0x00, 0x31, 0x00, 0x38, 0x00, 0x31, 0x00, 0x2e, 0x00, 0x32, 0x00,
+	0x33, 0x00, 0x35, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x35, 0x00, 0x34, 0x00,
+	0x2f, 0x00, 0x33, 0x00, 0x30, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00,
+	0x31, 0x00, 0x37, 0x00, 0x32, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x36, 0x00,
+	0x2e, 0x00, 0x31, 0x00, 0x34, 0x00, 0x35, 0x00, 0x2e, 0x00, 0x31, 0x00,
+	0x30, 0x00, 0x33, 0x00, 0x20, 0x00, 0x31, 0x00, 0x37, 0x00, 0x32, 0x00,
+	0x2e, 0x00, 0x31, 0x00, 0x36, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x34, 0x00,
+	0x35, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x30, 0x00, 0x33, 0x00, 0x00, 0x00,
+	0xff, 0xff, 0xff, 0xff
+};
+
+static const struct ril_msg reply_data_call_invalid_6 = {
+	.buf = (gchar *) &reply_data_call_invalid_parcel6,
+	.buf_len = sizeof(reply_data_call_invalid_parcel6),
+	.unsolicited = FALSE,
+	.req = RIL_REQUEST_SETUP_DATA_CALL,
+	.serial_no = 0,
+	.error = 0,
+};
+
+/*
+ * The following hexadecimal data represents a serialized Binder parcel
+ * instance containing a valid RIL_REQUEST_SETUP_DATA_CALL reply with the
+ * following parameters:
+ *
+ * {version=7,num=1 [status=0,retry=-1,cid=0,active=2,type=IP,
+ * ifname=rmnet_usb0,address=10.181.235.154/30,
+ * dns=172.16.145.103 172.16.145.103,gateways=10.181.235.153]}
+ */
+static const guchar reply_data_call_valid_parcel1[] = {
+	0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+	0x02, 0x00, 0x00, 0x00, 0x49, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x0a, 0x00, 0x00, 0x00, 0x72, 0x00, 0x6d, 0x00, 0x6e, 0x00, 0x65, 0x00,
+	0x74, 0x00, 0x5f, 0x00, 0x75, 0x00, 0x73, 0x00, 0x62, 0x00, 0x30, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x31, 0x00, 0x30, 0x00,
+	0x2e, 0x00, 0x31, 0x00, 0x38, 0x00, 0x31, 0x00, 0x2e, 0x00, 0x32, 0x00,
+	0x33, 0x00, 0x35, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x35, 0x00, 0x34, 0x00,
+	0x2f, 0x00, 0x33, 0x00, 0x30, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00,
+	0x31, 0x00, 0x37, 0x00, 0x32, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x36, 0x00,
+	0x2e, 0x00, 0x31, 0x00, 0x34, 0x00, 0x35, 0x00, 0x2e, 0x00, 0x31, 0x00,
+	0x30, 0x00, 0x33, 0x00, 0x20, 0x00, 0x31, 0x00, 0x37, 0x00, 0x32, 0x00,
+	0x2e, 0x00, 0x31, 0x00, 0x36, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x34, 0x00,
+	0x35, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x30, 0x00, 0x33, 0x00, 0x00, 0x00,
+	0x0e, 0x00, 0x00, 0x00, 0x31, 0x00, 0x30, 0x00, 0x2e, 0x00, 0x31, 0x00,
+	0x38, 0x00, 0x31, 0x00, 0x2e, 0x00, 0x32, 0x00, 0x33, 0x00, 0x35, 0x00,
+	0x2e, 0x00, 0x31, 0x00, 0x35, 0x00, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+static const struct ril_msg reply_data_call_valid_1 = {
+	.buf = (gchar *) &reply_data_call_valid_parcel1,
+	.buf_len = sizeof(reply_data_call_valid_parcel1),
+	.unsolicited = FALSE,
+	.req = RIL_REQUEST_SETUP_DATA_CALL,
+	.serial_no = 0,
+	.error = 0,
+};
+
+/*
+ * The following hexadecimal data represents a serialized Binder parcel
+ * instance containing an valid RIL_REQUEST_SETUP_DATA_CALL reply with
+ * a NULL string specified for 'dns' (note that some data calls without DNS
+ * information might still be rejected by the GPRS context driver):
+ *
+ * {version=7,num=1 [status=0,retry=-1,cid=0,active=2,type=IP
+ * ifname=rmnet_usb0,address=10.181.235.154/30,
+ * dns=NULL,gateways=10.181.235.153]}
+ */
+static const guchar reply_data_call_valid_parcel2[] = {
+	0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+	0x02, 0x00, 0x00, 0x00, 0x49, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x0a, 0x00, 0x00, 0x00, 0x72, 0x00, 0x6d, 0x00, 0x6e, 0x00, 0x65, 0x00,
+	0x74, 0x00, 0x5f, 0x00, 0x75, 0x00, 0x73, 0x00, 0x62, 0x00, 0x30, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x31, 0x00, 0x30, 0x00,
+	0x2e, 0x00, 0x31, 0x00, 0x38, 0x00, 0x31, 0x00, 0x2e, 0x00, 0x32, 0x00,
+	0x33, 0x00, 0x35, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x35, 0x00, 0x34, 0x00,
+	0x2f, 0x00, 0x33, 0x00, 0x30, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+	0x0e, 0x00, 0x00, 0x00, 0x31, 0x00, 0x30, 0x00, 0x2e, 0x00, 0x31, 0x00,
+	0x38, 0x00, 0x31, 0x00, 0x2e, 0x00, 0x32, 0x00, 0x33, 0x00, 0x35, 0x00,
+	0x2e, 0x00, 0x31, 0x00, 0x35, 0x00, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+static const struct ril_msg reply_data_call_valid_2 = {
+	.buf = (gchar *) &reply_data_call_valid_parcel2,
+	.buf_len = sizeof(reply_data_call_valid_parcel2),
+	.unsolicited = FALSE,
+	.req = RIL_REQUEST_SETUP_DATA_CALL,
+	.serial_no = 0,
+	.error = 0,
+};
+
+static const struct ril_msg unsol_data_call_list_changed_invalid_1 = {
+	.buf = "",
+	.buf_len = 0,
+	.unsolicited = TRUE,
+	.req = RIL_UNSOL_DATA_CALL_LIST_CHANGED,
+	.serial_no = 0,
+	.error = 0,
+};
+
+/*
+ * The following hexadecimal data represents a serialized Binder parcel
+ * instance containing a valid RIL_UNSOL_DATA_CALL_LIST_CHANGED message
+ * with the following parameters:
+ *
+ * (version=7,num=1 [status=0,retry=-1,cid=0,active=1,type=IP,
+ * ifname=rmnet_usb0,address=10.209.114.102/30,
+ * dns=172.16.145.103 172.16.145.103,gateways=10.209.114.101]}
+ */
+static const char unsol_data_call_list_changed_parcel1[] = {
+	0x00, 0x00, 0x00, 0xd4, 0x01, 0x00, 0x00, 0x00, 0xf2, 0x03, 0x00, 0x00,
+	0x07, 0x00, 0x00, 0x00,	0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,	0x01, 0x00, 0x00, 0x00,
+	0x02, 0x00, 0x00, 0x00, 0x49, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x0a, 0x00, 0x00, 0x00, 0x72, 0x00, 0x6d, 0x00, 0x6e, 0x00, 0x65, 0x00,
+	0x74, 0x00, 0x5f, 0x00,	0x75, 0x00, 0x73, 0x00, 0x62, 0x00, 0x30, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00,	0x31, 0x00, 0x30, 0x00,
+	0x2e, 0x00, 0x32, 0x00, 0x30, 0x00, 0x39, 0x00, 0x2e, 0x00, 0x31, 0x00,
+	0x31, 0x00, 0x34, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x30, 0x00, 0x32, 0x00,
+	0x2f, 0x00, 0x33, 0x00,	0x30, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00,
+	0x31, 0x00, 0x37, 0x00, 0x32, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x36, 0x00,
+	0x2e, 0x00, 0x31, 0x00, 0x34, 0x00, 0x35, 0x00, 0x2e, 0x00, 0x31, 0x00,
+	0x30, 0x00, 0x33, 0x00, 0x20, 0x00, 0x31, 0x00, 0x37, 0x00, 0x32, 0x00,
+	0x2e, 0x00, 0x31, 0x00,	0x36, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x34, 0x00,
+	0x35, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x30, 0x00,	0x33, 0x00, 0x00, 0x00,
+	0x0e, 0x00, 0x00, 0x00, 0x31, 0x00, 0x30, 0x00, 0x2e, 0x00, 0x32, 0x00,
+	0x30, 0x00, 0x39, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x31, 0x00, 0x34, 0x00,
+	0x2e, 0x00, 0x31, 0x00,	0x30, 0x00, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+static const struct ril_msg unsol_data_call_list_changed_valid_1 = {
+	.buf = (gchar *) &unsol_data_call_list_changed_parcel1,
+	.buf_len = sizeof(unsol_data_call_list_changed_parcel1),
+	.unsolicited = TRUE,
+	.req = RIL_UNSOL_DATA_CALL_LIST_CHANGED,
+	.serial_no = 0,
+	.error = 0,
+};
+
+/*
+ * The following hexadecimal data represents a serialized Binder parcel
+ * instance containing a valid RIL_UNSOL_RESPONSE_NEW_SMS message
+ * with the following parameter (SMSC address length is 7):
+ *
+ * {07914306073011F0040B914336543980F50000310113212002400AC8373B0C6AD7DDE437}
+ */
+static const char unsol_response_new_sms_parcel1[] = {
+	0x48, 0x00, 0x00, 0x00, 0x30, 0x00, 0x37, 0x00, 0x39, 0x00, 0x31, 0x00,
+	0x34, 0x00, 0x33, 0x00, 0x30, 0x00, 0x36, 0x00, 0x30, 0x00, 0x37, 0x00,
+	0x33, 0x00, 0x30, 0x00, 0x31, 0x00, 0x31, 0x00, 0x46, 0x00, 0x30, 0x00,
+	0x30, 0x00, 0x34, 0x00, 0x30, 0x00, 0x42, 0x00, 0x39, 0x00, 0x31, 0x00,
+	0x34, 0x00, 0x33, 0x00, 0x33, 0x00, 0x36, 0x00, 0x35, 0x00, 0x34, 0x00,
+	0x33, 0x00, 0x39, 0x00, 0x38, 0x00, 0x30, 0x00, 0x46, 0x00, 0x35, 0x00,
+	0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x33, 0x00, 0x31, 0x00,
+	0x30, 0x00, 0x31, 0x00, 0x31, 0x00, 0x33, 0x00, 0x32, 0x00, 0x31, 0x00,
+	0x32, 0x00, 0x30, 0x00, 0x30, 0x00, 0x32, 0x00, 0x34, 0x00, 0x30, 0x00,
+	0x30, 0x00, 0x41, 0x00, 0x43, 0x00, 0x38, 0x00, 0x33, 0x00, 0x37, 0x00,
+	0x33, 0x00, 0x42, 0x00, 0x30, 0x00, 0x43, 0x00, 0x36, 0x00, 0x41, 0x00,
+	0x44, 0x00, 0x37, 0x00, 0x44, 0x00, 0x44, 0x00, 0x45, 0x00, 0x34, 0x00,
+	0x33, 0x00, 0x37, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+static const struct ril_msg unsol_response_new_sms_valid_1 = {
+	.buf = (gchar *) &unsol_response_new_sms_parcel1,
+	.buf_len = sizeof(unsol_response_new_sms_parcel1),
+	.unsolicited = TRUE,
+	.req = RIL_UNSOL_RESPONSE_NEW_SMS,
+	.serial_no = 0,
+	.error = 0,
+};
+
+/*
+ * The following hexadecimal data represents a serialized Binder parcel
+ * instance containing a valid RIL_UNSOL_RESPONSE_NEW_SMS message
+ * with the following parameter (SMSC address length is 6):
+ *
+ * {069143060730F0040B914336543980F50000310113212002400AC8373B0C6AD7DDE437}
+ */
+static const char unsol_response_new_sms_parcel2[] = {
+	0x46, 0x00, 0x00, 0x00, 0x30, 0x00, 0x36, 0x00, 0x39, 0x00, 0x31, 0x00,
+	0x34, 0x00, 0x33, 0x00, 0x30, 0x00, 0x36, 0x00, 0x30, 0x00, 0x37, 0x00,
+	0x33, 0x00, 0x30, 0x00, 0x46, 0x00, 0x30, 0x00,	0x30, 0x00, 0x34, 0x00,
+	0x30, 0x00, 0x42, 0x00, 0x39, 0x00, 0x31, 0x00,	0x34, 0x00, 0x33, 0x00,
+	0x33, 0x00, 0x36, 0x00, 0x35, 0x00, 0x34, 0x00,	0x33, 0x00, 0x39, 0x00,
+	0x38, 0x00, 0x30, 0x00, 0x46, 0x00, 0x35, 0x00,	0x30, 0x00, 0x30, 0x00,
+	0x30, 0x00, 0x30, 0x00, 0x33, 0x00, 0x31, 0x00,	0x30, 0x00, 0x31, 0x00,
+	0x31, 0x00, 0x33, 0x00, 0x32, 0x00, 0x31, 0x00,	0x32, 0x00, 0x30, 0x00,
+	0x30, 0x00, 0x32, 0x00, 0x34, 0x00, 0x30, 0x00,	0x30, 0x00, 0x41, 0x00,
+	0x43, 0x00, 0x38, 0x00, 0x33, 0x00, 0x37, 0x00,	0x33, 0x00, 0x42, 0x00,
+	0x30, 0x00, 0x43, 0x00, 0x36, 0x00, 0x41, 0x00,	0x44, 0x00, 0x37, 0x00,
+	0x44, 0x00, 0x44, 0x00, 0x45, 0x00, 0x34, 0x00,	0x33, 0x00, 0x37, 0x00,
+	0x00, 0x00, 0x00, 0x00
+};
+
+static const struct ril_msg unsol_response_new_sms_valid_2 = {
+	.buf = (gchar *) &unsol_response_new_sms_parcel2,
+	.buf_len = sizeof(unsol_response_new_sms_parcel2),
+	.unsolicited = TRUE,
+	.req = RIL_UNSOL_RESPONSE_NEW_SMS,
+	.serial_no = 0,
+	.error = 0,
+};
+
+/*
+ * The following hexadecimal data represents a serialized Binder parcel
+ * instance containing a valid RIL_UNSOL_SUPP_SVC_NOTIFICATION message
+ * with the following parameters:
+ *
+ * {1,2,0,0,} -> call has been put on hold
+ */
+static const guchar unsol_supp_svc_notif_parcel1[] = {
+	0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
+};
+
+static const struct ril_msg unsol_supp_svc_notif_valid_1 = {
+	.buf = (gchar *) &unsol_supp_svc_notif_parcel1,
+	.buf_len = sizeof(unsol_supp_svc_notif_parcel1),
+	.unsolicited = TRUE,
+	.req = RIL_UNSOL_SUPP_SVC_NOTIFICATION,
+	.serial_no = 0,
+	.error = 0,
+};
+
+/*
+ * The following hexadecimal data represents a serialized Binder parcel
+ * instance containing a valid RIL_UNSOL_SIGNAL_STRENGTH message
+ * with the following parameters:
+ *
+ * (gw: 14, cdma: -1, evdo: -1, lte: 99)
+ *
+ * Note, the return value for gw sigmal is: (gw * 100) / 31, which
+ * in this case equals 45.
+ */
+static const guchar unsol_signal_strength_parcel1[] = {
+	0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,	0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff, 0xff, 0xff, 0x63, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x7f,
+	0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0x7f
+};
+
+static const signal_strength_test unsol_signal_strength_valid_1 = {
+	.strength = 45,
+	.ril_tech = RADIO_TECH_GPRS,
+	.msg = {
+		.buf = (gchar *) &unsol_signal_strength_parcel1,
+		.buf_len = sizeof(unsol_signal_strength_parcel1),
+		.unsolicited = TRUE,
+		.req = RIL_UNSOL_SIGNAL_STRENGTH,
+		.serial_no = 0,
+		.error = 0,
+	}
+};
+
+/*
+ * The following hexadecimal data represents a serialized Binder parcel
+ * instance containing a valid RIL_UNSOL_SIGNAL_STRENGTH message
+ * with the following parameters:
+ *
+ * (gw: 99, cdma: 0, evdo: 0, lte: 99)
+ */
+static const guchar unsol_signal_strength_parcel2[] = {
+	0x63, 0x00, 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x63, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x7f,
+	0xff, 0xff, 0xff, 0x7f, 0x2d, 0x01, 0x00, 0x00, 0xff, 0xff, 0xff, 0x7f,
+	0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+static const signal_strength_test unsol_signal_strength_valid_2 = {
+	.strength = -1,
+	.ril_tech = RADIO_TECH_GPRS,
+	.msg = {
+		.buf = (gchar *) &unsol_signal_strength_parcel2,
+		.buf_len = sizeof(unsol_signal_strength_parcel2),
+		.unsolicited = TRUE,
+		.req = RIL_UNSOL_SIGNAL_STRENGTH,
+		.serial_no = 0,
+		.error = 0,
+	}
+};
+
+/*
+ * The following hexadecimal data represents a serialized Binder parcel
+ * instance containing a valid RIL_UNSOL_ON_USSD message with the following
+ * parameters:
+ *
+ * {0,Spain 12:56 09/12/13  Canary 11:56 09/12/13  }
+ */
+static const guchar unsol_on_ussd_parcel1[] = {
+	0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00,
+	0x2d, 0x00, 0x00, 0x00, 0x53, 0x00, 0x70, 0x00, 0x61, 0x00, 0x69, 0x00,
+	0x6e, 0x00, 0x20, 0x00, 0x31, 0x00, 0x32, 0x00, 0x3a, 0x00, 0x35, 0x00,
+	0x36, 0x00, 0x20, 0x00, 0x30, 0x00, 0x39, 0x00, 0x2f, 0x00, 0x31, 0x00,
+	0x32, 0x00, 0x2f, 0x00, 0x31, 0x00, 0x33, 0x00, 0x20, 0x00, 0x20, 0x00,
+	0x43, 0x00, 0x61, 0x00, 0x6e, 0x00, 0x61, 0x00, 0x72, 0x00, 0x79, 0x00,
+	0x20, 0x00, 0x31, 0x00, 0x31, 0x00, 0x3a, 0x00, 0x35, 0x00, 0x36, 0x00,
+	0x20, 0x00, 0x30, 0x00, 0x39, 0x00, 0x2f, 0x00, 0x31, 0x00, 0x32, 0x00,
+	0x2f, 0x00, 0x31, 0x00, 0x33, 0x00, 0x20, 0x00, 0x20, 0x00, 0x00, 0x00
+};
+
+static const struct ril_msg unsol_on_ussd_valid_1 = {
+	.buf = (gchar *) &unsol_on_ussd_parcel1,
+	.buf_len = sizeof(unsol_on_ussd_parcel1),
+	.unsolicited = TRUE,
+	.req = RIL_UNSOL_ON_USSD,
+	.serial_no = 0,
+	.error = 0,
+};
+
+static void test_reply_data_call_invalid(gconstpointer data)
+{
+	struct ril_data_call_list *call_list;
+
+	call_list = g_ril_unsol_parse_data_call_list(NULL, data);
+	g_assert(call_list == NULL);
+}
+
+static void test_reply_data_call_valid(gconstpointer data)
+{
+	struct ril_data_call_list *call_list =
+		g_ril_unsol_parse_data_call_list(NULL, data);
+
+	g_assert(call_list != NULL);
+	g_ril_unsol_free_data_call_list(call_list);
+}
+
+static void test_unsol_data_call_list_changed_invalid(gconstpointer data)
+{
+	struct ril_data_call_list *unsol;
+
+	unsol = g_ril_unsol_parse_data_call_list(NULL, data);
+	g_assert(unsol == NULL);
+}
+
+static void test_unsol_data_call_list_changed_valid(gconstpointer data)
+{
+	struct ril_data_call_list *unsol;
+
+	unsol = g_ril_unsol_parse_data_call_list(NULL, data);
+	g_assert(unsol != NULL);
+	g_ril_unsol_free_data_call_list(unsol);
+}
+
+static void test_signal_strength_valid(gconstpointer data)
+{
+	const signal_strength_test *test = data;
+	int strength = g_ril_unsol_parse_signal_strength(NULL, &test->msg,
+								test->ril_tech);
+	g_assert(strength == test->strength);
+}
+
+static void test_unsol_response_new_sms_valid(gconstpointer data)
+{
+	struct unsol_sms_data *sms_data;
+
+	sms_data = g_ril_unsol_parse_new_sms(NULL, data);
+
+	g_assert(sms_data != NULL);
+	g_assert(sms_data->data != NULL);
+	g_assert(sms_data->length > 0);
+
+	g_ril_unsol_free_sms_data(sms_data);
+}
+
+static void test_unsol_supp_svc_notif_valid(gconstpointer data)
+{
+	struct unsol_supp_svc_notif *unsol;
+
+	unsol = g_ril_unsol_parse_supp_svc_notif(NULL,
+						(struct ril_msg *) data);
+	g_assert(unsol != NULL);
+	g_ril_unsol_free_supp_svc_notif(unsol);
+}
+
+static void test_unsol_on_ussd_valid(gconstpointer data)
+{
+	struct unsol_ussd *unsol;
+
+	unsol = g_ril_unsol_parse_ussd(NULL, (struct ril_msg *) data);
+
+	g_assert(unsol != NULL);
+	g_ril_unsol_free_ussd(unsol);
+}
+#endif
+
+int main(int argc, char **argv)
+{
+	g_test_init(&argc, &argv, NULL);
+
+/*
+ * As all our architectures are little-endian except for
+ * PowerPC, and the Binder wire-format differs slightly
+ * depending on endian-ness, the following guards against test
+ * failures when run on PowerPC.
+ */
+#if BYTE_ORDER == LITTLE_ENDIAN
+
+	g_test_add_data_func("/testgrilunsol/gprs-context: "
+				"invalid DATA_CALL_LIST_CHANGED Test 1",
+				&unsol_data_call_list_changed_invalid_1,
+				test_unsol_data_call_list_changed_invalid);
+
+	g_test_add_data_func("/testgrilunsol/gprs-context: "
+				"valid DATA_CALL_LIST_CHANGED Test 1",
+				&unsol_data_call_list_changed_valid_1,
+				test_unsol_data_call_list_changed_valid);
+
+	g_test_add_data_func("/testgrilunsol/gprs-context: "
+				"invalid SETUP_DATA_CALL Test 1",
+				&reply_data_call_invalid_1,
+				test_reply_data_call_invalid);
+
+	g_test_add_data_func("/testgrilunsol/gprs-context: "
+				"invalid SETUP_DATA_CALL Test 2",
+				&reply_data_call_invalid_2,
+				test_reply_data_call_invalid);
+
+	g_test_add_data_func("/testgrilunsol/gprs-context: "
+				"invalid SETUP_DATA_CALL Test 3",
+				&reply_data_call_invalid_3,
+				test_reply_data_call_invalid);
+
+	g_test_add_data_func("/testgrilunsol/gprs-context: "
+				"invalid SETUP_DATA_CALL Test 4",
+				&reply_data_call_invalid_4,
+				test_reply_data_call_invalid);
+
+	g_test_add_data_func("/testgrilunsol/gprs-context: "
+				"invalid SETUP_DATA_CALL Test 5",
+				&reply_data_call_invalid_5,
+				test_reply_data_call_invalid);
+
+	g_test_add_data_func("/testgrilunsol/gprs-context: "
+				"invalid SETUP_DATA_CALL Test 6",
+				&reply_data_call_invalid_6,
+				test_reply_data_call_invalid);
+
+	g_test_add_data_func("/testgrilunsol/gprs-context: "
+				"valid SETUP_DATA_CALL Test 1",
+				&reply_data_call_valid_1,
+				test_reply_data_call_valid);
+
+	g_test_add_data_func("/testgrilunsol/gprs-context: "
+				"valid SETUP_DATA_CALL Test 2",
+				&reply_data_call_valid_2,
+				test_reply_data_call_valid);
+
+	g_test_add_data_func("/testgrilunsol/sms: "
+				"valid RESPONSE_NEW_SMS Test 1",
+				&unsol_response_new_sms_valid_1,
+				test_unsol_response_new_sms_valid);
+
+	g_test_add_data_func("/testgrilunsol/sms: "
+				"valid RESPONSE_NEW_SMS Test 2",
+				&unsol_response_new_sms_valid_2,
+				test_unsol_response_new_sms_valid);
+
+	g_test_add_data_func("/testgrilunsol/voicecall: "
+				"valid SUPP_SVC_NOTIF Test 1",
+				&unsol_supp_svc_notif_valid_1,
+				test_unsol_supp_svc_notif_valid);
+
+	g_test_add_data_func("/testgrilunsol/voicecall: "
+				"valid SIGNAL_STRENGTH Test 1",
+				&unsol_signal_strength_valid_1,
+				test_signal_strength_valid);
+
+	g_test_add_data_func("/testgrilunsol/voicecall: "
+				"valid SIGNAL_STRENGTH Test 2",
+				&unsol_signal_strength_valid_2,
+				test_signal_strength_valid);
+
+	g_test_add_data_func("/testgrilunsol/ussd: "
+				"valid ON_USSD Test 1",
+				&unsol_on_ussd_valid_1,
+				test_unsol_on_ussd_valid);
+
+#endif
+	return g_test_run();
+}
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 09/10] build: Add rilmodem unit tests
  2015-10-15 16:46 [PATCH 00/10] Re-factoring of gril and rilmodem Alfonso Sanchez-Beato
                   ` (7 preceding siblings ...)
  2015-10-15 16:47 ` [PATCH 08/10] unit: Add unit tests for ril parcel processing Alfonso Sanchez-Beato
@ 2015-10-15 16:47 ` Alfonso Sanchez-Beato
  2015-10-15 16:47 ` [PATCH 10/10] gitignore: Ignore " Alfonso Sanchez-Beato
  9 siblings, 0 replies; 16+ messages in thread
From: Alfonso Sanchez-Beato @ 2015-10-15 16:47 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1977 bytes --]

---
 Makefile.am | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index 35ec7ce..4f895f1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -739,7 +739,10 @@ unit_objects =
 
 unit_tests = unit/test-common unit/test-util unit/test-idmap \
 				unit/test-simutil unit/test-stkutil \
-				unit/test-sms unit/test-cdmasms
+				unit/test-sms unit/test-cdmasms \
+				unit/test-rilreply \
+				unit/test-rilrequest \
+				unit/test-rilunsol
 
 noinst_PROGRAMS = $(unit_tests) \
 			unit/test-sms-root unit/test-mux unit/test-caif
@@ -791,6 +794,30 @@ unit_test_caif_SOURCES = unit/test-caif.c $(gatchat_sources) \
 unit_test_caif_LDADD = @GLIB_LIBS@
 unit_objects += $(unit_test_caif_OBJECTS)
 
+unit_test_rilrequest_SOURCES = unit/test-rilrequest.c $(gril_sources) \
+				drivers/rilmodem/rilrequest.c \
+				drivers/rilmodem/rilutil.c \
+                                src/log.c src/util.c src/simutil.c \
+                                src/common.c gatchat/ringbuffer.c
+unit_test_rilrequest_LDADD = @GLIB_LIBS@ -ldl
+unit_objects += $(unit_test_rilrequest_OBJECTS)
+
+unit_test_rilreply_SOURCES = unit/test-rilreply.c $(gril_sources) \
+				drivers/rilmodem/rilreply.c \
+				drivers/rilmodem/rilutil.c \
+                                src/log.c src/util.c src/simutil.c \
+                                src/common.c gatchat/ringbuffer.c
+unit_test_rilreply_LDADD = @GLIB_LIBS@ -ldl
+unit_objects += $(unit_test_rilreply_OBJECTS)
+
+unit_test_rilunsol_SOURCES = unit/test-rilunsol.c $(gril_sources) \
+				drivers/rilmodem/rilunsol.c \
+				drivers/rilmodem/rilutil.c \
+                                src/log.c src/util.c src/simutil.c \
+                                src/common.c gatchat/ringbuffer.c
+unit_test_rilunsol_LDADD = @GLIB_LIBS@ -ldl
+unit_objects += $(unit_test_rilunsol_OBJECTS)
+
 TESTS = $(unit_tests)
 
 if TOOLS
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 10/10] gitignore: Ignore rilmodem unit tests
  2015-10-15 16:46 [PATCH 00/10] Re-factoring of gril and rilmodem Alfonso Sanchez-Beato
                   ` (8 preceding siblings ...)
  2015-10-15 16:47 ` [PATCH 09/10] build: Add rilmodem unit tests Alfonso Sanchez-Beato
@ 2015-10-15 16:47 ` Alfonso Sanchez-Beato
  9 siblings, 0 replies; 16+ messages in thread
From: Alfonso Sanchez-Beato @ 2015-10-15 16:47 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 375 bytes --]

---
 .gitignore | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/.gitignore b/.gitignore
index b9c23a0..351fa8f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -44,6 +44,9 @@ unit/test-mux
 unit/test-caif
 unit/test-stkutil
 unit/test-cdmasms
+unit/test-rilrequest
+unit/test-rilreply
+unit/test-rilunsol
 unit/test-*.log
 unit/test-*.trs
 
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH 05/10] gril: Remove asserts
  2015-10-15 16:46 ` [PATCH 05/10] gril: Remove asserts Alfonso Sanchez-Beato
@ 2015-10-19 13:53   ` Denis Kenzior
  0 siblings, 0 replies; 16+ messages in thread
From: Denis Kenzior @ 2015-10-19 13:53 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 278 bytes --]

Hi Alfonso,

On 10/15/2015 11:46 AM, Alfonso Sanchez-Beato wrote:
> ---
>   gril/gril.c   | 23 +++++++++++------------
>   gril/grilio.c |  3 +--
>   gril/grilio.h |  2 ++
>   3 files changed, 14 insertions(+), 14 deletions(-)
>

Applied, thanks.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 07/10] ril: Remove asserts
  2015-10-15 16:47 ` [PATCH 07/10] ril: " Alfonso Sanchez-Beato
@ 2015-10-19 13:55   ` Denis Kenzior
  2015-10-20  7:26     ` Alfonso Sanchez-Beato
  0 siblings, 1 reply; 16+ messages in thread
From: Denis Kenzior @ 2015-10-19 13:55 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1026 bytes --]

Hi Alfonso,

On 10/15/2015 11:47 AM, Alfonso Sanchez-Beato wrote:
> ---
>   plugins/ril.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/plugins/ril.c b/plugins/ril.c
> index e31f24b..2edb0a9 100644
> --- a/plugins/ril.c
> +++ b/plugins/ril.c
> @@ -144,7 +144,9 @@ static void ril_radio_state_changed(struct ril_msg *message, gpointer user_data)
>   			break;
>   		default:
>   			/* Malformed parcel; no radio state == broken rild */
> -			g_assert(FALSE);
> +			ofono_error("%s: Bad radio state (%d), exiting",
> +							__func__, radio_state);
> +			exit(1);

Can we just remove the ril modem in question instead of killing the 
entire daemon?

>   		}
>   	}
>   }
> @@ -213,7 +215,6 @@ void ril_pre_sim(struct ofono_modem *modem)
>   	sim_data.ril_state_watch = NULL;
>
>   	rd->sim = ofono_sim_create(modem, rd->vendor, RILMODEM, &sim_data);
> -	g_assert(rd->sim != NULL);
>   }
>
>   void ril_post_sim(struct ofono_modem *modem)
>

Regards,
-Denis

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 07/10] ril: Remove asserts
  2015-10-19 13:55   ` Denis Kenzior
@ 2015-10-20  7:26     ` Alfonso Sanchez-Beato
  2015-10-20  8:28       ` Simon Fels
  2015-10-20 12:31       ` Denis Kenzior
  0 siblings, 2 replies; 16+ messages in thread
From: Alfonso Sanchez-Beato @ 2015-10-20  7:26 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1764 bytes --]

On Mon, Oct 19, 2015 at 3:55 PM, Denis Kenzior <denkenz@gmail.com> wrote:

> Hi Alfonso,
>
> On 10/15/2015 11:47 AM, Alfonso Sanchez-Beato wrote:
>
>> ---
>>   plugins/ril.c | 5 +++--
>>   1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/plugins/ril.c b/plugins/ril.c
>> index e31f24b..2edb0a9 100644
>> --- a/plugins/ril.c
>> +++ b/plugins/ril.c
>> @@ -144,7 +144,9 @@ static void ril_radio_state_changed(struct ril_msg
>> *message, gpointer user_data)
>>                         break;
>>                 default:
>>                         /* Malformed parcel; no radio state == broken
>> rild */
>> -                       g_assert(FALSE);
>> +                       ofono_error("%s: Bad radio state (%d), exiting",
>> +                                                       __func__,
>> radio_state);
>> +                       exit(1);
>>
>
> Can we just remove the ril modem in question instead of killing the entire
> daemon?


I think that if we start to do these things we need to add modem watches to
udev/udevng/rildev as they keep lists with the modems and remove them in
shutdown. Maybe we could try a modem reset here, within a limited number of
retries instead?


>
>
>                 }
>>         }
>>   }
>> @@ -213,7 +215,6 @@ void ril_pre_sim(struct ofono_modem *modem)
>>         sim_data.ril_state_watch = NULL;
>>
>>         rd->sim = ofono_sim_create(modem, rd->vendor, RILMODEM,
>> &sim_data);
>> -       g_assert(rd->sim != NULL);
>>   }
>>
>>   void ril_post_sim(struct ofono_modem *modem)
>>
>>
> Regards,
> -Denis
> _______________________________________________
> ofono mailing list
> ofono(a)ofono.org
> https://lists.ofono.org/mailman/listinfo/ofono
>

[-- Attachment #2: attachment.html --]
[-- Type: text/html, Size: 2760 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 07/10] ril: Remove asserts
  2015-10-20  7:26     ` Alfonso Sanchez-Beato
@ 2015-10-20  8:28       ` Simon Fels
  2015-10-20 12:31       ` Denis Kenzior
  1 sibling, 0 replies; 16+ messages in thread
From: Simon Fels @ 2015-10-20  8:28 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1588 bytes --]

On 20.10.2015 09:26, Alfonso Sanchez-Beato wrote:
> On Mon, Oct 19, 2015 at 3:55 PM, Denis Kenzior <denkenz@gmail.com> wrote:
>
>> Hi Alfonso,
>>
>> On 10/15/2015 11:47 AM, Alfonso Sanchez-Beato wrote:
>>
>>> ---
>>>    plugins/ril.c | 5 +++--
>>>    1 file changed, 3 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/plugins/ril.c b/plugins/ril.c
>>> index e31f24b..2edb0a9 100644
>>> --- a/plugins/ril.c
>>> +++ b/plugins/ril.c
>>> @@ -144,7 +144,9 @@ static void ril_radio_state_changed(struct ril_msg
>>> *message, gpointer user_data)
>>>                          break;
>>>                  default:
>>>                          /* Malformed parcel; no radio state == broken
>>> rild */
>>> -                       g_assert(FALSE);
>>> +                       ofono_error("%s: Bad radio state (%d), exiting",
>>> +                                                       __func__,
>>> radio_state);
>>> +                       exit(1);
>>>
>>
>> Can we just remove the ril modem in question instead of killing the entire
>> daemon?
>
>
> I think that if we start to do these things we need to add modem watches to
> udev/udevng/rildev as they keep lists with the modems and remove them in
> shutdown. Maybe we could try a modem reset here, within a limited number of
> retries instead?

We should avoid exiting in any case. The minimum we can do is to bring 
the whole modem down if we can't do anything more so we end up in the 
same state as we would when restarting ofono and we're about to setup 
the rilmodem again.

regards,
Simon


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 07/10] ril: Remove asserts
  2015-10-20  7:26     ` Alfonso Sanchez-Beato
  2015-10-20  8:28       ` Simon Fels
@ 2015-10-20 12:31       ` Denis Kenzior
  1 sibling, 0 replies; 16+ messages in thread
From: Denis Kenzior @ 2015-10-20 12:31 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 653 bytes --]

Hi Alfonso,

 >
>     Can we just remove the ril modem in question instead of killing the
>     entire daemon?
>
>
> I think that if we start to do these things we need to add modem watches
> to udev/udevng/rildev as they keep lists with the modems and remove them
> in shutdown. Maybe we could try a modem reset here, within a limited
> number of retries instead?
>

You can always simply call ofono_modem_set_powered here and make sure 
your initialization procedure can re-init all the file-descriptors, etc 
after set_powered(FALSE) -> set_powered(TRUE).

Would be in the end the same as restarting the daemon.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2015-10-20 12:31 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-15 16:46 [PATCH 00/10] Re-factoring of gril and rilmodem Alfonso Sanchez-Beato
2015-10-15 16:46 ` [PATCH 01/10] gril: Move parcel processing to rilmodem Alfonso Sanchez-Beato
2015-10-15 16:46 ` [PATCH 02/10] gril: Adapt to movement of parcel processing Alfonso Sanchez-Beato
2015-10-15 16:46 ` [PATCH 03/10] rilmodem: " Alfonso Sanchez-Beato
2015-10-15 16:46 ` [PATCH 04/10] ril: " Alfonso Sanchez-Beato
2015-10-15 16:46 ` [PATCH 05/10] gril: Remove asserts Alfonso Sanchez-Beato
2015-10-19 13:53   ` Denis Kenzior
2015-10-15 16:46 ` [PATCH 06/10] rilmodem: " Alfonso Sanchez-Beato
2015-10-15 16:47 ` [PATCH 07/10] ril: " Alfonso Sanchez-Beato
2015-10-19 13:55   ` Denis Kenzior
2015-10-20  7:26     ` Alfonso Sanchez-Beato
2015-10-20  8:28       ` Simon Fels
2015-10-20 12:31       ` Denis Kenzior
2015-10-15 16:47 ` [PATCH 08/10] unit: Add unit tests for ril parcel processing Alfonso Sanchez-Beato
2015-10-15 16:47 ` [PATCH 09/10] build: Add rilmodem unit tests Alfonso Sanchez-Beato
2015-10-15 16:47 ` [PATCH 10/10] gitignore: Ignore " Alfonso Sanchez-Beato

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.