| OLD | NEW | 
|    1 /* |    1 /* | 
|    2  * Copyright (C) 2012 Google Inc. All rights reserved. |    2  * Copyright (C) 2013 Google Inc. All rights reserved. | 
|    3  * |    3  * | 
|    4  * Redistribution and use in source and binary forms, with or without |    4  * Redistribution and use in source and binary forms, with or without | 
|    5  * modification, are permitted provided that the following conditions are |    5  * modification, are permitted provided that the following conditions are | 
|    6  * met: |    6  * met: | 
|    7  * |    7  * | 
|    8  *     * Redistributions of source code must retain the above copyright |    8  *     * Redistributions of source code must retain the above copyright | 
|    9  * notice, this list of conditions and the following disclaimer. |    9  * notice, this list of conditions and the following disclaimer. | 
|   10  *     * Redistributions in binary form must reproduce the above |   10  *     * Redistributions in binary form must reproduce the above | 
|   11  * copyright notice, this list of conditions and the following disclaimer |   11  * copyright notice, this list of conditions and the following disclaimer | 
|   12  * in the documentation and/or other materials provided with the |   12  * in the documentation and/or other materials provided with the | 
|   13  * distribution. |   13  * distribution. | 
|   14  *     * Neither the name of Google Inc. nor the names of its |   14  *     * Neither the name of Google Inc. nor the names of its | 
|   15  * contributors may be used to endorse or promote products derived from |   15  * contributors may be used to endorse or promote products derived from | 
|   16  * this software without specific prior written permission. |   16  * this software without specific prior written permission. | 
|   17  * |   17  * | 
|   18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |   18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 
|   19  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |   19  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 
|   20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |   20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 
|   21  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |   21  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 
|   22  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |   22  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 
|   23  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |   23  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 
|   24  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |   24  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 
|   25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |   25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 
|   26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |   26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 
|   27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |   27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 
|   28  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |   28  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 
|   29  */ |   29  */ | 
|   30  |   30  | 
|   31 #ifndef WebRTCConfiguration_h |   31 #ifndef WebCryptoAlgorithm_h | 
|   32 #define WebRTCConfiguration_h |   32 #define WebCryptoAlgorithm_h | 
|   33  |   33  | 
|   34 #include "WebCommon.h" |   34 #include "WebCommon.h" | 
|   35 #include "WebNonCopyable.h" |  | 
|   36 #include "WebPrivatePtr.h" |   35 #include "WebPrivatePtr.h" | 
|   37 #include "WebVector.h" |  | 
|   38  |   36  | 
|   39 namespace WebCore { |   37 #if WEBKIT_IMPLEMENTATION | 
|   40 class RTCIceServer; |   38 #include "wtf/PassOwnPtr.h" | 
|   41 class RTCConfiguration; |   39 #endif | 
|   42 } |  | 
|   43  |   40  | 
|   44 namespace WebKit { |   41 namespace WebKit { | 
|   45 class WebString; |  | 
|   46 class WebURL; |  | 
|   47  |   42  | 
|   48 class WebRTCICEServer { |   43 enum WebCryptoAlgorithmId { | 
 |   44     WebCryptoAlgorithmIdAesCbc, | 
 |   45     WebCryptoAlgorithmIdSha1, | 
 |   46     WebCryptoAlgorithmIdSha224, | 
 |   47     WebCryptoAlgorithmIdSha256, | 
 |   48     WebCryptoAlgorithmIdSha384, | 
 |   49     WebCryptoAlgorithmIdSha512, | 
 |   50 #if WEBKIT_IMPLEMENTATION | 
 |   51     NumberOfWebCryptoAlgorithmId, | 
 |   52 #endif | 
 |   53 }; | 
 |   54  | 
 |   55 enum WebCryptoAlgorithmParamsType { | 
 |   56     WebCryptoAlgorithmParamsTypeNone, | 
 |   57     WebCryptoAlgorithmParamsTypeAesCbcParams, | 
 |   58     WebCryptoAlgorithmParamsTypeAesKeyGenParams, | 
 |   59 }; | 
 |   60  | 
 |   61 class WebCryptoAesCbcParams; | 
 |   62 class WebCryptoAesKeyGenParams; | 
 |   63  | 
 |   64 class WebCryptoAlgorithmParams; | 
 |   65 class WebCryptoAlgorithmPrivate; | 
 |   66  | 
 |   67 // The WebCryptoAlgorithm represents a normalized algorithm and its parameters. | 
 |   68 //   * Immutable | 
 |   69 //   * Threadsafe | 
 |   70 //   * Copiable (cheaply) | 
 |   71 class WebCryptoAlgorithm { | 
|   49 public: |   72 public: | 
|   50     WebRTCICEServer() { } |   73 #if WEBKIT_IMPLEMENTATION | 
|   51     WebRTCICEServer(const WebRTCICEServer& other) { assign(other); } |   74     WebCryptoAlgorithm() { } | 
|   52     ~WebRTCICEServer() { reset(); } |   75     WebCryptoAlgorithm(WebCryptoAlgorithmId, const char*, PassOwnPtr<WebCryptoAl
     gorithmParams>); | 
 |   76 #endif | 
|   53  |   77  | 
|   54     WebRTCICEServer& operator=(const WebRTCICEServer& other) |   78     ~WebCryptoAlgorithm() { reset(); } | 
 |   79  | 
 |   80     WebCryptoAlgorithm(const WebCryptoAlgorithm& other) { assign(other); } | 
 |   81     WebCryptoAlgorithm& operator=(const WebCryptoAlgorithm& other) | 
|   55     { |   82     { | 
|   56         assign(other); |   83         assign(other); | 
|   57         return *this; |   84         return *this; | 
|   58     } |   85     } | 
|   59  |   86  | 
|   60     WEBKIT_EXPORT void assign(const WebRTCICEServer&); |   87     WEBKIT_EXPORT WebCryptoAlgorithmId algorithmId() const; | 
 |   88     WEBKIT_EXPORT const char* algorithmName() const; | 
|   61  |   89  | 
|   62     WEBKIT_EXPORT void reset(); |   90     WEBKIT_EXPORT WebCryptoAlgorithmParamsType paramsType() const; | 
|   63     bool isNull() const { return m_private.isNull(); } |  | 
|   64  |   91  | 
|   65     WEBKIT_EXPORT WebURL uri() const; |   92     // Retrieves the type-specific parameters. The algorithm contains at most 1 | 
|   66     WEBKIT_EXPORT WebString username() const; |   93     // type of parameters. Retrieving an invalid parameter will return 0. | 
|   67     WEBKIT_EXPORT WebString credential() const; |   94     WebCryptoAesCbcParams* aesCbcParams() const; | 
|   68  |   95     WebCryptoAesKeyGenParams* aesKeyGenParams() const; | 
|   69 #if WEBKIT_IMPLEMENTATION |  | 
|   70     WebRTCICEServer(const WTF::PassRefPtr<WebCore::RTCIceServer>&); |  | 
|   71 #endif |  | 
|   72  |   96  | 
|   73 private: |   97 private: | 
|   74     WebPrivatePtr<WebCore::RTCIceServer> m_private; |   98     WEBKIT_EXPORT void assign(const WebCryptoAlgorithm& other); | 
|   75 }; |   99     WEBKIT_EXPORT void reset(); | 
|   76  |  100  | 
|   77 class WebRTCConfiguration { |  101     WebPrivatePtr<WebCryptoAlgorithmPrivate> m_private; | 
|   78 public: |  | 
|   79     WebRTCConfiguration() { } |  | 
|   80     WebRTCConfiguration(const WebRTCConfiguration& other) { assign(other); } |  | 
|   81     ~WebRTCConfiguration() { reset(); } |  | 
|   82  |  | 
|   83     WebRTCConfiguration& operator=(const WebRTCConfiguration& other) |  | 
|   84     { |  | 
|   85         assign(other); |  | 
|   86         return *this; |  | 
|   87     } |  | 
|   88  |  | 
|   89     WEBKIT_EXPORT void assign(const WebRTCConfiguration&); |  | 
|   90  |  | 
|   91     WEBKIT_EXPORT void reset(); |  | 
|   92     bool isNull() const { return m_private.isNull(); } |  | 
|   93  |  | 
|   94     WEBKIT_EXPORT size_t numberOfServers() const; |  | 
|   95     WEBKIT_EXPORT WebRTCICEServer server(size_t index) const; |  | 
|   96  |  | 
|   97 #if WEBKIT_IMPLEMENTATION |  | 
|   98     WebRTCConfiguration(const WTF::PassRefPtr<WebCore::RTCConfiguration>&); |  | 
|   99 #endif |  | 
|  100  |  | 
|  101 private: |  | 
|  102     WebPrivatePtr<WebCore::RTCConfiguration> m_private; |  | 
|  103 }; |  102 }; | 
|  104  |  103  | 
|  105 } // namespace WebKit |  104 } // namespace WebKit | 
|  106  |  105  | 
|  107 #endif // WebRTCConfiguration_h |  106 #endif | 
| OLD | NEW |