IOLib 0.6.0 Manual

draft version 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.

Table of Contents

1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

2 Networking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

2.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 2.2 Sockets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

2.2.1 Socket Classes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 2.2.2 Socket Operators and Macros. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 2.2.3 Socket Accessors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.2.4 Socket Predicates. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.2.5 Socket Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

2.3 Socket Addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

2.3.1 Address Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.3.1.1 Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.3.1.2 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.3.1.3 Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

2.3.2 Address Predicates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 2.3.3 Address Arithmetic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 2.3.4 Low-level Address Manipulation . . . . . . . . . . . . . . . . . . . . . . . . . . 13

2.4 DNS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 2.4.1 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 2.4.2 Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

2.5 Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 2.6 Protocols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 2.7 Network Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

Chapter 1: Overview 1

1 Overview

Describe IOLib here.

2 Networking

2.1 Overview

Describe networking here.

2.2 Sockets

2.2.1 Socket Classes

[Class] sockets:socket
Class precedence list: socket, dual-channel-single-fd-mixin, dual-channel-
fd-mixin, standard-object, t

Base class for sockets.

[Class] sockets:stream-socket
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] sockets:datagram-socket
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] sockets:internet-socket
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] sockets:local-socket
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] sockets:active-socket
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] sockets:passive-socket
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] sockets:socket-stream-internet-active
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] sockets:socket-stream-internet-passive
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] sockets:socket-stream-local-active
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] sockets:socket-stream-local-passive
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] sockets:socket-datagram-internet-active
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] sockets:socket-datagram-local-active
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.

2.2.2 Socket Operators and Macros

[Generic Function] sockets:make-socket &key address-family type connect ipv6 external-format address-family type connect ipv6 external-format

&allow-other-keys

Create an instance of a subclass of socket. address-family, type, connect and IPV6 are used to specify the kind of socket to create.

• address-family - :internet or :local (or :file as synonim)
• type - :stream or :datagram
• connect - :active or :passive

• IPV6 - if nil, create an IPv4 socket, otherwise an IPv6 socket.

To initialize the socket, the following keyword arguments can be used depending on

address-family, type and connect:

• :local-host - a hostname designator or nil. If non-null the socket will be bound to this address

• :local-port - a port designator or nil. If local-host is non-null, bind the socket to this port. If nil, choose a random port

• :remote-host - a hostname designator or nil. If non-null the socket will be connected to this address

• :remote-port - a port designator. If remote-host is non-null, connect the socket to this port

• :local-filename - a string or nil. If non-null the socket will be bound to this file • :remote-filename - a string or nil. If non-null the socket will be connected to

this file

• :backlog - a positive integer or nil. Specifies the length of the incomming connection queue and can’t be larger than +max-backlog-size+. If nil, default is

  *default-backlog-size*

• :reuse-address: a boolean(default T). set option SO REUSEADDR if localhost 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

Glossary:

• hostname designator: an instance of inet-address or any object accepted by

    lookup-host. IPV6 is passed to lookup-host as is

• port designator: any object accepted by lookup-service

:address-family :internet :type :stream :connect :active

  • Valid keyword args: :local-host, :local-port, :remote-host, :remote-port,
    :reuse-address, :keepalive, :nodelay, :input-buffer-size and :output-
    buffer-size

:address-family :internet :type :stream :connect :passive

  • Valid keyword args: :local-host, :local-port, :backlog, :reuse-address,
    :interface and :nodelay

:address-family :internet :type :stream :connect :active

  • Valid keyword args: :local-filename, :remote-filename, :input-buffer-
    size and :output-buffer-size

:address-family :internet :type :stream :connect :passive

  • Valid keyword args: :local-filename, :remote-filename, :backlog and
    :reuse-address

:address-family :internet :type :datagram

  • Valid keyword args: :local-host, :local-port, :remote-host, :remote-port,
    :reuse-address, :interface and :broadcast

:address-family :local :type :datagram

  • Valid keyword args: :local-filename and :remote-filename

[Macro] sockets:with-open-socket (var &rest args) &body body

Bind var to a socket created by passing args to make-socket and execute body as implicit progn. The socket is automatically closed upon exit.

[Generic Function] sockets:make-socket-from-fd fd &key connect

