Alexander Afanasyev | 548d38d | 2013-01-26 16:36:06 -0800 | [diff] [blame] | 1 | /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /* |
| 3 | * Copyright (c) 2013 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 | */ |
| 20 | |
Alexander Afanasyev | 2b0363a | 2013-01-28 21:42:12 -0800 | [diff] [blame] | 21 | #include <QtCore> |
| 22 | |
Alexander Afanasyev | 548d38d | 2013-01-26 16:36:06 -0800 | [diff] [blame] | 23 | #include "dispatcher.h" |
| 24 | #include "fs-watcher.h" |
| 25 | #include "logging.h" |
| 26 | #include "ccnx-wrapper.h" |
| 27 | |
| 28 | #include <boost/make_shared.hpp> |
| 29 | |
| 30 | using namespace boost; |
| 31 | using namespace std; |
| 32 | using namespace Ccnx; |
| 33 | |
| 34 | int main(int argc, char *argv[]) |
| 35 | { |
| 36 | INIT_LOGGERS (); |
| 37 | |
Alexander Afanasyev | 2b0363a | 2013-01-28 21:42:12 -0800 | [diff] [blame] | 38 | QCoreApplication app(argc, argv); |
| 39 | |
Alexander Afanasyev | 548d38d | 2013-01-26 16:36:06 -0800 | [diff] [blame] | 40 | if (argc != 4) |
| 41 | { |
| 42 | cerr << "Usage: ./csd <username> <shared-folder> <path>" << endl; |
| 43 | return 1; |
| 44 | } |
| 45 | |
| 46 | string username = argv[1]; |
| 47 | string sharedFolder = argv[2]; |
| 48 | string path = argv[3]; |
| 49 | |
| 50 | cout << "Starting ChronoShare for [" << username << "] shared-folder [" << sharedFolder << "] at [" << path << "]" << endl; |
| 51 | |
| 52 | Dispatcher dispatcher (username, sharedFolder, path, make_shared<CcnxWrapper> ()); |
| 53 | |
| 54 | FsWatcher watcher (path.c_str (), |
| 55 | bind (&Dispatcher::Did_LocalFile_AddOrModify, &dispatcher, _1), |
Zhenkai Zhu | d175627 | 2013-02-01 17:02:18 -0800 | [diff] [blame] | 56 | bind (&Dispatcher::Did_LocalFile_Delete, &dispatcher, _1)); |
Alexander Afanasyev | 548d38d | 2013-01-26 16:36:06 -0800 | [diff] [blame] | 57 | |
Alexander Afanasyev | 2b0363a | 2013-01-28 21:42:12 -0800 | [diff] [blame] | 58 | return app.exec (); |
Alexander Afanasyev | 548d38d | 2013-01-26 16:36:06 -0800 | [diff] [blame] | 59 | } |