From aa48ae0df546d78602962096b3b9578fae47b645 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 13 Oct 2016 19:05:49 -0700 Subject: Adding family slot to socket addresses. A static slot indicating the address family simplifies code which wants to map a socket address to its family. * lisplib.c (sock_instantiate): Call sock_load_init before loading socket.tl rather than after, because socket.tl now references variables defined inside sock_load_init. * share/txr/stdlib/socket.tl (sockaddr, sockaddr-in, sockaddr-in6, sockaddr-un): New static slot, family. * txr.1: Documented family slots. --- txr.1 | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) (limited to 'txr.1') diff --git a/txr.1 b/txr.1 index 051eafff..2f410c14 100644 --- a/txr.1 +++ b/txr.1 @@ -43009,7 +43009,8 @@ newly created datagram socket which is returned. .coNP Structure @ sockaddr .synb -.mets (defstruct sockaddr nil) +.mets (defstruct sockaddr nil +.mets \ \ (:static family nil)) .syne .desc The @@ -43021,10 +43022,16 @@ several other types are derived: and .codn sockaddr-un . +It has a single slot called +.code family +which is static, and initialized to +.codn nil . + .coNP Structure @ sockaddr-in .synb .mets (defstruct sockaddr-in sockaddr -.mets \ \ (addr 0) (port 0)) +.mets \ \ (addr 0) (port 0) +.mets \ \ (:static family af-inet)) .syne .desc The @@ -43056,10 +43063,16 @@ for instance, when the function is used with the aim of looking up the address of a host, without caring about the port number. +The +.code family +static slot holds the value +.codn af-inet . + .coNP Structure @ sockaddr-in6 .synb .mets (defstruct sockaddr-in6 sockaddr -.mets \ \ (addr 0) (port 0) (flow-info 0) (scope-id 0)) +.mets \ \ (addr 0) (port 0) (flow-info 0) (scope-id 0) +.mets \ \ (:static family af-inet6)) .syne .desc The @@ -43092,10 +43105,16 @@ members of the .code sockaddr_in6 C language structure. Their meaning and use are beyond the scope of this document. +The +.code family +static slot holds the value +.codn af-inet . + .coNP Structure @ sockaddr-un .synb .mets (defstruct sockaddr-un sockaddr -.mets \ \ path) +.mets \ \ path +.mets \ \ (:static family af-unix)) .syne .desc The @@ -43144,6 +43163,11 @@ is valid and represents an abstract address consisting of the three bytes .str "foo" followed by null padding bytes. +The +.code family +static slot holds the value +.codn af-inet . + .coNP Structure @ addrinfo .synb .mets (defstruct addrinfo nil -- cgit v1.2.3