inet6_rthdr.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2003 Sun Microsystems, Inc.
* All rights reserved. Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* This code is conformant to revision 7 of 2292bis. Some of these functions
* were provided (named inet6_rthdr_) in a very similar form in RFC 2292.
* The RFC 2292 variants are not supported.
*/
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#define MAX_RTHDR0_SEGMENTS 127
/*
* Return amount of space needed to hold N segments for the specified
* routing type. Does NOT include space for cmsghdr.
*/
{
return (0);
return (sizeof (struct ip6_rthdr0) +
}
/*
* Initializes rthdr structure. Verifies the segments against the length of
* the buffer.
* Note that a routing header can only hold 127 segments since the length field
* in the header is just a byte.
*/
void *
{
struct ip6_rthdr0 *rthdr;
return (NULL);
if (bp_len < sizeof (struct ip6_rthdr0) +
return (NULL);
return (bp);
}
/*
* Add one more address to the routing header. Fails when there is no more
* room.
*/
int
{
struct ip6_rthdr0 *rthdr;
/* Not room for one more */
return (-1);
}
return (0);
}
/*
* Reverse a source route. Both arguments can point to the same buffer.
*/
int
{
int i, segments;
struct in6_addr *rtout_addrs;
struct in6_addr *rtin_addrs;
return (-1);
tmp = rtin_addrs[i];
}
return (0);
}
/*
* Return the number of segments in the routing header.
*/
int
inet6_rth_segments(const void *bp)
{
struct ip6_rthdr0 *rthdr;
if (rthdr->ip6r0_type == 0) {
return (-1);
} else {
}
} else {
return (-1);
}
}
/*
* Return a pointer to an element in the source route.
* This uses the C convention for index [0, size-1].
*/
struct in6_addr *
{
struct ip6_rthdr0 *rthdr;
return (NULL);
}