Commit f99d2223 authored by Ozkan Sezer's avatar Ozkan Sezer Committed by Daniel Veillard

614087 Fix Socket API usage to allow Windows64 compilation

In Windows 64 a socket is no more represented by an int,
this breaks the nanoftp API and nanoftp/nanohttp, the patch
changes this and fix the API for Win64
Regenerated the XML and documentation as a result too.
parent ce5f9a7d
This diff is collapsed.
......@@ -542,7 +542,9 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-list.html#xmlListSort">xmlListSort</a><br />
<a href="html/libxml-list.html#xmlListWalk">xmlListWalk</a><br />
<a href="html/libxml-list.html#xmlListWalker">xmlListWalker</a><br />
</p><h2><a name="nanoftp" id="nanoftp">Module nanoftp</a>:</h2><p><a href="html/libxml-nanoftp.html#ftpDataCallback">ftpDataCallback</a><br />
</p><h2><a name="nanoftp" id="nanoftp">Module nanoftp</a>:</h2><p><a href="html/libxml-nanoftp.html#INVALID_SOCKET">INVALID_SOCKET</a><br />
<a href="html/libxml-nanoftp.html#SOCKET">SOCKET</a><br />
<a href="html/libxml-nanoftp.html#ftpDataCallback">ftpDataCallback</a><br />
<a href="html/libxml-nanoftp.html#ftpListCallback">ftpListCallback</a><br />
<a href="html/libxml-nanoftp.html#xmlNanoFTPCheckResponse">xmlNanoFTPCheckResponse</a><br />
<a href="html/libxml-nanoftp.html#xmlNanoFTPCleanup">xmlNanoFTPCleanup</a><br />
......@@ -2818,6 +2820,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-xmlsave.html#XML_SAVE_NO_DECL">XML_SAVE_NO_DECL</a><br />
<a href="html/libxml-xmlsave.html#XML_SAVE_NO_EMPTY">XML_SAVE_NO_EMPTY</a><br />
<a href="html/libxml-xmlsave.html#XML_SAVE_NO_XHTML">XML_SAVE_NO_XHTML</a><br />
<a href="html/libxml-xmlsave.html#XML_SAVE_WSNONSIG">XML_SAVE_WSNONSIG</a><br />
<a href="html/libxml-xmlsave.html#XML_SAVE_XHTML">XML_SAVE_XHTML</a><br />
<a href="html/libxml-xmlsave.html#xmlSaveClose">xmlSaveClose</a><br />
<a href="html/libxml-xmlsave.html#xmlSaveCtxt">xmlSaveCtxt</a><br />
......
......@@ -40,6 +40,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-HTMLtree.html#HTML_TEXT_NODE">HTML_TEXT_NODE</a><br />
<a href="html/libxml-HTMLparser.html#HTML_VALID">HTML_VALID</a><br />
</p><h2>Letter I:</h2><p><a href="html/libxml-parserInternals.html#INPUT_CHUNK">INPUT_CHUNK</a><br />
<a href="html/libxml-nanoftp.html#INVALID_SOCKET">INVALID_SOCKET</a><br />
<a href="html/libxml-parserInternals.html#IS_ASCII_DIGIT">IS_ASCII_DIGIT</a><br />
<a href="html/libxml-parserInternals.html#IS_ASCII_LETTER">IS_ASCII_LETTER</a><br />
<a href="html/libxml-parserInternals.html#IS_BASECHAR">IS_BASECHAR</a><br />
......@@ -102,6 +103,7 @@ A:link, A:visited, A:active { text-decoration: underline }
</p><h2>Letter M:</h2><p><a href="html/libxml-parserInternals.html#MOVETO_ENDTAG">MOVETO_ENDTAG</a><br />
<a href="html/libxml-parserInternals.html#MOVETO_STARTTAG">MOVETO_STARTTAG</a><br />
</p><h2>Letter S:</h2><p><a href="html/libxml-parserInternals.html#SKIP_EOL">SKIP_EOL</a><br />
<a href="html/libxml-nanoftp.html#SOCKET">SOCKET</a><br />
</p><h2>Letter U:</h2><p><a href="html/libxml-HTMLparser.html#UTF8ToHtml">UTF8ToHtml</a><br />
<a href="html/libxml-encoding.html#UTF8Toisolat1">UTF8Toisolat1</a><br />
</p><h2>Letter W:</h2><p><a href="html/libxml-xmlversion.html#WITHOUT_TRIO">WITHOUT_TRIO</a><br />
......@@ -807,6 +809,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-xmlsave.html#XML_SAVE_NO_EMPTY">XML_SAVE_NO_EMPTY</a><br />
<a href="html/libxml-xmlsave.html#XML_SAVE_NO_XHTML">XML_SAVE_NO_XHTML</a><br />
<a href="html/libxml-xmlerror.html#XML_SAVE_UNKNOWN_ENCODING">XML_SAVE_UNKNOWN_ENCODING</a><br />
<a href="html/libxml-xmlsave.html#XML_SAVE_WSNONSIG">XML_SAVE_WSNONSIG</a><br />
<a href="html/libxml-xmlsave.html#XML_SAVE_XHTML">XML_SAVE_XHTML</a><br />
<a href="html/libxml-parser.html#XML_SAX2_MAGIC">XML_SAX2_MAGIC</a><br />
<a href="html/libxml-xmlerror.html#XML_SCHEMAP_AG_PROPS_CORRECT">XML_SCHEMAP_AG_PROPS_CORRECT</a><br />
......
......@@ -43,13 +43,15 @@
<p>Author(s): Daniel Veillard </p>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<pre class="synopsis">int <a href="#xmlNanoFTPQuit">xmlNanoFTPQuit</a> (void * ctx);
<pre class="synopsis">#define <a href="#INVALID_SOCKET">INVALID_SOCKET</a>;
#define <a href="#SOCKET">SOCKET</a>;
int <a href="#xmlNanoFTPQuit">xmlNanoFTPQuit</a> (void * ctx);
int <a href="#xmlNanoFTPClose">xmlNanoFTPClose</a> (void * ctx);
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="#xmlNanoFTPCloseConnection">xmlNanoFTPCloseConnection</a> (void * ctx);
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="#xmlNanoFTPUpdateURL">xmlNanoFTPUpdateURL</a> (void * ctx, <br/> const char * URL);
int <a href="#xmlNanoFTPGetConnection">xmlNanoFTPGetConnection</a> (void * ctx);
<a href="libxml2-nanoftp.html#SOCKET">SOCKET</a> <a href="#xmlNanoFTPGetConnection">xmlNanoFTPGetConnection</a> (void * ctx);
int <a href="#xmlNanoFTPDele">xmlNanoFTPDele</a> (void * ctx, <br/> const char * file);
void * <a href="#xmlNanoFTPNewCtxt">xmlNanoFTPNewCtxt</a> (const char * URL);
int <a href="#xmlNanoFTPCheckResponse">xmlNanoFTPCheckResponse</a> (void * ctx);
......@@ -62,7 +64,7 @@ void * <a href="#xmlNanoFTPConnectTo">xmlNanoFTPConnectTo</a> (const char * ser
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="#xmlNanoFTPOpen">xmlNanoFTPOpen</a> (const char * URL);
int <a href="#xmlNanoFTPConnect">xmlNanoFTPConnect</a> (void * ctx);
int <a href="#xmlNanoFTPGetSocket">xmlNanoFTPGetSocket</a> (void * ctx, <br/> const char * filename);
<a href="libxml2-nanoftp.html#SOCKET">SOCKET</a> <a href="#xmlNanoFTPGetSocket">xmlNanoFTPGetSocket</a> (void * ctx, <br/> const char * filename);
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);
int <a href="#xmlNanoFTPRead">xmlNanoFTPRead</a> (void * ctx, <br/> void * dest, <br/> int len);
void <a href="#xmlNanoFTPFreeCtxt">xmlNanoFTPFreeCtxt</a> (void * ctx);
......@@ -75,6 +77,14 @@ void <a href="#xmlNanoFTPCleanup">xmlNanoFTPCleanup</a> (void);
<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/>
</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/>
</div>
<hr/>
<div class="refsect2" lang="en"><h3><a name="ftpDataCallback"/>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>
......@@ -123,7 +133,7 @@ void <a href="#xmlNanoFTPCleanup">xmlNanoFTPCleanup</a> (void);
</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 incase of error, 0 otherwise</td></tr></tbody></table></div></div>
<hr/>
<div class="refsect2" lang="en"><h3><a name="xmlNanoFTPGetConnection"/>xmlNanoFTPGetConnection ()</h3><pre class="programlisting">int xmlNanoFTPGetConnection (void * ctx)<br/>
<div class="refsect2" lang="en"><h3><a name="xmlNanoFTPGetConnection"/>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 incase of error, 0 otherwise</td></tr></tbody></table></div></div>
<hr/>
......@@ -131,7 +141,7 @@ void <a href="#xmlNanoFTPCleanup">xmlNanoFTPCleanup</a> (void);
</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"/>xmlNanoFTPGetSocket ()</h3><pre class="programlisting">int xmlNanoFTPGetSocket (void * ctx, <br/> const char * filename)<br/>
<div class="refsect2" lang="en"><h3><a name="xmlNanoFTPGetSocket"/>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/>
......
......@@ -81,7 +81,8 @@ The content of this structure is not made public by the API.
<a name="XML_SAVE_NO_XHTML">XML_SAVE_NO_XHTML</a> = 8 /* disable XHTML1 specific rules */
<a name="XML_SAVE_XHTML">XML_SAVE_XHTML</a> = 16 /* force XHTML1 specific rules */
<a name="XML_SAVE_AS_XML">XML_SAVE_AS_XML</a> = 32 /* force XML serialization on HTML doc */
<a name="XML_SAVE_AS_HTML">XML_SAVE_AS_HTML</a> = 64 /* force HTML serialization on XML doc */
<a name="XML_SAVE_AS_HTML">XML_SAVE_AS_HTML</a> = 64 /* force HTML serialization on XML doc */
<a name="XML_SAVE_WSNONSIG">XML_SAVE_WSNONSIG</a> = 128 /* format with non-significant whitespace */
};
</pre><p/>
</div>
......
......@@ -71,6 +71,7 @@
<function name="HTML_PRESERVE_NODE" link="libxml2-HTMLtree.html#HTML_PRESERVE_NODE"/>
<function name="HTML_TEXT_NODE" link="libxml2-HTMLtree.html#HTML_TEXT_NODE"/>
<function name="INPUT_CHUNK" link="libxml2-parserInternals.html#INPUT_CHUNK"/>
<function name="INVALID_SOCKET" link="libxml2-nanoftp.html#INVALID_SOCKET"/>
<function name="IS_ASCII_DIGIT" link="libxml2-parserInternals.html#IS_ASCII_DIGIT"/>
<function name="IS_ASCII_LETTER" link="libxml2-parserInternals.html#IS_ASCII_LETTER"/>
<function name="IS_BASECHAR" link="libxml2-parserInternals.html#IS_BASECHAR"/>
......@@ -133,6 +134,7 @@
<function name="MOVETO_ENDTAG" link="libxml2-parserInternals.html#MOVETO_ENDTAG"/>
<function name="MOVETO_STARTTAG" link="libxml2-parserInternals.html#MOVETO_STARTTAG"/>
<function name="SKIP_EOL" link="libxml2-parserInternals.html#SKIP_EOL"/>
<function name="SOCKET" link="libxml2-nanoftp.html#SOCKET"/>
<function name="WITHOUT_TRIO" link="libxml2-xmlversion.html#WITHOUT_TRIO"/>
<function name="WITH_TRIO" link="libxml2-xmlversion.html#WITH_TRIO"/>
<function name="XINCLUDE_FALLBACK" link="libxml2-xinclude.html#XINCLUDE_FALLBACK"/>
......@@ -988,6 +990,7 @@
<function name="XML_SAVE_NO_EMPTY" link="libxml2-xmlsave.html#XML_SAVE_NO_EMPTY"/>
<function name="XML_SAVE_NO_XHTML" link="libxml2-xmlsave.html#XML_SAVE_NO_XHTML"/>
<function name="XML_SAVE_UNKNOWN_ENCODING" link="libxml2-xmlerror.html#XML_SAVE_UNKNOWN_ENCODING"/>
<function name="XML_SAVE_WSNONSIG" link="libxml2-xmlsave.html#XML_SAVE_WSNONSIG"/>
<function name="XML_SAVE_XHTML" link="libxml2-xmlsave.html#XML_SAVE_XHTML"/>
<function name="XML_SCHEMAP_AG_PROPS_CORRECT" link="libxml2-xmlerror.html#XML_SCHEMAP_AG_PROPS_CORRECT"/>
<function name="XML_SCHEMAP_ATTRFORMDEFAULT_VALUE" link="libxml2-xmlerror.html#XML_SCHEMAP_ATTRFORMDEFAULT_VALUE"/>
......
This diff is collapsed.
......@@ -35,6 +35,7 @@ The content of this structure is not made public by the API.
<a name="XML_SAVE_XHTML" id="XML_SAVE_XHTML">XML_SAVE_XHTML</a> = 16 : force XHTML1 specific rules
<a name="XML_SAVE_AS_XML" id="XML_SAVE_AS_XML">XML_SAVE_AS_XML</a> = 32 : force XML serialization on HTML doc
<a name="XML_SAVE_AS_HTML" id="XML_SAVE_AS_HTML">XML_SAVE_AS_HTML</a> = 64 : force HTML serialization on XML doc
<a name="XML_SAVE_WSNONSIG" id="XML_SAVE_WSNONSIG">XML_SAVE_WSNONSIG</a> = 128 : format with non-significant whitespace
}
</pre><h3><a name="xmlSaveClose" id="xmlSaveClose"></a>Function: xmlSaveClose</h3><pre class="programlisting">int xmlSaveClose (<a href="libxml-xmlsave.html#xmlSaveCtxtPtr">xmlSaveCtxtPtr</a> ctxt)<br />
</pre><p>Close a document saving context, i.e. make sure that all bytes have been output and free the associated data.</p>
......
......@@ -617,6 +617,8 @@
<summary>minimal FTP implementation</summary>
<description>minimal FTP implementation allowing to fetch resources like external subset. </description>
<author>Daniel Veillard </author>
<exports symbol='INVALID_SOCKET' type='macro'/>
<exports symbol='SOCKET' type='macro'/>
<exports symbol='xmlNanoFTPQuit' type='function'/>
<exports symbol='xmlNanoFTPClose' type='function'/>
<exports symbol='ftpListCallback' type='function'/>
......@@ -3004,6 +3006,7 @@
<exports symbol='XML_SAVE_NO_DECL' type='enum'/>
<exports symbol='XML_SAVE_AS_HTML' type='enum'/>
<exports symbol='XML_SAVE_FORMAT' type='enum'/>
<exports symbol='XML_SAVE_WSNONSIG' type='enum'/>
<exports symbol='xmlSaveOption' type='typedef'/>
<exports symbol='xmlSaveCtxt' type='typedef'/>
<exports symbol='xmlSaveCtxtPtr' type='typedef'/>
......@@ -3836,6 +3839,8 @@
<macro name='INPUT_CHUNK' file='parserInternals'>
<info>The parser tries to always have that amount of input ready. One of the point is providing context when reporting errors.</info>
</macro>
<macro name='INVALID_SOCKET' file='nanoftp'>
</macro>
<macro name='IS_ASCII_DIGIT' file='parserInternals'>
<info>Macro to check [0-9]</info>
<arg name='c' info='an xmlChar value'/>
......@@ -4043,6 +4048,8 @@
<info>Skips the end of line chars.</info>
<arg name='p' info='and UTF8 string pointer'/>
</macro>
<macro name='SOCKET' file='nanoftp'>
</macro>
<macro name='WITHOUT_TRIO' file='xmlversion'>
<info>defined if the trio support should not be configured in</info>
</macro>
......@@ -5270,7 +5277,7 @@ crash if you try to modify the tree)'/>
<enum name='XML_RNGP_VALUE_NO_CONTENT' file='xmlerror' value='1120' type='xmlParserErrors' info='1120'/>
<enum name='XML_RNGP_XMLNS_NAME' file='xmlerror' value='1121' type='xmlParserErrors' info='1121'/>
<enum name='XML_RNGP_XML_NS' file='xmlerror' value='1122' type='xmlParserErrors' info='1122'/>
<enum name='XML_SAVE_AS_HTML' file='xmlsave' value='64' type='xmlSaveOption' info=' force HTML serialization on XML doc'/>
<enum name='XML_SAVE_AS_HTML' file='xmlsave' value='64' type='xmlSaveOption' info='force HTML serialization on XML doc'/>
<enum name='XML_SAVE_AS_XML' file='xmlsave' value='32' type='xmlSaveOption' info='force XML serialization on HTML doc'/>
<enum name='XML_SAVE_CHAR_INVALID' file='xmlerror' value='1401' type='xmlParserErrors' info='1401'/>
<enum name='XML_SAVE_FORMAT' file='xmlsave' value='1' type='xmlSaveOption' info='format save output'/>
......@@ -5280,6 +5287,7 @@ crash if you try to modify the tree)'/>
<enum name='XML_SAVE_NO_EMPTY' file='xmlsave' value='4' type='xmlSaveOption' info='no empty tags'/>
<enum name='XML_SAVE_NO_XHTML' file='xmlsave' value='8' type='xmlSaveOption' info='disable XHTML1 specific rules'/>
<enum name='XML_SAVE_UNKNOWN_ENCODING' file='xmlerror' value='1403' type='xmlParserErrors' info='1403'/>
<enum name='XML_SAVE_WSNONSIG' file='xmlsave' value='128' type='xmlSaveOption' info=' format with non-significant whitespace'/>
<enum name='XML_SAVE_XHTML' file='xmlsave' value='16' type='xmlSaveOption' info='force XHTML1 specific rules'/>
<enum name='XML_SCHEMAP_AG_PROPS_CORRECT' file='xmlerror' value='3087' type='xmlParserErrors' info='3086'/>
<enum name='XML_SCHEMAP_ATTRFORMDEFAULT_VALUE' file='xmlerror' value='1701' type='xmlParserErrors' info='1701'/>
......@@ -11042,7 +11050,7 @@ Could we use @subtypes for this?'/>
<function name='xmlNanoFTPGetConnection' file='nanoftp' module='nanoftp'>
<cond>defined(LIBXML_FTP_ENABLED)</cond>
<info>Try to open a data connection to the server. Currently only passive mode is supported.</info>
<return type='int' info='-1 incase of error, 0 otherwise'/>
<return type='SOCKET' info='-1 incase of error, 0 otherwise'/>
<arg name='ctx' type='void *' info='an FTP context'/>
</function>
<function name='xmlNanoFTPGetResponse' file='nanoftp' module='nanoftp'>
......@@ -11054,7 +11062,7 @@ Could we use @subtypes for this?'/>
<function name='xmlNanoFTPGetSocket' file='nanoftp' module='nanoftp'>
<cond>defined(LIBXML_FTP_ENABLED)</cond>
<info>Initiate fetch of the given file from the server.</info>
<return type='int' info='the socket for the data connection, or &lt;0 in case of error'/>
<return type='SOCKET' info='the socket for the data connection, or &lt;0 in case of error'/>
<arg name='ctx' type='void *' info='an FTP context'/>
<arg name='filename' type='const char *' info='the file to retrieve (or NULL if path is in context).'/>
</function>
......@@ -34,6 +34,7 @@
<reference name='HTML_TEXT_NODE' href='html/libxml-HTMLtree.html#HTML_TEXT_NODE'/>
<reference name='HTML_VALID' href='html/libxml-HTMLparser.html#HTML_VALID'/>
<reference name='INPUT_CHUNK' href='html/libxml-parserInternals.html#INPUT_CHUNK'/>
<reference name='INVALID_SOCKET' href='html/libxml-nanoftp.html#INVALID_SOCKET'/>
<reference name='IS_ASCII_DIGIT' href='html/libxml-parserInternals.html#IS_ASCII_DIGIT'/>
<reference name='IS_ASCII_LETTER' href='html/libxml-parserInternals.html#IS_ASCII_LETTER'/>
<reference name='IS_BASECHAR' href='html/libxml-parserInternals.html#IS_BASECHAR'/>
......@@ -96,6 +97,7 @@
<reference name='MOVETO_ENDTAG' href='html/libxml-parserInternals.html#MOVETO_ENDTAG'/>
<reference name='MOVETO_STARTTAG' href='html/libxml-parserInternals.html#MOVETO_STARTTAG'/>
<reference name='SKIP_EOL' href='html/libxml-parserInternals.html#SKIP_EOL'/>
<reference name='SOCKET' href='html/libxml-nanoftp.html#SOCKET'/>
<reference name='UTF8ToHtml' href='html/libxml-HTMLparser.html#UTF8ToHtml'/>
<reference name='UTF8Toisolat1' href='html/libxml-encoding.html#UTF8Toisolat1'/>
<reference name='WITHOUT_TRIO' href='html/libxml-xmlversion.html#WITHOUT_TRIO'/>
......@@ -801,6 +803,7 @@
<reference name='XML_SAVE_NO_EMPTY' href='html/libxml-xmlsave.html#XML_SAVE_NO_EMPTY'/>
<reference name='XML_SAVE_NO_XHTML' href='html/libxml-xmlsave.html#XML_SAVE_NO_XHTML'/>
<reference name='XML_SAVE_UNKNOWN_ENCODING' href='html/libxml-xmlerror.html#XML_SAVE_UNKNOWN_ENCODING'/>
<reference name='XML_SAVE_WSNONSIG' href='html/libxml-xmlsave.html#XML_SAVE_WSNONSIG'/>
<reference name='XML_SAVE_XHTML' href='html/libxml-xmlsave.html#XML_SAVE_XHTML'/>
<reference name='XML_SAX2_MAGIC' href='html/libxml-parser.html#XML_SAX2_MAGIC'/>
<reference name='XML_SCHEMAP_AG_PROPS_CORRECT' href='html/libxml-xmlerror.html#XML_SCHEMAP_AG_PROPS_CORRECT'/>
......@@ -3579,6 +3582,7 @@
</letter>
<letter name='I'>
<ref name='INPUT_CHUNK'/>
<ref name='INVALID_SOCKET'/>
<ref name='IS_ASCII_DIGIT'/>
<ref name='IS_ASCII_LETTER'/>
<ref name='IS_BASECHAR'/>
......@@ -3647,6 +3651,7 @@
</letter>
<letter name='S'>
<ref name='SKIP_EOL'/>
<ref name='SOCKET'/>
</letter>
<letter name='U'>
<ref name='UTF8ToHtml'/>
......@@ -4358,6 +4363,7 @@
<ref name='XML_SAVE_NO_EMPTY'/>
<ref name='XML_SAVE_NO_XHTML'/>
<ref name='XML_SAVE_UNKNOWN_ENCODING'/>
<ref name='XML_SAVE_WSNONSIG'/>
<ref name='XML_SAVE_XHTML'/>
<ref name='XML_SAX2_MAGIC'/>
<ref name='XML_SCHEMAP_AG_PROPS_CORRECT'/>
......@@ -7129,6 +7135,10 @@
</letter>
</alpha>
<constructors>
<type name='SOCKET'>
<ref name='xmlNanoFTPGetConnection'/>
<ref name='xmlNanoFTPGetSocket'/>
</type>
<type name='const htmlElemDesc *'>
<ref name='htmlTagLookup'/>
</type>
......@@ -11166,6 +11176,8 @@
<ref name='xmlListWalker'/>
</file>
<file name='nanoftp'>
<ref name='INVALID_SOCKET'/>
<ref name='SOCKET'/>
<ref name='ftpDataCallback'/>
<ref name='ftpListCallback'/>
<ref name='xmlNanoFTPCheckResponse'/>
......@@ -13486,6 +13498,7 @@
<ref name='XML_SAVE_NO_DECL'/>
<ref name='XML_SAVE_NO_EMPTY'/>
<ref name='XML_SAVE_NO_XHTML'/>
<ref name='XML_SAVE_WSNONSIG'/>
<ref name='XML_SAVE_XHTML'/>
<ref name='xmlSaveClose'/>
<ref name='xmlSaveCtxt'/>
......@@ -7,7 +7,7 @@
*
* Author: Daniel Veillard
*/
#ifndef __NANO_FTP_H__
#define __NANO_FTP_H__
......@@ -15,12 +15,20 @@
#ifdef LIBXML_FTP_ENABLED
/* Needed for portability to Windows 64 bits */
#if defined(__MINGW32__) || defined(_WIN32_WCE)
#include <winsock2.h>
#else
#define SOCKET int
#define INVALID_SOCKET (-1)
#endif
#ifdef __cplusplus
extern "C" {
#endif
/**
* ftpListCallback:
* ftpListCallback:
* @userData: user provided data for the callback
* @filename: the file name (including "->" when links are shown)
* @attrib: the attribute string
......@@ -44,7 +52,7 @@ typedef void (*ftpListCallback) (void *userData,
const char *month, int day, int hour,
int minute);
/**
* ftpDataCallback:
* ftpDataCallback:
* @userData: the user provided context
* @data: the data received
* @len: its size in bytes
......@@ -60,78 +68,78 @@ typedef void (*ftpDataCallback) (void *userData,
*/
XMLPUBFUN void XMLCALL
xmlNanoFTPInit (void);
XMLPUBFUN void XMLCALL
XMLPUBFUN void XMLCALL
xmlNanoFTPCleanup (void);
/*
* Creating/freeing contexts.
*/
XMLPUBFUN void * XMLCALL
XMLPUBFUN void * XMLCALL
xmlNanoFTPNewCtxt (const char *URL);
XMLPUBFUN void XMLCALL
XMLPUBFUN void XMLCALL
xmlNanoFTPFreeCtxt (void * ctx);
XMLPUBFUN void * XMLCALL
XMLPUBFUN void * XMLCALL
xmlNanoFTPConnectTo (const char *server,
int port);
/*
* Opening/closing session connections.
*/
XMLPUBFUN void * XMLCALL
XMLPUBFUN void * XMLCALL
xmlNanoFTPOpen (const char *URL);
XMLPUBFUN int XMLCALL
XMLPUBFUN int XMLCALL
xmlNanoFTPConnect (void *ctx);
XMLPUBFUN int XMLCALL
XMLPUBFUN int XMLCALL
xmlNanoFTPClose (void *ctx);
XMLPUBFUN int XMLCALL
XMLPUBFUN int XMLCALL
xmlNanoFTPQuit (void *ctx);
XMLPUBFUN void XMLCALL
XMLPUBFUN void XMLCALL
xmlNanoFTPScanProxy (const char *URL);
XMLPUBFUN void XMLCALL
XMLPUBFUN void XMLCALL
xmlNanoFTPProxy (const char *host,
int port,
const char *user,
const char *passwd,
int type);
XMLPUBFUN int XMLCALL
XMLPUBFUN int XMLCALL
xmlNanoFTPUpdateURL (void *ctx,
const char *URL);
/*
* Rather internal commands.
*/
XMLPUBFUN int XMLCALL
XMLPUBFUN int XMLCALL
xmlNanoFTPGetResponse (void *ctx);
XMLPUBFUN int XMLCALL
XMLPUBFUN int XMLCALL
xmlNanoFTPCheckResponse (void *ctx);
/*
* CD/DIR/GET handlers.
*/
XMLPUBFUN int XMLCALL
XMLPUBFUN int XMLCALL
xmlNanoFTPCwd (void *ctx,
const char *directory);
XMLPUBFUN int XMLCALL
XMLPUBFUN int XMLCALL
xmlNanoFTPDele (void *ctx,
const char *file);
XMLPUBFUN int XMLCALL
XMLPUBFUN SOCKET XMLCALL
xmlNanoFTPGetConnection (void *ctx);
XMLPUBFUN int XMLCALL
XMLPUBFUN int XMLCALL
xmlNanoFTPCloseConnection(void *ctx);
XMLPUBFUN int XMLCALL
XMLPUBFUN int XMLCALL
xmlNanoFTPList (void *ctx,
ftpListCallback callback,
void *userData,
const char *filename);
XMLPUBFUN int XMLCALL
XMLPUBFUN SOCKET XMLCALL
xmlNanoFTPGetSocket (void *ctx,
const char *filename);
XMLPUBFUN int XMLCALL
XMLPUBFUN int XMLCALL
xmlNanoFTPGet (void *ctx,
ftpDataCallback callback,
void *userData,
const char *filename);
XMLPUBFUN int XMLCALL
XMLPUBFUN int XMLCALL
xmlNanoFTPRead (void *ctx,
void *dest,
int len);
......
This diff is collapsed.
......@@ -75,18 +75,18 @@
#ifdef VMS
#include <stropts>
#define XML_SOCKLEN_T unsigned int
#define SOCKET int
#endif
#if defined(__MINGW32__) || defined(_WIN32_WCE)
#ifndef _WINSOCKAPI_
#define _WINSOCKAPI_
#endif
#include <wsockcompat.h>
#include <winsock2.h>
#undef XML_SOCKLEN_T
#define XML_SOCKLEN_T unsigned int
#endif
#include <libxml/globals.h>
#include <libxml/xmlerror.h>
#include <libxml/xmlmemory.h>
......@@ -103,6 +103,7 @@
#define closesocket(s) close(s)
#endif
#define SOCKET int
#define INVALID_SOCKET (-1)
#endif
#ifdef __BEOS__
......@@ -114,9 +115,6 @@
#ifndef XML_SOCKLEN_T
#define XML_SOCKLEN_T unsigned int
#endif
#ifndef SOCKET
#define SOCKET int
#endif
#ifdef STANDALONE
#define DEBUG_HTTP
......@@ -196,10 +194,10 @@ static int socket_errno(void) {
#ifdef SUPPORT_IP6
static
int have_ipv6(void) {
int s;
SOCKET s;
s = socket (AF_INET6, SOCK_STREAM, 0);
if (s != -1) {
if (s != INVALID_SOCKET) {
close (s);
return (1);
}
......@@ -393,7 +391,7 @@ xmlNanoHTTPNewCtxt(const char *URL) {
memset(ret, 0, sizeof(xmlNanoHTTPCtxt));
ret->port = 80;
ret->returnValue = 0;
ret->fd = -1;
ret->fd = INVALID_SOCKET;
ret->ContentLength = -1;
xmlNanoHTTPScanURL(ret, URL);
......@@ -430,8 +428,8 @@ xmlNanoHTTPFreeCtxt(xmlNanoHTTPCtxtPtr ctxt) {
#endif
ctxt->state = XML_NANO_HTTP_NONE;
if (ctxt->fd >= 0) closesocket(ctxt->fd);
ctxt->fd = -1;
if (ctxt->fd != INVALID_SOCKET) closesocket(ctxt->fd);
ctxt->fd = INVALID_SOCKET;
xmlFree(ctxt);
}
......@@ -842,7 +840,7 @@ xmlNanoHTTPScanAnswer(xmlNanoHTTPCtxtPtr ctxt, const char *line) {
* Returns -1 in case of failure, the file descriptor number otherwise
*/
static int
static SOCKET
xmlNanoHTTPConnectAttempt(struct sockaddr *addr)
{
#ifndef HAVE_POLL_H
......@@ -870,12 +868,12 @@ xmlNanoHTTPConnectAttempt(struct sockaddr *addr)
s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
addrlen = sizeof(struct sockaddr_in);
}
if (s == -1) {
if (s == INVALID_SOCKET) {
#ifdef DEBUG_HTTP
perror("socket");
#endif
__xmlIOErr(XML_FROM_HTTP, 0, "socket failed\n");
return (-1);
return INVALID_SOCKET;
}
#ifdef _WINSOCKAPI_
{
......@@ -916,7 +914,7 @@ xmlNanoHTTPConnectAttempt(struct sockaddr *addr)
#endif
__xmlIOErr(XML_FROM_HTTP, 0, "error setting non-blocking IO\n");
closesocket(s);
return (-1);
return INVALID_SOCKET;
}
#endif /* !__BEOS__ */
#endif /* !VMS */
......@@ -931,7 +929,7 @@ xmlNanoHTTPConnectAttempt(struct sockaddr *addr)
__xmlIOErr(XML_FROM_HTTP, 0,
"error connecting to HTTP server");
closesocket(s);
return (-1);
return INVALID_SOCKET;
}
}
#ifndef HAVE_POLL_H
......@@ -944,7 +942,7 @@ xmlNanoHTTPConnectAttempt(struct sockaddr *addr)
#endif
#ifndef _WINSOCKAPI_
if (s > FD_SETSIZE)
return -1;
return INVALID_SOCKET;
#endif
FD_ZERO(&wfd);
FD_SET(s, &wfd);
......@@ -972,12 +970,12 @@ xmlNanoHTTPConnectAttempt(struct sockaddr *addr)
/* Time out */
__xmlIOErr(XML_FROM_HTTP, 0, "Connect attempt timed out");
closesocket(s);
return (-1);
return INVALID_SOCKET;
case -1:
/* Ermm.. ?? */
__xmlIOErr(XML_FROM_HTTP, 0, "Connect failed");
closesocket(s);
return (-1);
return INVALID_SOCKET;
}
#ifndef HAVE_POLL_H
......@@ -998,7 +996,7 @@ xmlNanoHTTPConnectAttempt(struct sockaddr *addr)
0) {
/* Solaris error code */
__xmlIOErr(XML_FROM_HTTP, 0, "getsockopt failed\n");
return (-1);
return INVALID_SOCKET;
}
#endif
if (status) {
......@@ -1006,13 +1004,13 @@ xmlNanoHTTPConnectAttempt(struct sockaddr *addr)
"Error connecting to remote host");
closesocket(s);
errno = status;
return (-1);
return INVALID_SOCKET;
}
} else {
/* pbm */
__xmlIOErr(XML_FROM_HTTP, 0, "select failed\n");
closesocket(s);
return (-1);
return INVALID_SOCKET;
}
return (s);
......@@ -1029,7 +1027,7 @@ xmlNanoHTTPConnectAttempt(struct sockaddr *addr)
* Returns -1 in case of failure, the file descriptor number otherwise
*/
static int
static SOCKET
xmlNanoHTTPConnectHost(const char *host, int port)
{
struct hostent *h;
......@@ -1042,7 +1040,7 @@ xmlNanoHTTPConnectHost(const char *host, int port)
struct sockaddr_in6 sockin6;
#endif
int i;
int s;
SOCKET s;
memset (&sockin, 0, sizeof(sockin));
#ifdef SUPPORT_IP6
......@@ -1073,7 +1071,7 @@ xmlNanoHTTPConnectHost(const char *host, int port)
status = getaddrinfo (host, NULL, &hints, &result);
if (status) {
__xmlIOErr(XML_FROM_HTTP, 0, "getaddrinfo failed\n");
return (-1);
return INVALID_SOCKET;
}
for (res = result; res; res = res->ai_next) {
......@@ -1081,7 +1079,7 @@ xmlNanoHTTPConnectHost(const char *host, int port)
if (res->ai_addrlen > sizeof(sockin)) {
__xmlIOErr(XML_FROM_HTTP, 0, "address size mismatch\n");
freeaddrinfo (result);
return (-1);
return INVALID_SOCKET;
}
memcpy (&sockin, res->ai_addr, res->ai_addrlen);
sockin.sin_port = htons (port);
......@@ -1091,7 +1089,7 @@ xmlNanoHTTPConnectHost(const char *host, int port)
if (res->ai_addrlen > sizeof(sockin6)) {
__xmlIOErr(XML_FROM_HTTP, 0, "address size mismatch\n");
freeaddrinfo (result);
return (-1);
return INVALID_SOCKET;
}
memcpy (&sockin6, res->ai_addr, res->ai_addrlen);
sockin6.sin6_port = htons (port);
......@@ -1101,7 +1099,7 @@ xmlNanoHTTPConnectHost(const char *host, int port)
continue; /* for */
s = xmlNanoHTTPConnectAttempt (addr);
if (s != -1) {
if (s != INVALID_SOCKET) {
freeaddrinfo (result);
return (s);
}
......@@ -1155,7 +1153,7 @@ xmlNanoHTTPConnectHost(const char *host, int port)
#else
__xmlIOErr(XML_FROM_HTTP, 0, "Failed to resolve host");
#endif
return (-1);
return INVALID_SOCKET;
}
for (i = 0; h->h_addr_list[i]; i++) {
......@@ -1163,7 +1161,7 @@ xmlNanoHTTPConnectHost(const char *host, int port)
/* A records (IPv4) */
if ((unsigned int) h->h_length > sizeof(ia)) {
__xmlIOErr(XML_FROM_HTTP, 0, "address size mismatch\n");
return (-1);
return INVALID_SOCKET;
}
memcpy (&ia, h->h_addr_list[i], h->h_length);
sockin.sin_family = h->h_addrtype;
......@@ -1175,7 +1173,7 @@ xmlNanoHTTPConnectHost(const char *host, int port)
/* AAAA records (IPv6) */
if ((unsigned int) h->h_length > sizeof(ia6)) {
__xmlIOErr(XML_FROM_HTTP, 0, "address size mismatch\n");
return (-1);
return INVALID_SOCKET;
}
memcpy (&ia6, h->h_addr_list[i], h->h_length);
sockin6.sin6_family = h->h_addrtype;
......@@ -1187,7 +1185,7 @@ xmlNanoHTTPConnectHost(const char *host, int port)
break; /* for */
s = xmlNanoHTTPConnectAttempt (addr);
if (s != -1)
if (s != INVALID_SOCKET)
return (s);
}
}
......@@ -1198,7 +1196,7 @@ xmlNanoHTTPConnectHost(const char *host, int port)
"xmlNanoHTTPConnectHost: unable to connect to '%s'.\n",
host);
#endif
return (-1);
return INVALID_SOCKET;
}
......@@ -1342,7 +1340,8 @@ xmlNanoHTTPMethodRedir(const char *URL, const char *method, const char *input,
const char *headers, int ilen ) {
xmlNanoHTTPCtxtPtr ctxt;
char *bp, *p;
int blen, ret;
int blen;
SOCKET ret;
int nbRedirects = 0;
char *redirURL = NULL;
#ifdef DEBUG_HTTP
......@@ -1386,7 +1385,7 @@ retry:
blen = strlen(ctxt->hostname);
ret = xmlNanoHTTPConnectHost(ctxt->hostname, ctxt->port);
}
if (ret < 0) {
if (ret == INVALID_SOCKET) {
xmlNanoHTTPFreeCtxt(ctxt);
if (redirURL != NULL) xmlFree(redirURL);
return(NULL);
......
......@@ -11639,32 +11639,8 @@ static int
test_xmlNanoFTPGetConnection(void) {
int test_ret = 0;
#if defined(LIBXML_FTP_ENABLED)
int mem_base;
int ret_val;
void * ctx; /* an FTP context */
int n_ctx;
for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
mem_base = xmlMemBlocks();
ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
ret_val = xmlNanoFTPGetConnection(ctx);
desret_int(ret_val);
call_tests++;
des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
xmlResetLastError();
if (mem_base != xmlMemBlocks()) {
printf("Leak of %d blocks found in xmlNanoFTPGetConnection",
xmlMemBlocks() - mem_base);
test_ret++;
printf(" %d", n_ctx);
printf("\n");
}
}
function_tests++;
#endif
/* missing type support */
return(test_ret);
}
......@@ -11707,39 +11683,8 @@ static int
test_xmlNanoFTPGetSocket(void) {
int test_ret = 0;
#if defined(LIBXML_FTP_ENABLED)
int mem_base;
int ret_val;
void * ctx; /* an FTP context */
int n_ctx;
const char * filename; /* the file to retrieve (or NULL if path is in context). */
int n_filename;
for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
mem_base = xmlMemBlocks();
ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
filename = gen_filepath(n_filename, 1);
ret_val = xmlNanoFTPGetSocket(ctx, filename);
desret_int(ret_val);
call_tests++;
des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);