3 * oFono - Open Source Telephony
5 * Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #ifndef __OFONO_GPRS_CONTEXT_H
23 #define __OFONO_GPRS_CONTEXT_H
29 #include <ofono/types.h>
31 struct ofono_gprs_context;
33 #define OFONO_GPRS_MAX_APN_LENGTH 127
34 #define OFONO_GPRS_MAX_USERNAME_LENGTH 63
35 #define OFONO_GPRS_MAX_PASSWORD_LENGTH 255
37 enum ofono_gprs_proto {
38 OFONO_GPRS_PROTO_IP = 0,
39 OFONO_GPRS_PROTO_IPV6,
40 OFONO_GPRS_PROTO_IPV4V6,
43 enum ofono_gprs_context_type {
44 OFONO_GPRS_CONTEXT_TYPE_ANY = 0,
45 OFONO_GPRS_CONTEXT_TYPE_INTERNET,
46 OFONO_GPRS_CONTEXT_TYPE_MMS,
47 OFONO_GPRS_CONTEXT_TYPE_WAP,
48 OFONO_GPRS_CONTEXT_TYPE_IMS,
51 struct ofono_gprs_primary_context {
54 char apn[OFONO_GPRS_MAX_APN_LENGTH + 1];
55 char username[OFONO_GPRS_MAX_USERNAME_LENGTH + 1];
56 char password[OFONO_GPRS_MAX_PASSWORD_LENGTH + 1];
57 enum ofono_gprs_proto proto;
60 typedef void (*ofono_gprs_context_cb_t)(const struct ofono_error *error,
63 struct ofono_gprs_context_driver {
65 int (*probe)(struct ofono_gprs_context *gc, unsigned int vendor,
67 void (*remove)(struct ofono_gprs_context *gc);
68 void (*activate_primary)(struct ofono_gprs_context *gc,
69 const struct ofono_gprs_primary_context *ctx,
70 ofono_gprs_context_cb_t cb, void *data);
71 void (*deactivate_primary)(struct ofono_gprs_context *gc,
73 ofono_gprs_context_cb_t cb, void *data);
76 void ofono_gprs_context_deactivated(struct ofono_gprs_context *gc,
79 int ofono_gprs_context_driver_register(
80 const struct ofono_gprs_context_driver *d);
81 void ofono_gprs_context_driver_unregister(
82 const struct ofono_gprs_context_driver *d);
84 struct ofono_gprs_context *ofono_gprs_context_create(struct ofono_modem *modem,
86 const char *driver, void *data);
87 void ofono_gprs_context_remove(struct ofono_gprs_context *gc);
89 void ofono_gprs_context_set_data(struct ofono_gprs_context *gc, void *data);
90 void *ofono_gprs_context_get_data(struct ofono_gprs_context *gc);
92 struct ofono_modem *ofono_gprs_context_get_modem(struct ofono_gprs_context *gc);
94 void ofono_gprs_context_set_type(struct ofono_gprs_context *gc,
95 enum ofono_gprs_context_type type);
97 void ofono_gprs_context_set_interface(struct ofono_gprs_context *gc,
98 const char *interface);
100 void ofono_gprs_context_set_ipv4_address(struct ofono_gprs_context *gc,
102 ofono_bool_t static_ip);
103 void ofono_gprs_context_set_ipv4_netmask(struct ofono_gprs_context *gc,
104 const char *netmask);
105 void ofono_gprs_context_set_ipv4_gateway(struct ofono_gprs_context *gc,
106 const char *gateway);
107 void ofono_gprs_context_set_ipv4_dns_servers(struct ofono_gprs_context *gc,
110 void ofono_gprs_context_set_ipv6_address(struct ofono_gprs_context *gc,
111 const char *address);
112 void ofono_gprs_context_set_ipv6_prefix_length(struct ofono_gprs_context *gc,
113 unsigned char length);
114 void ofono_gprs_context_set_ipv6_gateway(struct ofono_gprs_context *gc,
115 const char *gateway);
116 void ofono_gprs_context_set_ipv6_dns_servers(struct ofono_gprs_context *gc,
122 #endif /* __OFONO_GPRS_CONTEXT_H */