You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ro...@apache.org on 2007/12/30 15:19:51 UTC

svn commit: r607546 - in /httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/sip: ./ EnglishSipReasonPhraseCatalog.java SipException.java SipStatus.java SipVersion.java

Author: rolandw
Date: Sun Dec 30 06:19:48 2007
New Revision: 607546

URL: http://svn.apache.org/viewvc?rev=607546&view=rev
Log:
initial classes for SIP support

Added:
    httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/sip/
    httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/sip/EnglishSipReasonPhraseCatalog.java   (with props)
    httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/sip/SipException.java   (with props)
    httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/sip/SipStatus.java   (with props)
    httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/sip/SipVersion.java   (with props)

Added: httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/sip/EnglishSipReasonPhraseCatalog.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/sip/EnglishSipReasonPhraseCatalog.java?rev=607546&view=auto
==============================================================================
--- httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/sip/EnglishSipReasonPhraseCatalog.java (added)
+++ httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/sip/EnglishSipReasonPhraseCatalog.java Sun Dec 30 06:19:48 2007
@@ -0,0 +1,248 @@
+/*
+ * $HeadURL$
+ * $Revision$
+ * $Date$
+ *
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.http.contrib.sip;
+
+import java.util.Locale;
+import java.util.Map;
+import java.util.HashMap;
+
+import org.apache.http.ReasonPhraseCatalog;
+
+
+/**
+ * English reason phrases for SIP status codes.
+ * All status codes defined in RFC 3261 (SIP/2.0)
+ * and RFC 3265 (SIP-Specific Event Notification)
+ * are supported.
+ * 
+ * @author <a href="mailto:rolandw at apache.org">Roland Weber</a>
+ * 
+ * @version $Revision$
+ */
+public class EnglishSipReasonPhraseCatalog
+    implements ReasonPhraseCatalog {
+
+    // static map with english reason phrases defined below
+
+    /**
+     * The default instance of this catalog.
+     * This catalog is thread safe, so there typically
+     * is no need to create other instances.
+     */
+    public final static EnglishSipReasonPhraseCatalog INSTANCE =
+        new EnglishSipReasonPhraseCatalog();
+
+
+    /**
+     * Restricted default constructor, for derived classes.
+     * If you need an instance of this class, use {@link #INSTANCE INSTANCE}.
+     */
+    protected EnglishSipReasonPhraseCatalog() {
+        // no body
+    }
+
+
+    /**
+     * Obtains the reason phrase for a status code.
+     *
+     * @param status    the status code, in the range 100-699
+     * @param loc       ignored
+     *
+     * @return  the reason phrase, or <code>null</code>
+     */
+    public String getReason(int status, Locale loc) {
+        if ((status < 100) || (status >= 700)) {
+            throw new IllegalArgumentException
+                ("Unknown category for status code " + status + ".");
+        }
+
+        // Unlike HTTP status codes, those for SIP are not compact
+        // in each category. We therefore use a map for lookup.
+
+        return REASON_PHRASES.get(Integer.valueOf(status));
+    }
+
+
+
+    /**
+     * Reason phrases lookup table.
+     * Since this attribute is private and never exposed,
+     * we don't need to turn it into an unmodifiable map.
+     */
+    // see below for static initialization
+    private static final
+        Map<Integer,String> REASON_PHRASES = new HashMap<Integer,String>();
+
+
+
+    /**
+     * Stores the given reason phrase, by status code.
+     * Helper method to initialize the static lookup map.
+     *
+     * @param status    the status code for which to define the phrase
+     * @param reason    the reason phrase for this status code
+     */
+    private static void setReason(int status, String reason) {
+        REASON_PHRASES.put(Integer.valueOf(status), reason);
+    }
+
+
+    // ----------------------------------------------------- Static Initializer
+
+    /** Set up status code to "reason phrase" map. */
+    static {
+
+        // --- 1xx Informational ---
+        setReason(SipStatus.SC_CONTINUE,
+                  "Trying");
+        setReason(SipStatus.SC_RINGING,
+                  "Ringing");
+        setReason(SipStatus.SC_CALL_IS_BEING_FORWARDED,
+                  "Call Is Being Forwarded");
+        setReason(SipStatus.SC_QUEUED,
+                  "Queued");
+        setReason(SipStatus.SC_SESSION_PROGRESS,
+                  "Session Progress");
+
+
+        // --- 2xx Successful ---
+        setReason(SipStatus.SC_OK,
+                  "OK");
+        setReason(SipStatus.SC_ACCEPTED,
+                  "Accepted");
+
+
+        // --- 3xx Redirection ---
+        setReason(SipStatus.SC_MULTIPLE_CHOICES,
+                  "Multiple Choices");
+        setReason(SipStatus.SC_MOVED_PERMANENTLY,
+                  "Moved Permanently");
+        setReason(SipStatus.SC_MOVED_TEMPORARILY,
+                  "Moved Temporarily");
+        setReason(SipStatus.SC_USE_PROXY,
+                  "Use Proxy");
+        setReason(SipStatus.SC_ALTERNATIVE_SERVICE,
+                  "Alternative Service");
+
+
+        // --- 4xx Request Failure ---
+        setReason(SipStatus.SC_BAD_REQUEST,
+                  "Bad Request");
+        setReason(SipStatus.SC_UNAUTHORIZED,
+                  "Unauthorized");
+        setReason(SipStatus.SC_PAYMENT_REQUIRED,
+                  "Payment Required");
+        setReason(SipStatus.SC_FORBIDDEN,
+                  "Forbidden");
+        setReason(SipStatus.SC_NOT_FOUND,
+                  "Not Found");
+        setReason(SipStatus.SC_METHOD_NOT_ALLOWED,
+                  "Method Not Allowed");
+        setReason(SipStatus.SC_NOT_ACCEPTABLE,
+                  "Not Acceptable");
+        setReason(SipStatus.SC_PROXY_AUTHENTICATION_REQUIRED,
+                  "Proxy Authentication Required");
+        setReason(SipStatus.SC_REQUEST_TIMEOUT,
+                  "Request Timeout");
+        setReason(SipStatus.SC_GONE,
+                  "Gone");
+        setReason(SipStatus.SC_REQUEST_ENTITY_TOO_LARGE,
+                  "Request Entity Too Large");
+        setReason(SipStatus.SC_REQUEST_URI_TOO_LONG,
+                  "Request-URI Too Long");
+        setReason(SipStatus.SC_UNSUPPORTED_MEDIA_TYPE,
+                  "Unsupported Media Type");
+        setReason(SipStatus.SC_UNSUPPORTED_URI_SCHEME,
+                  "Unsupported URI Scheme");
+        setReason(SipStatus.SC_BAD_EXTENSION,
+                  "Bad Extension");
+        setReason(SipStatus.SC_EXTENSION_REQUIRED,
+                  "Extension Required");
+        setReason(SipStatus.SC_INTERVAL_TOO_BRIEF,
+                  "Interval Too Brief");
+        setReason(SipStatus.SC_TEMPORARILY_UNAVAILABLE,
+                  "Temporarily Unavailable");
+        setReason(SipStatus.SC_CALL_TRANSACTION_DOES_NOT_EXIST,
+                  "Call/Transaction Does Not Exist");
+        setReason(SipStatus.SC_LOOP_DETECTED,
+                  "Loop Detected");
+        setReason(SipStatus.SC_TOO_MANY_HOPS,
+                  "Too Many Hops");
+        setReason(SipStatus.SC_ADDRESS_INCOMPLETE,
+                  "Address Incomplete");
+        setReason(SipStatus.SC_AMBIGUOUS,
+                  "Ambiguous");
+        setReason(SipStatus.SC_BUSY_HERE,
+                  "Busy Here");
+        setReason(SipStatus.SC_REQUEST_TERMINATED,
+                  "Request Terminated");
+        setReason(SipStatus.SC_NOT_ACCEPTABLE_HERE,
+                  "Not Acceptable Here");
+        setReason(SipStatus.SC_BAD_EVENT,
+                  "Bad Event");
+        setReason(SipStatus.SC_REQUEST_PENDING,
+                  "Request Pending");
+        setReason(SipStatus.SC_UNDECIPHERABLE,
+                  "Undecipherable");
+
+
+        // --- 5xx Server Failure ---
+        setReason(SipStatus.SC_SERVER_INTERNAL_ERROR,
+                  "Server Internal Error");
+        setReason(SipStatus.SC_NOT_IMPLEMENTED,
+                  "Not Implemented");
+        setReason(SipStatus.SC_BAD_GATEWAY,
+                  "Bad Gateway");
+        setReason(SipStatus.SC_SERVICE_UNAVAILABLE,
+                  "Service Unavailable");
+        setReason(SipStatus.SC_SERVER_TIMEOUT,
+                  "Server Time-out");
+        setReason(SipStatus.SC_VERSION_NOT_SUPPORTED,
+                  "Version Not Supported");
+        setReason(SipStatus.SC_MESSAGE_TOO_LARGE,
+                  "Message Too Large");
+
+
+        // --- 6xx Global Failures ---
+        setReason(SipStatus.SC_BUSY_EVERYWHERE,
+                  "Busy Everywhere");
+        setReason(SipStatus.SC_DECLINE,
+                  "Decline");
+        setReason(SipStatus.SC_DOES_NOT_EXIST_ANYWHERE,
+                  "Does Not Exist Anywhere");
+        setReason(SipStatus.SC_NOT_ACCEPTABLE_ANYWHERE,
+                  "Not Acceptable");
+
+    } // static initializer
+
+
+}

