blob: e0a6aedb006ad9d354c32e515f52b26956e52878 [file] [log] [blame]
// -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*-
//
// Copyright (c) 2006 Georgia Tech Research Corporation
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation;
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Author:
//
#ifndef CCNX_L4_PROTOCOL_H
#define CCNX_L4_PROTOCOL_H
#include "ns3/object.h"
#include "ns3/callback.h"
#include "ns3/ccnx-interest-header.h"
#include "ns3/ccnx-content-object-header.h"
namespace ns3 {
class Packet;
class CcnxInterface;
class CcnxRoute;
/**
* \brief Actual implementation of CCNx protocol
*/
class CcnxL4Protocol : public Object
{
public:
enum RxStatus {
RX_OK,
// RX_CSUM_FAILED,
// RX_ENDPOINT_CLOSED,
// RX_ENDPOINT_UNREACH
};
static TypeId GetTypeId (void);
CcnxL4Protocol ();
virtual ~CcnxL4Protocol ();
void SetNode (Ptr<Node> node);
/**
* \param p packet to forward up
* \param header Ccnx Header information
* \param incomingInterface the CcnxInterface on which the packet arrived
*
* Called from lower-level layers to send the packet up
* in the stack.
*/
virtual enum RxStatus Receive (Ptr<Packet> p,
CcnxHeader const &header,
Ptr<CcnxInterface> incomingInterface);
typedef Callback<void,Ptr<Packet>, Ptr<CcnxRoute> > DownTargetCallback;
/**
* This method allows a caller to set the current down target callback
* set for this L4 protocol
*
* \param cb current Callback for the L4 protocol
*/
virtual void SetDownTarget (DownTargetCallback cb);
/**
* This method allows a caller to get the current down target callback
* set for this L4 protocol, for
*
* \return current Callback for the L4 protocol
*/
virtual DownTargetCallback GetDownTarget (void) const;
protected:
virtual void DoDispose (void);
/*
* This function will notify other components connected to the node that a new stack member is now connected
* This will be used to notify Layer 3 protocol of layer 4 protocol stack to connect them together.
*/
virtual void NotifyNewAggregate ();
private:
DownTargetCallback m_downTarget;
};
} // Namespace ns3
#endif // CCNX_L4_PROTOCOL_H