self_msgproto 0.0.4 → 0.0.8
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/acl.cpp +19 -5
- data/ext/self_msgproto/auth.cpp +2 -2
- data/ext/self_msgproto/header.cpp +1 -1
- data/ext/self_msgproto/message.cpp +2 -2
- data/ext/self_msgproto/notification.cpp +1 -1
- data/lib/self_msgproto/version.rb +1 -1
- data/test/unit/test_acl.rb +3 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cab7cc6b6f6a48df982c1ee3d9b170e85cfd55178f79bdab9e6ced5676f52199
|
4
|
+
data.tar.gz: 88f152ebe1b13969258c96be8d1fb98036a51509957e236bdf2ece2a15c18389
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7903916cb4d14f524c312b582b92b19d18094a582df509ae8e2cb3df8621d2b852dae659d6faf306b6402a4335c96faed5309495e997ee80cb93095baedc1255
|
7
|
+
data.tar.gz: 84fa5070a8d235c1e42ca4b8a93407861288b3ccb62ac307dadebb62482055afbdeca52907aaa3bae85341d29a04bc397e1f5de82694715ddc48deb78d50a370
|
data/ext/self_msgproto/acl.cpp
CHANGED
@@ -63,11 +63,21 @@ VALUE acl_to_fb(VALUE self)
|
|
63
63
|
char *idstr = RSTRING_PTR(idv);
|
64
64
|
|
65
65
|
VALUE commandv = rb_ivar_get(self, rb_intern("@command"));
|
66
|
-
|
66
|
+
int64_t commandint = NUM2INT(commandv);
|
67
67
|
|
68
68
|
ACLCommand command;
|
69
69
|
|
70
|
-
|
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:
|
71
81
|
rb_raise(rb_eStandardError, "acl command is invalid");
|
72
82
|
}
|
73
83
|
|
@@ -75,6 +85,7 @@ VALUE acl_to_fb(VALUE self)
|
|
75
85
|
|
76
86
|
u_char *payloadstr;
|
77
87
|
long payloadlen;
|
88
|
+
flatbuffers::Offset<flatbuffers::Vector<uint8_t>> payload;
|
78
89
|
|
79
90
|
if (payloadv != Qnil) {
|
80
91
|
payloadstr = (u_char *)RSTRING_PTR(payloadv);
|
@@ -84,7 +95,10 @@ VALUE acl_to_fb(VALUE self)
|
|
84
95
|
flatbuffers::FlatBufferBuilder builder(1024);
|
85
96
|
|
86
97
|
auto id = builder.CreateString(idstr);
|
87
|
-
|
98
|
+
|
99
|
+
if (payloadv != Qnil) {
|
100
|
+
payload = builder.CreateVector(payloadstr, payloadlen);
|
101
|
+
}
|
88
102
|
|
89
103
|
ACLBuilder acl_builder(builder);
|
90
104
|
|
@@ -113,7 +127,7 @@ void acl_init() {
|
|
113
127
|
VALUE cRubySelfMsg = rb_define_module("SelfMsg");
|
114
128
|
VALUE cAcl = rb_define_class_under(cRubySelfMsg, "Acl", rb_cObject);
|
115
129
|
|
116
|
-
rb_define_method(cAcl, "initialize", acl_initialize, -1);
|
117
|
-
rb_define_method(cAcl, "to_fb", acl_to_fb, 0);
|
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);
|
118
132
|
}
|
119
133
|
|
data/ext/self_msgproto/auth.cpp
CHANGED
@@ -101,7 +101,7 @@ void auth_init() {
|
|
101
101
|
VALUE cRubySelfMsg = rb_define_module("SelfMsg");
|
102
102
|
VALUE cAuth = rb_define_class_under(cRubySelfMsg, "Auth", rb_cObject);
|
103
103
|
|
104
|
-
rb_define_method(cAuth, "initialize", auth_initialize, -1);
|
105
|
-
rb_define_method(cAuth, "to_fb", auth_to_fb, 0);
|
104
|
+
rb_define_method(cAuth, "initialize", reinterpret_cast< VALUE ( * ) ( ... ) >(auth_initialize), -1);
|
105
|
+
rb_define_method(cAuth, "to_fb", reinterpret_cast< VALUE ( * ) ( ... ) >(auth_to_fb), 0);
|
106
106
|
}
|
107
107
|
|
@@ -48,6 +48,6 @@ void header_init() {
|
|
48
48
|
VALUE cRubySelfMsg = rb_define_module("SelfMsg");
|
49
49
|
VALUE cHeader = rb_define_class_under(cRubySelfMsg, "Header", rb_cObject);
|
50
50
|
|
51
|
-
rb_define_method(cHeader, "initialize", header_initialize, -1);
|
51
|
+
rb_define_method(cHeader, "initialize", reinterpret_cast< VALUE ( * ) ( ... ) >(header_initialize), -1);
|
52
52
|
}
|
53
53
|
|
@@ -125,7 +125,7 @@ void message_init() {
|
|
125
125
|
VALUE cRubySelfMsg = rb_define_module("SelfMsg");
|
126
126
|
VALUE cMessage = rb_define_class_under(cRubySelfMsg, "Message", rb_cObject);
|
127
127
|
|
128
|
-
rb_define_method(cMessage, "initialize", message_initialize, -1);
|
129
|
-
rb_define_method(cMessage, "to_fb", message_to_fb, 0);
|
128
|
+
rb_define_method(cMessage, "initialize", reinterpret_cast< VALUE ( * ) ( ... ) >(message_initialize), -1);
|
129
|
+
rb_define_method(cMessage, "to_fb", reinterpret_cast< VALUE ( * ) ( ... ) >(message_to_fb), 0);
|
130
130
|
}
|
131
131
|
|
@@ -54,6 +54,6 @@ void notification_init() {
|
|
54
54
|
VALUE cRubySelfMsg = rb_define_module("SelfMsg");
|
55
55
|
VALUE cHeader = rb_define_class_under(cRubySelfMsg, "Notification", rb_cObject);
|
56
56
|
|
57
|
-
rb_define_method(cHeader, "initialize", notification_initialize, -1);
|
57
|
+
rb_define_method(cHeader, "initialize", reinterpret_cast< VALUE ( * ) ( ... ) >(notification_initialize), -1);
|
58
58
|
}
|
59
59
|
|
data/test/unit/test_acl.rb
CHANGED
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.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Bevan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rice
|