summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDante Russo <drusso@codeaurora.org>2014-07-25 15:16:17 -0700
committerVineeta Srivastava <vsrivastava@google.com>2014-08-01 16:17:02 +0000
commit0d00b9e0690547ad06eef43a5f1c77a31e8885dc (patch)
tree29a285080388bb227571f7fa886a1b195528a77e
parent1d4940024c54e7d1e63f73edd5054a18a7a01b63 (diff)
downloadgps-0d00b9e0690547ad06eef43a5f1c77a31e8885dc.tar.gz
Add support for IPV6 in AGPS Interface
AGPS interface now has support for IPV6 and IPV6V4 APN types. bug: 16632856 Change-Id: I30504227fdbffcac9c5eec1fdd5fafb61358e36d
-rw-r--r--core/gps_extended_c.h2
-rw-r--r--loc_api/libloc_api_50001/loc.cpp52
-rw-r--r--loc_api/libloc_api_50001/loc_eng_agps.cpp4
-rw-r--r--loc_api/libloc_api_50001/loc_eng_agps.h12
4 files changed, 64 insertions, 6 deletions
diff --git a/core/gps_extended_c.h b/core/gps_extended_c.h
index ed1d4ca..76a4927 100644
--- a/core/gps_extended_c.h
+++ b/core/gps_extended_c.h
@@ -155,7 +155,7 @@ typedef struct {
AGpsExtType type;
AGpsStatusValue status;
uint32_t ipv4_addr;
- char ipv6_addr[16];
+ struct sockaddr_storage addr;
char ssid[SSID_BUF_SIZE];
char password[SSID_BUF_SIZE];
} AGpsExtStatus;
diff --git a/loc_api/libloc_api_50001/loc.cpp b/loc_api/libloc_api_50001/loc.cpp
index c753626..7a44f24 100644
--- a/loc_api/libloc_api_50001/loc.cpp
+++ b/loc_api/libloc_api_50001/loc.cpp
@@ -99,15 +99,17 @@ static int loc_agps_open(const char* apn);
static int loc_agps_closed();
static int loc_agps_open_failed();
static int loc_agps_set_server(AGpsType type, const char *hostname, int port);
+static int loc_agps_open_with_apniptype( const char* apn, ApnIpType apnIpType);
-static const AGpsInterface_v1 sLocEngAGpsInterface =
+static const AGpsInterface sLocEngAGpsInterface =
{
- sizeof(AGpsInterface_v1),
+ sizeof(AGpsInterface),
loc_agps_init,
loc_agps_open,
loc_agps_closed,
loc_agps_open_failed,
- loc_agps_set_server
+ loc_agps_set_server,
+ loc_agps_open_with_apniptype
};
static int loc_xtra_init(GpsXtraCallbacks* callbacks);
@@ -767,6 +769,50 @@ static int loc_agps_open(const char* apn)
}
/*===========================================================================
+FUNCTION loc_agps_open_with_apniptype
+
+DESCRIPTION
+ This function is called when on-demand data connection opening is successful.
+It should inform ARM 9 about the data open result.
+
+DEPENDENCIES
+ NONE
+
+RETURN VALUE
+ 0
+
+SIDE EFFECTS
+ N/A
+
+===========================================================================*/
+static int loc_agps_open_with_apniptype(const char* apn, ApnIpType apnIpType)
+{
+ ENTRY_LOG();
+ AGpsType agpsType = AGPS_TYPE_SUPL;
+ AGpsBearerType bearerType;
+
+ switch (apnIpType) {
+ case APN_IP_IPV4:
+ bearerType = AGPS_APN_BEARER_IPV4;
+ break;
+ case APN_IP_IPV6:
+ bearerType = AGPS_APN_BEARER_IPV6;
+ break;
+ case APN_IP_IPV4V6:
+ bearerType = AGPS_APN_BEARER_IPV4V6;
+ break;
+ default:
+ bearerType = AGPS_APN_BEARER_INVALID;
+ break;
+ }
+
+ int ret_val = loc_eng_agps_open(loc_afw_data, agpsType, apn, bearerType);
+
+ EXIT_LOG(%d, ret_val);
+ return ret_val;
+}
+
+/*===========================================================================
FUNCTION loc_agps_closed
DESCRIPTION
diff --git a/loc_api/libloc_api_50001/loc_eng_agps.cpp b/loc_api/libloc_api_50001/loc_eng_agps.cpp
index d6cc136..5016b5c 100644
--- a/loc_api/libloc_api_50001/loc_eng_agps.cpp
+++ b/loc_api/libloc_api_50001/loc_eng_agps.cpp
@@ -762,11 +762,11 @@ int AgpsStateMachine::sendRsrcRequest(AGpsStatusValue action) const
if (s == NULL) {
nifRequest.ipv4_addr = INADDR_NONE;
- nifRequest.ipv6_addr[0] = 0;
+ memset(&nifRequest.addr, 0, sizeof(nifRequest.addr));
nifRequest.ssid[0] = '\0';
nifRequest.password[0] = '\0';
} else {
- s->setIPAddresses(nifRequest.ipv4_addr, (char*)nifRequest.ipv6_addr);
+ s->setIPAddresses(nifRequest.addr);
s->setWifiInfo(nifRequest.ssid, nifRequest.password);
}
diff --git a/loc_api/libloc_api_50001/loc_eng_agps.h b/loc_api/libloc_api_50001/loc_eng_agps.h
index 055d955..2d689ce 100644
--- a/loc_api/libloc_api_50001/loc_eng_agps.h
+++ b/loc_api/libloc_api_50001/loc_eng_agps.h
@@ -276,6 +276,7 @@ struct Subscriber {
inline virtual ~Subscriber() {}
virtual void setIPAddresses(uint32_t &v4, char* v6) = 0;
+ virtual void setIPAddresses(struct sockaddr_storage& addr) = 0;
inline virtual void setWifiInfo(char* ssid, char* password)
{ ssid[0] = 0; password[0] = 0; }
@@ -316,6 +317,9 @@ struct BITSubscriber : public Subscriber {
inline virtual void setIPAddresses(uint32_t &v4, char* v6)
{ v4 = ID; memcpy(v6, mIPv6Addr, sizeof(mIPv6Addr)); }
+ inline virtual void setIPAddresses(struct sockaddr_storage& addr)
+ { addr.ss_family = AF_INET6;/*todo: convert mIPv6Addr into addr */ }
+
virtual Subscriber* clone()
{
return new BITSubscriber(mStateMachine, ID, mIPv6Addr);
@@ -340,6 +344,9 @@ struct ATLSubscriber : public Subscriber {
inline virtual void setIPAddresses(uint32_t &v4, char* v6)
{ v4 = INADDR_NONE; v6[0] = 0; }
+ inline virtual void setIPAddresses(struct sockaddr_storage& addr)
+ { addr.ss_family = AF_INET6; }
+
inline virtual Subscriber* clone()
{
return new ATLSubscriber(ID, mStateMachine, mLocAdapter,
@@ -372,6 +379,9 @@ struct WIFISubscriber : public Subscriber {
inline virtual void setIPAddresses(uint32_t &v4, char* v6) {}
+ inline virtual void setIPAddresses(struct sockaddr_storage& addr)
+ { addr.ss_family = AF_INET6; }
+
inline virtual void setWifiInfo(char* ssid, char* password)
{
if (NULL != mSSID)
@@ -405,6 +415,8 @@ struct DSSubscriber : public Subscriber {
mIsInactive = false;
}
inline virtual void setIPAddresses(uint32_t &v4, char* v6) {}
+ inline virtual void setIPAddresses(struct sockaddr_storage& addr)
+ { addr.ss_family = AF_INET6; }
virtual Subscriber* clone()
{return new DSSubscriber(mStateMachine, ID);}
virtual bool notifyRsrcStatus(Notification &notification);