blob: 55c5722dfb61bedc28d51115b99b585117d03699 [file] [log] [blame]
Alexander Afanasyevc74a6022011-08-15 20:01:35 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
Alexander Afanasyev08d984e2011-08-13 19:20:22 -07002/*
Alexander Afanasyev7112f482011-08-17 14:05:57 -07003 * Copyright (c) 2011 University of California, Los Angeles
Alexander Afanasyev08d984e2011-08-13 19:20:22 -07004 *
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 *
Alexander Afanasyev7112f482011-08-17 14:05:57 -070018 * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070019 */
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070020
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070021#ifndef _NDN_H_
22#define _NDN_H_
Alexander Afanasyev7112f482011-08-17 14:05:57 -070023
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070024#include "ns3/object.h"
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070025#include "ns3/callback.h"
Alexander Afanasyevf377b332011-12-16 15:32:12 -080026#include "ns3/traced-callback.h"
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070027
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070028namespace ns3 {
29
30class Node;
31class NetDevice;
32class Packet;
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070033class NdnForwardingStrategy;
34class NdnFace;
35class NdnContentObjectHeader;
36class NdnInterestHeader;
37class NdnPit;
Alexander Afanasyev78cf0c92011-09-01 19:57:14 -070038
Alexander Afanasyev6315ef72012-06-01 20:56:31 -070039/// @cond include_hidden
Alexander Afanasyev78cf0c92011-09-01 19:57:14 -070040/**
41 * \internal
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070042 * \brief Private namespace for Ndn content store implementation
Alexander Afanasyev78cf0c92011-09-01 19:57:14 -070043 */
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070044namespace __ndn_private
Alexander Afanasyev78cf0c92011-09-01 19:57:14 -070045{
46class i_face {};
47class i_metric {};
48class i_nth {};
49class i_prefix {};
50class i_ordered {}; ///< tag for Boost.MultiIndex container (ordered by prefix)
51class i_mru {};
52}
Alexander Afanasyev6315ef72012-06-01 20:56:31 -070053/// @endcond
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070054
Ilya Moiseenkobdf78d62011-10-28 13:20:10 -070055// default data size
Alexander Afanasyeva5bbe0e2011-11-22 17:28:39 -080056// #define NDN_DEFAULT_DATA_SIZE 1024
57// #define NDN_INTEREST_RESET_PERIOD (10*MILLI_SECOND)
58
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070059/**
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070060 * \defgroup ndn NDN abstraction
Alexander Afanasyev7112f482011-08-17 14:05:57 -070061 *
62 * This is an abstract implementation of NDN protocol
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070063 */
64/**
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070065 * \ingroup ndn
66 * \brief Interface to manage Ndn stack
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070067 *
68 * This class defines the API to manipulate the following aspects of
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070069 * the Ndn stack implementation:
70 * -# register a face (NdnFace-derived object) for use by the Ndn
Alexander Afanasyev7112f482011-08-17 14:05:57 -070071 * layer
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070072 * -# register forwarding strategy (NdnForwardingStrategy-derived
73 * object) to use by Ndn stack
74 * -# export Ndn configuration attributes
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070075 *
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070076 * Each NdnFace-derived object has conceptually a single Ndn
Alexander Afanasyev7112f482011-08-17 14:05:57 -070077 * interface associated with it.
78 *
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070079 * In addition, this class defines Ndn packet coding constants
Alexander Afanasyev7112f482011-08-17 14:05:57 -070080 *
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070081 * \see NdnFace, NdnForwardingStrategy
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070082 */
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070083class Ndn : public Object
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070084{
85public:
Alexander Afanasyev7112f482011-08-17 14:05:57 -070086 /**
87 * \brief Interface ID
88 *
89 * \return interface ID
90 */
91 static TypeId GetTypeId ();
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070092 virtual ~Ndn ();
Alexander Afanasyev3a4a0b32012-06-28 14:14:22 -070093
Alexander Afanasyev56f79ea2011-08-17 23:54:27 -070094 /**
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070095 * \brief Add face to Ndn stack
Alexander Afanasyev56f79ea2011-08-17 23:54:27 -070096 *
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070097 * \param face smart pointer to NdnFace-derived object
98 * (NdnLocalFace, NdnNetDeviceFace, NdnUdpFace) \returns the
99 * index of the Ndn interface added.
Alexander Afanasyev56f79ea2011-08-17 23:54:27 -0700100 *
Alexander Afanasyev4aac5572012-08-09 10:49:55 -0700101 * \see NdnLocalFace, NdnNetDeviceFace, NdnUdpFace
Alexander Afanasyev56f79ea2011-08-17 23:54:27 -0700102 */
103 virtual uint32_t
Alexander Afanasyev4aac5572012-08-09 10:49:55 -0700104 AddFace (const Ptr<NdnFace> &face) = 0;
Alexander Afanasyev56f79ea2011-08-17 23:54:27 -0700105
106 /**
Alexander Afanasyev4aac5572012-08-09 10:49:55 -0700107 * \brief Get current number of faces added to Ndn stack
Alexander Afanasyev56f79ea2011-08-17 23:54:27 -0700108 *
109 * \returns the number of faces
110 */
111 virtual uint32_t
112 GetNFaces (void) const = 0;
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700113
114 /**
Alexander Afanasyevc5a23e22011-09-07 00:37:36 -0700115 * \brief Get face by face index
Alexander Afanasyev4aac5572012-08-09 10:49:55 -0700116 * \param face The face number of an Ndn interface.
117 * \returns The NdnFace associated with the Ndn face number.
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700118 */
Alexander Afanasyev4aac5572012-08-09 10:49:55 -0700119 virtual Ptr<NdnFace>
Alexander Afanasyev56f79ea2011-08-17 23:54:27 -0700120 GetFace (uint32_t face) const = 0;
Alexander Afanasyevc5a23e22011-09-07 00:37:36 -0700121
122 /**
Alexander Afanasyev4aac5572012-08-09 10:49:55 -0700123 * \brief Remove face from ndn stack (remove callbacks)
Alexander Afanasyevc5a23e22011-09-07 00:37:36 -0700124 */
125 virtual void
Alexander Afanasyev4aac5572012-08-09 10:49:55 -0700126 RemoveFace (Ptr<NdnFace> face) = 0;
Alexander Afanasyev52e9aa92011-11-15 20:23:20 -0800127
128 /**
Alexander Afanasyev7f3e49e2012-04-30 00:17:07 -0700129 * \brief Get face for NetDevice
Alexander Afanasyev52e9aa92011-11-15 20:23:20 -0800130 */
Alexander Afanasyev4aac5572012-08-09 10:49:55 -0700131 virtual Ptr<NdnFace>
Alexander Afanasyev52e9aa92011-11-15 20:23:20 -0800132 GetFaceByNetDevice (Ptr<NetDevice> netDevice) const = 0;
Alexander Afanasyevf377b332011-12-16 15:32:12 -0800133
Alexander Afanasyeve3d126f2012-07-16 17:07:31 -0700134 // /**
135 // * \enum DropReason
136 // * \brief A reason why the packet has been dropped
137 // */
138 // enum DropReason
139 // {
140 // DUPLICATED, // Interests
141 // SUPPRESSED, // Interests and Nacks
142 // NO_FACES, // Interests
143 // NON_DUPLICATED, // Nacks
144 // AFTER_SATISFIED, // Nacks
145 // UNSOLICITED, // data
146 // PIT_LIMIT // PIT limit reached
147 // };
148 };
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700149
150} // namespace ns3
151
Alexander Afanasyev4aac5572012-08-09 10:49:55 -0700152#endif /* _NDN_H_ */