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 
94  //
96  static void setCookiesIn(const std::string& cookiesin) {
97  NetworkAdapter::CookiesIn = cookiesin;
98  }
99 
102  //
104  static const std::string& getCookiesIn() {
105  return NetworkAdapter::CookiesIn;
106  }
107 
108 private:
111  static std::string CookiesIn;
112 
113  static const ReservedNames& reservedNames();
114 
115 };
116 
117 } // namespace gnash
118 
119 #endif // CURL_ADAPTER_H
120 
121 // Local Variables:
122 // mode: C++
123 // indent-tabs-mode: t
124 // End: