github.com/racerxdl/gonx@v0.0.0-20210103083128-c5afc43bcbd2/services/vi/binder.go (about) 1 package vi 2 3 // Binder Represents a remote interface 4 type Binder struct { 5 Handle int32 6 } 7 8 func (b *Binder) AdjustRefCount(addVal, Type int32) error { 9 return AdjustRefCount(b.Handle, addVal, Type) 10 } 11 12 // FlatBinderObject Binder object as included in a Parcel 13 type FlatBinderObject struct { 14 Type uint32 15 Flags uint32 16 Content uint64 // union of void *binder and int32 Handle 17 Cookie uint64 18 } 19 20 func (fb *FlatBinderObject) GetBinder() uintptr { 21 return uintptr(fb.Content) 22 } 23 24 func (fb *FlatBinderObject) GetHandle() int32 { 25 return int32(fb.Content) 26 } 27 28 func BinderTransactParcel(binder Binder, transaction, flags uint32, in *Parcel) (*Parcel, error) { 29 inFlattened, _ := in.FinalizeWriting() 30 31 buff := make([]byte, 0x210) 32 33 err := TransactParcel(binder.Handle, transaction, flags, inFlattened, buff) 34 if err != nil { 35 return nil, err 36 } 37 38 return ParcelLoad(buff) 39 }