inet6_getscopeid.3 revision 1.2 $NetBSD: inet6_getscopeid.3,v 1.2 2013/10/19 23:34:48 wiz Exp $- Copyright (c) 2003 The NetBSD Foundation, Inc. All rights reserved. This code is derived from software contributed to The NetBSD Foundation by Christos Zoulas. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE..Dd October 19, 2013
.Dt INET6_GETSCOPEID 3
.Os
.Sh NAME
.Nm inet6_getscopeid ,
.Nm inet6_putscopeid
.Nd IPv6 scope id encoding and decoding functions
.Sh SYNOPSIS
n netinet/in.h .Ft void
.Fn inet6_getscopeid "struct sockaddr_in6 *sin6" "int flags"
.Ft void
.Fn inet6_putscopeid "struct sockaddr_in6 *sin6" "int flags"
.Sh DESCRIPTION
These functions implement a KAME-specific extension that encodes and
decodes the scope id inside in the 3rd and 4th byte of the address,
for link-local, site-local, and multicast-link-local addresses.
Typically those two bytes are
.Dv 0
for these kinds of addresses.
The scope id is stored in network byte order.
p
The
.Fn inet6_getscopeid
function retrieves the scope id from the 3rd and the 4th address bytes,
and sets the
.Ft sin6_scope_id
from them.
It then clears the two address bytes.
p
The
.Fn inet6putscopeid
function stores the scope id found in
.Ft sin6_scope_id
into the 3rd and 4th byte of the address.
It then clears the
.Ft sin6_scope_id .
p
The
.Fa flags
argument controls for which addresses this action is performed.
It
can be a combination of:
l -tag -width "INET6_IS_ADDR_MC_LINKLOCAL" t Dv INET6_IS_ADDR_LINKLOCAL t Dv INET6_IS_ADDR_MC_LINKLOCAL t Dv INET6_IS_ADDR_SITELOCAL .El
.Sh HISTORY
These functions first appeared in
.Nx 7.0 .