Propchange: httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/sip/EnglishSipReasonPhraseCatalog.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/sip/EnglishSipReasonPhraseCatalog.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/sip/EnglishSipReasonPhraseCatalog.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/sip/SipException.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/sip/SipException.java?rev=607546&view=auto
==============================================================================
--- httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/sip/SipException.java (added)
+++ httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/sip/SipException.java Sun Dec 30 06:19:48 2007
@@ -0,0 +1,79 @@
+/*
+ * $HeadURL$
+ * $Revision$
+ * $Date$
+ *
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.http.contrib.sip;
+
+
+import org.apache.http.HttpException;
+
+
+/**
+ * Signals that an SIP exception has occurred.
+ * This is for protocol errors specific to SIP,
+ * as opposed to protocol errors shared with HTTP.
+ * 
+ * @author <a href="mailto:rolandw at apache.org">Roland Weber</a>
+ * 
+ * @version $Revision$
+ */
+public class SipException extends HttpException {
+
+    private static final long serialVersionUID = 337592534308025800L;
+	
+    /**
+     * Creates a new SipException with a <tt>null</tt> detail message.
+     */
+    public SipException() {
+        super();
+    }
+
+    /**
+     * Creates a new SipException with the specified detail message.
+     *
+     * @param message the exception detail message
+     */
+    public SipException(final String message) {
+        super(message);
+    }
+
+    /**
+     * Creates a new SipException with the specified detail message and cause.
+     * 
+     * @param message the exception detail message
+     * @param cause   the <tt>Throwable</tt> that caused this exception, or
+     *                <tt>null</tt> if the cause is unavailable, unknown, or
+     *                not a <tt>Throwable</tt>
+     */
+    public SipException(final String message, final Throwable cause) {
+        super(message, cause);
+    }
+
+}

