| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef NET_SPDY_SPDY_FRAMER_H_ | 5 #ifndef NET_SPDY_SPDY_FRAMER_H_ |
| 6 #define NET_SPDY_SPDY_FRAMER_H_ | 6 #define NET_SPDY_SPDY_FRAMER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <list> | 9 #include <list> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 uint32 id() const { return id_; } | 64 uint32 id() const { return id_; } |
| 65 uint8 flags() const { return flags_; } | 65 uint8 flags() const { return flags_; } |
| 66 | 66 |
| 67 private: | 67 private: |
| 68 static void ConvertFlagsAndIdForSpdy2(uint32* val); | 68 static void ConvertFlagsAndIdForSpdy2(uint32* val); |
| 69 | 69 |
| 70 uint8 flags_; | 70 uint8 flags_; |
| 71 uint32 id_; | 71 uint32 id_; |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 // A datastructure for holding a set of ID/value pairs for a SETTINGS frame. | 74 // SpdySettingsMap has unique (flags, value) pair for given SpdySettingsIds ID. |
| 75 typedef std::pair<SettingsFlagsAndId, uint32> SpdySetting; | |
| 76 typedef std::list<SpdySetting> SpdySettings; | |
| 77 // SpdySettingsMap has unique (flags, value) pair for give SpdySetting ID. | |
| 78 typedef std::pair<SpdySettingsFlags, uint32> SettingsFlagsAndValue; | 75 typedef std::pair<SpdySettingsFlags, uint32> SettingsFlagsAndValue; |
| 79 typedef std::map<SpdySettingsIds, SettingsFlagsAndValue> SettingsMap; | 76 typedef std::map<SpdySettingsIds, SettingsFlagsAndValue> SettingsMap; |
| 80 | 77 |
| 81 // A datastrcture for holding the contents of a CREDENTIAL frame. | 78 // A datastrcture for holding the contents of a CREDENTIAL frame. |
| 82 struct NET_EXPORT_PRIVATE SpdyCredential { | 79 struct NET_EXPORT_PRIVATE SpdyCredential { |
| 83 SpdyCredential(); | 80 SpdyCredential(); |
| 84 ~SpdyCredential(); | 81 ~SpdyCredential(); |
| 85 | 82 |
| 86 uint16 slot; | 83 uint16 slot; |
| 87 std::vector<std::string> certs; | 84 std::vector<std::string> certs; |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 SpdySynReplyControlFrame* CreateSynReply(SpdyStreamId stream_id, | 293 SpdySynReplyControlFrame* CreateSynReply(SpdyStreamId stream_id, |
| 297 SpdyControlFlags flags, | 294 SpdyControlFlags flags, |
| 298 bool compressed, | 295 bool compressed, |
| 299 const SpdyHeaderBlock* headers); | 296 const SpdyHeaderBlock* headers); |
| 300 | 297 |
| 301 SpdyRstStreamControlFrame* CreateRstStream(SpdyStreamId stream_id, | 298 SpdyRstStreamControlFrame* CreateRstStream(SpdyStreamId stream_id, |
| 302 SpdyStatusCodes status) const; | 299 SpdyStatusCodes status) const; |
| 303 | 300 |
| 304 // Creates an instance of SpdySettingsControlFrame. The SETTINGS frame is | 301 // Creates an instance of SpdySettingsControlFrame. The SETTINGS frame is |
| 305 // used to communicate name/value pairs relevant to the communication channel. | 302 // used to communicate name/value pairs relevant to the communication channel. |
| 306 SpdySettingsControlFrame* CreateSettings(const SpdySettings& values) const; | 303 SpdySettingsControlFrame* CreateSettings(const SettingsMap& values) const; |
| 307 | 304 |
| 308 // Creates an instance of SpdyPingControlFrame. The unique_id is used to | 305 // Creates an instance of SpdyPingControlFrame. The unique_id is used to |
| 309 // identify the ping request/response. | 306 // identify the ping request/response. |
| 310 SpdyPingControlFrame* CreatePingFrame(uint32 unique_id) const; | 307 SpdyPingControlFrame* CreatePingFrame(uint32 unique_id) const; |
| 311 | 308 |
| 312 // Creates an instance of SpdyGoAwayControlFrame. The GOAWAY frame is used | 309 // Creates an instance of SpdyGoAwayControlFrame. The GOAWAY frame is used |
| 313 // prior to the shutting down of the TCP connection, and includes the | 310 // prior to the shutting down of the TCP connection, and includes the |
| 314 // stream_id of the last stream the sender of the frame is willing to process | 311 // stream_id of the last stream the sender of the frame is willing to process |
| 315 // to completion. | 312 // to completion. |
| 316 SpdyGoAwayControlFrame* CreateGoAway(SpdyStreamId last_accepted_stream_id, | 313 SpdyGoAwayControlFrame* CreateGoAway(SpdyStreamId last_accepted_stream_id, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 332 | 329 |
| 333 // Creates an instance of SpdyCredentialControlFrame. The CREDENTIAL | 330 // Creates an instance of SpdyCredentialControlFrame. The CREDENTIAL |
| 334 // frame is used to send a client certificate to the server when | 331 // frame is used to send a client certificate to the server when |
| 335 // request more than one origin are sent over the same SPDY session. | 332 // request more than one origin are sent over the same SPDY session. |
| 336 SpdyCredentialControlFrame* CreateCredentialFrame( | 333 SpdyCredentialControlFrame* CreateCredentialFrame( |
| 337 const SpdyCredential& credential) const; | 334 const SpdyCredential& credential) const; |
| 338 | 335 |
| 339 // Given a SpdySettingsControlFrame, extract the settings. | 336 // Given a SpdySettingsControlFrame, extract the settings. |
| 340 // Returns true on successful parse, false otherwise. | 337 // Returns true on successful parse, false otherwise. |
| 341 static bool ParseSettings(const SpdySettingsControlFrame* frame, | 338 static bool ParseSettings(const SpdySettingsControlFrame* frame, |
| 342 SpdySettings* settings); | 339 SettingsMap* settings); |
| 343 | 340 |
| 344 // Given a SpdyCredentialControlFrame's payload, extract the credential. | 341 // Given a SpdyCredentialControlFrame's payload, extract the credential. |
| 345 // Returns true on successful parse, false otherwise. | 342 // Returns true on successful parse, false otherwise. |
| 346 // TODO(hkhalil): Implement CREDENTIAL frame parsing in SpdyFramer | 343 // TODO(hkhalil): Implement CREDENTIAL frame parsing in SpdyFramer |
| 347 // and eliminate this method. | 344 // and eliminate this method. |
| 348 static bool ParseCredentialData(const char* data, size_t len, | 345 static bool ParseCredentialData(const char* data, size_t len, |
| 349 SpdyCredential* credential); | 346 SpdyCredential* credential); |
| 350 | 347 |
| 351 // Create a data frame. | 348 // Create a data frame. |
| 352 // |stream_id| is the stream for this frame | 349 // |stream_id| is the stream for this frame |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 591 // starts with HTTP. If it does, we likely have an HTTP response. This | 588 // starts with HTTP. If it does, we likely have an HTTP response. This |
| 592 // isn't guaranteed though: we could have gotten a settings frame and then | 589 // isn't guaranteed though: we could have gotten a settings frame and then |
| 593 // corrupt data that just looks like HTTP, but deterministic checking requires | 590 // corrupt data that just looks like HTTP, but deterministic checking requires |
| 594 // a lot more state. | 591 // a lot more state. |
| 595 bool probable_http_response_; | 592 bool probable_http_response_; |
| 596 }; | 593 }; |
| 597 | 594 |
| 598 } // namespace net | 595 } // namespace net |
| 599 | 596 |
| 600 #endif // NET_SPDY_SPDY_FRAMER_H_ | 597 #endif // NET_SPDY_SPDY_FRAMER_H_ |
| OLD | NEW |