external-format input-buffer-size output-buffer-size connect external-format Create a socket instance of the appropriate subclass of socket using fd. The connection type of the socket must be specified - :active or :passive. The address family and type of the socket are automatically discovered using os functions. Buffer sizes for the new socket can also be specified using input-buffer-size and output-

buffer-size.

[Generic Function] sockets:make-socket-pair &key type protocol

external-format input-buffer-size output-buffer-size type protocol external-format

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 using input-buffer-size and

output-buffer-size.

[Generic Function] sockets:send-to socket buffer &rest args &key start end

remote-filename flags remote-host remote-port ipv6 &allow-other-keys Send the contents of buffer to socket. buffer must be a vector that can be coerced to a (SIMPLE-ARRAY (UNSIGNED-BYTE 8) (*)). start and end are used a bounding index on buffer. For disconnected datagram sockets, remote-host and remote-port or remote-filename are used as destination for the data.

Some flags can also be passed to sendto(2):

• :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 with datagram sockets

• :more for telling the kernel that there is more data to send - only available on Linux

Returns the number of bytes sent.

[Generic Function] sockets:receive-from socket &rest args &key flags end start

buffer size &allow-other-keys

Receives data from socket. If buffer is specified start and end are used as bounding index. In that case buffer must be an array and its array-element-type be either (UNSIGNED-BYTE 8) or t. If buffer is not specified an (UNSIGNED-BYTE 8) buffer of size size will be allocated.

Some flags can also be passed to recvfrom(2):

• :out-of-band for receiving out-of-band data - only for stream 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-blocking

The first two values returned are the buffer and the number of elements that have been copied into the buffer. For internet datagram sockets, two additional values are returned: the host and port of the remote peer from which the data was received. For local datagram sockets, one additional values is returned: the filename of the remote peer from which the data was received.

[Generic Function] sockets:bind-address socket address &key reuse-address port

&allow-other-keys

Sets the local address of socket to ADDRESS(and port for internet sockets). reuse-address sets the SO REUSEADDR socket option on socket.

[Generic Function] sockets:listen-on socket &key backlog &allow-other-keys

Start allowing incoming connections on socket. backlog specifies the maximum length of the queue of pending connections.

[Generic Function] sockets:accept-connection passive-socket &key timeout wait

output-buffer-size input-buffer-size external-format &allow-other-keys Returns one connection from the queue of pending connections on socket. If wait is true, waits until a connection is received or timeout expires in which case returns nil. If wait is false and there are no pending connections return nil. external-format optionally specifies the external format of the new socket - the default being that of socket. Buffer sizes for the new socket can also be specified using input-buffer-

size and output-buffer-size.

[Macro] sockets:with-accept-connection (var passive-socket &rest args)

&body body

Bind var to a socket created by passing passive-socket and args to acceptconnection and execute body as implicit progn. The socket is automatically closed upon exit.

[Generic Function] sockets:connect socket address &key port wait timeout

&allow-other-keys

Connects socket to address. For internet sockets you can specify the port to connect to using keyword argument port. The default value of port is 0, which usually means letting the os choose a random port to connect to. For internet sockets, if wait is true and a connection cannot be established within timeout seconds signal iomux:poll-timeout, but it works only with non-blocking sockets.

[Generic Function] sockets:disconnect socket

Disassociates socket from any remote address. Works only on datagram sockets.

[Generic Function] sockets:shutdown socket &key read write

Shut down all or part of a connection. If read it non-NIL, further receptions are disallowed; if write is non-NIL, further transmissions are disallowed. close must still be called on socket in order to release os resources.

[Generic Function] sockets:send-file-descriptor socket file-descriptor

Send file-descriptor through socket. The receiving process must use receivefile-descriptor to receive the file descriptor in order for it to be valid in the receiving process.

[Generic Function] sockets:receive-file-descriptor socket

Receive a file descriptor as ancillary data through socket.

2.2.3 Socket Accessors

[Generic Function] sockets:socket-os-fd socket

Returns the os file descriptor of socket.

[Generic Function] sockets:socket-type socket

Returns the socket type of socket - :stream or :datagram.

[Generic Function] sockets:socket-protocol object

Return the protocol of a socket.

[Generic Function] sockets:socket-address-family object

Return the address family of a socket.

[Generic Function] sockets:local-name socket

For internet sockets, returns two values: the local host and the local port. For local sockets, returns the local filename.

