Class: CFrida::Relay

Inherits:
GObject show all
Defined in:
ext/c_frida/Relay.c

Instance Method Summary collapse

Methods inherited from GObject

#off, #on

Constructor Details

#initialize(address, username, password, kind) ⇒ Object



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'ext/c_frida/Relay.c', line 71

static VALUE Relay_initialize(VALUE self, VALUE address, VALUE username, VALUE password, VALUE kind)
{
    GET_GOBJECT_DATA();
    FridaRelayKind	gkind;
    FridaRelay		*handle;

    if (address == Qfalse)
        return (self);
    if (!RB_TYPE_P(address, T_STRING)) {
        raise_argerror("address should be a string.");
        return (Qnil);
    }
    if (!RB_TYPE_P(username, T_STRING)) {
        raise_argerror("username should be a string.");
        return (Qnil);
    }
    if (!RB_TYPE_P(password, T_STRING)) {
        raise_argerror("password should be a string.");
        return (Qnil);
    }
    if (!RB_TYPE_P(kind, T_STRING)) {
        raise_argerror("kind should be a string.");
        return (Qnil);
    }
    if (!rbGObject_unmarshal_enum(StringValueCStr(kind), FRIDA_TYPE_RELAY_KIND, &gkind)) {
        raise_argerror("kind is not valid.");
        return (Qnil);
    }
    handle = frida_relay_new(StringValueCStr(address), StringValueCStr(username), StringValueCStr(password), gkind);
    d->handle = handle;
    d->destroy = g_object_unref;
    rb_ivar_set(self, rb_intern("address"), rbGObject_marshal_string(frida_relay_get_address(handle)));
    rb_ivar_set(self, rb_intern("username"), rbGObject_marshal_string(frida_relay_get_username(handle)));
    rb_ivar_set(self, rb_intern("password"), rbGObject_marshal_string(frida_relay_get_password(handle)));
    rb_ivar_set(self, rb_intern("kind"), rbGObject_marshal_enum(frida_relay_get_kind(handle), FRIDA_TYPE_RELAY_KIND));
    return (self);
}

Instance Method Details

#addressObject



35
36
37
38
# File 'ext/c_frida/Relay.c', line 35

static VALUE Relay_address(VALUE self)
{
    return (rb_ivar_get(self, rb_intern("address")));
}

#inspectObject Also known as: to_s



21
22
23
24
25
26
27
28
29
# File 'ext/c_frida/Relay.c', line 21

static VALUE Relay_inspect(VALUE self)
{
    VALUE s;

    s = rb_sprintf("#<Relay: address=%+"PRIsVALUE", username=%+"PRIsVALUE", password=%+"PRIsVALUE", kind=%+"PRIsVALUE">", \
                   rb_funcall(self, rb_intern("address"), 0, NULL),  rb_funcall(self, rb_intern("username"), 0, NULL), \
                   rb_funcall(self, rb_intern("password"), 0, NULL),  rb_funcall(self, rb_intern("kind"), 0, NULL));
    return (s);
}

#kindObject



62
63
64
65
# File 'ext/c_frida/Relay.c', line 62

static VALUE Relay_kind(VALUE self)
{
    return (rb_ivar_get(self, rb_intern("kind")));
}

#passwordObject



53
54
55
56
# File 'ext/c_frida/Relay.c', line 53

static VALUE Relay_password(VALUE self)
{
    return (rb_ivar_get(self, rb_intern("password")));
}

#usernameObject



44
45
46
47
# File 'ext/c_frida/Relay.c', line 44

static VALUE Relay_username(VALUE self)
{
    return (rb_ivar_get(self, rb_intern("username")));
}