[cleanup]revise file location and name
[platform/core/connectivity/mtp-responder.git] / include / mtp_util_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 #ifdef __cplusplus
21 extern "C" {
22 #endif
23
24 #include "mtp_datatype.h"
25 #include "mtp_util.h"
26
27 typedef struct _slist_node {
28         void *value;
29         struct _slist_node *link;
30 } slist_node_t;
31
32 typedef struct {
33         slist_node_t *start;
34         slist_node_t *end;
35         mtp_uint32 nnodes;
36 } slist_t;
37
38 typedef struct {
39         slist_node_t *node_ptr;
40 } slist_iterator;
41
42 void _util_init_list(slist_t *l_ptr);
43 mtp_bool _util_add_node(slist_t *l_ptr, void *data);
44 slist_node_t *_util_delete_node(slist_t *l_ptr, void *data);
45 slist_iterator *_util_init_list_iterator(slist_t *l_ptr);
46 void *_util_get_list_next(slist_iterator *iter);
47 slist_node_t *_util_get_first_node(slist_t *l_ptr);
48 void _util_deinit_list_iterator(slist_iterator *iter);
49
50 #ifdef __cplusplus
51 }
52 #endif
53
54 #endif /* _MTP_LIST_H_ */