f9589941dd17af4b6293efb04db0a5610de8d9a4
2 * Copyright (C) 2012 Toni Gundogdu <legatvs@gmail.com>
4 * This file is part of libquvi <http://quvi.sourceforge.net/>.
6 * This library is free software: you can redistribute it and/or
7 * modify it under the terms of the GNU Affero General Public
8 * License as published by the Free Software Foundation, either
9 * version 3 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Affero General Public License for more details.
16 * You should have received a copy of the GNU Affero General
17 * Public License along with this library. If not, see
18 * <http://www.gnu.org/licenses/>.
29 #include "_quvi_net_s.h"
30 #include "_quvi_net_resolve_s.h"
32 #include "net/handle.h"
34 gpointer
n_new(_quvi_t q
, const gchar
*url
)
36 _quvi_net_t n
= g_new0(struct _quvi_net_s
, 1);
37 n
->http_metainfo
.content_type
= g_string_new(NULL
);
38 n
->status
.errmsg
= g_string_new(NULL
);
39 n
->fetch
.content
= g_string_new(NULL
);
40 n
->url
.addr
= g_string_new(url
);
45 void n_free(gpointer p
)
47 _quvi_net_t n
= (_quvi_net_t
) p
;
52 g_string_free(n
->url
.addr
, TRUE
);
55 g_string_free(n
->status
.errmsg
, TRUE
);
56 n
->status
.errmsg
= NULL
;
58 g_string_free(n
->fetch
.content
, TRUE
);
59 n
->fetch
.content
= NULL
;
61 g_string_free(n
->http_metainfo
.content_type
, TRUE
);
62 n
->http_metainfo
.content_type
= NULL
;
68 gpointer
n_resolve_new(_quvi_t q
, const gchar
*url
)
70 _quvi_net_resolve_t r
= g_new0(struct _quvi_net_resolve_s
, 1);
71 r
->status
.errmsg
= g_string_new(NULL
);
72 r
->url
.addr
= g_string_new(url
);
73 r
->url
.dst
= g_string_new(NULL
);
78 void n_resolve_free(gpointer p
)
80 _quvi_net_resolve_t r
= (_quvi_net_resolve_t
) p
;
82 g_string_free(r
->status
.errmsg
, TRUE
);
83 r
->status
.errmsg
= NULL
;
85 g_string_free(r
->url
.addr
, TRUE
);
88 g_string_free(r
->url
.dst
, TRUE
);
95 /* vim: set ts=2 sw=2 tw=72 expandtab: */