Code Sync up from tizen_2.4
[platform/core/connectivity/mtp-responder.git] / include / mtp_cmd_handler_util.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_CMD_HANDLER_UTIL_H_
18 #define _MTP_CMD_HANDLER_UTIL_H_
19
20 #include "mtp_device.h"
21
22 typedef struct {
23         mtp_uint32 store_id;
24         mtp_uint64 obj_size;
25         mtp_obj_t *obj;
26 } obj_data_t;
27
28 mtp_err_t _hutil_get_storage_entry(mtp_uint32 store_id, store_info_t *info);
29 mtp_err_t _hutil_get_storage_ids(ptp_array_t *store_ids);
30 mtp_err_t _hutil_get_device_property(mtp_uint32 prop_id,
31                 device_prop_desc_t* dev_prop);
32 mtp_err_t _hutil_set_device_property(mtp_uint32 prop_id, void *data,
33                 mtp_uint32 data_sz);
34 mtp_err_t _hutil_reset_device_entry(mtp_uint32 prop_id);
35 mtp_err_t _hutil_add_object_entry(obj_info_t *obj_info, mtp_char *file_name,
36                 mtp_obj_t **new_obj);
37 mtp_err_t _hutil_remove_object_entry(mtp_uint32 obj_handle, mtp_uint32 format);
38 mtp_err_t _hutil_get_object_entry(mtp_uint32 obj_handle, mtp_obj_t **obj_ptr);
39 mtp_err_t _hutil_copy_object_entries(mtp_uint32 dst_store_id,
40                 mtp_uint32 src_store_id, mtp_uint32 h_parent, mtp_uint32 obj_handle,
41                 mtp_uint32 *new_hobj, mtp_bool keep_handle);
42 mtp_err_t _hutil_move_object_entry(mtp_uint32 dst_store_id, mtp_uint32 h_parent,
43                 mtp_uint32 obj_handle);
44 mtp_err_t _hutil_duplicate_object_entry(mtp_uint32 dst_store_id,
45                 mtp_uint32 h_parent, mtp_uint32 obj_handle, mtp_uint32 *new_handle);
46 mtp_err_t _hutil_read_file_data_from_offset(mtp_uint32 obj_handle, off_t offset,
47                 void *data, mtp_uint32 *data_sz);
48 mtp_err_t _hutil_write_file_data(mtp_uint32 store_id, mtp_obj_t *obj,
49                 mtp_char *fpath);
50 mtp_err_t _hutil_get_object_entry_size(mtp_uint32 obj_handle, mtp_uint64 *obj_sz);
51 mtp_err_t _hutil_set_protection(mtp_uint32 obj_handle, mtp_uint16 prot_status);
52 mtp_err_t _hutil_get_num_objects(mtp_uint32 store_id, mtp_uint32 h_parent,
53                 mtp_uint32 format, mtp_uint32 *num_obj);
54 mtp_err_t _hutil_get_object_handles(mtp_uint32 store_id, mtp_uint32 format,
55                 mtp_uint32 h_parent, ptp_array_t *handle_arr);
56 mtp_err_t _hutil_construct_object_entry(mtp_uint32 store_id, mtp_uint32 h_parent,
57                 obj_data_t *objdata, mtp_obj_t **obj, void *data, mtp_uint32 data_sz);
58 mtp_err_t _hutil_construct_object_entry_prop_list(
59                 mtp_uint32 store_id,
60                 mtp_uint32 h_parent,
61                 mtp_uint16 format,
62                 mtp_uint64 obj_sz,
63                 obj_data_t *obj_data,
64                 mtp_obj_t **obj_ptr,
65                 void *data,
66                 mtp_int32 data_sz,
67                 mtp_uint32 *err_idx);
68 mtp_err_t _hutil_get_object_prop_value(mtp_uint32 obj_handle, mtp_uint32 prop_code,
69                 obj_prop_val_t  *prop_val, mtp_obj_t **obj);
70 mtp_err_t _hutil_update_object_property(
71                 mtp_uint32 obj_handle,
72                 mtp_uint32 prop_code,
73                 mtp_uint16 *data_type,
74                 void *buf,
75                 mtp_uint32 buf_sz,
76                 mtp_uint32 *prop_sz);
77 mtp_err_t _hutil_get_prop_desc(mtp_uint32 format, mtp_uint32 prop_code, void *data);
78 mtp_err_t _hutil_get_object_prop_supported(mtp_uint32 format,
79                 ptp_array_t *prop_arr);
80
81 #ifdef MTP_USE_RUNTIME_GETOBJECTPROPVALUE
82 mtp_err_t _hutil_get_object_prop_list(mtp_uint32 obj_handle,
83                 mtp_uint32 format,
84                 mtp_uint32 prop_code,
85                 mtp_uint32 group_code,
86                 mtp_uint32 depth,
87                 obj_proplist_t *prop_list,
88                 ptp_array_t *obj_arr);
89 #else /* MTP_USE_RUNTIME_GETOBJECTPROPVALUE */
90 mtp_err_t _hutil_get_object_prop_list(
91                 mtp_uint32 obj_handle,
92                 mtp_uint32 format,
93                 mtp_uint32 prop_code,
94                 mtp_uint32 group_code,
95                 mtp_uint32 depth,
96                 obj_proplist_t *prop_list);
97 #endif /* MTP_USE_RUNTIME_GETOBJECTPROPVALUE */
98
99 mtp_err_t _hutil_add_object_references_enhanced(mtp_uint32 obj_handle,
100                 mtp_uchar *buffer, mtp_uint32 buf_sz);
101 mtp_err_t _hutil_remove_object_reference(mtp_uint32 obj_handle,
102                 mtp_uint32 ref_handle);
103 mtp_err_t _hutil_get_object_references(mtp_uint32 obj_handle,
104                 ptp_array_t *parray, mtp_uint32 *num_ele);
105 mtp_err_t _hutil_get_number_of_objects(mtp_uint32 store_id,
106                 mtp_uint32 *num_obj);
107 mtp_err_t _hutil_get_interdep_prop_config_list_size(mtp_uint32 *list_sz,
108                 mtp_uint32 format);
109 mtp_err_t _hutil_get_interdep_prop_config_list_data(void *data,
110                 mtp_uint32 list_sz, mtp_uint32 format);
111 mtp_err_t _hutil_get_playback_skip(mtp_int32 skip_param);
112 mtp_err_t _hutil_format_storage(mtp_uint32 store_id, mtp_uint32 fs_format);
113 mtp_uint32 _hutil_get_storage_info_size(store_info_t *store_info);
114
115 #endif /* _MTP_CMD_HANDLER_UTIL_H_ */