Propchange: httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/sip/SipException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/sip/SipException.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/sip/SipException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/sip/SipStatus.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/sip/SipStatus.java?rev=607546&view=auto
==============================================================================
--- httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/sip/SipStatus.java (added)
+++ httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/sip/SipStatus.java Sun Dec 30 06:19:48 2007
@@ -0,0 +1,233 @@
+/*
+ * $HeadURL$
+ * $Revision$
+ * $Date$
+ *
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.http.contrib.sip;
+
+/**
+ * Constants enumerating the SIP status codes.
+ * All status codes defined in RFC 3261 (SIP/2.0)
+ * and RFC 3265 (SIP-Specific Event Notification)
+ * are listed.
+ * 
+ * @author <a href="mailto:rolandw at apache.org">Roland Weber</a>
+ * 
+ * @version $Revision$
+ */
+public interface SipStatus {
+
+    // --- 1xx Informational ---
+
+    /** <tt>100 Trying</tt>. RFC 3261, section 21.1.1. */
+    public static final int SC_CONTINUE = 100;
+
+    /** <tt>180 Ringing</tt>. RFC 3261, section 21.1.2. */
+    public static final int SC_RINGING = 180;
+
+    /** <tt>181 Call Is Being Forwarded</tt>. RFC 3261, section 21.1.3. */
+    public static final int SC_CALL_IS_BEING_FORWARDED = 181;
+
+    /** <tt>182 Queued</tt>. RFC 3261, section 21.1.4. */
+    public static final int SC_QUEUED = 182;
+
+    /** <tt>183 Session Progress</tt>. RFC 3261, section 21.1.5. */
+    public static final int SC_SESSION_PROGRESS = 183;
+
+
+    // --- 2xx Successful ---
+
+    /** <tt>200 OK</tt>. RFC 3261, section 21.2.1. */
+    public static final int SC_OK = 200;
+
+    /** <tt>202 Accepted</tt>. RFC 3265, section 6.4. */
+    public static final int SC_ACCEPTED = 489;
+
+
+    // --- 3xx Redirection ---
+
+    /** <tt>300 Multiple Choices</tt>. RFC 3261, section 21.3.1. */
+    public static final int SC_MULTIPLE_CHOICES = 300;
+
+    /** <tt>301 Moved Permanently</tt>. RFC 3261, section 21.3.2. */
+    public static final int SC_MOVED_PERMANENTLY = 301;
+
+    /** <tt>302 Moved Temporarily</tt>. RFC 3261, section 21.3.3. */
+    public static final int SC_MOVED_TEMPORARILY = 302;
+
+    /** <tt>305 Use Proxy</tt>. RFC 3261, section 21.3.4. */
+    public static final int SC_USE_PROXY = 305;
+
+    /** <tt>380 Alternative Service</tt>. RFC 3261, section 21.3.5. */
+    public static final int SC_ALTERNATIVE_SERVICE = 380;
+
+
+    // --- 4xx Request Failure ---
+
+
+    /** <tt>400 Bad Request</tt>. RFC 3261, section 21.4.1. */
+    public static final int SC_BAD_REQUEST = 400;
+
+    /** <tt>401 Unauthorized</tt>. RFC 3261, section 21.4.2. */
+    public static final int SC_UNAUTHORIZED = 401;
+
+    /** <tt>402 Payment Required</tt>. RFC 3261, section 21.4.3. */
+    public static final int SC_PAYMENT_REQUIRED = 402;
+
+    /** <tt>403 Forbidden</tt>. RFC 3261, section 21.4.4. */
+    public static final int SC_FORBIDDEN = 403;
+
+    /** <tt>404 Not Found</tt>. RFC 3261, section 21.4.5. */
+    public static final int SC_NOT_FOUND = 404;
+
+    /** <tt>405 Method Not Allowed</tt>. RFC 3261, section 21.4.6. */
+    public static final int SC_METHOD_NOT_ALLOWED = 405;
+
+    /** <tt>406 Not Acceptable</tt>. RFC 3261, section 21.4.7. */
+    public static final int SC_NOT_ACCEPTABLE = 406;
+
+    /**
+     * <tt>407 Proxy Authentication Required</tt>.
+     * RFC 3261, section 21.4.8.
+     */
+    public static final int SC_PROXY_AUTHENTICATION_REQUIRED = 407;
+
+    /** <tt>408 Request Timeout</tt>. RFC 3261, section 21.4.9. */
+    public static final int SC_REQUEST_TIMEOUT = 408;
+
+    /** <tt>410 Gone</tt>. RFC 3261, section 21.4.10. */
+    public static final int SC_GONE = 410;
+
+    /** <tt>413 Request Entity Too Large</tt>. RFC 3261, section 21.4.11. */
+    public static final int SC_REQUEST_ENTITY_TOO_LARGE = 413;
+
+    /** <tt>414 Request-URI Too Long</tt>. RFC 3261, section 21.4.12. */
+    public static final int SC_REQUEST_URI_TOO_LONG = 414;
+
+    /** <tt>415 Unsupported Media Type</tt>. RFC 3261, section 21.4.13. */
+    public static final int SC_UNSUPPORTED_MEDIA_TYPE = 415;
+
+    /** <tt>416 Unsupported URI Scheme</tt>. RFC 3261, section 21.4.14. */
+    public static final int SC_UNSUPPORTED_URI_SCHEME = 416;
+
+    /** <tt>420 Bad Extension</tt>. RFC 3261, section 21.4.15. */
+    public static final int SC_BAD_EXTENSION = 420;
+
+    /** <tt>421 Extension Required</tt>. RFC 3261, section 21.4.16. */
+    public static final int SC_EXTENSION_REQUIRED = 421;
+
+    /** <tt>423 Interval Too Brief</tt>. RFC 3261, section 21.4.17. */
+    public static final int SC_INTERVAL_TOO_BRIEF = 423;
+
+    /** <tt>480 Temporarily Unavailable</tt>. RFC 3261, section 21.4.18. */
+    public static final int SC_TEMPORARILY_UNAVAILABLE = 480;
+
+    /**
+     * <tt>481 Call/Transaction Does Not Exist</tt>.
+     * RFC 3261, section 21.4.19.
+     */
+    public static final int SC_CALL_TRANSACTION_DOES_NOT_EXIST = 481;
+
+    /** <tt>482 Loop Detected</tt>. RFC 3261, section 21.4.20. */
+    public static final int SC_LOOP_DETECTED = 482;
+
+    /** <tt>483 Too Many Hops</tt>. RFC 3261, section 21.4.21. */
+    public static final int SC_TOO_MANY_HOPS = 483;
+
+    /** <tt>484 Address Incomplete</tt>. RFC 3261, section 21.4.22. */
+    public static final int SC_ADDRESS_INCOMPLETE = 484;
+
+    /** <tt>485 Ambiguous</tt>. RFC 3261, section 21.4.23. */
+    public static final int SC_AMBIGUOUS = 485;
+
+    /** <tt>486 Busy Here</tt>. RFC 3261, section 21.4.24. */
+    public static final int SC_BUSY_HERE = 486;
+
+    /** <tt>487 Request Terminated</tt>. RFC 3261, section 21.4.25. */
+    public static final int SC_REQUEST_TERMINATED = 487;
+
+    /** <tt>488 Not Acceptable Here</tt>. RFC 3261, section 21.4.26. */
+    public static final int SC_NOT_ACCEPTABLE_HERE = 488;
+
+    /** <tt>489 Bad Event</tt>. RFC 3265, section 6.4. */
+    public static final int SC_BAD_EVENT = 489;
+
+    /** <tt>491 Request Pending</tt>. RFC 3261, section 21.4.27. */
+    public static final int SC_REQUEST_PENDING = 491;
+
+    /** <tt>493 Undecipherable</tt>. RFC 3261, section 21.4.28. */
+    public static final int SC_UNDECIPHERABLE = 493;
+
+
+    // --- 5xx Server Failure ---
+
+    /** <tt>500 Server Internal Error</tt>. RFC 3261, section 21.5.1. */
+    public static final int SC_SERVER_INTERNAL_ERROR = 500;
+
+    /** <tt>501 Not Implemented</tt>. RFC 3261, section 21.5.2. */
+    public static final int SC_NOT_IMPLEMENTED = 501;
+
+    /** <tt>502 Bad Gateway</tt>. RFC 3261, section 21.5.3. */
+    public static final int SC_BAD_GATEWAY = 502;
+
+    /** <tt>503 Service Unavailable</tt>. RFC 3261, section 21.5.4. */
+    public static final int SC_SERVICE_UNAVAILABLE = 503;
+
+    /** <tt>504 Server Time-out</tt>. RFC 3261, section 21.5.5. */
+    public static final int SC_SERVER_TIMEOUT = 504;
+
+    /** <tt>505 Version Not Supported</tt>. RFC 3261, section 21.5.6. */
+    public static final int SC_VERSION_NOT_SUPPORTED = 505;
+
+    /** <tt>513 Message Too Large</tt>. RFC 3261, section 21.5.7. */
+    public static final int SC_MESSAGE_TOO_LARGE = 513;
+
+
+    // --- 6xx Global Failures ---
+
+    /** <tt>600 Busy Everywhere</tt>. RFC 3261, section 21.6.1. */
+    public static final int SC_BUSY_EVERYWHERE = 600;
+
+    /** <tt>603 Decline</tt>. RFC 3261, section 21.6.2. */
+    public static final int SC_DECLINE = 603;
+
+    /** <tt>604 Does Not Exist Anywhere</tt>. RFC 3261, section 21.6.3. */
+    public static final int SC_DOES_NOT_EXIST_ANYWHERE = 604;
+
+    /**
+     * <tt>606 Not Acceptable</tt>. RFC 3261, section 21.6.4.
+     * Status codes 606 and 406 both indicate "Not Acceptable",
+     * but we can only define one constant with that name in this interface.
+     * 406 is specific to an endpoint, while 606 is global and
+     * indicates that the callee will not find the request acceptable
+     * on any endpoint.
+     */
+    public static final int SC_NOT_ACCEPTABLE_ANYWHERE = 606;
+
+}

