1%%
2%% %CopyrightBegin%
3%%
4%% Copyright Ericsson AB 2006-2016. All Rights Reserved.
5%%
6%% Licensed under the Apache License, Version 2.0 (the "License");
7%% you may not use this file except in compliance with the License.
8%% You may obtain a copy of the License at
9%%
10%%     http://www.apache.org/licenses/LICENSE-2.0
11%%
12%% Unless required by applicable law or agreed to in writing, software
13%% distributed under the License is distributed on an "AS IS" BASIS,
14%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15%% See the License for the specific language governing permissions and
16%% limitations under the License.
17%%
18%% %CopyrightEnd%
19%%
20
21%%
22
23%%% Description: Default Callback module for ssh_sftpd
24
25-module(ssh_sftpd_file).
26
27-behaviour(ssh_sftpd_file_api).
28
29%% API
30-export([close/2, delete/2, del_dir/2, get_cwd/1, is_dir/2, list_dir/2,
31	 make_dir/2, make_symlink/3, open/3, position/3, read/3,
32	 read_file_info/2, read_link/2, read_link_info/2, rename/3,
33	 write/3, write_file_info/3]).
34
35close(IoDevice, State) ->
36    {file:close(IoDevice), State}.
37
38delete(Path, State) ->
39    {file:delete(Path), State}.
40
41del_dir(Path, State) ->
42    {file:del_dir(Path), State}.
43
44get_cwd(State) ->
45    {file:get_cwd(), State}.
46
47is_dir(AbsPath, State) ->
48    {filelib:is_dir(AbsPath), State}.
49
50list_dir(AbsPath, State) ->
51    {file:list_dir(AbsPath), State}.
52
53make_dir(Dir, State) ->
54    {file:make_dir(Dir), State}.
55
56make_symlink(Path2, Path, State) ->
57    {file:make_symlink(Path2, Path), State}.
58
59open(Path, Flags, State) ->
60    {file:open(Path, Flags), State}.
61
62position(IoDevice, Offs, State) ->
63    {file:position(IoDevice, Offs), State}.
64
65read(IoDevice, Len, State) ->
66    {file:read(IoDevice, Len), State}.
67
68read_link(Path, State) ->
69    {file:read_link(Path), State}.
70
71read_link_info(Path, State) ->
72    {file:read_link_info(Path), State}.
73
74read_file_info(Path, State) ->
75    {file:read_file_info(Path), State}.
76
77rename(Path, Path2, State) ->
78    {file:rename(Path, Path2), State}.
79
80write(IoDevice, Data, State) ->
81    {file:write(IoDevice, Data), State}.
82
83write_file_info(Path,Info, State) ->
84    {file:write_file_info(Path, Info), State}.
85