1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

checker: define missing C fn args & check C & JS args (#8770)

This commit is contained in:
joe-conigliaro
2021-03-06 01:41:11 +11:00
committed by GitHub
parent ead2ba6004
commit 2d73411396
34 changed files with 358 additions and 284 deletions

View File

@ -11,10 +11,14 @@ enum Select {
pub enum SocketType {
udp = C.SOCK_DGRAM
tcp = C.SOCK_STREAM
dgram = C.SOCK_DGRAM
stream = C.SOCK_STREAM
seqpacket = C.SOCK_SEQPACKET
}
// SocketFamily are the available address families
pub enum SocketFamily {
unix = C.AF_UNIX
inet = C.AF_INET
}
@ -55,59 +59,71 @@ mut:
struct C.sockaddr_storage {
}
fn C.socket() int
fn C.socket(domain SocketFamily, typ SocketType, protocol int) int
fn C.setsockopt() int
// fn C.setsockopt(sockfd int, level int, optname int, optval voidptr, optlen C.socklen_t) int
fn C.setsockopt(sockfd int, level int, optname int, optval voidptr, optlen u32) int
fn C.htonl() int
fn C.htonl(hostlong u32) int
fn C.htons() int
fn C.htons(netshort u16) int
fn C.bind() int
// fn C.bind(sockfd int, addr &C.sockaddr, addrlen C.socklen_t) int
// use voidptr for arg 2 becasue sockaddr is a generic descriptor for any kind of socket operation,
// it can also take sockaddr_in depending on the type of socket used in arg 1
fn C.bind(sockfd int, addr voidptr, addrlen u32) int
fn C.listen() int
fn C.listen(sockfd int, backlog int) int
fn C.accept() int
// fn C.accept(sockfd int, addr &C.sockaddr, addrlen &C.socklen_t) int
fn C.accept(sockfd int, addr &C.sockaddr, addrlen &u32) int
fn C.getaddrinfo() int
fn C.getaddrinfo(node charptr, service charptr, hints &C.addrinfo, res &&C.addrinfo) int
fn C.connect() int
// fn C.connect(sockfd int, addr &C.sockaddr, addrlen C.socklen_t) int
fn C.connect(sockfd int, addr &C.sockaddr, addrlen u32) int
fn C.send() int
// fn C.send(sockfd int, buf voidptr, len size_t, flags int) size_t
fn C.send(sockfd int, buf voidptr, len size_t, flags int) int
fn C.sendto() int
// fn C.sendto(sockfd int, buf voidptr, len size_t, flags int, dest_add &C.sockaddr, addrlen C.socklen_t) size_t
fn C.sendto(sockfd int, buf voidptr, len size_t, flags int, dest_add &C.sockaddr, addrlen u32) int
fn C.recv() int
// fn C.recv(sockfd int, buf voidptr, len size_t, flags int) size_t
fn C.recv(sockfd int, buf voidptr, len size_t, flags int) int
fn C.recvfrom() int
// fn C.recvfrom(sockfd int, buf voidptr, len size_t, flags int, src_addr &C.sockaddr, addrlen &C.socklen_t) size_t
fn C.recvfrom(sockfd int, buf voidptr, len size_t, flags int, src_addr &C.sockaddr, addrlen &u32) int
fn C.shutdown() int
fn C.shutdown(socket int, how int) int
fn C.ntohs() int
fn C.ntohs(netshort u16) int
fn C.getpeername() int
// fn C.getpeername(sockfd int, addr &C.sockaddr, addlen &C.socklen_t) int
fn C.getpeername(sockfd int, addr &C.sockaddr, addlen &u32) int
fn C.inet_ntop(af int, src voidptr, dst charptr, dst_size int) charptr
fn C.inet_ntop(af SocketFamily, src voidptr, dst charptr, dst_size int) charptr
fn C.WSAAddressToStringA() int
fn C.WSAAddressToStringA(lpsaAddress &C.sockaddr, dwAddressLength u32, lpProtocolInfo voidptr, lpszAddressString charptr, lpdwAddressStringLength &u32) int
fn C.getsockname() int
// fn C.getsockname(sockfd int, addr &C.sockaddr, addrlen &C.socklen_t) int
fn C.getsockname(sockfd int, addr &C.sockaddr, addrlen &u32) int
// defined in builtin
// fn C.read() int
// fn C.close() int
fn C.ioctlsocket() int
fn C.ioctlsocket(s int, cmd int, argp &u32) int
fn C.fcntl() int
fn C.fcntl(fd int, cmd int, arg ...voidptr) int
fn C.@select() int
fn C.@select(ndfs int, readfds &C.fd_set, writefds &C.fd_set, exceptfds &C.fd_set, timeout &C.timeval) int
fn C.FD_ZERO()
fn C.FD_ZERO(fdset &C.fd_set)
fn C.FD_SET()
fn C.FD_SET(fd int, fdset &C.fd_set)
fn C.FD_ISSET() bool
fn C.FD_ISSET(fd int, fdset &C.fd_set) bool
[typedef]
pub struct C.fd_set {}