Propchange: httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/sip/SipStatus.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/sip/SipStatus.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/sip/SipStatus.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/sip/SipVersion.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/sip/SipVersion.java?rev=607546&view=auto
==============================================================================
--- httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/sip/SipVersion.java (added)
+++ httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/sip/SipVersion.java Sun Dec 30 06:19:48 2007
@@ -0,0 +1,95 @@
+/*
+ * $HeadURL$
+ * $Revision$
+ * $Date$
+ *
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.http.contrib.sip;
+
+import java.io.Serializable;
+
+import org.apache.http.ProtocolVersion;
+
+
+/**
+ * Represents an SIP version, as specified in RFC 3261.
+ * 
+ * @author <a href="mailto:oleg@ural.ru">Oleg Kalnichevski</a>
+ * @author and others
+ * 
+ * @version $Revision$
+ */
+public final class SipVersion extends ProtocolVersion
+    implements Serializable {
+
+    private static final long serialVersionUID = 6112302080954348220L;
+
+    /** The protocol name. */
+    public static final String SIP = "SIP";
+    
+    /** SIP protocol version 2.0 */
+    public static final SipVersion SIP_2_0 = new SipVersion(2, 0);
+
+    
+    /**
+     * Create a SIP protocol version designator.
+     *
+     * @param major   the major version number of the SIP protocol
+     * @param minor   the minor version number of the SIP protocol
+     * 
+     * @throws IllegalArgumentException
+     *         if either major or minor version number is negative
+     */
+    public SipVersion(int major, int minor) {
+        super(SIP, major, minor);
+    }
+
+
+    /**
+     * Obtains a specific SIP version.
+     *
+     * @param major     the major version
+     * @param minor     the minor version
+     *
+     * @return  an instance of {@link SipVersion} with the argument version
+     */
+    public ProtocolVersion forVersion(int major, int minor) {
+
+        if ((major == this.major) && (minor == this.minor)) {
+            return this;
+        }
+
+        if ((major == 2) && (minor == 0)) {
+            return SIP_2_0;
+        }
+
+        // argument checking is done in the constructor
+        return new SipVersion(major, minor);
+    }
+
+}

Propchange: httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/sip/SipVersion.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/sip/SipVersion.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/sip/SipVersion.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain