| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 const std::string& origin() const { return origin_; } | 83 const std::string& origin() const { return origin_; } |
| 84 void set_origin(const std::string& origin) { origin_ = origin; } | 84 void set_origin(const std::string& origin) { origin_ = origin; } |
| 85 | 85 |
| 86 // Returns the STUN type of the request message. | 86 // Returns the STUN type of the request message. |
| 87 int type(); | 87 int type(); |
| 88 | 88 |
| 89 // Returns a const pointer to |msg_|. | 89 // Returns a const pointer to |msg_|. |
| 90 const StunMessage* msg() const; | 90 const StunMessage* msg() const; |
| 91 | 91 |
| 92 // Time elapsed since last send (in ms) | 92 // Time elapsed since last send (in ms) |
| 93 uint32 Elapsed() const; | 93 uint32_t Elapsed() const; |
| 94 | 94 |
| 95 protected: | 95 protected: |
| 96 int count_; | 96 int count_; |
| 97 bool timeout_; | 97 bool timeout_; |
| 98 std::string origin_; | 98 std::string origin_; |
| 99 | 99 |
| 100 // Fills in a request object to be sent. Note that request's transaction ID | 100 // Fills in a request object to be sent. Note that request's transaction ID |
| 101 // will already be set and cannot be changed. | 101 // will already be set and cannot be changed. |
| 102 virtual void Prepare(StunMessage* request) {} | 102 virtual void Prepare(StunMessage* request) {} |
| 103 | 103 |
| 104 // Called when the message receives a response or times out. | 104 // Called when the message receives a response or times out. |
| 105 virtual void OnResponse(StunMessage* response) {} | 105 virtual void OnResponse(StunMessage* response) {} |
| 106 virtual void OnErrorResponse(StunMessage* response) {} | 106 virtual void OnErrorResponse(StunMessage* response) {} |
| 107 virtual void OnTimeout() {} | 107 virtual void OnTimeout() {} |
| 108 // Called when the message is sent. | 108 // Called when the message is sent. |
| 109 virtual void OnSent(); | 109 virtual void OnSent(); |
| 110 // Returns the next delay for resends. | 110 // Returns the next delay for resends. |
| 111 virtual int resend_delay(); | 111 virtual int resend_delay(); |
| 112 | 112 |
| 113 private: | 113 private: |
| 114 void set_manager(StunRequestManager* manager); | 114 void set_manager(StunRequestManager* manager); |
| 115 | 115 |
| 116 // Handles messages for sending and timeout. | 116 // Handles messages for sending and timeout. |
| 117 void OnMessage(rtc::Message* pmsg); | 117 void OnMessage(rtc::Message* pmsg); |
| 118 | 118 |
| 119 StunRequestManager* manager_; | 119 StunRequestManager* manager_; |
| 120 StunMessage* msg_; | 120 StunMessage* msg_; |
| 121 uint32 tstamp_; | 121 uint32_t tstamp_; |
| 122 | 122 |
| 123 friend class StunRequestManager; | 123 friend class StunRequestManager; |
| 124 }; | 124 }; |
| 125 | 125 |
| 126 } // namespace cricket | 126 } // namespace cricket |
| 127 | 127 |
| 128 #endif // WEBRTC_P2P_BASE_STUNREQUEST_H_ | 128 #endif // WEBRTC_P2P_BASE_STUNREQUEST_H_ |
| OLD | NEW |