<!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>Vidalia: ControlSocket Class Reference</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.6.3 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li class="current"><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> <li><a href="dirs.html"><span>Directories</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="annotated.html"><span>Class List</span></a></li> <li><a href="classes.html"><span>Class Index</span></a></li> <li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li> <li><a href="functions.html"><span>Class Members</span></a></li> </ul> </div> </div> <div class="contents"> <h1>ControlSocket Class Reference</h1><!-- doxytag: class="ControlSocket" --> <p><code>#include <<a class="el" href="_control_socket_8h_source.html">ControlSocket.h</a>></code></p> <p><a href="class_control_socket-members.html">List of all members.</a></p> <table border="0" cellpadding="0" cellspacing="0"> <tr><td colspan="2"><h2>Public Member Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="class_control_socket.html#acd8a2d5cce14340fcc5defbedf38b59e">ControlSocket</a> ()</td></tr> <tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="class_control_socket.html#ad1a17ebeffc64f0a8478592ce0e98cfd">sendCommand</a> (<a class="el" href="class_control_command.html">ControlCommand</a> cmd, QString *errmsg=0)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="class_control_socket.html#a6a41a10e7cd0f5e21c33e78ba4d20cc4">readReply</a> (<a class="el" href="class_control_reply.html">ControlReply</a> &reply, QString *errmsg=0)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="class_control_socket.html#add0d8b44456f6b98ac52a3ccb642e4f2">isConnected</a> ()</td></tr> <tr><td colspan="2"><h2>Static Public Member Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">static QString </td><td class="memItemRight" valign="bottom"><a class="el" href="class_control_socket.html#a34ebf2e5e3314a619cca291c69b7f7e1">toString</a> (const QAbstractSocket::SocketError error)</td></tr> <tr><td colspan="2"><h2>Protected Member Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="class_control_socket.html#a2ade78e22e613147c0d9dc550aeb84a5">customEvent</a> (QEvent *event)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="class_control_socket.html#a43db321f9e81061f319dc224b6eb96d6">readLineData</a> (QString &line, QString *errmsg=0)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="class_control_socket.html#a0d7db4048387b2ef9c2d85e504a02825">readLine</a> (QString &line, QString *errmsg=0)</td></tr> </table> <hr/><a name="_details"></a><h2>Detailed Description</h2> <p>Definition at line <a class="el" href="_control_socket_8h_source.html#l00026">26</a> of file <a class="el" href="_control_socket_8h_source.html">ControlSocket.h</a>.</p> <hr/><h2>Constructor & Destructor Documentation</h2> <a class="anchor" id="acd8a2d5cce14340fcc5defbedf38b59e"></a><!-- doxytag: member="ControlSocket::ControlSocket" ref="acd8a2d5cce14340fcc5defbedf38b59e" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">ControlSocket::ControlSocket </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Default constructor. </p> <p>Definition at line <a class="el" href="_control_socket_8cpp_source.html#l00029">29</a> of file <a class="el" href="_control_socket_8cpp_source.html">ControlSocket.cpp</a>.</p> </div> </div> <hr/><h2>Member Function Documentation</h2> <a class="anchor" id="a2ade78e22e613147c0d9dc550aeb84a5"></a><!-- doxytag: member="ControlSocket::customEvent" ref="a2ade78e22e613147c0d9dc550aeb84a5" args="(QEvent *event)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void ControlSocket::customEvent </td> <td>(</td> <td class="paramtype">QEvent * </td> <td class="paramname"> <em>event</em></td> <td> ) </td> <td><code> [protected]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Processes custom events sent to this object (e.g. SendCommandEvents) from other threads. </p> <p>Definition at line <a class="el" href="_control_socket_8cpp_source.html#l00044">44</a> of file <a class="el" href="_control_socket_8cpp_source.html">ControlSocket.cpp</a>.</p> <p>References <a class="el" href="_send_command_event_8h_source.html#l00052">SendCommandEvent::command()</a>, <a class="el" href="_control_socket_8cpp_source.html#l00067">sendCommand()</a>, and <a class="el" href="_send_command_event_8h_source.html#l00054">SendCommandEvent::waiter()</a>.</p> </div> </div> <a class="anchor" id="add0d8b44456f6b98ac52a3ccb642e4f2"></a><!-- doxytag: member="ControlSocket::isConnected" ref="add0d8b44456f6b98ac52a3ccb642e4f2" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">bool ControlSocket::isConnected </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Returns true if the control socket is connected and ready to send or receive. </p> <p>Definition at line <a class="el" href="_control_socket_8cpp_source.html#l00036">36</a> of file <a class="el" href="_control_socket_8cpp_source.html">ControlSocket.cpp</a>.</p> <p>Referenced by <a class="el" href="_control_socket_8cpp_source.html#l00110">readLine()</a>, <a class="el" href="_control_socket_8cpp_source.html#l00138">readReply()</a>, <a class="el" href="_control_connection_8cpp_source.html#l00236">ControlConnection::send()</a>, and <a class="el" href="_control_socket_8cpp_source.html#l00067">sendCommand()</a>.</p> </div> </div> <a class="anchor" id="a0d7db4048387b2ef9c2d85e504a02825"></a><!-- doxytag: member="ControlSocket::readLine" ref="a0d7db4048387b2ef9c2d85e504a02825" args="(QString &line, QString *errmsg=0)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">bool ControlSocket::readLine </td> <td>(</td> <td class="paramtype">QString & </td> <td class="paramname"> <em>line</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">QString * </td> <td class="paramname"> <em>errmsg</em> = <code>0</code></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td><code> [protected]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Reads a line of data from the socket (blocking)</p> <p>Reads a line of data from the socket and returns true if successful or false if an error occurred while waiting for a line of data to become available. </p> <p>Definition at line <a class="el" href="_control_socket_8cpp_source.html#l00110">110</a> of file <a class="el" href="_control_socket_8cpp_source.html">ControlSocket.cpp</a>.</p> <p>References <a class="el" href="stringutil_8cpp_source.html#l00038">err()</a>, <a class="el" href="_control_socket_8cpp_source.html#l00036">isConnected()</a>, <a class="el" href="_control_socket_8cpp_source.html#l00025">READ_TIMEOUT</a>, and <a class="el" href="_control_socket_8cpp_source.html#l00089">readLineData()</a>.</p> <p>Referenced by <a class="el" href="_control_socket_8cpp_source.html#l00089">readLineData()</a>, and <a class="el" href="_control_socket_8cpp_source.html#l00138">readReply()</a>.</p> </div> </div> <a class="anchor" id="a43db321f9e81061f319dc224b6eb96d6"></a><!-- doxytag: member="ControlSocket::readLineData" ref="a43db321f9e81061f319dc224b6eb96d6" args="(QString &line, QString *errmsg=0)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">bool ControlSocket::readLineData </td> <td>(</td> <td class="paramtype">QString & </td> <td class="paramname"> <em>line</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">QString * </td> <td class="paramname"> <em>errmsg</em> = <code>0</code></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td><code> [protected]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Reads line data off the socket in chunks.</p> <p>Reads line data, one chunk at a time, until a newline character is encountered. </p> <p>Definition at line <a class="el" href="_control_socket_8cpp_source.html#l00089">89</a> of file <a class="el" href="_control_socket_8cpp_source.html">ControlSocket.cpp</a>.</p> <p>References <a class="el" href="stringutil_8cpp_source.html#l00038">err()</a>, and <a class="el" href="_control_socket_8cpp_source.html#l00110">readLine()</a>.</p> <p>Referenced by <a class="el" href="_control_socket_8cpp_source.html#l00110">readLine()</a>.</p> </div> </div> <a class="anchor" id="a6a41a10e7cd0f5e21c33e78ba4d20cc4"></a><!-- doxytag: member="ControlSocket::readReply" ref="a6a41a10e7cd0f5e21c33e78ba4d20cc4" args="(ControlReply &reply, QString *errmsg=0)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">bool ControlSocket::readReply </td> <td>(</td> <td class="paramtype"><a class="el" href="class_control_reply.html">ControlReply</a> & </td> <td class="paramname"> <em>reply</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">QString * </td> <td class="paramname"> <em>errmsg</em> = <code>0</code></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Read a response from Tor</p> <p>Read a complete reply from the control socket. Replies take the following form, based on Tor's Control Protocol v1:</p> <p>Reply = *(MidReplyLine / DataReplyLine) EndReplyLine</p> <p>MidReplyLine = "-" <a class="el" href="class_reply_line.html">ReplyLine</a> DataReplyLine = "+" <a class="el" href="class_reply_line.html">ReplyLine</a> Data EndReplyLine = SP <a class="el" href="class_reply_line.html">ReplyLine</a> <a class="el" href="class_reply_line.html">ReplyLine</a> = StatusCode [ SP ReplyText ] CRLF ReplyText = XXXX StatusCode = XXiX </p> <p>Definition at line <a class="el" href="_control_socket_8cpp_source.html#l00138">138</a> of file <a class="el" href="_control_socket_8cpp_source.html">ControlSocket.cpp</a>.</p> <p>References <a class="el" href="_control_reply_8cpp_source.html#l00027">ControlReply::appendLine()</a>, <a class="el" href="stringutil_8cpp_source.html#l00038">err()</a>, <a class="el" href="_control_socket_8cpp_source.html#l00036">isConnected()</a>, and <a class="el" href="_control_socket_8cpp_source.html#l00110">readLine()</a>.</p> <p>Referenced by <a class="el" href="_control_connection_8cpp_source.html#l00251">ControlConnection::onReadyRead()</a>.</p> </div> </div> <a class="anchor" id="ad1a17ebeffc64f0a8478592ce0e98cfd"></a><!-- doxytag: member="ControlSocket::sendCommand" ref="ad1a17ebeffc64f0a8478592ce0e98cfd" args="(ControlCommand cmd, QString *errmsg=0)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">bool ControlSocket::sendCommand </td> <td>(</td> <td class="paramtype"><a class="el" href="class_control_command.html">ControlCommand</a> </td> <td class="paramname"> <em>cmd</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">QString * </td> <td class="paramname"> <em>errmsg</em> = <code>0</code></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Send a command to Tor</p> <p>Send a control command to Tor on the control socket, conforming to Tor's Control Protocol V1:</p> <p>Command = Keyword Arguments CRLF / "+" Keyword Arguments CRLF Data Keyword = 1*ALPHA Arguments = *(SP / VCHAR) </p> <p>Definition at line <a class="el" href="_control_socket_8cpp_source.html#l00067">67</a> of file <a class="el" href="_control_socket_8cpp_source.html">ControlSocket.cpp</a>.</p> <p>References <a class="el" href="namespacetc.html#aee5c749751dca91b96d6d024b1c4a076">tc::debug()</a>, <a class="el" href="stringutil_8cpp_source.html#l00038">err()</a>, <a class="el" href="_control_socket_8cpp_source.html#l00036">isConnected()</a>, and <a class="el" href="_control_command_8cpp_source.html#l00100">ControlCommand::toString()</a>.</p> <p>Referenced by <a class="el" href="_control_socket_8cpp_source.html#l00044">customEvent()</a>.</p> </div> </div> <a class="anchor" id="a34ebf2e5e3314a619cca291c69b7f7e1"></a><!-- doxytag: member="ControlSocket::toString" ref="a34ebf2e5e3314a619cca291c69b7f7e1" args="(const QAbstractSocket::SocketError error)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">QString ControlSocket::toString </td> <td>(</td> <td class="paramtype">const QAbstractSocket::SocketError </td> <td class="paramname"> <em>error</em></td> <td> ) </td> <td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Returns the string description of <b>error</b>. </p> <p>Definition at line <a class="el" href="_control_socket_8cpp_source.html#l00187">187</a> of file <a class="el" href="_control_socket_8cpp_source.html">ControlSocket.cpp</a>.</p> <p>Referenced by <a class="el" href="_control_connection_8cpp_source.html#l00118">ControlConnection::onError()</a>.</p> </div> </div> <hr/>The documentation for this class was generated from the following files:<ul> <li><a class="el" href="_control_socket_8h_source.html">ControlSocket.h</a></li> <li><a class="el" href="_control_socket_8cpp_source.html">ControlSocket.cpp</a></li> </ul> </div> <hr class="footer"/><address style="text-align: right;"><small>Generated on Mon Aug 30 22:58:56 2010 for Vidalia by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address> </body> </html>