2 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software
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.
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.
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
23 #include <iostream> // for output operator
29 /// This namespace is for all the Cygnal specific classes not used by
30 /// anything else in Gnash.
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
37 class DSOEXPORT CRcInitFile
: public gnash::RcInitFile
40 /// Construct only by getDefaultInstance()
42 /// Never destroy (TODO: add a destroyDefaultInstance)
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.
56 /// \brief Parse and load configuration file
58 /// @param filespec The path and file name of the disk file to parse.
60 /// @return True if the file was parsed successfully, false if not.
61 bool parseFile(const std::string
& filespec
);
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 {
106 /// \brief Set the Root SSL certificate
107 void setRootCert(const std::string
& value
) {
111 /// \brief Get the Client SSL certificate
112 const std::string
& getCertFile() const {
115 /// \brief Set the Client SSL certificate
116 void setCertFile(const std::string
& value
) {
120 /// \brief Get the directory for client SSL certificates
121 const std::string
& getCertDir() const {
124 /// \brief Set the directory for client SSL certificates
125 void setCertDir(const std::string
& 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;
138 /// The root path for the streaming server to find al files.
139 std::string _wwwroot
;
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.
153 /// Turn on special output format to support Gnash
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
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.
171 /// Toggles very verbose debugging info from the network Network
176 /// This toggles whether the admin thread is started or
177 /// not, also to reduce complecity when debugging.
181 /// This is the name of the server certificate file
182 std::string _certfile
;
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
)
197 // End of gnash namespace
206 // indent-tabs-mode: t