From 474dfaf674ac8746367ff856534ef0b63afc6307 Mon Sep 17 00:00:00 2001 From: Ingela Anderton Andin Date: Tue, 1 Sep 2015 17:32:34 +0200 Subject: inets: Align with alphabetical order and clean local anchor handling Functions in the same module can be referenced as #Function-Arity, no need to make special markers for them. --- lib/inets/doc/src/tftp.xml | 300 +++++++++++++++++++++------------------------ 1 file changed, 143 insertions(+), 157 deletions(-) (limited to 'lib/inets/doc/src/tftp.xml') diff --git a/lib/inets/doc/src/tftp.xml b/lib/inets/doc/src/tftp.xml index 78f77f5b91..00d9d53376 100644 --- a/lib/inets/doc/src/tftp.xml +++ b/lib/inets/doc/src/tftp.xml @@ -221,88 +221,57 @@ + - start(Options) -> {ok, Pid} | {error, Reason} - Starts a daemon process. + change_config(daemons, Options) -> [{Pid, Result}] + Changes configuration for all daemons. + Options = [option()] Pid = pid() + Result = ok | {error, Reason} Reason = term() -

Starts a daemon process listening for UDP packets on a - port. When it receives a request for read or write, it spawns - a temporary server process handling the actual transfer - of the (virtual) file.

+

Changes configuration for all TFTP daemon processes.

- +
- read_file(RemoteFilename, LocalFilename, Options) -> {ok, LastCallbackState} | {error, Reason} - Reads a (virtual) file from a TFTP server. + change_config(servers, Options) -> [{Pid, Result}] + Changes configuration for all servers. + - RemoteFilename = string() - LocalFilename = binary | string() Options = [option()] - LastCallbackState = term() + Pid = pid() + Result = ok | {error, Reason} Reason = term() -

Reads a (virtual) file RemoteFilename from a TFTP - server.

-

If LocalFilename is the atom binary, - tftp_binary is used as callback module. It concatenates - all transferred blocks and returns them as one single binary - in LastCallbackState.

-

If LocalFilename is a string and there are no - registered callback modules, tftp_file is used as - callback module. It writes each transferred block to the file - named LocalFilename and returns the number of - transferred bytes in LastCallbackState.

-

If LocalFilename is a string and there are registered - callback modules, LocalFilename is tested against - the regexps of these and the callback module corresponding to - the first match is used, or an error tuple is returned if no - matching regexp is found.

-
+

Changes configuration for all TFTP server processes.

- + +
- write_file(RemoteFilename, LocalFilename, Options) -> {ok, LastCallbackState} | {error, Reason} - Writes a (virtual) file to a TFTP server. + change_config(Pid, Options) -> Result + Changes configuration for a TFTP daemon, server, + or client process. - RemoteFilename = string() - LocalFilename = binary() | string() + Pid = pid() Options = [option()] - LastCallbackState = term() + Result = ok | {error, Reason} Reason = term() -

Writes a (virtual) file RemoteFilename to a TFTP - server.

-

If LocalFilename is a binary, tftp_binary is - used as callback module. The binary is transferred block by - block and the number of transferred bytes is returned in - LastCallbackState.

-

If LocalFilename is a string and there are no - registered callback modules, tftp_file is used as - callback module. It reads the file named LocalFilename - block by block and returns the number of transferred bytes - in LastCallbackState.

-

If LocalFilename is a string and there are registered - callback modules, LocalFilename is tested against - the regexps of these and the callback module corresponding to - the first match is used, or an error tuple is returned if no - matching regexp is found.

- +

Changes configuration for a TFTP daemon, server, or client process.

- + info(daemons) -> [{Pid, Options}] Returns information about all daemons. @@ -342,72 +311,89 @@

Returns information about a TFTP daemon, server, or client process.

