File size: 22,108 Bytes
53a37cf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>nanoftp: minimal FTP implementation</title>
<meta name="generator" content="Libxml2 devhelp stylesheet">
<link rel="start" href="index.html" title="libxml2 Reference Manual">
<link rel="up" href="general.html" title="API">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="chapter" href="general.html" title="API">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
<td><a accesskey="p" href="libxml2-list.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="general.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<td><a accesskey="n" href="libxml2-nanohttp.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
<th width="100%" align="center">libxml2 Reference Manual</th>
</tr></table>
<h2><span class="refentrytitle">nanoftp</span></h2>
<p>nanoftp - minimal FTP implementation</p>
<p>minimal FTP implementation allowing to fetch resources like external subset. This module is DEPRECATED, do not use any of its functions. </p>
<p> WARNING: this module is deprecated !</p>
<p>Author(s): Daniel Veillard </p>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<pre class="synopsis">#define <a href="#INVALID_SOCKET">INVALID_SOCKET</a>;
#define <a href="#SOCKET">SOCKET</a>;
typedef void <a href="#ftpDataCallback">ftpDataCallback</a>			(void * userData, <br>					 const char * data, <br>					 int len);
typedef void <a href="#ftpListCallback">ftpListCallback</a>			(void * userData, <br>					 const char * filename, <br>					 const char * attrib, <br>					 const char * owner, <br>					 const char * group, <br>					 unsigned long size, <br>					 int links, <br>					 int year, <br>					 const char * month, <br>					 int day, <br>					 int hour, <br>					 int minute);
int	<a href="#xmlNanoFTPCheckResponse">xmlNanoFTPCheckResponse</a>		(void * ctx);
void	<a href="#xmlNanoFTPCleanup">xmlNanoFTPCleanup</a>		(void);
int	<a href="#xmlNanoFTPClose">xmlNanoFTPClose</a>			(void * ctx);
int	<a href="#xmlNanoFTPCloseConnection">xmlNanoFTPCloseConnection</a>	(void * ctx);
int	<a href="#xmlNanoFTPConnect">xmlNanoFTPConnect</a>		(void * ctx);
void *	<a href="#xmlNanoFTPConnectTo">xmlNanoFTPConnectTo</a>		(const char * server, <br>					 int port);
int	<a href="#xmlNanoFTPCwd">xmlNanoFTPCwd</a>			(void * ctx, <br>					 const char * directory);
int	<a href="#xmlNanoFTPDele">xmlNanoFTPDele</a>			(void * ctx, <br>					 const char * file);
void	<a href="#xmlNanoFTPFreeCtxt">xmlNanoFTPFreeCtxt</a>		(void * ctx);
int	<a href="#xmlNanoFTPGet">xmlNanoFTPGet</a>			(void * ctx, <br>					 <a href="libxml2-nanoftp.html#ftpDataCallback">ftpDataCallback</a> callback, <br>					 void * userData, <br>					 const char * filename);
<a href="libxml2-nanoftp.html#SOCKET">SOCKET</a>	<a href="#xmlNanoFTPGetConnection">xmlNanoFTPGetConnection</a>		(void * ctx);
int	<a href="#xmlNanoFTPGetResponse">xmlNanoFTPGetResponse</a>		(void * ctx);
<a href="libxml2-nanoftp.html#SOCKET">SOCKET</a>	<a href="#xmlNanoFTPGetSocket">xmlNanoFTPGetSocket</a>		(void * ctx, <br>					 const char * filename);
void	<a href="#xmlNanoFTPInit">xmlNanoFTPInit</a>			(void);
int	<a href="#xmlNanoFTPList">xmlNanoFTPList</a>			(void * ctx, <br>					 <a href="libxml2-nanoftp.html#ftpListCallback">ftpListCallback</a> callback, <br>					 void * userData, <br>					 const char * filename);
void *	<a href="#xmlNanoFTPNewCtxt">xmlNanoFTPNewCtxt</a>		(const char * URL);
void *	<a href="#xmlNanoFTPOpen">xmlNanoFTPOpen</a>			(const char * URL);
void	<a href="#xmlNanoFTPProxy">xmlNanoFTPProxy</a>			(const char * host, <br>					 int port, <br>					 const char * user, <br>					 const char * passwd, <br>					 int type);
int	<a href="#xmlNanoFTPQuit">xmlNanoFTPQuit</a>			(void * ctx);
int	<a href="#xmlNanoFTPRead">xmlNanoFTPRead</a>			(void * ctx, <br>					 void * dest, <br>					 int len);
void	<a href="#xmlNanoFTPScanProxy">xmlNanoFTPScanProxy</a>		(const char * URL);
int	<a href="#xmlNanoFTPUpdateURL">xmlNanoFTPUpdateURL</a>		(void * ctx, <br>					 const char * URL);
</pre>
</div>
<div class="refsect1" lang="en"><h2>Description</h2></div>
<div class="refsect1" lang="en">
<h2>Details</h2>
<div class="refsect2" lang="en">
<div class="refsect2" lang="en">
<h3>
<a name="INVALID_SOCKET">Macro </a>INVALID_SOCKET</h3>
<pre class="programlisting">#define <a href="#INVALID_SOCKET">INVALID_SOCKET</a>;
</pre>
<p>macro used to provide portability of code to windows sockets the value to be used when the socket is not valid</p>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="SOCKET">Macro </a>SOCKET</h3>
<pre class="programlisting">#define <a href="#SOCKET">SOCKET</a>;
</pre>
<p>macro used to provide portability of code to windows sockets</p>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="ftpDataCallback"></a>Function type ftpDataCallback</h3>
<pre class="programlisting">void	ftpDataCallback			(void * userData, <br>					 const char * data, <br>					 int len)<br>
</pre>
<p>A callback for the <a href="libxml2-nanoftp.html#xmlNanoFTPGet">xmlNanoFTPGet</a> command.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>userData</tt></i>:</span></td>
<td>the user provided context</td>
</tr>
<tr>
<td><span class="term"><i><tt>data</tt></i>:</span></td>
<td>the data received</td>
</tr>
<tr>
<td><span class="term"><i><tt>len</tt></i>:</span></td>
<td>its size in bytes</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="ftpListCallback"></a>Function type ftpListCallback</h3>
<pre class="programlisting">void	ftpListCallback			(void * userData, <br>					 const char * filename, <br>					 const char * attrib, <br>					 const char * owner, <br>					 const char * group, <br>					 unsigned long size, <br>					 int links, <br>					 int year, <br>					 const char * month, <br>					 int day, <br>					 int hour, <br>					 int minute)<br>
</pre>
<p>A callback for the <a href="libxml2-nanoftp.html#xmlNanoFTPList">xmlNanoFTPList</a> command. Note that only one of year and day:minute are specified.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>userData</tt></i>:</span></td>
<td>user provided data for the callback</td>
</tr>
<tr>
<td><span class="term"><i><tt>filename</tt></i>:</span></td>
<td>the file name (including "-&gt;" when links are shown)</td>
</tr>
<tr>
<td><span class="term"><i><tt>attrib</tt></i>:</span></td>
<td>the <a href="libxml2-SAX.html#attribute">attribute</a> string</td>
</tr>
<tr>
<td><span class="term"><i><tt>owner</tt></i>:</span></td>
<td>the owner string</td>
</tr>
<tr>
<td><span class="term"><i><tt>group</tt></i>:</span></td>
<td>the group string</td>
</tr>
<tr>
<td><span class="term"><i><tt>size</tt></i>:</span></td>
<td>the file size</td>
</tr>
<tr>
<td><span class="term"><i><tt>links</tt></i>:</span></td>
<td>the link count</td>
</tr>
<tr>
<td><span class="term"><i><tt>year</tt></i>:</span></td>
<td>the year</td>
</tr>
<tr>
<td><span class="term"><i><tt>month</tt></i>:</span></td>
<td>the month</td>
</tr>
<tr>
<td><span class="term"><i><tt>day</tt></i>:</span></td>
<td>the day</td>
</tr>
<tr>
<td><span class="term"><i><tt>hour</tt></i>:</span></td>
<td>the hour</td>
</tr>
<tr>
<td><span class="term"><i><tt>minute</tt></i>:</span></td>
<td>the minute</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="xmlNanoFTPCheckResponse"></a>xmlNanoFTPCheckResponse ()</h3>
<pre class="programlisting">int	xmlNanoFTPCheckResponse		(void * ctx)<br>
</pre>
<p>Check if there is a response from the FTP server after a command.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>ctx</tt></i>:</span></td>
<td>an FTP context</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>the code number, or 0</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="xmlNanoFTPCleanup"></a>xmlNanoFTPCleanup ()</h3>
<pre class="programlisting">void	xmlNanoFTPCleanup		(void)<br>
</pre>
<p>Cleanup the FTP protocol layer. This cleanup proxy information.</p>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="xmlNanoFTPClose"></a>xmlNanoFTPClose ()</h3>
<pre class="programlisting">int	xmlNanoFTPClose			(void * ctx)<br>
</pre>
<p>Close the connection and both control and transport</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>ctx</tt></i>:</span></td>
<td>an FTP context</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>-1 in case of error, 0 otherwise</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="xmlNanoFTPCloseConnection"></a>xmlNanoFTPCloseConnection ()</h3>
<pre class="programlisting">int	xmlNanoFTPCloseConnection	(void * ctx)<br>
</pre>
<p>Close the data connection from the server</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>ctx</tt></i>:</span></td>
<td>an FTP context</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>-1 in case of error, 0 otherwise</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="xmlNanoFTPConnect"></a>xmlNanoFTPConnect ()</h3>
<pre class="programlisting">int	xmlNanoFTPConnect		(void * ctx)<br>
</pre>
<p>Tries to open a control connection</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>ctx</tt></i>:</span></td>
<td>an FTP context</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>-1 in case of error, 0 otherwise</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="xmlNanoFTPConnectTo"></a>xmlNanoFTPConnectTo ()</h3>
<pre class="programlisting">void *	xmlNanoFTPConnectTo		(const char * server, <br>					 int port)<br>
</pre>
<p>Tries to open a control connection to the given server/port</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>server</tt></i>:</span></td>
<td>an FTP server name</td>
</tr>
<tr>
<td><span class="term"><i><tt>port</tt></i>:</span></td>
<td>the port (use 21 if 0)</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>an fTP context or NULL if it failed</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="xmlNanoFTPCwd"></a>xmlNanoFTPCwd ()</h3>
<pre class="programlisting">int	xmlNanoFTPCwd			(void * ctx, <br>					 const char * directory)<br>
</pre>
<p>Tries to change the remote directory</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>ctx</tt></i>:</span></td>
<td>an FTP context</td>
</tr>
<tr>
<td><span class="term"><i><tt>directory</tt></i>:</span></td>
<td>a directory on the server</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>-1 in case of error, 1 if CWD worked, 0 if it failed</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="xmlNanoFTPDele"></a>xmlNanoFTPDele ()</h3>
<pre class="programlisting">int	xmlNanoFTPDele			(void * ctx, <br>					 const char * file)<br>
</pre>
<p>Tries to delete an item (file or directory) from server</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>ctx</tt></i>:</span></td>
<td>an FTP context</td>
</tr>
<tr>
<td><span class="term"><i><tt>file</tt></i>:</span></td>
<td>a file or directory on the server</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>-1 in case of error, 1 if DELE worked, 0 if it failed</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="xmlNanoFTPFreeCtxt"></a>xmlNanoFTPFreeCtxt ()</h3>
<pre class="programlisting">void	xmlNanoFTPFreeCtxt		(void * ctx)<br>
</pre>
<p>Frees the context after closing the connection.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody><tr>
<td><span class="term"><i><tt>ctx</tt></i>:</span></td>
<td>an FTP context</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="xmlNanoFTPGet"></a>xmlNanoFTPGet ()</h3>
<pre class="programlisting">int	xmlNanoFTPGet			(void * ctx, <br>					 <a href="libxml2-nanoftp.html#ftpDataCallback">ftpDataCallback</a> callback, <br>					 void * userData, <br>					 const char * filename)<br>
</pre>
<p>Fetch the given file from the server. All data are passed back in the callbacks. The last callback has a size of 0 block.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>ctx</tt></i>:</span></td>
<td>an FTP context</td>
</tr>
<tr>
<td><span class="term"><i><tt>callback</tt></i>:</span></td>
<td>the user callback</td>
</tr>
<tr>
<td><span class="term"><i><tt>userData</tt></i>:</span></td>
<td>the user callback data</td>
</tr>
<tr>
<td><span class="term"><i><tt>filename</tt></i>:</span></td>
<td>the file to retrieve</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>-1 in case of error, 0 otherwise</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="xmlNanoFTPGetConnection"></a>xmlNanoFTPGetConnection ()</h3>
<pre class="programlisting"><a href="libxml2-nanoftp.html#SOCKET">SOCKET</a>	xmlNanoFTPGetConnection		(void * ctx)<br>
</pre>
<p>Try to open a data connection to the server. Currently only passive mode is supported.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>ctx</tt></i>:</span></td>
<td>an FTP context</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>-1 in case of error, 0 otherwise</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="xmlNanoFTPGetResponse"></a>xmlNanoFTPGetResponse ()</h3>
<pre class="programlisting">int	xmlNanoFTPGetResponse		(void * ctx)<br>
</pre>
<p>Get the response from the FTP server after a command.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>ctx</tt></i>:</span></td>
<td>an FTP context</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>the code number</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="xmlNanoFTPGetSocket"></a>xmlNanoFTPGetSocket ()</h3>
<pre class="programlisting"><a href="libxml2-nanoftp.html#SOCKET">SOCKET</a>	xmlNanoFTPGetSocket		(void * ctx, <br>					 const char * filename)<br>
</pre>
<p>Initiate fetch of the given file from the server.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>ctx</tt></i>:</span></td>
<td>an FTP context</td>
</tr>
<tr>
<td><span class="term"><i><tt>filename</tt></i>:</span></td>
<td>the file to retrieve (or NULL if path is in context).</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>the socket for the data connection, or &lt;0 in case of error</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="xmlNanoFTPInit"></a>xmlNanoFTPInit ()</h3>
<pre class="programlisting">void	xmlNanoFTPInit			(void)<br>
</pre>
<p>Initialize the FTP protocol layer. Currently it just checks for proxy information, and get the hostname</p>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="xmlNanoFTPList"></a>xmlNanoFTPList ()</h3>
<pre class="programlisting">int	xmlNanoFTPList			(void * ctx, <br>					 <a href="libxml2-nanoftp.html#ftpListCallback">ftpListCallback</a> callback, <br>					 void * userData, <br>					 const char * filename)<br>
</pre>
<p>Do a listing on the server. All files info are passed back in the callbacks.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>ctx</tt></i>:</span></td>
<td>an FTP context</td>
</tr>
<tr>
<td><span class="term"><i><tt>callback</tt></i>:</span></td>
<td>the user callback</td>
</tr>
<tr>
<td><span class="term"><i><tt>userData</tt></i>:</span></td>
<td>the user callback data</td>
</tr>
<tr>
<td><span class="term"><i><tt>filename</tt></i>:</span></td>
<td>optional files to list</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>-1 in case of error, 0 otherwise</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="xmlNanoFTPNewCtxt"></a>xmlNanoFTPNewCtxt ()</h3>
<pre class="programlisting">void *	xmlNanoFTPNewCtxt		(const char * URL)<br>
</pre>
<p>Allocate and initialize a new FTP context.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>URL</tt></i>:</span></td>
<td>The URL used to initialize the context</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>an FTP context or NULL in case of error.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="xmlNanoFTPOpen"></a>xmlNanoFTPOpen ()</h3>
<pre class="programlisting">void *	xmlNanoFTPOpen			(const char * URL)<br>
</pre>
<p>Start to fetch the given ftp:// resource</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>URL</tt></i>:</span></td>
<td>the URL to the resource</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>an FTP context, or NULL</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="xmlNanoFTPProxy"></a>xmlNanoFTPProxy ()</h3>
<pre class="programlisting">void	xmlNanoFTPProxy			(const char * host, <br>					 int port, <br>					 const char * user, <br>					 const char * passwd, <br>					 int type)<br>
</pre>
<p>Setup the FTP proxy information. This can also be done by using ftp_proxy ftp_proxy_user and ftp_proxy_password environment variables.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>host</tt></i>:</span></td>
<td>the proxy host name</td>
</tr>
<tr>
<td><span class="term"><i><tt>port</tt></i>:</span></td>
<td>the proxy port</td>
</tr>
<tr>
<td><span class="term"><i><tt>user</tt></i>:</span></td>
<td>the proxy user name</td>
</tr>
<tr>
<td><span class="term"><i><tt>passwd</tt></i>:</span></td>
<td>the proxy password</td>
</tr>
<tr>
<td><span class="term"><i><tt>type</tt></i>:</span></td>
<td>the type of proxy 1 for using SITE, 2 for USER a@b</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="xmlNanoFTPQuit"></a>xmlNanoFTPQuit ()</h3>
<pre class="programlisting">int	xmlNanoFTPQuit			(void * ctx)<br>
</pre>
<p>Send a QUIT command to the server</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>ctx</tt></i>:</span></td>
<td>an FTP context</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>-1 in case of error, 0 otherwise</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="xmlNanoFTPRead"></a>xmlNanoFTPRead ()</h3>
<pre class="programlisting">int	xmlNanoFTPRead			(void * ctx, <br>					 void * dest, <br>					 int len)<br>
</pre>
<p>This function tries to read @len bytes from the existing FTP connection and saves them in @dest. This is a blocking call.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>ctx</tt></i>:</span></td>
<td>the FTP context</td>
</tr>
<tr>
<td><span class="term"><i><tt>dest</tt></i>:</span></td>
<td>a buffer</td>
</tr>
<tr>
<td><span class="term"><i><tt>len</tt></i>:</span></td>
<td>the buffer length</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>the number of byte read. 0 is an indication of an end of connection. -1 indicates a parameter error.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="xmlNanoFTPScanProxy"></a>xmlNanoFTPScanProxy ()</h3>
<pre class="programlisting">void	xmlNanoFTPScanProxy		(const char * URL)<br>
</pre>
<p>(Re)Initialize the FTP Proxy context by parsing the URL and finding the protocol host port it indicates. Should be like ftp://myproxy/ or ftp://myproxy:3128/ A NULL URL cleans up proxy information.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody><tr>
<td><span class="term"><i><tt>URL</tt></i>:</span></td>
<td>The proxy URL used to initialize the proxy context</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<h3>
<a name="xmlNanoFTPUpdateURL"></a>xmlNanoFTPUpdateURL ()</h3>
<pre class="programlisting">int	xmlNanoFTPUpdateURL		(void * ctx, <br>					 const char * URL)<br>
</pre>
<p>Update an FTP context by parsing the URL and finding new path it indicates. If there is an error in the protocol, hostname, port or other information, the error is raised. It indicates a new connection has to be established.</p>
<div class="variablelist"><table border="0">
<col align="left">
<tbody>
<tr>
<td><span class="term"><i><tt>ctx</tt></i>:</span></td>
<td>an FTP context</td>
</tr>
<tr>
<td><span class="term"><i><tt>URL</tt></i>:</span></td>
<td>The URL used to update the context</td>
</tr>
<tr>
<td><span class="term"><i><tt>Returns</tt></i>:</span></td>
<td>0 if Ok, -1 in case of error (other host).</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
</div>
</div>
</body>
</html>