| | |
| | | func Cleanup() { |
| | | C.BHCleanup() |
| | | } |
| | | |
| | | // /////////////////////////////////////////////////// |
| | | func Request2(dest_addr *bh.BHAddress, data []byte, proc_id *string, replyPtr *unsafe.Pointer, replyLen *int, timeout_ms int) bool { |
| | | dest, _ := dest_addr.Marshal() |
| | | cpid := unsafe.Pointer(nil) |
| | | cpid_len := C.int(0) |
| | | |
| | | creply := unsafe.Pointer(nil) |
| | | creply_len := C.int(0) |
| | | |
| | | r := C.BHRequest(getPtr(&dest), C.int(len(dest)), getPtr(&data), C.int(len(data)), &cpid, &cpid_len, &creply, &creply_len, C.int(timeout_ms)) > 0 |
| | | defer C.BHFree(cpid, cpid_len) |
| | | if r { |
| | | *proc_id = string(unsafeGetBytes(&cpid, int(cpid_len))) |
| | | *replyPtr = creply |
| | | *replyLen = int(creply_len) |
| | | } |
| | | return r |
| | | } |
| | | func CFree(p unsafe.Pointer, size int) { |
| | | if p != nil { |
| | | C.BHFree(p, C.int(size)) |
| | | } |
| | | } |
| | | func SendReply2(src unsafe.Pointer, data []byte) bool { |
| | | return C.BHSendReply(src, getPtr(&data), C.int(len(data))) > 0 |
| | | } |