2 * Copyright (C) 2012 Toni Gundogdu <legatvs@gmail.com>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library 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 GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
27 #include "_quvi_macro.h"
28 #include "_quvi_net_resolve_s.h"
30 #include "net/resolve.h"
31 #include "net/handle.h"
33 extern QuviError
c_resolve(_quvi_t
, _quvi_net_resolve_t
);
35 QuviError
n_resolve(_quvi_t q
, _quvi_net_resolve_t r
)
37 QuviError rc
= QUVI_OK
;
39 if (q
->cb
.status
!= NULL
)
41 const glong p
= q_makelong(QUVI_CALLBACK_STATUS_RESOLVE
, 0);
43 if (q
->cb
.status(p
, 0) != QUVI_OK
)
44 return (QUVI_ERROR_CALLBACK_ABORTED
);
47 if (q
->cb
.resolve
!= NULL
)
48 rc
= q
->cb
.resolve(r
);
54 if (q
->cb
.status
!= NULL
)
56 const glong p
= q_makelong(QUVI_CALLBACK_STATUS_RESOLVE
,
57 QUVI_CALLBACK_STATUS_DONE
);
59 if (q
->cb
.status(p
, 0) != QUVI_OK
)
60 rc
= QUVI_ERROR_CALLBACK_ABORTED
;
65 if (r
->status
.errmsg
->len
>0)
66 g_string_assign(q
->status
.errmsg
, r
->status
.errmsg
->str
);
69 g_string_assign(q
->status
.errmsg
,
70 "unknown error: callback returned empty errmsg");
74 q
->status
.resp_code
= r
->status
.resp_code
;
80 /* vim: set ts=2 sw=2 tw=72 expandtab: */