summaryrefslogtreecommitdiff
path: root/drivers/atmodem
diff options
context:
space:
mode:
authorGiacinto Cifelli <gciofono@gmail.com>2018-10-22 20:56:07 +0200
committerDenis Kenzior <denkenz@gmail.com>2018-10-22 15:01:51 -0500
commit0208c10e9bebaa0acb2d4db25267c67f779dbf2a (patch)
tree801db9758d1d9374ee97e28fa8846d25b821a61e /drivers/atmodem
parent2637bfd4ecbc23a4faeb01604297e1e7bdefa08f (diff)
downloadofono-0208c10e9bebaa0acb2d4db25267c67f779dbf2a.tar.gz
atmodem: Add at_util_gprs_auth_method_to_auth_proto
This function converts the ofono enum ofono_gprs_auth_method into the value of the 3GPP 27.007 'auth_proto' variable of +CGAUTH so that it can be passed directly to the AT command.
Diffstat (limited to 'drivers/atmodem')
-rw-r--r--drivers/atmodem/atutil.c16
-rw-r--r--drivers/atmodem/atutil.h4
2 files changed, 20 insertions, 0 deletions
diff --git a/drivers/atmodem/atutil.c b/drivers/atmodem/atutil.c
index 6f4e8a20..661ba205 100644
--- a/drivers/atmodem/atutil.c
+++ b/drivers/atmodem/atutil.c
@@ -3,6 +3,7 @@
* oFono - Open Source Telephony
*
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
+ * Copyright (C) 2018 Gemalto M2M
*
* 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
@@ -654,3 +655,18 @@ int at_util_get_ipv4_address_and_netmask(const char *addrnetmask,
return ret;
}
+
+int at_util_gprs_auth_method_to_auth_prot(
+ enum ofono_gprs_auth_method auth_method)
+{
+ switch (auth_method) {
+ case OFONO_GPRS_AUTH_METHOD_PAP:
+ return 1;
+ case OFONO_GPRS_AUTH_METHOD_CHAP:
+ return 2;
+ case OFONO_GPRS_AUTH_METHOD_NONE:
+ return 0;
+ }
+
+ return 0;
+}
diff --git a/drivers/atmodem/atutil.h b/drivers/atmodem/atutil.h
index 7113a4cd..aa6b8d4d 100644
--- a/drivers/atmodem/atutil.h
+++ b/drivers/atmodem/atutil.h
@@ -3,6 +3,7 @@
* oFono - Open Source Telephony
*
* Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
+ * Copyright (C) 2018 Gemalto M2M
*
* 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
@@ -86,6 +87,9 @@ void at_util_sim_state_query_free(struct at_util_sim_state_query *req);
int at_util_get_ipv4_address_and_netmask(const char *addrnetmask,
char *address, char *netmask);
+int at_util_gprs_auth_method_to_auth_prot(
+ enum ofono_gprs_auth_method auth_method);
+
struct cb_data {
void *cb;
void *data;