Gnash  0.8.11dev
NetworkAdapter.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
3 // Free Software Foundation, Inc
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 
19 
20 #ifndef NETWORK_ADAPTER_H
21 #define NETWORK_ADAPTER_H
22 
23 #include "dsodefs.h"
24 
25 #include <map>
26 #include <string>
27 #include <memory>
28 #include <set>
29 #include "StringPredicates.h"
30 
31 namespace gnash {
32 class IOChannel;
33 
36 
37 public:
38 
42  typedef std::map<std::string, std::string, StringNoCaseLessThan>
44 
48  //
50  DSOEXPORT static std::auto_ptr<IOChannel> makeStream(
51  const std::string& url, const std::string& cachefile);
52 
56  //
61  DSOEXPORT static std::auto_ptr<IOChannel> makeStream(
62  const std::string& url, const std::string& postdata,
63  const std::string& cachefile);
64 
68  //
74  DSOEXPORT static std::auto_ptr<IOChannel> makeStream(const std::string& url,
75  const std::string& postdata, const RequestHeaders& headers,
76  const std::string& cachefile);
77 
78 
79  typedef std::set<std::string, StringNoCaseLessThan> ReservedNames;
80 
82  //
86  DSOEXPORT static bool isHeaderAllowed(const std::string& headerName)
87  {
88  const ReservedNames& names = reservedNames();
89  return (names.find(headerName) == names.end());
90  }
91 
92 private:
93 
94  static const ReservedNames& reservedNames();
95 
96 };
97 
98 } // namespace gnash
99 
100 #endif // CURL_ADAPTER_H
101 
102 // Local Variables:
103 // mode: C++
104 // indent-tabs-mode: t
105 // End:
std::set< std::string, StringNoCaseLessThan > ReservedNames
Definition: NetworkAdapter.h:79
char ** names[EV_MAX+1]
Definition: evtest.c:357
static DSOEXPORT bool isHeaderAllowed(const std::string &headerName)
Check whether a RequestHeader is permitted.
Definition: NetworkAdapter.h:86
Code to use libcurl as an IOChannel stream.
Definition: NetworkAdapter.h:35
static DSOEXPORT std::auto_ptr< IOChannel > makeStream(const std::string &url, const std::string &cachefile)
Returns a read-only IOChannel that fetches data from an url.
Definition: curl_adapter.cpp:45
#define DSOEXPORT
Definition: dsodefs.h:55
std::map< std::string, std::string, StringNoCaseLessThan > RequestHeaders
Definition: NetworkAdapter.h:43
std::string url
Definition: gnash.cpp:58