Code Sync up from tizen_2.4
[platform/core/connectivity/mtp-responder.git] / include / util / mtp_list.h
1 /*
2  * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef _MTP_LIST_H_
18 #define _MTP_LIST_H_
19
20 #include "mtp_datatype.h"
21 #include "mtp_util.h"
22
23 typedef struct _slist_node {
24         void *value;
25         struct _slist_node *link;
26 } slist_node_t;
27
28 typedef struct {
29         slist_node_t *start;
30         slist_node_t *end;
31         mtp_uint32 nnodes;
32 } slist_t;
33
34 typedef struct {
35         slist_node_t *node_ptr;
36 } slist_iterator;
37
38 void _util_init_list(slist_t *l_ptr);
39 mtp_bool _util_add_node(slist_t *l_ptr, void *data);
40 slist_node_t *_util_delete_node(slist_t *l_ptr, void *data);
41 slist_iterator *_util_init_list_iterator(slist_t *l_ptr);
42 void *_util_get_list_next(slist_iterator *iter);
43 slist_node_t *_util_get_first_node(slist_t *l_ptr);
44 void _util_deinit_list_iterator(slist_iterator *iter);
45
46 #endif /* _MTP_LIST_H_ */