Intermediate update... consider this version completely broken
[handlervirt.git] / handler_example.h
blobcbc5ddd6d73cfe1eaeccff1e151f125c7e410402
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>
7 * Stefan de Konink <stefan@konink.de>
9 * Copyright (C) 2001-2008 Alvaro Lopez Ortega
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of version 2 of the GNU General Public
13 * License as published by the Free Software Foundation.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23 * USA
26 #ifndef CHEROKEE_HANDLER_EXAMPLE_H
27 #define CHEROKEE_HANDLER_EXAMPLE_H
30 #include "common.h"
31 #include "buffer.h"
32 #include "handler.h"
33 #include "connection.h"
34 #include "plugin_loader.h"
37 #include <cherokee/cherokee.h>
39 /* Data types
41 typedef struct {
42 cherokee_module_props_t base;
44 /* Configuration parameters */
45 cherokee_boolean_t example_config;
46 } cherokee_handler_example_props_t;
48 typedef struct {
49 /* Shared structures */
50 cherokee_handler_t handler;
52 /* A buffer is your output 'to be' */
53 cherokee_buffer_t buffer;
55 enum {
56 send_page,
57 send_yourmother /* not advised but possible */
58 } action; /* this could implement a state machine */
59 } cherokee_handler_example_t;
61 #define HDL_EXAMPLE(x) ((cherokee_handler_example_t *)(x))
62 #define PROP_EXAMPLE(x) ((cherokee_handler_example_props_t *)(x))
63 #define HDL_EXAMPLE_PROPS(x) (PROP_EXAMPLE(MODULE(x)->props))
66 /* Library init function
68 void PLUGIN_INIT_NAME(example) (cherokee_plugin_loader_t *loader);
69 ret_t cherokee_handler_example_new (cherokee_handler_t **hdl, cherokee_connection_t *cnt, cherokee_module_props_t *props);
71 /* virtual methods implementation
73 ret_t cherokee_handler_example_init (cherokee_handler_example_t *hdl);
74 ret_t cherokee_handler_example_free (cherokee_handler_example_t *hdl);
75 ret_t cherokee_handler_example_step (cherokee_handler_example_t *hdl, cherokee_buffer_t *buffer);
76 ret_t cherokee_handler_example_add_headers (cherokee_handler_example_t *hdl, cherokee_buffer_t *buffer);
78 #endif /* CHEROKEE_HANDLER_EXAMPLE_H */