blob: 6e4ee850e2a5e6d2017f76625a1bc19a9e1b6937 [file] [log] [blame]
Alexander Afanasyev3fd14f02014-03-26 14:34:39 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
3 * Copyright (C) 2014 Regents of the University of California.
4 * See COPYING for copyright and distribution information.
5 */
6
Shuo Chen9c2477f2014-03-13 15:01:06 -07007#include <string>
8#include <iostream>
9#include <ndn-cpp-dev/face.hpp>
10
11#include "../storage/storage-handle.hpp"
12#include "../storage/sqlite/sqlite-handle.hpp"
13#include "../ndn-handle/read-handle.hpp"
14
15using namespace repo;
16
17static const string ndnRepoUsageMessage =
18 "ndn-repo - NDNx Repository Daemon\n"
19 "-d: set database path\n"
20 "-h: show help message\n"
21 "-c: set config file path\n"
22 ;
23
Alexander Afanasyev3fd14f02014-03-26 14:34:39 -070024int
Shuo Chen9c2477f2014-03-13 15:01:06 -070025main(int argc, char** argv) {
26 int opt;
27 string dbPath;
28 string confPath;
29 while ((opt = getopt(argc, argv, "d:hc:")) != -1) {
30 switch (opt) {
31 case 'd':
32 dbPath = string(optarg);
33 break;
34 case 'h':
35 std::cout << ndnRepoUsageMessage << std::endl;
36 return 1;
37 case 'c':
38 confPath = string(optarg);
39 break;
40 default:
41 break;
42 }
43 }
44 SqliteHandle sqliteHandle(dbPath);
45 StorageHandle* handle = &sqliteHandle;
46
47 Face face;
48 ReadHandle readHandle(&face, handle);
49 if (confPath.empty()) {
50 confPath = "./repo.conf";
51 }
52 face.processEvents();
Alexander Afanasyev3fd14f02014-03-26 14:34:39 -070053 return 0;
54}