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 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
597 default: return StunMessage::GetAttributeValueType(type); | 597 default: return StunMessage::GetAttributeValueType(type); |
598 } | 598 } |
599 } | 599 } |
600 virtual StunMessage* CreateNew() const { return new TurnMessage(); } | 600 virtual StunMessage* CreateNew() const { return new TurnMessage(); } |
601 }; | 601 }; |
602 | 602 |
603 // RFC 5245 ICE STUN attributes. | 603 // RFC 5245 ICE STUN attributes. |
604 enum IceAttributeType { | 604 enum IceAttributeType { |
605 STUN_ATTR_PRIORITY = 0x0024, // UInt32 | 605 STUN_ATTR_PRIORITY = 0x0024, // UInt32 |
606 STUN_ATTR_USE_CANDIDATE = 0x0025, // No content, Length = 0 | 606 STUN_ATTR_USE_CANDIDATE = 0x0025, // No content, Length = 0 |
607 STUN_ATTR_NETWORK_COST = 0x0026, // UInt32 | |
pthatcher1
2016/02/04 23:16:21
According to RFC 5389, section 18.2, we have to ch
| |
607 STUN_ATTR_ICE_CONTROLLED = 0x8029, // UInt64 | 608 STUN_ATTR_ICE_CONTROLLED = 0x8029, // UInt64 |
608 STUN_ATTR_ICE_CONTROLLING = 0x802A // UInt64 | 609 STUN_ATTR_ICE_CONTROLLING = 0x802A // UInt64 |
609 }; | 610 }; |
610 | 611 |
611 // RFC 5245-defined errors. | 612 // RFC 5245-defined errors. |
612 enum IceErrorCode { | 613 enum IceErrorCode { |
613 STUN_ERROR_ROLE_CONFLICT = 487, | 614 STUN_ERROR_ROLE_CONFLICT = 487, |
614 }; | 615 }; |
615 extern const char STUN_ERROR_REASON_ROLE_CONFLICT[]; | 616 extern const char STUN_ERROR_REASON_ROLE_CONFLICT[]; |
616 | 617 |
617 // A RFC 5245 ICE STUN message. | 618 // A RFC 5245 ICE STUN message. |
618 class IceMessage : public StunMessage { | 619 class IceMessage : public StunMessage { |
619 protected: | 620 protected: |
620 virtual StunAttributeValueType GetAttributeValueType(int type) const { | 621 virtual StunAttributeValueType GetAttributeValueType(int type) const { |
621 switch (type) { | 622 switch (type) { |
622 case STUN_ATTR_PRIORITY: return STUN_VALUE_UINT32; | 623 case STUN_ATTR_PRIORITY: |
624 case STUN_ATTR_NETWORK_COST: | |
pthatcher1
2016/02/04 23:16:21
32-bits is overkill. Let's make it uint8. We'll
juberti2
2016/02/04 23:31:10
attribs are padded to 32 bits, so no point in goin
pthatcher1
2016/02/04 23:51:18
Yes, I forgot about that. It's pretty lame when y
| |
625 return STUN_VALUE_UINT32; | |
623 case STUN_ATTR_USE_CANDIDATE: return STUN_VALUE_BYTE_STRING; | 626 case STUN_ATTR_USE_CANDIDATE: return STUN_VALUE_BYTE_STRING; |
624 case STUN_ATTR_ICE_CONTROLLED: return STUN_VALUE_UINT64; | 627 case STUN_ATTR_ICE_CONTROLLED: return STUN_VALUE_UINT64; |
625 case STUN_ATTR_ICE_CONTROLLING: return STUN_VALUE_UINT64; | 628 case STUN_ATTR_ICE_CONTROLLING: return STUN_VALUE_UINT64; |
626 default: return StunMessage::GetAttributeValueType(type); | 629 default: return StunMessage::GetAttributeValueType(type); |
627 } | 630 } |
628 } | 631 } |
629 virtual StunMessage* CreateNew() const { return new IceMessage(); } | 632 virtual StunMessage* CreateNew() const { return new IceMessage(); } |
630 }; | 633 }; |
631 | 634 |
632 } // namespace cricket | 635 } // namespace cricket |
633 | 636 |
634 #endif // WEBRTC_P2P_BASE_STUN_H_ | 637 #endif // WEBRTC_P2P_BASE_STUN_H_ |
OLD | NEW |