blob: 3259e7a587017d1c4c43c41b9f279a58d8ca835e [file] [log] [blame]
Alexander Afanasyev548d38d2013-01-26 16:36:06 -08001/* -*- 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 Afanasyev2b0363a2013-01-28 21:42:12 -080021#include <QtCore>
22
Alexander Afanasyev548d38d2013-01-26 16:36:06 -080023#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
30using namespace boost;
31using namespace std;
32using namespace Ccnx;
33
34int main(int argc, char *argv[])
35{
36 INIT_LOGGERS ();
37
Alexander Afanasyev2b0363a2013-01-28 21:42:12 -080038 QCoreApplication app(argc, argv);
39
Alexander Afanasyev548d38d2013-01-26 16:36:06 -080040 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),
56 bind (&Dispatcher::Did_LocalFile_Delete, &dispatcher, _1));
57
Alexander Afanasyev548d38d2013-01-26 16:36:06 -080058
Alexander Afanasyev2b0363a2013-01-28 21:42:12 -080059 return app.exec ();
Alexander Afanasyev548d38d2013-01-26 16:36:06 -080060}