-
Notifications
You must be signed in to change notification settings - Fork 9
/
Bus.go
49 lines (42 loc) · 1021 Bytes
/
Bus.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package frida_go
import (
"fmt"
"github.com/a97077088/frida-go/cfrida"
jsoniter "github.com/json-iterator/go"
"unsafe"
)
type Bus struct {
CObj
*BusSignalConnect
}
func (b *Bus) Post(message interface{},data []byte) {
cfrida.Frida_bus_post(b.instance,jsoniter.Wrap(message).ToString(),data)
}
func (b *Bus) Attach()(bool,error){
isatt,err:=cfrida.Frida_bus_attach_sync(b.instance,0)
return isatt,err
}
func (b *Bus) Description() string {
if b.instance==0{
return ""
}
return fmt.Sprintf(`Frida.Bus()`)
}
func (b *Bus) IsClosed() bool {
return cfrida.Frida_bus_is_detached(b.instance)
}
func (b *Bus) Free() {
cfrida.G_object_unref(b.instance)
}
// BusFromInst
// 新建一个对象来自已经存在的对象实例指针。
//
// Create a new object from an existing object instance pointer.
func BusFromInst(inst uintptr) *Bus {
dl:=new(Bus)
dl.instance=inst
dl.ptr= unsafe.Pointer(dl.instance)
dl.BusSignalConnect=NewBusSignalConnect(dl.instance)
setFinalizer(dl, (*Bus).Free)
return dl
}