~ubuntu-branches/ubuntu/vivid/drizzle/vivid-proposed

« back to all changes in this revision

Viewing changes to plugin/json_server/http_server.h

  • Committer: Package Import Robot
  • Author(s): Tobias Frost
  • Date: 2013-08-22 20:18:31 UTC
  • mto: (20.1.1 sid)
  • mto: This revision was merged to the branch mainline in revision 21.
  • Revision ID: package-import@ubuntu.com-20130822201831-gn3ozsh7o7wmc5tk
Tags: upstream-7.2.3
ImportĀ upstreamĀ versionĀ 7.2.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
 
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
 
3
 *
 
4
 *  Copyright (C) 2012 Mohit Srivastava
 
5
 *
 
6
 *  This program is free software; you can redistribute it and/or modify
 
7
 *  it under the terms of the GNU General Public License as published by
 
8
 *  the Free Software Foundation; either version 2 of the License, or
 
9
 *  (at your option) any later version.
 
10
 *
 
11
 *  This program is distributed in the hope that it will be useful,
 
12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 *  GNU General Public License for more details.
 
15
 *
 
16
 *  You should have received a copy of the GNU General Public License
 
17
 *  along with this program; if not, write to the Free Software
 
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
19
 */
 
20
/**
 
21
 * @file Implements a class HTTPServer handles socket related functions. Based on example code https://gist.github.com/665437 .
 
22
 */
 
23
#include <event.h>
 
24
#include <evhttp.h>
 
25
#include <errno.h>
 
26
#include <string.h>
 
27
#include <fcntl.h>
 
28
#include <sys/socket.h>
 
29
#include <sys/types.h>
 
30
#include <netinet/in.h>
 
31
#include <arpa/inet.h>
 
32
#include <iostream>
 
33
using namespace std;
 
34
/**
 
35
 *  Drizzle Plugin Namespace
 
36
 */
 
37
namespace drizzle_plugin {
 
38
/**
 
39
 *  Json Server Plugin Namespace
 
40
 */
 
41
namespace json_server{
 
42
 
 
43
class HTTPServer 
 
44
{
 
45
  public:
 
46
    /**
 
47
     * Constructor
 
48
     */
 
49
    HTTPServer() {}
 
50
    /**
 
51
     * Destructor
 
52
     */
 
53
    ~HTTPServer() {}
 
54
  protected:
 
55
    /**
 
56
     * Bind socket to a address and port.
 
57
     *
 
58
     * @param address a constant character pointer.
 
59
     * @param port a integer.
 
60
     *
 
61
     * @return a non-negative file descriptor on success or -1 on failure.
 
62
     */
 
63
    int BindSocket(const char *address, int port);
 
64
};
 
65
 
 
66
}
 
67
}