Sophie

Sophie

distrib > Fedora > 14 > x86_64 > by-pkgid > 3ebaf504d69f581a8834e53e04e712a5 > files > 629

gearbox-devel-9.11-6.fc14.i686.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>GearBox Project</title>

<link rel="icon" href="gbx_icon_cardbox_sky.png" type="image/png">
<link rel="shortcut icon" href="gbx_icon_cardbox_sky.png" type="image/png">

<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
<!-- Google Analytics -->
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-3583782-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>
<!-- Returning you to your regular programming -->
</head><body>

<!-- Header -->

<table border="0" cellspacing="0" cellpadding="0">

<tr><!-- create row -->

<!-- spacer cell -->
<!-- #CC CC CC -->
<td rowspan="1" colspan="1" bgcolor="#EEEEEE">&nbsp;&nbsp;&nbsp;&nbsp;</td>

<!-- menu cell -->
<td width="170" rowspan="1" colspan="1" align="left" valign="top" bgcolor="#EEEEEE">


<p>&nbsp;</p>
<p align="center"><a href="index.html"><img src="gbx_logo_cardbox_sky_150x150.png"></a></p><br>

<strong>INTRODUCTION</strong><br>
<strong><a href="gbx_doc_overview.html" style="text-decoration:none">Overview</a></strong><br>
<strong><a href="gbx_doc_getting.html" style="text-decoration:none">Download and Install</a></strong><br>
<!-- <strong><a href="gbx_doc_quickstart.html" style="text-decoration:none">Quick Start</a></strong><br> -->
<strong><a href="gbx_doc_documentation.html" style="text-decoration:none">Documentation</a></strong><br>
<strong><a href="gbx_doc_publications.html" style="text-decoration:none">Publications</a></strong><br>
<br>

<strong>REPOSITORY</strong><br>
<strong><a href="group__gbx__libs.html" style="text-decoration:none">Libraries</a></strong><br>
<!-- <strong><a href="group__gbx__utils.html" style="text-decoration:none">Utilities</a></strong><br> -->
<br>

<strong>DEVELOPER</strong><br>

<!--<strong><a href="gbx_doc_tutorials.html" style="text-decoration:none">Tutorials</a></strong><br>
<strong><a href="group__gbx__examples.html" style="text-decoration:none">Examples</a></strong><br>-->
<strong><a href="gbx_doc_devguide.html" style="text-decoration:none">Dev Guide</a></strong><br>
<!-- 
<strong><a href="gbx_doc_faq.html" style="text-decoration:none">FAQ</a></strong><br>
-->
<strong><a href="http://cdash.acfr.usyd.edu.au/index.php?project=Gearbox" style="text-decoration:none">Dashboard</a></strong><br>
<!--<strong><a href="http://wiki2.cas.edu.au/orca">Wiki</a></strong><br>
login/pass: orca/orca<br>-->
<br>

<strong>PEOPLE</strong><br>
<strong><a href="gbx_doc_contributors.html" style="text-decoration:none">Contributors</a></strong><br>
<strong><a href="gbx_doc_users.html" style="text-decoration:none">Users</a></strong><br>
<br>

<a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=216468&amp;type=2" width="125" height="37" border="0" alt="SourceForge.net Logo" /></a><br>
<strong><a href="http://sourceforge.net/projects/gearbox">Project</a></strong><br>
<strong><a href="http://sourceforge.net/project/showfiles.php?group_id=216468">Download</a></strong><br>
<!--<strong><a href="http://sourceforge.net/tracker/?group_id=216468">Bugs/Feedback</a></strong><br>-->
<strong><a href="http://sourceforge.net/mail/?group_id=216468">Mailing lists</a></strong></p>
<p>&nbsp;</p>

</td><!-- /menu cell -->

<!-- one grey spacer cells -->
<td rowspan="1" colspan="1" bgcolor="#EEEEEE">&nbsp;&nbsp;&nbsp;&nbsp;</td>

