OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 // Gets the desired attribute value, or NULL if no such attribute type exists. | 151 // Gets the desired attribute value, or NULL if no such attribute type exists. |
152 const StunAddressAttribute* GetAddress(int type) const; | 152 const StunAddressAttribute* GetAddress(int type) const; |
153 const StunUInt32Attribute* GetUInt32(int type) const; | 153 const StunUInt32Attribute* GetUInt32(int type) const; |
154 const StunUInt64Attribute* GetUInt64(int type) const; | 154 const StunUInt64Attribute* GetUInt64(int type) const; |
155 const StunByteStringAttribute* GetByteString(int type) const; | 155 const StunByteStringAttribute* GetByteString(int type) const; |
156 | 156 |
157 // Gets these specific attribute values. | 157 // Gets these specific attribute values. |
158 const StunErrorCodeAttribute* GetErrorCode() const; | 158 const StunErrorCodeAttribute* GetErrorCode() const; |
159 const StunUInt16ListAttribute* GetUnknownAttributes() const; | 159 const StunUInt16ListAttribute* GetUnknownAttributes() const; |
160 | 160 |
161 // Takes ownership of the specified attribute, verifies it is of the correct | 161 // Takes ownership of the specified attribute and adds it to the message. |
162 // type, and adds it to the message. The return value indicates whether this | 162 void AddAttribute(StunAttribute* attr); |
163 // was successful. | |
164 bool AddAttribute(StunAttribute* attr); | |
165 | 163 |
166 // Validates that a raw STUN message has a correct MESSAGE-INTEGRITY value. | 164 // Validates that a raw STUN message has a correct MESSAGE-INTEGRITY value. |
167 // This can't currently be done on a StunMessage, since it is affected by | 165 // This can't currently be done on a StunMessage, since it is affected by |
168 // padding data (which we discard when reading a StunMessage). | 166 // padding data (which we discard when reading a StunMessage). |
169 static bool ValidateMessageIntegrity(const char* data, size_t size, | 167 static bool ValidateMessageIntegrity(const char* data, size_t size, |
170 const std::string& password); | 168 const std::string& password); |
171 // Adds a MESSAGE-INTEGRITY attribute that is valid for the current message. | 169 // Adds a MESSAGE-INTEGRITY attribute that is valid for the current message. |
172 bool AddMessageIntegrity(const std::string& password); | 170 bool AddMessageIntegrity(const std::string& password); |
173 bool AddMessageIntegrity(const char* key, size_t keylen); | 171 bool AddMessageIntegrity(const char* key, size_t keylen); |
174 | 172 |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
632 case STUN_ATTR_ICE_CONTROLLING: return STUN_VALUE_UINT64; | 630 case STUN_ATTR_ICE_CONTROLLING: return STUN_VALUE_UINT64; |
633 default: return StunMessage::GetAttributeValueType(type); | 631 default: return StunMessage::GetAttributeValueType(type); |
634 } | 632 } |
635 } | 633 } |
636 virtual StunMessage* CreateNew() const { return new IceMessage(); } | 634 virtual StunMessage* CreateNew() const { return new IceMessage(); } |
637 }; | 635 }; |
638 | 636 |
639 } // namespace cricket | 637 } // namespace cricket |
640 | 638 |
641 #endif // WEBRTC_P2P_BASE_STUN_H_ | 639 #endif // WEBRTC_P2P_BASE_STUN_H_ |
OLD | NEW |