Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
The software is provided “as is”, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.
Describe IOLib here.
Describe networking here.
Class precedence list:
socket, dual-channel-single-fd-mixin, dual-channel-fd-mixin, standard-object, t
Base class for sockets.
Class precedence list:
stream-socket, socket, dual-channel-single-fd-mixin, dual-channel-fd-mixin, standard-object, t
Mixin for sockets of type SOCK_STREAM.
Class precedence list:
datagram-socket, socket, dual-channel-single-fd-mixin, dual-channel-fd-mixin, standard-object, t
Mixin for sockets of type SOCK_DGRAM.
Class precedence list:
internet-socket, socket, dual-channel-single-fd-mixin, dual-channel-fd-mixin, standard-object, t
Mixin for sockets of domain AF_INET or AF_INET6.
Class precedence list:
local-socket, socket, dual-channel-single-fd-mixin, dual-channel-fd-mixin, standard-object, t
Mixin for sockets of domain AF_LOCAL.
Class precedence list:
active-socket, socket, dual-channel-single-fd-mixin, dual-channel-gray-stream, trivial-gray-stream-mixin, dual-channel-fd-mixin, fundamental-binary-input-stream, fundamental-binary-output-stream, fundamental-character-input-stream, fundamental-input-stream, fundamental-character-output-stream, fundamental-output-stream, fundamental-character-stream, fundamental-binary-stream, fundamental-stream, standard-object, stream, t
Mixin class for active(client) sockets.
Class precedence list:
passive-socket, socket, dual-channel-single-fd-mixin, dual-channel-fd-mixin, standard-object, t
Mixin class for PASSIVE(server) sockets.
Class precedence list:
socket-stream-internet-active, active-socket, stream-socket, internet-socket, socket, dual-channel-single-fd-mixin, dual-channel-gray-stream, trivial-gray-stream-mixin, dual-channel-fd-mixin, fundamental-binary-input-stream, fundamental-binary-output-stream, fundamental-character-input-stream, fundamental-input-stream, fundamental-character-output-stream, fundamental-output-stream, fundamental-character-stream, fundamental-binary-stream, fundamental-stream, standard-object, stream, t
Class representing active sockets of type SOCK_STREAM and domain AF_INET or AF_INET6.
Class precedence list:
socket-stream-internet-passive, passive-socket, stream-socket, internet-socket, socket, dual-channel-single-fd-mixin, dual-channel-fd-mixin, standard-object, t
Class representing passive sockets of type SOCK_STREAM and domain AF_INET or AF_INET6.
Class precedence list:
socket-stream-local-active, active-socket, stream-socket, local-socket, socket, dual-channel-single-fd-mixin, dual-channel-gray-stream, trivial-gray-stream-mixin, dual-channel-fd-mixin, fundamental-binary-input-stream, fundamental-binary-output-stream, fundamental-character-input-stream, fundamental-input-stream, fundamental-character-output-stream, fundamental-output-stream, fundamental-character-stream, fundamental-binary-stream, fundamental-stream, standard-object, stream, t
Class representing active sockets of type SOCK_STREAM and domain AF_LOCAL.
Class precedence list:
socket-stream-local-passive, passive-socket, stream-socket, local-socket, socket, dual-channel-single-fd-mixin, dual-channel-fd-mixin, standard-object, t
Class representing passive sockets of type SOCK_STREAM and domain AF_LOCAL.
Class precedence list:
socket-datagram-internet-active, active-socket, datagram-socket, internet-socket, socket, dual-channel-single-fd-mixin, dual-channel-gray-stream, trivial-gray-stream-mixin, dual-channel-fd-mixin, fundamental-binary-input-stream, fundamental-binary-output-stream, fundamental-character-input-stream, fundamental-input-stream, fundamental-character-output-stream, fundamental-output-stream, fundamental-character-stream, fundamental-binary-stream, fundamental-stream, standard-object, stream, t
Class representing active sockets of type SOCK_DGRAM and domain AF_INET or AF_INET6.
Class precedence list:
socket-datagram-local-active, active-socket, datagram-socket, local-socket, socket, dual-channel-single-fd-mixin, dual-channel-gray-stream, trivial-gray-stream-mixin, dual-channel-fd-mixin, fundamental-binary-input-stream, fundamental-binary-output-stream, fundamental-character-input-stream, fundamental-input-stream, fundamental-character-output-stream, fundamental-output-stream, fundamental-character-stream, fundamental-binary-stream, fundamental-stream, standard-object, stream, t
Class representing active sockets of type SOCK_DGRAM and domain AF_LOCAL.
Create an instance of a subclass of
socket
.address-family
,type
,connect
and IPV6 are used to specify the kind of socket to create.To initialize the socket, the following keyword arguments can be used depending on
address-family
-
:internet
or:local
(or:file
as synonim)type
-
:stream
or:datagram
connect
-
:active
or:passive
- IPV6
-
ifnil
, create an IPv4 socket, otherwise an IPv6 socket.address-family
,type
andconnect:
Glossary:
- :local-host
-
a hostname designator ornil
. If non-null the socket will be bound to this address- :local-port
-
a port designator ornil
. Iflocal-host
is non-null, bind the socket to this port. Ifnil
, choose a random port- :remote-host
-
a hostname designator ornil
. If non-null the socket will be connected to this address- :remote-port
-
a port designator. Ifremote-host
is non-null, connect the socket to this port- :local-filename
-
a string ornil
. If non-null the socket will be bound to this file- :remote-filename
-
a string ornil
. If non-null the socket will be connected to this file- :backlog
-
a positive integer ornil
. Specifies the length of the incomming connection queue and can't be larger than+max-backlog-size+
. Ifnil
, default is*default-backlog-size*
- :reuse-address: a boolean(default T). set option SO_REUSEADDR if
local-host
is non-null- :keepalive
-
a boolean. set option SO_KEEPALIVE- :nodelay
-
a boolean. set option SO_NODELAY- :interface
-
a string. set option SO_BINDTODEVICE to this interface- :input-buffer-size
-
a positive integer. Create the stream input buffer of this size- :output-buffer-size
-
a positive integer. Create the stream output buffer of this size:address-family
- hostname designator: an instance of
inet-address
or any object accepted bylookup-host
. IPV6 is passed tolookup-host
as is- port designator: any object accepted by
lookup-service
:internet
:type:stream
:connect:active
:address-family
- Valid keyword args:
:local-host
,:local-port
,:remote-host
,:remote-port
,:reuse-address
,:keepalive
,:nodelay
,:input-buffer-size
and:output-buffer-size
:internet
:type:stream
:connect:passive
:address-family
- Valid keyword args:
:local-host
,:local-port
,:backlog
,:reuse-address
,:interface
and:nodelay
:internet
:type:stream
:connect:active
:address-family
- Valid keyword args:
:local-filename
,:remote-filename
,:input-buffer-size
and:output-buffer-size
:internet
:type:stream
:connect:passive
:address-family
- Valid keyword args:
:local-filename
,:remote-filename
,:backlog
and:reuse-address
:internet
:type:datagram
:address-family
- Valid keyword args:
:local-host
,:local-port
,:remote-host
,:remote-port
,:reuse-address
,:interface
and:broadcast
:local
:type:datagram
- Valid keyword args:
:local-filename
and:remote-filename
Bind
var
to a socket created by passingargs
tomake-socket
and executebody
as implicitprogn
. The socket is automatically closed upon exit.
Create a socket instance of the appropriate subclass of
socket
usingfd
. The connection type of the socket must be specified-
:active
or:passive
. The address family and type of the socket are automatically discovered usingos
functions. Buffer sizes for the new socket can also be specified usinginput-buffer-size
andoutput-buffer-size
.
Create a pair of sockets connected to each other. The socket type must be either
:stream
or:datagram
. Currently OSes can only create:local
sockets this way. Buffer sizes for the new sockets can also be specified usinginput-buffer-size
andoutput-buffer-size
.
Send the contents of
buffer
tosocket
.buffer
must be a vector that can be coerced to a (SIMPLE-ARRAY (UNSIGNED-BYTE 8) (*)).start
andend
are used a bounding index onbuffer
. For disconnected datagram sockets,remote-host
andremote-port
orremote-filename
are used as destination for the data.Some flags can also be passed to sendto(2):
Returns the number of bytes sent.
:out-of-band
for receiving out-of-band data-
only for stream sockets:dont-wait
for making only the current call non-blocking:dont-route
for sending only to hosts on directly connected networks, not using gateways:confirm
for signalling progress on the link layer-
only available on Linux and only withdatagram
sockets:more
for telling the kernel that there is more data to send-
only available on Linux
Receives data from
socket
. Ifbuffer
is specifiedstart
andend
are used as bounding index. In that casebuffer
must be an array and itsarray-element-type
be either (UNSIGNED-BYTE 8) ort
. Ifbuffer
is not specified an (UNSIGNED-BYTE 8) buffer of sizesize
will be allocated.Some flags can also be passed to recvfrom(2):
The first two values returned are the buffer and the number of elements that have been copied into the buffer. For
:out-of-band
for receiving out-of-band data-
only forstream
sockets:peek
for keeping the returned data in the kernel buffers:wait-all
for waiting until the entire buffer can be filled:dont-wait
for making only the current call non-blockinginternet
datagram
sockets, two additional values are returned: the host and port of the remote peer from which the data was received. Forlocal
datagram
sockets, one additional values is returned: the filename of the remote peer from which the data was received.
Sets the local address of
socket
to ADDRESS(andport
forinternet
sockets).reuse-address
sets the SO_REUSEADDR socket option onsocket
.
Start allowing incoming connections on
socket
.backlog
specifies the maximum length of the queue of pending connections.
Returns one connection from the queue of pending connections on
socket
. Ifwait
is true, waits until a connection is received ortimeout
expires in which case returnsnil
. Ifwait
is false and there are no pending connections returnnil
.external-format
optionally specifies the external format of the new socket-
the default being that ofsocket
. Buffer sizes for the new socket can also be specified usinginput-buffer-size
andoutput-buffer-size
.
Bind
var
to a socket created by passingpassive-socket
andargs
toaccept-connection
and executebody
as implicitprogn
. The socket is automatically closed upon exit.
Connects
socket
toaddress
. Forinternet
sockets you can specify the port to connect to using keyword argumentport
. The default value ofport
is 0, which usually means letting theos
choose a random port to connect to. Forinternet
sockets, ifwait
is true and a connection cannot be established withintimeout
seconds signaliomux:poll-timeout
, but it works only with non-blocking sockets.
Disassociates
socket
from any remote address. Works only ondatagram
sockets.
Shut down all or part of a connection. If
read
it non-NIL, further receptions are disallowed; ifwrite
is non-NIL, further transmissions are disallowed.close
must still be called onsocket
in order to releaseos
resources.
Send
file-descriptor
throughsocket
. The receiving process must usereceive-file-descriptor
to receive the file descriptor in order for it to be valid in the receiving process.
For
internet
sockets, returns two values: the local host and the local port. Forlocal
sockets, returns the local filename.
Returns the local host of
socket
. Works only oninternet
sockets.
Returns the local port of
socket
-
an (UNSIGNED-BYTE 16). Works only oninternet
sockets.
Returns the local filename of
socket
. Works only onlocal
sockets.
For
internet
sockets, returns two values: the remote host and the remote port. Forremote
sockets, returns the remote filename.
Returns the remote host of
socket
. Works only oninternet
sockets.
Returns the remote port of
socket
-
an (UNSIGNED-BYTE 16). Works only oninternet
sockets.
Returns the remote filename of
socket
. Works only onlocal
sockets.
Returns a boolean indicating whether or not the file descriptor of
socket
is open.
Returns a boolean specifying whether or not
socket
is connected.
Class precedence list:
address, standard-object, t
Base class for all socket address classes.
Class precedence list:
inet-address, address, standard-object, t
Base class for IPv4 and IPv6 addresses.
Class precedence list:
ipv4-address, inet-address, address, standard-object, t
IPv4 address. Its low-level representation can be accessed as vector of type IPV4-ARRAY through the
address-name
reader.
Class precedence list:
ipv6-address, inet-address, address, standard-object, t
IPv6 address. Its low-level representation can be accessed as vector of type IPV6-ARRAY through the
address-name
reader.
Class precedence list:
local-address, address, standard-object, t
unix
socket address.
Constructs an
address
object.name
should be of type IPV4-ARRAY, IPV6-ARRAY orstring
in which case an instance of IPV4-ADDRESS, IPV6-ADDRESS orlocal-address
, respectively, will be created. Otherwise, atype-error
is signalled. See alsoensure-address
.
Returns a copy of
address
which is ADDRESS= to the original.
If
family
is:local
, alocal-address
is instantiated withaddress
as itsname
slot. Iffamily
is:internet
, an appropriate subtype ofinet-address
is instantiated after guessing the address type throughaddress-to-vector
. If the address is invalid anderrorp
is notnil
, then acl:parse-error
is signalled, otherwisenil
is returned.When
address
is already an instance of theaddress
class, a check is made to see if it matches thefamily
argument and it is returned unmodified.
Convert any representation of an internet address to a vector. Allowed inputs are: unsigned 32-bit integers, strings, vectors and
inet-address
objects. If the address is valid, two values are returned: the vector and the address type (:IPV4 or IPV6), otherwisenil
is returned.
Returns
t
ifaddress
is an object of classaddress
. Does not returnt
for other low-level address representations.
Returns
t
if both arguments are designators for the same socket address.
Return
t
ifaddress
is alocal-address
that lives in the abstract namespace.
Returns a keyword symbol denoting the kind of
address
(:IPV4, :IPV6 or :LOCAL). Ifaddress
is not a known address object,nil
is returned.
Returns the address type of
address
as 2 values:For unicast or multicast IPv6 addresses, a third value is returned which corresponds to the return value of IPV6-UNICAST-TYPE or IPV6-MULTICAST-TYPE, respectively.
- protocol, one of :IPV4 or :IPV6
- kind, one of
:unspecified
,:loopback
,:multicast
or:unicast
Returns
t
ifaddress
is a admin-local multicast IPv6 address.
Returns
t
ifaddress
is an IPv6 address representing an IPv4 mapped address.
Returns the multicast type of
address
ornil
if it's not a multicast address.
Returns
t
ifaddress
is an organization-local multicast IPv6 address.
Returns
t
ifaddress
is an site-local multicast IPv6 address.
Returns
t
ifaddress
is a solicited-node multicast IPv6 address.
Returns
t
ifaddress
is an unassigned multicast IPv6 address.
Returns the unicast type of
address
ornil
if it's not a unicast address.
Create a subnet mask by specifying either its class(:A,
:b
or :C) or acidr
suffix(a number between 0 and 32).
If
thing
is of type IPV4-ADDRESS it is returned as is; if keyword it must be one of:a
,:b
or:c
otherwise it's treated as acidr
suffix.
Apply network netmask
netmask
toaddress
in order to calculate the network part ofaddress
.
Apply network netmask
netmask
toaddress
in order to calculate the host part ofaddress
.
Return
t
ifaddress
is part of the subnet specified bynetwork
.
Return
t
if ADDRESS1 and ADDRESS2 are both part part of the subnet specified bynetwork
.
Return the network class of
address:
one of:a
,:b
,:c
,:d
or:e
.
Returns
t
ifaddress
is in a private network range. Private IPv4 networks are 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. See http://en.wikipedia.org/wiki/Private_network for details.
Convert an (UNSIGNED-BYTE 32) IPv4 address to a dotted string.
Convert a dotted IPv4 address to a (SIMPLE-ARRAY (UNSIGNED-BYTE 8) 4).
Convert a colon-separated IPv6 address to a (SIMPLE-ARRAY (UNSIGNED-BYTE 16) 8).
Convert an (SIMPLE-ARRAY (UNSIGNED-BYTE 16) 8) to a colon-separated IPv6 address.
case
may be:downcase
or:upcase
.
Convert a string address (dotted or colon-separated) to a vector address. If the string is not a valid address, return
nil
.
Extracts the IPv4 part of an IPv6-mapped IPv4 address. Signals an error if
address
is not an IPv6-mapped IPv4 address.
Looks up a host by name or address. IPV6 determines the IPv6 behaviour, defaults to *IPV6*. Returns 4 values:
- an address
- a list of additional addresses(if existent)
- the canonical name of the host
- an alist of all the host's names with their respective addresses
If
address
is an inet-address designator, it is converted, if necessary, to aninet-address
object and returned. Otherwise it is assumed to be a host name which is then looked up in order to return its primary address as the first return value and the remaining address list as the second return value.
Class precedence list:
resolver-error, condition, t
Signaled when an error occurs while trying to resolve an address.
Return the datum that caused the signalling of a
resolver-error
condition.
Class precedence list:
resolver-again-error, resolver-error, condition, t
Condition signaled when a temporary failure occurred.
Class precedence list:
resolver-fail-error, resolver-error, condition, t
Condition signaled when a non-recoverable error occurred.
Class precedence list:
resolver-no-name-error, resolver-error, condition, t
Condition signaled when a host or service was not found.
Class precedence list:
resolver-unknown-error, resolver-error, condition, t
Condition signaled when an unknown error is signaled while resolving an address.
Lookup a service by port or name.
protocol
should be one of:tcp
,:udp
or:any
.
Class precedence list:
unknown-service, condition, t
Condition raised when a network service is not found.
Return the datum that caused the signalling of an
unknown-service
condition.
Lookup a protocol by name or number. Signals an
unknown-protocol
error if no protocol is found.
Class precedence list:
unknown-protocol, condition, t
Condition raised when a network protocol is not found.
Return the datum that caused the signalling of an
unknown-protocol
condition.
Lookup an interface by name or index.
unknown-interface
is signalled if an interface is not found.
Class precedence list:
unknown-interface, enxio, syscall-error, iolib-error, error, serious-condition, iolib-condition, condition, t
Condition raised when a network interface is not found.
Return the datum that caused the signalling of an
unknown-interface
condition.
sockets:abstract-address-p
: Address Predicatessockets:accept-connection
: Socket Operatorssockets:active-socket
: Socket Classessockets:address
: Address Classessockets:address-equal-p
: Address Predicatessockets:address-to-string
: Address Functionssockets:address-to-vector
: Address Functionssockets:address-type
: Address Predicatessockets:address=
: Address Predicatessockets:addressp
: Address Predicatessockets:bind-address
: Socket Operatorssockets:colon-separated-to-vector
: Low-level Address Manipulationsockets:connect
: Socket Operatorssockets:copy-address
: Address Functionssockets:datagram-socket
: Socket Classessockets:disconnect
: Socket Operatorssockets:dotted-to-integer
: Low-level Address Manipulationsockets:dotted-to-vector
: Low-level Address Manipulationsockets:ensure-address
: Address Functionssockets:ensure-hostname
: DNSsockets:ensure-netmask
: Address Arithmeticsockets:inet-address
: Address Classessockets:inet-address-host-portion
: Address Arithmeticsockets:inet-address-in-network-p
: Address Arithmeticsockets:inet-address-loopback-p
: Address Predicatessockets:inet-address-multicast-p
: Address Predicatessockets:inet-address-network-class
: Address Arithmeticsockets:inet-address-network-portion
: Address Arithmeticsockets:inet-address-private-p
: Address Arithmeticsockets:inet-address-type
: Address Predicatessockets:inet-address-unicast-p
: Address Predicatessockets:inet-address-unspecified-p
: Address Predicatessockets:inet-addresses-in-same-network-p
: Address Arithmeticsockets:integer-to-dotted
: Low-level Address Manipulationsockets:integer-to-vector
: Low-level Address Manipulationsockets:interface-index
: Network Interfacessockets:interface-name
: Network Interfacessockets:internet-socket
: Socket Classessockets:ipv4-address
: Address Classessockets:ipv4-address-p
: Address Predicatessockets:ipv6-address
: Address Classessockets:ipv6-address-p
: Address Predicatessockets:ipv6-admin-local-multicast-p
: Address Predicatessockets:ipv6-global-multicast-p
: Address Predicatessockets:ipv6-global-unicast-p
: Address Predicatessockets:ipv6-interface-local-multicast-p
: Address Predicatessockets:ipv6-ipv4-mapped-p
: Address Predicatessockets:ipv6-link-local-multicast-p
: Address Predicatessockets:ipv6-link-local-unicast-p
: Address Predicatessockets:ipv6-multicast-type
: Address Predicatessockets:ipv6-organization-local-multicast-p
: Address Predicatessockets:ipv6-reserved-multicast-p
: Address Predicatessockets:ipv6-site-local-multicast-p
: Address Predicatessockets:ipv6-site-local-unicast-p
: Address Predicatessockets:ipv6-solicited-node-multicast-p
: Address Predicatessockets:ipv6-transient-multicast-p
: Address Predicatessockets:ipv6-unassigned-multicast-p
: Address Predicatessockets:ipv6-unicast-type
: Address Predicatessockets:list-network-interfaces
: Network Interfacessockets:listen-on
: Socket Operatorssockets:local-address
: Address Classessockets:local-address-p
: Address Predicatessockets:local-filename
: Socket Accessorssockets:local-host
: Socket Accessorssockets:local-name
: Socket Accessorssockets:local-port
: Socket Accessorssockets:local-socket
: Socket Classessockets:lookup-hostname
: DNSsockets:lookup-interface
: Network Interfacessockets:lookup-protocol
: Protocolssockets:lookup-service
: Servicessockets:make-address
: Address Functionssockets:make-interface
: Network Interfacessockets:make-netmask
: Address Arithmeticsockets:make-socket
: Socket Operatorssockets:make-socket-from-fd
: Socket Operatorssockets:make-socket-pair
: Socket Operatorssockets:map-ipv4-address-to-ipv6
: Low-level Address Manipulationsockets:map-ipv6-address-to-ipv4
: Low-level Address Manipulationsockets:passive-socket
: Socket Classessockets:receive-file-descriptor
: Socket Operatorssockets:receive-from
: Socket Operatorssockets:remote-filename
: Socket Accessorssockets:remote-host
: Socket Accessorssockets:remote-name
: Socket Accessorssockets:remote-port
: Socket Accessorssockets:resolver-again-error
: DNSsockets:resolver-error
: DNSsockets:resolver-error-datum
: DNSsockets:resolver-fail-error
: DNSsockets:resolver-no-name-error
: DNSsockets:resolver-unknown-error
: DNSsockets:send-file-descriptor
: Socket Operatorssockets:send-to
: Socket Operatorssockets:shutdown
: Socket Operatorssockets:socket
: Socket Classessockets:socket-address-family
: Socket Accessorssockets:socket-connected-p
: Socket Predicatessockets:socket-datagram-internet-active
: Socket Classessockets:socket-datagram-local-active
: Socket Classessockets:socket-ipv6-p
: Socket Predicatessockets:socket-open-p
: Socket Predicatessockets:socket-os-fd
: Socket Accessorssockets:socket-protocol
: Socket Accessorssockets:socket-stream-internet-active
: Socket Classessockets:socket-stream-internet-passive
: Socket Classessockets:socket-stream-local-active
: Socket Classessockets:socket-stream-local-passive
: Socket Classessockets:socket-type
: Socket Accessorssockets:stream-socket
: Socket Classessockets:string-address-to-vector
: Low-level Address Manipulationsockets:unknown-interface
: Network Interfacessockets:unknown-interface-datum
: Network Interfacessockets:unknown-protocol
: Protocolssockets:unknown-protocol-datum
: Protocolssockets:unknown-service
: Servicessockets:unknown-service-datum
: Servicessockets:vector-to-colon-separated
: Low-level Address Manipulationsockets:vector-to-dotted
: Low-level Address Manipulationsockets:vector-to-integer
: Low-level Address Manipulationsockets:with-accept-connection
: Socket Operatorssockets:with-open-socket
: Socket Operators