<!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>GNU libmicrohttpd: src/daemon/reason_phrase.c 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 Page</span></a></li> <li><a href="../../annotated.html"><span>Data Structures</span></a></li> <li class="current"><a href="../../files.html"><span>Files</span></a></li> <li><a href="../../dirs.html"><span>Directories</span></a></li> </ul> </div> <div class="tabs2"> <ul class="tablist"> <li><a href="../../files.html"><span>File List</span></a></li> <li><a href="../../globals.html"><span>Globals</span></a></li> </ul> </div> <div class="navpath"> <ul> <li><a class="el" href="../../dir_6321990a7c24e6229efad5095602bf4d.html">src</a> </li> <li><a class="el" href="../../dir_db71c89daadcbe4e293122b147fd6eef.html">daemon</a> </li> </ul> </div> </div> <div class="header"> <div class="headertitle"> <h1>reason_phrase.c</h1> </div> </div> <div class="contents"> <a href="../../dc/df0/reason__phrase_8c.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"> This file is part of libmicrohttpd</span> <a name="l00003"></a>00003 <span class="comment"> (C) 2007 Lymba</span> <a name="l00004"></a>00004 <span class="comment"></span> <a name="l00005"></a>00005 <span class="comment"> This library is free software; you can redistribute it and/or</span> <a name="l00006"></a>00006 <span class="comment"> modify it under the terms of the GNU Lesser General Public</span> <a name="l00007"></a>00007 <span class="comment"> License as published by the Free Software Foundation; either</span> <a name="l00008"></a>00008 <span class="comment"> version 2.1 of the License, or (at your option) any later version.</span> <a name="l00009"></a>00009 <span class="comment"></span> <a name="l00010"></a>00010 <span class="comment"> This library is distributed in the hope that it will be useful,</span> <a name="l00011"></a>00011 <span class="comment"> but WITHOUT ANY WARRANTY; without even the implied warranty of</span> <a name="l00012"></a>00012 <span class="comment"> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span> <a name="l00013"></a>00013 <span class="comment"> Lesser General Public License for more details.</span> <a name="l00014"></a>00014 <span class="comment"></span> <a name="l00015"></a>00015 <span class="comment"> You should have received a copy of the GNU Lesser General Public</span> <a name="l00016"></a>00016 <span class="comment"> License along with this library; if not, write to the Free Software</span> <a name="l00017"></a>00017 <span class="comment"> Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA</span> <a name="l00018"></a>00018 <span class="comment"></span> <a name="l00019"></a>00019 <span class="comment">*/</span> <a name="l00020"></a>00020 <a name="l00028"></a>00028 <span class="preprocessor">#include "<a class="code" href="../../de/d1b/reason__phrase_8h.html">reason_phrase.h</a>"</span> <a name="l00029"></a>00029 <a name="l00030"></a>00030 <span class="preprocessor">#ifndef NULL</span> <a name="l00031"></a><a class="code" href="../../dc/df0/reason__phrase_8c.html#a070d2ce7b6bb7e5c05602aa8c308d0c4">00031</a> <span class="preprocessor"></span><span class="preprocessor">#define NULL (void*)0</span> <a name="l00032"></a>00032 <span class="preprocessor"></span><span class="preprocessor">#endif // !NULL</span> <a name="l00033"></a>00033 <span class="preprocessor"></span> <a name="l00034"></a><a class="code" href="../../dc/df0/reason__phrase_8c.html#a761446d4ae9f00516141943ff1d6349f">00034</a> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="../../dc/df0/reason__phrase_8c.html#a761446d4ae9f00516141943ff1d6349f">invalid_hundred</a>[] = { <a class="code" href="../../dc/df0/reason__phrase_8c.html#a070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a> }; <a name="l00035"></a>00035 <a name="l00036"></a><a class="code" href="../../dc/df0/reason__phrase_8c.html#a7822f5e013e48db41ac1f4a319466dab">00036</a> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="../../dc/df0/reason__phrase_8c.html#a7822f5e013e48db41ac1f4a319466dab">one_hundred</a>[] = { <a name="l00037"></a>00037 <span class="stringliteral">"Continue"</span>, <a name="l00038"></a>00038 <span class="stringliteral">"Switching Protocols"</span>, <a name="l00039"></a>00039 <span class="stringliteral">"Processing"</span> <a name="l00040"></a>00040 }; <a name="l00041"></a>00041 <a name="l00042"></a><a class="code" href="../../dc/df0/reason__phrase_8c.html#a5b391b9312084a79afeeb73e6387f6f1">00042</a> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="../../dc/df0/reason__phrase_8c.html#a5b391b9312084a79afeeb73e6387f6f1">two_hundred</a>[] = { <a name="l00043"></a>00043 <span class="stringliteral">"OK"</span>, <a name="l00044"></a>00044 <span class="stringliteral">"Created"</span>, <a name="l00045"></a>00045 <span class="stringliteral">"Accepted"</span>, <a name="l00046"></a>00046 <span class="stringliteral">"Non-Authoritative Information"</span>, <a name="l00047"></a>00047 <span class="stringliteral">"No Content"</span>, <a name="l00048"></a>00048 <span class="stringliteral">"Reset Content"</span>, <a name="l00049"></a>00049 <span class="stringliteral">"Partial Content"</span>, <a name="l00050"></a>00050 <span class="stringliteral">"Multi Status"</span> <a name="l00051"></a>00051 }; <a name="l00052"></a>00052 <a name="l00053"></a><a class="code" href="../../dc/df0/reason__phrase_8c.html#ab1734884605a250b3ea7e6161107fd40">00053</a> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="../../dc/df0/reason__phrase_8c.html#ab1734884605a250b3ea7e6161107fd40">three_hundred</a>[] = { <a name="l00054"></a>00054 <span class="stringliteral">"Multiple Choices"</span>, <a name="l00055"></a>00055 <span class="stringliteral">"Moved Permanently"</span>, <a name="l00056"></a>00056 <span class="stringliteral">"Moved Temporarily"</span>, <a name="l00057"></a>00057 <span class="stringliteral">"See Other"</span>, <a name="l00058"></a>00058 <span class="stringliteral">"Not Modified"</span>, <a name="l00059"></a>00059 <span class="stringliteral">"Use Proxy"</span>, <a name="l00060"></a>00060 <span class="stringliteral">"Switch Proxy"</span>, <a name="l00061"></a>00061 <span class="stringliteral">"Temporary Redirect"</span> <a name="l00062"></a>00062 }; <a name="l00063"></a>00063 <a name="l00064"></a><a class="code" href="../../dc/df0/reason__phrase_8c.html#ac2724302cdadb7f3de5f6e1e4b807805">00064</a> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="../../dc/df0/reason__phrase_8c.html#ac2724302cdadb7f3de5f6e1e4b807805">four_hundred</a>[] = { <a name="l00065"></a>00065 <span class="stringliteral">"Bad Request"</span>, <a name="l00066"></a>00066 <span class="stringliteral">"Unauthorized"</span>, <a name="l00067"></a>00067 <span class="stringliteral">"Payment Required"</span>, <a name="l00068"></a>00068 <span class="stringliteral">"Forbidden"</span>, <a name="l00069"></a>00069 <span class="stringliteral">"Not Found"</span>, <a name="l00070"></a>00070 <span class="stringliteral">"Method Not Allowed"</span>, <a name="l00071"></a>00071 <span class="stringliteral">"Not Acceptable"</span>, <a name="l00072"></a>00072 <span class="stringliteral">"Proxy Authentication Required"</span>, <a name="l00073"></a>00073 <span class="stringliteral">"Request Time-out"</span>, <a name="l00074"></a>00074 <span class="stringliteral">"Conflict"</span>, <a name="l00075"></a>00075 <span class="stringliteral">"Gone"</span>, <a name="l00076"></a>00076 <span class="stringliteral">"Length Required"</span>, <a name="l00077"></a>00077 <span class="stringliteral">"Precondition Failed"</span>, <a name="l00078"></a>00078 <span class="stringliteral">"Request Entity Too Large"</span>, <a name="l00079"></a>00079 <span class="stringliteral">"Request-URI Too Large"</span>, <a name="l00080"></a>00080 <span class="stringliteral">"Unsupported Media Type"</span>, <a name="l00081"></a>00081 <span class="stringliteral">"Requested Range Not Satisfiable"</span>, <a name="l00082"></a>00082 <span class="stringliteral">"Expectation Failed"</span>, <a name="l00083"></a>00083 <span class="stringliteral">"Unprocessable Entity"</span>, <a name="l00084"></a>00084 <span class="stringliteral">"Locked"</span>, <a name="l00085"></a>00085 <span class="stringliteral">"Failed Dependency"</span>, <a name="l00086"></a>00086 <span class="stringliteral">"Unordered Collection"</span>, <a name="l00087"></a>00087 <span class="stringliteral">"Upgrade Required"</span>, <a name="l00088"></a>00088 <span class="stringliteral">"Retry With"</span> <a name="l00089"></a>00089 }; <a name="l00090"></a>00090 <a name="l00091"></a><a class="code" href="../../dc/df0/reason__phrase_8c.html#a9c6fd5623f23219e1f80a40817ec321b">00091</a> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="../../dc/df0/reason__phrase_8c.html#a9c6fd5623f23219e1f80a40817ec321b">five_hundred</a>[] = { <a name="l00092"></a>00092 <span class="stringliteral">"Internal Server Error"</span>, <a name="l00093"></a>00093 <span class="stringliteral">"Not Implemented"</span>, <a name="l00094"></a>00094 <span class="stringliteral">"Bad Gateway"</span>, <a name="l00095"></a>00095 <span class="stringliteral">"Service Unavailable"</span>, <a name="l00096"></a>00096 <span class="stringliteral">"Gateway Time-out"</span>, <a name="l00097"></a>00097 <span class="stringliteral">"HTTP Version not supported"</span>, <a name="l00098"></a>00098 <span class="stringliteral">"Variant Also Negotiates"</span>, <a name="l00099"></a>00099 <span class="stringliteral">"Insufficient Storage"</span>, <a name="l00100"></a>00100 <span class="stringliteral">"Bandwidth Limit Exceeded"</span>, <a name="l00101"></a>00101 <span class="stringliteral">"Not Extended"</span> <a name="l00102"></a>00102 }; <a name="l00103"></a>00103 <a name="l00104"></a>00104 <a name="l00105"></a>00105 <span class="keyword">struct </span>MHD_Reason_Block <a name="l00106"></a>00106 { <a name="l00107"></a>00107 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> max; <a name="l00108"></a>00108 <span class="keyword">const</span> <span class="keywordtype">char</span> **data; <a name="l00109"></a>00109 }; <a name="l00110"></a>00110 <a name="l00111"></a><a class="code" href="../../dc/df0/reason__phrase_8c.html#a37645b10e3f56bd8fb00f5e2f49b9742">00111</a> <span class="preprocessor">#define BLOCK(m) { (sizeof(m) / sizeof(char*)), m }</span> <a name="l00112"></a>00112 <span class="preprocessor"></span> <a name="l00113"></a><a class="code" href="../../dc/df0/reason__phrase_8c.html#a245eedeabde5065939828222e8d2b7b3">00113</a> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keyword">struct </span>MHD_Reason_Block <a class="code" href="../../dc/df0/reason__phrase_8c.html#a245eedeabde5065939828222e8d2b7b3">reasons</a>[] = { <a name="l00114"></a>00114 <a class="code" href="../../dc/df0/reason__phrase_8c.html#a37645b10e3f56bd8fb00f5e2f49b9742">BLOCK</a> (<a class="code" href="../../dc/df0/reason__phrase_8c.html#a761446d4ae9f00516141943ff1d6349f">invalid_hundred</a>), <a name="l00115"></a>00115 <a class="code" href="../../dc/df0/reason__phrase_8c.html#a37645b10e3f56bd8fb00f5e2f49b9742">BLOCK</a> (<a class="code" href="../../dc/df0/reason__phrase_8c.html#a7822f5e013e48db41ac1f4a319466dab">one_hundred</a>), <a name="l00116"></a>00116 <a class="code" href="../../dc/df0/reason__phrase_8c.html#a37645b10e3f56bd8fb00f5e2f49b9742">BLOCK</a> (<a class="code" href="../../dc/df0/reason__phrase_8c.html#a5b391b9312084a79afeeb73e6387f6f1">two_hundred</a>), <a name="l00117"></a>00117 <a class="code" href="../../dc/df0/reason__phrase_8c.html#a37645b10e3f56bd8fb00f5e2f49b9742">BLOCK</a> (<a class="code" href="../../dc/df0/reason__phrase_8c.html#ab1734884605a250b3ea7e6161107fd40">three_hundred</a>), <a name="l00118"></a>00118 <a class="code" href="../../dc/df0/reason__phrase_8c.html#a37645b10e3f56bd8fb00f5e2f49b9742">BLOCK</a> (<a class="code" href="../../dc/df0/reason__phrase_8c.html#ac2724302cdadb7f3de5f6e1e4b807805">four_hundred</a>), <a name="l00119"></a>00119 <a class="code" href="../../dc/df0/reason__phrase_8c.html#a37645b10e3f56bd8fb00f5e2f49b9742">BLOCK</a> (<a class="code" href="../../dc/df0/reason__phrase_8c.html#a9c6fd5623f23219e1f80a40817ec321b">five_hundred</a>), <a name="l00120"></a>00120 }; <a name="l00121"></a>00121 <a name="l00122"></a>00122 <span class="keyword">const</span> <span class="keywordtype">char</span> * <a name="l00123"></a><a class="code" href="../../de/d1b/reason__phrase_8h.html#aa451a3c3bd307214d6fa282f425b69fa">00123</a> <a class="code" href="../../dc/df0/reason__phrase_8c.html#aa451a3c3bd307214d6fa282f425b69fa">MHD_get_reason_phrase_for</a> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> code) <a name="l00124"></a>00124 { <a name="l00125"></a>00125 <span class="keywordflow">if</span> ((code >= 100 && code < 600) && (reasons[code / 100].max > code % 100)) <a name="l00126"></a>00126 <span class="keywordflow">return</span> reasons[code / 100].data[code % 100]; <a name="l00127"></a>00127 <span class="keywordflow">return</span> <span class="stringliteral">"Unknown"</span>; <a name="l00128"></a>00128 } </pre></div></div> </div> <hr class="footer"/><address class="footer"><small>Generated on Wed Jan 26 2011 for GNU libmicrohttpd by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="../../doxygen.png" alt="doxygen"/></a> 1.7.1 </small></address> </body> </html>