Loading telephony/common/com/android/internal/telephony/SipMessageParsingUtils.java +16 −2 Original line number Diff line number Diff line Loading @@ -80,6 +80,15 @@ public class SipMessageParsingUtils { return verifySipRequest(splitLine); } /** * @return true if the SIP message start line is considered a response. */ public static boolean isSipResponse(String startLine) { String[] splitLine = splitStartLineAndVerify(startLine); if (splitLine == null) return false; return verifySipResponse(splitLine); } /** * Return the via branch parameter, which is used to identify the transaction ID (request and * response pair) in a SIP transaction. Loading Loading @@ -140,7 +149,12 @@ public class SipMessageParsingUtils { return !headers.isEmpty() ? headers.get(0).second : null; } private static String[] splitStartLineAndVerify(String startLine) { /** * Validate that the start line is correct and split into its three segments. * @param startLine The start line to verify and split. * @return The split start line, which will always have three segments. */ public static String[] splitStartLineAndVerify(String startLine) { String[] splitLine = startLine.split(" "); if (isStartLineMalformed(splitLine)) return null; return splitLine; Loading Loading @@ -184,7 +198,7 @@ public class SipMessageParsingUtils { * (This is internally an equalsIgnoreMatch comparison). * @return the matched header keys and values. */ private static List<Pair<String, String>> parseHeaders(String headerString, public static List<Pair<String, String>> parseHeaders(String headerString, boolean stopAtFirstMatch, String... matchingHeaderKeys) { // Ensure there is no leading whitespace headerString = removeLeadingWhitespace(headerString); Loading telephony/java/android/telephony/ims/SipDelegateManager.java +7 −2 Original line number Diff line number Diff line Loading @@ -80,13 +80,18 @@ public class SipDelegateManager { public static final int MESSAGE_FAILURE_REASON_DELEGATE_CLOSED = 2; /** * The SIP message has an invalid start line and the message can not be sent. * The SIP message has an invalid start line and the message can not be sent or the start line * failed validation due to the request containing a restricted SIP request method. * {@link SipDelegateConnection}s can not send SIP requests for the methods: REGISTER, PUBLISH, * or OPTIONS. */ public static final int MESSAGE_FAILURE_REASON_INVALID_START_LINE = 3; /** * One or more of the header fields in the header section of the outgoing SIP message is invalid * and the SIP message can not be sent. * or contains a restricted header value and the SIP message can not be sent. * {@link SipDelegateConnection}s can not send SIP SUBSCRIBE requests for the "Event" header * value of "presence". */ public static final int MESSAGE_FAILURE_REASON_INVALID_HEADER_FIELDS = 4; Loading Loading
telephony/common/com/android/internal/telephony/SipMessageParsingUtils.java +16 −2 Original line number Diff line number Diff line Loading @@ -80,6 +80,15 @@ public class SipMessageParsingUtils { return verifySipRequest(splitLine); } /** * @return true if the SIP message start line is considered a response. */ public static boolean isSipResponse(String startLine) { String[] splitLine = splitStartLineAndVerify(startLine); if (splitLine == null) return false; return verifySipResponse(splitLine); } /** * Return the via branch parameter, which is used to identify the transaction ID (request and * response pair) in a SIP transaction. Loading Loading @@ -140,7 +149,12 @@ public class SipMessageParsingUtils { return !headers.isEmpty() ? headers.get(0).second : null; } private static String[] splitStartLineAndVerify(String startLine) { /** * Validate that the start line is correct and split into its three segments. * @param startLine The start line to verify and split. * @return The split start line, which will always have three segments. */ public static String[] splitStartLineAndVerify(String startLine) { String[] splitLine = startLine.split(" "); if (isStartLineMalformed(splitLine)) return null; return splitLine; Loading Loading @@ -184,7 +198,7 @@ public class SipMessageParsingUtils { * (This is internally an equalsIgnoreMatch comparison). * @return the matched header keys and values. */ private static List<Pair<String, String>> parseHeaders(String headerString, public static List<Pair<String, String>> parseHeaders(String headerString, boolean stopAtFirstMatch, String... matchingHeaderKeys) { // Ensure there is no leading whitespace headerString = removeLeadingWhitespace(headerString); Loading
telephony/java/android/telephony/ims/SipDelegateManager.java +7 −2 Original line number Diff line number Diff line Loading @@ -80,13 +80,18 @@ public class SipDelegateManager { public static final int MESSAGE_FAILURE_REASON_DELEGATE_CLOSED = 2; /** * The SIP message has an invalid start line and the message can not be sent. * The SIP message has an invalid start line and the message can not be sent or the start line * failed validation due to the request containing a restricted SIP request method. * {@link SipDelegateConnection}s can not send SIP requests for the methods: REGISTER, PUBLISH, * or OPTIONS. */ public static final int MESSAGE_FAILURE_REASON_INVALID_START_LINE = 3; /** * One or more of the header fields in the header section of the outgoing SIP message is invalid * and the SIP message can not be sent. * or contains a restricted header value and the SIP message can not be sent. * {@link SipDelegateConnection}s can not send SIP SUBSCRIBE requests for the "Event" header * value of "presence". */ public static final int MESSAGE_FAILURE_REASON_INVALID_HEADER_FIELDS = 4; Loading