• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • Examples
  • File List
  • File Members

proc.h

Go to the documentation of this file.
00001 // 
00002 //   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software
00003 //   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 __PROC_H__
00021 #define __PROC_H__ 1
00022 
00023 #include <string>
00024 #include <map>
00025 
00026 #include <boost/thread/mutex.hpp>
00027 #include <boost/thread/condition.hpp>
00028 
00029 #include "network.h"
00030 #include "dsodefs.h"
00031 
00032 namespace cygnal
00033 {
00034   
00035 class Proc : public gnash::Network {
00036 public:
00037     DSOEXPORT Proc (void);
00038     DSOEXPORT ~Proc (void);
00039     static Proc& getDefaultInstance();
00040     
00041     // These flags control whether the stdout of the child process gets displayed
00042     bool setOutput (const std::string &output, bool outflag);
00043     bool getOutput (const std::string &output);
00044 
00045     // This starts the process running via the usual fork() & exec()
00046     bool startCGI (void);
00047     bool startCGI (const std::string &filespec);
00048     bool startCGI (const std::string &filespec, boost::uint16_t port);
00049     bool startCGI (const std::string &filespec, bool output);
00050     bool startCGI (const std::string &filespec, bool output, boost::uint16_t port);
00051 
00052     void setDocroot(const std::string &path) { _docroot = path; } ;
00053     std::string &getDocroot() { return _docroot; };
00054     
00055     // This opens a network connection to the process
00056     bool connectCGI (const std::string &host, boost::uint16_t port);
00057 
00058     // This finds the process
00059     int findCGI (const std::string &filespec);
00060 
00061     // This stop the process
00062     bool stopCGI (void);
00063     bool stopCGI (const std::string &filespec);
00064 private:
00065     std::map<std::string, bool> _output;
00066     std::map<std::string, int>  _pids;
00067     std::map<std::string, int>  _cons;
00068     std::string                 _docroot;
00069     
00070     boost::mutex        _mutex;
00071 };
00072 
00073 } // end of cygnal namespace
00074 
00075 #endif  // end of __PROC_H__
00076 
00077 // Local Variables:
00078 // mode: C++
00079 // indent-tabs-mode: t
00080 // End:

Generated on Fri Mar 16 2012 15:46:11 for Gnash by  doxygen 1.7.1