User Manual, Developers Guide and API Documentation

TCPHeader.hpp

Go to the documentation of this file.
00001 /*******************************************************************************
00002  * This file is part of openWNS (open Wireless Network Simulator)
00003  * _____________________________________________________________________________
00004  *
00005  * Copyright (C) 2004-2007
00006  * Chair of Communication Networks (ComNets)
00007  * Kopernikusstr. 16, D-52074 Aachen, Germany
00008  * phone: ++49-241-80-27910,
00009  * fax: ++49-241-80-22242
00010  * email: info@openwns.org
00011  * www: http://www.openwns.org
00012  * _____________________________________________________________________________
00013  *
00014  * openWNS is free software; you can redistribute it and/or modify it under the
00015  * terms of the GNU Lesser General Public License version 2 as published by the
00016  * Free Software Foundation;
00017  *
00018  * openWNS is distributed in the hope that it will be useful, but WITHOUT ANY
00019  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
00020  * A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00021  * details.
00022  *
00023  * You should have received a copy of the GNU Lesser General Public License
00024  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00025  *
00026  ******************************************************************************/
00027 
00028 #ifndef TCP_TCPHEADER_HPP
00029 #define TCP_TCPHEADER_HPP
00030 
00031 #include <WNS/service/tl/TCPHeader.hpp>
00032 #include <WNS/ldk/Forwarding.hpp>
00033 #include <WNS/ldk/fu/Plain.hpp>
00034 
00035 namespace tcp {
00036 
00037     class TCPCommand:
00038         public wns::ldk::Command,
00039         public wns::service::tl::ITCPHeader
00040     {
00041      public:
00042          TCPCommand()
00043              {
00044                  peer.urg = false;
00045                  peer.ack = false;
00046                  peer.psh = false;
00047                  peer.rst = false;
00048                  peer.syn = false;
00049                  peer.fin = false;
00050              }
00051 
00052          struct {} local;
00053          struct {
00054              wns::service::tl::FlowID flowID;
00055              bool urg;
00056              bool ack;
00057              bool psh;
00058              bool rst;
00059              bool syn;
00060              bool fin;
00061          } peer;
00062          struct {} magic;
00063 
00064         const wns::service::tl::FlowID& getFlowID() const { return peer.flowID; }
00065 
00066         wns::service::tl::FlowID& getFlowID() { return peer.flowID; }
00067 
00068         const bool& getUrgentFlag() const { return peer.urg; }
00069 
00070         bool& getUrgentFlag() { return peer.urg; }
00071 
00072         const bool& getAckFlag() const { return peer.ack; }
00073 
00074         bool& getAckFlag() { return peer.ack; }
00075 
00076         const bool& getPushFlag() const { return peer.psh; }
00077 
00078         bool& getPushFlag() { return peer.psh; }
00079 
00080         const bool& getResetFlag() const { return peer.rst; }
00081 
00082         bool& getResetFlag() { return peer.rst; }
00083 
00084         const bool& getSynFlag() const { return peer.syn; }
00085 
00086         bool& getSynFlag() { return peer.syn; }
00087 
00088         const bool& getFinFlag() const { return peer.fin; }
00089 
00090         bool& getFinFlag() { return peer.fin; }
00091      };
00092 
00097     class TCPHeader :
00098         public wns::ldk::Forwarding<TCPHeader>,
00099         public wns::ldk::fu::Plain<TCPHeader, TCPCommand>
00100     {
00101     public:
00102         TCPHeader(wns::ldk::fun::FUN* fun, const wns::pyconfig::View& config);
00103 
00104         virtual ~TCPHeader() {}
00105 
00106         wns::ldk::CommandPool*
00107         createReply(const wns::ldk::CommandPool* original) const;
00108 
00109         virtual void
00110         calculateSizes(const wns::ldk::CommandPool* commandPool, Bit& commandPoolSize, Bit& dataSize) const;
00111 
00112     private:
00117         Bit headerSize;
00118 
00119 
00120 
00121     };
00122 } // tcp
00123 
00124 
00125 #endif // TCP_TCPHEADER_HPP

Generated on Sun May 27 03:31:54 2012 for openWNS by  doxygen 1.5.5