OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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_BASE_PEM_TOKENIZER_H_ | 5 #ifndef NET_BASE_PEM_TOKENIZER_H_ |
6 #define NET_BASE_PEM_TOKENIZER_H_ | 6 #define NET_BASE_PEM_TOKENIZER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/string_piece.h" | 12 #include "base/string_piece.h" |
13 #include "net/base/net_api.h" | 13 #include "net/base/net_export.h" |
14 | 14 |
15 namespace net { | 15 namespace net { |
16 | 16 |
17 // PEMTokenizer is a utility class for the parsing of data encapsulated | 17 // PEMTokenizer is a utility class for the parsing of data encapsulated |
18 // using RFC 1421, Privacy Enhancement for Internet Electronic Mail. It | 18 // using RFC 1421, Privacy Enhancement for Internet Electronic Mail. It |
19 // does not implement the full specification, most notably it does not | 19 // does not implement the full specification, most notably it does not |
20 // support the Encapsulated Header Portion described in Section 4.4. | 20 // support the Encapsulated Header Portion described in Section 4.4. |
21 class NET_TEST PEMTokenizer { | 21 class NET_EXPORT_PRIVATE PEMTokenizer { |
22 public: | 22 public: |
23 // Create a new PEMTokenizer that iterates through |str| searching for | 23 // Create a new PEMTokenizer that iterates through |str| searching for |
24 // instances of PEM encoded blocks that are of the |allowed_block_types|. | 24 // instances of PEM encoded blocks that are of the |allowed_block_types|. |
25 // |str| must remain valid for the duration of the PEMTokenizer. | 25 // |str| must remain valid for the duration of the PEMTokenizer. |
26 PEMTokenizer(const base::StringPiece& str, | 26 PEMTokenizer(const base::StringPiece& str, |
27 const std::vector<std::string>& allowed_block_types); | 27 const std::vector<std::string>& allowed_block_types); |
28 ~PEMTokenizer(); | 28 ~PEMTokenizer(); |
29 | 29 |
30 // Attempts to decode the next PEM block in the string. Returns false if no | 30 // Attempts to decode the next PEM block in the string. Returns false if no |
31 // PEM blocks can be decoded. The decoded PEM block will be available via | 31 // PEM blocks can be decoded. The decoded PEM block will be available via |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 69 |
70 // The raw (Base64-decoded) data of the last successfully decoded block. | 70 // The raw (Base64-decoded) data of the last successfully decoded block. |
71 std::string data_; | 71 std::string data_; |
72 | 72 |
73 DISALLOW_COPY_AND_ASSIGN(PEMTokenizer); | 73 DISALLOW_COPY_AND_ASSIGN(PEMTokenizer); |
74 }; | 74 }; |
75 | 75 |
76 } // namespace net | 76 } // namespace net |
77 | 77 |
78 #endif // NET_BASE_PEM_TOKENIZER_H_ | 78 #endif // NET_BASE_PEM_TOKENIZER_H_ |
OLD | NEW |