[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: :family extension for make_network_process
From: |
Kim F. Storm |
Subject: |
Re: :family extension for make_network_process |
Date: |
Mon, 12 Dec 2005 15:51:14 +0100 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
Kazu Yamamoto (山本和彦) <address@hidden> writes:
> I would report one documentation mistake and propose an extension for
> make_network_process.
Does the following patch give good results?
*** process.c 01 Oct 2005 21:33:29 +0200 1.467
--- process.c 12 Dec 2005 15:35:44 +0100
***************
*** 140,146 ****
Lisp_Object Qprocessp;
Lisp_Object Qrun, Qstop, Qsignal;
Lisp_Object Qopen, Qclosed, Qconnect, Qfailed, Qlisten;
! Lisp_Object Qlocal, Qdatagram;
Lisp_Object QCname, QCbuffer, QChost, QCservice, QCtype;
Lisp_Object QClocal, QCremote, QCcoding;
Lisp_Object QCserver, QCnowait, QCnoquery, QCstop;
--- 140,149 ----
Lisp_Object Qprocessp;
Lisp_Object Qrun, Qstop, Qsignal;
Lisp_Object Qopen, Qclosed, Qconnect, Qfailed, Qlisten;
! Lisp_Object Qlocal, Qipv4, Qdatagram;
! #ifdef AF_INET6
! Lisp_Object Qipv6;
! #endif
Lisp_Object QCname, QCbuffer, QChost, QCservice, QCtype;
Lisp_Object QClocal, QCremote, QCcoding;
Lisp_Object QCserver, QCnowait, QCnoquery, QCstop;
***************
*** 2595,2604 ****
stream type connection, `datagram' creates a datagram type connection.
:family FAMILY -- FAMILY is the address (and protocol) family for the
! service specified by HOST and SERVICE. The default address family is
! Inet (or IPv4) for the host and port number specified by HOST and
! SERVICE. Other address families supported are:
local -- for a local (i.e. UNIX) address specified by SERVICE.
:local ADDRESS -- ADDRESS is the local address used for the connection.
This parameter is ignored when opening a client process. When specified
--- 2598,2610 ----
stream type connection, `datagram' creates a datagram type connection.
:family FAMILY -- FAMILY is the address (and protocol) family for the
! service specified by HOST and SERVICE. The default (nil) is to use
! whatever address family (IPv4 or IPv6) that is defined for the host
! and port number specified by HOST and SERVICE. Other address families
! supported are:
local -- for a local (i.e. UNIX) address specified by SERVICE.
+ ipv4 -- use IPv4 address family only.
+ ipv6 -- use IPv6 address family only.
:local ADDRESS -- ADDRESS is the local address used for the connection.
This parameter is ignored when opening a client process. When specified
***************
*** 2855,2873 ****
/* :family FAMILY -- nil (for Inet), local, or integer. */
tem = Fplist_get (contact, QCfamily);
! if (INTEGERP (tem))
! family = XINT (tem);
! else
{
! if (NILP (tem))
! family = AF_INET;
! #ifdef HAVE_LOCAL_SOCKETS
! else if (EQ (tem, Qlocal))
! family = AF_LOCAL;
#endif
}
! if (family < 0)
error ("Unknown address family");
ai.ai_family = family;
/* :service SERVICE -- string, integer (port number), or t (random port).
*/
--- 2861,2889 ----
/* :family FAMILY -- nil (for Inet), local, or integer. */
tem = Fplist_get (contact, QCfamily);
! if (NILP (tem))
{
! #ifdef HAVE_GETADDRINFO
! family = AF_UNSPEC;
! #else
! family = AF_INET;
#endif
}
! #ifdef HAVE_LOCAL_SOCKETS
! else if (EQ (tem, Qlocal))
! family = AF_LOCAL;
! #endif
! #ifdef AF_INET6
! else if (EQ (tem, Qipv6))
! family = AF_INET6;
! #endif
! else if (EQ (tem, Qipv4))
! family = AF_INET;
! else if (INTEGERP (tem))
! family = XINT (tem);
! else
error ("Unknown address family");
+
ai.ai_family = family;
/* :service SERVICE -- string, integer (port number), or t (random port).
*/
***************
*** 2933,2939 ****
QUIT;
memset (&hints, 0, sizeof (hints));
hints.ai_flags = 0;
! hints.ai_family = NILP (Fplist_member (contact, QCfamily)) ? AF_UNSPEC
: family;
hints.ai_socktype = socktype;
hints.ai_protocol = 0;
ret = getaddrinfo (SDATA (host), portstring, &hints, &res);
--- 2949,2955 ----
QUIT;
memset (&hints, 0, sizeof (hints));
hints.ai_flags = 0;
! hints.ai_family = family;
hints.ai_socktype = socktype;
hints.ai_protocol = 0;
ret = getaddrinfo (SDATA (host), portstring, &hints, &res);
***************
*** 6724,6729 ****
--- 6740,6749 ----
#ifdef HAVE_LOCAL_SOCKETS
ADD_SUBFEATURE (QCfamily, Qlocal);
#endif
+ ADD_SUBFEATURE (QCfamily, Qipv4);
+ #ifdef AF_INET6
+ ADD_SUBFEATURE (QCfamily, Qipv6);
+ #endif
#ifdef HAVE_GETSOCKNAME
ADD_SUBFEATURE (QCservice, Qt);
#endif
***************
*** 6782,6787 ****
--- 6802,6813 ----
staticpro (&Qlisten);
Qlocal = intern ("local");
staticpro (&Qlocal);
+ Qipv4 = intern ("ipv4");
+ staticpro (&Qipv4);
+ #ifdef AF_INET6
+ Qipv6 = intern ("ipv6");
+ staticpro (&Qipv6);
+ #endif
Qdatagram = intern ("datagram");
staticpro (&Qdatagram);
--
Kim F. Storm <address@hidden> http://www.cua.dk