blob: 163ee554426ee683715dcf82f84f2cd1e846eeb3 (
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
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
|
#ifndef _GDEV_H_
#define _GDEV_H_
#ifdef __cplusplus
extern "C" {
#endif
/* �����豸����Э������ */
#define GDEV_KEEPALIVE_TYPE_ICMP (1)
#define GDEV_KEEPALIVE_TYPE_ARP (2)
#define GDEV_KEEPALIVE_TYPE_BFD (3)
/* �����豸ʹ�õı���Э�� */
#define BFD_DEFAULT_PORT (3784) /* Ĭ�϶˿� */
/* State Machine
+--+
| | UP, ADMIN DOWN, TIMER
| V
DOWN +------+ INIT
+------------| |------------+
| | DOWN | |
| +-------->| |<--------+ |
| | +------+ | |
| | | |
| | ADMIN DOWN,| |
| |ADMIN DOWN, DOWN,| |
| |TIMER TIMER| |
V | | V
+------+ +------+
+----| | | |----+
DOWN| | INIT |--------------------->| UP | |INIT, UP
+--->| | INIT, UP | |<---+
+------+ +------+
*/
#define BFD_MSG_FLAGS_ADMIN_DOWN 0x00
#define BFD_MSG_FLAGS_DOWN 0x01
#define BFD_MSG_FLAGS_INIT 0x02
#define BFD_MSG_FLAGS_UP 0x03
typedef struct{
unsigned char version_diag;
#if __BYTE_ORDER == __LITTLE_ENDIAN
unsigned char flags:6;
unsigned char state:2;
#elif __BYTE_ORDER == __BIG_ENDIAN
unsigned char state:2;
unsigned char flags:6;
#endif
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; /* 9.7.5 */
/* return value:
* >0: is gdev keepalive pkt;
* 0: not gdev keepalive pkt;
* -1: error;
*/
int gdev_keepalive(const raw_pkt_t *raw_pkt, int thread_id, int keepalive_type,unsigned char dir);
int gdev_check_pkt(int addr_type, void *pkt_data);
#ifdef __cplusplus
}
#endif
#endif
|