Class: CFrida::PortalService
- Inherits:
-
GObject
- Object
- GObject
- CFrida::PortalService
- Defined in:
- ext/c_frida/PortalService.c
Instance Method Summary collapse
- #broadcast(*args) ⇒ Object
- #device ⇒ Object
- #enumerate_tags(connection_id) ⇒ Object
- #initialize(*args) ⇒ Object constructor
- #kick(connection_id) ⇒ Object
- #narrowcast(*args) ⇒ Object
- #post(*args) ⇒ Object
- #start ⇒ Object
- #stop ⇒ Object
- #tag(connection_id, tag) ⇒ Object
- #untag(connection_id, tag) ⇒ Object
Constructor Details
#initialize(*args) ⇒ Object
361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 |
# File 'ext/c_frida/PortalService.c', line 361
static VALUE PortalService_initialize(int argc, VALUE *argv, VALUE self)
{
GET_GOBJECT_DATA();
VALUE cluster_params, kws;
FridaEndpointParameters *c, *cc = NULL;
rb_scan_args(argc, argv, "1:", &cluster_params, &kws);
if (!rb_obj_is_instance_of(cluster_params, cEndpointParameters)) {
raise_argerror("cluster_params must be an instance of EndpointParameters.");
return (Qnil);
}
GET_DATA_EX(GObject, cluster_params, c_d);
c = c_d->handle;
// we support creating classes without a handle for marshaling purposes, but those instances should not work here.
if (!c) {
raise_argerror("cluster_params must be an instance of a valid EndpointParameters.");
return (Qnil);
}
if (!NIL_P(kws)) {
VALUE control_params = rb_hash_aref(kws, ID2SYM(rb_intern("control_params")));
if (!NIL_P(control_params)) {
if (!rb_obj_is_instance_of(control_params, cEndpointParameters)) {
raise_argerror("control_params must be an instance of EndpointParameters.");
return (Qnil);
}
GET_DATA_EX(GObject, control_params, cc_d);
cc = cc_d->handle;
}
}
FridaPortalService *handle = frida_portal_service_new(c, cc);
d->handle = handle;
d->destroy = PortalService_destroy;
rb_ivar_set(self, rb_intern("device"), Device_from_FridaDevice(g_object_ref(frida_portal_service_get_device(d->handle))));
return (self);
}
|
Instance Method Details
#broadcast(*args) ⇒ Object
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 |
# File 'ext/c_frida/PortalService.c', line 215
static VALUE PortalService_broadcast(int argc, VALUE *argv, VALUE self)
{
GET_GOBJECT_DATA();
REQUIRE_GOBJECT_HANDLE();
VALUE message, kws;
GBytes *gdata = NULL;
rb_scan_args(argc, argv, "1:", &message, &kws);
if (!RB_TYPE_P(message, T_STRING)) {
raise_argerror("message must be a String.");
return (Qnil);
}
if (!NIL_P(kws)) {
VALUE data = rb_hash_aref(kws, ID2SYM(rb_intern("data")));
if (!NIL_P(data)) {
if (!RB_TYPE_P(data, T_STRING)) {
raise_argerror("data must be a String.");
return (Qnil);
}
}
gdata = g_bytes_new(RSTRING_PTR(data), RSTRING_LEN(data));
}
broadcast_proxy_args args = {
.handle = d->handle,
.message = StringValueCStr(message),
.data = gdata
};
CALL_GVL_FREE_WITH_RET(void *dummy, broadcast, &args);
g_bytes_unref(gdata);
return (Qnil);
UNREACHABLE_GERROR_BLOCK
}
|
#device ⇒ Object
26 27 28 29 |
# File 'ext/c_frida/PortalService.c', line 26
static VALUE PortalService_device(VALUE self)
{
return (rb_ivar_get(self, rb_intern("device")));
}
|
#enumerate_tags(connection_id) ⇒ Object
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 |
# File 'ext/c_frida/PortalService.c', line 262
static VALUE PortalService_enumerate_tags(VALUE self, VALUE connection_id)
{
GET_GOBJECT_DATA();
REQUIRE_GOBJECT_HANDLE();
gint tags_count;
if (!RB_TYPE_P(connection_id, T_FIXNUM)) {
raise_argerror("connection_id must be an integer.");
return (Qnil);
}
enumerate_tags_proxy_args args = {
.handle = d->handle,
.connection_id = NUM2UINT(connection_id),
.tags_count = &tags_count
};
CALL_GVL_FREE_WITH_RET(gchar **tags, enumerate_tags, &args);
VALUE rtags = rbGObject_marshal_strv(tags, tags_count);
g_strfreev(tags);
return (rtags);
UNREACHABLE_GERROR_BLOCK
}
|
#kick(connection_id) ⇒ Object
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'ext/c_frida/PortalService.c', line 82
static VALUE PortalService_kick(VALUE self, VALUE connection_id)
{
GET_GOBJECT_DATA();
REQUIRE_GOBJECT_HANDLE();
if (!RB_TYPE_P(connection_id, T_FIXNUM)) {
raise_argerror("connection_id must be an integer.");
return (Qnil);
}
kick_proxy_args args = {
.handle = d->handle,
.connection_id = NUM2UINT(connection_id)
};
CALL_GVL_FREE_WITH_RET(void *dummy, kick, &args);
return (Qnil);
UNREACHABLE_GERROR_BLOCK
}
|
#narrowcast(*args) ⇒ Object
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
# File 'ext/c_frida/PortalService.c', line 164
static VALUE PortalService_narrowcast(int argc, VALUE *argv, VALUE self)
{
GET_GOBJECT_DATA();
REQUIRE_GOBJECT_HANDLE();
VALUE tag, message, kws;
GBytes *gdata = NULL;
rb_scan_args(argc, argv, "2:", &tag, &message, &kws);
if (!RB_TYPE_P(tag, T_STRING)) {
raise_argerror("tag must be a String.");
return (Qnil);
}
if (!RB_TYPE_P(message, T_STRING)) {
raise_argerror("message must be a String.");
return (Qnil);
}
if (!NIL_P(kws)) {
VALUE data = rb_hash_aref(kws, ID2SYM(rb_intern("data")));
if (!NIL_P(data)) {
if (!RB_TYPE_P(data, T_STRING)) {
raise_argerror("data must be a String.");
return (Qnil);
}
}
gdata = g_bytes_new(RSTRING_PTR(data), RSTRING_LEN(data));
}
narrowcast_proxy_args args = {
.handle = d->handle,
.tag = StringValueCStr(tag),
.message = StringValueCStr(message),
.data = gdata
};
CALL_GVL_FREE_WITH_RET(void *dummy, narrowcast, &args);
g_bytes_unref(gdata);
return (Qnil);
UNREACHABLE_GERROR_BLOCK
}
|
#post(*args) ⇒ Object
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
# File 'ext/c_frida/PortalService.c', line 113
static VALUE PortalService_post(int argc, VALUE *argv, VALUE self)
{
GET_GOBJECT_DATA();
REQUIRE_GOBJECT_HANDLE();
VALUE connection_id, message, kws;
GBytes *gdata = NULL;
rb_scan_args(argc, argv, "2:", &connection_id, &message, &kws);
if (!RB_TYPE_P(connection_id, T_FIXNUM)) {
raise_argerror("tag must be a number.");
return (Qnil);
}
if (!RB_TYPE_P(message, T_STRING)) {
raise_argerror("message must be a String.");
return (Qnil);
}
if (!NIL_P(kws)) {
VALUE data = rb_hash_aref(kws, ID2SYM(rb_intern("data")));
if (!NIL_P(data)) {
if (!RB_TYPE_P(data, T_STRING)) {
raise_argerror("data must be a String.");
return (Qnil);
}
}
gdata = g_bytes_new(RSTRING_PTR(data), RSTRING_LEN(data));
}
_post_proxy_args args = {
.handle = d->handle,
.connection_id = NUM2UINT(connection_id),
.message = StringValueCStr(message),
.data = gdata
};
CALL_GVL_FREE_WITH_RET(void *dummy, post, &args);
g_bytes_unref(gdata);
return (Qnil);
UNREACHABLE_GERROR_BLOCK
}
|
#start ⇒ Object
59 60 61 62 63 64 65 66 67 68 |
# File 'ext/c_frida/PortalService.c', line 59
static VALUE PortalService_start(VALUE self)
{
GET_GOBJECT_DATA();
REQUIRE_GOBJECT_HANDLE();
CALL_GVL_FREE_WITH_RET(void *dummy, start_sync, d->handle);
return (Qnil);
GERROR_BLOCK
}
|
#stop ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# File 'ext/c_frida/PortalService.c', line 35
static VALUE PortalService_stop(VALUE self)
{
GET_GOBJECT_DATA();
REQUIRE_GOBJECT_HANDLE();
CALL_GVL_FREE_WITH_RET(void *dummy, stop_sync, d->handle);
return (Qnil);
GERROR_BLOCK
}
|
#tag(connection_id, tag) ⇒ Object
297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 |
# File 'ext/c_frida/PortalService.c', line 297
static VALUE PortalService_tag(VALUE self, VALUE connection_id, VALUE tag)
{
GET_GOBJECT_DATA();
REQUIRE_GOBJECT_HANDLE();
if (!RB_TYPE_P(connection_id, T_FIXNUM)) {
raise_argerror("connection_id must be an integer.");
return (Qnil);
}
if (!RB_TYPE_P(tag, T_STRING)) {
raise_argerror("tag must be a String.");
return (Qnil);
}
tag_proxy_args args = {
.handle = d->handle,
.connection_id = NUM2UINT(connection_id),
.tag = StringValueCStr(tag)
};
CALL_GVL_FREE_WITH_RET(void *dummy, tag, &args);
return (Qnil);
UNREACHABLE_GERROR_BLOCK
}
|
#untag(connection_id, tag) ⇒ Object
333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 |
# File 'ext/c_frida/PortalService.c', line 333
static VALUE PortalService_untag(VALUE self, VALUE connection_id, VALUE tag)
{
GET_GOBJECT_DATA();
REQUIRE_GOBJECT_HANDLE();
if (!RB_TYPE_P(connection_id, T_FIXNUM)) {
raise_argerror("connection_id must be an integer.");
return (Qnil);
}
if (!RB_TYPE_P(tag, T_STRING)) {
raise_argerror("tag must be a String.");
return (Qnil);
}
untag_proxy_args args = {
.handle = d->handle,
.connection_id = NUM2UINT(connection_id),
.tag = StringValueCStr(tag)
};
CALL_GVL_FREE_WITH_RET(void *dummy, untag, &args);
return (Qnil);
UNREACHABLE_GERROR_BLOCK
}
|