adapted types
This commit is contained in:
parent
491894920d
commit
f81441cf2a
184
scsh/network.scm
184
scsh/network.scm
|
@ -167,11 +167,11 @@
|
|||
(make-socket pf in out)))))
|
||||
|
||||
(define-foreign %socket/errno
|
||||
(socket (integer pf)
|
||||
(integer type)
|
||||
(integer protocol))
|
||||
(multi-rep (to-scheme integer errno_or_false)
|
||||
integer))
|
||||
(socket (fixnum pf)
|
||||
(fixnum type)
|
||||
(fixnum protocol))
|
||||
(multi-rep (to-scheme fixnum errno_or_false)
|
||||
fixnum))
|
||||
|
||||
(define-errno-syscall (%socket pf type protocol) %socket/errno
|
||||
sockfd)
|
||||
|
@ -202,10 +202,10 @@
|
|||
(socket-address:address name)))))))
|
||||
|
||||
(define-foreign %bind/errno
|
||||
(scheme_bind (integer sockfd) ; socket fdes
|
||||
(integer family) ; address family
|
||||
(scheme_bind (fixnum sockfd) ; socket fdes
|
||||
(fixnum family) ; address family
|
||||
(string-desc name)) ; scheme descriptor
|
||||
(to-scheme integer errno_or_false))
|
||||
(to-scheme fixnum errno_or_false))
|
||||
|
||||
(define-errno-syscall (%bind sockfd family name) %bind/errno)
|
||||
|
||||
|
@ -229,10 +229,10 @@
|
|||
(socket-address:address name))))))))
|
||||
|
||||
(define-foreign %connect/errno
|
||||
(scheme_connect (integer sockfd) ; socket fdes
|
||||
(integer family) ; address family
|
||||
(scheme_connect (fixnum sockfd) ; socket fdes
|
||||
(fixnum family) ; address family
|
||||
(desc name)) ; scheme descriptor
|
||||
(to-scheme integer errno_or_false))
|
||||
(to-scheme fixnum errno_or_false))
|
||||
|
||||
(define-errno-syscall (%connect sockfd family name) %connect/errno)
|
||||
|
||||
|
@ -248,10 +248,10 @@
|
|||
(%listen (socket->fdes sock) backlog))))
|
||||
|
||||
(define-foreign %listen/errno
|
||||
(listen (integer sockfd) ; socket fdes
|
||||
(integer backlog)) ; backlog
|
||||
(listen (fixnum sockfd) ; socket fdes
|
||||
(fixnum backlog)) ; backlog
|
||||
no-declare ; for Linux
|
||||
(to-scheme integer errno_or_false))
|
||||
(to-scheme fixnum errno_or_false))
|
||||
|
||||
(define-errno-syscall (%listen sockfd backlog) %listen/errno)
|
||||
|
||||
|
@ -270,11 +270,11 @@
|
|||
(make-socket-address family name)))))
|
||||
|
||||
(define-foreign %accept/errno
|
||||
(scheme_accept (integer sockfd)
|
||||
(integer family)
|
||||
(scheme_accept (fixnum sockfd)
|
||||
(fixnum family)
|
||||
(string-desc name))
|
||||
(multi-rep (to-scheme integer errno_or_false)
|
||||
integer))
|
||||
(multi-rep (to-scheme fixnum errno_or_false)
|
||||
fixnum))
|
||||
|
||||
(define-errno-syscall (%accept sock family name) %accept/errno
|
||||
sockfd)
|
||||
|
@ -294,10 +294,10 @@
|
|||
(make-socket-address family name))))
|
||||
|
||||
(define-foreign %peer-name/errno
|
||||
(scheme_peer_name (integer sockfd)
|
||||
(integer family)
|
||||
(scheme_peer_name (fixnum sockfd)
|
||||
(fixnum family)
|
||||
(string-desc name))
|
||||
(to-scheme integer errno_or_false))
|
||||
(to-scheme fixnum errno_or_false))
|
||||
|
||||
(define-errno-syscall (%peer-name sock family name) %peer-name/errno)
|
||||
|
||||
|
@ -316,10 +316,10 @@
|
|||
(make-socket-address family name))))
|
||||
|
||||
(define-foreign %socket-name/errno
|
||||
(scheme_socket_name (integer sockfd)
|
||||
(integer family)
|
||||
(scheme_socket_name (fixnum sockfd)
|
||||
(fixnum family)
|
||||
(string-desc name))
|
||||
(to-scheme integer "False_on_zero"))
|
||||
(to-scheme fixnum "False_on_zero"))
|
||||
|
||||
(define-errno-syscall
|
||||
(%socket-name sock family name) %socket-name/errno)
|
||||
|
@ -336,9 +336,9 @@
|
|||
(%shutdown (socket->fdes sock) how))))
|
||||
|
||||
(define-foreign %shutdown/errno
|
||||
(shutdown (integer sockfd)
|
||||
(integer how))
|
||||
(to-scheme integer errno_or_false))
|
||||
(shutdown (fixnum sockfd)
|
||||
(fixnum how))
|
||||
(to-scheme fixnum errno_or_false))
|
||||
|
||||
(define-errno-syscall
|
||||
(%shutdown sock how) %shutdown/errno)
|
||||
|
@ -360,10 +360,10 @@
|
|||
|
||||
;; based on pipe in syscalls.scm
|
||||
(define-foreign %socket-pair/errno
|
||||
(scheme_socket_pair (integer type))
|
||||
(to-scheme integer errno_or_false)
|
||||
integer
|
||||
integer)
|
||||
(scheme_socket_pair (fixnum type))
|
||||
(to-scheme fixnum errno_or_false)
|
||||
fixnum
|
||||
fixnum)
|
||||
|
||||
(define-errno-syscall
|
||||
(%socket-pair type) %socket-pair/errno
|
||||
|
@ -488,14 +488,14 @@
|
|||
s start start end addr))))))))
|
||||
|
||||
(define-foreign recv-substring!/errno
|
||||
(recv_substring (integer sockfd)
|
||||
(integer flags)
|
||||
(recv_substring (fixnum sockfd)
|
||||
(fixnum flags)
|
||||
(string-desc buf)
|
||||
(integer start)
|
||||
(integer end)
|
||||
(size_t start)
|
||||
(size_t end)
|
||||
(string-desc name))
|
||||
(multi-rep (to-scheme integer errno_or_false)
|
||||
integer))
|
||||
(multi-rep (to-scheme ssize_t errno_or_false)
|
||||
ssize_t))
|
||||
|
||||
;;;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
;;; send syscall
|
||||
|
@ -564,15 +564,15 @@
|
|||
s start start end writer)))))))
|
||||
|
||||
(define-foreign send-substring/errno
|
||||
(send_substring (integer sockfd)
|
||||
(integer flags)
|
||||
(send_substring (fixnum sockfd)
|
||||
(fixnum flags)
|
||||
(string-desc buf)
|
||||
(integer start)
|
||||
(integer end)
|
||||
(integer family)
|
||||
(size_t start)
|
||||
(size_t end)
|
||||
(fixnum family)
|
||||
(string-desc name))
|
||||
(multi-rep (to-scheme integer errno_or_false)
|
||||
integer))
|
||||
(multi-rep (to-scheme ssize_t errno_or_false)
|
||||
ssize_t))
|
||||
|
||||
;;;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
;;; getsockopt syscall
|
||||
|
@ -609,22 +609,22 @@
|
|||
"socket-option: unknown option type ~s" option)))
|
||||
|
||||
(define-foreign %getsockopt/errno
|
||||
(scheme_getsockopt (integer sockfd)
|
||||
(integer level)
|
||||
(integer optname))
|
||||
(multi-rep (to-scheme integer errno_or_false)
|
||||
integer))
|
||||
(scheme_getsockopt (fixnum sockfd)
|
||||
(fixnum level)
|
||||
(fixnum optname))
|
||||
(multi-rep (to-scheme fixnum errno_or_false)
|
||||
fixnum))
|
||||
|
||||
(define-errno-syscall (%getsockopt sock level option) %getsockopt/errno
|
||||
value)
|
||||
|
||||
(define-foreign %getsockopt-linger/errno
|
||||
(scheme_getsockopt_linger (integer sockfd)
|
||||
(integer level)
|
||||
(integer optname))
|
||||
(multi-rep (to-scheme integer errno_or_false)
|
||||
integer) ; error/on-off
|
||||
integer) ; linger time
|
||||
(scheme_getsockopt_linger (fixnum sockfd)
|
||||
(fixnum level)
|
||||
(fixnum optname))
|
||||
(multi-rep (to-scheme fixnum errno_or_false)
|
||||
fixnum) ; error/on-off
|
||||
fixnum) ; linger time
|
||||
|
||||
(define-errno-syscall
|
||||
(%getsockopt-linger sock level option) %getsockopt-linger/errno
|
||||
|
@ -632,12 +632,12 @@
|
|||
linger)
|
||||
|
||||
(define-foreign %getsockopt-timeout/errno
|
||||
(scheme_getsockopt_timeout (integer sockfd)
|
||||
(integer level)
|
||||
(integer optname))
|
||||
(multi-rep (to-scheme integer errno_or_false)
|
||||
integer) ; error/secs
|
||||
integer) ; usecs
|
||||
(scheme_getsockopt_timeout (fixnum sockfd)
|
||||
(fixnum level)
|
||||
(fixnum optname))
|
||||
(multi-rep (to-scheme fixnum errno_or_false)
|
||||
fixnum) ; error/secs
|
||||
fixnum) ; usecs
|
||||
|
||||
(define-errno-syscall
|
||||
(%getsockopt-timeout sock level option) %getsockopt-timeout/errno
|
||||
|
@ -671,34 +671,34 @@
|
|||
"set-socket-option: unknown option type")))
|
||||
|
||||
(define-foreign %setsockopt/errno
|
||||
(scheme_setsockopt (integer sockfd)
|
||||
(integer level)
|
||||
(integer optname)
|
||||
(integer optval))
|
||||
(to-scheme integer errno_or_false))
|
||||
(scheme_setsockopt (fixnum sockfd)
|
||||
(fixnum level)
|
||||
(fixnum optname)
|
||||
(fixnum optval))
|
||||
(to-scheme fixnum errno_or_false))
|
||||
|
||||
(define-errno-syscall
|
||||
(%setsockopt sock level option value) %setsockopt/errno)
|
||||
|
||||
|
||||
(define-foreign %setsockopt-linger/errno
|
||||
(scheme_setsockopt_linger (integer sockfd)
|
||||
(integer level)
|
||||
(integer optname)
|
||||
(integer on-off)
|
||||
(integer time))
|
||||
(to-scheme integer errno_or_false))
|
||||
(scheme_setsockopt_linger (fixnum sockfd)
|
||||
(fixnum level)
|
||||
(fixnum optname)
|
||||
(fixnum on-off)
|
||||
(fixnum time))
|
||||
(to-scheme fixnum errno_or_false))
|
||||
|
||||
(define-errno-syscall
|
||||
(%setsockopt-linger sock level option on-off time) %setsockopt-linger/errno)
|
||||
|
||||
(define-foreign %setsockopt-timeout/errno
|
||||
(scheme_setsockopt_timeout (integer sockfd)
|
||||
(integer level)
|
||||
(integer optname)
|
||||
(integer secs)
|
||||
(integer usecs))
|
||||
(to-scheme integer errno_or_false))
|
||||
(scheme_setsockopt_timeout (fixnum sockfd)
|
||||
(fixnum level)
|
||||
(fixnum optname)
|
||||
(fixnum secs)
|
||||
(fixnum usecs))
|
||||
(to-scheme fixnum errno_or_false))
|
||||
|
||||
(define-errno-syscall
|
||||
(%setsockopt-timeout sock level option secs usecs) %setsockopt-timeout/errno)
|
||||
|
@ -752,7 +752,7 @@
|
|||
|
||||
(define-foreign %host-address->host-info/h-errno
|
||||
(scheme_host_address2host_info (string-desc name))
|
||||
(to-scheme integer "False_on_zero")
|
||||
(to-scheme fixnum "False_on_zero")
|
||||
static-string ; host name
|
||||
(C char**) ; alias list
|
||||
(C char**)) ; address list
|
||||
|
@ -772,7 +772,7 @@
|
|||
|
||||
(define-foreign %host-name->host-info/h-errno
|
||||
(scheme_host_name2host_info (string name))
|
||||
(to-scheme integer "False_on_zero")
|
||||
(to-scheme fixnum "False_on_zero")
|
||||
static-string ; host name
|
||||
(C char**) ; alias list
|
||||
(C char**)) ; address list
|
||||
|
@ -806,7 +806,7 @@
|
|||
|
||||
(define-foreign %net-address->network-info
|
||||
(scheme_net_address2net_info (string-desc name) (string-desc net))
|
||||
(to-scheme integer "False_on_zero")
|
||||
(to-scheme fixnum "False_on_zero")
|
||||
static-string ; net name
|
||||
(C char**)) ; alias list
|
||||
|
||||
|
@ -824,7 +824,7 @@
|
|||
|
||||
(define-foreign %net-name->network-info
|
||||
(scheme_net_name2net_info (string name) (string-desc net))
|
||||
(to-scheme integer "False_on_zero")
|
||||
(to-scheme fixnum "False_on_zero")
|
||||
static-string ; net name
|
||||
(C char**)) ; alias list
|
||||
|
||||
|
@ -858,11 +858,11 @@
|
|||
protocol))))))
|
||||
|
||||
(define-foreign %service-port->service-info
|
||||
(scheme_serv_port2serv_info (integer name) (string proto))
|
||||
(to-scheme integer "False_on_zero")
|
||||
(scheme_serv_port2serv_info (fixnum name) (string proto))
|
||||
(to-scheme fixnum "False_on_zero")
|
||||
static-string ; service name
|
||||
(C char**) ; alias list
|
||||
integer ; port number
|
||||
fixnum ; port number
|
||||
static-string) ; protocol name
|
||||
|
||||
|
||||
|
@ -874,10 +874,10 @@
|
|||
|
||||
(define-foreign %service-name->service-info
|
||||
(scheme_serv_name2serv_info (string name) (string proto))
|
||||
(to-scheme integer "False_on_zero")
|
||||
(to-scheme fixnum "False_on_zero")
|
||||
static-string ; service name
|
||||
(C char**) ; alias list
|
||||
integer ; port number
|
||||
fixnum ; port number
|
||||
static-string) ; protocol name
|
||||
|
||||
;;;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
|
@ -904,11 +904,11 @@
|
|||
protocol))))
|
||||
|
||||
(define-foreign %protocol-port->protocol-info
|
||||
(scheme_proto_num2proto_info (integer name))
|
||||
(to-scheme integer "False_on_zero")
|
||||
(scheme_proto_num2proto_info (fixnum name))
|
||||
(to-scheme fixnum "False_on_zero")
|
||||
static-string ; protocol name
|
||||
(C char**) ; alias list
|
||||
integer) ; protocol number
|
||||
fixnum) ; protocol number
|
||||
|
||||
(define (name->protocol-info name)
|
||||
(if (not (string? name))
|
||||
|
@ -922,10 +922,10 @@
|
|||
|
||||
(define-foreign %protocol-name->protocol-info
|
||||
(scheme_proto_name2proto_info (string name))
|
||||
(to-scheme integer "False_on_zero")
|
||||
(to-scheme fixnum "False_on_zero")
|
||||
static-string ; protocol name
|
||||
(C char**) ; alias list
|
||||
integer) ; protocol number
|
||||
fixnum) ; protocol number
|
||||
|
||||
;;;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
;;; Lowlevel junk
|
||||
|
|
|
@ -200,11 +200,11 @@ int scheme_socket_pair(int type, int *s1, int *s2)
|
|||
}
|
||||
|
||||
/*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/
|
||||
int recv_substring(int s,
|
||||
ssize_t recv_substring(int s,
|
||||
int flags,
|
||||
s48_value buf,
|
||||
int start,
|
||||
int end,
|
||||
size_t start,
|
||||
size_t end,
|
||||
s48_value scheme_name)
|
||||
{
|
||||
|
||||
|
@ -242,8 +242,8 @@ int recv_substring(int s,
|
|||
int send_substring(int s,
|
||||
int flags,
|
||||
s48_value buf,
|
||||
int start,
|
||||
int end,
|
||||
size_t start,
|
||||
size_t end,
|
||||
int family,
|
||||
s48_value scheme_name)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue