From owner-freebsd-net Thu May 10 9: 9:29 2001 Delivered-To: freebsd-net@freebsd.org Received: from fw.wintelcom.net (ns1.wintelcom.net [209.1.153.20]) by hub.freebsd.org (Postfix) with ESMTP id 3CC2F37B424 for ; Thu, 10 May 2001 09:09:21 -0700 (PDT) (envelope-from bright@fw.wintelcom.net) Received: (from bright@localhost) by fw.wintelcom.net (8.10.0/8.10.0) id f4AG97s24850; Thu, 10 May 2001 09:09:07 -0700 (PDT) Date: Thu, 10 May 2001 09:09:07 -0700 From: Alfred Perlstein To: Garrett Wollman Cc: net@FreeBSD.ORG Subject: Re: getaddrinfo irritation Message-ID: <20010510090907.L18676@fw.wintelcom.net> References: <20010510082025.J18676@fw.wintelcom.net> <200105101540.LAA81367@khavrinen.lcs.mit.edu> <20010510090322.K18676@fw.wintelcom.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010510090322.K18676@fw.wintelcom.net>; from bright@wintelcom.net on Thu, May 10, 2001 at 09:03:22AM -0700 X-all-your-base: are belong to us. Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org * Alfred Perlstein [010510 09:04] wrote: > * Garrett Wollman [010510 08:41] wrote: > > < said: > > > > > Using "our" APIs (getaddrinfo) is causing me much pain because I can't > > > figure out how to map "tcp" -> SOCK_STREAM. > > > > You don't. In the `hints' structure, you pass in ai_socktype == > > SOCK_STREAM. This is clearly documented in the manual page. > > Duh. :) > > What I mean is how would one map: localhost:http:tcp into that? > > There seems to be no way to determine what I must do to ai_socktype > based on the above string. > > Do I have to roll my own lookup code? What I'm trying is something like this: if (proto != NULL) { struct protoent *protoent; protoent = getprotobyname(proto); if (protoent != NULL) addrhint.ai_protocol = protoent->p_proto; else log_error("getprotobyname(%s)", proto); } error = getaddrinfo(addr, service, &addrhint, &addrinfo); Shouldn't it do the mapping of addrhint.ai_protocol=6 (tcp) into ai_socktype = SOCK_STREAM? Isn't this a bug of some sorts? -- -Alfred Perlstein - [alfred@freebsd.org] Represent yourself, show up at BABUG http://www.babug.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message