summaryrefslogtreecommitdiff
path: root/src/hard_keepalive.h
blob: 22f08c21495601d85bb58adc3224fb52a9913323 (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
34
35
36
37
38
39
40
41
42
43
44
#ifndef _HARD_KEEPALIVE_H
#define _HARD_KEEPALIVE_H

typedef struct bfd_port_s
{		
	uint32_t	recv_port;
	uint32_t	send_port;
}bfd_port_t;

#define	MY_ID_OFFSET	4
#define	YOUR_ID_OFFSET	8
#define	ID_SIZE			4

#define setbit(x,y)  x|=(1<<y)
#define clrbit(x,y)  x&=~(1<<y)
#define getbit(x,y)  ((x) >> (y)&1)

typedef struct bfd_header_s
{
    unsigned char version_diag;
    unsigned char flags;				/*flagǰ2bit��state*/
    unsigned char detect_time_multiplier;
    unsigned char length;
    unsigned char my_discriminator[4]; /* ҵ?º? ²²â*/
    unsigned char your_discriminator[4];
    unsigned char desired_min_tx_interval[4];
    unsigned char required_min_rx_interval[4];
    unsigned char required_min_echo_interval[4];
}bfd_header_t; 

#ifdef __cplusplus
extern "C" {
#endif


/*return 0:succ -1:fail*/
int hard_keepalive_run(void* bfd_port);

#ifdef __cplusplus
}
#endif


#endif