- -
- - - change_config(daemons, Options) -> [{Pid, Result}] - Changes configuration for all daemons. - + + + read_file(RemoteFilename, LocalFilename, Options) -> {ok, LastCallbackState} | {error, Reason} + Reads a (virtual) file from a TFTP server. + RemoteFilename = string() + LocalFilename = binary | string() Options = [option()] - Pid = pid() - Result = ok | {error, Reason} + LastCallbackState = term() Reason = term() -

Changes configuration for all TFTP daemon processes.

- - +

Reads a (virtual) file RemoteFilename from a TFTP + server.

+

If LocalFilename is the atom binary, + tftp_binary is used as callback module. It concatenates + all transferred blocks and returns them as one single binary + in LastCallbackState.

+

If LocalFilename is a string and there are no + registered callback modules, tftp_file is used as + callback module. It writes each transferred block to the file + named LocalFilename and returns the number of + transferred bytes in LastCallbackState.

+

If LocalFilename is a string and there are registered + callback modules, LocalFilename is tested against + the regexps of these and the callback module corresponding to + the first match is used, or an error tuple is returned if no + matching regexp is found.

+ +
- + - change_config(servers, Options) -> [{Pid, Result}] - Changes configuration for all servers. - + start(Options) -> {ok, Pid} | {error, Reason} + Starts a daemon process. Options = [option()] Pid = pid() - Result = ok | {error, Reason} Reason = term() -

Changes configuration for all TFTP server processes.

+

Starts a daemon process listening for UDP packets on a + port. When it receives a request for read or write, it spawns + a temporary server process handling the actual transfer + of the (virtual) file.

- +
- change_config(Pid, Options) -> Result - Changes configuration for a TFTP daemon, server, - or client process. + write_file(RemoteFilename, LocalFilename, Options) -> {ok, LastCallbackState} | {error, Reason} + Writes a (virtual) file to a TFTP server. - Pid = pid() + RemoteFilename = string() + LocalFilename = binary() | string() Options = [option()] - Result = ok | {error, Reason} - Reason = term() - - -

Changes configuration for a TFTP daemon, server, or client process.

- - -
-
- - - start() -> ok | {error, Reason} - Starts the Inets application. - + LastCallbackState = term() Reason = term() -

Starts the Inets application.

+

Writes a (virtual) file RemoteFilename to a TFTP + server.

+

If LocalFilename is a binary, tftp_binary is + used as callback module. The binary is transferred block by + block and the number of transferred bytes is returned in + LastCallbackState.

+

If LocalFilename is a string and there are no + registered callback modules, tftp_file is used as + callback module. It reads the file named LocalFilename + block by block and returns the number of transferred bytes + in LastCallbackState.

+

If LocalFilename is a string and there are registered + callback modules, LocalFilename is tested against + the regexps of these and the callback module corresponding to + the first match is used, or an error tuple is returned if no + matching regexp is found.

+
@@ -467,43 +453,32 @@
- - prepare(Peer, Access, Filename, Mode, SuggestedOptions, InitialState) -> {ok, AcceptedOptions, NewState} | {error, {Code, Text}} - Prepares to open a file on the client side. + + Module:abort(Code, Text, State) -> ok + Aborts the file transfer. - Peer = {PeerType, PeerHost, PeerPort} - PeerType = inet | inet6 - PeerHost = ip_address() - PeerPort = integer() - Access = read | write - Filename = string() - Mode = string() - SuggestedOptions = AcceptedOptions = [{Key, Value}] -  Key = Value = string() - InitialState = [] | [{root_dir, string()}] - NewState = term() Code = undef | enoent | eacces | enospc   | badop | eexist | baduser | badopt   | int() Text = string() + State = term() -

Prepares to open a file on the client side.

-

No new options can be added, but those present in - SuggestedOptions can be omitted or replaced with new - values in AcceptedOptions.

-

This is followed by a call to open/4 before any - read/write access is performed. AcceptedOptions is - sent to the server, which replies with the options that it - accepts. These are then forwarded to open/4 as - SuggestedOptions.

- - +

Invoked when the file transfer is aborted.

