Added request structure
[cascardo/atompub.git] / atom / request.c
1 /*
2  *  Copyright (C) 2008  Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
3  *
4  *  This program is free software; you can redistribute it and/or modify
5  *  it under the terms of the GNU General Public License as published by
6  *  the Free Software Foundation; either version 2 of the License, or
7  *  (at your option) any later version.
8  *
9  *  This program is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License along
15  *  with this program; if not, write to the Free Software Foundation, Inc.,
16  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18
19
20 #include <atompub/atom.h>
21
22 #include <glib.h>
23
24 struct _atom_request
25 {
26   int type;
27   char *request;
28 };
29
30 AtomRequest *
31 atom_request_new (int type, char *request)
32 {
33   AtomRequest *req;
34   req = g_slice_new (AtomRequest);
35   req->type = type;
36   req->request = g_strdup (request);
37   return req;
38 }
39
40 void
41 atom_request_delete (AtomRequest *req)
42 {
43   if (req->request)
44     g_free (req->request);
45   g_slice_free (AtomRequest, req);
46 }
47
48 int
49 atom_request_type (AtomRequest *req)
50 {
51   return req->type;
52 }
53
54 char *
55 atom_request_request (AtomRequest *req)
56 {
57   return req->request;
58 }