<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>libcddb: cddb_net.h File Reference</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.3.9.1 --> <div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="globals.html">File Members</a></div> <div class="nav"> <a class="el" href="dir_000000.html">include</a> / <a class="el" href="dir_000001.html">cddb</a></div> <h1>cddb_net.h File Reference</h1><code>#include <stdarg.h></code><br> <code>#include <cddb/cddb_ni.h></code><br> <code>#include <cddb/cddb_config.h></code><br> <p> <a href="cddb__net_8h-source.html">Go to the source code of this file.</a><table border="0" cellpadding="0" cellspacing="0"> <tr><td></td></tr> <tr><td colspan="2"><br><h2>Defines</h2></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="cddb__net_8h.html#a0">CDDB_NET_H</a> 1</td></tr> <tr><td colspan="2"><br><h2>Functions</h2></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">char * </td><td class="memItemRight" valign="bottom"><a class="el" href="cddb__net_8h.html#a1">sock_fgets</a> (char *s, int size, <a class="el" href="cddb__conn_8h.html#a2">cddb_conn_t</a> *c)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">This function performs the same task as the standard fgets except for the fact that it might time-out if the socket read takes too long. <a href="#a1"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="cddb__net_8h.html#a2">sock_fwrite</a> (const void *ptr, size_t size, size_t nmemb, <a class="el" href="cddb__conn_8h.html#a2">cddb_conn_t</a> *c)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">This function performs the same task as the standard fwrite except for the fact that it might time-out if the socket write takes too long. <a href="#a2"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="cddb__net_8h.html#a3">sock_fprintf</a> (<a class="el" href="cddb__conn_8h.html#a2">cddb_conn_t</a> *c, const char *format,...)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">This function performs the same task as the standard fprintf except for the fact that it might time-out if the socket write takes too long. <a href="#a3"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="cddb__net_8h.html#a4">sock_vfprintf</a> (<a class="el" href="cddb__conn_8h.html#a2">cddb_conn_t</a> *c, const char *format, va_list ap)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">This function performs the same task as the standard vfprintf except for the fact that it might time-out if the socket write takes too long. <a href="#a4"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">hostent * </td><td class="memItemRight" valign="bottom"><a class="el" href="cddb__net_8h.html#a5">timeout_gethostbyname</a> (const char *hostname, int timeout)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">This function performs the same task as the standard gethostbyname except for the fact that it might time-out if the query takes too long. <a href="#a5"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="cddb__net_8h.html#a6">timeout_connect</a> (int sockfd, const struct sockaddr *addr, size_t len, int timeout)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">This function performs the same task as the standard connect except for the fact that it might time-out if the connect takes too long. <a href="#a6"></a><br></td></tr> </table> <hr><h2>Define Documentation</h2> <a class="anchor" name="a0" doxytag="cddb_net.h::CDDB_NET_H"></a><p> <table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top">#define CDDB_NET_H 1 </td> </tr> </table> </td> </tr> </table> <table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td> <p> </td> </tr> </table> <hr><h2>Function Documentation</h2> <a class="anchor" name="a1" doxytag="cddb_net.h::sock_fgets"></a><p> <table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top">char* sock_fgets </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">char * </td> <td class="mdname" nowrap> <em>s</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td class="md"></td> <td class="md" nowrap>int </td> <td class="mdname" nowrap> <em>size</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td class="md"></td> <td class="md" nowrap><a class="el" href="cddb__conn_8h.html#a2">cddb_conn_t</a> * </td> <td class="mdname" nowrap> <em>c</em></td> </tr> <tr> <td class="md"></td> <td class="md">) </td> <td class="md" colspan="2"></td> </tr> </table> </td> </tr> </table> <table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td> <p> This function performs the same task as the standard fgets except for the fact that it might time-out if the socket read takes too long. <p> In case of a time out, errno will be set to ETIMEDOUT.<p> <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>s</em> </td><td>The string buffer. </td></tr> <tr><td valign="top"></td><td valign="top"><em>size</em> </td><td>Size of the buffer. </td></tr> <tr><td valign="top"></td><td valign="top"><em>c</em> </td><td>The CDDB connection structure. </td></tr> </table> </dl> <dl compact><dt><b>Returns:</b></dt><dd>The string that was read or NULL on error or EOF when no characters were read. </dd></dl> </td> </tr> </table> <a class="anchor" name="a3" doxytag="cddb_net.h::sock_fprintf"></a><p> <table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top">int sock_fprintf </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="cddb__conn_8h.html#a2">cddb_conn_t</a> * </td> <td class="mdname" nowrap> <em>c</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td class="md"></td> <td class="md" nowrap>const char * </td> <td class="mdname" nowrap> <em>format</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td class="md"></td> <td class="md" nowrap> </td> <td class="mdname" nowrap> <em>...</em></td> </tr> <tr> <td class="md"></td> <td class="md">) </td> <td class="md" colspan="2"></td> </tr> </table> </td> </tr> </table> <table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td> <p> This function performs the same task as the standard fprintf except for the fact that it might time-out if the socket write takes too long. <p> In case of a time out, errno will be set to ETIMEDOUT.<p> <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>c</em> </td><td>The CDDB connection structure. </td></tr> <tr><td valign="top"></td><td valign="top"><em>format</em> </td><td>Pointer to data record. </td></tr> </table> </dl> <dl compact><dt><b>Returns:</b></dt><dd>The number of characters written. </dd></dl> </td> </tr> </table> <a class="anchor" name="a2" doxytag="cddb_net.h::sock_fwrite"></a><p> <table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top">size_t sock_fwrite </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">const void * </td> <td class="mdname" nowrap> <em>ptr</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td class="md"></td> <td class="md" nowrap>size_t </td> <td class="mdname" nowrap> <em>size</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td class="md"></td> <td class="md" nowrap>size_t </td> <td class="mdname" nowrap> <em>nmemb</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td class="md"></td> <td class="md" nowrap><a class="el" href="cddb__conn_8h.html#a2">cddb_conn_t</a> * </td> <td class="mdname" nowrap> <em>c</em></td> </tr> <tr> <td class="md"></td> <td class="md">) </td> <td class="md" colspan="2"></td> </tr> </table> </td> </tr> </table> <table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td> <p> This function performs the same task as the standard fwrite except for the fact that it might time-out if the socket write takes too long. <p> In case of a time out, errno will be set to ETIMEDOUT.<p> <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>ptr</em> </td><td>Pointer to data record. </td></tr> <tr><td valign="top"></td><td valign="top"><em>size</em> </td><td>Size of data record. </td></tr> <tr><td valign="top"></td><td valign="top"><em>nmemb</em> </td><td>The number of data records to write. </td></tr> <tr><td valign="top"></td><td valign="top"><em>c</em> </td><td>The CDDB connection structure. </td></tr> </table> </dl> <dl compact><dt><b>Returns:</b></dt><dd>The number of records written. </dd></dl> </td> </tr> </table> <a class="anchor" name="a4" doxytag="cddb_net.h::sock_vfprintf"></a><p> <table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top">int sock_vfprintf </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="cddb__conn_8h.html#a2">cddb_conn_t</a> * </td> <td class="mdname" nowrap> <em>c</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td class="md"></td> <td class="md" nowrap>const char * </td> <td class="mdname" nowrap> <em>format</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td class="md"></td> <td class="md" nowrap>va_list </td> <td class="mdname" nowrap> <em>ap</em></td> </tr> <tr> <td class="md"></td> <td class="md">) </td> <td class="md" colspan="2"></td> </tr> </table> </td> </tr> </table> <table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td> <p> This function performs the same task as the standard vfprintf except for the fact that it might time-out if the socket write takes too long. <p> In case of a time out, errno will be set to ETIMEDOUT.<p> <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>c</em> </td><td>The CDDB connection structure. </td></tr> <tr><td valign="top"></td><td valign="top"><em>format</em> </td><td>Pointer to data record. </td></tr> <tr><td valign="top"></td><td valign="top"><em>ap</em> </td><td>Variable argument list. </td></tr> </table> </dl> <dl compact><dt><b>Returns:</b></dt><dd>The number of characters written. </dd></dl> </td> </tr> </table> <a class="anchor" name="a6" doxytag="cddb_net.h::timeout_connect"></a><p> <table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top">int timeout_connect </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">int </td> <td class="mdname" nowrap> <em>sockfd</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td class="md"></td> <td class="md" nowrap>const struct sockaddr * </td> <td class="mdname" nowrap> <em>addr</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td class="md"></td> <td class="md" nowrap>size_t </td> <td class="mdname" nowrap> <em>len</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td class="md"></td> <td class="md" nowrap>int </td> <td class="mdname" nowrap> <em>timeout</em></td> </tr> <tr> <td class="md"></td> <td class="md">) </td> <td class="md" colspan="2"></td> </tr> </table> </td> </tr> </table> <table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td> <p> This function performs the same task as the standard connect except for the fact that it might time-out if the connect takes too long. <p> In case of a time out, errno will be set to ETIMEDOUT.<p> <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>sockfd</em> </td><td>The socket. </td></tr> <tr><td valign="top"></td><td valign="top"><em>addr</em> </td><td>The address to connect to. </td></tr> <tr><td valign="top"></td><td valign="top"><em>len</em> </td><td>The size of the address structure. </td></tr> <tr><td valign="top"></td><td valign="top"><em>timeout</em> </td><td>Number of seconds after which to time out. </td></tr> </table> </dl> <dl compact><dt><b>Returns:</b></dt><dd>Zero on success, -1 on failure (errno will be set). </dd></dl> </td> </tr> </table> <a class="anchor" name="a5" doxytag="cddb_net.h::timeout_gethostbyname"></a><p> <table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top">struct hostent* timeout_gethostbyname </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">const char * </td> <td class="mdname" nowrap> <em>hostname</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td class="md"></td> <td class="md" nowrap>int </td> <td class="mdname" nowrap> <em>timeout</em></td> </tr> <tr> <td class="md"></td> <td class="md">) </td> <td class="md" colspan="2"></td> </tr> </table> </td> </tr> </table> <table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td> <p> This function performs the same task as the standard gethostbyname except for the fact that it might time-out if the query takes too long. <p> In case of a time out, errno will be set to ETIMEDOUT.<p> <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>hostname</em> </td><td>The hostname that needs to be resolved. </td></tr> <tr><td valign="top"></td><td valign="top"><em>timeout</em> </td><td>Number of seconds after which to time out. </td></tr> </table> </dl> <dl compact><dt><b>Returns:</b></dt><dd>The host entity for given host name or NULL if not found or timed out (errno will be set). </dd></dl> </td> </tr> </table> <hr size="1"><address style="align: right;"><small>Generated on Sat Jul 9 11:18:31 2005 for libcddb by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.3.9.1 </small></address> </body> </html>