Pre-ci test passed git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4000 818b1a75-f10b-46b9-bf7c-635c3b92a50f
24 lines
525 B
C
Executable File
24 lines
525 B
C
Executable File
/* $Id: inet6_rth_space.c 1.1 03/12/09 09:57:37+02:00 anttit@tcs.hut.fi $ */
|
|
|
|
/* This is a substitute for a missing inet6_rth_space(). */
|
|
|
|
#include <netinet/in.h>
|
|
|
|
#ifndef IPV6_RTHDR_TYPE_2
|
|
#define IPV6_RTHDR_TYPE_2 2
|
|
#endif
|
|
|
|
socklen_t inet6_rth_space(int type, int segments)
|
|
{
|
|
if (type == IPV6_RTHDR_TYPE_0) {
|
|
if (segments > 128)
|
|
return 0;
|
|
return 8 + segments * sizeof(struct in6_addr);
|
|
} else if (type == IPV6_RTHDR_TYPE_2) {
|
|
if (segments != 1)
|
|
return 0;
|
|
return 8 + sizeof(struct in6_addr);
|
|
}
|
|
return 0;
|
|
}
|