123

Dependencies:   MQTTSN

Committer:
m_ahsan
Date:
Tue Aug 06 05:32:43 2019 +0000
Revision:
15:8c473836feba
123

Who changed what in which revision?

UserRevisionLine numberNew contents of line
m_ahsan 15:8c473836feba 1 #pragma once
m_ahsan 15:8c473836feba 2 #include <string>
m_ahsan 15:8c473836feba 3
m_ahsan 15:8c473836feba 4
m_ahsan 15:8c473836feba 5 using namespace std;
m_ahsan 15:8c473836feba 6
m_ahsan 15:8c473836feba 7 extern int ty, op, cst, rsc;
m_ahsan 15:8c473836feba 8 extern std::string resourceType, cseType, operation, content, response;
m_ahsan 15:8c473836feba 9 extern bool RequestReachability;
m_ahsan 15:8c473836feba 10 extern bool rr, local;
m_ahsan 15:8c473836feba 11 extern std::string From, csi, api, poa, to, rqi, aei, rn;
m_ahsan 15:8c473836feba 12 extern char URI[40];
m_ahsan 15:8c473836feba 13 extern char* c_aei;
m_ahsan 15:8c473836feba 14 extern std::string con, cnf;
m_ahsan 15:8c473836feba 15 extern std::string nu;
m_ahsan 15:8c473836feba 16 extern std::string sur;
m_ahsan 15:8c473836feba 17 extern int net, nct;
m_ahsan 15:8c473836feba 18
m_ahsan 15:8c473836feba 19 extern void resource_type();
m_ahsan 15:8c473836feba 20 extern void Operation_Type();
m_ahsan 15:8c473836feba 21 extern void Response_Type();
m_ahsan 15:8c473836feba 22 extern void CSE_Type();
m_ahsan 15:8c473836feba 23
m_ahsan 15:8c473836feba 24
m_ahsan 15:8c473836feba 25 struct Resource
m_ahsan 15:8c473836feba 26 {
m_ahsan 15:8c473836feba 27 string resourceName; //rn 1
m_ahsan 15:8c473836feba 28 int Resource_Type; //ty 1
m_ahsan 15:8c473836feba 29 string resourceID; //ri 1
m_ahsan 15:8c473836feba 30 string parentID; //pi 1
m_ahsan 15:8c473836feba 31 string creationTime; //ct 1
m_ahsan 15:8c473836feba 32 string lastModifiedTime; //lt 1
m_ahsan 15:8c473836feba 33 string labels; // 0-1
m_ahsan 15:8c473836feba 34 };
m_ahsan 15:8c473836feba 35
m_ahsan 15:8c473836feba 36 struct regularResource
m_ahsan 15:8c473836feba 37 {
m_ahsan 15:8c473836feba 38 //struct RES;
m_ahsan 15:8c473836feba 39 string accessControlPolicyIDs; //
m_ahsan 15:8c473836feba 40 string expirationTime; //et 1
m_ahsan 15:8c473836feba 41 string dynamicAuthorizationConsultationIDs; //
m_ahsan 15:8c473836feba 42 };
m_ahsan 15:8c473836feba 43
m_ahsan 15:8c473836feba 44 struct announceableResource
m_ahsan 15:8c473836feba 45 {
m_ahsan 15:8c473836feba 46 //struct regRES;
m_ahsan 15:8c473836feba 47 string announceTo; //
m_ahsan 15:8c473836feba 48 string announcedAttribute; //
m_ahsan 15:8c473836feba 49 };
m_ahsan 15:8c473836feba 50
m_ahsan 15:8c473836feba 51 struct announcedResource
m_ahsan 15:8c473836feba 52 {
m_ahsan 15:8c473836feba 53 //struct RES;
m_ahsan 15:8c473836feba 54 string accessControlPolicyIDs; // 1
m_ahsan 15:8c473836feba 55 string expirationTime; //et 1
m_ahsan 15:8c473836feba 56 string link; // 1
m_ahsan 15:8c473836feba 57 string dynamicAuthorizationConsultationIDs; // 0-1
m_ahsan 15:8c473836feba 58 };
m_ahsan 15:8c473836feba 59
m_ahsan 15:8c473836feba 60 struct subordinateResource
m_ahsan 15:8c473836feba 61 {
m_ahsan 15:8c473836feba 62 //struct RES;
m_ahsan 15:8c473836feba 63 string expirationTime; //et 1
m_ahsan 15:8c473836feba 64 };
m_ahsan 15:8c473836feba 65
m_ahsan 15:8c473836feba 66 struct announceableSubordinateResource
m_ahsan 15:8c473836feba 67 {
m_ahsan 15:8c473836feba 68 //struct RES;
m_ahsan 15:8c473836feba 69 string expirationTime; //et 1
m_ahsan 15:8c473836feba 70 string announceTo; // 0-1
m_ahsan 15:8c473836feba 71 string announcedAttribute; // 0-1
m_ahsan 15:8c473836feba 72 };
m_ahsan 15:8c473836feba 73
m_ahsan 15:8c473836feba 74 struct announcedSubordinateResource
m_ahsan 15:8c473836feba 75 {
m_ahsan 15:8c473836feba 76 //struct RES;
m_ahsan 15:8c473836feba 77 string expirationTime; //et 1
m_ahsan 15:8c473836feba 78 string link; // 1
m_ahsan 15:8c473836feba 79 };
m_ahsan 15:8c473836feba 80
m_ahsan 15:8c473836feba 81 class Response
m_ahsan 15:8c473836feba 82 {
m_ahsan 15:8c473836feba 83 public:
m_ahsan 15:8c473836feba 84 int responseStatusCode;
m_ahsan 15:8c473836feba 85 string Request_Identifier;
m_ahsan 15:8c473836feba 86 string To;
m_ahsan 15:8c473836feba 87 string From;
m_ahsan 15:8c473836feba 88 int releaseVersion;
m_ahsan 15:8c473836feba 89 };
m_ahsan 15:8c473836feba 90
m_ahsan 15:8c473836feba 91 class Request{
m_ahsan 15:8c473836feba 92 public:
m_ahsan 15:8c473836feba 93 int Operation;
m_ahsan 15:8c473836feba 94 string To;
m_ahsan 15:8c473836feba 95 string From;
m_ahsan 15:8c473836feba 96 string Request_Identifier;
m_ahsan 15:8c473836feba 97 int Resource_Type;
m_ahsan 15:8c473836feba 98 };
m_ahsan 15:8c473836feba 99
m_ahsan 15:8c473836feba 100 struct CreateAE
m_ahsan 15:8c473836feba 101 {
m_ahsan 15:8c473836feba 102 string resourceName;
m_ahsan 15:8c473836feba 103 string App_ID;
m_ahsan 15:8c473836feba 104 string pointOfAccess;
m_ahsan 15:8c473836feba 105 bool requestReachability;
m_ahsan 15:8c473836feba 106 };
m_ahsan 15:8c473836feba 107
m_ahsan 15:8c473836feba 108 struct CreateCIN
m_ahsan 15:8c473836feba 109 {
m_ahsan 15:8c473836feba 110 string resourceName; //rn
m_ahsan 15:8c473836feba 111 string contentInfo; //cnf
m_ahsan 15:8c473836feba 112 string content; //con
m_ahsan 15:8c473836feba 113 };
m_ahsan 15:8c473836feba 114
m_ahsan 15:8c473836feba 115 struct CreateSub
m_ahsan 15:8c473836feba 116 {
m_ahsan 15:8c473836feba 117 string resourceName; //rn
m_ahsan 15:8c473836feba 118 string notificationURI; //nu
m_ahsan 15:8c473836feba 119 int notificationContentType; //nct
m_ahsan 15:8c473836feba 120 int notificationEventType; //net
m_ahsan 15:8c473836feba 121 };
m_ahsan 15:8c473836feba 122
m_ahsan 15:8c473836feba 123 struct respAE
m_ahsan 15:8c473836feba 124 {
m_ahsan 15:8c473836feba 125 string App_ID;
m_ahsan 15:8c473836feba 126 bool requestReachability;
m_ahsan 15:8c473836feba 127 string AE_ID;
m_ahsan 15:8c473836feba 128 string pointOfAccess;
m_ahsan 15:8c473836feba 129 };
m_ahsan 15:8c473836feba 130
m_ahsan 15:8c473836feba 131 struct respCnt
m_ahsan 15:8c473836feba 132 {
m_ahsan 15:8c473836feba 133 int stateTag;
m_ahsan 15:8c473836feba 134 int CurrentNrOfInstances;
m_ahsan 15:8c473836feba 135 int CurrentByteSize;
m_ahsan 15:8c473836feba 136 };
m_ahsan 15:8c473836feba 137 struct respCin
m_ahsan 15:8c473836feba 138 {
m_ahsan 15:8c473836feba 139 string contentInfo;
m_ahsan 15:8c473836feba 140 int contentSize;
m_ahsan 15:8c473836feba 141 int stateTag;
m_ahsan 15:8c473836feba 142 string content;
m_ahsan 15:8c473836feba 143 };
m_ahsan 15:8c473836feba 144
m_ahsan 15:8c473836feba 145 struct respSub
m_ahsan 15:8c473836feba 146 {
m_ahsan 15:8c473836feba 147 string notificationURI;
m_ahsan 15:8c473836feba 148 int notificationContentType;
m_ahsan 15:8c473836feba 149 int notificationEventType;
m_ahsan 15:8c473836feba 150 };
m_ahsan 15:8c473836feba 151
m_ahsan 15:8c473836feba 152 const char* Create_Req(Request Req);
m_ahsan 15:8c473836feba 153
m_ahsan 15:8c473836feba 154 const char* Delete_Req(Request Req);
m_ahsan 15:8c473836feba 155
m_ahsan 15:8c473836feba 156 const char* Create_Resp(Response Resp);
m_ahsan 15:8c473836feba 157
m_ahsan 15:8c473836feba 158 const char* Notify_Resp(Response Resp);
m_ahsan 15:8c473836feba 159
m_ahsan 15:8c473836feba 160 void process_msg(const char* Buffer);