summaryrefslogtreecommitdiff
path: root/src/check_ip_legal.h
blob: 86a5bc48c772001cda4329c03e533fa7f6e7422d (plain)
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
#ifndef __CHECK_IP_LEGAL_H__
#define __CHECK_IP_LEGAL_H__

#if defined __GNUC__ || defined __llvm__
#define likely(x) __builtin_expect ((x), 1)
#define unlikely(x) __builtin_expect ((x), 0)
#else
#define likely(x) (x)
#define unlikely(x) (x)
#endif


#ifndef IPV6_PREFIX_MIN
	#define IPV6_PREFIX_MIN 48
#endif

#define IPV6_OK  			0
#define IPV6_ILLEGAL    	2
#define IPV6_PREFIX_LEN_ERR 3
#define IPV6_PREFIX_NONPRE 	4	//ǰ׺���벻��
#define IPV6_PREFIX_ERR    	5	//ͬ4
#define IPV6_IP_PREFIX_ERR 	6	//�ڹ��󲻵����Լ�

#include <arpa/inet.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

extern int ipv6_valid(uint8_t * ipv6);
extern int ipv6m_valid(uint8_t * ipv6, uint8_t * mask);

#endif