static void _request_fail(UserRequest *ur, int cmd, int resp_len, void *resp)
{
tcore_user_request_send_response(ur, cmd, resp_len, resp);
- tcore_user_request_free(ur);
+ tcore_user_request_unref(ur);
+}
+static char *_get_ip_string(const unsigned char str[4])
+{
+ union tcore_ip4_type ip;
+
+ ip.i = 0;
+ ip.s[0] = str[0];
+ ip.s[1] = str[1];
+ ip.s[2] = str[2];
+ ip.s[3] = str[3];
+
+ return tcore_util_get_string_by_ip4type(ip);
}
gboolean scomm_service_request_ps(unsigned int ch_id, Communicator *c, TcorePlugin *plugin,
unsigned int data_len, const void *data)
{
const struct tnoti_ps_dun_pin_control *noti_pin_info = data;
+ const struct tnoti_ps_call_status *noti_call_status = data;
+ const struct tnoti_ps_pdp_ipconfiguration *noti_pdp_ipconfiguration = data;
+ const struct tnoti_ps_protocol_status *noti_protocol_status = data;
int ret = 0;
struct custom_data *ctx = NULL;
struct _tapi_header hdr;
struct _sipc_marshal_object* out_obj = NULL;
gchar *out_d = NULL, *serial_d = NULL;
+ char *ipstr;
+
+ memset(&hdr, 0, sizeof(struct _tapi_header));
ctx = tcore_communicator_ref_user_data(comm);
if (!ctx) {
hdr.cmd = TAPI_NOTI_PS_EXTERNAL_CALL;
/* no data */
break;
+
+ case TNOTI_PS_CALL_STATUS:
+ hdr.cmd = TAPI_NOTI_PS_CALL_STATUS;
+ out_obj = sipc_util_marshal_object_create();
+ sipc_util_marshal_object_add_data(out_obj, "context_id", ¬i_call_status->context_id,
+ SIPC_MARSHAL_DATA_INT_TYPE);
+ if (noti_call_status->state == 1) {
+ sipc_util_marshal_object_add_data(out_obj, "state", "activated", SIPC_MARSHAL_DATA_STRING_TYPE);
+ }
+ else {
+ sipc_util_marshal_object_add_data(out_obj, "state", "deactivated", SIPC_MARSHAL_DATA_STRING_TYPE);
+ }
+ break;
+
+ case TNOTI_PS_PDP_IPCONFIGURATION:
+ hdr.cmd = TAPI_NOTI_PS_PDP_IPCONFIGURATION;
+ out_obj = sipc_util_marshal_object_create();
+ sipc_util_marshal_object_add_data(out_obj, "context_id", ¬i_pdp_ipconfiguration->context_id,
+ SIPC_MARSHAL_DATA_INT_TYPE);
+ sipc_util_marshal_object_add_data(out_obj, "secondary_context_id",
+ ¬i_pdp_ipconfiguration->secondary_context_id, SIPC_MARSHAL_DATA_INT_TYPE);
+ ipstr = _get_ip_string(noti_pdp_ipconfiguration->ip_address);
+ sipc_util_marshal_object_add_data(out_obj, "ip_address", ipstr, SIPC_MARSHAL_DATA_STRING_TYPE);
+ free(ipstr);
+ ipstr = _get_ip_string(noti_pdp_ipconfiguration->primary_dns);
+ sipc_util_marshal_object_add_data(out_obj, "primary_dns", ipstr, SIPC_MARSHAL_DATA_STRING_TYPE);
+ free(ipstr);
+ ipstr = _get_ip_string(noti_pdp_ipconfiguration->secondary_dns);
+ sipc_util_marshal_object_add_data(out_obj, "secondary_dns", ipstr, SIPC_MARSHAL_DATA_STRING_TYPE);
+ free(ipstr);
+ ipstr = _get_ip_string(noti_pdp_ipconfiguration->gateway);
+ sipc_util_marshal_object_add_data(out_obj, "gateway", ipstr, SIPC_MARSHAL_DATA_STRING_TYPE);
+ free(ipstr);
+ ipstr = _get_ip_string(noti_pdp_ipconfiguration->subnet_mask);
+ sipc_util_marshal_object_add_data(out_obj, "subnet_mask", ipstr, SIPC_MARSHAL_DATA_STRING_TYPE);
+ free(ipstr);
+ sipc_util_marshal_object_add_data(out_obj, "devname", ¬i_pdp_ipconfiguration->devname,
+ SIPC_MARSHAL_DATA_STRING_TYPE);
+ break;
+
+ case TNOTI_PS_PROTOCOL_STATUS:
+ hdr.cmd = TAPI_NOTI_PS_PROTOCOL_STATUS;
+ out_obj = sipc_util_marshal_object_create();
+ switch (noti_protocol_status->status) {
+ case 1:
+ sipc_util_marshal_object_add_data(out_obj, "status", "hsdpa", SIPC_MARSHAL_DATA_STRING_TYPE);
+ break;
+
+ case 2:
+ sipc_util_marshal_object_add_data(out_obj, "status", "hspa+", SIPC_MARSHAL_DATA_STRING_TYPE);
+ break;
+
+ case 3:
+ sipc_util_marshal_object_add_data(out_obj, "status", "hsupa", SIPC_MARSHAL_DATA_STRING_TYPE);
+ break;
+
+ case 0:
+ default:
+ sipc_util_marshal_object_add_data(out_obj, "status", "none", SIPC_MARSHAL_DATA_STRING_TYPE);
+ break;
+ }
+ break;
+
+ default:
+ dbg("unknown notification");
+ return FALSE;
+ break;
}
if (out_obj) {