blob: 6745518c3d1f65e056c4d1c19951188d183c0cba [file] [log] [blame]
Alexander Afanasyevdfe58192013-01-17 17:34:04 -08001/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
2/*
3 * Copyright (c) 2012 University of California, Los Angeles
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: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
19 * Zhenkai Zhu <zhenkai@cs.ucla.edu>
20 */
21
22#include "fetcher.h"
Alexander Afanasyevd6c2a902013-01-19 21:24:30 -080023#include "fetch-manager.h"
24
Alexander Afanasyevdfe58192013-01-17 17:34:04 -080025#include <boost/make_shared.hpp>
26#include <boost/ref.hpp>
27#include <boost/throw_exception.hpp>
28
29using namespace boost;
30using namespace std;
Alexander Afanasyevdfe58192013-01-17 17:34:04 -080031
Alexander Afanasyev76d4fa42013-01-19 14:51:21 -080032Fetcher::Fetcher (FetchManager &fetchManger,
Alexander Afanasyev49a18522013-01-18 17:49:04 -080033 const Ccnx::Name &name, int32_t minSeqNo, int32_t maxSeqNo,
34 const Ccnx::Name &forwardingHint/* = Ccnx::Name ()*/)
Alexander Afanasyev76d4fa42013-01-19 14:51:21 -080035 : m_fetchManager (fetchManger)
Alexander Afanasyev83531a42013-01-19 16:21:54 -080036 , m_active (false)
Alexander Afanasyev49a18522013-01-18 17:49:04 -080037 , m_name (name)
38 , m_forwardingHint (forwardingHint)
39 , m_minSendSeqNo (-1)
40 , m_maxSendSeqNo (-1)
41 , m_minSeqNo (minSeqNo)
42 , m_maxSeqNo (maxSeqNo)
Alexander Afanasyevdfe58192013-01-17 17:34:04 -080043
Alexander Afanasyev49a18522013-01-18 17:49:04 -080044 , m_pipeline (6) // initial "congestion window"
Alexander Afanasyevdfe58192013-01-17 17:34:04 -080045{
Alexander Afanasyevdfe58192013-01-17 17:34:04 -080046}
47
48Fetcher::~Fetcher ()
49{
Alexander Afanasyevdfe58192013-01-17 17:34:04 -080050}
Alexander Afanasyev83531a42013-01-19 16:21:54 -080051
52void
53Fetcher::RestartPipeline ()
54{
55 m_active = true;
56}
Alexander Afanasyevd6c2a902013-01-19 21:24:30 -080057
58void
59Fetcher::OnData (uint32_t seqno, const Ccnx::Name &name, const Ccnx::Bytes &)
60{
61 // bla bla
62 if (0)
63 {
64 m_active = false;
65 m_fetchManager.DidFetchComplete (*this);
66 }
67}
68
69void
70Fetcher::OnTimeout (uint32_t seqno, const Ccnx::Name &name)
71{
72}