A potential memory leak was fixed, we cannot just bail out without cleaning up the...
[handlerosm.git] / handler_osm.h
blob23dd5bb3354685ef4a5d653a963c5bd9175197ee
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3 /* Cherokee
5 * Authors:
6 * Alvaro Lopez Ortega <alvaro@alobbs.com>
8 * Copyright (C) 2001-2008 Alvaro Lopez Ortega
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of version 2 of the GNU General Public
12 * License as published by the Free Software Foundation.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22 * USA
25 #ifndef CHEROKEE_HANDLER_OSM_H
26 #define CHEROKEE_HANDLER_OSM_H
28 #include <cherokee/common-internal.h>
29 #include <cherokee/cherokee.h>
30 #include <Mapi.h>
32 #define LEGACY_SQL 1
34 /* Data types
37 typedef struct {
38 CHEROKEE_RWLOCK_T(lock);
39 int dummy;
40 } cherokee_handler_osm_priv_t;
42 #define OSM_PRIV(x) ((cherokee_handler_osm_priv_t *)((x)->priv))
43 #define OSM_LOCK(x) (&OSM_PRIV(x)->lock)
45 typedef struct {
46 cherokee_module_props_t base;
47 cherokee_boolean_t read_only;
48 cherokee_buffer_t db_hostname;
49 cint_t db_port;
50 cherokee_buffer_t db_username;
51 cherokee_buffer_t db_password;
52 cherokee_buffer_t db_name;
54 void * priv;
55 cherokee_list_t dbh_pool;
56 } cherokee_handler_osm_props_t;
58 typedef struct {
59 Mapi dbh;
60 cherokee_handler_t handler;
61 cherokee_buffer_t buffer;
62 } cherokee_handler_osm_t;
65 #define HDL_OSM(x) ((cherokee_handler_osm_t *)(x))
66 #define PROP_OSM(x) ((cherokee_handler_osm_props_t *)(x))
67 #define HDL_OSM_PROPS(x) (PROP_OSM(MODULE(x)->props))
70 /* Library init function
72 void PLUGIN_INIT_NAME(osm) (cherokee_plugin_loader_t *loader);
73 ret_t cherokee_handler_osm_new (cherokee_handler_t **hdl, cherokee_connection_t *cnt, cherokee_module_props_t *props);
75 /* virtual methods implementation
77 ret_t cherokee_handler_osm_init (cherokee_handler_osm_t *hdl);
78 ret_t cherokee_handler_osm_free (cherokee_handler_osm_t *hdl);
79 ret_t cherokee_handler_osm_step (cherokee_handler_osm_t *hdl, cherokee_buffer_t *buffer);
80 ret_t cherokee_handler_osm_add_headers (cherokee_handler_osm_t *hdl, cherokee_buffer_t *buffer);
82 #endif /* CHEROKEE_HANDLER_OSM_H */