wibble  1.1
mime.h
Go to the documentation of this file.
1 #ifndef WIBBLE_NET_MIME_H
2 #define WIBBLE_NET_MIME_H
3 
4 /*
5  * net/mime - MIME utilities
6  *
7  * Copyright (C) 2010 Enrico Zini <enrico@enricozini.org>
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22  */
23 
24 #include <string>
25 #include <map>
26 #include <wibble/regexp.h>
27 #include <iosfwd>
28 
29 namespace wibble {
30 namespace net {
31 namespace mime {
32 
33 struct Reader
34 {
36 
37  Reader();
38 
51  bool read_line(int sock, std::string& res);
52 
59  bool read_headers(int sock, std::map<std::string, std::string>& headers);
60 
69  bool read_until_boundary(int sock, const std::string& boundary, std::ostream& out, size_t max=0);
70 
77  bool discard_until_boundary(int sock, const std::string& boundary);
78 
84  bool readboundarytail(int sock);
85 };
86 
87 }
88 }
89 }
90 
91 // vim:set ts=4 sw=4:
92 #endif
bool read_headers(int sock, std::map< std::string, std::string > &headers)
Read MIME headers.
Definition: mime.cpp:68
wibble::ERegexp header_splitter
Definition: mime.h:35
bool readboundarytail(int sock)
Skip until the end of the boundary line.
Definition: mime.cpp:125
Definition: regexp.h:82
Reader()
Definition: mime.cpp:32
bool read_line(int sock, std::string &res)
Read a line from the file descriptor.
Definition: mime.cpp:37
bool discard_until_boundary(int sock, const std::string &boundary)
Read until boundary is found, sending data to the given ostream.
Definition: mime.cpp:192
Definition: amorph.h:17
Definition: mime.h:33
bool read_until_boundary(int sock, const std::string &boundary, std::ostream &out, size_t max=0)
Read until boundary is found, sending data to the given ostream.
Definition: mime.cpp:159