self_msgproto 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/self_msgproto/msgproto/message_generated.h +18 -4
- data/ext/self_msgproto/msgproto/status_generated.h +149 -0
- data/ext/self_msgproto/msgproto/types_generated.h +21 -49
- data/ext/self_msgproto/msgproto/watch_generated.h +137 -0
- data/ext/self_msgproto/self_msgproto.cpp +0 -2
- data/lib/self_msgproto/version.rb +1 -1
- data/lib/self_msgproto.rb +2 -6
- metadata +9 -12
- data/ext/self_msgproto/acl.cpp +0 -133
- data/ext/self_msgproto/msgproto/acl_generated.h +0 -137
- data/lib/self_msgproto/acl.rb +0 -9
- data/test/unit/test_acl.rb +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0baf544ea5fe7c0ad5637477ab27b796e72beed265becd71c1c818bf1833b78c
|
4
|
+
data.tar.gz: 78c6d570bd15dd6a3d226330c75dacada63a9a2f43cb1047e37a09d81780345a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e75f88b0a97c4c77227df0a7a45719a0cdd5afbdc6a007561e690ad104dfec6a3f08b1b7219e90dcc73c2051eaff3c833ed5b60dbc8bf803c89ed41ff5eb7e7d
|
7
|
+
data.tar.gz: 1aeb9e4cfc1deb833dbbd14ed10e4f0caa782dc20cf24f212fe3947f17e9d8e3fa581dda4b9e88dbb281cc1c743bdb2c2ad4d568614b2a10da8cf87227502e7d
|
@@ -51,7 +51,8 @@ struct Message FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
|
51
51
|
VT_PRIORITY = 20,
|
52
52
|
VT_MESSAGE_TYPE = 22,
|
53
53
|
VT_COLLAPSE_KEY = 24,
|
54
|
-
VT_NOTIFICATION_PAYLOAD = 26
|
54
|
+
VT_NOTIFICATION_PAYLOAD = 26,
|
55
|
+
VT_AUTHORIZATION = 28
|
55
56
|
};
|
56
57
|
const flatbuffers::String *id() const {
|
57
58
|
return GetPointer<const flatbuffers::String *>(VT_ID);
|
@@ -86,6 +87,9 @@ struct Message FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
|
86
87
|
const flatbuffers::Vector<uint8_t> *notification_payload() const {
|
87
88
|
return GetPointer<const flatbuffers::Vector<uint8_t> *>(VT_NOTIFICATION_PAYLOAD);
|
88
89
|
}
|
90
|
+
const flatbuffers::Vector<uint8_t> *authorization() const {
|
91
|
+
return GetPointer<const flatbuffers::Vector<uint8_t> *>(VT_AUTHORIZATION);
|
92
|
+
}
|
89
93
|
bool Verify(flatbuffers::Verifier &verifier) const {
|
90
94
|
return VerifyTableStart(verifier) &&
|
91
95
|
VerifyOffset(verifier, VT_ID) &&
|
@@ -106,6 +110,8 @@ struct Message FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
|
106
110
|
verifier.VerifyVector(collapse_key()) &&
|
107
111
|
VerifyOffset(verifier, VT_NOTIFICATION_PAYLOAD) &&
|
108
112
|
verifier.VerifyVector(notification_payload()) &&
|
113
|
+
VerifyOffset(verifier, VT_AUTHORIZATION) &&
|
114
|
+
verifier.VerifyVector(authorization()) &&
|
109
115
|
verifier.EndTable();
|
110
116
|
}
|
111
117
|
};
|
@@ -147,6 +153,9 @@ struct MessageBuilder {
|
|
147
153
|
void add_notification_payload(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> notification_payload) {
|
148
154
|
fbb_.AddOffset(Message::VT_NOTIFICATION_PAYLOAD, notification_payload);
|
149
155
|
}
|
156
|
+
void add_authorization(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> authorization) {
|
157
|
+
fbb_.AddOffset(Message::VT_AUTHORIZATION, authorization);
|
158
|
+
}
|
150
159
|
explicit MessageBuilder(flatbuffers::FlatBufferBuilder &_fbb)
|
151
160
|
: fbb_(_fbb) {
|
152
161
|
start_ = fbb_.StartTable();
|
@@ -171,8 +180,10 @@ inline flatbuffers::Offset<Message> CreateMessage(
|
|
171
180
|
uint32_t priority = 0,
|
172
181
|
flatbuffers::Offset<flatbuffers::Vector<uint8_t>> message_type = 0,
|
173
182
|
flatbuffers::Offset<flatbuffers::Vector<uint8_t>> collapse_key = 0,
|
174
|
-
flatbuffers::Offset<flatbuffers::Vector<uint8_t>> notification_payload = 0
|
183
|
+
flatbuffers::Offset<flatbuffers::Vector<uint8_t>> notification_payload = 0,
|
184
|
+
flatbuffers::Offset<flatbuffers::Vector<uint8_t>> authorization = 0) {
|
175
185
|
MessageBuilder builder_(_fbb);
|
186
|
+
builder_.add_authorization(authorization);
|
176
187
|
builder_.add_notification_payload(notification_payload);
|
177
188
|
builder_.add_collapse_key(collapse_key);
|
178
189
|
builder_.add_message_type(message_type);
|
@@ -199,7 +210,8 @@ inline flatbuffers::Offset<Message> CreateMessageDirect(
|
|
199
210
|
uint32_t priority = 0,
|
200
211
|
const std::vector<uint8_t> *message_type = nullptr,
|
201
212
|
const std::vector<uint8_t> *collapse_key = nullptr,
|
202
|
-
const std::vector<uint8_t> *notification_payload = nullptr
|
213
|
+
const std::vector<uint8_t> *notification_payload = nullptr,
|
214
|
+
const std::vector<uint8_t> *authorization = nullptr) {
|
203
215
|
auto id__ = id ? _fbb.CreateString(id) : 0;
|
204
216
|
auto sender__ = sender ? _fbb.CreateString(sender) : 0;
|
205
217
|
auto recipient__ = recipient ? _fbb.CreateString(recipient) : 0;
|
@@ -207,6 +219,7 @@ inline flatbuffers::Offset<Message> CreateMessageDirect(
|
|
207
219
|
auto message_type__ = message_type ? _fbb.CreateVector<uint8_t>(*message_type) : 0;
|
208
220
|
auto collapse_key__ = collapse_key ? _fbb.CreateVector<uint8_t>(*collapse_key) : 0;
|
209
221
|
auto notification_payload__ = notification_payload ? _fbb.CreateVector<uint8_t>(*notification_payload) : 0;
|
222
|
+
auto authorization__ = authorization ? _fbb.CreateVector<uint8_t>(*authorization) : 0;
|
210
223
|
return SelfMessaging::CreateMessage(
|
211
224
|
_fbb,
|
212
225
|
id__,
|
@@ -219,7 +232,8 @@ inline flatbuffers::Offset<Message> CreateMessageDirect(
|
|
219
232
|
priority,
|
220
233
|
message_type__,
|
221
234
|
collapse_key__,
|
222
|
-
notification_payload__
|
235
|
+
notification_payload__,
|
236
|
+
authorization__);
|
223
237
|
}
|
224
238
|
|
225
239
|
inline const SelfMessaging::Message *GetMessage(const void *buf) {
|
@@ -0,0 +1,149 @@
|
|
1
|
+
// automatically generated by the FlatBuffers compiler, do not modify
|
2
|
+
|
3
|
+
|
4
|
+
#ifndef FLATBUFFERS_GENERATED_STATUS_SELFMESSAGING_H_
|
5
|
+
#define FLATBUFFERS_GENERATED_STATUS_SELFMESSAGING_H_
|
6
|
+
|
7
|
+
#include "flatbuffers/flatbuffers.h"
|
8
|
+
|
9
|
+
#include "types_generated.h"
|
10
|
+
|
11
|
+
namespace SelfMessaging {
|
12
|
+
|
13
|
+
struct Status;
|
14
|
+
struct StatusBuilder;
|
15
|
+
|
16
|
+
struct Status FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
17
|
+
typedef StatusBuilder Builder;
|
18
|
+
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
19
|
+
VT_ID = 4,
|
20
|
+
VT_MSGTYPE = 6,
|
21
|
+
VT_RECIPIENT = 8,
|
22
|
+
VT_ONLINE = 10,
|
23
|
+
VT_LAST_SEEN = 12
|
24
|
+
};
|
25
|
+
const flatbuffers::String *id() const {
|
26
|
+
return GetPointer<const flatbuffers::String *>(VT_ID);
|
27
|
+
}
|
28
|
+
SelfMessaging::MsgType msgtype() const {
|
29
|
+
return static_cast<SelfMessaging::MsgType>(GetField<int8_t>(VT_MSGTYPE, 0));
|
30
|
+
}
|
31
|
+
const flatbuffers::String *recipient() const {
|
32
|
+
return GetPointer<const flatbuffers::String *>(VT_RECIPIENT);
|
33
|
+
}
|
34
|
+
bool online() const {
|
35
|
+
return GetField<uint8_t>(VT_ONLINE, 0) != 0;
|
36
|
+
}
|
37
|
+
int64_t last_seen() const {
|
38
|
+
return GetField<int64_t>(VT_LAST_SEEN, 0);
|
39
|
+
}
|
40
|
+
bool Verify(flatbuffers::Verifier &verifier) const {
|
41
|
+
return VerifyTableStart(verifier) &&
|
42
|
+
VerifyOffset(verifier, VT_ID) &&
|
43
|
+
verifier.VerifyString(id()) &&
|
44
|
+
VerifyField<int8_t>(verifier, VT_MSGTYPE) &&
|
45
|
+
VerifyOffset(verifier, VT_RECIPIENT) &&
|
46
|
+
verifier.VerifyString(recipient()) &&
|
47
|
+
VerifyField<uint8_t>(verifier, VT_ONLINE) &&
|
48
|
+
VerifyField<int64_t>(verifier, VT_LAST_SEEN) &&
|
49
|
+
verifier.EndTable();
|
50
|
+
}
|
51
|
+
};
|
52
|
+
|
53
|
+
struct StatusBuilder {
|
54
|
+
typedef Status Table;
|
55
|
+
flatbuffers::FlatBufferBuilder &fbb_;
|
56
|
+
flatbuffers::uoffset_t start_;
|
57
|
+
void add_id(flatbuffers::Offset<flatbuffers::String> id) {
|
58
|
+
fbb_.AddOffset(Status::VT_ID, id);
|
59
|
+
}
|
60
|
+
void add_msgtype(SelfMessaging::MsgType msgtype) {
|
61
|
+
fbb_.AddElement<int8_t>(Status::VT_MSGTYPE, static_cast<int8_t>(msgtype), 0);
|
62
|
+
}
|
63
|
+
void add_recipient(flatbuffers::Offset<flatbuffers::String> recipient) {
|
64
|
+
fbb_.AddOffset(Status::VT_RECIPIENT, recipient);
|
65
|
+
}
|
66
|
+
void add_online(bool online) {
|
67
|
+
fbb_.AddElement<uint8_t>(Status::VT_ONLINE, static_cast<uint8_t>(online), 0);
|
68
|
+
}
|
69
|
+
void add_last_seen(int64_t last_seen) {
|
70
|
+
fbb_.AddElement<int64_t>(Status::VT_LAST_SEEN, last_seen, 0);
|
71
|
+
}
|
72
|
+
explicit StatusBuilder(flatbuffers::FlatBufferBuilder &_fbb)
|
73
|
+
: fbb_(_fbb) {
|
74
|
+
start_ = fbb_.StartTable();
|
75
|
+
}
|
76
|
+
flatbuffers::Offset<Status> Finish() {
|
77
|
+
const auto end = fbb_.EndTable(start_);
|
78
|
+
auto o = flatbuffers::Offset<Status>(end);
|
79
|
+
return o;
|
80
|
+
}
|
81
|
+
};
|
82
|
+
|
83
|
+
inline flatbuffers::Offset<Status> CreateStatus(
|
84
|
+
flatbuffers::FlatBufferBuilder &_fbb,
|
85
|
+
flatbuffers::Offset<flatbuffers::String> id = 0,
|
86
|
+
SelfMessaging::MsgType msgtype = SelfMessaging::MsgType_MSG,
|
87
|
+
flatbuffers::Offset<flatbuffers::String> recipient = 0,
|
88
|
+
bool online = false,
|
89
|
+
int64_t last_seen = 0) {
|
90
|
+
StatusBuilder builder_(_fbb);
|
91
|
+
builder_.add_last_seen(last_seen);
|
92
|
+
builder_.add_recipient(recipient);
|
93
|
+
builder_.add_id(id);
|
94
|
+
builder_.add_online(online);
|
95
|
+
builder_.add_msgtype(msgtype);
|
96
|
+
return builder_.Finish();
|
97
|
+
}
|
98
|
+
|
99
|
+
inline flatbuffers::Offset<Status> CreateStatusDirect(
|
100
|
+
flatbuffers::FlatBufferBuilder &_fbb,
|
101
|
+
const char *id = nullptr,
|
102
|
+
SelfMessaging::MsgType msgtype = SelfMessaging::MsgType_MSG,
|
103
|
+
const char *recipient = nullptr,
|
104
|
+
bool online = false,
|
105
|
+
int64_t last_seen = 0) {
|
106
|
+
auto id__ = id ? _fbb.CreateString(id) : 0;
|
107
|
+
auto recipient__ = recipient ? _fbb.CreateString(recipient) : 0;
|
108
|
+
return SelfMessaging::CreateStatus(
|
109
|
+
_fbb,
|
110
|
+
id__,
|
111
|
+
msgtype,
|
112
|
+
recipient__,
|
113
|
+
online,
|
114
|
+
last_seen);
|
115
|
+
}
|
116
|
+
|
117
|
+
inline const SelfMessaging::Status *GetStatus(const void *buf) {
|
118
|
+
return flatbuffers::GetRoot<SelfMessaging::Status>(buf);
|
119
|
+
}
|
120
|
+
|
121
|
+
inline const SelfMessaging::Status *GetSizePrefixedStatus(const void *buf) {
|
122
|
+
return flatbuffers::GetSizePrefixedRoot<SelfMessaging::Status>(buf);
|
123
|
+
}
|
124
|
+
|
125
|
+
inline bool VerifyStatusBuffer(
|
126
|
+
flatbuffers::Verifier &verifier) {
|
127
|
+
return verifier.VerifyBuffer<SelfMessaging::Status>(nullptr);
|
128
|
+
}
|
129
|
+
|
130
|
+
inline bool VerifySizePrefixedStatusBuffer(
|
131
|
+
flatbuffers::Verifier &verifier) {
|
132
|
+
return verifier.VerifySizePrefixedBuffer<SelfMessaging::Status>(nullptr);
|
133
|
+
}
|
134
|
+
|
135
|
+
inline void FinishStatusBuffer(
|
136
|
+
flatbuffers::FlatBufferBuilder &fbb,
|
137
|
+
flatbuffers::Offset<SelfMessaging::Status> root) {
|
138
|
+
fbb.Finish(root);
|
139
|
+
}
|
140
|
+
|
141
|
+
inline void FinishSizePrefixedStatusBuffer(
|
142
|
+
flatbuffers::FlatBufferBuilder &fbb,
|
143
|
+
flatbuffers::Offset<SelfMessaging::Status> root) {
|
144
|
+
fbb.FinishSizePrefixed(root);
|
145
|
+
}
|
146
|
+
|
147
|
+
} // namespace SelfMessaging
|
148
|
+
|
149
|
+
#endif // FLATBUFFERS_GENERATED_STATUS_SELFMESSAGING_H_
|
@@ -8,48 +8,15 @@
|
|
8
8
|
|
9
9
|
namespace SelfMessaging {
|
10
10
|
|
11
|
-
enum
|
12
|
-
ACLCommand_LIST = 0,
|
13
|
-
ACLCommand_PERMIT = 1,
|
14
|
-
ACLCommand_REVOKE = 2,
|
15
|
-
ACLCommand_MIN = ACLCommand_LIST,
|
16
|
-
ACLCommand_MAX = ACLCommand_REVOKE
|
17
|
-
};
|
18
|
-
|
19
|
-
inline const ACLCommand (&EnumValuesACLCommand())[3] {
|
20
|
-
static const ACLCommand values[] = {
|
21
|
-
ACLCommand_LIST,
|
22
|
-
ACLCommand_PERMIT,
|
23
|
-
ACLCommand_REVOKE
|
24
|
-
};
|
25
|
-
return values;
|
26
|
-
}
|
27
|
-
|
28
|
-
inline const char * const *EnumNamesACLCommand() {
|
29
|
-
static const char * const names[4] = {
|
30
|
-
"LIST",
|
31
|
-
"PERMIT",
|
32
|
-
"REVOKE",
|
33
|
-
nullptr
|
34
|
-
};
|
35
|
-
return names;
|
36
|
-
}
|
37
|
-
|
38
|
-
inline const char *EnumNameACLCommand(ACLCommand e) {
|
39
|
-
if (flatbuffers::IsOutRange(e, ACLCommand_LIST, ACLCommand_REVOKE)) return "";
|
40
|
-
const size_t index = static_cast<size_t>(e);
|
41
|
-
return EnumNamesACLCommand()[index];
|
42
|
-
}
|
43
|
-
|
44
|
-
enum ErrType {
|
11
|
+
enum ErrType : int8_t {
|
45
12
|
ErrType_ErrConnection = 0,
|
46
13
|
ErrType_ErrBadRequest = 1,
|
47
14
|
ErrType_ErrInternal = 2,
|
48
15
|
ErrType_ErrMessage = 3,
|
49
16
|
ErrType_ErrAuth = 4,
|
50
|
-
|
17
|
+
ErrType_ErrWatch = 6,
|
51
18
|
ErrType_MIN = ErrType_ErrConnection,
|
52
|
-
ErrType_MAX =
|
19
|
+
ErrType_MAX = ErrType_ErrWatch
|
53
20
|
};
|
54
21
|
|
55
22
|
inline const ErrType (&EnumValuesErrType())[6] {
|
@@ -59,70 +26,75 @@ inline const ErrType (&EnumValuesErrType())[6] {
|
|
59
26
|
ErrType_ErrInternal,
|
60
27
|
ErrType_ErrMessage,
|
61
28
|
ErrType_ErrAuth,
|
62
|
-
|
29
|
+
ErrType_ErrWatch
|
63
30
|
};
|
64
31
|
return values;
|
65
32
|
}
|
66
33
|
|
67
34
|
inline const char * const *EnumNamesErrType() {
|
68
|
-
static const char * const names[
|
35
|
+
static const char * const names[8] = {
|
69
36
|
"ErrConnection",
|
70
37
|
"ErrBadRequest",
|
71
38
|
"ErrInternal",
|
72
39
|
"ErrMessage",
|
73
40
|
"ErrAuth",
|
74
|
-
"
|
41
|
+
"",
|
42
|
+
"ErrWatch",
|
75
43
|
nullptr
|
76
44
|
};
|
77
45
|
return names;
|
78
46
|
}
|
79
47
|
|
80
48
|
inline const char *EnumNameErrType(ErrType e) {
|
81
|
-
if (flatbuffers::IsOutRange(e, ErrType_ErrConnection,
|
49
|
+
if (flatbuffers::IsOutRange(e, ErrType_ErrConnection, ErrType_ErrWatch)) return "";
|
82
50
|
const size_t index = static_cast<size_t>(e);
|
83
51
|
return EnumNamesErrType()[index];
|
84
52
|
}
|
85
53
|
|
86
|
-
enum MsgType {
|
54
|
+
enum MsgType : int8_t {
|
87
55
|
MsgType_MSG = 0,
|
88
56
|
MsgType_ACK = 1,
|
89
57
|
MsgType_ERR = 2,
|
90
58
|
MsgType_AUTH = 3,
|
91
|
-
|
59
|
+
MsgType_WTC = 5,
|
60
|
+
MsgType_STS = 6,
|
92
61
|
MsgType_MIN = MsgType_MSG,
|
93
|
-
MsgType_MAX =
|
62
|
+
MsgType_MAX = MsgType_STS
|
94
63
|
};
|
95
64
|
|
96
|
-
inline const MsgType (&EnumValuesMsgType())[
|
65
|
+
inline const MsgType (&EnumValuesMsgType())[6] {
|
97
66
|
static const MsgType values[] = {
|
98
67
|
MsgType_MSG,
|
99
68
|
MsgType_ACK,
|
100
69
|
MsgType_ERR,
|
101
70
|
MsgType_AUTH,
|
102
|
-
|
71
|
+
MsgType_WTC,
|
72
|
+
MsgType_STS
|
103
73
|
};
|
104
74
|
return values;
|
105
75
|
}
|
106
76
|
|
107
77
|
inline const char * const *EnumNamesMsgType() {
|
108
|
-
static const char * const names[
|
78
|
+
static const char * const names[8] = {
|
109
79
|
"MSG",
|
110
80
|
"ACK",
|
111
81
|
"ERR",
|
112
82
|
"AUTH",
|
113
|
-
"
|
83
|
+
"",
|
84
|
+
"WTC",
|
85
|
+
"STS",
|
114
86
|
nullptr
|
115
87
|
};
|
116
88
|
return names;
|
117
89
|
}
|
118
90
|
|
119
91
|
inline const char *EnumNameMsgType(MsgType e) {
|
120
|
-
if (flatbuffers::IsOutRange(e, MsgType_MSG,
|
92
|
+
if (flatbuffers::IsOutRange(e, MsgType_MSG, MsgType_STS)) return "";
|
121
93
|
const size_t index = static_cast<size_t>(e);
|
122
94
|
return EnumNamesMsgType()[index];
|
123
95
|
}
|
124
96
|
|
125
|
-
enum MsgSubType {
|
97
|
+
enum MsgSubType : uint16_t {
|
126
98
|
MsgSubType_Unknown = 0,
|
127
99
|
MsgSubType_AuthenticationReq = 1,
|
128
100
|
MsgSubType_AuthenticationResp = 2,
|
@@ -0,0 +1,137 @@
|
|
1
|
+
// automatically generated by the FlatBuffers compiler, do not modify
|
2
|
+
|
3
|
+
|
4
|
+
#ifndef FLATBUFFERS_GENERATED_WATCH_SELFMESSAGING_H_
|
5
|
+
#define FLATBUFFERS_GENERATED_WATCH_SELFMESSAGING_H_
|
6
|
+
|
7
|
+
#include "flatbuffers/flatbuffers.h"
|
8
|
+
|
9
|
+
#include "types_generated.h"
|
10
|
+
|
11
|
+
namespace SelfMessaging {
|
12
|
+
|
13
|
+
struct Watch;
|
14
|
+
struct WatchBuilder;
|
15
|
+
|
16
|
+
struct Watch FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
17
|
+
typedef WatchBuilder Builder;
|
18
|
+
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
19
|
+
VT_ID = 4,
|
20
|
+
VT_MSGTYPE = 6,
|
21
|
+
VT_RECIPIENT = 8,
|
22
|
+
VT_WATCH = 10
|
23
|
+
};
|
24
|
+
const flatbuffers::String *id() const {
|
25
|
+
return GetPointer<const flatbuffers::String *>(VT_ID);
|
26
|
+
}
|
27
|
+
SelfMessaging::MsgType msgtype() const {
|
28
|
+
return static_cast<SelfMessaging::MsgType>(GetField<int8_t>(VT_MSGTYPE, 0));
|
29
|
+
}
|
30
|
+
const flatbuffers::String *recipient() const {
|
31
|
+
return GetPointer<const flatbuffers::String *>(VT_RECIPIENT);
|
32
|
+
}
|
33
|
+
bool watch() const {
|
34
|
+
return GetField<uint8_t>(VT_WATCH, 0) != 0;
|
35
|
+
}
|
36
|
+
bool Verify(flatbuffers::Verifier &verifier) const {
|
37
|
+
return VerifyTableStart(verifier) &&
|
38
|
+
VerifyOffset(verifier, VT_ID) &&
|
39
|
+
verifier.VerifyString(id()) &&
|
40
|
+
VerifyField<int8_t>(verifier, VT_MSGTYPE) &&
|
41
|
+
VerifyOffset(verifier, VT_RECIPIENT) &&
|
42
|
+
verifier.VerifyString(recipient()) &&
|
43
|
+
VerifyField<uint8_t>(verifier, VT_WATCH) &&
|
44
|
+
verifier.EndTable();
|
45
|
+
}
|
46
|
+
};
|
47
|
+
|
48
|
+
struct WatchBuilder {
|
49
|
+
typedef Watch Table;
|
50
|
+
flatbuffers::FlatBufferBuilder &fbb_;
|
51
|
+
flatbuffers::uoffset_t start_;
|
52
|
+
void add_id(flatbuffers::Offset<flatbuffers::String> id) {
|
53
|
+
fbb_.AddOffset(Watch::VT_ID, id);
|
54
|
+
}
|
55
|
+
void add_msgtype(SelfMessaging::MsgType msgtype) {
|
56
|
+
fbb_.AddElement<int8_t>(Watch::VT_MSGTYPE, static_cast<int8_t>(msgtype), 0);
|
57
|
+
}
|
58
|
+
void add_recipient(flatbuffers::Offset<flatbuffers::String> recipient) {
|
59
|
+
fbb_.AddOffset(Watch::VT_RECIPIENT, recipient);
|
60
|
+
}
|
61
|
+
void add_watch(bool watch) {
|
62
|
+
fbb_.AddElement<uint8_t>(Watch::VT_WATCH, static_cast<uint8_t>(watch), 0);
|
63
|
+
}
|
64
|
+
explicit WatchBuilder(flatbuffers::FlatBufferBuilder &_fbb)
|
65
|
+
: fbb_(_fbb) {
|
66
|
+
start_ = fbb_.StartTable();
|
67
|
+
}
|
68
|
+
flatbuffers::Offset<Watch> Finish() {
|
69
|
+
const auto end = fbb_.EndTable(start_);
|
70
|
+
auto o = flatbuffers::Offset<Watch>(end);
|
71
|
+
return o;
|
72
|
+
}
|
73
|
+
};
|
74
|
+
|
75
|
+
inline flatbuffers::Offset<Watch> CreateWatch(
|
76
|
+
flatbuffers::FlatBufferBuilder &_fbb,
|
77
|
+
flatbuffers::Offset<flatbuffers::String> id = 0,
|
78
|
+
SelfMessaging::MsgType msgtype = SelfMessaging::MsgType_MSG,
|
79
|
+
flatbuffers::Offset<flatbuffers::String> recipient = 0,
|
80
|
+
bool watch = false) {
|
81
|
+
WatchBuilder builder_(_fbb);
|
82
|
+
builder_.add_recipient(recipient);
|
83
|
+
builder_.add_id(id);
|
84
|
+
builder_.add_watch(watch);
|
85
|
+
builder_.add_msgtype(msgtype);
|
86
|
+
return builder_.Finish();
|
87
|
+
}
|
88
|
+
|
89
|
+
inline flatbuffers::Offset<Watch> CreateWatchDirect(
|
90
|
+
flatbuffers::FlatBufferBuilder &_fbb,
|
91
|
+
const char *id = nullptr,
|
92
|
+
SelfMessaging::MsgType msgtype = SelfMessaging::MsgType_MSG,
|
93
|
+
const char *recipient = nullptr,
|
94
|
+
bool watch = false) {
|
95
|
+
auto id__ = id ? _fbb.CreateString(id) : 0;
|
96
|
+
auto recipient__ = recipient ? _fbb.CreateString(recipient) : 0;
|
97
|
+
return SelfMessaging::CreateWatch(
|
98
|
+
_fbb,
|
99
|
+
id__,
|
100
|
+
msgtype,
|
101
|
+
recipient__,
|
102
|
+
watch);
|
103
|
+
}
|
104
|
+
|
105
|
+
inline const SelfMessaging::Watch *GetWatch(const void *buf) {
|
106
|
+
return flatbuffers::GetRoot<SelfMessaging::Watch>(buf);
|
107
|
+
}
|
108
|
+
|
109
|
+
inline const SelfMessaging::Watch *GetSizePrefixedWatch(const void *buf) {
|
110
|
+
return flatbuffers::GetSizePrefixedRoot<SelfMessaging::Watch>(buf);
|
111
|
+
}
|
112
|
+
|
113
|
+
inline bool VerifyWatchBuffer(
|
114
|
+
flatbuffers::Verifier &verifier) {
|
115
|
+
return verifier.VerifyBuffer<SelfMessaging::Watch>(nullptr);
|
116
|
+
}
|
117
|
+
|
118
|
+
inline bool VerifySizePrefixedWatchBuffer(
|
119
|
+
flatbuffers::Verifier &verifier) {
|
120
|
+
return verifier.VerifySizePrefixedBuffer<SelfMessaging::Watch>(nullptr);
|
121
|
+
}
|
122
|
+
|
123
|
+
inline void FinishWatchBuffer(
|
124
|
+
flatbuffers::FlatBufferBuilder &fbb,
|
125
|
+
flatbuffers::Offset<SelfMessaging::Watch> root) {
|
126
|
+
fbb.Finish(root);
|
127
|
+
}
|
128
|
+
|
129
|
+
inline void FinishSizePrefixedWatchBuffer(
|
130
|
+
flatbuffers::FlatBufferBuilder &fbb,
|
131
|
+
flatbuffers::Offset<SelfMessaging::Watch> root) {
|
132
|
+
fbb.FinishSizePrefixed(root);
|
133
|
+
}
|
134
|
+
|
135
|
+
} // namespace SelfMessaging
|
136
|
+
|
137
|
+
#endif // FLATBUFFERS_GENERATED_WATCH_SELFMESSAGING_H_
|
@@ -3,7 +3,6 @@
|
|
3
3
|
|
4
4
|
using namespace Rice;
|
5
5
|
|
6
|
-
void acl_init();
|
7
6
|
void auth_init();
|
8
7
|
void header_init();
|
9
8
|
void message_init();
|
@@ -13,7 +12,6 @@ void notification_init();
|
|
13
12
|
extern "C"
|
14
13
|
void Init_self_msgproto()
|
15
14
|
{
|
16
|
-
acl_init();
|
17
15
|
auth_init();
|
18
16
|
header_init();
|
19
17
|
message_init();
|
data/lib/self_msgproto.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# Copyright 2020 Self Group Ltd. All Rights Reserved.
|
2
2
|
|
3
3
|
require 'self_msgproto/version'
|
4
|
-
require 'self_msgproto/acl'
|
5
4
|
require 'self_msgproto/auth'
|
6
5
|
require 'self_msgproto/header'
|
7
6
|
require 'self_msgproto/message'
|
@@ -14,10 +13,7 @@ module SelfMsg
|
|
14
13
|
MsgTypeACK = 1
|
15
14
|
MsgTypeERR = 2
|
16
15
|
MsgTypeAUTH = 3
|
17
|
-
|
18
|
-
|
19
|
-
AclCommandLIST = 0
|
20
|
-
AclCommandPERMIT = 1
|
21
|
-
AclCommandREVOKE = 2
|
16
|
+
MsgTypeWatch = 5
|
17
|
+
MsgTypeStatus = 6
|
22
18
|
|
23
19
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: self_msgproto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Bevan
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rice
|
@@ -80,7 +80,7 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
-
description:
|
83
|
+
description:
|
84
84
|
email: ops@joinself.com
|
85
85
|
executables: []
|
86
86
|
extensions:
|
@@ -88,28 +88,26 @@ extensions:
|
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
90
|
- Rakefile
|
91
|
-
- ext/self_msgproto/acl.cpp
|
92
91
|
- ext/self_msgproto/auth.cpp
|
93
92
|
- ext/self_msgproto/extconf.rb
|
94
93
|
- ext/self_msgproto/header.cpp
|
95
94
|
- ext/self_msgproto/message.cpp
|
96
|
-
- ext/self_msgproto/msgproto/acl_generated.h
|
97
95
|
- ext/self_msgproto/msgproto/auth_generated.h
|
98
96
|
- ext/self_msgproto/msgproto/header_generated.h
|
99
97
|
- ext/self_msgproto/msgproto/message_generated.h
|
100
98
|
- ext/self_msgproto/msgproto/notification_generated.h
|
99
|
+
- ext/self_msgproto/msgproto/status_generated.h
|
101
100
|
- ext/self_msgproto/msgproto/types_generated.h
|
101
|
+
- ext/self_msgproto/msgproto/watch_generated.h
|
102
102
|
- ext/self_msgproto/notification.cpp
|
103
103
|
- ext/self_msgproto/self_msgproto.cpp
|
104
104
|
- lib/self_msgproto.rb
|
105
|
-
- lib/self_msgproto/acl.rb
|
106
105
|
- lib/self_msgproto/auth.rb
|
107
106
|
- lib/self_msgproto/header.rb
|
108
107
|
- lib/self_msgproto/message.rb
|
109
108
|
- lib/self_msgproto/notification.rb
|
110
109
|
- lib/self_msgproto/version.rb
|
111
110
|
- test/spec/test_message.rb
|
112
|
-
- test/unit/test_acl.rb
|
113
111
|
- test/unit/test_auth.rb
|
114
112
|
- test/unit/test_header.rb
|
115
113
|
- test/unit/test_message.rb
|
@@ -118,7 +116,7 @@ homepage: https://github.com/joinself/self-msgproto-ruby
|
|
118
116
|
licenses:
|
119
117
|
- MIT
|
120
118
|
metadata: {}
|
121
|
-
post_install_message:
|
119
|
+
post_install_message:
|
122
120
|
rdoc_options: []
|
123
121
|
require_paths:
|
124
122
|
- lib
|
@@ -133,13 +131,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
131
|
- !ruby/object:Gem::Version
|
134
132
|
version: '0'
|
135
133
|
requirements: []
|
136
|
-
rubygems_version: 3.3.
|
137
|
-
signing_key:
|
134
|
+
rubygems_version: 3.3.15
|
135
|
+
signing_key:
|
138
136
|
specification_version: 4
|
139
137
|
summary: Bindings for Self's Flatbuffer messaging protocol
|
140
138
|
test_files:
|
141
139
|
- test/spec/test_message.rb
|
142
|
-
- test/unit/test_acl.rb
|
143
140
|
- test/unit/test_auth.rb
|
144
141
|
- test/unit/test_header.rb
|
145
142
|
- test/unit/test_message.rb
|
data/ext/self_msgproto/acl.cpp
DELETED
@@ -1,133 +0,0 @@
|
|
1
|
-
#include <iostream>
|
2
|
-
#include "rice/rice.hpp"
|
3
|
-
#include "flatbuffers/flatbuffers.h"
|
4
|
-
#include "msgproto/acl_generated.h"
|
5
|
-
|
6
|
-
using namespace SelfMessaging;
|
7
|
-
|
8
|
-
VALUE acl_initialize(int argc, VALUE *argv, VALUE self)
|
9
|
-
{
|
10
|
-
VALUE opts;
|
11
|
-
|
12
|
-
(void)rb_scan_args(argc, argv, "0:", &opts);
|
13
|
-
|
14
|
-
opts = (opts == Qnil) ? rb_hash_new(): opts;
|
15
|
-
|
16
|
-
VALUE data = rb_hash_aref(opts, ID2SYM(rb_intern("data")));
|
17
|
-
|
18
|
-
if (data != Qnil) {
|
19
|
-
if(rb_obj_is_kind_of(data, rb_cString) != Qtrue){
|
20
|
-
rb_raise(rb_eTypeError, "acl data must be kind of String");
|
21
|
-
}
|
22
|
-
|
23
|
-
const uint8_t *data_ptr = (uint8_t *)RSTRING_PTR(data);
|
24
|
-
long data_len = RSTRING_LEN(data);
|
25
|
-
|
26
|
-
auto acl = GetACL(data_ptr);
|
27
|
-
|
28
|
-
flatbuffers::Verifier verifier(data_ptr, data_len);
|
29
|
-
|
30
|
-
if (!VerifyACLBuffer(verifier)) {
|
31
|
-
rb_raise(rb_eStandardError, "acl buffer is invalid");
|
32
|
-
}
|
33
|
-
|
34
|
-
auto id = acl->id()->c_str();
|
35
|
-
auto mtype = acl->msgtype();
|
36
|
-
auto command = acl->command();
|
37
|
-
auto payload = acl->payload();
|
38
|
-
|
39
|
-
VALUE idstr = rb_str_new(id, std::strlen(id));
|
40
|
-
rb_ivar_set(self, rb_intern("@id"), idstr);
|
41
|
-
|
42
|
-
VALUE mtypeint = rb_int2inum(mtype);
|
43
|
-
rb_ivar_set(self, rb_intern("@type"), mtypeint);
|
44
|
-
|
45
|
-
VALUE commandint = rb_int2inum(command);
|
46
|
-
rb_ivar_set(self, rb_intern("@command"), commandint);
|
47
|
-
|
48
|
-
if (payload != NULL) {
|
49
|
-
const u_char *payloaddata = payload->data();
|
50
|
-
long payloadsize = payload->size();
|
51
|
-
|
52
|
-
VALUE payloadstr = rb_str_new((const char *)payloaddata, payloadsize);
|
53
|
-
rb_ivar_set(self, rb_intern("@payload"), payloadstr);
|
54
|
-
}
|
55
|
-
}
|
56
|
-
|
57
|
-
return self;
|
58
|
-
}
|
59
|
-
|
60
|
-
VALUE acl_to_fb(VALUE self)
|
61
|
-
{
|
62
|
-
VALUE idv = rb_ivar_get(self, rb_intern("@id"));
|
63
|
-
char *idstr = RSTRING_PTR(idv);
|
64
|
-
|
65
|
-
VALUE commandv = rb_ivar_get(self, rb_intern("@command"));
|
66
|
-
int64_t commandint = NUM2INT(commandv);
|
67
|
-
|
68
|
-
ACLCommand command;
|
69
|
-
|
70
|
-
switch(commandint) {
|
71
|
-
case 0:
|
72
|
-
command = ACLCommand_LIST;
|
73
|
-
break;
|
74
|
-
case 1:
|
75
|
-
command = ACLCommand_PERMIT;
|
76
|
-
break;
|
77
|
-
case 2:
|
78
|
-
command = ACLCommand_REVOKE;
|
79
|
-
break;
|
80
|
-
default:
|
81
|
-
rb_raise(rb_eStandardError, "acl command is invalid");
|
82
|
-
}
|
83
|
-
|
84
|
-
VALUE payloadv = rb_ivar_get(self, rb_intern("@payload"));
|
85
|
-
|
86
|
-
u_char *payloadstr;
|
87
|
-
long payloadlen;
|
88
|
-
flatbuffers::Offset<flatbuffers::Vector<uint8_t>> payload;
|
89
|
-
|
90
|
-
if (payloadv != Qnil) {
|
91
|
-
payloadstr = (u_char *)RSTRING_PTR(payloadv);
|
92
|
-
payloadlen = RSTRING_LEN(payloadv);
|
93
|
-
}
|
94
|
-
|
95
|
-
flatbuffers::FlatBufferBuilder builder(1024);
|
96
|
-
|
97
|
-
auto id = builder.CreateString(idstr);
|
98
|
-
|
99
|
-
if (payloadv != Qnil) {
|
100
|
-
payload = builder.CreateVector(payloadstr, payloadlen);
|
101
|
-
}
|
102
|
-
|
103
|
-
ACLBuilder acl_builder(builder);
|
104
|
-
|
105
|
-
acl_builder.add_id(id);
|
106
|
-
acl_builder.add_msgtype(MsgType_ACL);
|
107
|
-
acl_builder.add_command(command);
|
108
|
-
|
109
|
-
if (payloadv != Qnil) {
|
110
|
-
acl_builder.add_payload(payload);
|
111
|
-
}
|
112
|
-
|
113
|
-
auto acl = acl_builder.Finish();
|
114
|
-
builder.Finish(acl);
|
115
|
-
|
116
|
-
uint8_t *buf = builder.GetBufferPointer();
|
117
|
-
int size = builder.GetSize();
|
118
|
-
|
119
|
-
VALUE data = rb_str_new((char *)buf, size);
|
120
|
-
|
121
|
-
builder.Release();
|
122
|
-
|
123
|
-
return data;
|
124
|
-
}
|
125
|
-
|
126
|
-
void acl_init() {
|
127
|
-
VALUE cRubySelfMsg = rb_define_module("SelfMsg");
|
128
|
-
VALUE cAcl = rb_define_class_under(cRubySelfMsg, "Acl", rb_cObject);
|
129
|
-
|
130
|
-
rb_define_method(cAcl, "initialize", reinterpret_cast< VALUE ( * ) ( ... ) >(acl_initialize), -1);
|
131
|
-
rb_define_method(cAcl, "to_fb", reinterpret_cast< VALUE ( * ) ( ... ) >(acl_to_fb), 0);
|
132
|
-
}
|
133
|
-
|
@@ -1,137 +0,0 @@
|
|
1
|
-
// automatically generated by the FlatBuffers compiler, do not modify
|
2
|
-
|
3
|
-
|
4
|
-
#ifndef FLATBUFFERS_GENERATED_ACL_SELFMESSAGING_H_
|
5
|
-
#define FLATBUFFERS_GENERATED_ACL_SELFMESSAGING_H_
|
6
|
-
|
7
|
-
#include "flatbuffers/flatbuffers.h"
|
8
|
-
|
9
|
-
#include "types_generated.h"
|
10
|
-
|
11
|
-
namespace SelfMessaging {
|
12
|
-
|
13
|
-
struct ACL;
|
14
|
-
struct ACLBuilder;
|
15
|
-
|
16
|
-
struct ACL FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
|
17
|
-
typedef ACLBuilder Builder;
|
18
|
-
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
19
|
-
VT_ID = 4,
|
20
|
-
VT_MSGTYPE = 6,
|
21
|
-
VT_COMMAND = 8,
|
22
|
-
VT_PAYLOAD = 10
|
23
|
-
};
|
24
|
-
const flatbuffers::String *id() const {
|
25
|
-
return GetPointer<const flatbuffers::String *>(VT_ID);
|
26
|
-
}
|
27
|
-
SelfMessaging::MsgType msgtype() const {
|
28
|
-
return static_cast<SelfMessaging::MsgType>(GetField<int8_t>(VT_MSGTYPE, 0));
|
29
|
-
}
|
30
|
-
SelfMessaging::ACLCommand command() const {
|
31
|
-
return static_cast<SelfMessaging::ACLCommand>(GetField<int8_t>(VT_COMMAND, 0));
|
32
|
-
}
|
33
|
-
const flatbuffers::Vector<uint8_t> *payload() const {
|
34
|
-
return GetPointer<const flatbuffers::Vector<uint8_t> *>(VT_PAYLOAD);
|
35
|
-
}
|
36
|
-
bool Verify(flatbuffers::Verifier &verifier) const {
|
37
|
-
return VerifyTableStart(verifier) &&
|
38
|
-
VerifyOffset(verifier, VT_ID) &&
|
39
|
-
verifier.VerifyString(id()) &&
|
40
|
-
VerifyField<int8_t>(verifier, VT_MSGTYPE) &&
|
41
|
-
VerifyField<int8_t>(verifier, VT_COMMAND) &&
|
42
|
-
VerifyOffset(verifier, VT_PAYLOAD) &&
|
43
|
-
verifier.VerifyVector(payload()) &&
|
44
|
-
verifier.EndTable();
|
45
|
-
}
|
46
|
-
};
|
47
|
-
|
48
|
-
struct ACLBuilder {
|
49
|
-
typedef ACL Table;
|
50
|
-
flatbuffers::FlatBufferBuilder &fbb_;
|
51
|
-
flatbuffers::uoffset_t start_;
|
52
|
-
void add_id(flatbuffers::Offset<flatbuffers::String> id) {
|
53
|
-
fbb_.AddOffset(ACL::VT_ID, id);
|
54
|
-
}
|
55
|
-
void add_msgtype(SelfMessaging::MsgType msgtype) {
|
56
|
-
fbb_.AddElement<int8_t>(ACL::VT_MSGTYPE, static_cast<int8_t>(msgtype), 0);
|
57
|
-
}
|
58
|
-
void add_command(SelfMessaging::ACLCommand command) {
|
59
|
-
fbb_.AddElement<int8_t>(ACL::VT_COMMAND, static_cast<int8_t>(command), 0);
|
60
|
-
}
|
61
|
-
void add_payload(flatbuffers::Offset<flatbuffers::Vector<uint8_t>> payload) {
|
62
|
-
fbb_.AddOffset(ACL::VT_PAYLOAD, payload);
|
63
|
-
}
|
64
|
-
explicit ACLBuilder(flatbuffers::FlatBufferBuilder &_fbb)
|
65
|
-
: fbb_(_fbb) {
|
66
|
-
start_ = fbb_.StartTable();
|
67
|
-
}
|
68
|
-
flatbuffers::Offset<ACL> Finish() {
|
69
|
-
const auto end = fbb_.EndTable(start_);
|
70
|
-
auto o = flatbuffers::Offset<ACL>(end);
|
71
|
-
return o;
|
72
|
-
}
|
73
|
-
};
|
74
|
-
|
75
|
-
inline flatbuffers::Offset<ACL> CreateACL(
|
76
|
-
flatbuffers::FlatBufferBuilder &_fbb,
|
77
|
-
flatbuffers::Offset<flatbuffers::String> id = 0,
|
78
|
-
SelfMessaging::MsgType msgtype = SelfMessaging::MsgType_MSG,
|
79
|
-
SelfMessaging::ACLCommand command = SelfMessaging::ACLCommand_LIST,
|
80
|
-
flatbuffers::Offset<flatbuffers::Vector<uint8_t>> payload = 0) {
|
81
|
-
ACLBuilder builder_(_fbb);
|
82
|
-
builder_.add_payload(payload);
|
83
|
-
builder_.add_id(id);
|
84
|
-
builder_.add_command(command);
|
85
|
-
builder_.add_msgtype(msgtype);
|
86
|
-
return builder_.Finish();
|
87
|
-
}
|
88
|
-
|
89
|
-
inline flatbuffers::Offset<ACL> CreateACLDirect(
|
90
|
-
flatbuffers::FlatBufferBuilder &_fbb,
|
91
|
-
const char *id = nullptr,
|
92
|
-
SelfMessaging::MsgType msgtype = SelfMessaging::MsgType_MSG,
|
93
|
-
SelfMessaging::ACLCommand command = SelfMessaging::ACLCommand_LIST,
|
94
|
-
const std::vector<uint8_t> *payload = nullptr) {
|
95
|
-
auto id__ = id ? _fbb.CreateString(id) : 0;
|
96
|
-
auto payload__ = payload ? _fbb.CreateVector<uint8_t>(*payload) : 0;
|
97
|
-
return SelfMessaging::CreateACL(
|
98
|
-
_fbb,
|
99
|
-
id__,
|
100
|
-
msgtype,
|
101
|
-
command,
|
102
|
-
payload__);
|
103
|
-
}
|
104
|
-
|
105
|
-
inline const SelfMessaging::ACL *GetACL(const void *buf) {
|
106
|
-
return flatbuffers::GetRoot<SelfMessaging::ACL>(buf);
|
107
|
-
}
|
108
|
-
|
109
|
-
inline const SelfMessaging::ACL *GetSizePrefixedACL(const void *buf) {
|
110
|
-
return flatbuffers::GetSizePrefixedRoot<SelfMessaging::ACL>(buf);
|
111
|
-
}
|
112
|
-
|
113
|
-
inline bool VerifyACLBuffer(
|
114
|
-
flatbuffers::Verifier &verifier) {
|
115
|
-
return verifier.VerifyBuffer<SelfMessaging::ACL>(nullptr);
|
116
|
-
}
|
117
|
-
|
118
|
-
inline bool VerifySizePrefixedACLBuffer(
|
119
|
-
flatbuffers::Verifier &verifier) {
|
120
|
-
return verifier.VerifySizePrefixedBuffer<SelfMessaging::ACL>(nullptr);
|
121
|
-
}
|
122
|
-
|
123
|
-
inline void FinishACLBuffer(
|
124
|
-
flatbuffers::FlatBufferBuilder &fbb,
|
125
|
-
flatbuffers::Offset<SelfMessaging::ACL> root) {
|
126
|
-
fbb.Finish(root);
|
127
|
-
}
|
128
|
-
|
129
|
-
inline void FinishSizePrefixedACLBuffer(
|
130
|
-
flatbuffers::FlatBufferBuilder &fbb,
|
131
|
-
flatbuffers::Offset<SelfMessaging::ACL> root) {
|
132
|
-
fbb.FinishSizePrefixed(root);
|
133
|
-
}
|
134
|
-
|
135
|
-
} // namespace SelfMessaging
|
136
|
-
|
137
|
-
#endif // FLATBUFFERS_GENERATED_ACL_SELFMESSAGING_H_
|
data/lib/self_msgproto/acl.rb
DELETED
data/test/unit/test_acl.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'minitest/autorun'
|
2
|
-
require 'base64'
|
3
|
-
require 'self_msgproto'
|
4
|
-
|
5
|
-
class TestMessage < Minitest::Test
|
6
|
-
|
7
|
-
include SelfMsg
|
8
|
-
|
9
|
-
def test_new_acl
|
10
|
-
d = Base64.decode64('EAAAAAwAFAAMABMACwAEAAwAAAAQAAAAAAAAARQAAAAAAAAEBwAAAHBheWxvYWQAJAAAADk5NDliMWEzLWRhN2QtNGQzYy05OTMxLTlkYzkzMTJhZWI4YQAAAAA')
|
11
|
-
h = SelfMsg::Acl.new(data: d)
|
12
|
-
p h.id
|
13
|
-
p h.type
|
14
|
-
p h.command
|
15
|
-
p h.payload
|
16
|
-
|
17
|
-
p h.command = SelfMsg::AclCommandPERMIT
|
18
|
-
p h.to_fb
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
22
|
-
|
23
|
-
#EAAAAAwAFAAMABMACwAEAAwAAAAQAAAAAAAAAQwAAAAAAAAEAAAAACQAAAA4M2I1Zjg3Zi0yYTYxLTRiM2YtOWU2Zi0yOTk5OTk3ZDdhNDgAAAAA
|