Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
2 | /* | ||||
Varun Patil | a24bd3e | 2020-11-24 10:08:33 +0530 | [diff] [blame^] | 3 | * Copyright (c) 2020, Regents of the University of California |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 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 | |||||
Yingdi Yu | eb692ac | 2015-02-10 18:46:18 -0800 | [diff] [blame] | 11 | #ifndef CHRONOCHAT_INVITATION_HPP |
12 | #define CHRONOCHAT_INVITATION_HPP | ||||
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 13 | |
14 | |||||
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame] | 15 | #include "common.hpp" |
16 | |||||
Varun Patil | 3d85090 | 2020-11-23 12:19:14 +0530 | [diff] [blame] | 17 | #include <ndn-cxx/security/certificate.hpp> |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 18 | |
Yingdi Yu | eb692ac | 2015-02-10 18:46:18 -0800 | [diff] [blame] | 19 | namespace chronochat { |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 20 | |
21 | class Invitation | ||||
22 | { | ||||
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame] | 23 | public: |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 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 Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 34 | static const size_t NAME_SIZE_MIN; |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 35 | static const ssize_t SIGNATURE; |
36 | static const ssize_t KEY_LOCATOR; | ||||
37 | static const ssize_t TIMESTAMP; | ||||
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 38 | static const ssize_t INVITER_CERT; |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 39 | static const ssize_t INVITER_PREFIX; |
40 | static const ssize_t CHATROOM; | ||||
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 41 | static const ssize_t CHRONOCHAT_INVITATION; |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 42 | |
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame] | 43 | class Error : public std::runtime_error |
44 | { | ||||
45 | public: | ||||
46 | Error(const std::string& what) | ||||
47 | : std::runtime_error(what) | ||||
48 | { | ||||
49 | } | ||||
50 | }; | ||||
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 51 | |
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame] | 52 | Invitation() |
53 | { | ||||
54 | } | ||||
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 55 | |
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame] | 56 | Invitation(const Name& interestName); |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 57 | |
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame] | 58 | Invitation(const Name& inviteeNameSpace, |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 59 | const std::string& chatroom, |
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame] | 60 | const Name& inviterRoutingPrefix, |
Varun Patil | 3d85090 | 2020-11-23 12:19:14 +0530 | [diff] [blame] | 61 | const ndn::security::Certificate& inviterCertificate); |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 62 | |
63 | Invitation(const Invitation& invitation); | ||||
64 | |||||
65 | virtual | ||||
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame] | 66 | ~Invitation() |
67 | { | ||||
68 | } | ||||
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 69 | |
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame] | 70 | const Name& |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 71 | getInviteeNameSpace() const |
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame] | 72 | { |
73 | return m_inviteeNameSpace; | ||||
74 | } | ||||
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 75 | |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 76 | const std::string& |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 77 | getChatroom() const |
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame] | 78 | { |
79 | return m_chatroom; | ||||
80 | } | ||||
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 81 | |
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame] | 82 | const Name& |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 83 | getInviterRoutingPrefix() const |
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame] | 84 | { |
85 | return m_inviterRoutingPrefix; | ||||
86 | } | ||||
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 87 | |
Varun Patil | 3d85090 | 2020-11-23 12:19:14 +0530 | [diff] [blame] | 88 | const ndn::security::Certificate& |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 89 | getInviterCertificate() const |
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame] | 90 | { |
91 | return m_inviterCertificate; | ||||
92 | } | ||||
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 93 | |
Varun Patil | a24bd3e | 2020-11-24 10:08:33 +0530 | [diff] [blame^] | 94 | uint64_t |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 95 | getTimestamp() const |
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame] | 96 | { |
97 | return m_timestamp; | ||||
98 | } | ||||
Yingdi Yu | fa0b6a0 | 2014-04-30 14:26:42 -0700 | [diff] [blame] | 99 | |
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame] | 100 | const Name& |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 101 | getUnsignedInterestName() const |
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame] | 102 | { |
103 | return m_interestName; | ||||
104 | } | ||||
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 105 | |
106 | private: | ||||
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame] | 107 | Name m_interestName; |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 108 | |
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame] | 109 | Name m_inviteeNameSpace; |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 110 | std::string m_chatroom; |
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame] | 111 | Name m_inviterRoutingPrefix; |
Varun Patil | 3d85090 | 2020-11-23 12:19:14 +0530 | [diff] [blame] | 112 | ndn::security::Certificate m_inviterCertificate; |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 113 | uint64_t m_timestamp; |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 114 | }; |
115 | |||||
Yingdi Yu | eb692ac | 2015-02-10 18:46:18 -0800 | [diff] [blame] | 116 | } // namespace chronochat |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 117 | |
Yingdi Yu | eb692ac | 2015-02-10 18:46:18 -0800 | [diff] [blame] | 118 | #endif // CHRONOCHAT_INVITATION_HPP |