The address family of sa is not included in the result. */
Lisp_Object
-conv_sockaddr_to_lisp (struct sockaddr *sa, ptrdiff_t len, bool include_port)
+conv_sockaddr_to_lisp (struct sockaddr *sa, ptrdiff_t len)
{
Lisp_Object address;
ptrdiff_t i;
{
DECLARE_POINTER_ALIAS (sin, struct sockaddr_in, sa);
len = sizeof (sin->sin_addr) + 1;
- if (!include_port)
- len--;
address = Fmake_vector (make_number (len), Qnil);
p = XVECTOR (address);
- if (include_port)
- p->contents[--len] = make_number (ntohs (sin->sin_port));
+ p->contents[--len] = make_number (ntohs (sin->sin_port));
cp = (unsigned char *) &sin->sin_addr;
break;
}
DECLARE_POINTER_ALIAS (sin6, struct sockaddr_in6, sa);
DECLARE_POINTER_ALIAS (ip6, uint16_t, &sin6->sin6_addr);
len = sizeof (sin6->sin6_addr) / 2 + 1;
- if (!include_port)
- len--;
address = Fmake_vector (make_number (len), Qnil);
p = XVECTOR (address);
- if (include_port)
- p->contents[--len] = make_number (ntohs (sin6->sin6_port));
+ p->contents[--len] = make_number (ntohs (sin6->sin6_port));
for (i = 0; i < len; i++)
p->contents[i] = make_number (ntohs (ip6[i]));
return address;
{
Lisp_Object protocol = make_number (res->ai_protocol);
eassert (XINT (protocol) == res->ai_protocol);
- return Fcons (protocol, conv_sockaddr_to_lisp (res->ai_addr, res->ai_addrlen, true));
+ return Fcons (protocol, conv_sockaddr_to_lisp (res->ai_addr, res->ai_addrlen));
}
channel = XPROCESS (process)->infd;
return conv_sockaddr_to_lisp (datagram_address[channel].sa,
- datagram_address[channel].len,
- true);
+ datagram_address[channel].len);
}
DEFUN ("set-process-datagram-address", Fset_process_datagram_address, Sset_process_datagram_address,
#endif
contact = Fplist_put (contact, p->is_server? QClocal: QCremote,
- conv_sockaddr_to_lisp (sa, addrlen, true));
+ conv_sockaddr_to_lisp (sa, addrlen));
#ifdef HAVE_GETSOCKNAME
if (!p->is_server)
{
DECLARE_POINTER_ALIAS (psa1, struct sockaddr, &sa1);
if (getsockname (s, psa1, &len1) == 0)
contact = Fplist_put (contact, QClocal,
- conv_sockaddr_to_lisp (psa1, len1, true));
+ conv_sockaddr_to_lisp (psa1, len1));
}
#endif
}
namebuf[sizeof (ifq->ifr_name)] = 0;
res = Fcons (Fcons (build_string (namebuf),
conv_sockaddr_to_lisp (&ifq->ifr_addr,
- sizeof (struct sockaddr),
- true)),
+ sizeof (struct sockaddr))),
res);
}
{
any = 1;
#ifdef HAVE_STRUCT_IFREQ_IFR_NETMASK
- elt = conv_sockaddr_to_lisp (&rq.ifr_netmask, sizeof (rq.ifr_netmask), true);
+ elt = conv_sockaddr_to_lisp (&rq.ifr_netmask, sizeof (rq.ifr_netmask));
#else
- elt = conv_sockaddr_to_lisp (&rq.ifr_addr, sizeof (rq.ifr_addr), true);
+ elt = conv_sockaddr_to_lisp (&rq.ifr_addr, sizeof (rq.ifr_addr));
#endif
}
#endif
if (ioctl (s, SIOCGIFBRDADDR, &rq) == 0)
{
any = 1;
- elt = conv_sockaddr_to_lisp (&rq.ifr_broadaddr, sizeof (rq.ifr_broadaddr), true);
+ elt = conv_sockaddr_to_lisp (&rq.ifr_broadaddr, sizeof (rq.ifr_broadaddr));
}
#endif
res = Fcons (elt, res);
if (ioctl (s, SIOCGIFADDR, &rq) == 0)
{
any = 1;
- elt = conv_sockaddr_to_lisp (&rq.ifr_addr, sizeof (rq.ifr_addr), true);
+ elt = conv_sockaddr_to_lisp (&rq.ifr_addr, sizeof (rq.ifr_addr));
}
#endif
res = Fcons (elt, res);
for (lres = res; lres; lres = lres->ai_next)
{
addresses = Fcons (conv_sockaddr_to_lisp
- (lres->ai_addr, lres->ai_addrlen, false),
+ (lres->ai_addr, lres->ai_addrlen),
addresses);
}
addresses = Fnreverse (addresses);
if (!NILP (service))
contact = Fplist_put (contact, QCservice, service);
contact = Fplist_put (contact, QCremote,
- conv_sockaddr_to_lisp (&saddr.sa, len, true));
+ conv_sockaddr_to_lisp (&saddr.sa, len));
#ifdef HAVE_GETSOCKNAME
len = sizeof saddr;
if (getsockname (s, &saddr.sa, &len) == 0)
contact = Fplist_put (contact, QClocal,
- conv_sockaddr_to_lisp (&saddr.sa, len, true));
+ conv_sockaddr_to_lisp (&saddr.sa, len));
#endif
pset_childp (p, contact);
union u_sockaddr sa;
socklen_t salen = sizeof sa;
if (getsockname (sockfd, &sa.sa, &salen) == 0)
- sockname = conv_sockaddr_to_lisp (&sa.sa, salen, true);
+ sockname = conv_sockaddr_to_lisp (&sa.sa, salen);
}
# endif
Vinternal__daemon_sockname = sockname;
if (NILP (ifname))
res = Fcons (Fcons (build_string (namebuf),
conv_sockaddr_to_lisp ((struct sockaddr*) &sa,
- sizeof (struct sockaddr),
- false)),
+ sizeof (struct sockaddr))),
res);
else if (strcmp (namebuf, SSDATA (ifname)) == 0)
{
sa.sin_addr.s_addr = net_mask;
sa.sin_port = 0;
res = Fcons (conv_sockaddr_to_lisp ((struct sockaddr *) &sa,
- sizeof (struct sockaddr),
- false),
+ sizeof (struct sockaddr)),
res);
}
else
sa.sin_addr.s_addr = bcast_addr;
sa.sin_port = 0;
res = Fcons (conv_sockaddr_to_lisp ((struct sockaddr *) &sa,
- sizeof (struct sockaddr),
- false),
+ sizeof (struct sockaddr)),
res);
/* IP address. */
sa.sin_addr.s_addr = ip_addr;
sa.sin_port = 0;
res = Fcons (conv_sockaddr_to_lisp ((struct sockaddr *) &sa,
- sizeof (struct sockaddr),
- false),
+ sizeof (struct sockaddr)),
res);
}
else
sa.sin_addr.s_addr = sys_inet_addr ("127.0.0.1");
res = Fcons (Fcons (build_string ("lo"),
conv_sockaddr_to_lisp ((struct sockaddr*) &sa,
- sizeof (struct sockaddr),
- false)),
+ sizeof (struct sockaddr))),
res);
}
else if (strcmp (SSDATA (ifname), "lo") == 0)
res);
sa.sin_addr.s_addr = sys_inet_addr ("255.0.0.0");
res = Fcons (conv_sockaddr_to_lisp ((struct sockaddr *) &sa,
- sizeof (struct sockaddr),
- false),
+ sizeof (struct sockaddr)),
res);
sa.sin_addr.s_addr = sys_inet_addr ("0.0.0.0");
res = Fcons (conv_sockaddr_to_lisp ((struct sockaddr *) &sa,
- sizeof (struct sockaddr),
- false),
+ sizeof (struct sockaddr)),
res);
sa.sin_addr.s_addr = sys_inet_addr ("127.0.0.1");
res = Fcons (conv_sockaddr_to_lisp ((struct sockaddr *) &sa,
- sizeof (struct sockaddr),
- false),
+ sizeof (struct sockaddr)),
res);
}