[Generic Function] sockets:local-host socket

Returns the local host of socket. Works only on internet sockets.

[Generic Function] sockets:local-port socket

Returns the local port of socket - an (UNSIGNED-BYTE 16). Works only on

internet sockets.

[Generic Function] sockets:local-filename socket

Returns the local filename of socket. Works only on local sockets.

[Generic Function] sockets:remote-name socket

For internet sockets, returns two values: the remote host and the remote port. For remote sockets, returns the remote filename.

[Generic Function] sockets:remote-host socket

Returns the remote host of socket. Works only on internet sockets.

[Generic Function] sockets:remote-port socket

Returns the remote port of socket - an (UNSIGNED-BYTE 16). Works only on

internet sockets.
[Generic Function] sockets:remote-filename socket

Returns the remote filename of socket. Works only on local sockets.

2.2.4 Socket Predicates

[Generic Function] sockets:socket-open-p socket

Returns a boolean indicating whether or not the file descriptor of socket is open.

[Generic Function] sockets:socket-connected-p socket

Returns a boolean specifying whether or not socket is connected.

[Function] sockets:socket-ipv6-p socket

Return t if socket is an AF INET6 socket.

2.2.5 Socket Options

2.3 Socket Addresses

2.3.1 Address Objects 2.3.1.1 Classes

[Class] sockets:address
Class precedence list: address, standard-object, t

Base class for all socket address classes.

[Class] sockets:inet-address
Class precedence list: inet-address, address, standard-object, t

Base class for IPv4 and IPv6 addresses.

[Class] sockets:ipv4-address
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] sockets:ipv6-address
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] sockets:local-address
Class precedence list: local-address, address, standard-object, t

unix socket address.

2.3.1.2 Functions

[Function] sockets:make-address name

Constructs an address object. name should be of type IPV4-ARRAY, IPV6-ARRAY or string in which case an instance of IPV4-ADDRESS, IPV6-ADDRESS or localaddress, respectively, will be created. Otherwise, a type-error is signalled. See also

ensure-address.

[Generic Function] sockets:copy-address address

Returns a copy of address which is ADDRESS= to the original.

[Function] sockets:ensure-address address &key family abstract errorp

If family is :local, a local-address is instantiated with address as its name slot.

If family is :internet, an appropriate subtype of inet-address is instantiated after guessing the address type through address-to-vector. If the address is invalid and errorp is not nil, then a cl:parse-error is signalled, otherwise nil is returned. When address is already an instance of the address class, a check is made to see if it matches the family argument and it is returned unmodified.

[Generic Function] sockets:address-to-string address

Returns a textual presentation of address.

[Function] sockets:address-to-vector address

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), otherwise nil is returned.

2.3.1.3 Constants

[Constant] sockets:+ipv4-loopback+

Loopback IPv4 address. (127.0.0.1)

[Constant] sockets:+ipv4-unspecified+

Unspecified IPv4 address. (0.0.0.0)

[Constant] sockets:+ipv6-interface-local-all-nodes+

Interface local all nodes address. (ff01::1)

[Constant] sockets:+ipv6-interface-local-all-routers+

Interface local all routers address. (ff01::2)

[Constant] sockets:+ipv6-link-local-all-nodes+

Link local all nodes address. (ff02::1)

[Constant] sockets:+ipv6-link-local-all-routers+

Link local all routers address. (ff02::2)

[Constant] sockets:+ipv6-loopback+

Loopback IPv6 address. (::1)

[Constant] sockets:+ipv6-site-local-all-routers+

Site local all routers address. (ff05::2)

[Constant] sockets:+ipv6-unspecified+

Unspecified IPv6 address. (::)

2.3.2 Address Predicates

[Function] sockets:addressp address

Returns t if address is an object of class address. Does not return t for other low-level address representations.

[Generic Function] sockets:address= addr1 addr2

Returns t if both arguments are the same socket address.

[Function] sockets:address-equal-p addr1 addr2 &optional family

Returns t if both arguments are designators for the same socket address.

[Function] sockets:ipv4-address-p address

Returns t if address is an IPv4 address object.

[Function] sockets:ipv6-address-p address

Returns t if address is an IPv6 address object.

[Function] sockets:local-address-p address

Returns t if address is a local address object.

