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