Skip to content

Commit 801cfde

Browse files
committed
cm: cloudprotocol: update provisioning messages
Signed-off-by: Oleksandr Grytsov <[email protected]>
1 parent 96ab698 commit 801cfde

File tree

1 file changed

+53
-53
lines changed

1 file changed

+53
-53
lines changed

src/core/cm/cloudprotocol/provisioning.hpp

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -14,120 +14,120 @@
1414
namespace aos::cloudprotocol {
1515

1616
/**
17-
* StartProvisioningRequest message.
17+
* CSR info.
1818
*/
19-
struct StartProvisioningRequest {
20-
Identity mNodeID;
21-
StaticString<cCertSecretSize> mPassword;
19+
struct CSRInfo {
20+
CertType mType;
21+
StaticString<crypto::cCSRPEMLen> mCSR;
2222

2323
/**
24-
* Compares start provisioning request.
24+
* Compares CSR info.
2525
*
26-
* @param other object to compare with.
26+
* @param other CSR info to compare with.
2727
* @return bool.
2828
*/
29-
bool operator==(const StartProvisioningRequest& other) const
30-
{
31-
return mNodeID == other.mNodeID && mPassword == other.mPassword;
32-
}
29+
bool operator==(const CSRInfo& other) const { return mType == other.mType && mCSR == other.mCSR; }
3330

3431
/**
35-
* Compares start provisioning request.
32+
* Compares CSR info.
3633
*
37-
* @param other object to compare with.
34+
* @param other CSR info to compare with.
3835
* @return bool.
3936
*/
40-
bool operator!=(const StartProvisioningRequest& other) const { return !operator==(other); }
37+
bool operator!=(const CSRInfo& other) const { return !operator==(other); }
4138
};
4239

40+
using CSRInfoArray = StaticArray<CSRInfo, cCertsPerNodeCount>;
41+
4342
/**
44-
* CSR info.
43+
* Certificate info.
4544
*/
46-
struct CSRInfo {
47-
CertType mType;
48-
StaticString<crypto::cCSRPEMLen> mCsr;
45+
struct CertInfo {
46+
CertType mCertType;
47+
StaticString<crypto::cCertChainPEMLen> mCertChain;
4948

5049
/**
51-
* Compares CSR info.
50+
* Compares certificate info.
5251
*
53-
* @param other CSR info to compare with.
52+
* @param other object to compare with.
5453
* @return bool.
5554
*/
56-
bool operator==(const CSRInfo& other) const { return mType == other.mType && mCsr == other.mCsr; }
55+
bool operator==(const CertInfo& other) const
56+
{
57+
return mCertType == other.mCertType && mCertChain == other.mCertChain;
58+
}
5759

5860
/**
59-
* Compares CSR info.
61+
* Compares certificate info.
6062
*
61-
* @param other CSR info to compare with.
63+
* @param other object to compare with.
6264
* @return bool.
6365
*/
64-
bool operator!=(const CSRInfo& other) const { return !operator==(other); }
66+
bool operator!=(const CertInfo& other) const { return !operator==(other); }
6567
};
6668

67-
using CSRInfoArray = StaticArray<CSRInfo, cCertsPerNodeCount>;
69+
using CertInfoArray = StaticArray<CertInfo, cCertsPerNodeCount>;
6870

6971
/**
70-
* StartProvisioningResponse message.
72+
* Start provisioning request.
7173
*/
72-
struct StartProvisioningResponse {
73-
Identity mNodeID;
74-
Error mError;
75-
CSRInfoArray mCSRs;
74+
struct StartProvisioningRequest {
75+
Identity mNode;
76+
StaticString<cCertSecretSize> mPassword;
7677

7778
/**
78-
* Compares start provisioning response.
79+
* Compares start provisioning request.
7980
*
8081
* @param other object to compare with.
8182
* @return bool.
8283
*/
83-
bool operator==(const StartProvisioningResponse& other) const
84+
bool operator==(const StartProvisioningRequest& other) const
8485
{
85-
return mNodeID == other.mNodeID && mError == other.mError && mCSRs == other.mCSRs;
86+
return mNode == other.mNode && mPassword == other.mPassword;
8687
}
8788

8889
/**
89-
* Compares start provisioning response.
90+
* Compares start provisioning request.
9091
*
9192
* @param other object to compare with.
9293
* @return bool.
9394
*/
94-
bool operator!=(const StartProvisioningResponse& other) const { return !operator==(other); }
95+
bool operator!=(const StartProvisioningRequest& other) const { return !operator==(other); }
9596
};
9697

9798
/**
98-
* Certificate info.
99+
* Start provisioning response.
99100
*/
100-
struct CertInfo {
101-
CertType mType;
102-
StaticString<crypto::cCertChainPEMLen> mCertificateChain;
101+
struct StartProvisioningResponse {
102+
Identity mNode;
103+
CSRInfoArray mCSRs;
104+
Error mError;
103105

104106
/**
105-
* Compares certificate info.
107+
* Compares start provisioning response.
106108
*
107109
* @param other object to compare with.
108110
* @return bool.
109111
*/
110-
bool operator==(const CertInfo& other) const
112+
bool operator==(const StartProvisioningResponse& other) const
111113
{
112-
return mType == other.mType && mCertificateChain == other.mCertificateChain;
114+
return mNode == other.mNode && mCSRs == other.mCSRs && mError == other.mError;
113115
}
114116

115117
/**
116-
* Compares certificate info.
118+
* Compares start provisioning response.
117119
*
118120
* @param other object to compare with.
119121
* @return bool.
120122
*/
121-
bool operator!=(const CertInfo& other) const { return !operator==(other); }
123+
bool operator!=(const StartProvisioningResponse& other) const { return !operator==(other); }
122124
};
123125

124-
using CertInfoArray = StaticArray<CertInfo, cCertsPerNodeCount>;
125-
126126
/**
127127
* FinishProvisioningRequest message.
128128
*/
129129
struct FinishProvisioningRequest {
130-
Identity mNodeID;
130+
Identity mNode;
131131
CertInfoArray mCertificates;
132132
StaticString<cCertSecretSize> mPassword;
133133

@@ -139,7 +139,7 @@ struct FinishProvisioningRequest {
139139
*/
140140
bool operator==(const FinishProvisioningRequest& other) const
141141
{
142-
return mNodeID == other.mNodeID && mCertificates == other.mCertificates && mPassword == other.mPassword;
142+
return mNode == other.mNode && mCertificates == other.mCertificates && mPassword == other.mPassword;
143143
}
144144

145145
/**
@@ -155,7 +155,7 @@ struct FinishProvisioningRequest {
155155
* FinishProvisioningResponse message.
156156
*/
157157
struct FinishProvisioningResponse {
158-
Identity mNodeID;
158+
Identity mNode;
159159
Error mError;
160160

161161
/**
@@ -166,7 +166,7 @@ struct FinishProvisioningResponse {
166166
*/
167167
bool operator==(const FinishProvisioningResponse& other) const
168168
{
169-
return mNodeID == other.mNodeID && mError == other.mError;
169+
return mNode == other.mNode && mError == other.mError;
170170
}
171171

172172
/**
@@ -182,7 +182,7 @@ struct FinishProvisioningResponse {
182182
* DeprovisioningRequest message.
183183
*/
184184
struct DeprovisioningRequest {
185-
Identity mNodeID;
185+
Identity mNode;
186186
StaticString<cCertSecretSize> mPassword;
187187

188188
/**
@@ -193,7 +193,7 @@ struct DeprovisioningRequest {
193193
*/
194194
bool operator==(const DeprovisioningRequest& other) const
195195
{
196-
return mNodeID == other.mNodeID && mPassword == other.mPassword;
196+
return mNode == other.mNode && mPassword == other.mPassword;
197197
}
198198

199199
/**
@@ -209,7 +209,7 @@ struct DeprovisioningRequest {
209209
* DeprovisioningRequest message.
210210
*/
211211
struct DeprovisioningResponse {
212-
Identity mNodeID;
212+
Identity mNode;
213213
Error mError;
214214

215215
/**
@@ -220,7 +220,7 @@ struct DeprovisioningResponse {
220220
*/
221221
bool operator==(const DeprovisioningResponse& other) const
222222
{
223-
return mNodeID == other.mNodeID && mError == other.mError;
223+
return mNode == other.mNode && mError == other.mError;
224224
}
225225

226226
/**

0 commit comments

Comments
 (0)