refactor(c/libuv): Move some func due to libuv doc

doc: https://docs.libuv.org/en/v1.x/
This commit is contained in:
hackerchai
2024-08-06 15:58:15 +08:00
parent 9b12e9819c
commit 9a61e374b5
2 changed files with 34 additions and 29 deletions

View File

@@ -70,11 +70,12 @@ type UdpFlags c.Int
/* Handle types. */
type Tcp C.uv_tcp_t
// TODO(spongehah): Handle
type Handle struct {
Data c.Pointer
Unused [88]byte
// TODO(spongehah): Stream
// TODO(spongehah): Stream
}
type Stream struct {
@@ -82,6 +83,9 @@ type Stream struct {
Unused [256]byte
}
type Shutdown struct {
Unused [0]byte
}
type Udp struct {
Unused [0]byte
@@ -97,12 +101,12 @@ type UdpSend struct {
Unused [0]byte
}
// TODO(spongehah): Connect
type Connect struct {
Data c.Pointer
Unused [88]byte
}
// TODO(spongehah): Write
type Write struct {
Data c.Pointer
@@ -142,6 +146,9 @@ type WriteCb func(req *Write, status c.Int)
// llgo:type C
type ConnectionCb func(server *Stream, status c.Int)
// llgo:type C
type ShutdownCb func(req *Shutdown, status c.Int)
// ----------------------------------------------
/* Handle related function and method */
@@ -219,6 +226,16 @@ func (handle *Handle) IsClosing() c.Int {
return 0
}
// llgo:link (*Handle).IsReadable C.uv_is_readable
func (handle *Handle) IsReadable() c.Int {
return 0
}
// llgo:link (*Handle).IsWritable C.uv_is_writable
func (handle *Handle) IsWritable() c.Int {
return 0
}
// ----------------------------------------------
/* Req related function and method */
@@ -306,6 +323,11 @@ func (stream *Stream) SetBlocking(blocking c.Int) c.Int {
return 0
}
//go:linkname StreamShutdown C.uv_shutdown
func StreamShutdown(shutdown *Shutdown, stream *Stream, shutdownCb ShutdownCb) c.Int {
return 0
}
// ----------------------------------------------
/* Tcp related function and method */