OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_WEB_SOCKET_PROXY_HELPER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_WEB_SOCKET_PROXY_HELPER_H_ |
| 7 #pragma once |
| 8 |
| 9 #include <string> |
| 10 #include "base/basictypes.h" |
| 11 |
| 12 namespace chromeos { |
| 13 |
| 14 // Helper class for WebSocketProxy. |
| 15 class WebSocketProxyHelper { |
| 16 public: |
| 17 // Parses "passport:addr:hostname:port:" string. Returns true on success. |
| 18 static bool FetchPassportAddrNamePort( |
| 19 uint8* begin, uint8* end, |
| 20 std::string* passport, std::string* addr, |
| 21 std::string* hostname, int* port); |
| 22 |
| 23 // Fetches a token from the string and erases it. Token separtor is |
| 24 // either ':' or ']:' if the token is started with '[' and |
| 25 // |match_brackets|. Fetching position (start or end) is determined by |
| 26 // |forward|. Returns whether the token was successfully fetched. |
| 27 static bool FetchToken(bool forward, bool match_brackets, |
| 28 std::string* input, |
| 29 std::string* token); |
| 30 }; |
| 31 |
| 32 } // namespace chromeos |
| 33 |
| 34 #endif // CHROME_BROWSER_CHROMEOS_WEB_SOCKET_PROXY_HELPER_H_ |
OLD | NEW |