+

The callback function is expected to clean + up its used resources after the aborted file + transfer, such as closing open file + descriptors and so on. The function is not + invoked if any of the other callback + functions returns an error, as it is + expected that they already have cleaned up + the necessary resources. However, it is + invoked if the functions fail (crash).

- - - open(Peer, Access, Filename, Mode, SuggestedOptions, State) -> {ok, AcceptedOptions, NewState} | {error, {Code, Text}} + + + Module:open(Peer, Access, Filename, Mode, SuggestedOptions, State) -> {ok, AcceptedOptions, NewState} | {error, {Code, Text}} Opens a file for read or write access. Peer = {PeerType, PeerHost, PeerPort} @@ -536,9 +511,44 @@ + + + Module:prepare(Peer, Access, Filename, Mode, SuggestedOptions, InitialState) -> {ok, AcceptedOptions, NewState} | {error, {Code, Text}} + Prepares to open a file on the client side. + + Peer = {PeerType, PeerHost, PeerPort} + PeerType = inet | inet6 + PeerHost = ip_address() + PeerPort = integer() + Access = read | write + Filename = string() + Mode = string() + SuggestedOptions = AcceptedOptions = [{Key, Value}] +  Key = Value = string() + InitialState = [] | [{root_dir, string()}] + NewState = term() + Code = undef | enoent | eacces | enospc +   | badop | eexist | baduser | badopt +   | int() + Text = string() + + +

Prepares to open a file on the client side.

+

No new options can be added, but those present in + SuggestedOptions can be omitted or replaced with new + values in AcceptedOptions.

+

This is followed by a call to open/4 before any + read/write access is performed. AcceptedOptions is + sent to the server, which replies with the options that it + accepts. These are then forwarded to open/4 as + SuggestedOptions.

+ + +
+
- read(State) -> {more, Bin, NewState} | {last, Bin, FileSize} | {error, {Code, Text}} + Module:read(State) -> {more, Bin, NewState} | {last, Bin, FileSize} | {error, {Code, Text}} Reads a chunk from the file. State = NewState = term() @@ -565,7 +575,7 @@ - write(Bin, State) -> {more, NewState} | {last, FileSize} | {error, {Code, Text}} + Module:write(Bin, State) -> {more, NewState} | {last, FileSize} | {error, {Code, Text}} Writes a chunk to the file. Bin = binary() @@ -590,30 +600,6 @@ - - - abort(Code, Text, State) -> ok - Aborts the file transfer. - - Code = undef | enoent | eacces | enospc -   | badop | eexist | baduser | badopt -   | int() - Text = string() - State = term() - - -

Invoked when the file transfer is aborted.

-

The callback function is expected to clean - up its used resources after the aborted file - transfer, such as closing open file - descriptors and so on. The function is not - invoked if any of the other callback - functions returns an error, as it is - expected that they already have cleaned up - the necessary resources. However, it is - invoked if the functions fail (crash).

-
-
@@ -628,7 +614,7 @@ - error_msg(Format, Data) -> ok | exit(Reason) + Logger:error_msg(Format, Data) -> ok | exit(Reason) Logs an error message. Format = string() @@ -644,32 +630,32 @@ - warning_msg(Format, Data) -> ok | exit(Reason) - Logs a warning message. + Logger:info_msg(Format, Data) -> ok | exit(Reason) + Logs an info message. Format = string() Data = [term()] Reason = term() -

Logs a warning message. - See error_logger:warning_msg/2 for details.

- - +

Logs an info message. + See error_logger:info_msg/2 for details.

- + - info_msg(Format, Data) -> ok | exit(Reason) - Logs an info message. + Logger:warning_msg(Format, Data) -> ok | exit(Reason) + Logs a warning message. Format = string() Data = [term()] Reason = term() -

Logs an info message. - See error_logger:info_msg/2 for details.

+

Logs a warning message. + See error_logger:warning_msg/2 for details.

+ +
-- cgit v1.2.3