/
mms_file_util.h
94 lines (80 loc) · 2.49 KB
/
mms_file_util.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/*
* Copyright (C) 2013-2014 Jolla Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef JOLLA_MMS_FILE_UTIL_H
#define JOLLA_MMS_FILE_UTIL_H
#include "mms_lib_types.h"
/* Permissions for MMS files and directories */
#define MMS_DIR_PERM (0755)
#define MMS_FILE_PERM (0644)
/* Directories and files */
#define MMS_ATTIC_DIR "attic"
#define MMS_MESSAGE_DIR "msg"
#define MMS_PARTS_DIR "parts"
#define MMS_ENCODE_DIR "encode"
#define MMS_RESIZE_DIR "resize"
#define MMS_NOTIFICATION_IND_FILE "m-notification.ind"
#define MMS_NOTIFYRESP_IND_FILE "m-notifyresp.ind"
#define MMS_RETRIEVE_CONF_FILE "m-retrieve.conf"
#define MMS_ACKNOWLEDGE_IND_FILE "m-acknowledge.ind"
#define MMS_DELIVERY_IND_FILE "m-delivery.ind"
#define MMS_READ_REC_IND_FILE "m-read-rec.ind"
#define MMS_READ_ORIG_IND_FILE "m-read-orig.ind"
#define MMS_SEND_REQ_FILE "m-send.req"
#define MMS_SEND_CONF_FILE "m-send.conf"
#define MMS_UNRECOGNIZED_PUSH_FILE "push.pdu"
gboolean
mms_file_is_smil(
const char* file);
void
mms_remove_file_and_dir(
const char* file);
int
mms_create_file(
const char* dir,
const char* fname,
char** path,
GError** error);
gboolean
mms_write_file(
const char* dir,
const char* file,
const void* data,
gsize size,
char** path);
gboolean
mms_write_bytes(
const char* dir,
const char* file,
GBytes* bytes,
char** path);
gboolean
mms_file_copy(
const char* src,
const char* dest,
GError** error);
#define mms_message_dir(config,id) \
(g_strconcat((config)->root_dir, "/" MMS_MESSAGE_DIR "/" , id, NULL))
#define mms_task_dir(task) \
mms_message_dir(task_config(task),(task)->id)
#define mms_task_file(task,file) \
(g_strconcat(task_config(task)->root_dir, "/" MMS_MESSAGE_DIR "/" , \
(task)->id, "/", file, NULL))
#endif /* JOLLA_MMS_FILE_UTIL_H */
/*
* Local Variables:
* mode: C
* c-basic-offset: 4
* indent-tabs-mode: nil
* End:
*/