[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: One AF_* constant for each of sockaddr_{hci,l2cap,rfcomm}?
- To: "Eugene M. Kim" <freebsd_(_dot_)_org_(_at_)_ab_(_dot_)_ote_(_dot_)_we_(_dot_)_lv>
- Subject: Re: One AF_* constant for each of sockaddr_{hci,l2cap,rfcomm}?
- From: "Maksim Yevmenkin" <maksim_(_dot_)_yevmenkin_(_at_)_gmail_(_dot_)_com>
- Date: Thu, 30 Aug 2007 17:43:09 -0700
- Cc: FreeBSD Bluetooth Mailing List <bluetooth_(_at_)_freebsd_(_dot_)_org>
- Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=eN8IW8ZJrzFSMt5h/RwH96jrjhjI4TQH1gw0S7bZpOwfcE/7KfYh1mimiN+3aVCRqxU821WEr1kz0O9kMVp+KXEW2SbKzvs86rGX25ZMtXtRGlXmE3mUXYCpJjBZmLMtNjcbIT6mu28p5zNuAGLehIFWCOC8BCnojlg+EfQXzOM=
On 8/30/07, Eugene M. Kim <freebsd_(_dot_)_org_(_at_)_ab_(_dot_)_ote_(_dot_)_we_(_dot_)_lv> wrote:
> Hello,
>
> It seems that AF_BLUETOOTH ambiguously identifies three different types
> of socket—HCI, L2CAP and RFCOMM—each with its own sockaddr_* type. This
> deviates from the standard practice where there is a 1:1 mapping between
> an AF_* constant and a corresponding sockaddr_* type, and this may, in
> turn, break usage of system calls such as getsockname(2) and
> getpeername(2): These calls return a struct sockaddr whose sa_family
> should uniquely and unambiguously identify the real sockaddr_* struct to
> which the returned sockaddr should be type-cast; if sa_family ==
> AF_BLUETOOTH, there are three possibilities and an application that
> calls get{sock,peer}name(2) cannot choose one of them without extra
> information (namely, the third argument to the socket() call that
> created the socket).
the application probably can use sa_len field to figure out which
sockaddr_ structure it is. it is somewhat a hack but it should work.
> In this light, shouldn't a unique AF_* constant be allocated for each
> Bluetooth socket type, such as AF_BTHCI, AF_BTL2CAP and AF_BTRFCOMM,
> instead of just one AF_BLUETOOTH?
i'd rather not to it. may be it is better to add sa_proto field to
bluetooth sockaddr_ structures and have union data field for each
protocol?
thanks,
max
_______________________________________________
freebsd-bluetooth_(_at_)_freebsd_(_dot_)_org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bluetooth
To unsubscribe, send any mail to "freebsd-bluetooth-unsubscribe_(_at_)_freebsd_(_dot_)_org"
Visit your host, monkey.org