blob: 6a53019addbdaaf038047a60775cc72612cb5ab1 [file] [log] [blame]
Yingdi Yufa4ce792014-02-06 18:09:22 -08001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
2/*
3 * Copyright (c) 2013, Regents of the University of California
4 * Yingdi Yu
5 *
6 * BSD license, See the LICENSE file for more information
7 *
8 * Author: Yingdi Yu <yingdi@cs.ucla.edu>
9 */
10
11#ifndef CHRONOS_INVITATION_H
12#define CHRONOS_INVITATION_H
13
14
Yingdi Yufa0b6a02014-04-30 14:26:42 -070015#include <ndn-cxx/name.hpp>
16#include <ndn-cxx/signature.hpp>
17#include <ndn-cxx/security/identity-certificate.hpp>
Yingdi Yufa4ce792014-02-06 18:09:22 -080018
19namespace chronos{
20
21class Invitation
22{
Yingdi Yu348f5ea2014-03-01 14:47:25 -080023 public:
24 /*
25 * /[invitee_namespace]
26 * /CHRONOCHAT-INVITATION
27 * /<chatroom_name>
28 * /<inviter_routing_prefix>
29 * /<inviter_cert>
30 * /<timestamp>
31 * /<keylocator>
32 * /<signature>
33 */
Yingdi Yufa4ce792014-02-06 18:09:22 -080034 static const size_t NAME_SIZE_MIN;
Yingdi Yufa4ce792014-02-06 18:09:22 -080035 static const ssize_t SIGNATURE;
36 static const ssize_t KEY_LOCATOR;
37 static const ssize_t TIMESTAMP;
Yingdi Yu348f5ea2014-03-01 14:47:25 -080038 static const ssize_t INVITER_CERT;
Yingdi Yufa4ce792014-02-06 18:09:22 -080039 static const ssize_t INVITER_PREFIX;
40 static const ssize_t CHATROOM;
Yingdi Yu348f5ea2014-03-01 14:47:25 -080041 static const ssize_t CHRONOCHAT_INVITATION;
Yingdi Yufa4ce792014-02-06 18:09:22 -080042
Yingdi Yufa4ce792014-02-06 18:09:22 -080043 struct Error : public std::runtime_error { Error(const std::string &what) : std::runtime_error(what) {} };
44
45 Invitation() {}
46
47 Invitation(const ndn::Name& interestName);
48
Yingdi Yu348f5ea2014-03-01 14:47:25 -080049 Invitation(const ndn::Name& inviteeNameSpace,
50 const std::string& chatroom,
51 const ndn::Name& inviterRoutingPrefix,
52 const ndn::IdentityCertificate& inviterCertificate);
Yingdi Yufa4ce792014-02-06 18:09:22 -080053
54 Invitation(const Invitation& invitation);
55
56 virtual
57 ~Invitation() {};
58
59 const ndn::Name&
60 getInviteeNameSpace() const
61 { return m_inviteeNameSpace; }
62
Yingdi Yu348f5ea2014-03-01 14:47:25 -080063 const std::string&
Yingdi Yufa4ce792014-02-06 18:09:22 -080064 getChatroom() const
65 { return m_chatroom; }
66
67 const ndn::Name&
68 getInviterRoutingPrefix() const
69 { return m_inviterRoutingPrefix; }
Yingdi Yu348f5ea2014-03-01 14:47:25 -080070
71 const ndn::IdentityCertificate&
72 getInviterCertificate() const
73 { return m_inviterCertificate; }
74
75 const uint64_t
76 getTimestamp() const
77 { return m_timestamp; }
Yingdi Yufa0b6a02014-04-30 14:26:42 -070078
Yingdi Yufa4ce792014-02-06 18:09:22 -080079 const ndn::Name&
80 getUnsignedInterestName() const
81 { return m_interestName; }
82
83private:
84 ndn::Name m_interestName;
85
86 ndn::Name m_inviteeNameSpace;
Yingdi Yu348f5ea2014-03-01 14:47:25 -080087 std::string m_chatroom;
Yingdi Yufa4ce792014-02-06 18:09:22 -080088 ndn::Name m_inviterRoutingPrefix;
Yingdi Yu348f5ea2014-03-01 14:47:25 -080089 ndn::IdentityCertificate m_inviterCertificate;
90 uint64_t m_timestamp;
Yingdi Yufa4ce792014-02-06 18:09:22 -080091};
92
93}//chronos
94
95#endif