Alexander Afanasyev | dfe5819 | 2013-01-17 17:34:04 -0800 | [diff] [blame] | 1 | /* -*- 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 Afanasyev | d6c2a90 | 2013-01-19 21:24:30 -0800 | [diff] [blame^] | 23 | #include "fetch-manager.h" |
| 24 | |
Alexander Afanasyev | dfe5819 | 2013-01-17 17:34:04 -0800 | [diff] [blame] | 25 | #include <boost/make_shared.hpp> |
| 26 | #include <boost/ref.hpp> |
| 27 | #include <boost/throw_exception.hpp> |
| 28 | |
| 29 | using namespace boost; |
| 30 | using namespace std; |
Alexander Afanasyev | dfe5819 | 2013-01-17 17:34:04 -0800 | [diff] [blame] | 31 | |
Alexander Afanasyev | 76d4fa4 | 2013-01-19 14:51:21 -0800 | [diff] [blame] | 32 | Fetcher::Fetcher (FetchManager &fetchManger, |
Alexander Afanasyev | 49a1852 | 2013-01-18 17:49:04 -0800 | [diff] [blame] | 33 | const Ccnx::Name &name, int32_t minSeqNo, int32_t maxSeqNo, |
| 34 | const Ccnx::Name &forwardingHint/* = Ccnx::Name ()*/) |
Alexander Afanasyev | 76d4fa4 | 2013-01-19 14:51:21 -0800 | [diff] [blame] | 35 | : m_fetchManager (fetchManger) |
Alexander Afanasyev | 83531a4 | 2013-01-19 16:21:54 -0800 | [diff] [blame] | 36 | , m_active (false) |
Alexander Afanasyev | 49a1852 | 2013-01-18 17:49:04 -0800 | [diff] [blame] | 37 | , m_name (name) |
| 38 | , m_forwardingHint (forwardingHint) |
| 39 | , m_minSendSeqNo (-1) |
| 40 | , m_maxSendSeqNo (-1) |
| 41 | , m_minSeqNo (minSeqNo) |
| 42 | , m_maxSeqNo (maxSeqNo) |
Alexander Afanasyev | dfe5819 | 2013-01-17 17:34:04 -0800 | [diff] [blame] | 43 | |
Alexander Afanasyev | 49a1852 | 2013-01-18 17:49:04 -0800 | [diff] [blame] | 44 | , m_pipeline (6) // initial "congestion window" |
Alexander Afanasyev | dfe5819 | 2013-01-17 17:34:04 -0800 | [diff] [blame] | 45 | { |
Alexander Afanasyev | dfe5819 | 2013-01-17 17:34:04 -0800 | [diff] [blame] | 46 | } |
| 47 | |
| 48 | Fetcher::~Fetcher () |
| 49 | { |
Alexander Afanasyev | dfe5819 | 2013-01-17 17:34:04 -0800 | [diff] [blame] | 50 | } |
Alexander Afanasyev | 83531a4 | 2013-01-19 16:21:54 -0800 | [diff] [blame] | 51 | |
| 52 | void |
| 53 | Fetcher::RestartPipeline () |
| 54 | { |
| 55 | m_active = true; |
| 56 | } |
Alexander Afanasyev | d6c2a90 | 2013-01-19 21:24:30 -0800 | [diff] [blame^] | 57 | |
| 58 | void |
| 59 | Fetcher::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 | |
| 69 | void |
| 70 | Fetcher::OnTimeout (uint32_t seqno, const Ccnx::Name &name) |
| 71 | { |
| 72 | } |