diff options
author | Micael Karlberg <[email protected]> | 2011-10-11 10:38:48 +0200 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2011-10-11 10:38:48 +0200 |
commit | 8490c3a413ca4a89c0a2f37e8723b2105cbe2406 (patch) | |
tree | 8dbae16e97b8f5872f7feae2c983ef8e43b0903e /lib/inets/src/tftp/tftp.erl | |
parent | adacb706e77b90a9284c3f4d8c828992c9acebf8 (diff) | |
parent | 6ca6dd3c670fb8185ebb9a20c2a731a7375c1cac (diff) | |
download | otp-8490c3a413ca4a89c0a2f37e8723b2105cbe2406.tar.gz otp-8490c3a413ca4a89c0a2f37e8723b2105cbe2406.tar.bz2 otp-8490c3a413ca4a89c0a2f37e8723b2105cbe2406.zip |
Merge branch 'master' of super:otp into bmk/inets/inets58_integration
Diffstat (limited to 'lib/inets/src/tftp/tftp.erl')
-rw-r--r-- | lib/inets/src/tftp/tftp.erl | 47 |
1 files changed, 41 insertions, 6 deletions
diff --git a/lib/inets/src/tftp/tftp.erl b/lib/inets/src/tftp/tftp.erl index bfdb4c0030..b33c0a98f4 100644 --- a/lib/inets/src/tftp/tftp.erl +++ b/lib/inets/src/tftp/tftp.erl @@ -215,8 +215,6 @@ start/0 ]). --export([behaviour_info/1]). - %% Application local functions -export([ start_standalone/1, @@ -227,13 +225,50 @@ ]). -behaviour_info(callbacks) -> - [{prepare, 6}, {open, 6}, {read, 1}, {write, 2}, {abort, 3}]; -behaviour_info(_) -> - undefined. +-type peer() :: {PeerType :: inet | inet6, + PeerHost :: inet:ip_address(), + PeerPort :: port()}. + +-type access() :: read | write. + +-type options() :: [{Key :: string(), Value :: string()}]. + +-type error_code() :: undef | enoent | eacces | enospc | + badop | eexist | baduser | badopt | + integer(). + +-callback prepare(Peer :: peer(), + Access :: access(), + Filename :: file:name(), + Mode :: string(), + SuggestedOptions :: options(), + InitialState :: [] | [{root_dir, string()}]) -> + {ok, AcceptedOptions :: options(), NewState :: term()} | + {error, {Code :: error_code(), string()}}. + +-callback open(Peer :: peer(), + Access :: access(), + Filename :: file:name(), + Mode :: string(), + SuggestedOptions :: options(), + State :: [] | [{root_dir, string()}] | term()) -> + {ok, AcceptedOptions :: options(), NewState :: term()} | + {error, {Code :: error_code(), string()}}. + +-callback read(State :: term()) -> {more, binary(), NewState :: term()} | + {last, binary(), integer()} | + {error, {Code :: error_code(), string()}}. + +-callback write(binary(), State :: term()) -> + {more, NewState :: term()} | + {last, FileSize :: integer()} | + {error, {Code :: error_code(), string()}}. + +-callback abort(Code :: error_code(), string(), State :: term()) -> 'ok'. -include("tftp.hrl"). + %%------------------------------------------------------------------- %% read_file(RemoteFilename, LocalFilename, Options) -> %% {ok, LastCallbackState} | {error, Reason} |