blob: b5c1c0d869d751ed2af6bc8dc70125888b4f9c80 [file] [log] [blame]
<!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"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>libguac: guacamole/parser.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">libguac
&#160;<span id="projectnumber">1.1.0</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_6bb9fad85c98b48a11165f494b9f53ce.html">guacamole</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">parser.h</div> </div>
</div><!--header-->
<div class="contents">
<a href="parser_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span>&#160;<span class="comment">/*</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span>&#160;<span class="comment"> * Licensed to the Apache Software Foundation (ASF) under one</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span>&#160;<span class="comment"> * or more contributor license agreements. See the NOTICE file</span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span>&#160;<span class="comment"> * distributed with this work for additional information</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span>&#160;<span class="comment"> * regarding copyright ownership. The ASF licenses this file</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span>&#160;<span class="comment"> * to you under the Apache License, Version 2.0 (the</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span>&#160;<span class="comment"> * &quot;License&quot;); you may not use this file except in compliance</span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span>&#160;<span class="comment"> * with the License. You may obtain a copy of the License at</span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span>&#160;<span class="comment"> *</span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span>&#160;<span class="comment"> * http://www.apache.org/licenses/LICENSE-2.0</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span>&#160;<span class="comment"> *</span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span>&#160;<span class="comment"> * Unless required by applicable law or agreed to in writing,</span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span>&#160;<span class="comment"> * software distributed under the License is distributed on an</span></div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span>&#160;<span class="comment"> * &quot;AS IS&quot; BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY</span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span>&#160;<span class="comment"> * KIND, either express or implied. See the License for the</span></div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span>&#160;<span class="comment"> * specific language governing permissions and limitations</span></div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span>&#160;<span class="comment"> * under the License.</span></div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span>&#160;<span class="comment"> */</span></div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span>&#160;</div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span>&#160;</div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160;<span class="preprocessor">#ifndef _GUAC_PARSER_H</span></div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span>&#160;<span class="preprocessor">#define _GUAC_PARSER_H</span></div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span>&#160;</div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="parser-types_8h.html">parser-types.h</a>&quot;</span></div><div class="line"><a name="l00031"></a><span class="lineno"> 31</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="parser-constants_8h.html">parser-constants.h</a>&quot;</span></div><div class="line"><a name="l00032"></a><span class="lineno"> 32</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="socket-types_8h.html">socket-types.h</a>&quot;</span></div><div class="line"><a name="l00033"></a><span class="lineno"> 33</span>&#160;</div><div class="line"><a name="l00034"></a><span class="lineno"><a class="line" href="structguac__parser.html"> 34</a></span>&#160;<span class="keyword">struct </span><a class="code" href="structguac__parser.html">guac_parser</a> {</div><div class="line"><a name="l00035"></a><span class="lineno"> 35</span>&#160;</div><div class="line"><a name="l00039"></a><span class="lineno"><a class="line" href="structguac__parser.html#a725767c57dc6f157afe2d7dd6ce281e1"> 39</a></span>&#160; <span class="keywordtype">char</span>* <a class="code" href="structguac__parser.html#a725767c57dc6f157afe2d7dd6ce281e1">opcode</a>;</div><div class="line"><a name="l00040"></a><span class="lineno"> 40</span>&#160;</div><div class="line"><a name="l00044"></a><span class="lineno"><a class="line" href="structguac__parser.html#a718ce9e60c8414c367ce393cc4e0cffe"> 44</a></span>&#160; <span class="keywordtype">int</span> <a class="code" href="structguac__parser.html#a718ce9e60c8414c367ce393cc4e0cffe">argc</a>;</div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span>&#160;</div><div class="line"><a name="l00049"></a><span class="lineno"><a class="line" href="structguac__parser.html#a9bd5362b9de8cf2adfcdff2c86bb4701"> 49</a></span>&#160; <span class="keywordtype">char</span>** <a class="code" href="structguac__parser.html#a9bd5362b9de8cf2adfcdff2c86bb4701">argv</a>;</div><div class="line"><a name="l00050"></a><span class="lineno"> 50</span>&#160;</div><div class="line"><a name="l00054"></a><span class="lineno"><a class="line" href="structguac__parser.html#a2773500f91b3cdb7de7bdea280228054"> 54</a></span>&#160; <a class="code" href="parser-types_8h.html#a842bb8c1d5569ebebae3fdadb2527f30">guac_parse_state</a> <a class="code" href="structguac__parser.html#a2773500f91b3cdb7de7bdea280228054">state</a>;</div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span>&#160;</div><div class="line"><a name="l00059"></a><span class="lineno"> 59</span>&#160; <span class="keywordtype">int</span> __element_length;</div><div class="line"><a name="l00060"></a><span class="lineno"> 60</span>&#160;</div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span>&#160; <span class="keywordtype">int</span> __elementc;</div><div class="line"><a name="l00065"></a><span class="lineno"> 65</span>&#160;</div><div class="line"><a name="l00069"></a><span class="lineno"> 69</span>&#160; <span class="keywordtype">char</span>* __elementv[<a class="code" href="parser-constants_8h.html#a6f314dc5700812ca93ff132a15b86a46">GUAC_INSTRUCTION_MAX_ELEMENTS</a>];</div><div class="line"><a name="l00070"></a><span class="lineno"> 70</span>&#160;</div><div class="line"><a name="l00075"></a><span class="lineno"> 75</span>&#160; <span class="keywordtype">char</span>* __instructionbuf_unparsed_start;</div><div class="line"><a name="l00076"></a><span class="lineno"> 76</span>&#160;</div><div class="line"><a name="l00080"></a><span class="lineno"> 80</span>&#160; <span class="keywordtype">char</span>* __instructionbuf_unparsed_end;</div><div class="line"><a name="l00081"></a><span class="lineno"> 81</span>&#160;</div><div class="line"><a name="l00087"></a><span class="lineno"> 87</span>&#160; <span class="keywordtype">char</span> __instructionbuf[32768];</div><div class="line"><a name="l00088"></a><span class="lineno"> 88</span>&#160;</div><div class="line"><a name="l00089"></a><span class="lineno"> 89</span>&#160;};</div><div class="line"><a name="l00090"></a><span class="lineno"> 90</span>&#160;</div><div class="line"><a name="l00097"></a><span class="lineno"> 97</span>&#160;<a class="code" href="structguac__parser.html">guac_parser</a>* <a class="code" href="parser_8h.html#a69dc498eb4d71d353bff07b88ec21cad">guac_parser_alloc</a>();</div><div class="line"><a name="l00098"></a><span class="lineno"> 98</span>&#160;</div><div class="line"><a name="l00113"></a><span class="lineno"> 113</span>&#160;<span class="keywordtype">int</span> <a class="code" href="parser_8h.html#ab1ca22b7bf9c232cce0d122f03dc183d">guac_parser_append</a>(<a class="code" href="structguac__parser.html">guac_parser</a>* parser, <span class="keywordtype">void</span>* buffer, <span class="keywordtype">int</span> length);</div><div class="line"><a name="l00114"></a><span class="lineno"> 114</span>&#160;</div><div class="line"><a name="l00122"></a><span class="lineno"> 122</span>&#160;<span class="keywordtype">int</span> <a class="code" href="parser_8h.html#a8899dd607997fcffd78517947b17760b">guac_parser_length</a>(<a class="code" href="structguac__parser.html">guac_parser</a>* parser);</div><div class="line"><a name="l00123"></a><span class="lineno"> 123</span>&#160;</div><div class="line"><a name="l00133"></a><span class="lineno"> 133</span>&#160;<span class="keywordtype">int</span> <a class="code" href="parser_8h.html#a56e7b2a85abdb6cb4ec4bd6e47a92ed3">guac_parser_shift</a>(<a class="code" href="structguac__parser.html">guac_parser</a>* parser, <span class="keywordtype">void</span>* buffer, <span class="keywordtype">int</span> length);</div><div class="line"><a name="l00134"></a><span class="lineno"> 134</span>&#160;</div><div class="line"><a name="l00140"></a><span class="lineno"> 140</span>&#160;<span class="keywordtype">void</span> <a class="code" href="parser_8h.html#ad3b7d4df1ca25c5bced1c08b329f0a0f">guac_parser_free</a>(<a class="code" href="structguac__parser.html">guac_parser</a>* parser);</div><div class="line"><a name="l00141"></a><span class="lineno"> 141</span>&#160;</div><div class="line"><a name="l00163"></a><span class="lineno"> 163</span>&#160;<span class="keywordtype">int</span> <a class="code" href="parser_8h.html#a8a1169f5040732e4f4b55ee6c1e1fe93">guac_parser_read</a>(<a class="code" href="structguac__parser.html">guac_parser</a>* parser, <a class="code" href="structguac__socket.html">guac_socket</a>* socket, <span class="keywordtype">int</span> usec_timeout);</div><div class="line"><a name="l00164"></a><span class="lineno"> 164</span>&#160;</div><div class="line"><a name="l00186"></a><span class="lineno"> 186</span>&#160;<span class="keywordtype">int</span> <a class="code" href="parser_8h.html#ac54c94465aead463ce10e9a090b9b701">guac_parser_expect</a>(<a class="code" href="structguac__parser.html">guac_parser</a>* parser, <a class="code" href="structguac__socket.html">guac_socket</a>* socket, <span class="keywordtype">int</span> usec_timeout, <span class="keyword">const</span> <span class="keywordtype">char</span>* opcode);</div><div class="line"><a name="l00187"></a><span class="lineno"> 187</span>&#160;</div><div class="line"><a name="l00188"></a><span class="lineno"> 188</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00189"></a><span class="lineno"> 189</span>&#160;</div><div class="ttc" id="structguac__parser_html_a9bd5362b9de8cf2adfcdff2c86bb4701"><div class="ttname"><a href="structguac__parser.html#a9bd5362b9de8cf2adfcdff2c86bb4701">guac_parser::argv</a></div><div class="ttdeci">char ** argv</div><div class="ttdoc">Array of all arguments passed to this instruction. </div><div class="ttdef"><b>Definition:</b> parser.h:49</div></div>
<div class="ttc" id="parser_8h_html_a69dc498eb4d71d353bff07b88ec21cad"><div class="ttname"><a href="parser_8h.html#a69dc498eb4d71d353bff07b88ec21cad">guac_parser_alloc</a></div><div class="ttdeci">guac_parser * guac_parser_alloc()</div><div class="ttdoc">Allocates a new parser. </div></div>
<div class="ttc" id="parser_8h_html_a8a1169f5040732e4f4b55ee6c1e1fe93"><div class="ttname"><a href="parser_8h.html#a8a1169f5040732e4f4b55ee6c1e1fe93">guac_parser_read</a></div><div class="ttdeci">int guac_parser_read(guac_parser *parser, guac_socket *socket, int usec_timeout)</div><div class="ttdoc">Reads a single instruction from the given guac_socket connection. </div></div>
<div class="ttc" id="parser_8h_html_ac54c94465aead463ce10e9a090b9b701"><div class="ttname"><a href="parser_8h.html#ac54c94465aead463ce10e9a090b9b701">guac_parser_expect</a></div><div class="ttdeci">int guac_parser_expect(guac_parser *parser, guac_socket *socket, int usec_timeout, const char *opcode)</div><div class="ttdoc">Reads a single instruction from the given guac_socket. </div></div>
<div class="ttc" id="socket-types_8h_html"><div class="ttname"><a href="socket-types_8h.html">socket-types.h</a></div><div class="ttdoc">Type definitions related to the guac_socket object. </div></div>
<div class="ttc" id="parser_8h_html_ab1ca22b7bf9c232cce0d122f03dc183d"><div class="ttname"><a href="parser_8h.html#ab1ca22b7bf9c232cce0d122f03dc183d">guac_parser_append</a></div><div class="ttdeci">int guac_parser_append(guac_parser *parser, void *buffer, int length)</div><div class="ttdoc">Appends data from the given buffer to the given parser. </div></div>
<div class="ttc" id="structguac__socket_html"><div class="ttname"><a href="structguac__socket.html">guac_socket</a></div><div class="ttdoc">The core I/O object of Guacamole. </div><div class="ttdef"><b>Definition:</b> socket.h:39</div></div>
<div class="ttc" id="parser-types_8h_html"><div class="ttname"><a href="parser-types_8h.html">parser-types.h</a></div><div class="ttdoc">Type definitions related to parsing the Guacamole protocol. </div></div>
<div class="ttc" id="parser_8h_html_a8899dd607997fcffd78517947b17760b"><div class="ttname"><a href="parser_8h.html#a8899dd607997fcffd78517947b17760b">guac_parser_length</a></div><div class="ttdeci">int guac_parser_length(guac_parser *parser)</div><div class="ttdoc">Returns the number of unparsed bytes stored in the given parser&amp;#39;s internal buffers. </div></div>
<div class="ttc" id="parser_8h_html_ad3b7d4df1ca25c5bced1c08b329f0a0f"><div class="ttname"><a href="parser_8h.html#ad3b7d4df1ca25c5bced1c08b329f0a0f">guac_parser_free</a></div><div class="ttdeci">void guac_parser_free(guac_parser *parser)</div><div class="ttdoc">Frees all memory allocated to the given parser. </div></div>
<div class="ttc" id="structguac__parser_html_a725767c57dc6f157afe2d7dd6ce281e1"><div class="ttname"><a href="structguac__parser.html#a725767c57dc6f157afe2d7dd6ce281e1">guac_parser::opcode</a></div><div class="ttdeci">char * opcode</div><div class="ttdoc">The opcode of the instruction. </div><div class="ttdef"><b>Definition:</b> parser.h:39</div></div>
<div class="ttc" id="parser-types_8h_html_a842bb8c1d5569ebebae3fdadb2527f30"><div class="ttname"><a href="parser-types_8h.html#a842bb8c1d5569ebebae3fdadb2527f30">guac_parse_state</a></div><div class="ttdeci">guac_parse_state</div><div class="ttdoc">All possible states of the instruction parser. </div><div class="ttdef"><b>Definition:</b> parser-types.h:33</div></div>
<div class="ttc" id="structguac__parser_html_a2773500f91b3cdb7de7bdea280228054"><div class="ttname"><a href="structguac__parser.html#a2773500f91b3cdb7de7bdea280228054">guac_parser::state</a></div><div class="ttdeci">guac_parse_state state</div><div class="ttdoc">The parse state of the instruction. </div><div class="ttdef"><b>Definition:</b> parser.h:54</div></div>
<div class="ttc" id="structguac__parser_html_a718ce9e60c8414c367ce393cc4e0cffe"><div class="ttname"><a href="structguac__parser.html#a718ce9e60c8414c367ce393cc4e0cffe">guac_parser::argc</a></div><div class="ttdeci">int argc</div><div class="ttdoc">The number of arguments passed to this instruction. </div><div class="ttdef"><b>Definition:</b> parser.h:44</div></div>
<div class="ttc" id="parser_8h_html_a56e7b2a85abdb6cb4ec4bd6e47a92ed3"><div class="ttname"><a href="parser_8h.html#a56e7b2a85abdb6cb4ec4bd6e47a92ed3">guac_parser_shift</a></div><div class="ttdeci">int guac_parser_shift(guac_parser *parser, void *buffer, int length)</div><div class="ttdoc">Removes up to length bytes from internal buffer of unparsed bytes, storing them in the given buffer...</div></div>
<div class="ttc" id="parser-constants_8h_html_a6f314dc5700812ca93ff132a15b86a46"><div class="ttname"><a href="parser-constants_8h.html#a6f314dc5700812ca93ff132a15b86a46">GUAC_INSTRUCTION_MAX_ELEMENTS</a></div><div class="ttdeci">#define GUAC_INSTRUCTION_MAX_ELEMENTS</div><div class="ttdoc">The maximum number of elements per instruction, including the opcode. </div><div class="ttdef"><b>Definition:</b> parser-constants.h:42</div></div>
<div class="ttc" id="structguac__parser_html"><div class="ttname"><a href="structguac__parser.html">guac_parser</a></div><div class="ttdoc">A Guacamole protocol parser, which reads individual instructions, filling its own internal structure ...</div><div class="ttdef"><b>Definition:</b> parser.h:34</div></div>
<div class="ttc" id="parser-constants_8h_html"><div class="ttname"><a href="parser-constants_8h.html">parser-constants.h</a></div><div class="ttdoc">Constants related to the Guacamole protocol parser. </div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.14
</small></address>
</body>
</html>