rjw | 6c1fd8f | 2022-11-30 14:33:01 +0800 | [diff] [blame] | 1 | #ifndef IPSEC_TCPIP_MSG_H |
| 2 | #define IPSEC_TCPIP_MSG_H |
| 3 | |
| 4 | #include "ipsec_common_interface.h" |
| 5 | |
| 6 | /*example: |
| 7 | MSG_ID_TDD_CRLC_CONFIG_AM_ESTABLISH_REQ |
| 8 | tdd_crlc_config_am_establish_req_struct |
| 9 | Name MUST exactly match: |
| 10 | MSG_ID_ + TDD_CRLC_CONFIG_AM_ESTABLISH_REQ |
| 11 | tdd_crlc_config_am_establish_req + _struct |
| 12 | */ |
| 13 | |
| 14 | //MSG_ID_TCPIP_IPSEC_ENCAP_REQ |
| 15 | typedef struct |
| 16 | { |
| 17 | LOCAL_PARA_HDR |
| 18 | |
| 19 | kal_uint32 transaction_id; // to identify the packet |
| 20 | kal_uint32 input_data_len; // or input_payload_len |
| 21 | kal_uint32 input_buffer_len; |
| 22 | kal_uint32 output_buffer_len; |
| 23 | kal_uint32 sa_id; |
| 24 | void* p_input_buffer; // point to the beginning of the TCP/UDP header for ENCAP |
| 25 | void* p_output_buffer; |
| 26 | ipsec_proto_enum next_header; // {TCP or UDP or ICMP or MH or IP} for ENCAP_REQ; |
| 27 | } tcpip_ipsec_encap_req_struct; |
| 28 | |
| 29 | |
| 30 | //MSG_ID_TCPIP_IPSEC_DECAP_REQ |
| 31 | typedef struct |
| 32 | { |
| 33 | LOCAL_PARA_HDR |
| 34 | |
| 35 | kal_uint32 transaction_id; // to identify the packet |
| 36 | kal_uint32 input_data_len; |
| 37 | kal_uint32 input_buffer_len; |
| 38 | kal_uint32 output_buffer_len; |
| 39 | void* p_input_buffer; // point to the beginning of the ESP header for DECAP |
| 40 | void* p_output_buffer; |
| 41 | kal_uint8 src_addr[MAX_IP_ADDR_SIZE]; // IP_ADDR_MAX_LEN = 16 BYTES |
| 42 | kal_uint8 dst_addr[MAX_IP_ADDR_SIZE]; |
| 43 | ipsec_addr_family_enum addr_family; // ipv4 or ipv6 |
| 44 | ipsec_proto_enum next_header; // {ESP or AH} for DECAP_REQ |
| 45 | } tcpip_ipsec_decap_req_struct; |
| 46 | |
| 47 | |
| 48 | //MSG_ID_TCPIP_IPSEC_ENCAP_RSP |
| 49 | typedef struct |
| 50 | { |
| 51 | LOCAL_PARA_HDR |
| 52 | |
| 53 | kal_uint32 transaction_id;//to identify the packet |
| 54 | kal_uint32 output_data_len;//not always be equal to the input output_buffer_len in ENCAP_REQ/DECAP_REQ |
| 55 | ipsec_proto_enum next_header;//{ESP or AH} for ENCAP_RSP |
| 56 | ipsec_status_enum status;//result |
| 57 | |
| 58 | } tcpip_ipsec_encap_rsp_struct; |
| 59 | |
| 60 | |
| 61 | //MSG_ID_TCPIP_IPSEC_DECAP_RSP |
| 62 | typedef struct |
| 63 | { |
| 64 | LOCAL_PARA_HDR |
| 65 | |
| 66 | kal_uint32 transaction_id;//to identify the packet |
| 67 | kal_uint32 output_data_len;//not always be equal to the input output_buffer_len in ENCAP_REQ/DECAP_REQ |
| 68 | ipsec_proto_enum next_header;//{TCP or UDP or ICMP or MH or IP} for DECAP_RSP; |
| 69 | ipsec_status_enum status;//result |
| 70 | |
| 71 | } tcpip_ipsec_decap_rsp_struct; |
| 72 | |
| 73 | |
| 74 | //MSG_ID_TCPIP_IPSEC_SA_CREATION_IND |
| 75 | typedef struct |
| 76 | { |
| 77 | LOCAL_PARA_HDR |
| 78 | |
| 79 | kal_uint32 interface_id; |
| 80 | kal_uint32 spi; |
| 81 | kal_uint32 sa_id; |
| 82 | |
| 83 | ipsec_selector_t sel[IPSEC_MAX_SELECTOR_NUM]; /* equal to sp.sel */ |
| 84 | kal_uint32 ipsec_selector_count; |
| 85 | /* |
| 86 | kal_uint8 src_addr[MAX_IP_ADDR_SIZE]; |
| 87 | kal_uint8 dst_addr[MAX_IP_ADDR_SIZE]; |
| 88 | kal_uint8 addr_family; |
| 89 | ipsec_proto_enum next_header; |
| 90 | kal_uint16 src_port; |
| 91 | kal_uint16 dst_port; |
| 92 | */ |
| 93 | ipsec_proto_enum ipsec_protocol;//ESP or AH |
| 94 | |
| 95 | kal_uint32 overhead_fixed_len; |
| 96 | kal_uint32 overhead_block_size; |
| 97 | } tcpip_ipsec_sa_creation_ind_struct; |
| 98 | |
| 99 | |
| 100 | //MSG_ID_TCPIP_IPSEC_SA_DELETION_IND |
| 101 | typedef struct |
| 102 | { |
| 103 | LOCAL_PARA_HDR |
| 104 | |
| 105 | kal_uint32 sa_id; |
| 106 | } tcpip_ipsec_sa_deletion_ind_struct; |
| 107 | |
| 108 | // MSG_ID_TCPIP_IPSEC_MULTI_SA_DELETION_IND |
| 109 | typedef struct |
| 110 | { |
| 111 | LOCAL_PARA_HDR |
| 112 | |
| 113 | kal_uint32 sa_del_cnt; |
| 114 | kal_uint32 ipsec_said_list[IPSEC_MAX_SASP_DEL_NUM]; |
| 115 | } tcpip_ipsec_multi_sa_deletion_ind_struct; |
| 116 | |
| 117 | #endif |
| 118 | |
| 119 | |