static void parser_provider_start (MobileParser *parser, const char *name, const char **attribute_names, const char **attribute_values) { if (!strcmp (name, "gsm")) parser->state = PARSER_METHOD_GSM; else if (!strcmp (name, "cdma")) { parser->state = PARSER_METHOD_CDMA; parser->current_method = access_method_new (); } }
static void parser_gsm_start (MobileParser *parser, const char *name, const char **attribute_names, const char **attribute_values) { if (!strcmp (name, "network-id")) { const char *mcc = NULL, *mnc = NULL; int i; for (i = 0; attribute_names && attribute_names[i]; i++) { if (!strcmp (attribute_names[i], "mcc")) mcc = attribute_values[i]; else if (!strcmp (attribute_names[i], "mnc")) mnc = attribute_values[i]; if (mcc && strlen (mcc) && mnc && strlen (mnc)) { gchar *mccmnc; if (!parser->current_provider->mcc_mnc) parser->current_provider->mcc_mnc = g_ptr_array_new_full (2, g_free); mccmnc = g_strdup_printf ("%s%s", mcc, mnc); g_ptr_array_add (parser->current_provider->mcc_mnc, mccmnc); break; } } } else if (!strcmp (name, "apn")) { int i; for (i = 0; attribute_names && attribute_names[i]; i++) { if (!strcmp (attribute_names[i], "value")) { parser->state = PARSER_METHOD_GSM_APN; parser->current_method = access_method_new (); parser->current_method->apn = g_strstrip (g_strdup (attribute_values[i])); break; } } } }
static void parser_gsm_start (MobileParser *parser, const char *name, const char **attribute_names, const char **attribute_values) { if (!strcmp (name, "network-id")) { const char *mcc = NULL, *mnc = NULL; int i; for (i = 0; attribute_names && attribute_names[i]; i++) { if (!strcmp (attribute_names[i], "mcc")) mcc = attribute_values[i]; else if (!strcmp (attribute_names[i], "mnc")) mnc = attribute_values[i]; if (mcc && strlen (mcc) && mnc && strlen (mnc)) { parser->current_provider->gsm_mcc_mnc = g_slist_prepend (parser->current_provider->gsm_mcc_mnc, mcc_mnc_new (mcc, mnc)); break; } } } else if (!strcmp (name, "apn")) { int i; for (i = 0; attribute_names && attribute_names[i]; i++) { if (!strcmp (attribute_names[i], "value")) { parser->state = PARSER_METHOD_GSM_APN; parser->current_method = access_method_new (); parser->current_method->gsm_apn = g_strstrip (g_strdup (attribute_values[i])); break; } } } }