taskrambler  0.1.9
Web server and task management solution.
http/writer.c
Go to the documentation of this file.
1 /**
2  * \file
3  *
4  * \author Georg Hopp
5  *
6  * \copyright
7  * Copyright © 2012 Georg Hopp
8  *
9  * This program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 3 of the License, or
12  * (at your option) any later version.
13  *
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.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program. If not, see <http://www.gnu.org/licenses/>.
21  */
22 
23 #include <stdarg.h>
24 
25 #include "class.h"
26 #include "stream.h"
27 
28 #include "queue.h"
29 #include "http/writer.h"
30 
31 #include "utils/memory.h"
32 
33 static
34 int
35 httpWriterCtor(void * _this, va_list * params)
36 {
37  HttpWriter this = _this;
38 
39  this->queue = new(Queue);
40 
41  return 0;
42 }
43 
44 static
45 void
46 httpWriterDtor(void * _this)
47 {
48  HttpWriter this = _this;
49 
50  delete(this->queue);
51 
52  if (NULL != this->buffer) {
53  MEM_FREE(this->buffer);
54  }
55 
56  if (NULL != this->current) {
57  delete(this->current);
58  }
59 }
60 
62 INIT_IFACE(StreamWriter, httpWriterWrite);
63 CREATE_CLASS(HttpWriter, NULL, IFACE(Class), IFACE(StreamWriter));
64 
65 // vim: set ts=4 sw=4:
#define MEM_FREE(seg)
Definition: memory.h:28
CREATE_CLASS(HttpWriter, NULL, IFACE(Class), IFACE(StreamWriter))
INIT_IFACE(Class, httpWriterCtor, httpWriterDtor, NULL)
#define IFACE(name)
Definition: interface.h:34
static int httpWriterCtor(void *_this, va_list *params)
Definition: http/writer.c:35
ssize_t httpWriterWrite(void *, Stream)
static void httpWriterDtor(void *_this)
Definition: http/writer.c:46