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 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_ICE_CONTROLLED = 0x8029, // UInt64 | 607 STUN_ATTR_ICE_CONTROLLED = 0x8029, // UInt64 |
608 STUN_ATTR_ICE_CONTROLLING = 0x802A, // UInt64 | 608 STUN_ATTR_ICE_CONTROLLING = 0x802A, // UInt64 |
609 STUN_ATTR_NETWORK_COST = 0xC057 // UInt32 | 609 // UInt32. The higher 16 bits are the network ID. The lower 16 bits are the |
| 610 // network cost. |
| 611 STUN_ATTR_NETWORK_INFO = 0xC057 |
610 }; | 612 }; |
611 | 613 |
612 // RFC 5245-defined errors. | 614 // RFC 5245-defined errors. |
613 enum IceErrorCode { | 615 enum IceErrorCode { |
614 STUN_ERROR_ROLE_CONFLICT = 487, | 616 STUN_ERROR_ROLE_CONFLICT = 487, |
615 }; | 617 }; |
616 extern const char STUN_ERROR_REASON_ROLE_CONFLICT[]; | 618 extern const char STUN_ERROR_REASON_ROLE_CONFLICT[]; |
617 | 619 |
618 // A RFC 5245 ICE STUN message. | 620 // A RFC 5245 ICE STUN message. |
619 class IceMessage : public StunMessage { | 621 class IceMessage : public StunMessage { |
620 protected: | 622 protected: |
621 virtual StunAttributeValueType GetAttributeValueType(int type) const { | 623 virtual StunAttributeValueType GetAttributeValueType(int type) const { |
622 switch (type) { | 624 switch (type) { |
623 case STUN_ATTR_PRIORITY: | 625 case STUN_ATTR_PRIORITY: |
624 case STUN_ATTR_NETWORK_COST: | 626 case STUN_ATTR_NETWORK_INFO: |
625 return STUN_VALUE_UINT32; | 627 return STUN_VALUE_UINT32; |
626 case STUN_ATTR_USE_CANDIDATE: return STUN_VALUE_BYTE_STRING; | 628 case STUN_ATTR_USE_CANDIDATE: return STUN_VALUE_BYTE_STRING; |
627 case STUN_ATTR_ICE_CONTROLLED: return STUN_VALUE_UINT64; | 629 case STUN_ATTR_ICE_CONTROLLED: return STUN_VALUE_UINT64; |
628 case STUN_ATTR_ICE_CONTROLLING: return STUN_VALUE_UINT64; | 630 case STUN_ATTR_ICE_CONTROLLING: return STUN_VALUE_UINT64; |
629 default: return StunMessage::GetAttributeValueType(type); | 631 default: return StunMessage::GetAttributeValueType(type); |
630 } | 632 } |
631 } | 633 } |
632 virtual StunMessage* CreateNew() const { return new IceMessage(); } | 634 virtual StunMessage* CreateNew() const { return new IceMessage(); } |
633 }; | 635 }; |
634 | 636 |
635 } // namespace cricket | 637 } // namespace cricket |
636 | 638 |
637 #endif // WEBRTC_P2P_BASE_STUN_H_ | 639 #endif // WEBRTC_P2P_BASE_STUN_H_ |
OLD | NEW |