Gnash  0.8.10
NetworkAdapter.h
Go to the documentation of this file.
00001 // 
00002 //   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
00003 //   Free Software Foundation, Inc
00004 // 
00005 // This program is free software; you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License as published by
00007 // the Free Software Foundation; either version 3 of the License, or
00008 // (at your option) any later version.
00009 // 
00010 // This program is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 // 
00015 // You should have received a copy of the GNU General Public License
00016 // along with this program; if not, write to the Free Software
00017 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00018 
00019 
00020 #ifndef NETWORK_ADAPTER_H
00021 #define NETWORK_ADAPTER_H
00022 
00023 #include "dsodefs.h"
00024 
00025 #include <map>
00026 #include <string>
00027 #include <memory>
00028 #include <set>
00029 #include "StringPredicates.h"
00030 
00031 namespace gnash {
00032 class IOChannel;
00033 
00035 class NetworkAdapter {
00036 
00037 public:
00038 
00042     typedef std::map<std::string, std::string, StringNoCaseLessThan>
00043         RequestHeaders;
00044 
00048     //
00050     DSOEXPORT static std::auto_ptr<IOChannel> makeStream(
00051             const std::string& url, const std::string& cachefile);
00052 
00056     //
00061     DSOEXPORT static std::auto_ptr<IOChannel> makeStream(
00062             const std::string& url, const std::string& postdata,
00063             const std::string& cachefile);
00064 
00068     //
00074     DSOEXPORT static std::auto_ptr<IOChannel> makeStream(const std::string& url,
00075            const std::string& postdata, const RequestHeaders& headers,
00076            const std::string& cachefile);
00077 
00078 
00079     typedef std::set<std::string, StringNoCaseLessThan> ReservedNames;
00080 
00082     //
00086     DSOEXPORT static bool isHeaderAllowed(const std::string& headerName)
00087     {
00088         const ReservedNames& names = reservedNames();
00089         return (names.find(headerName) == names.end());
00090     }
00091 
00092 private:
00093 
00094     static const ReservedNames& reservedNames();
00095 
00096 };
00097 
00098 } // namespace gnash
00099 
00100 #endif // CURL_ADAPTER_H
00101 
00102 // Local Variables:
00103 // mode: C++
00104 // indent-tabs-mode: t
00105 // End: