Home | History | Annotate | Download | only in include
      1 /******************************************************************************
      2  *
      3  *  Copyright (C) 2003-2012 Broadcom Corporation
      4  *
      5  *  Licensed under the Apache License, Version 2.0 (the "License");
      6  *  you may not use this file except in compliance with the License.
      7  *  You may obtain a copy of the License at:
      8  *
      9  *  http://www.apache.org/licenses/LICENSE-2.0
     10  *
     11  *  Unless required by applicable law or agreed to in writing, software
     12  *  distributed under the License is distributed on an "AS IS" BASIS,
     13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14  *  See the License for the specific language governing permissions and
     15  *  limitations under the License.
     16  *
     17  ******************************************************************************/
     18 
     19 /******************************************************************************
     20  *
     21  *  This is the interface file for the synchronization server call-out
     22  *  functions.
     23  *
     24  ******************************************************************************/
     25 #ifndef BTA_FS_CO_H
     26 #define BTA_FS_CO_H
     27 
     28 #include <time.h>
     29 
     30 #include "bta_api.h"
     31 #include "goep_fs.h"
     32 #include "obx_api.h"
     33 
     34 /*****************************************************************************
     35 **  Constants and Data Types
     36 *****************************************************************************/
     37 
     38 #ifndef BTA_FS_CO_MAX_SSN_ENTRIES
     39 #define BTA_FS_CO_MAX_SSN_ENTRIES   10
     40 #endif
     41 
     42 /* Maximum path length supported by FS_CO */
     43 #ifndef BTA_FS_CO_PATH_LEN
     44 #define BTA_FS_CO_PATH_LEN          294
     45 #endif
     46 
     47 #ifndef BTA_FS_CO_TEST_ROOT
     48 #define BTA_FS_CO_TEST_ROOT         "test_files"
     49 #endif
     50 
     51 #define BTA_FS_CO_TEST_TYPE_NONE    0
     52 #define BTA_FS_CO_TEST_TYPE_REJECT  1
     53 #define BTA_FS_CO_TEST_TYPE_SUSPEND 2
     54 
     55 #ifndef BTA_FS_CO_TEST_AB_END
     56 #define BTA_FS_CO_TEST_AB_END   BTA_FS_CO_TEST_TYPE_NONE
     57 #endif
     58 
     59 /**************************
     60 **  Common Definitions
     61 ***************************/
     62 
     63 /* Status codes returned by call-out functions, or in call-in functions as status */
     64 #define BTA_FS_CO_OK            GOEP_OK
     65 #define BTA_FS_CO_FAIL          GOEP_FAIL   /* Used to pass all other errors */
     66 #define BTA_FS_CO_EACCES        GOEP_EACCES
     67 #define BTA_FS_CO_ENOTEMPTY     GOEP_ENOTEMPTY
     68 #define BTA_FS_CO_EOF           GOEP_EOF
     69 #define BTA_FS_CO_EODIR         GOEP_EODIR
     70 #define BTA_FS_CO_ENOSPACE      GOEP_ENOSPACE/* Returned in bta_fs_ci_open if no room */
     71 #define BTA_FS_CO_EIS_DIR       GOEP_EIS_DIR
     72 #define BTA_FS_CO_RESUME        GOEP_RESUME /* used in ci_open, on resume */
     73 #define BTA_FS_CO_NONE          GOEP_NONE /* used in ci_open, on resume (no file to resume) */
     74 
     75 typedef UINT16 tBTA_FS_CO_STATUS;
     76 
     77 /* the index to the permission flags */
     78 #define BTA_FS_PERM_USER    0
     79 #define BTA_FS_PERM_GROUP   1
     80 #define BTA_FS_PERM_OTHER   2
     81 /* max number of the permission flags */
     82 #define BTA_FS_PERM_SIZE    3
     83 
     84 /* Flags passed to the open function (bta_fs_co_open)
     85 **      Values are OR'd together. (First 3 are
     86 **      mutually exclusive.
     87 */
     88 #define BTA_FS_O_RDONLY         GOEP_O_RDONLY
     89 #define BTA_FS_O_WRONLY         GOEP_O_WRONLY
     90 #define BTA_FS_O_RDWR           GOEP_O_RDWR
     91 
     92 #define BTA_FS_O_CREAT          GOEP_O_CREAT
     93 #define BTA_FS_O_EXCL           GOEP_O_EXCL
     94 #define BTA_FS_O_TRUNC          GOEP_O_TRUNC
     95 
     96 #define BTA_FS_O_MODE_MASK(x)      (((UINT16)(x)) & 0x0003)
     97 
     98 /* Origin for the bta_fs_co_seek function  */
     99 #define BTA_FS_SEEK_SET         GOEP_SEEK_SET
    100 #define BTA_FS_SEEK_CUR         GOEP_SEEK_CUR
    101 #define BTA_FS_SEEK_END         GOEP_SEEK_END
    102 
    103 /* mode field in bta_fs_co_access callout */
    104 #define BTA_FS_ACC_EXIST        GOEP_ACC_EXIST
    105 #define BTA_FS_ACC_READ         GOEP_ACC_READ
    106 #define BTA_FS_ACC_RDWR         GOEP_ACC_RDWR
    107 
    108 #define BTA_FS_LEN_UNKNOWN      GOEP_LEN_UNKNOWN
    109 #define BTA_FS_INVALID_FD       GOEP_INVALID_FD
    110 #define BTA_FS_INVALID_APP_ID   (0xFF)  /* this app_id is reserved */
    111 
    112 /* mode field in tBTA_FS_DIRENTRY (OR'd together) */
    113 #define BTA_FS_A_RDONLY         GOEP_A_RDONLY
    114 #define BTA_FS_A_DIR            GOEP_A_DIR      /* Entry is a sub directory */
    115 
    116 #define BTA_FS_CTIME_LEN        GOEP_CTIME_LEN  /* Creation time "yyyymmddTHHMMSSZ" */
    117 
    118 /* Return structure type for a directory entry */
    119 typedef struct
    120 {
    121     UINT32  refdata;            /* holder for OS specific data used to get next entry */
    122     UINT32  filesize;
    123     char    crtime[BTA_FS_CTIME_LEN]; /* "yyyymmddTHHMMSSZ", or "" if none */
    124     char    *p_name;            /* Contains the addr of memory to copy name into */
    125     UINT8   mode;               /* BTA_FS_A_RDONLY and/or BTA_FS_A_DIR */
    126 } tBTA_FS_DIRENTRY;
    127 
    128 /* session state */
    129 enum
    130 {
    131     BTA_FS_CO_SESS_ST_NONE,
    132     BTA_FS_CO_SESS_ST_ACTIVE,
    133     BTA_FS_CO_SESS_ST_SUSPEND,
    134     BTA_FS_CO_SESS_ST_RESUMING
    135 };
    136 typedef UINT8   tBTA_FS_CO_SESS_ST;
    137 
    138 
    139 
    140 /* a data type to keep an array of ssn/file offset - the info can be saved to NV */
    141 typedef struct
    142 {
    143     char        path[BTA_FS_CO_PATH_LEN + 1];   /* the "current path". path[0]==0-> root */
    144     char        file[BTA_FS_CO_PATH_LEN + 1];   /* file[0] !=0 on resume -> the previous suspended session had opened files */
    145     int         oflags;  /* the flag to open the file */
    146     BD_ADDR     bd_addr;
    147     UINT8       sess_info[OBX_SESSION_INFO_SIZE];
    148     UINT32      offset;         /* last file offset */
    149     UINT32      timeout;        /* the timeout value on suspend */
    150     time_t      suspend_time;   /* the time of suspend */
    151     UINT16      nbytes;         /* number of bytes for last read/write */
    152     UINT8       ssn;
    153     UINT8       info;           /* info for BTA on the client side */
    154     UINT8       app_id;
    155     tBTA_FS_CO_SESS_ST  sess_st;
    156 } tBTA_FS_CO_SESSION;
    157 
    158 /*****************************************************************************
    159 **  Function Declarations
    160 *****************************************************************************/
    161 /**************************
    162 **  Common Functions
    163 ***************************/
    164 /*******************************************************************************
    165 **
    166 ** Function         bta_fs_co_init
    167 **
    168 ** Description      This function is executed as a part of the start up sequence
    169 **                  to make sure the control block is initialized.
    170 **
    171 ** Parameters       void.
    172 **
    173 ** Returns          void
    174 **
    175 **
    176 *******************************************************************************/
    177 BTA_API extern void bta_fs_co_init(void);
    178 
    179 /*******************************************************************************
    180 **
    181 ** Function         bta_fs_co_open
    182 **
    183 ** Description      This function is executed by BTA when a file is opened.
    184 **                  The phone uses this function to open
    185 **                  a file for reading or writing.
    186 **
    187 ** Parameters       p_path  - Fully qualified path and file name.
    188 **                  oflags  - permissions and mode (see constants above)
    189 **                  size    - size of file to put (0 if unavailable or not applicable)
    190 **                  evt     - event that must be passed into the call-in function.
    191 **                  app_id  - application ID specified in the enable functions.
    192 **                            It can be used to identify which profile is the caller
    193 **                            of the call-out function.
    194 **
    195 ** Returns          void
    196 **
    197 **                  Note: Upon completion of the request, a file descriptor (int),
    198 **                        if successful, and an error code (tBTA_FS_CO_STATUS)
    199 **                        are returned in the call-in function, bta_fs_ci_open().
    200 **
    201 *******************************************************************************/
    202 BTA_API extern void bta_fs_co_open(const char *p_path, int oflags, UINT32 size,
    203                            UINT16 evt, UINT8 app_id);
    204 
    205 /*******************************************************************************
    206 **
    207 ** Function         bta_fs_co_session_info
    208 **
    209 ** Description      This function is executed by BTA when a reliable session is
    210 **                  established (p_sess_info != NULL) or ended (p_sess_info == NULL).
    211 **
    212 ** Parameters       bd_addr     - the peer address
    213 **                  p_sess_info - the session ID and related information.
    214 **                  app_id  - application ID specified in the enable functions.
    215 **                            It can be used to identify which profile is the caller
    216 **                            of the call-out function.
    217 **
    218 ** Returns          void
    219 **
    220 *******************************************************************************/
    221 BTA_API extern void bta_fs_co_session_info(BD_ADDR bd_addr, UINT8 *p_sess_info, UINT8 ssn,
    222                                            tBTA_FS_CO_SESS_ST new_st, char *p_path, UINT8 *p_info, UINT8 app_id);
    223 
    224 /*******************************************************************************
    225 **
    226 ** Function         bta_fs_co_resume_op
    227 **
    228 ** Description      This function is executed by BTA when a reliable session is
    229 **                  resumed and there was an interrupted operation.
    230 **
    231 ** Parameters       offset  - the session ID and related information.
    232 **                  evt     - event that must be passed into the call-in function.
    233 **                  app_id  - application ID specified in the enable functions.
    234 **                            It can be used to identify which profile is the caller
    235 **                            of the call-out function.
    236 **
    237 ** Returns          void
    238 **
    239 *******************************************************************************/
    240 BTA_API extern void bta_fs_co_resume_op(UINT32 offset, UINT16 evt, UINT8 app_id);
    241 
    242 /*******************************************************************************
    243 **
    244 ** Function         bta_fs_co_suspend
    245 **
    246 ** Description      This function is executed by BTA when a reliable session is
    247 **                  suspended.
    248 **
    249 ** Parameters       bd_addr - the peer address
    250 **                  ssn     - the session sequence number.
    251 **                  info    - the BTA specific information (like last active operation).
    252 **                  p_offset- the location to receive object offset of the suspended session
    253 **                  app_id  - application ID specified in the enable functions.
    254 **                            It can be used to identify which profile is the caller
    255 **                            of the call-out function.
    256 **
    257 ** Returns          void
    258 **
    259 *******************************************************************************/
    260 BTA_API extern void bta_fs_co_suspend(BD_ADDR bd_addr, UINT8 *p_sess_info, UINT8 ssn,
    261                                       UINT32 *p_timeout, UINT32 *p_offset, UINT8 info, UINT8 app_id);
    262 
    263 /*******************************************************************************
    264 **
    265 ** Function         bta_fs_co_resume
    266 **
    267 ** Description      This function is executed by BTA when resuming a session.
    268 **                  This is used to retrieve the session ID and related information
    269 **
    270 ** Parameters       evt     - event that must be passed into the call-in function.
    271 **                  app_id  - application ID specified in the enable functions.
    272 **                            It can be used to identify which profile is the caller
    273 **                            of the call-out function.
    274 **
    275 ** Returns          void
    276 **
    277 **                  Note: Upon completion of the request, the related session information,
    278 **                        if successful, and an error code (tBTA_FS_CO_STATUS)
    279 **                        are returned in the call-in function, bta_fs_ci_resume().
    280 **
    281 *******************************************************************************/
    282 BTA_API extern void bta_fs_co_resume(UINT16 evt, UINT8 app_id);
    283 
    284 /*******************************************************************************
    285 **
    286 ** Function         bta_fs_co_sess_ssn
    287 **
    288 ** Description      This function is executed by BTA when resuming a session.
    289 **                  This is used to inform call-out module if the ssn/file offset
    290 **                  needs to be adjusted.
    291 **
    292 ** Parameters       ssn     - the session sequence number of the first request
    293 **                            after resume.
    294 **                  app_id  - application ID specified in the enable functions.
    295 **                            It can be used to identify which profile is the caller
    296 **                            of the call-out function.
    297 **
    298 ** Returns          void
    299 **
    300 *******************************************************************************/
    301 BTA_API extern void bta_fs_co_sess_ssn(int fd, UINT8 ssn, UINT8 app_id);
    302 
    303 /*******************************************************************************
    304 **
    305 ** Function         bta_fs_co_setdir
    306 **
    307 ** Description      This function is executed by BTA when the server changes the
    308 **                  local path
    309 **
    310 ** Parameters       p_path  - the new path.
    311 **                  app_id  - application ID specified in the enable functions.
    312 **                            It can be used to identify which profile is the caller
    313 **                            of the call-out function.
    314 **
    315 ** Returns          void
    316 **
    317 *******************************************************************************/
    318 BTA_API extern void bta_fs_co_setdir(const char *p_path, UINT8 app_id);
    319 
    320 /*******************************************************************************
    321 **
    322 ** Function         bta_fs_co_close
    323 **
    324 ** Description      This function is called by BTA when a connection to a
    325 **                  client is closed.
    326 **
    327 ** Parameters       fd      - file descriptor of file to close.
    328 **                  app_id  - application ID specified in the enable functions.
    329 **                            It can be used to identify which profile is the caller
    330 **                            of the call-out function.
    331 **
    332 ** Returns          (tBTA_FS_CO_STATUS) status of the call.
    333 **                      [BTA_FS_CO_OK if successful],
    334 **                      [BTA_FS_CO_FAIL if failed  ]
    335 **
    336 *******************************************************************************/
    337 BTA_API extern tBTA_FS_CO_STATUS bta_fs_co_close(int fd, UINT8 app_id);
    338 
    339 /*******************************************************************************
    340 **
    341 ** Function         bta_fs_co_read
    342 **
    343 ** Description      This function is called by BTA to read in data from the
    344 **                  previously opened file on the phone.
    345 **
    346 ** Parameters       fd      - file descriptor of file to read from.
    347 **                  p_buf   - buffer to read the data into.
    348 **                  nbytes  - number of bytes to read into the buffer.
    349 **                  evt     - event that must be passed into the call-in function.
    350 **                  ssn     - session sequence number. Ignored, if bta_fs_co_open
    351 **							  was not called with BTA_FS_CO_RELIABLE.
    352 **                  app_id  - application ID specified in the enable functions.
    353 **                            It can be used to identify which profile is the caller
    354 **                            of the call-out function.
    355 **
    356 ** Returns          void
    357 **
    358 **                  Note: Upon completion of the request, bta_fs_ci_read() is
    359 **                        called with the buffer of data, along with the number
    360 **                        of bytes read into the buffer, and a status.  The
    361 **                        call-in function should only be called when ALL requested
    362 **                        bytes have been read, the end of file has been detected,
    363 **                        or an error has occurred.
    364 **
    365 *******************************************************************************/
    366 BTA_API extern void bta_fs_co_read(int fd, UINT8 *p_buf, UINT16 nbytes, UINT16 evt,
    367                            UINT8 ssn, UINT8 app_id);
    368 
    369 /*******************************************************************************
    370 **
    371 ** Function         bta_fs_co_write
    372 **
    373 ** Description      This function is called by io to send file data to the
    374 **                  phone.
    375 **
    376 ** Parameters       fd      - file descriptor of file to write to.
    377 **                  p_buf   - buffer to read the data from.
    378 **                  nbytes  - number of bytes to write out to the file.
    379 **                  evt     - event that must be passed into the call-in function.
    380 **                  ssn     - session sequence number. Ignored, if bta_fs_co_open
    381 **							  was not called with BTA_FS_CO_RELIABLE.
    382 **                  app_id  - application ID specified in the enable functions.
    383 **                            It can be used to identify which profile is the caller
    384 **                            of the call-out function.
    385 **
    386 ** Returns          void
    387 **
    388 **                  Note: Upon completion of the request, bta_fs_ci_write() is
    389 **                        called with the file descriptor and the status.  The
    390 **                        call-in function should only be called when ALL requested
    391 **                        bytes have been written, or an error has been detected,
    392 **
    393 *******************************************************************************/
    394 BTA_API extern void bta_fs_co_write(int fd, const UINT8 *p_buf, UINT16 nbytes, UINT16 evt,
    395                             UINT8 ssn, UINT8 app_id);
    396 
    397 /*******************************************************************************
    398 **
    399 ** Function         bta_fs_co_seek
    400 **
    401 ** Description      This function is called by io to move the file pointer
    402 **                  of a previously opened file to the specified location for
    403 **                  the next read or write operation.
    404 **
    405 ** Parameters       fd      - file descriptor of file.
    406 **                  offset  - Number of bytes from origin.
    407 **                  origin  - Initial position: BTA_FS_SEEK_SET, BTA_FS_SEEK_CUR,
    408 **                            or BTA_FS_SEEK_END.
    409 **
    410 ** Returns          void
    411 **
    412 *******************************************************************************/
    413 BTA_API extern void bta_fs_co_seek (int fd, INT32 offset, INT16 origin, UINT8 app_id);
    414 
    415 /*******************************************************************************
    416 **
    417 ** Function         bta_fs_co_access
    418 **
    419 ** Description      This function is called to check the existence of a file or
    420 **                  directory.
    421 **
    422 ** Parameters       p_path   - (input) file or directory to access (fully qualified path).
    423 **                  mode     - (input) [BTA_FS_ACC_EXIST, BTA_FS_ACC_READ, or BTA_FS_ACC_RDWR]
    424 **                  p_is_dir - (output) returns TRUE if p_path specifies a directory.
    425 **                  app_id   - (input) application ID specified in the enable functions.
    426 **                                     It can be used to identify which profile is the caller
    427 **                                     of the call-out function.
    428 **
    429 ** Returns          (tBTA_FS_CO_STATUS) status of the call.
    430 **                   [BTA_FS_CO_OK if it exists]
    431 **                   [BTA_FS_CO_EACCES if permissions are wrong]
    432 **                   [BTA_FS_CO_FAIL if it does not exist]
    433 **
    434 *******************************************************************************/
    435 BTA_API extern tBTA_FS_CO_STATUS bta_fs_co_access(const char *p_path, int mode,
    436                                           BOOLEAN *p_is_dir, UINT8 app_id);
    437 
    438 /*******************************************************************************
    439 **
    440 ** Function         bta_fs_co_mkdir
    441 **
    442 ** Description      This function is called to create a directory with
    443 **                  the pathname given by path. The pathname is a null terminated
    444 **                  string. All components of the path must already exist.
    445 **
    446 ** Parameters       p_path   - (input) name of directory to create (fully qualified path).
    447 **                  app_id   - (input) application ID specified in the enable functions.
    448 **                                     It can be used to identify which profile is the caller
    449 **                                     of the call-out function.
    450 **
    451 ** Returns          (tBTA_FS_CO_STATUS) status of the call.
    452 **                  [BTA_FS_CO_OK if successful]
    453 **                  [BTA_FS_CO_FAIL if unsuccessful]
    454 **
    455 *******************************************************************************/
    456 BTA_API extern tBTA_FS_CO_STATUS bta_fs_co_mkdir(const char *p_path, UINT8 app_id);
    457 
    458 /*******************************************************************************
    459 **
    460 ** Function         bta_fs_co_rmdir
    461 **
    462 ** Description      This function is called to remove a directory whose
    463 **                  name is given by path. The directory must be empty.
    464 **
    465 ** Parameters       p_path   - (input) name of directory to remove (fully qualified path).
    466 **                  app_id   - (input) application ID specified in the enable functions.
    467 **                                     It can be used to identify which profile is the caller
    468 **                                     of the call-out function.
    469 **
    470 ** Returns          (tBTA_FS_CO_STATUS) status of the call.
    471 **                      [BTA_FS_CO_OK if successful]
    472 **                      [BTA_FS_CO_EACCES if read-only]
    473 **                      [BTA_FS_CO_ENOTEMPTY if directory is not empty]
    474 **                      [BTA_FS_CO_FAIL otherwise]
    475 **
    476 *******************************************************************************/
    477 BTA_API extern tBTA_FS_CO_STATUS bta_fs_co_rmdir(const char *p_path, UINT8 app_id);
    478 
    479 /*******************************************************************************
    480 **
    481 ** Function         bta_fs_co_unlink
    482 **
    483 ** Description      This function is called by to remove a file whose name
    484 **                  is given by p_path.
    485 **
    486 ** Parameters       p_path   - (input) name of file to remove (fully qualified path).
    487 **                  app_id   - (input) application ID specified in the enable functions.
    488 **                                     It can be used to identify which profile is the caller
    489 **                                     of the call-out function.
    490 **
    491 ** Returns          (tBTA_FS_CO_STATUS) status of the call.
    492 **                      [BTA_FS_CO_OK if successful]
    493 **                      [BTA_FS_CO_EACCES if read-only]
    494 **                      [BTA_FS_CO_FAIL otherwise]
    495 **
    496 *******************************************************************************/
    497 BTA_API extern tBTA_FS_CO_STATUS bta_fs_co_unlink(const char *p_path, UINT8 app_id);
    498 
    499 /*******************************************************************************
    500 **
    501 ** Function         bta_fs_co_getdirentry
    502 **
    503 ** Description      This function is called to retrieve a directory entry for the
    504 **                  specified path.  The first/next directory should be filled
    505 **                  into the location specified by p_entry.
    506 **
    507 ** Parameters       p_path      - directory to search (Fully qualified path)
    508 **                  first_item  - TRUE if first search, FALSE if next search
    509 **                                      (p_cur contains previous)
    510 **                  p_entry (input/output) - Points to last entry data (valid when
    511 **                                           first_item is FALSE)
    512 **                  evt     - event that must be passed into the call-in function.
    513 **                  app_id  - application ID specified in the enable functions.
    514 **                            It can be used to identify which profile is the caller
    515 **                            of the call-out function.
    516 **
    517 ** Returns          void
    518 **
    519 **                  Note: Upon completion of the request, the status is passed
    520 **                        in the bta_fs_ci_direntry() call-in function.
    521 **                        BTA_FS_CO_OK is returned when p_entry is valid,
    522 **                        BTA_FS_CO_EODIR is returned when no more entries [finished]
    523 **                        BTA_FS_CO_FAIL is returned if an error occurred
    524 **
    525 *******************************************************************************/
    526 BTA_API extern void bta_fs_co_getdirentry(const char *p_path, BOOLEAN first_item,
    527                                    tBTA_FS_DIRENTRY *p_entry, UINT16 evt,
    528                                    UINT8 app_id);
    529 
    530 /*******************************************************************************
    531 **
    532 ** Function         bta_fs_co_copy
    533 **
    534 ** Description      This function is called to copy a file/directory whose
    535 **                  name is given by p_src_path to p_dest_path.
    536 **
    537 ** Parameters       p_src_path  - (input) name of file/directory to be copied (fully qualified path).
    538 **                  p_dest_path - (input) new name of file/directory(fully qualified path).
    539 **                  p_perms     - the permission of the new object.
    540 **                  evt     - event that must be passed into the call-in function.
    541 **                  app_id   - (input) application ID specified in the enable functions.
    542 **                                     It can be used to identify which profile is the caller
    543 **                                     of the call-out function.
    544 **
    545 ** Returns          (tBTA_FS_CO_STATUS) status of the call.
    546 **                      [BTA_FS_CO_OK if successful]
    547 **                      [BTA_FS_CO_EIS_DIR if p_src_path is a folder]
    548 **                      [BTA_FS_CO_EACCES if p_dest_path already exists or could not be created (invalid path);
    549 **                                        or p_src_path is a directory and p_dest_path specifies a different path. ]
    550 **                      [BTA_FS_CO_FAIL otherwise]
    551 **
    552 *******************************************************************************/
    553 BTA_API extern void bta_fs_co_copy(const char *p_src_path, const char *p_dest_path, UINT8 *p_perms, UINT16 evt, UINT8 app_id);
    554 
    555 /*******************************************************************************
    556 **
    557 ** Function         bta_fs_co_rename
    558 **
    559 ** Description      This function is called to move a file/directory whose
    560 **                  name is given by p_src_path to p_dest_path.
    561 **
    562 ** Parameters       p_src_path  - (input) name of file/directory to be moved (fully qualified path).
    563 **                  p_dest_path - (input) new name of file/directory(fully qualified path).
    564 **                  p_perms     - the permission of the new object.
    565 **                  app_id   - (input) application ID specified in the enable functions.
    566 **                                     It can be used to identify which profile is the caller
    567 **                                     of the call-out function.
    568 **
    569 ** Returns          (tBTA_FS_CO_STATUS) status of the call.
    570 **                      [BTA_FS_CO_OK if successful]
    571 **                      [BTA_FS_CO_EACCES if p_dest_path already exists or could not be created (invalid path);
    572 **                                        or p_src_path is a directory and p_dest_path specifies a different path. ]
    573 **                      [BTA_FS_CO_FAIL otherwise]
    574 **
    575 *******************************************************************************/
    576 BTA_API extern void bta_fs_co_rename(const char *p_src_path, const char *p_dest_path, UINT8 *p_perms, UINT16 evt, UINT8 app_id);
    577 
    578 /*******************************************************************************
    579 **
    580 ** Function         bta_fs_co_set_perms
    581 **
    582 ** Description      This function is called to set the permission a file/directory
    583 **                  with name as p_src_path.
    584 **
    585 ** Parameters       p_src_path  - (input) name of file/directory to set permission (fully qualified path).
    586 **                  p_perms     - the permission .
    587 **                  app_id   - (input) application ID specified in the enable functions.
    588 **                                     It can be used to identify which profile is the caller
    589 **                                     of the call-out function.
    590 **
    591 ** Returns          (tBTA_FS_CO_STATUS) status of the call.
    592 **                      [BTA_FS_CO_OK if successful]
    593 **                      [BTA_FS_CO_EACCES if p_dest_path already exists or could not be created (invalid path);
    594 **                                        or p_src_path is a directory and p_dest_path specifies a different path. ]
    595 **                      [BTA_FS_CO_FAIL otherwise]
    596 **
    597 *******************************************************************************/
    598 BTA_API extern void bta_fs_co_set_perms(const char *p_src_path,  UINT8 *p_perms, UINT16 evt, UINT8 app_id);
    599 
    600 /*******************************************************************************
    601 **
    602 ** Function         bta_fs_co_sess_fopen
    603 **
    604 ** Description      This function is called by bta_fs_co_open to keep track of
    605 **                  the opened file (for reliable session suspend/resume.)
    606 **
    607 ** Parameters       p_path  - Fully qualified path and file name.
    608 **                  oflags  - permissions and mode (see constants above)
    609 **                  app_id  - application ID specified in the enable functions.
    610 **                            It can be used to identify which profile is the caller
    611 **                            of the call-out function.
    612 **
    613 ** Returns          void
    614 **
    615 *******************************************************************************/
    616 BTA_API extern void bta_fs_co_sess_fopen(const char *p_path, int oflags, UINT8 app_id);
    617 
    618 /*******************************************************************************
    619 **
    620 ** Function         bta_fs_co_sess_fclose
    621 **
    622 ** Description      This function is called by bta_fs_co_close
    623 **
    624 ** Parameters       app_id  - application ID specified in the enable functions.
    625 **                            It can be used to identify which profile is the caller
    626 **                            of the call-out function.
    627 **
    628 ** Returns          void
    629 **
    630 *******************************************************************************/
    631 BTA_API extern void bta_fs_co_sess_fclose(UINT8 app_id);
    632 
    633 /*******************************************************************************
    634 **
    635 ** Function         bta_fs_co_sess_offset
    636 **
    637 ** Description      This function is called by bta_fs_co_write to keep track of
    638 **                  the last file offset (Only the receiving side needs to keep
    639 **                  track of the file offset)
    640 **
    641 ** Returns          void
    642 **
    643 *******************************************************************************/
    644 BTA_API extern void bta_fs_co_sess_offset(UINT8 ssn, INT32 pos, UINT16 nbytes, UINT8 app_id);
    645 
    646 /*******************************************************************************
    647 **
    648 ** Function         bta_fs_co_suspended_addr
    649 **
    650 ** Description      find the peer address of the suspended session control block
    651 **                  for the given an app_id.
    652 **
    653 ** Returns          the control block found.
    654 **
    655 *******************************************************************************/
    656 BTA_API extern UINT8 *bta_fs_co_suspended_addr(UINT8 app_id);
    657 
    658 /*******************************************************************************
    659 **
    660 ** Function         bta_fs_co_num_suspended_session
    661 **
    662 ** Description      find the number of suspended session control blocks for the
    663 **                  given an app_id.
    664 **
    665 ** Returns          the number of control blocks found.
    666 **
    667 *******************************************************************************/
    668 BTA_API extern UINT8 bta_fs_co_num_suspended_session(UINT8 app_id);
    669 
    670 /*******************************************************************************
    671 **
    672 ** Function         bta_fs_co_get_active_session
    673 **
    674 ** Description      find the active session control block for the given an app_id.
    675 **
    676 ** Returns          the control block found.
    677 **
    678 *******************************************************************************/
    679 BTA_API extern tBTA_FS_CO_SESSION *bta_fs_co_get_active_session(UINT8 app_id);
    680 
    681 /*******************************************************************************
    682 **
    683 ** Function         bta_fs_co_init_db
    684 **
    685 ** Description      Initialize the session control blocks for platform.
    686 **
    687 ** Returns          void
    688 **
    689 *******************************************************************************/
    690 BTA_API extern void bta_fs_co_init_db (tBTA_FS_CO_SESSION *p_first);
    691 
    692 /*******************************************************************************
    693 **
    694 ** Function         bta_fs_convert_oflags
    695 **
    696 ** Description      This function converts the open flags from BTA into MFS.
    697 **
    698 ** Returns          BTA FS status value.
    699 **
    700 *******************************************************************************/
    701 BTA_API extern int bta_fs_convert_bta_oflags(int bta_oflags);
    702 
    703 #endif /* BTA_FS_CO_H */
    704