Skip to content

Commit

Permalink
Meh! Still playing
Browse files Browse the repository at this point in the history
  • Loading branch information
alobbs committed Jul 29, 2013
1 parent 6f4e873 commit 83214a2
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 8 deletions.
8 changes: 7 additions & 1 deletion src/CMakeLists.txt
@@ -1,4 +1,7 @@
INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIR} ${CMAKE_BINARY_DIR} )

set (SRC_SERVER
Server.cpp Server.h
Socket.cpp Socket.h
Connection.cpp Connection.h
)
Expand All @@ -9,7 +12,10 @@ add_library(
${SRC_SERVER}
${INCLUDE_FILES} ${LIBEVENT_INCLUDE_DIR}
)
target_link_libraries (
server
${LIBEVENT_LIB} ${Boost_LIBRARIES}
)

INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIR} ${CMAKE_BINARY_DIR} )
ADD_EXECUTABLE( h2main main.cpp )
TARGET_LINK_LIBRARIES( h2main server ${Boost_LIBRARIES} )
45 changes: 45 additions & 0 deletions src/Server.cpp
@@ -0,0 +1,45 @@
/* All files in http2d are Copyright (C) 2013 Alvaro Lopez Ortega.
*
* Authors:
* * Alvaro Lopez Ortega <alvaro@alobbs.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include "Server.h"

namespace http2d {

Server::Server() {
evbase = event_base_new();
// TODO Auto-generated constructor stub

}

Server::~Server() {
// TODO Auto-generated destructor stub
}

} /* namespace http2d */
54 changes: 54 additions & 0 deletions src/Server.h
@@ -0,0 +1,54 @@
/* All files in http2d are Copyright (C) 2013 Alvaro Lopez Ortega.
*
* Authors:
* * Alvaro Lopez Ortega <alvaro@alobbs.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/


#ifndef SERVER_H_
#define SERVER_H_

#include <event2/event.h>
#include <event2/event_struct.h>
#include <event2/bufferevent.h>
#include <event2/buffer.h>

namespace http2d {

class Server
{
public:
Server();
virtual ~Server();

protected:
struct event_base *evbase;
struct event *timer;
};

} /* namespace http2d */
#endif /* SERVER_H_ */
18 changes: 11 additions & 7 deletions src/main.cpp
Expand Up @@ -30,30 +30,34 @@

#include <string>
#include <iostream>
// #include <boost/program_options.hpp>

#include <boost/program_options/options_description.hpp>
#include <boost/program_options/variables_map.hpp>
#include <boost/program_options.hpp>

namespace po = boost::program_options;
namespace opts = boost::program_options;


int
main (int argc, char *argv[])
{

// Declare the supported options.
po::options_description desc("Allowed options");
opts::options_description desc("Allowed options");
desc.add_options()
("help", "produce help message")
("compression", po::value<int>(), "set compression level")
("compression", opts::value<int>(), "set compression level")
;

po::variables_map vm;
po::store(po::parse_command_line(argc, argv, desc), vm);
po::notify(vm);
opts::variables_map vm;
opts::store(opts::parse_command_line(argc, argv, desc), vm);
opts::notify(vm);

if (vm.count("help")) {
std::cout << desc << "\n";
return 1;
}

return 120;
return 0;
}

0 comments on commit 83214a2

Please sign in to comment.