File: libipv6addr.h

package info (click to toggle)
ipv6calc 0.39-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 740 kB
  • ctags: 535
  • sloc: ansic: 5,499; sh: 134; perl: 103; makefile: 85
file content (109 lines) | stat: -rw-r--r-- 3,406 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/*
 * Project    : ipv6calc
 * File       : libipv6addr.h
 * Version    : $Id: libipv6addr.h,v 1.4 2002/02/27 23:07:15 peter Exp $
 * Copyright  : 2001-2002 by Peter Bieringer <pb (at) bieringer.de> except the parts taken from kernel source
 *
 * Information:
 *  Header file for libipv6addr.c
 */ 

#include "ipv6calc.h"


/* typedefs */

#ifndef _libipv6addr_h

#define _libipv6addr_h 1

typedef struct {
	struct in6_addr in6_addr;	/* in6_addr structure */
	unsigned short prefixlength;	/* prefix length (0-128) 8 bit*/
	int flag_prefixuse;		/* =1 prefix length in use */
	unsigned int scope;		/* address scope value 16 bit*/
	unsigned short bit_start;	/* start of bit */
	unsigned short bit_end;		/* end of bit */
	int flag_startend_use;		/* =1 start or end of bit in use */
} ipv6calc_ipv6addr;

/* IPv6 address type definitions 
 * with credits to kernel and USAGI developer team
 * basic information was taken from "kernel/include/net/ipv6.h"
 */

/*
 *	Addr type
 *	
 *	type	-	unicast | multicast | anycast
 *	scope	-	local	| site	    | global
 *	v4	-	compat
 *	v4mapped
 *	any
 *	loopback
 */

#define IPV6_ADDR_ANY				0x0000U

#define IPV6_ADDR_UNICAST			0x0001U	
#define IPV6_ADDR_MULTICAST			0x0002U	
#define IPV6_ADDR_ANYCAST			0x0004U

#define IPV6_ADDR_LOOPBACK			0x0010U
#define IPV6_ADDR_LINKLOCAL			0x0020U
#define IPV6_ADDR_SITELOCAL			0x0040U

#define IPV6_ADDR_COMPATv4			0x0080U

#define IPV6_ADDR_SCOPE_MASK			0x00f0U

#define IPV6_ADDR_MAPPED			0x1000U
#define IPV6_ADDR_RESERVED			0x2000U	/* reserved address space */

#define IPV6_NEW_ADDR_6TO4			0x10000U
#define IPV6_NEW_ADDR_6BONE			0x20000U
#define IPV6_NEW_ADDR_AGU			0x40000U
#define IPV6_NEW_ADDR_UNSPECIFIED		0x80000U
#define IPV6_NEW_ADDR_SOLICITED_NODE		0x100000U
#define IPV6_NEW_ADDR_ISATAP			0x200000U

/* text representations */
#define TXT_IPV6_ADDR_ANY			"unknown"
#define TXT_IPV6_ADDR_UNICAST			"unicast"
#define TXT_IPV6_ADDR_MULTICAST			"multicast"
#define TXT_IPV6_ADDR_ANYCAST			"anycast"
#define TXT_IPV6_ADDR_LOOPBACK			"loopback"
#define TXT_IPV6_ADDR_LINKLOCAL			"link-local"
#define TXT_IPV6_ADDR_SITELOCAL			"site-local"
#define TXT_IPV6_ADDR_COMPATv4			"compat-v4"
#define TXT_IPV6_ADDR_MAPPED			"mapped"
#define TXT_IPV6_ADDR_RESERVED			"reserved"
#define TXT_IPV6_NEW_ADDR_6TO4			"6to4"
#define TXT_IPV6_NEW_ADDR_6BONE			"6bone"
#define TXT_IPV6_NEW_ADDR_AGU			"aggregatable-global-unicast"
#define TXT_IPV6_NEW_ADDR_UNSPECIFIED		"unspecified"
#define TXT_IPV6_NEW_ADDR_SOLICITED_NODE	"solicited-node"
#define TXT_IPV6_NEW_ADDR_ISATAP		"ISATAP"

#define IPV6INFO_NUM 15

#endif


/* prototypes */
extern unsigned int ipv6addr_getoctett(ipv6calc_ipv6addr *ipv6addrp, int numoctett);
extern unsigned int ipv6addr_getword(ipv6calc_ipv6addr *ipv6addrp, int numword);
extern unsigned int ipv6addr_getdword(ipv6calc_ipv6addr *ipv6addrp, int numdword);

extern void ipv6addr_setoctett(ipv6calc_ipv6addr *ipv6addrp, int numocett, unsigned int value);
extern void ipv6addr_setword(ipv6calc_ipv6addr *ipv6addrp, int numword, unsigned int value);
extern void ipv6addr_setdword(ipv6calc_ipv6addr *ipv6addrp, int numdword, unsigned int value);

extern void ipv6addr_clear(ipv6calc_ipv6addr *ipv6addrp);
extern void ipv6addr_clearall(ipv6calc_ipv6addr *ipv6addrp);

extern unsigned int ipv6addr_gettype(ipv6calc_ipv6addr *ipv6addrp);

extern unsigned int ipv6addr_typesnum[];
extern char *ipv6addr_typesstring[];