summaryrefslogtreecommitdiffstats
path: root/src/bridge_request.h
blob: 3d6de17ceeab4565f1b610364b4a7da23e7a1640 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
 * json dbus bridge
 *
 * Copyright (c) 2009, 2010 by Michael Olbrich <m.olbrich@pengutronix.de>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef BRIDGE_REQUEST_H
#define BRIDGE_REQUEST_H

#include <dbus/dbus.h>

#include "fcgiapp.h"

typedef struct bridge_request bridge_request_t;
typedef struct bridge bridge_t;

typedef enum {
	error_origin_server = 1,
	error_origin_method = 2,
	error_origin_transport = 3,
	error_origin_client = 4
} error_origin_t;

typedef enum {
	error_code_illegal_service = 1,
	error_code_service_not_found = 2,
	error_code_class_not_found = 3,
	error_code_method_not_found = 4,
	error_code_parameter_missmatch = 5,
	error_code_permission_denied = 6
} error_code_t;

struct bridge_request {
	FCGX_Request request;
	int id;
	struct json_tokener *tokener;
	DBusConnection *dbus_connection;
	bridge_t *bridge;
	bridge_request_t *next;
	struct json_object *response;
};

int bridge_request_init(bridge_request_t *self, bridge_t *bridge, DBusConnection *dbus_connection, int socket);
int bridge_request_destroy(bridge_request_t *self);

int bridge_request_accept(bridge_request_t *self);
int bridge_request_handle(bridge_request_t *self);

#endif /* BRIDGE_REQUEST_H */