Update with current status
[gnash.git] / cygnal / crc.h
blob898e0eddc84cbde998479db597202d86aaf4c79d
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
19 #ifndef __CRC_H__
20 #define __CRC_H__
22 #include <string>
23 #include <iostream> // for output operator
25 #include "rc.h"
27 /// \namespace cygnal
28 ///
29 /// This namespace is for all the Cygnal specific classes not used by
30 /// anything else in Gnash.
31 namespace cygnal {
33 /// \class cygnal::CRcInitFile
34 /// This class handles reading values from the Cygnal
35 /// configuration file, .cygnalrc, and into a form we can use in
36 /// Cygnal.
37 class DSOEXPORT CRcInitFile : public gnash::RcInitFile
39 public:
40 /// Construct only by getDefaultInstance()
41 CRcInitFile();
42 /// Never destroy (TODO: add a destroyDefaultInstance)
43 ~CRcInitFile();
45 /// \brief Return the default instance of RC file,
46 static CRcInitFile& getDefaultInstance();
48 /// \brief Load all the configuration files.
49 /// This includes parsing the default .gnashrc file for
50 /// Gnash settings that control the swf parser and virtual
51 /// machine. These setting can be overridden in the
52 /// .cygnalrc file, plus the Cygnal specific file has
53 /// options only used by Cygnal.
54 bool loadFiles();
56 /// \brief Parse and load configuration file
57 ///
58 /// @param filespec The path and file name of the disk file to parse.
59 ///
60 /// @return True if the file was parsed successfully, false if not.
61 bool parseFile(const std::string& filespec);
63 /// Accessors
65 /// \brief Get the port offset.
66 int getPortOffset() { return _port_offset; };
68 // \brief Set the port offset
69 void setPortOffset(int x) { _port_offset = x; };
71 /// \brief Get the number of file descriptors per thread.
72 int getFDThread() { return _fdthread; };
73 /// \brief Set the number of file descriptors per thread.
74 void setFDThread(int x) { _fdthread = x; };
76 /// \brief Get the special testing output option.
77 bool getTestingFlag() { return _testing; };
78 /// \brief Set the special testing output option.
79 void setTestingFlag(bool x) { _testing = x; };
81 /// \brief Get the flag for whether to enable threading.
82 bool getThreadingFlag() { return _threading; };
83 /// \brief Set the flag for whether to enable threading.
84 void setThreadingFlag(bool x) { _threading = x; };
86 /// \brief Get the flag for whether to enable internal debugging messages.
87 bool getNetDebugFlag() const { return _netdebug; }
88 /// \brief Set the flag for whether to enable internal debugging messages.
89 void setNetDebugFlag(bool x) { _netdebug = x; }
91 /// \brief Get the flag for whether to enable the administration thread.
92 bool getAdminFlag() const { return _admin; }
93 /// \brief Set the flag for whether to enable the administration thread.
94 void setAdminFlag(bool x) { _admin = x; }
96 void setDocumentRoot(const std::string &x) { _wwwroot = x; }
97 std::string getDocumentRoot() { return _wwwroot; }
99 void setCgiRoot(const std::string &x) { _cgiroot = x; }
100 std::string getCgiRoot() { return _cgiroot; }
102 /// \brief Get the Root SSL certificate
103 const std::string& getRootCert() const {
104 return _rootcert;
106 /// \brief Set the Root SSL certificate
107 void setRootCert(const std::string& value) {
108 _rootcert = value;
111 /// \brief Get the Client SSL certificate
112 const std::string& getCertFile() const {
113 return _certfile;
115 /// \brief Set the Client SSL certificate
116 void setCertFile(const std::string& value) {
117 _certfile = value;
120 /// \brief Get the directory for client SSL certificates
121 const std::string& getCertDir() const {
122 return _certdir;
124 /// \brief Set the directory for client SSL certificates
125 void setCertDir(const std::string& value) {
126 _certdir = value;
129 /// \brief Dump the internal data of this class in a human readable form.
130 /// @remarks This should only be used for debugging purposes.
131 void dump() const { dump(std::cerr); }
133 /// \overload dump(std::ostream& os) const
134 void dump(std::ostream& os) const;
136 private:
137 /// \var _wwwroot
138 /// The root path for the streaming server to find al files.
139 std::string _wwwroot;
141 /// \var _cgiroot;
142 /// This specifies the default directory for all cgi (exeutables).
143 std::string _cgiroot;
145 /// \var _port_offset
146 /// This is an offset applied to all priviledged tcp/ip
147 /// ports. This enables the port number to be shifted into
148 /// the unpriviledged range (anything about 1024) so one
149 /// doesn't have to be root.
150 int _port_offset;
152 /// \var _testing
153 /// Turn on special output format to support Gnash
154 /// testing.
155 bool _testing;
157 /// \var _threading
158 /// Disable threading in the server I/O as much as
159 /// possible to make debugging easier. This is to only be
160 /// used by developers
161 bool _threading;
163 /// \var _fdthread
164 /// The number of file descriptors to be watched by each
165 /// dispatch thread. When threading is disabled, this is
166 /// also disabled, as all the file descriptors are watched
167 /// by one one thread as an aid to debugging.
168 size_t _fdthread;
170 /// \var _netdebug
171 /// Toggles very verbose debugging info from the network Network
172 /// class.
173 bool _netdebug;
175 /// \var _admin
176 /// This toggles whether the admin thread is started or
177 /// not, also to reduce complecity when debugging.
178 bool _admin;
180 /// \var _certfile
181 /// This is the name of the server certificate file
182 std::string _certfile;
184 /// \var _certdir
185 /// This is the path to the directory containing cert files
186 std::string _certdir;
190 /// \brief Dump to the specified output stream.
191 inline std::ostream& operator << (std::ostream& os, const CRcInitFile& crcini)
193 crcini.dump(os);
194 return os;
197 // End of gnash namespace
200 // __CRC_H__
201 #endif
204 // local Variables:
205 // mode: C++
206 // indent-tabs-mode: t
207 // End: