Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame^] | 1 | // -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- |
| 2 | // |
| 3 | // Copyright (c) 2006 Georgia Tech Research Corporation |
| 4 | // |
| 5 | // This program is free software; you can redistribute it and/or modify |
| 6 | // it under the terms of the GNU General Public License version 2 as |
| 7 | // published by the Free Software Foundation; |
| 8 | // |
| 9 | // This program is distributed in the hope that it will be useful, |
| 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | // GNU General Public License for more details. |
| 13 | // |
| 14 | // You should have received a copy of the GNU General Public License |
| 15 | // along with this program; if not, write to the Free Software |
| 16 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 17 | // |
| 18 | // Author: |
| 19 | // |
| 20 | |
| 21 | #ifndef CCNX_L4_PROTOCOL_H |
| 22 | #define CCNX_L4_PROTOCOL_H |
| 23 | |
| 24 | #include "ns3/object.h" |
| 25 | #include "ns3/callback.h" |
| 26 | #include "ns3/ccnx-interest-header.h" |
| 27 | #include "ns3/ccnx-content-object-header.h" |
| 28 | |
| 29 | namespace ns3 { |
| 30 | |
| 31 | class Packet; |
| 32 | class CcnxInterface; |
| 33 | class CcnxRoute; |
| 34 | |
| 35 | /** |
| 36 | * \brief Actual implementation of CCNx protocol |
| 37 | */ |
| 38 | class CcnxL4Protocol : public Object |
| 39 | { |
| 40 | public: |
| 41 | enum RxStatus { |
| 42 | RX_OK, |
| 43 | |
| 44 | // RX_CSUM_FAILED, |
| 45 | // RX_ENDPOINT_CLOSED, |
| 46 | // RX_ENDPOINT_UNREACH |
| 47 | }; |
| 48 | |
| 49 | static TypeId GetTypeId (void); |
| 50 | |
| 51 | virtual ~CcnxL4Protocol (); |
| 52 | |
| 53 | /** |
| 54 | * \param p packet to forward up |
| 55 | * \param header Ccnx Header information |
| 56 | * \param incomingInterface the CcnxInterface on which the packet arrived |
| 57 | * |
| 58 | * Called from lower-level layers to send the packet up |
| 59 | * in the stack. |
| 60 | */ |
| 61 | virtual enum RxStatus Receive (Ptr<Packet> p, |
| 62 | CcnxHeader const &header, |
| 63 | Ptr<CcnxInterface> incomingInterface) = 0; |
| 64 | |
| 65 | typedef Callback<void,Ptr<Packet>, Ptr<CcnxRoute> > DownTargetCallback; |
| 66 | /** |
| 67 | * This method allows a caller to set the current down target callback |
| 68 | * set for this L4 protocol |
| 69 | * |
| 70 | * \param cb current Callback for the L4 protocol |
| 71 | */ |
| 72 | virtual void SetDownTarget (DownTargetCallback cb) = 0; |
| 73 | /** |
| 74 | * This method allows a caller to get the current down target callback |
| 75 | * set for this L4 protocol, for |
| 76 | * |
| 77 | * \return current Callback for the L4 protocol |
| 78 | */ |
| 79 | virtual DownTargetCallback GetDownTarget (void) const = 0; |
| 80 | }; |
| 81 | |
| 82 | } // Namespace ns3 |
| 83 | |
| 84 | #endif // CCNX_L4_PROTOCOL_H |