#pragma once #include #include 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; };