Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 1 | /* -*- 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 Yu | fa0b6a0 | 2014-04-30 14:26:42 -0700 | [diff] [blame^] | 15 | #include <ndn-cxx/name.hpp> |
| 16 | #include <ndn-cxx/signature.hpp> |
| 17 | #include <ndn-cxx/security/identity-certificate.hpp> |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 18 | |
| 19 | namespace chronos{ |
| 20 | |
| 21 | class Invitation |
| 22 | { |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 23 | 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 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 | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 43 | 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 Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 49 | Invitation(const ndn::Name& inviteeNameSpace, |
| 50 | const std::string& chatroom, |
| 51 | const ndn::Name& inviterRoutingPrefix, |
| 52 | const ndn::IdentityCertificate& inviterCertificate); |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 53 | |
| 54 | Invitation(const Invitation& invitation); |
| 55 | |
| 56 | virtual |
| 57 | ~Invitation() {}; |
| 58 | |
| 59 | const ndn::Name& |
| 60 | getInviteeNameSpace() const |
| 61 | { return m_inviteeNameSpace; } |
| 62 | |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 63 | const std::string& |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 64 | getChatroom() const |
| 65 | { return m_chatroom; } |
| 66 | |
| 67 | const ndn::Name& |
| 68 | getInviterRoutingPrefix() const |
| 69 | { return m_inviterRoutingPrefix; } |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 70 | |
| 71 | const ndn::IdentityCertificate& |
| 72 | getInviterCertificate() const |
| 73 | { return m_inviterCertificate; } |
| 74 | |
| 75 | const uint64_t |
| 76 | getTimestamp() const |
| 77 | { return m_timestamp; } |
Yingdi Yu | fa0b6a0 | 2014-04-30 14:26:42 -0700 | [diff] [blame^] | 78 | |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 79 | const ndn::Name& |
| 80 | getUnsignedInterestName() const |
| 81 | { return m_interestName; } |
| 82 | |
| 83 | private: |
| 84 | ndn::Name m_interestName; |
| 85 | |
| 86 | ndn::Name m_inviteeNameSpace; |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 87 | std::string m_chatroom; |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 88 | ndn::Name m_inviterRoutingPrefix; |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 89 | ndn::IdentityCertificate m_inviterCertificate; |
| 90 | uint64_t m_timestamp; |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 91 | }; |
| 92 | |
| 93 | }//chronos |
| 94 | |
| 95 | #endif |