[Generic Function] sockets:abstract-address-p object

Return t if address is a local-address that lives in the abstract namespace.

[Generic Function] sockets:address-type address

Returns a keyword symbol denoting the kind of address (:IPV4, :IPV6 or :LOCAL). If address is not a known address object, nil is returned.

[Generic Function] sockets:inet-address-loopback-p address

Returns t if address is a loopback internet address.

[Generic Function] sockets:inet-address-multicast-p address

Returns t if address is an multicast internet address.

[Generic Function] sockets:inet-address-type address

Returns the address type of address as 2 values:

• protocol, one of :IPV4 or :IPV6

  • kind, one of :unspecified, :loopback, :multicast or :unicast

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.

[Generic Function] sockets:inet-address-unicast-p address

Returns t if address is an unicast internet address.

[Generic Function] sockets:inet-address-unspecified-p addr

Returns t if addr is an "unspecified" internet address.

[Function] sockets:ipv6-admin-local-multicast-p address

Returns t if address is a admin-local multicast IPv6 address.

[Function] sockets:ipv6-global-multicast-p address

Returns t if address is a global multicast IPv6 address.

[Function] sockets:ipv6-global-unicast-p address

Returns t if address is an global unicasst IPv6 address.

[Function] sockets:ipv6-interface-local-multicast-p address

Returns t if address is an interface-local IPv6 address.

[Function] sockets:ipv6-ipv4-mapped-p address

Returns t if address is an IPv6 address representing an IPv4 mapped address.

[Function] sockets:ipv6-link-local-multicast-p address

Returns t if address is a link-local IPv6 address.

[Function] sockets:ipv6-link-local-unicast-p address

Returns t if address is an link-local unicast IPv6 address.

[Function] sockets:ipv6-multicast-type address

Returns the multicast type of address or nil if it’s not a multicast address.

[Function] sockets:ipv6-organization-local-multicast-p address

Returns t if address is an organization-local multicast IPv6 address.

[Function] sockets:ipv6-reserved-multicast-p address

Returns t if address is a reserved multicast IPv6 address.

[Function] sockets:ipv6-site-local-multicast-p address

Returns t if address is an site-local multicast IPv6 address.

[Function] sockets:ipv6-site-local-unicast-p address

Returns t if address is an site-local unicast IPv6 address.

[Function] sockets:ipv6-solicited-node-multicast-p address

Returns t if address is a solicited-node multicast IPv6 address.

[Function] sockets:ipv6-transient-multicast-p address

Returns t if address is a transient multicast IPv6 address.

[Function] sockets:ipv6-unassigned-multicast-p address

Returns t if address is an unassigned multicast IPv6 address.

[Function] sockets:ipv6-unicast-type address

Returns the unicast type of address or nil if it’s not a unicast address.

2.3.3 Address Arithmetic

[Function] sockets:make-netmask &key cidr class

Create a subnet mask by specifying either its class(:A, :b or :C) or a cidr suffix(a number between 0 and 32).

[Function] sockets:ensure-netmask thing

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 a cidr suffix.

[Generic Function] sockets:inet-address-network-portion address netmask

Apply network netmask netmask to address in order to calculate the network part

of address.
[Generic Function] sockets:inet-address-host-portion address netmask

Apply network netmask netmask to address in order to calculate the host part of

address.
[Generic Function] sockets:inet-address-in-network-p address network

Return t if address is part of the subnet specified by network.

[Generic Function] sockets:inet-addresses-in-same-network-p address1

address2 network Return t if ADDRESS1 and ADDRESS2 are both part part of the subnet specified

by network.

[Generic Function] sockets:inet-address-network-class address

Return the network class of address: one of :a, :b, :c, :d or :e .

[Generic Function] sockets:inet-address-private-p address

Returns t if address 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.

2.3.4 Low-level Address Manipulation

[Constant] sockets:+max-ipv4-value+

Integer denoting 255.255.255.255

[Function] sockets:dotted-to-integer address

Convert a dotted IPv4 address to an (UNSIGNED-BYTE 32).

[Function] sockets:integer-to-dotted integer

Convert an (UNSIGNED-BYTE 32) IPv4 address to a dotted string.

[Function] sockets:vector-to-integer vector

Convert a vector to a 32-bit unsigned integer.

[Function] sockets:integer-to-vector ipaddr

