summaryrefslogtreecommitdiff
path: root/app/include/sendpath.h
blob: aa33530b63ab26270e0202a145773bb21b3ce1d0 (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
#pragma once

#include <mrapp.h>
#include <marsio.h>

typedef int(*fn_layer_construct_t)(struct mr_sendpath * sendpath, struct rte_mbuf * mbuf[], unsigned int nr_mbuf);
typedef int(*fn_hook_t)(struct mr_sendpath * sendpath, struct rte_mbuf * mbuf[], unsigned int nr_mbuf, void * arg);

typedef int(*fn_requery_t)(struct mr_sendpath * sendpath);
typedef int(*fn_option_set_t)(struct mr_instance * instance, struct mr_sendpath * sendpath, int opt, va_list va_list);
typedef int(*fn_option_get_t)(struct mr_instance * instance, struct mr_sendpath * sendpath, int opt, va_list va_list);
typedef void(*fn_destory_t)(struct mr_sendpath * sendpath);

struct mr_sendpath
{
    enum mr_sendpath_type sendpath_type;
    unsigned int create_time;
    unsigned int can_use;

    /* 选项设置回调函数 */
    fn_option_set_t fn_option_set;
    /* 选项读取回调函数 */
    fn_option_get_t fn_option_get;
    /* 销毁回调函数 */
    fn_destory_t fn_destory;
    /* 重查询回调函数 */
    fn_requery_t fn_requery;
    /* 二层负载构建函数 */
    fn_layer_construct_t fn_l2_construct;
    /* 三层负载构建函数 */
    fn_layer_construct_t fn_l3_construct;
    /* 四层负载构建函数 */
    fn_layer_construct_t fn_l4_construct;
	/* Prebuild Hook回调函数 */
	fn_hook_t fn_prebuild_hook;
	/* Prebuild Hook回调函数参数 */
	void * prebuild_hook_args;
	/* Postbuild Hook 回调函数 */
	fn_hook_t fn_postbuild_hook;
	/* Postbuild Hook 回调函数参数 */
	void * postbuild_hook_args;
		
    /* 目标VDI */
    struct vdev_instance * target_vdi;
    /* Instance */
    struct mr_instance * instance;
	/* __VDEV */
	struct mr_vdev * vdev;
};

struct __mr_sendpath_vdev
{
    struct mr_sendpath _father;
	struct rte_ether_addr src_eth_addr;
	struct rte_ether_addr dst_eth_addr;
};

struct __mr_sendpath_route
{
    struct mr_sendpath _father;
    
    /* 三层报文构建信息 */
    struct in_addr src_addr;
    struct in_addr dst_addr;

    /* 二层报文构建信息 */
    struct rte_ether_addr src_eth_addr;
    struct rte_ether_addr dst_eth_addr;

    /* 重查询使用的目标IP地址 */
    struct in_addr target_addr;
};