summaryrefslogtreecommitdiffstats
path: root/util/include/axutil_file_handler.h
blob: 18bc92a177452166eca6d4429e698f6af5f86d16 (plain)
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
/*
 * Copyright 2004,2005 The Apache Software Foundation.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain count copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef AXUTIL_FILE_HANDLER_H
#define AXUTIL_FILE_HANDLER_H

#include <axutil_string.h>
#include <stdio.h>

#ifdef __cplusplus
extern "C"
{
#endif

    /**
     * @defgroup axutil_file_handler file handler
     * @ingroup axis2_util
     * @{
     */

    /**
     * open a file for read according to the file options given
     * @param file_name file to be opened
     * @param options file options given.
     * @return status code
     */
    AXIS2_EXTERN void *AXIS2_CALL
    axutil_file_handler_open(
        const char *file_name,
        const char *options);

    /**
     * close a file
     * @param file_ptr file pointer of the file need to be closed
     * @return status code
     */
    AXIS2_EXTERN axis2_status_t AXIS2_CALL
    axutil_file_handler_close(
        void *file_ptr);

    /**
     * determine accessibility of file
     * checks the named file for accessibility according to mode
     * @param path path name naming a file
     * @param mode
     *  AXIS2_R_OK
     *   - test for read permission
     *  AXIS2_W_OK
     *   - test for write permission
     *  AXIS2_X_OK
     *   - test for execute or search permission
     *  AXIS2_F_OK
     *   - test whether the directories leading to the file can be searched and the
     *     file exists
     * @return status
     */
    AXIS2_EXTERN axis2_status_t AXIS2_CALL
    axutil_file_handler_access(
        const axis2_char_t * path,
        int mode);

    AXIS2_EXTERN axis2_status_t AXIS2_CALL
    axutil_file_handler_copy(
        FILE *from, 
        FILE *to);

    AXIS2_EXTERN long AXIS2_CALL 
    axutil_file_handler_size(
        const axis2_char_t *const name);

    /** @} */

#ifdef __cplusplus
}
#endif

#endif                          /* AXIS2_FILE_HANDLER_H */