Convert a 32-bit unsigned integer to a vector.

[Function] sockets:dotted-to-vector address

Convert a dotted IPv4 address to a (SIMPLE-ARRAY (UNSIGNED-BYTE 8) 4).

[Function] sockets:vector-to-dotted vector

Convert an 4-element vector to a dotted string.

[Function] sockets:colon-separated-to-vector string

Convert a colon-separated IPv6 address to a (SIMPLE-ARRAY (UNSIGNED-BYTE

16) 8).

[Function] sockets:vector-to-colon-separated vector &optional case

Convert an (SIMPLE-ARRAY (UNSIGNED-BYTE 16) 8) to a colon-separated IPv6

address. case may be :downcase or :upcase.
[Function] sockets:string-address-to-vector address

Convert a string address (dotted or colon-separated) to a vector address. If the string is not a valid address, return nil.

[Function] sockets:map-ipv4-address-to-ipv6 address

Returns an IPv6 address by mapping address onto it.

[Function] sockets:map-ipv6-address-to-ipv4 address

Extracts the IPv4 part of an IPv6-mapped IPv4 address. Signals an error if address is not an IPv6-mapped IPv4 address.

2.4 DNS

2.4.1 Functions

[Function] sockets:lookup-hostname host &key ipv6

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

[Function] sockets:ensure-hostname address &key ipv6 errorp

If address is an inet-address designator, it is converted, if necessary, to an inetaddress 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.

2.4.2 Conditions

[Condition] sockets:resolver-error
Class precedence list: resolver-error, condition, t

Signaled when an error occurs while trying to resolve an address.

[Generic Function] sockets:resolver-error-datum condition

Return the datum that caused the signalling of a resolver-error condition.

[Condition] sockets:resolver-again-error
Class precedence list: resolver-again-error, resolver-error, condition, t

Condition signaled when a temporary failure occurred.

[Condition] sockets:resolver-fail-error
Class precedence list: resolver-fail-error, resolver-error, condition, t

Condition signaled when a non-recoverable error occurred.

[Condition] sockets:resolver-no-name-error
Class precedence list: resolver-no-name-error, resolver-error, condition, t

Condition signaled when a host or service was not found.

[Condition] sockets:resolver-unknown-error
Class precedence list: resolver-unknown-error, resolver-error, condition, t

Condition signaled when an unknown error is signaled while resolving an address.

2.5 Services

[Function] sockets:lookup-service service &optional protocol

Lookup a service by port or name. protocol should be one of :tcp, :udp or :any.

[Condition] sockets:unknown-service
Class precedence list: unknown-service, condition, t

Condition raised when a network service is not found.

[Generic Function] sockets:unknown-service-datum condition

Return the datum that caused the signalling of an unknown-service condition.

2.6 Protocols

[Function] sockets:lookup-protocol protocol

Lookup a protocol by name or number. Signals an unknown-protocol error if no protocol is found.

[Condition] sockets:unknown-protocol
Class precedence list: unknown-protocol, condition, t

Condition raised when a network protocol is not found.

[Generic Function] sockets:unknown-protocol-datum condition

Return the datum that caused the signalling of an unknown-protocol condition.

2.7 Network Interfaces

[Function] sockets:interface-index interface

Return the os index of a network interface.

[Function] sockets:interface-name interface

Return the name of an network interface.

[Function] sockets:make-interface name index

Constructor for interface objects.

[Function] sockets:lookup-interface interface

Lookup an interface by name or index. unknown-interface is signalled if an interface is not found.

[Function] sockets:list-network-interfaces

Returns a list of network interfaces currently available.

[Condition] sockets:unknown-interface
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.

[Generic Function] sockets:unknown-interface-datum condition

Return the datum that caused the signalling of an unknown-interface condition.

Index 16

Index

sockets:abstract-address-p . . . . . . . . . . . . . . . . . 11
sockets:accept-connection . . . . . . . . . . . . . . . . . . . 7

sockets:active-socket . . . . . . . . . . . . . . . . . . . . . . . . 2 sockets:address . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

sockets:address-equal-p. . . . . . . . . . . . . . . . . . . . . 10
sockets:address-to-string . . . . . . . . . . . . . . . . . . . 9
sockets:address-to-vector . . . . . . . . . . . . . . . . . . 10

