Files
metasploit-gs/api/Rex/IO/GramServer.html
T
jenkins-metasploit c3f5bd3de2 Reboot gh-pages
2026-05-08 17:08:43 +00:00

735 lines
17 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
Module: Rex::IO::GramServer
&mdash; Documentation by YARD 0.9.37
</title>
<link rel="stylesheet" href="../../css/style.css" type="text/css" />
<link rel="stylesheet" href="../../css/common.css" type="text/css" />
<script type="text/javascript">
pathId = "Rex::IO::GramServer";
relpath = '../../';
</script>
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
</head>
<body>
<div class="nav_wrap">
<iframe id="nav" src="../../class_list.html?1"></iframe>
<div id="resizer"></div>
</div>
<div id="main" tabindex="-1">
<div id="header">
<div id="menu">
<a href="../../_index.html">Index (G)</a> &raquo;
<span class='title'><span class='object_link'><a href="../../Rex.html" title="Rex (module)">Rex</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../IO.html" title="Rex::IO (module)">IO</a></span></span>
&raquo;
<span class="title">GramServer</span>
</div>
<div id="search">
<a class="full_list_link" id="class_list_link"
href="../../class_list.html">
<svg width="24" height="24">
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
</svg>
</a>
</div>
<div class="clear"></div>
</div>
<div id="content"><h1>Module: Rex::IO::GramServer
</h1>
<div class="box_info">
<dl>
<dt>Included in:</dt>
<dd><span class='object_link'><a href="../Proto/DNS/Server.html" title="Rex::Proto::DNS::Server (class)">Proto::DNS::Server</a></span>, <span class='object_link'><a href="../Proto/LDAP/Server.html" title="Rex::Proto::LDAP::Server (class)">Proto::LDAP::Server</a></span></dd>
</dl>
<dl>
<dt>Defined in:</dt>
<dd>lib/rex/io/gram_server.rb</dd>
</dl>
</div>
<h2>Overview</h2><div class="docstring">
<div class="discussion">
<p>This mixin provides the framework and interface for implementing a datagram server that can handle incoming datagrams. Datagram servers include this mixin</p>
</div>
</div>
<div class="tags">
</div>
<h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
<ul class="summary">
<li class="public ">
<span class="summary_signature">
<a href="#dispatch_request_proc-instance_method" title="#dispatch_request_proc (instance method)">#<strong>dispatch_request_proc</strong> &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>This callback procedure can be set and will be called when clients have data to be processed.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#listener_thread-instance_method" title="#listener_thread (instance method)">#<strong>listener_thread</strong> &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>:nodoc:.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#send_response_proc-instance_method" title="#send_response_proc (instance method)">#<strong>send_response_proc</strong> &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>This callback procedure can be set and will be called when clients have data to be processed.</p>
</div></span>
</li>
</ul>
<h2>
Instance Method Summary
<small><a href="#" class="summary_toggle">collapse</a></small>
</h2>
<ul class="summary">
<li class="public ">
<span class="summary_signature">
<a href="#dispatch_request-instance_method" title="#dispatch_request (instance method)">#<strong>dispatch_request</strong>(client, data) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>This callback is notified when a client connection has data that needs to be processed.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#send_response-instance_method" title="#send_response (instance method)">#<strong>send_response</strong>(client, data) &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>This callback is notified when data must be returned to the client.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#start-instance_method" title="#start (instance method)">#<strong>start</strong> &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Start monitoring the listener socket for connections and keep track of all client connections.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#stop-instance_method" title="#stop (instance method)">#<strong>stop</strong> &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>Terminates the listener monitoring threads and closes all active clients.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#wait-instance_method" title="#wait (instance method)">#<strong>wait</strong> &#x21d2; Object </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>This method waits on the server listener thread.</p>
</div></span>
</li>
</ul>
<div id="instance_attr_details" class="attr_details">
<h2>Instance Attribute Details</h2>
<span id="dispatch_request_proc=-instance_method"></span>
<div class="method_details first">
<h3 class="signature first" id="dispatch_request_proc-instance_method">
#<strong>dispatch_request_proc</strong> &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>This callback procedure can be set and will be called when clients have data to be processed.</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
85
86
87</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/rex/io/gram_server.rb', line 85</span>
<span class='kw'>def</span> <span class='id identifier rubyid_dispatch_request_proc'>dispatch_request_proc</span>
<span class='ivar'>@dispatch_request_proc</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<span id="listener_thread=-instance_method"></span>
<div class="method_details ">
<h3 class="signature " id="listener_thread-instance_method">
#<strong>listener_thread</strong> &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>:nodoc:</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
87
88
89</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/rex/io/gram_server.rb', line 87</span>
<span class='kw'>def</span> <span class='id identifier rubyid_listener_thread'>listener_thread</span>
<span class='ivar'>@listener_thread</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<span id="send_response_proc=-instance_method"></span>
<div class="method_details ">
<h3 class="signature " id="send_response_proc-instance_method">
#<strong>send_response_proc</strong> &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>This callback procedure can be set and will be called when clients have data to be processed.</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
85
86
87</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/rex/io/gram_server.rb', line 85</span>
<span class='kw'>def</span> <span class='id identifier rubyid_send_response_proc'>send_response_proc</span>
<span class='ivar'>@send_response_proc</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
<div id="instance_method_details" class="method_details_list">
<h2>Instance Method Details</h2>
<div class="method_details first">
<h3 class="signature first" id="dispatch_request-instance_method">
#<strong>dispatch_request</strong>(client, data) &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>This callback is notified when a client connection has data that needs to be processed.</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
33
34
35
36
37</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/rex/io/gram_server.rb', line 33</span>
<span class='kw'>def</span> <span class='id identifier rubyid_dispatch_request'>dispatch_request</span><span class='lparen'>(</span><span class='id identifier rubyid_client'>client</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span>
<span class='kw'>if</span> <span class='lparen'>(</span><span class='id identifier rubyid_dispatch_request_proc'>dispatch_request_proc</span><span class='rparen'>)</span>
<span class='id identifier rubyid_dispatch_request_proc'>dispatch_request_proc</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_client'>client</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="send_response-instance_method">
#<strong>send_response</strong>(client, data) &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>This callback is notified when data must be returned to the client</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>client</span>
<span class='type'>(<tt>Socket</tt>)</span>
&mdash;
<div class='inline'>
<p>Client/Socket to receive data</p>
</div>
</li>
<li>
<span class='name'>data</span>
<span class='type'>(<tt>String</tt>)</span>
&mdash;
<div class='inline'>
<p>Data to be sent to client/socket</p>
</div>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
43
44
45
46
47
48
49</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/rex/io/gram_server.rb', line 43</span>
<span class='kw'>def</span> <span class='id identifier rubyid_send_response'>send_response</span><span class='lparen'>(</span><span class='id identifier rubyid_client'>client</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span>
<span class='kw'>if</span> <span class='lparen'>(</span><span class='id identifier rubyid_send_response_proc'>send_response_proc</span><span class='rparen'>)</span>
<span class='id identifier rubyid_send_response_proc'>send_response_proc</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_client'>client</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span>
<span class='kw'>else</span>
<span class='id identifier rubyid_client'>client</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="start-instance_method">
#<strong>start</strong> &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Start monitoring the listener socket for connections and keep track of all client connections.</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
55
56
57
58
59</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/rex/io/gram_server.rb', line 55</span>
<span class='kw'>def</span> <span class='id identifier rubyid_start'>start</span>
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_listener_thread'>listener_thread</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../../Rex.html" title="Rex (module)">Rex</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../ThreadFactory.html" title="Rex::ThreadFactory (class)">ThreadFactory</a></span></span><span class='period'>.</span><span class='id identifier rubyid_spawn'><span class='object_link'><a href="../ThreadFactory.html#spawn-class_method" title="Rex::ThreadFactory.spawn (method)">spawn</a></span></span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>GramServerListener</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='kw'>false</span><span class='rparen'>)</span> <span class='lbrace'>{</span>
<span class='id identifier rubyid_monitor_listener'>monitor_listener</span>
<span class='rbrace'>}</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="stop-instance_method">
#<strong>stop</strong> &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>Terminates the listener monitoring threads and closes all active clients.</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
64
65
66</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/rex/io/gram_server.rb', line 64</span>
<span class='kw'>def</span> <span class='id identifier rubyid_stop'>stop</span>
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_listener_thread'>listener_thread</span><span class='period'>.</span><span class='id identifier rubyid_kill'>kill</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="wait-instance_method">
#<strong>wait</strong> &#x21d2; <tt>Object</tt>
</h3><div class="docstring">
<div class="discussion">
<p>This method waits on the server listener thread</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
71
72
73</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/rex/io/gram_server.rb', line 71</span>
<span class='kw'>def</span> <span class='id identifier rubyid_wait'>wait</span>
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_listener_thread'>listener_thread</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span> <span class='kw'>if</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_listener_thread'>listener_thread</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="footer">
Generated on Fri May 8 17:03:09 2026 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.37 (ruby-3.1.5).
</div>
</div>
</body>
</html>