tcore_server_send_notification(tcore_plugin_ref_server(tcore_object_ref_plugin(o)), o,
TNOTI_PS_EXTERNAL_CALL, sizeof(struct tnoti_ps_external_call), &data);
}
+ break;
case 3:
{
{
TcoreHal *hal = NULL;
TcorePending *pending = NULL;
- char cmd_str[MAX_AT_CMD_STR_LEN];
+ char *cmd_str = NULL;
int cid = 0;
dbg("Entry");
- memset(cmd_str, 0x0, MAX_AT_CMD_STR_LEN);
/* FIXME: Before MUX setup, use PHY HAL directly. */
hal = tcore_object_get_hal(co_ps);
/*Getting Context ID from Core Object*/
cid = tcore_context_get_id(ps_context);
- (void) sprintf(cmd_str, "AT+CGDCONT=%d", cid);
+ cmd_str = g_strdup_printf("AT+CGDCONT=%d", cid);
+
dbg("Command: [%s] Command Length: [%d]", cmd_str, strlen(cmd_str));
pending = tcore_at_pending_new(co_ps, cmd_str, NULL, TCORE_AT_NO_RESULT,
goto error;
}
tcore_hal_send_request(hal, pending);
+ g_free(cmd_str);
dbg("Exit: Successfully");
return;
error:
{
dbg("Exit: With error");
_unable_to_get_pending(co_ps, ps_context);
+ g_free(cmd_str);
return;
}
}
dbg("Entry");
- if (!ps_data ) {
+ if (!ps_data) {
err("PS_data unavailable. Exiting.");
return;
}
}
/* Set Device name */
- //tcore_context_set_ipv4_devname(ps_context, netif_name);
g_strlcpy(ps_data->data_call_conf.devname, netif_name, sizeof(ps_data->data_call_conf.devname));
ps_data->data_call_conf.context_id = (int)tcore_context_get_id(ps_data->ps_context);
pRespData = (GSList *) resp->lines;
no_pdp_active = g_slist_length(pRespData);
dbg("Total Number of Active PS Context: [%d]", no_pdp_active);
- if (0 == no_pdp_active) {
+ if (0 == no_pdp_active)
goto exit_fail;
- }
while (pRespData) {
line = (const char *) pRespData->data;
token_dns = g_slist_nth_data(tokens, 1);
/* Strip off starting " and ending " from this token to read actual PDP address */
- dns_prim = util_removeQuotes((void *)token_dns);
+ dns_prim = tcore_at_tok_extract((void *)token_dns);
dbg("Primary DNS: [%s]", dns_prim);
}
token_dns = g_slist_nth_data(tokens, 2);
/* Strip off starting " and ending " from this token to read actual PDP address */
- dns_sec = util_removeQuotes((void *)token_dns);
+ dns_sec = tcore_at_tok_extract((void *)token_dns);
dbg("Secondary DNS: [%s]", dns_sec);
}
__convert_ipv4_atoi(ps_data->data_call_conf.primary_dns, dns_prim);
__convert_ipv4_atoi(ps_data->data_call_conf.secondary_dns, dns_sec);
- util_hex_dump(" ", 4, ps_data->data_call_conf.primary_dns);
- util_hex_dump(" ", 4, ps_data->data_call_conf.secondary_dns);
+ tcore_util_hex_dump(" ", 4, ps_data->data_call_conf.primary_dns);
+ tcore_util_hex_dump(" ", 4, ps_data->data_call_conf.secondary_dns);
/* Set DNS Address */
tcore_context_set_dns1(ps_data->ps_context, dns_prim);
{
TcoreHal *hal = NULL;
TcorePending *pending = NULL;
- char cmd_str[MAX_AT_CMD_STR_LEN];
-
- memset(cmd_str, 0x0, MAX_AT_CMD_STR_LEN);
+ char *cmd_str = NULL;
dbg("Entry");
hal = tcore_object_get_hal(co_ps);
- (void) sprintf(cmd_str, "AT+XDNS?");
+ cmd_str = g_strdup("AT+XDNS?");
dbg("Command: [%s] Command Length: [%d]", cmd_str, strlen(cmd_str));
pending = tcore_at_pending_new(co_ps, cmd_str, "+XDNS", TCORE_AT_MULTILINE,
on_response_get_dns_cmnd, (void *)ps_data);
if (TCORE_RETURN_SUCCESS == tcore_hal_send_request(hal, pending)) {
+ g_free(cmd_str);
return TCORE_RETURN_SUCCESS;
}
_unable_to_get_pending(co_ps, ps_data->ps_context);
+ g_free(cmd_str);
return TCORE_RETURN_FAILURE;
}
dbg("Enetered");
if (resp->final_response) {
- ps_data = g_try_malloc0(sizeof (struct ps_user_data));
+ ps_data = g_try_malloc0(sizeof(struct ps_user_data));
+ if (ps_data == NULL) {
+ err("Memory allocation failed!!");
+ return;
+ }
ps_data->ps_context = ps_context;
dbg("RESPONSE OK");
if (resp->lines != NULL) {
/* CID is already stored in ps_context, skip over & read PDP address */
token_address = g_slist_nth_data(tokens, 1);
- token_pdp_address = util_removeQuotes((void *)token_address);
+ token_pdp_address = tcore_at_tok_extract((void *)token_address);
dbg("IP Address: [%s]", token_pdp_address);
__convert_ipv4_atoi(ps_data->data_call_conf.ip_address, token_pdp_address);
- util_hex_dump(" ", 4, ps_data->data_call_conf.ip_address);
+ tcore_util_hex_dump(" ", 4, ps_data->data_call_conf.ip_address);
/* Strip off starting " and ending " from this token to read actual PDP address */
/* Set IP Address */
TcoreHal *hal = NULL;
TcorePending *pending = NULL;
unsigned int cid = PS_INVALID_CID;
- char cmd_str[MAX_AT_CMD_STR_LEN] = {0};
+ char *cmd_str = NULL;
dbg("Entry");
hal = tcore_object_get_hal(co_ps);
cid = tcore_context_get_id(ps_context);
- (void) sprintf(cmd_str, "AT+CGPADDR=%d", cid);
+ cmd_str = g_strdup_printf("AT+CGPADDR=%d", cid);
+
dbg("Command: [%s] Command Length: [%d]", cmd_str, strlen(cmd_str));
pending = tcore_at_pending_new(co_ps, cmd_str, "+CGPADDR", TCORE_AT_SINGLELINE,
on_response_get_pdp_address, ps_context);
if (TCORE_RETURN_SUCCESS == tcore_hal_send_request(hal, pending)) {
+ g_free(cmd_str);
return TCORE_RETURN_SUCCESS;
}
_unable_to_get_pending(co_ps, ps_context);
+ g_free(cmd_str);
return TCORE_RETURN_FAILURE;
}
dbg("Entry");
- if (!p) {
+ if (!p)
goto error;
- }
+
co_ps = tcore_pending_ref_core_object(p);
if (resp->success) {
{
TcoreHal *hal = NULL;
TcorePending *pending = NULL;
- char cmd_str[MAX_AT_CMD_STR_LEN] = {0};
+ char *cmd_str = NULL;
int cid = 0;
+
dbg("Entry");
+
/* FIXME: Before MUX setup, use PHY HAL directly. */
hal = tcore_object_get_hal(co_ps);
/*Getting Context ID from Core Object*/
cid = tcore_context_get_id(ps_context);
- (void) sprintf(cmd_str, "AT+CGACT=%d,%d", AT_PDP_ACTIVATE, cid);
+ cmd_str = g_strdup_printf("AT+CGACT=%d,%d", AT_PDP_ACTIVATE, cid);
+
dbg("Command: [%s] Command Length: [%d]", cmd_str, strlen(cmd_str));
pending = tcore_at_pending_new(co_ps, cmd_str, NULL, TCORE_AT_NO_RESULT,
on_response_send_pdp_activate_cmd, ps_context);
if (TCORE_RETURN_SUCCESS == tcore_hal_send_request(hal, pending)) {
+ g_free(cmd_str);
return TCORE_RETURN_SUCCESS;
}
_unable_to_get_pending(co_ps, ps_context);
+ g_free(cmd_str);
return TCORE_RETURN_FAILURE;
}
{
TcoreHal *hal = NULL;
TcorePending *pending = NULL;
- char cmd_str[MAX_AT_CMD_STR_LEN];
+ char *cmd_str = NULL;
int cid = 0;
dbg("Entry");
- memset(cmd_str, 0x0, MAX_AT_CMD_STR_LEN);
hal = tcore_object_get_hal(co_ps);
/*Getting Context ID from Core Object*/
cid = tcore_context_get_id(ps_context);
+ cmd_str = g_strdup_printf("AT+CGACT=%d,%u", AT_PDP_DEACTIVATE, cid);
- (void) sprintf(cmd_str, "AT+CGACT=%d,%u", AT_PDP_DEACTIVATE, cid);
dbg("Command: [%s] Command Length: [%d]", cmd_str, strlen(cmd_str));
pending = tcore_at_pending_new(co_ps, cmd_str, NULL, TCORE_AT_NO_RESULT,
on_response_send_pdp_deactivate_cmd, ps_context);
if (TCORE_RETURN_SUCCESS == tcore_hal_send_request(hal, pending)) {
+ g_free(cmd_str);
return TCORE_RETURN_SUCCESS;
}
+ g_free(cmd_str);
return TCORE_RETURN_FAILURE;
}
TcoreHal *hal = NULL;
TcorePending *pending = NULL;
int cid = -1;
- char cmd_str[MAX_AT_CMD_STR_LEN];
+ char *cmd_str = NULL;
dbg("Entry");
- memset(cmd_str, 0x0, MAX_AT_CMD_STR_LEN);
hal = tcore_object_get_hal(co_ps);
cid = tcore_context_get_id(ps_context);
- (void) sprintf(cmd_str, "AT+XDNS=%d,%d", cid, AT_XDNS_ENABLE);
+ cmd_str = g_strdup_printf("AT+XDNS=%d,%d", cid, AT_XDNS_ENABLE);
dbg("Command: [%s] Command Length: [%d]", cmd_str, strlen(cmd_str));
pending = tcore_at_pending_new(co_ps, cmd_str, NULL, TCORE_AT_NO_RESULT,
on_response_xdns_enable_cmd, ps_context);
if (TCORE_RETURN_SUCCESS == tcore_hal_send_request(hal, pending)) {
+ g_free(cmd_str);
return TCORE_RETURN_SUCCESS;
}
_unable_to_get_pending(co_ps, ps_context);
+ g_free(cmd_str);
return TCORE_RETURN_FAILURE;
}
TcoreHal *hal = NULL;
TcorePending *pending = NULL;
char *apn = NULL;
- char cmd_str[MAX_AT_CMD_STR_LEN] = {0};
- char pdp_type_str[10] = {0};
+ char *cmd_str = NULL;
+ char *pdp_type_str = NULL;
unsigned int cid = PS_INVALID_CID;
enum co_context_type pdp_type;
enum co_context_d_comp d_comp;
case CONTEXT_TYPE_X25:
{
dbg("CONTEXT_TYPE_X25");
- strcpy(pdp_type_str, "X.25");
- break;
+ pdp_type_str = g_strdup_printf("X.25");
}
+ break;
+ case CONTEXT_TYPE_IPV4V6:
case CONTEXT_TYPE_IP:
{
dbg("CONTEXT_TYPE_IP");
- strcpy(pdp_type_str, "IP");
+ pdp_type_str = g_strdup_printf("IP");
}
break;
case CONTEXT_TYPE_PPP:
{
dbg("CONTEXT_TYPE_PPP");
- strcpy(pdp_type_str, "PPP");
+ pdp_type_str = g_strdup_printf("PPP");
}
break;
case CONTEXT_TYPE_IPV6:
{
dbg("CONTEXT_TYPE_IPV6");
- strcpy(pdp_type_str, "IPV6");
+ pdp_type_str = g_strdup_printf("IPV6");
break;
}
}
}
dbg("Activating context for CID: %d", cid);
- (void) sprintf(cmd_str, "AT+CGDCONT=%d,\"%s\",\"%s\",,%d,%d", cid, pdp_type_str, apn, d_comp, h_comp);
+ cmd_str = g_strdup_printf("AT+CGDCONT=%d,\"%s\",\"%s\",,%d,%d",
+ cid, pdp_type_str, apn, d_comp, h_comp);
+
dbg("Command: [%s] Command Length: [%d]", cmd_str, strlen(cmd_str));
g_free(apn);
pending = tcore_at_pending_new(co_ps, cmd_str, NULL, TCORE_AT_NO_RESULT,
on_response_define_pdp_context, ps_context);
if (TCORE_RETURN_SUCCESS == tcore_hal_send_request(hal, pending)) {
+ g_free(cmd_str);
+ g_free(pdp_type_str);
return TCORE_RETURN_SUCCESS;
}
_unable_to_get_pending(co_ps, ps_context);
+ g_free(cmd_str);
+ g_free(pdp_type_str);
return TCORE_RETURN_FAILURE;
}
dbg("Entry");
/* Set operations */
- tcore_ps_set_ops(co_ps, &ps_ops);
+ tcore_ps_set_ops(co_ps, &ps_ops, TCORE_OPS_TYPE_CP);
tcore_object_add_callback(co_ps, "+CGEV", on_cgev_notification, NULL);
tcore_object_add_callback(co_ps, "+XNOTIFYDUNSTATUS", on_event_dun_call_notification, plugin);