sockets:address-type . . . . . . . . . . . . . . . . . . . . . . . . 11 sockets:address=. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 sockets:addressp. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 sockets:bind-address . . . . . . . . . . . . . . . . . . . . . . . . . 6

sockets:colon-separated-to-vector . . . . . . . . . 13

sockets:connect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 sockets:copy-address . . . . . . . . . . . . . . . . . . . . . . . . . 9

sockets:datagram-socket . . . . . . . . . . . . . . . . . . . . . . 2

sockets:disconnect . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

sockets:dotted-to-integer . . . . . . . . . . . . . . . . . . 13
sockets:dotted-to-vector . . . . . . . . . . . . . . . . . . . 13

sockets:ensure-address . . . . . . . . . . . . . . . . . . . . . . . 9

sockets:ensure-hostname. . . . . . . . . . . . . . . . . . . . . 14

sockets:ensure-netmask . . . . . . . . . . . . . . . . . . . . . . 12 sockets:inet-address . . . . . . . . . . . . . . . . . . . . . . . . . 9

sockets:inet-address-host-portion . . . . . . . . . 12
sockets:inet-address-in-network-p . . . . . . . . . 12
sockets:inet-address-loopback-p . . . . . . . . . . . 11
sockets:inet-address-multicast-p . . . . . . . . . . 11
sockets:inet-address-network-class . . . . . . . . 13
sockets:inet-address-network-portion. . . . . . 12
sockets:inet-address-private-p. . . . . . . . . . . . . 13
sockets:inet-address-type . . . . . . . . . . . . . . . . . . 11
sockets:inet-address-unicast-p. . . . . . . . . . . . . 11
sockets:inet-address-unspecified-p . . . . . . . . 11
sockets:inet-addresses-in-same-network-p

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

sockets:integer-to-dotted . . . . . . . . . . . . . . . . . . 13
sockets:integer-to-vector . . . . . . . . . . . . . . . . . . 13
sockets:interface-index. . . . . . . . . . . . . . . . . . . . . 15

sockets:interface-name . . . . . . . . . . . . . . . . . . . . . . 15

sockets:internet-socket . . . . . . . . . . . . . . . . . . . . . . 2

sockets:ipv4-address . . . . . . . . . . . . . . . . . . . . . . . . . 9 sockets:ipv4-address-p . . . . . . . . . . . . . . . . . . . . . . 10 sockets:ipv6-address . . . . . . . . . . . . . . . . . . . . . . . . . 9 sockets:ipv6-address-p . . . . . . . . . . . . . . . . . . . . . . 10

sockets:ipv6-admin-local-multicast-p. . . . . . 11
sockets:ipv6-global-multicast-p . . . . . . . . . . . 11
sockets:ipv6-global-unicast-p . . . . . . . . . . . . . . 11
sockets:ipv6-interface-local-multicast-p

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

sockets:ipv6-ipv4-mapped-p . . . . . . . . . . . . . . . . . 11
sockets:ipv6-link-local-multicast-p . . . . . . . 11
sockets:ipv6-link-local-unicast-p . . . . . . . . . 11
sockets:ipv6-multicast-type . . . . . . . . . . . . . . . . 12
sockets:ipv6-organization-local-multicast-p

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

sockets:ipv6-reserved-multicast-p . . . . . . . . . 12

sockets:ipv6-site-local-multicast-p . . . . . . . 12
sockets:ipv6-site-local-unicast-p . . . . . . . . . 12
sockets:ipv6-solicited-node-multicast-p . . 12
sockets:ipv6-transient-multicast-p . . . . . . . . 12
sockets:ipv6-unassigned-multicast-p . . . . . . . 12
sockets:ipv6-unicast-type . . . . . . . . . . . . . . . . . . 12
sockets:list-network-interfaces . . . . . . . . . . . 15

sockets:listen-on. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 sockets:local-address . . . . . . . . . . . . . . . . . . . . . . . . 9

sockets:local-address-p. . . . . . . . . . . . . . . . . . . . . 11

sockets:local-filename . . . . . . . . . . . . . . . . . . . . . . . 8 sockets:local-host . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 sockets:local-name . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 sockets:local-port . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 sockets:local-socket . . . . . . . . . . . . . . . . . . . . . . . . . 2

