Sophie

Sophie

distrib > Fedora > 14 > x86_64 > by-pkgid > 964aecd60fac62d5dc5479d22a0c53ef > files > 401

libmusicbrainz3-devel-3.0.3-2.fc14.x86_64.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>libmusicbrainz3: webservice.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.7.1 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul class="tablist">
      <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<h1>webservice.h</h1>  </div>
</div>
<div class="contents">
<a href="webservice_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> * MusicBrainz -- The Internet music metadatabase</span>
<a name="l00003"></a>00003 <span class="comment"> *</span>
<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2006 Lukas Lalinsky</span>
<a name="l00005"></a>00005 <span class="comment"> *  </span>
<a name="l00006"></a>00006 <span class="comment"> * This library is free software; you can redistribute it and/or</span>
<a name="l00007"></a>00007 <span class="comment"> * modify it under the terms of the GNU Lesser General Public</span>
<a name="l00008"></a>00008 <span class="comment"> * License as published by the Free Software Foundation; either</span>
<a name="l00009"></a>00009 <span class="comment"> * version 2.1 of the License, or (at your option) any later version.</span>
<a name="l00010"></a>00010 <span class="comment"> * </span>
<a name="l00011"></a>00011 <span class="comment"> * This library is distributed in the hope that it will be useful,</span>
<a name="l00012"></a>00012 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00013"></a>00013 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU</span>
<a name="l00014"></a>00014 <span class="comment"> * Lesser General Public License for more details.</span>
<a name="l00015"></a>00015 <span class="comment"> * </span>
<a name="l00016"></a>00016 <span class="comment"> * You should have received a copy of the GNU Lesser General Public</span>
<a name="l00017"></a>00017 <span class="comment"> * License along with this library; if not, write to the Free Software</span>
<a name="l00018"></a>00018 <span class="comment"> * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA</span>
<a name="l00019"></a>00019 <span class="comment"> *</span>
<a name="l00020"></a>00020 <span class="comment"> * </span>
<a name="l00021"></a>00021 <span class="comment"> */</span>
<a name="l00022"></a>00022  
<a name="l00023"></a>00023 <span class="preprocessor">#ifndef __MUSICBRAINZ3_WEBSERVICE_H__</span>
<a name="l00024"></a>00024 <span class="preprocessor"></span><span class="preprocessor">#define __MUSICBRAINZ3_WEBSERVICE_H__</span>
<a name="l00025"></a>00025 <span class="preprocessor"></span>
<a name="l00026"></a>00026 <span class="preprocessor">#include &lt;string&gt;</span>
<a name="l00027"></a>00027 <span class="preprocessor">#include &lt;<a class="code" href="musicbrainz_8h.html">musicbrainz3/musicbrainz.h</a>&gt;</span> 
<a name="l00028"></a>00028 <span class="preprocessor">#include &lt;<a class="code" href="iwebservice_8h.html">musicbrainz3/iwebservice.h</a>&gt;</span>
<a name="l00029"></a>00029 
<a name="l00030"></a>00030 <span class="keyword">namespace </span>MusicBrainz
<a name="l00031"></a>00031 {
<a name="l00032"></a>00032   
<a name="l00039"></a><a class="code" href="class_music_brainz_1_1_web_service_error.html">00039</a>         <span class="keyword">class </span><a class="code" href="defines_8h.html#a2170aeec4b32749d5a7e15bd8474e0ec">MB_API</a> <a class="code" href="class_music_brainz_1_1_web_service_error.html" title="A web service error has occurred.">WebServiceError</a> : <span class="keyword">public</span> <a class="code" href="class_music_brainz_1_1_exception.html">Exception</a>
<a name="l00040"></a>00040         {
<a name="l00041"></a>00041         <span class="keyword">public</span>:
<a name="l00042"></a><a class="code" href="class_music_brainz_1_1_web_service_error.html#aca491bbd5d37f0798452f3e32e54f1a0">00042</a>                 <a class="code" href="class_music_brainz_1_1_web_service_error.html#aca491bbd5d37f0798452f3e32e54f1a0">WebServiceError</a>(<span class="keyword">const</span> std::string &amp;msg = std::string()) : <a class="code" href="class_music_brainz_1_1_exception.html">Exception</a>(msg) {}
<a name="l00043"></a>00043         };
<a name="l00044"></a>00044         
<a name="l00052"></a><a class="code" href="class_music_brainz_1_1_connection_error.html">00052</a>         <span class="keyword">class </span><a class="code" href="defines_8h.html#a2170aeec4b32749d5a7e15bd8474e0ec">MB_API</a> <a class="code" href="class_music_brainz_1_1_connection_error.html" title="Getting a server connection failed.">ConnectionError</a> : <span class="keyword">public</span> <a class="code" href="class_music_brainz_1_1_web_service_error.html" title="A web service error has occurred.">WebServiceError</a>
<a name="l00053"></a>00053         {
<a name="l00054"></a>00054         <span class="keyword">public</span>:
<a name="l00055"></a><a class="code" href="class_music_brainz_1_1_connection_error.html#a8c52c25b17ef342a4aa8f8e832d31da8">00055</a>                 <a class="code" href="class_music_brainz_1_1_connection_error.html#a8c52c25b17ef342a4aa8f8e832d31da8">ConnectionError</a>(<span class="keyword">const</span> std::string &amp;msg = std::string()) : <a class="code" href="class_music_brainz_1_1_web_service_error.html" title="A web service error has occurred.">WebServiceError</a>(msg) {}
<a name="l00056"></a>00056         };
<a name="l00057"></a>00057         
<a name="l00062"></a><a class="code" href="class_music_brainz_1_1_time_out_error.html">00062</a>         <span class="keyword">class </span><a class="code" href="defines_8h.html#a2170aeec4b32749d5a7e15bd8474e0ec">MB_API</a> <a class="code" href="class_music_brainz_1_1_time_out_error.html" title="Connection to a server timed out.">TimeOutError</a> : <span class="keyword">public</span> <a class="code" href="class_music_brainz_1_1_web_service_error.html" title="A web service error has occurred.">WebServiceError</a>
<a name="l00063"></a>00063         {
<a name="l00064"></a>00064         <span class="keyword">public</span>:
<a name="l00065"></a><a class="code" href="class_music_brainz_1_1_time_out_error.html#af7c5e335afe97702722c8ab6238cad0e">00065</a>                 <a class="code" href="class_music_brainz_1_1_time_out_error.html#af7c5e335afe97702722c8ab6238cad0e">TimeOutError</a>(<span class="keyword">const</span> std::string &amp;msg = std::string()) : <a class="code" href="class_music_brainz_1_1_web_service_error.html" title="A web service error has occurred.">WebServiceError</a>(msg) {}
<a name="l00066"></a>00066         };
<a name="l00067"></a>00067         
<a name="l00071"></a><a class="code" href="class_music_brainz_1_1_resource_not_found_error.html">00071</a>         <span class="keyword">class </span><a class="code" href="defines_8h.html#a2170aeec4b32749d5a7e15bd8474e0ec">MB_API</a> <a class="code" href="class_music_brainz_1_1_resource_not_found_error.html" title="No resource with the given ID exists.">ResourceNotFoundError</a> : <span class="keyword">public</span> <a class="code" href="class_music_brainz_1_1_web_service_error.html" title="A web service error has occurred.">WebServiceError</a>
<a name="l00072"></a>00072         {
<a name="l00073"></a>00073         <span class="keyword">public</span>:
<a name="l00074"></a><a class="code" href="class_music_brainz_1_1_resource_not_found_error.html#a5373a02a0c31767569995645e0777e38">00074</a>                 <a class="code" href="class_music_brainz_1_1_resource_not_found_error.html#a5373a02a0c31767569995645e0777e38">ResourceNotFoundError</a>(<span class="keyword">const</span> std::string &amp;msg = std::string()) : <a class="code" href="class_music_brainz_1_1_web_service_error.html" title="A web service error has occurred.">WebServiceError</a>(msg) {}
<a name="l00075"></a>00075         };
<a name="l00076"></a>00076         
<a name="l00083"></a><a class="code" href="class_music_brainz_1_1_authentication_error.html">00083</a>         <span class="keyword">class </span><a class="code" href="defines_8h.html#a2170aeec4b32749d5a7e15bd8474e0ec">MB_API</a> <a class="code" href="class_music_brainz_1_1_authentication_error.html" title="Authentication failed.">AuthenticationError</a> : <span class="keyword">public</span> <a class="code" href="class_music_brainz_1_1_web_service_error.html" title="A web service error has occurred.">WebServiceError</a>
<a name="l00084"></a>00084         {
<a name="l00085"></a>00085         <span class="keyword">public</span>:
<a name="l00086"></a><a class="code" href="class_music_brainz_1_1_authentication_error.html#a0e72753b7f28b088f541bab8e6a58391">00086</a>                 <a class="code" href="class_music_brainz_1_1_authentication_error.html#a0e72753b7f28b088f541bab8e6a58391">AuthenticationError</a>(<span class="keyword">const</span> std::string &amp;msg = std::string()) : <a class="code" href="class_music_brainz_1_1_web_service_error.html" title="A web service error has occurred.">WebServiceError</a>(msg) {}
<a name="l00087"></a>00087         };
<a name="l00088"></a>00088         
<a name="l00096"></a><a class="code" href="class_music_brainz_1_1_response_error.html">00096</a>         <span class="keyword">class </span><a class="code" href="defines_8h.html#a2170aeec4b32749d5a7e15bd8474e0ec">MB_API</a> <a class="code" href="class_music_brainz_1_1_response_error.html" title="The returned resource was invalid.">ResponseError</a> : <span class="keyword">public</span> <a class="code" href="class_music_brainz_1_1_web_service_error.html" title="A web service error has occurred.">WebServiceError</a>
<a name="l00097"></a>00097         {
<a name="l00098"></a>00098         <span class="keyword">public</span>:
<a name="l00099"></a><a class="code" href="class_music_brainz_1_1_response_error.html#abc797f47f943bacc2d11bbab8370391b">00099</a>                 <a class="code" href="class_music_brainz_1_1_response_error.html#abc797f47f943bacc2d11bbab8370391b">ResponseError</a>(<span class="keyword">const</span> std::string &amp;msg = std::string()) : <a class="code" href="class_music_brainz_1_1_web_service_error.html" title="A web service error has occurred.">WebServiceError</a>(msg) {}
<a name="l00100"></a>00100         };
<a name="l00101"></a>00101         
<a name="l00109"></a><a class="code" href="class_music_brainz_1_1_request_error.html">00109</a>         <span class="keyword">class </span><a class="code" href="defines_8h.html#a2170aeec4b32749d5a7e15bd8474e0ec">MB_API</a> <a class="code" href="class_music_brainz_1_1_request_error.html" title="An invalid request was made.">RequestError</a> : <span class="keyword">public</span> <a class="code" href="class_music_brainz_1_1_web_service_error.html" title="A web service error has occurred.">WebServiceError</a>
<a name="l00110"></a>00110         {
<a name="l00111"></a>00111         <span class="keyword">public</span>:
<a name="l00112"></a><a class="code" href="class_music_brainz_1_1_request_error.html#a1decfeee2b8cdda06f1e2e696a914c9f">00112</a>                 <a class="code" href="class_music_brainz_1_1_request_error.html#a1decfeee2b8cdda06f1e2e696a914c9f">RequestError</a>(<span class="keyword">const</span> std::string &amp;msg = std::string()) : <a class="code" href="class_music_brainz_1_1_web_service_error.html" title="A web service error has occurred.">WebServiceError</a>(msg) {}
<a name="l00113"></a>00113         };
<a name="l00114"></a>00114         
<a name="l00124"></a><a class="code" href="class_music_brainz_1_1_web_service.html">00124</a>         <span class="keyword">class </span><a class="code" href="defines_8h.html#a2170aeec4b32749d5a7e15bd8474e0ec">MB_API</a> <a class="code" href="class_music_brainz_1_1_web_service.html" title="An interface to the MusicBrainz XML web service via HTTP.">WebService</a> : <span class="keyword">public</span> <a class="code" href="class_music_brainz_1_1_i_web_service.html" title="An interface all concrete web service classes have to implement.">IWebService</a>
<a name="l00125"></a>00125         {
<a name="l00126"></a>00126         <span class="keyword">public</span>:
<a name="l00127"></a>00127         
<a name="l00141"></a>00141                 <a class="code" href="class_music_brainz_1_1_web_service.html" title="An interface to the MusicBrainz XML web service via HTTP.">WebService</a>(<span class="keyword">const</span> std::string &amp;host = <span class="stringliteral">&quot;musicbrainz.org&quot;</span>,
<a name="l00142"></a>00142                                    <span class="keyword">const</span> <span class="keywordtype">int</span> port = 80,
<a name="l00143"></a>00143                                    <span class="keyword">const</span> std::string &amp;pathPrefix = <span class="stringliteral">&quot;/ws&quot;</span>,
<a name="l00144"></a>00144                                    <span class="keyword">const</span> std::string &amp;username = std::string(),
<a name="l00145"></a>00145                                    <span class="keyword">const</span> std::string &amp;password = std::string(),
<a name="l00146"></a>00146                                    <span class="keyword">const</span> std::string &amp;realm = <span class="stringliteral">&quot;musicbrainz.org&quot;</span>);
<a name="l00147"></a>00147 
<a name="l00151"></a>00151                 <span class="keyword">virtual</span> ~<a class="code" href="class_music_brainz_1_1_web_service.html" title="An interface to the MusicBrainz XML web service via HTTP.">WebService</a>();
<a name="l00152"></a>00152                 
<a name="l00158"></a>00158                 <span class="keywordtype">void</span> setHost(<span class="keyword">const</span> std::string &amp;host);
<a name="l00159"></a>00159                 
<a name="l00165"></a>00165                 std::string getHost() <span class="keyword">const</span>;
<a name="l00166"></a>00166                 
<a name="l00172"></a>00172                 <span class="keywordtype">void</span> setPort(<span class="keyword">const</span> <span class="keywordtype">int</span> port);
<a name="l00173"></a>00173                 
<a name="l00179"></a>00179                 <span class="keywordtype">int</span> getPort() <span class="keyword">const</span>;
<a name="l00180"></a>00180                 
<a name="l00186"></a>00186                 <span class="keywordtype">void</span> setPathPrefix(<span class="keyword">const</span> std::string &amp;pathPrefix);
<a name="l00187"></a>00187                 
<a name="l00193"></a>00193                 std::string getPathPrefix() <span class="keyword">const</span>;
<a name="l00194"></a>00194                 
<a name="l00200"></a>00200                 <span class="keywordtype">void</span> setUserName(<span class="keyword">const</span> std::string &amp;username);
<a name="l00201"></a>00201                 
<a name="l00207"></a>00207                 std::string getUserName() <span class="keyword">const</span>;
<a name="l00208"></a>00208                 
<a name="l00214"></a>00214                 <span class="keywordtype">void</span> setPassword(<span class="keyword">const</span> std::string &amp;password);
<a name="l00215"></a>00215                 
<a name="l00221"></a>00221                 std::string getPassword() <span class="keyword">const</span>;
<a name="l00222"></a>00222                 
<a name="l00228"></a>00228                 <span class="keywordtype">void</span> setRealm(<span class="keyword">const</span> std::string &amp;realm);
<a name="l00229"></a>00229                 
<a name="l00235"></a>00235                 std::string getRealm() <span class="keyword">const</span>;
<a name="l00236"></a>00236                 
<a name="l00242"></a>00242                 <span class="keywordtype">void</span> setProxyHost(<span class="keyword">const</span> std::string &amp;host);
<a name="l00243"></a>00243                 
<a name="l00249"></a>00249                 std::string getProxyHost() <span class="keyword">const</span>;
<a name="l00250"></a>00250                 
<a name="l00256"></a>00256                 <span class="keywordtype">void</span> setProxyPort(<span class="keyword">const</span> <span class="keywordtype">int</span> port);
<a name="l00257"></a>00257                 
<a name="l00263"></a>00263                 <span class="keywordtype">int</span> getProxyPort() <span class="keyword">const</span>;
<a name="l00264"></a>00264                 
<a name="l00270"></a>00270                 <span class="keywordtype">void</span> setProxyUserName(<span class="keyword">const</span> std::string &amp;username);
<a name="l00271"></a>00271                 
<a name="l00277"></a>00277                 std::string getProxyUserName() <span class="keyword">const</span>;
<a name="l00278"></a>00278                 
<a name="l00284"></a>00284                 <span class="keywordtype">void</span> setProxyPassword(<span class="keyword">const</span> std::string &amp;password);
<a name="l00285"></a>00285                 
<a name="l00291"></a>00291                 std::string getProxyPassword() <span class="keyword">const</span>;
<a name="l00292"></a>00292                 
<a name="l00308"></a>00308                 std::string <span class="keyword">get</span>(<span class="keyword">const</span> std::string &amp;entity,
<a name="l00309"></a>00309                                                 <span class="keyword">const</span> std::string &amp;id,
<a name="l00310"></a>00310                                                 <span class="keyword">const</span> <a class="code" href="class_music_brainz_1_1_i_includes.html#afecd9a28c3be5892ec4ce11bcb4fd66e">IIncludes::IncludeList</a> &amp;include,
<a name="l00311"></a>00311                                                 <span class="keyword">const</span> <a class="code" href="class_music_brainz_1_1_i_filter.html#aaba1f8574aef404c9df93d340f10d611">IFilter::ParameterList</a> &amp;filter,
<a name="l00312"></a>00312                                                 <span class="keyword">const</span> std::string &amp;version = <span class="stringliteral">&quot;1&quot;</span>); 
<a name="l00313"></a>00313 
<a name="l00328"></a>00328                  <span class="keywordtype">void</span> post(<span class="keyword">const</span> std::string &amp;entity,
<a name="l00329"></a>00329                                    <span class="keyword">const</span> std::string &amp;<span class="keywordtype">id</span>,
<a name="l00330"></a>00330                                    <span class="keyword">const</span> std::string &amp;data,
<a name="l00331"></a>00331                                    <span class="keyword">const</span> std::string &amp;version = <span class="stringliteral">&quot;1&quot;</span>);
<a name="l00332"></a>00332                 
<a name="l00333"></a>00333         <span class="keyword">private</span>:
<a name="l00334"></a>00334         
<a name="l00335"></a>00335                 <span class="keyword">static</span> <span class="keywordtype">int</span> httpAuth(<span class="keywordtype">void</span> *userdata, <span class="keyword">const</span> <span class="keywordtype">char</span> *realm, <span class="keywordtype">int</span> attempts,
<a name="l00336"></a>00336                                                         <span class="keywordtype">char</span> *username, <span class="keywordtype">char</span> *password);
<a name="l00337"></a>00337                 <span class="keyword">static</span> <span class="keywordtype">int</span> proxyAuth(<span class="keywordtype">void</span> *userdata, <span class="keyword">const</span> <span class="keywordtype">char</span> *realm, <span class="keywordtype">int</span> attempts,
<a name="l00338"></a>00338                                                         <span class="keywordtype">char</span> *username, <span class="keywordtype">char</span> *password);
<a name="l00339"></a>00339                 <span class="keyword">static</span> <span class="keywordtype">int</span> httpResponseReader(<span class="keywordtype">void</span> *userdata, <span class="keyword">const</span> <span class="keywordtype">char</span> *buf, <span class="keywordtype">size_t</span> len);
<a name="l00340"></a>00340 
<a name="l00341"></a>00341                 <span class="keyword">class </span>WebServicePrivate;
<a name="l00342"></a>00342                 WebServicePrivate *d;
<a name="l00343"></a>00343         };
<a name="l00344"></a>00344         
<a name="l00345"></a>00345 }
<a name="l00346"></a>00346 
<a name="l00347"></a>00347 <span class="preprocessor">#endif</span>
</pre></div></div>
</div>
<hr class="footer"/><address class="footer"><small>Generated by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.1 </small></address>
</body>
</html>