summaryrefslogtreecommitdiffstats
path: root/plugins/mbpi.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/mbpi.c')
-rw-r--r--plugins/mbpi.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/plugins/mbpi.c b/plugins/mbpi.c
index dff8752c..ae92c762 100644
--- a/plugins/mbpi.c
+++ b/plugins/mbpi.c
@@ -128,6 +128,37 @@ static const GMarkupParser text_parser = {
NULL,
};
+static void authentication_start(GMarkupParseContext *context,
+ const gchar **attribute_names,
+ const gchar **attribute_values,
+ enum ofono_gprs_auth_method *auth_method,
+ GError **error)
+{
+ const char *text = NULL;
+ int i;
+
+ for (i = 0; attribute_names[i]; i++)
+ if (g_str_equal(attribute_names[i], "method") == TRUE)
+ text = attribute_values[i];
+
+ if (text == NULL) {
+ mbpi_g_set_error(context, error, G_MARKUP_ERROR,
+ G_MARKUP_ERROR_MISSING_ATTRIBUTE,
+ "Missing attribute: method");
+ return;
+ }
+
+ if (strcmp(text, "chap") == 0)
+ *auth_method = OFONO_GPRS_AUTH_METHOD_CHAP;
+ else if (strcmp(text, "pap") == 0)
+ *auth_method = OFONO_GPRS_AUTH_METHOD_PAP;
+ else
+ mbpi_g_set_error(context, error, G_MARKUP_ERROR,
+ G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE,
+ "Unknown authentication method: %s",
+ text);
+}
+
static void usage_start(GMarkupParseContext *context,
const gchar **attribute_names,
const gchar **attribute_values,
@@ -174,6 +205,9 @@ static void apn_start(GMarkupParseContext *context, const gchar *element_name,
else if (g_str_equal(element_name, "password"))
g_markup_parse_context_push(context, &text_parser,
&apn->password);
+ else if (g_str_equal(element_name, "authentication"))
+ authentication_start(context, attribute_names,
+ attribute_values, &apn->auth_method, error);
else if (g_str_equal(element_name, "mmsc"))
g_markup_parse_context_push(context, &text_parser,
&apn->message_center);
@@ -291,6 +325,7 @@ static void apn_handler(GMarkupParseContext *context, struct gsm_data *gsm,
ap->apn = g_strdup(apn);
ap->type = OFONO_GPRS_CONTEXT_TYPE_INTERNET;
ap->proto = OFONO_GPRS_PROTO_IP;
+ ap->auth_method = OFONO_GPRS_AUTH_METHOD_CHAP;
g_markup_parse_context_push(context, &apn_parser, ap);
}