sockets:lookup-hostname. . . . . . . . . . . . . . . . . . . . . 14
sockets:lookup-interface . . . . . . . . . . . . . . . . . . . 15
sockets:lookup-protocol. . . . . . . . . . . . . . . . . . . . . 15

sockets:lookup-service . . . . . . . . . . . . . . . . . . . . . . 15 sockets:make-address . . . . . . . . . . . . . . . . . . . . . . . . . 9 sockets:make-interface . . . . . . . . . . . . . . . . . . . . . . 15 sockets:make-netmask . . . . . . . . . . . . . . . . . . . . . . . . 12 sockets:make-socket . . . . . . . . . . . . . . . . . . . . . . . . . . 4

sockets:make-socket-from-fd . . . . . . . . . . . . . . . . . 5
sockets:make-socket-pair. . . . . . . . . . . . . . . . . . . . . 5
sockets:map-ipv4-address-to-ipv6 . . . . . . . . . . 13
sockets:map-ipv6-address-to-ipv4 . . . . . . . . . . 13

sockets:passive-socket . . . . . . . . . . . . . . . . . . . . . . . 2

sockets:receive-file-descriptor. . . . . . . . . . . . . 7

sockets:receive-from . . . . . . . . . . . . . . . . . . . . . . . . . 6

sockets:remote-filename . . . . . . . . . . . . . . . . . . . . . . 8

sockets:remote-host . . . . . . . . . . . . . . . . . . . . . . . . . . 8 sockets:remote-name . . . . . . . . . . . . . . . . . . . . . . . . . . 8 sockets:remote-port . . . . . . . . . . . . . . . . . . . . . . . . . . 8

sockets:resolver-again-error . . . . . . . . . . . . . . . 14

sockets:resolver-error . . . . . . . . . . . . . . . . . . . . . . 14

sockets:resolver-error-datum . . . . . . . . . . . . . . . 14
sockets:resolver-fail-error . . . . . . . . . . . . . . . . 14
sockets:resolver-no-name-error. . . . . . . . . . . . . 14
sockets:resolver-unknown-error. . . . . . . . . . . . . 14
sockets:send-file-descriptor . . . . . . . . . . . . . . . . 7

sockets:send-to . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 sockets:shutdown . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 sockets:socket . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

sockets:socket-address-family . . . . . . . . . . . . . . . 8
sockets:socket-connected-p . . . . . . . . . . . . . . . . . . 8
sockets:socket-datagram-internet-active . . . 3
sockets:socket-datagram-local-active . . . . . . . 4

sockets:socket-ipv6-p . . . . . . . . . . . . . . . . . . . . . . . . 8 sockets:socket-open-p . . . . . . . . . . . . . . . . . . . . . . . . 8 sockets:socket-os-fd . . . . . . . . . . . . . . . . . . . . . . . . . 7

sockets:socket-protocol . . . . . . . . . . . . . . . . . . . . . . 7
sockets:socket-stream-internet-active. . . . . . 3
sockets:socket-stream-internet-passive . . . . 3
sockets:socket-stream-local-active . . . . . . . . . 3

Index 17

sockets:socket-stream-local-passive . . . . . . . . 3

sockets:socket-type . . . . . . . . . . . . . . . . . . . . . . . . . . 7 sockets:stream-socket . . . . . . . . . . . . . . . . . . . . . . . . 2

sockets:string-address-to-vector . . . . . . . . . . 13
sockets:unknown-interface . . . . . . . . . . . . . . . . . . 15
sockets:unknown-interface-datum . . . . . . . . . . . 15
sockets:unknown-protocol . . . . . . . . . . . . . . . . . . . 15
sockets:unknown-protocol-datum. . . . . . . . . . . . . 15

                                                sockets:unknown-service. . . . . . . . . . . . . . . . . . . . . 15
                                                sockets:unknown-service-datum . . . . . . . . . . . . . . 15
                                                sockets:vector-to-colon-separated . . . . . . . . . 13
                                                sockets:vector-to-dotted . . . . . . . . . . . . . . . . . . . 13
                                                sockets:vector-to-integer . . . . . . . . . . . . . . . . . . 13
                                                sockets:with-accept-connection. . . . . . . . . . . . . . 7
                                                sockets:with-open-socket. . . . . . . . . . . . . . . . . . . . . 5