secgateway/Common/ipsec_api.h

76 lines
1.9 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef _IPSEC_API_H
#define _IPSEC_API_H
#include "common_types.h"
#define MAX_TUN_NAME_LEN 31
#define MAX_IP_STR_LEN 63
#define MAX_SUBNET_STR_LEN 67
#define MAX_AUTH_ID_LEN 63
#define MAX_PSK_LEN 31
#define MAX_IKE_PROP_LEN 127
#define MAX_IPSEC_PROP_LEN 127
typedef struct _ikev1_config_ph1 {
char ph1_name[MAX_TUN_NAME_LEN+1]; /* key值要求不能重复 */
/* 隧道源地址与目的地址 */
char local_ip_str[MAX_IP_STR_LEN+1];
char remote_ip_str[MAX_IP_STR_LEN+1]; /* 要求不能重复 */
/* 认证方式 */
u32 auth_method;
/* PSK */
char psk[MAX_PSK_LEN+1];
/* 一阶段加密算法、认证算法、DH组 */
char ike_proposal_str[MAX_IKE_PROP_LEN+1];
/* 一阶段模式: 隧道模式、传输模式 */
u32 mode;
u32 sa_ike_life_seconds;
int dpd_delay;
int dpd_timeout;
bool nat_keepalive;
} ikev1_config_ph1_t;
typedef struct _ikev1_config_ph2 {
char ph2_name[MAX_TUN_NAME_LEN+1]; /* key值要求不能重复 */
char refph1_name[MAX_TUN_NAME_LEN+1]; /* 引用的第一阶段隧道名 */
/* 流量选择符信息: 源保护子网、目的保护子网、上层保护协议、源端口与目的端口上层保护协议为UDP或TCP时有效 */
char local_net_str[MAX_SUBNET_STR_LEN+1];
char remote_net_str[MAX_SUBNET_STR_LEN+1];
u16 ul_protocol;
u8 ul_port_ln;
u8 ul_port_rn;
/* 二阶段加密算法、认证算法、PFS */
char ipsec_proposal_str[MAX_IPSEC_PROP_LEN+1];
u32 sa_ipsec_life_seconds;
u32 sa_ipsec_life_kilobytes;
int encapsulation;
} ikev1_config_ph2_t;
typedef struct _ikev2_config {
/* 待填充 */
;
} ikev2_config_t;
typedef union _ike_config {
struct {
ikev1_config_ph1_t ph1;
ikev1_config_ph2_t ph2;
}v1;
ikev2_config_t v2;
}ike_config_t;
#endif