diff options
author | Robert Greenwalt <rgreenwalt@google.com> | 2014-12-08 23:33:48 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-12-08 23:33:49 +0000 |
commit | 257ba4e389b21e0b56510017d60e90753cb074c1 (patch) | |
tree | 8cf2acd2ef354287d47ee0444fa376d4cfc5a69b | |
parent | 496a71cfd58fb10b621a6e1b3205929908bcd86d (diff) | |
parent | b44dda3ea5bbbadb910479019f967b52cf9d69c7 (diff) | |
download | android_hardware_ril-257ba4e389b21e0b56510017d60e90753cb074c1.tar.gz android_hardware_ril-257ba4e389b21e0b56510017d60e90753cb074c1.tar.bz2 android_hardware_ril-257ba4e389b21e0b56510017d60e90753cb074c1.zip |
Merge "Modify RIL_Data_Call_Response to include MTU" into lmp-mr1-dev
-rw-r--r-- | include/telephony/ril.h | 42 | ||||
-rw-r--r-- | libril/ril.cpp | 80 | ||||
-rw-r--r-- | reference-ril/reference-ril.c | 15 |
3 files changed, 115 insertions, 22 deletions
diff --git a/include/telephony/ril.h b/include/telephony/ril.h index ccc40d9..62521f4 100644 --- a/include/telephony/ril.h +++ b/include/telephony/ril.h @@ -46,7 +46,7 @@ extern "C" { #define SIM_COUNT 1 #endif -#define RIL_VERSION 10 /* Current version */ +#define RIL_VERSION 11 /* Current version */ #define RIL_VERSION_MIN 6 /* Minimum RIL_VERSION supported */ #define CDMA_ALPHA_INFO_BUFFER_LENGTH 64 @@ -379,7 +379,43 @@ typedef struct { to point connections. */ char * pcscf; /* the Proxy Call State Control Function address via PCO(Protocol Configuration Option) for IMS client. */ -} RIL_Data_Call_Response_v9; // FIXME: Change to v10 +} RIL_Data_Call_Response_v9; + +typedef struct { + int status; /* A RIL_DataCallFailCause, 0 which is PDP_FAIL_NONE if no error */ + int suggestedRetryTime; /* If status != 0, this fields indicates the suggested retry + back-off timer value RIL wants to override the one + pre-configured in FW. + The unit is miliseconds. + The value < 0 means no value is suggested. + The value 0 means retry should be done ASAP. + The value of INT_MAX(0x7fffffff) means no retry. */ + int cid; /* Context ID, uniquely identifies this call */ + int active; /* 0=inactive, 1=active/physical link down, 2=active/physical link up */ + char * type; /* One of the PDP_type values in TS 27.007 section 10.1.1. + For example, "IP", "IPV6", "IPV4V6", or "PPP". If status is + PDP_FAIL_ONLY_SINGLE_BEARER_ALLOWED this is the type supported + such as "IP" or "IPV6" */ + char * ifname; /* The network interface name */ + char * addresses; /* A space-delimited list of addresses with optional "/" prefix length, + e.g., "192.0.1.3" or "192.0.1.11/16 2001:db8::1/64". + May not be empty, typically 1 IPv4 or 1 IPv6 or + one of each. If the prefix length is absent the addresses + are assumed to be point to point with IPv4 having a prefix + length of 32 and IPv6 128. */ + char * dnses; /* A space-delimited list of DNS server addresses, + e.g., "192.0.1.3" or "192.0.1.11 2001:db8::1". + May be empty. */ + char * gateways; /* A space-delimited list of default gateway addresses, + e.g., "192.0.1.3" or "192.0.1.11 2001:db8::1". + May be empty in which case the addresses represent point + to point connections. */ + char * pcscf; /* the Proxy Call State Control Function address + via PCO(Protocol Configuration Option) for IMS client. */ + int mtu; /* MTU received from network + Value <= 0 means network has either not sent a value or + sent an invalid value */ +} RIL_Data_Call_Response_v11; typedef enum { RADIO_TECH_3GPP = 1, /* 3GPP Technologies - GSM, WCDMA */ @@ -2103,7 +2139,7 @@ typedef struct { * For example, "IP", "IPV6", "IPV4V6", or "PPP". * ((const char **)data)[7] Optional connection property parameters, format to be defined. * - * "response" is a RIL_Data_Call_Response_v6 + * "response" is a RIL_Data_Call_Response_v11 * * FIXME may need way to configure QoS settings * diff --git a/libril/ril.cpp b/libril/ril.cpp index 0f244c3..a1105b4 100644 --- a/libril/ril.cpp +++ b/libril/ril.cpp @@ -2410,36 +2410,86 @@ static int responseDataCallListV6(Parcel &p, void *response, size_t responselen) return 0; } +static int responseDataCallListV9(Parcel &p, void *response, size_t responselen) +{ + if (response == NULL && responselen != 0) { + RLOGE("invalid response: NULL"); + return RIL_ERRNO_INVALID_RESPONSE; + } + + if (responselen % sizeof(RIL_Data_Call_Response_v9) != 0) { + RLOGE("responseDataCallListV9: invalid response length %d expected multiple of %d", + (int)responselen, (int)sizeof(RIL_Data_Call_Response_v9)); + return RIL_ERRNO_INVALID_RESPONSE; + } + + // Write version + p.writeInt32(10); + + int num = responselen / sizeof(RIL_Data_Call_Response_v9); + p.writeInt32(num); + + RIL_Data_Call_Response_v9 *p_cur = (RIL_Data_Call_Response_v9 *) response; + startResponse; + int i; + for (i = 0; i < num; i++) { + p.writeInt32((int)p_cur[i].status); + p.writeInt32(p_cur[i].suggestedRetryTime); + p.writeInt32(p_cur[i].cid); + p.writeInt32(p_cur[i].active); + writeStringToParcel(p, p_cur[i].type); + writeStringToParcel(p, p_cur[i].ifname); + writeStringToParcel(p, p_cur[i].addresses); + writeStringToParcel(p, p_cur[i].dnses); + writeStringToParcel(p, p_cur[i].gateways); + writeStringToParcel(p, p_cur[i].pcscf); + appendPrintBuf("%s[status=%d,retry=%d,cid=%d,%s,%s,%s,%s,%s,%s,%s],", printBuf, + p_cur[i].status, + p_cur[i].suggestedRetryTime, + p_cur[i].cid, + (p_cur[i].active==0)?"down":"up", + (char*)p_cur[i].type, + (char*)p_cur[i].ifname, + (char*)p_cur[i].addresses, + (char*)p_cur[i].dnses, + (char*)p_cur[i].gateways, + (char*)p_cur[i].pcscf); + } + removeLastChar; + closeResponse; + + return 0; +} + + static int responseDataCallList(Parcel &p, void *response, size_t responselen) { if (s_callbacks.version < 5) { RLOGD("responseDataCallList: v4"); return responseDataCallListV4(p, response, responselen); + } else if (responselen % sizeof(RIL_Data_Call_Response_v6) == 0) { + return responseDataCallListV6(p, response, responselen); + } else if (responselen % sizeof(RIL_Data_Call_Response_v9) == 0) { + return responseDataCallListV9(p, response, responselen); } else { if (response == NULL && responselen != 0) { RLOGE("invalid response: NULL"); return RIL_ERRNO_INVALID_RESPONSE; } - // Support v6 or v9 with new rils - if (responselen % sizeof(RIL_Data_Call_Response_v6) == 0) { - RLOGD("responseDataCallList: v6"); - return responseDataCallListV6(p, response, responselen); - } - - if (responselen % sizeof(RIL_Data_Call_Response_v9) != 0) { - RLOGE("responseDataCallList: invalid response length %d expected multiple of %d", - (int)responselen, (int)sizeof(RIL_Data_Call_Response_v9)); + if (responselen % sizeof(RIL_Data_Call_Response_v11) != 0) { + RLOGE("invalid response length %d expected multiple of %d", + (int)responselen, (int)sizeof(RIL_Data_Call_Response_v11)); return RIL_ERRNO_INVALID_RESPONSE; } // Write version - p.writeInt32(10); + p.writeInt32(11); - int num = responselen / sizeof(RIL_Data_Call_Response_v9); + int num = responselen / sizeof(RIL_Data_Call_Response_v11); p.writeInt32(num); - RIL_Data_Call_Response_v9 *p_cur = (RIL_Data_Call_Response_v9 *) response; + RIL_Data_Call_Response_v11 *p_cur = (RIL_Data_Call_Response_v11 *) response; startResponse; int i; for (i = 0; i < num; i++) { @@ -2453,7 +2503,8 @@ static int responseDataCallList(Parcel &p, void *response, size_t responselen) writeStringToParcel(p, p_cur[i].dnses); writeStringToParcel(p, p_cur[i].gateways); writeStringToParcel(p, p_cur[i].pcscf); - appendPrintBuf("%s[status=%d,retry=%d,cid=%d,%s,%s,%s,%s,%s,%s,%s],", printBuf, + p.writeInt32(p_cur[i].mtu); + appendPrintBuf("%s[status=%d,retry=%d,cid=%d,%s,%s,%s,%s,%s,%s,%s,mtu=%d],", printBuf, p_cur[i].status, p_cur[i].suggestedRetryTime, p_cur[i].cid, @@ -2463,7 +2514,8 @@ static int responseDataCallList(Parcel &p, void *response, size_t responselen) (char*)p_cur[i].addresses, (char*)p_cur[i].dnses, (char*)p_cur[i].gateways, - (char*)p_cur[i].pcscf); + (char*)p_cur[i].pcscf, + p_cur[i].mtu); } removeLastChar; closeResponse; diff --git a/reference-ril/reference-ril.c b/reference-ril/reference-ril.c index a3f24c7..45340e3 100644 --- a/reference-ril/reference-ril.c +++ b/reference-ril/reference-ril.c @@ -51,6 +51,9 @@ static void *noopRemoveWarning( void *a ) { return a; } /* pathname returned from RIL_REQUEST_SETUP_DATA_CALL / RIL_REQUEST_SETUP_DEFAULT_PDP */ #define PPP_TTY_PATH "eth0" +// Default MTU value +#define DEFAULT_MTU 1500 + #ifdef USE_TI_COMMANDS // Enable a workaround @@ -449,8 +452,8 @@ static void requestOrSendDataCallList(RIL_Token *t) p_cur = p_cur->p_next) n++; - RIL_Data_Call_Response_v9 *responses = - alloca(n * sizeof(RIL_Data_Call_Response_v9)); + RIL_Data_Call_Response_v11 *responses = + alloca(n * sizeof(RIL_Data_Call_Response_v11)); int i; for (i = 0; i < n; i++) { @@ -464,9 +467,10 @@ static void requestOrSendDataCallList(RIL_Token *t) responses[i].dnses = ""; responses[i].gateways = ""; responses[i].pcscf = ""; + responses[i].mtu = 0; } - RIL_Data_Call_Response_v9 *response = responses; + RIL_Data_Call_Response_v11 *response = responses; for (p_cur = p_response->p_intermediates; p_cur != NULL; p_cur = p_cur->p_next) { char *line = p_cur->line; @@ -583,6 +587,7 @@ static void requestOrSendDataCallList(RIL_Token *t) /* There is only on gateway in the emulator */ responses[i].gateways = "10.0.2.2"; + responses[i].mtu = DEFAULT_MTU; } else { /* I don't know where we are, so use the public Google DNS @@ -598,11 +603,11 @@ static void requestOrSendDataCallList(RIL_Token *t) if (t != NULL) RIL_onRequestComplete(*t, RIL_E_SUCCESS, responses, - n * sizeof(RIL_Data_Call_Response_v9)); + n * sizeof(RIL_Data_Call_Response_v11)); else RIL_onUnsolicitedResponse(RIL_UNSOL_DATA_CALL_LIST_CHANGED, responses, - n * sizeof(RIL_Data_Call_Response_v9)); + n * sizeof(RIL_Data_Call_Response_v11)); return; |