aboutsummaryrefslogtreecommitdiffstats
path: root/lib/common_test/doc/src/ct_ftp.xml
blob: 592c5eb05dc49987e11bde64fb371912a5d07e0e (plain) (blame)
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE erlref SYSTEM "erlref.dtd">

<erlref>
  <header>
    <copyright>
      <year>2010</year><year>2018</year>
      <holder>Ericsson AB. All Rights Reserved.</holder>
    </copyright>
    <legalnotice>
      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 a 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.

    </legalnotice>

    <title>ct_ftp</title>
    <prepared></prepared>
    <responsible></responsible>
    <docno></docno>
    <approved></approved>
    <checked></checked>
    <date></date>
    <rev>A</rev>
    <file>ct_ftp.xml</file>
  </header>
  <module>ct_ftp</module>
  <modulesummary>FTP client module (based on the FTP application).</modulesummary>

  <description>

    <p>FTP client module (based on the <c>ftp</c> application).</p>

  </description>

  <section>
    <title>Data Types</title>
    <marker id="types"/>
    <taglist>
      <tag><c>connection() = handle() | target_name()</c></tag>
        <item><marker id="type-connection"/>
          <p>For <c>target_name</c>, see module
            <seealso marker="ct"><c>ct</c></seealso>.</p></item>

      <tag><c>handle() = handle()</c></tag>
        <item><marker id="type-handle"/>
          <p>Handle for a specific FTP connection, see module
            <seealso marker="ct"><c>ct</c></seealso>.</p></item>
    </taglist>
  </section>

  <funcs>
    <func>
      <name>cd(Connection, Dir) -&gt; ok | {error, Reason}</name>
      <fsummary>Changes directory on remote host.</fsummary>
      <type>
        <v>Connection = connection()</v>
        <v>Dir = string()</v>
      </type>
      <desc><marker id="cd-2"/>
        <p>Changes directory on remote host.</p>
      </desc>
    </func>

    <func>
      <name>close(Connection) -&gt; ok | {error, Reason}</name>
      <fsummary>Closes the FTP connection.</fsummary>
      <type>
        <v>Connection = connection()</v>
      </type>
      <desc><marker id="close-1"/>
        <p>Closes the FTP connection.</p>
      </desc>
    </func>

    <func>
      <name>delete(Connection, File) -&gt; ok | {error, Reason}</name>
      <fsummary>Deletes a file on remote host.</fsummary>
      <type>
        <v>Connection = connection()</v>
        <v>File = string()</v>
      </type>
      <desc><marker id="delete-2"/>
        <p>Deletes a file on remote host.</p>
      </desc>
    </func>

    <func>
      <name>get(KeyOrName, RemoteFile, LocalFile) -&gt; ok | {error, Reason}</name>
      <fsummary>Opens an FTP connection and fetches a file from the remote
        host.</fsummary>
      <type>
        <v>KeyOrName = Key | Name</v>
        <v>Key = atom()</v>
        <v>Name = target_name()</v>
        <v>RemoteFile = string()</v>
        <v>LocalFile = string()</v>
      </type>
      <desc><marker id="get-3"/>
        <p>Opens an FTP connection and fetches a file from the remote
          host.</p>

        <p><c>RemoteFile</c> and <c>LocalFile</c> must be absolute paths.</p>

        <p>The configuration file must be as for
          <seealso marker="#put-3"><c>ct_ftp:put/3</c></seealso>.</p>

        <p>For <c>target_name</c>, see module
          <seealso marker="ct"><c>ct</c></seealso>.</p>

        <p>See also
          <seealso marker="ct#require-2"><c>ct:require/2</c></seealso>.</p>
      </desc>
    </func>

    <func>
      <name>ls(Connection, Dir) -&gt; {ok, Listing} | {error, Reason}</name>
      <fsummary>Lists directory Dir.</fsummary>
      <type>
        <v>Connection = connection()</v>
        <v>Dir = string()</v>
        <v>Listing = string()</v>
      </type>
      <desc><marker id="ls-2"/>
        <p>Lists directory <c>Dir</c>.</p>
      </desc>
    </func>

    <func>
      <name>open(KeyOrName) -&gt; {ok, Handle} | {error, Reason}</name>
      <fsummary>Opens an FTP connection to the specified node.</fsummary>
      <type>
        <v>KeyOrName = Key | Name</v>
        <v>Key = atom()</v>
        <v>Name = target_name()</v>
        <v>Handle = handle()</v>
      </type>
      <desc><marker id="open-1"/>
        <p>Opens an FTP connection to the specified node.</p>

        <p>You can open a connection for a particular <c>Name</c> and use the
          same name as reference for all following subsequent operations.
          If you want
          the connection to be associated with <c>Handle</c> instead (if you,
          for example, need to open multiple connections to a host), use
          <c>Key</c>, the configuration variable name, to specify the target.
          A connection without an associated target name can only be closed
          with the handle value.</p>

        <p>For information on how to create a new <c>Name</c>, see
          <seealso marker="ct#require-2"><c>ct:require/2</c></seealso>.</p>

        <p>For <c>target_name</c>, see module
          <seealso marker="ct"><c>ct</c></seealso>.</p>
      </desc>
    </func>

    <func>
      <name>put(KeyOrName, LocalFile, RemoteFile) -&gt; ok | {error, Reason}</name>
      <fsummary>Opens an FTP connection and sends a file to the remote
        host.</fsummary>
      <type>
        <v>KeyOrName = Key | Name</v>
        <v>Key = atom()</v>
        <v>Name = target_name()</v>
        <v>LocalFile = string()</v>
        <v>RemoteFile = string()</v>
      </type>
      <desc><marker id="put-3"/>
        <p>Opens an FTP connection and sends a file to the remote host.</p>

        <p><c>LocalFile</c> and <c>RemoteFile</c> must be absolute paths.</p>

        <p>For <c>target_name</c>, see module
          <seealso marker="ct"><c>ct</c></seealso>.</p>

        <p>If the target host is a "special" node, the FTP address must be
          specified in the configuration file as follows:</p>

        <pre>
 {node,[{ftp,IpAddr}]}.</pre>

        <p>If the target host is something else, for example, a UNIX host,
          the configuration file must also include the username and password
          (both strings):</p>

        <pre>
 {unix,[{ftp,IpAddr},
        {username,Username},
        {password,Password}]}.</pre>

        <p>See also
          <seealso marker="ct#require-2"><c>ct:require/2</c></seealso>.</p>
      </desc>
    </func>

    <func>
      <name>recv(Connection, RemoteFile) -&gt; ok | {error, Reason}</name>
      <fsummary>Fetches a file over FTP.</fsummary>
      <desc><marker id="recv-2"/>
        <p>Fetches a file over FTP.</p>

        <p>The file gets the same name on the local host.</p>

        <p>See also <seealso marker="#recv-3"><c>ct_ftp:recv/3</c></seealso>.</p>
      </desc>
    </func>

    <func>
      <name>recv(Connection, RemoteFile, LocalFile) -&gt; ok | {error, Reason}</name>
      <fsummary>Fetches a file over FTP.</fsummary>
      <type>
        <v>Connection = connection()</v>
        <v>RemoteFile = string()</v>
        <v>LocalFile = string()</v>
      </type>
      <desc><marker id="recv-3"/>
        <p>Fetches a file over FTP.</p>

        <p>The file is named <c>LocalFile</c> on the local host.</p>
      </desc>
    </func>

    <func>
      <name>send(Connection, LocalFile) -&gt; ok | {error, Reason}</name>
      <fsummary>Sends a file over FTP.</fsummary>
      <desc><marker id="send-2"/>
        <p>Sends a file over FTP.</p>

        <p>The file gets the same name on the remote host.</p>

        <p>See also
          <seealso marker="#send-3"><c>ct_ftp:send/3</c></seealso>.</p>
      </desc>
    </func>

    <func>
      <name>send(Connection, LocalFile, RemoteFile) -&gt; ok | {error, Reason}</name>
      <fsummary>Sends a file over FTP.</fsummary>
      <type>
        <v>Connection = connection()</v>
        <v>LocalFile = string()</v>
        <v>RemoteFile = string()</v>
      </type>
      <desc><marker id="send-3"/>
        <p>Sends a file over FTP.</p>

        <p>The file is named <c>RemoteFile</c> on the remote host.</p>
      </desc>
    </func>

    <func>
      <name>type(Connection, Type) -&gt; ok | {error, Reason}</name>
      <fsummary>Changes the file transfer type.</fsummary>
      <type>
        <v>Connection = connection()</v>
        <v>Type = ascii | binary</v>
      </type>
      <desc><marker id="type-2"/>
        <p>Changes the file transfer type.</p>
      </desc>
    </func>
  </funcs>

</erlref>