<!-- one white spacer cells -->
<td rowspan="1" colspan="1">&nbsp;&nbsp;&nbsp;&nbsp;</td>

<!-- main content cell -->
<td rowspan="1" colspan="1" align="left" valign="top">


<!-- Generated by Doxygen 1.6.2-20100208 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</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>
      <li><a href="dirs.html"><span>Directories</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
    </ul>
  </div>
  <div class="navpath"><a class="el" href="dir_b8ba9ebcb71a95a44c4fd60b7d348fe1.html">src</a>&nbsp;&raquo;&nbsp;<a class="el" href="dir_26b426ffd7c02d2636b681f5b9fd4318.html">flexiport</a>
  </div>
</div>
<div class="contents">
<h1>udpport.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics</span>
<a name="l00003"></a>00003 <span class="comment"> *               http://gearbox.sf.net/</span>
<a name="l00004"></a>00004 <span class="comment"> * Copyright (c) 2008 Geoffrey Biggs</span>
<a name="l00005"></a>00005 <span class="comment"> *</span>
<a name="l00006"></a>00006 <span class="comment"> * flexiport flexible hardware data communications library.</span>
<a name="l00007"></a>00007 <span class="comment"> *</span>
<a name="l00008"></a>00008 <span class="comment"> * This distribution is licensed to you under the terms described in the LICENSE file included in</span>
<a name="l00009"></a>00009 <span class="comment"> * this distribution.</span>
<a name="l00010"></a>00010 <span class="comment"> *</span>
<a name="l00011"></a>00011 <span class="comment"> * This work is a product of the National Institute of Advanced Industrial Science and Technology,</span>
<a name="l00012"></a>00012 <span class="comment"> * Japan. Registration number: H20PRO-881</span>
<a name="l00013"></a>00013 <span class="comment"> *</span>
<a name="l00014"></a>00014 <span class="comment"> * This file is part of flexiport.</span>
<a name="l00015"></a>00015 <span class="comment"> *</span>
<a name="l00016"></a>00016 <span class="comment"> * flexiport is free software: you can redistribute it and/or modify it under the terms of the GNU</span>
<a name="l00017"></a>00017 <span class="comment"> * Lesser General Public License as published by the Free Software Foundation, either version 3 of</span>
<a name="l00018"></a>00018 <span class="comment"> * the License, or (at your option) any later version.</span>
<a name="l00019"></a>00019 <span class="comment"> *</span>
<a name="l00020"></a>00020 <span class="comment"> * flexiport is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without</span>
<a name="l00021"></a>00021 <span class="comment"> * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU</span>
<a name="l00022"></a>00022 <span class="comment"> * Lesser General Public License for more details.</span>
<a name="l00023"></a>00023 <span class="comment"> *</span>
<a name="l00024"></a>00024 <span class="comment"> * You should have received a copy of the GNU Lesser General Public License along with flexiport.</span>
<a name="l00025"></a>00025 <span class="comment"> * If not, see &lt;http://www.gnu.org/licenses/&gt;.</span>
<a name="l00026"></a>00026 <span class="comment"> */</span>
<a name="l00027"></a>00027 
<a name="l00028"></a>00028 <span class="preprocessor">#ifndef __UDPPORT_H</span>
<a name="l00029"></a>00029 <span class="preprocessor"></span><span class="preprocessor">#define __UDPPORT_H</span>
<a name="l00030"></a>00030 <span class="preprocessor"></span>
<a name="l00031"></a>00031 <span class="preprocessor">#include &quot;port.h&quot;</span>
<a name="l00032"></a>00032 <span class="preprocessor">#include &quot;flexiport_config.h&quot;</span>
<a name="l00033"></a>00033 
<a name="l00034"></a>00034 <span class="preprocessor">#include &lt;map&gt;</span>
<a name="l00035"></a>00035 <span class="preprocessor">#include &lt;string&gt;</span>
<a name="l00036"></a>00036 <span class="preprocessor">#if !defined (WIN32)</span>
<a name="l00037"></a>00037 <span class="preprocessor"></span><span class="preprocessor">        #include &lt;netinet/in.h&gt;</span>
<a name="l00038"></a>00038 <span class="preprocessor">#endif</span>
<a name="l00039"></a>00039 <span class="preprocessor"></span>
<a name="l00044"></a>00044 <span class="keyword">namespace </span>flexiport
<a name="l00045"></a>00045 {
<a name="l00046"></a>00046 
<a name="l00077"></a><a class="code" href="classflexiport_1_1UDPPort.html">00077</a> <span class="keyword">class </span>FLEXIPORT_EXPORT <a class="code" href="classflexiport_1_1UDPPort.html" title="UDP implementation of the Port class. This class provides UDP communication between...">UDPPort</a> : <span class="keyword">public</span> <a class="code" href="classflexiport_1_1Port.html" title="Base Port class.">Port</a>
<a name="l00078"></a>00078 {
<a name="l00079"></a>00079         <span class="keyword">public</span>:
<a name="l00080"></a>00080                 <a class="code" href="classflexiport_1_1UDPPort.html" title="UDP implementation of the Port class. This class provides UDP communication between...">UDPPort</a> (std::map&lt;std::string, std::string&gt; options);
<a name="l00081"></a>00081                 ~<a class="code" href="classflexiport_1_1UDPPort.html" title="UDP implementation of the Port class. This class provides UDP communication between...">UDPPort</a> ();
<a name="l00082"></a>00082 
<a name="l00086"></a>00086                 <span class="keywordtype">void</span> Open ();
<a name="l00088"></a>00088                 <span class="keywordtype">void</span> Close ();
<a name="l00090"></a>00090                 ssize_t Read (<span class="keywordtype">void</span> * <span class="keyword">const</span> buffer, <span class="keywordtype">size_t</span> count);
<a name="l00092"></a>00092                 ssize_t ReadFull (<span class="keywordtype">void</span> * <span class="keyword">const</span> buffer, <span class="keywordtype">size_t</span> count);
<a name="l00094"></a>00094                 ssize_t ReadUntil (<span class="keywordtype">void</span> * <span class="keyword">const</span> buffer, <span class="keywordtype">size_t</span> count, uint8_t terminator);
<a name="l00096"></a>00096                 ssize_t ReadStringUntil (std::string &amp;buffer, <span class="keywordtype">char</span> terminator);
<a name="l00098"></a>00098                 ssize_t Skip (<span class="keywordtype">size_t</span> count);
<a name="l00101"></a>00101                 ssize_t SkipUntil (uint8_t terminator, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> count);
<a name="l00103"></a>00103                 ssize_t BytesAvailable ();
<a name="l00105"></a>00105                 ssize_t BytesAvailableWait ();
<a name="l00107"></a>00107                 ssize_t Write (<span class="keyword">const</span> <span class="keywordtype">void</span> * <span class="keyword">const</span> buffer, <span class="keywordtype">size_t</span> count);
<a name="l00109"></a>00109                 <span class="keywordtype">void</span> Flush ();
<a name="l00111"></a>00111                 <span class="keywordtype">void</span> Drain ();
<a name="l00113"></a>00113                 std::string GetStatus () <span class="keyword">const</span>;
<a name="l00115"></a>00115                 <span class="keywordtype">void</span> SetTimeout (<a class="code" href="classflexiport_1_1Timeout.html" title="An object used to represent timeouts.">Timeout</a> timeout);
<a name="l00117"></a>00117                 <span class="keywordtype">void</span> SetCanRead (<span class="keywordtype">bool</span> canRead);
<a name="l00119"></a>00119                 <span class="keywordtype">void</span> SetCanWrite (<span class="keywordtype">bool</span> canWrite);
<a name="l00121"></a><a class="code" href="classflexiport_1_1UDPPort.html#aa0cf22123572524670ab795d21d2c1b9">00121</a>                 <span class="keywordtype">bool</span> <a class="code" href="classflexiport_1_1UDPPort.html#aa0cf22123572524670ab795d21d2c1b9" title="Check if the port is open.">IsOpen</a> ()<span class="keyword"> const                        </span>{ <span class="keywordflow">return</span> _open; }
<a name="l00122"></a>00122 
<a name="l00123"></a>00123         <span class="keyword">private</span>:
<a name="l00124"></a>00124 <span class="preprocessor">#if !defined (WIN32)</span>
<a name="l00125"></a>00125 <span class="preprocessor"></span><span class="preprocessor">        #if defined (FLEXIPORT_HAVE_GETADDRINFO)</span>
<a name="l00126"></a>00126 <span class="preprocessor"></span>                <span class="keyword">struct </span>sockaddr _destSockAddr;
<a name="l00127"></a>00127 <span class="preprocessor">        #else</span>
<a name="l00128"></a>00128 <span class="preprocessor"></span>                <span class="keyword">struct </span>sockaddr_in _destSockAddr;
<a name="l00129"></a>00129 <span class="preprocessor">        #endif</span>
<a name="l00130"></a>00130 <span class="preprocessor"></span><span class="preprocessor">#endif // !defined (WIN32)</span>
<a name="l00131"></a>00131 <span class="preprocessor"></span>                <span class="keywordtype">int</span> _sendSock;      <span class="comment">// Socket to send data from.</span>
<a name="l00132"></a>00132                 <span class="keywordtype">int</span> _recvSock;      <span class="comment">// Socket to receive data on.</span>
<a name="l00133"></a>00133 
<a name="l00134"></a>00134                 std::string _destIP;
<a name="l00135"></a>00135                 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> _destPort;
<a name="l00136"></a>00136                 std::string _recvIP;
<a name="l00137"></a>00137                 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> _recvPort;
<a name="l00138"></a>00138                 <span class="keywordtype">bool</span> _open;
<a name="l00139"></a>00139 
<a name="l00140"></a>00140                 <span class="keywordtype">void</span> CheckPort (<span class="keywordtype">bool</span> read);
<a name="l00141"></a>00141 
<a name="l00142"></a>00142                 <span class="keywordtype">bool</span> ProcessOption (<span class="keyword">const</span> std::string &amp;option, <span class="keyword">const</span> std::string &amp;value);
<a name="l00143"></a>00143 
<a name="l00144"></a>00144                 <span class="keywordtype">void</span> OpenSender ();
<a name="l00145"></a>00145                 <span class="keywordtype">void</span> CloseSender ();
<a name="l00146"></a>00146                 <span class="keywordtype">void</span> OpenReceiver ();
<a name="l00147"></a>00147                 <span class="keywordtype">void</span> CloseReceiver ();
<a name="l00148"></a>00148                 <span class="keyword">typedef</span> <span class="keyword">enum</span> {TIMED_OUT, DATA_AVAILABLE, CAN_WRITE} WaitStatus;
<a name="l00149"></a>00149                 WaitStatus WaitForDataOrTimeout ();
<a name="l00150"></a>00150                 <span class="keywordtype">bool</span> IsDataAvailable ();
<a name="l00151"></a>00151                 WaitStatus WaitForWritableOrTimeout ();
<a name="l00152"></a>00152                 <span class="keywordtype">void</span> SetSocketBlockingFlag ();
<a name="l00153"></a>00153 };
<a name="l00154"></a>00154 
<a name="l00155"></a>00155 } <span class="comment">// namespace flexiport</span>
<a name="l00156"></a>00156 
<a name="l00159"></a>00159 <span class="preprocessor">#endif // __UDPPORT_H</span>
</pre></div></div>

            </td>
            <td colspan="1">&nbsp;</td>
         </tr>
        </table>
<!-- end of table -->

 <hr size="1"><address style="align: right;"><small>Generated for GearBox by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.5 </small></address>
</body>
</html>