4 * Copyright (c) 2004 Novell, Inc. All Rights Reserved.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
21 #include "nmrequest.h"
32 nm_response_cb callback
;
37 NMRequest
*nm_create_request(const char *cmd
, int trans_id
, int gmt
, nm_response_cb cb
,
38 gpointer resp_data
, gpointer user_define
)
45 req
= g_new0(NMRequest
, 1);
46 req
->cmd
= g_strdup(cmd
);
47 req
->trans_id
= trans_id
;
50 req
->data
= resp_data
;
51 req
->user_define
= user_define
;
54 purple_debug_info("novell", "Creating NMRequest instance, total=%d\n", ++count
);
60 nm_release_request(NMRequest
* req
)
62 if (req
&& (--req
->ref_count
== 0)) {
66 purple_debug_info("novell",
67 "Releasing NMRequest instance, total=%d\n", --count
);
73 nm_request_add_ref(NMRequest
* req
)
80 nm_request_set_callback(NMRequest
* req
, nm_response_cb callback
)
83 req
->callback
= callback
;
87 nm_request_set_data(NMRequest
* req
, gpointer data
)
94 nm_request_set_user_define(NMRequest
* req
, gpointer user_define
)
97 req
->user_define
= user_define
;
101 nm_request_get_trans_id(NMRequest
* req
)
104 return req
->trans_id
;
110 nm_request_get_cmd(NMRequest
* req
)
119 nm_request_get_data(NMRequest
* req
)
128 nm_request_get_user_define(NMRequest
* req
)
133 return req
->user_define
;
137 nm_request_get_callback(NMRequest
* req
)
142 return req
->callback
;
147 nm_request_set_ret_code(NMRequest
* req
, NMERR_T rc
)
154 nm_request_get_ret_code(NMRequest
* req
)
157 return req
->ret_code
;
159 return (NMERR_T
) - 1;