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