Inital build master
authorRichard Whitehouse <github@richardwhiuk.com>
Thu, 27 Jan 2011 03:15:33 +0000 (03:15 +0000)
committerRichard Whitehouse <github@richardwhiuk.com>
Thu, 27 Jan 2011 03:15:33 +0000 (03:15 +0000)
20 files changed:
.gitignore [new file with mode: 0644]
CMakeLists.txt [new file with mode: 0644]
README [new file with mode: 0644]
include/cgi/log.hpp [new file with mode: 0644]
include/cgi/request.hpp [new file with mode: 0644]
include/cgi/response.hpp [new file with mode: 0644]
include/cgi/server.hpp [new file with mode: 0644]
include/exception.hpp [new file with mode: 0644]
include/iliad.hpp.in [new file with mode: 0644]
include/log.hpp [new file with mode: 0644]
include/request.hpp [new file with mode: 0644]
include/response.hpp [new file with mode: 0644]
include/server.hpp [new file with mode: 0644]
src/cgi/log.cpp [new file with mode: 0644]
src/cgi/main.cpp [new file with mode: 0644]
src/cgi/request.cpp [new file with mode: 0644]
src/log.cpp [new file with mode: 0644]
src/request.cpp [new file with mode: 0644]
src/response.cpp [new file with mode: 0644]
src/server.cpp [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..567609b
--- /dev/null
@@ -0,0 +1 @@
+build/
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644 (file)
index 0000000..aaa7e60
--- /dev/null
@@ -0,0 +1,49 @@
+# Iliad Project Build File
+
+cmake_minimum_required (VERSION 2.6)
+
+project(iliad)
+
+set (ILIAD_VERSION_MAJOR 1)
+set (ILIAD_VERSION_MINOR 0)
+
+set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG -Wall -Werror")
+
+configure_file (
+  "${PROJECT_SOURCE_DIR}/include/iliad.hpp.in"
+  "${PROJECT_BINARY_DIR}/include/iliad.hpp"
+  )
+
+include_directories("include" "${PROJECT_BINARY_DIR}/include")
+
+set(CGI_HEADER_FILES
+  include/cgi/log.hpp
+  include/cgi/request.hpp
+  include/cgi/response.hpp
+  include/cgi/server.hpp
+)
+
+set(HEADER_FILES
+  include/exception.hpp
+  include/log.hpp
+  include/request.hpp
+  include/response.hpp
+  include/server.hpp
+)
+
+set(CGI_SOURCE_FILES
+  src/cgi/main.cpp
+  src/cgi/log.cpp
+  src/cgi/request.cpp
+)
+
+set(SOURCE_FILES
+  src/server.cpp
+  src/log.cpp
+  src/request.cpp
+  src/response.cpp
+)
+
+add_executable(iliad-cgi ${HEADER_FILES} ${SOURCE_FILES} ${CGI_HEADER_FILES} ${CGI_SOURCE_FILES})
+
+INSTALL(TARGETS iliad-cgi DESTINATION /usr/lib/cgi-bin)
diff --git a/README b/README
new file mode 100644 (file)
index 0000000..3221fac
--- /dev/null
+++ b/README
@@ -0,0 +1,20 @@
+Iliad Internet Server.
+
+The Iliad Internet Server is a C++ Content Management System designed to manage websites.
+
+INSTALL
+-------
+
+mkdir build
+cd build
+cmake ..
+make
+sudo make install
+
+This places a copy of iliad-cgi in your /usr/lib/cgi-bin
+
+In a .htaccess file, you can setup a site with:
+
+RewriteEngine on
+RewriteRule ^(.*)$ /cgi-bin/iliad-cgi [QSA,L,E=ILIAD_CONFIG:/etc/iliad/iliad.dev]
+
diff --git a/include/cgi/log.hpp b/include/cgi/log.hpp
new file mode 100644 (file)
index 0000000..8bbc7d9
--- /dev/null
@@ -0,0 +1,29 @@
+#include <iostream>
+#include <string>
+
+#include <log.hpp>
+
+namespace Iliad {
+
+namespace CGI {
+
+class Log : public Iliad::Log {
+
+public:
+       Log(std::ostream& out);
+
+       virtual void operator()(Iliad::Exception& e){
+               log << e.what() << std::endl;
+       }
+
+       virtual ~Log();
+
+private:
+       std::ostream& log;
+
+};
+
+}
+
+}
+
diff --git a/include/cgi/request.hpp b/include/cgi/request.hpp
new file mode 100644 (file)
index 0000000..2ee35e3
--- /dev/null
@@ -0,0 +1,22 @@
+#include <iostream>
+#include <vector>
+#include <string>
+
+#include <request.hpp>
+
+namespace Iliad {
+namespace CGI {
+
+class Request : public Iliad::Request {
+
+public:
+
+       Request(int argc, char** argv, std::istream& in);
+
+       Request(std::vector<std::string>& args, std::istream& in);
+
+};
+
+}
+}
+
diff --git a/include/cgi/response.hpp b/include/cgi/response.hpp
new file mode 100644 (file)
index 0000000..c41cc6c
--- /dev/null
@@ -0,0 +1,21 @@
+#include <iostream>
+
+#include <response.hpp>
+
+namespace Iliad {
+namespace CGI {
+
+class Response : public Iliad::Response {
+
+public:
+
+       Response(std::ostream& out) : Iliad::Response(){
+
+       }
+
+};
+
+
+}
+}
+
diff --git a/include/cgi/server.hpp b/include/cgi/server.hpp
new file mode 100644 (file)
index 0000000..be97b8f
--- /dev/null
@@ -0,0 +1,14 @@
+#include <server.hpp>
+
+namespace Iliad {
+
+namespace CGI {
+
+class Server : public Iliad::Server {
+
+};
+
+}
+
+}
+
diff --git a/include/exception.hpp b/include/exception.hpp
new file mode 100644 (file)
index 0000000..a8cfb4d
--- /dev/null
@@ -0,0 +1,24 @@
+#include <string>
+
+namespace Iliad {
+
+class Exception {
+
+public:
+       virtual ~Exception(){
+
+       }
+
+       virtual std::string what() = 0;
+
+protected:
+
+       Exception(){
+       
+       }
+
+
+};
+
+}
+
diff --git a/include/iliad.hpp.in b/include/iliad.hpp.in
new file mode 100644 (file)
index 0000000..a428100
--- /dev/null
@@ -0,0 +1,4 @@
+#define ILIAD_VERSION_MAJOR @ILIAD_VERSION_MAJOR@
+#define ILIAD_VERSION_MINOR @ILIAD_VERSION_MINOR@
+
+#define ILIAD "@ILIAD_VERSION_MAJOR@ @ILIAD_VERSION_MINOR@"
diff --git a/include/log.hpp b/include/log.hpp
new file mode 100644 (file)
index 0000000..cb8f662
--- /dev/null
@@ -0,0 +1,17 @@
+#include <exception.hpp>
+
+namespace Iliad {
+
+class Log {
+
+public:
+       virtual ~Log();
+
+       virtual void operator()(Iliad::Exception& e) = 0;
+
+protected:
+       Log();
+
+};
+
+}
diff --git a/include/request.hpp b/include/request.hpp
new file mode 100644 (file)
index 0000000..2390a7d
--- /dev/null
@@ -0,0 +1,17 @@
+#ifndef ILIAD_FILE_REQUEST
+#define ILIAD_FILE_REQUEST
+
+namespace Iliad {
+
+class Request {
+
+public:
+       Request();
+       virtual ~Request();
+
+};
+
+}
+
+#endif
+
diff --git a/include/response.hpp b/include/response.hpp
new file mode 100644 (file)
index 0000000..8cdf9f9
--- /dev/null
@@ -0,0 +1,17 @@
+#ifndef ILIAD_FILE_RESPONSE
+#define ILIAD_FILE_RESPONSE
+
+namespace Iliad {
+
+class Response {
+
+public:
+       Response();
+       virtual ~Response();
+
+};
+
+}
+
+#endif
+
diff --git a/include/server.hpp b/include/server.hpp
new file mode 100644 (file)
index 0000000..5bd92b4
--- /dev/null
@@ -0,0 +1,19 @@
+#include <request.hpp>
+#include <response.hpp>
+
+namespace Iliad {
+
+class Server {
+
+public:
+       virtual ~Server();
+
+       virtual void process(Iliad::Request& req, Iliad::Response& rep);
+
+protected:
+       Server();
+
+};
+
+}
+
diff --git a/src/cgi/log.cpp b/src/cgi/log.cpp
new file mode 100644 (file)
index 0000000..71beb58
--- /dev/null
@@ -0,0 +1,11 @@
+#include <cgi/log.hpp>
+
+Iliad::CGI::Log::Log(std::ostream& out) : Iliad::Log::Log() , log(out){
+
+}
+
+Iliad::CGI::Log::~Log(){
+
+}
+
+
diff --git a/src/cgi/main.cpp b/src/cgi/main.cpp
new file mode 100644 (file)
index 0000000..856b14f
--- /dev/null
@@ -0,0 +1,32 @@
+#include <iliad.hpp>
+
+#include <iostream>
+
+#include <cgi/server.hpp>
+#include <cgi/log.hpp>
+#include <cgi/request.hpp>
+#include <cgi/response.hpp>
+
+int main(int argc, char** argv){
+
+       #ifdef DEBUG
+               std::cout << "Content-type: text/plain" << std::endl << std::endl;
+       #endif
+
+       Iliad::CGI::Log log(std::cerr);
+
+       Iliad::CGI::Request request(argc, argv, std::cin); 
+
+       Iliad::CGI::Response response(std::cout);
+
+       Iliad::CGI::Server server;
+
+       try {
+               server.process(request, response);
+               return 0;
+       } catch(...){
+               return -1;
+       }
+
+}
+
diff --git a/src/cgi/request.cpp b/src/cgi/request.cpp
new file mode 100644 (file)
index 0000000..78008d3
--- /dev/null
@@ -0,0 +1,14 @@
+#include <cgi/request.hpp>
+
+Iliad::CGI::Request::Request(int argc, char** argv, std::istream& in) : Iliad::Request(){
+       std::vector<std::string> args;
+       for(int i = 0; i < argc; i ++){
+               args.push_back(std::string(argv[i]));
+       }   
+       Request(args, in);
+} 
+
+Iliad::CGI::Request::Request(std::vector<std::string>& args, std::istream& in){
+
+}
+
diff --git a/src/log.cpp b/src/log.cpp
new file mode 100644 (file)
index 0000000..99431e6
--- /dev/null
@@ -0,0 +1,10 @@
+#include <log.hpp>
+
+Iliad::Log::Log(){
+
+}
+
+Iliad::Log::~Log(){
+
+}
+
diff --git a/src/request.cpp b/src/request.cpp
new file mode 100644 (file)
index 0000000..506570f
--- /dev/null
@@ -0,0 +1,10 @@
+#include <request.hpp>
+
+Iliad::Request::Request(){
+
+}
+
+Iliad::Request::~Request(){
+
+}
+
diff --git a/src/response.cpp b/src/response.cpp
new file mode 100644 (file)
index 0000000..7d2ff2a
--- /dev/null
@@ -0,0 +1,10 @@
+#include <response.hpp>
+
+Iliad::Response::Response(){
+
+}
+
+Iliad::Response::~Response(){
+
+}
+
diff --git a/src/server.cpp b/src/server.cpp
new file mode 100644 (file)
index 0000000..2f5e9a9
--- /dev/null
@@ -0,0 +1,15 @@
+#include <server.hpp>
+
+Iliad::Server::Server(){
+
+}
+
+Iliad::Server::~Server(){
+
+}
+
+void Iliad::Server::process(Iliad::Request& req, Iliad::Response& rep){
+
+}
+
+