00001 /* PF_KEY user interface, this is defined by rfc2367 so 00002 * do not make arbitrary modifications or else this header 00003 * file will not be compliant. 00004 */ 00005 00006 #ifndef _LINUX_PFKEY2_H 00007 #define _LINUX_PFKEY2_H 00008 00009 #ifdef __MACOSX__ 00010 #define uint8_t unsigned char 00011 #define uint16_t unsigned short 00012 #define uint32_t unsigned int 00013 #define uint64_t unsigned long long 00014 #endif 00015 00016 #define PF_KEY_V2 2 00017 #define PFKEYV2_REVISION 199806L 00018 00019 struct sadb_msg { 00020 uint8_t sadb_msg_version; 00021 uint8_t sadb_msg_type; 00022 uint8_t sadb_msg_errno; 00023 uint8_t sadb_msg_satype; 00024 uint16_t sadb_msg_len; 00025 uint16_t sadb_msg_reserved; 00026 uint32_t sadb_msg_seq; 00027 uint32_t sadb_msg_pid; 00028 } 00029 #ifdef __WIN32__ 00030 ; 00031 #else 00032 __attribute__((packed)); 00033 #endif 00034 /* sizeof(struct sadb_msg) == 16 */ 00035 00036 struct sadb_ext { 00037 uint16_t sadb_ext_len; 00038 uint16_t sadb_ext_type; 00039 } 00040 #ifdef __WIN32__ 00041 ; 00042 #else 00043 __attribute__((packed)); 00044 #endif 00045 /* sizeof(struct sadb_ext) == 4 */ 00046 00047 struct sadb_sa { 00048 uint16_t sadb_sa_len; 00049 uint16_t sadb_sa_exttype; 00050 uint32_t sadb_sa_spi; 00051 uint8_t sadb_sa_replay; 00052 uint8_t sadb_sa_state; 00053 uint8_t sadb_sa_auth; 00054 uint8_t sadb_sa_encrypt; 00055 uint32_t sadb_sa_flags; 00056 } 00057 #ifdef __WIN32__ 00058 ; 00059 #else 00060 __attribute__((packed)); 00061 #endif 00062 /* sizeof(struct sadb_sa) == 16 */ 00063 00064 struct sadb_lifetime { 00065 uint16_t sadb_lifetime_len; 00066 uint16_t sadb_lifetime_exttype; 00067 uint32_t sadb_lifetime_allocations; 00068 uint64_t sadb_lifetime_bytes; 00069 uint64_t sadb_lifetime_addtime; 00070 uint64_t sadb_lifetime_usetime; 00071 } 00072 #ifdef __WIN32__ 00073 ; 00074 #else 00075 __attribute__((packed)); 00076 #endif 00077 /* sizeof(struct sadb_lifetime) == 32 */ 00078 00079 struct sadb_address { 00080 uint16_t sadb_address_len; 00081 uint16_t sadb_address_exttype; 00082 uint8_t sadb_address_proto; 00083 uint8_t sadb_address_prefixlen; 00084 uint16_t sadb_address_reserved; 00085 } 00086 #ifdef __WIN32__ 00087 ; 00088 #else 00089 __attribute__((packed)); 00090 #endif 00091 /* sizeof(struct sadb_address) == 8 */ 00092 00093 struct sadb_key { 00094 uint16_t sadb_key_len; 00095 uint16_t sadb_key_exttype; 00096 uint16_t sadb_key_bits; 00097 uint16_t sadb_key_reserved; 00098 } 00099 #ifdef __WIN32__ 00100 ; 00101 #else 00102 __attribute__((packed)); 00103 #endif 00104 /* sizeof(struct sadb_key) == 8 */ 00105 00106 struct sadb_ident { 00107 uint16_t sadb_ident_len; 00108 uint16_t sadb_ident_exttype; 00109 uint16_t sadb_ident_type; 00110 uint16_t sadb_ident_reserved; 00111 uint64_t sadb_ident_id; 00112 } 00113 #ifdef __WIN32__ 00114 ; 00115 #else 00116 __attribute__((packed)); 00117 #endif 00118 /* sizeof(struct sadb_ident) == 16 */ 00119 00120 struct sadb_sens { 00121 uint16_t sadb_sens_len; 00122 uint16_t sadb_sens_exttype; 00123 uint32_t sadb_sens_dpd; 00124 uint8_t sadb_sens_sens_level; 00125 uint8_t sadb_sens_sens_len; 00126 uint8_t sadb_sens_integ_level; 00127 uint8_t sadb_sens_integ_len; 00128 uint32_t sadb_sens_reserved; 00129 } 00130 #ifdef __WIN32__ 00131 ; 00132 #else 00133 __attribute__((packed)); 00134 #endif 00135 /* sizeof(struct sadb_sens) == 16 */ 00136 00137 /* followed by: 00138 uint64_t sadb_sens_bitmap[sens_len]; 00139 uint64_t sadb_integ_bitmap[integ_len]; */ 00140 00141 struct sadb_prop { 00142 uint16_t sadb_prop_len; 00143 uint16_t sadb_prop_exttype; 00144 uint8_t sadb_prop_replay; 00145 uint8_t sadb_prop_reserved[3]; 00146 } 00147 #ifdef __WIN32__ 00148 ; 00149 #else 00150 __attribute__((packed)); 00151 #endif 00152 /* sizeof(struct sadb_prop) == 8 */ 00153 00154 /* followed by: 00155 struct sadb_comb sadb_combs[(sadb_prop_len + 00156 sizeof(uint64_t) - sizeof(struct sadb_prop)) / 00157 sizeof(strut sadb_comb)]; */ 00158 00159 struct sadb_comb { 00160 uint8_t sadb_comb_auth; 00161 uint8_t sadb_comb_encrypt; 00162 uint16_t sadb_comb_flags; 00163 uint16_t sadb_comb_auth_minbits; 00164 uint16_t sadb_comb_auth_maxbits; 00165 uint16_t sadb_comb_encrypt_minbits; 00166 uint16_t sadb_comb_encrypt_maxbits; 00167 uint32_t sadb_comb_reserved; 00168 uint32_t sadb_comb_soft_allocations; 00169 uint32_t sadb_comb_hard_allocations; 00170 uint64_t sadb_comb_soft_bytes; 00171 uint64_t sadb_comb_hard_bytes; 00172 uint64_t sadb_comb_soft_addtime; 00173 uint64_t sadb_comb_hard_addtime; 00174 uint64_t sadb_comb_soft_usetime; 00175 uint64_t sadb_comb_hard_usetime; 00176 } 00177 #ifdef __WIN32__ 00178 ; 00179 #else 00180 __attribute__((packed)); 00181 #endif 00182 /* sizeof(struct sadb_comb) == 72 */ 00183 00184 struct sadb_supported { 00185 uint16_t sadb_supported_len; 00186 uint16_t sadb_supported_exttype; 00187 uint32_t sadb_supported_reserved; 00188 } 00189 #ifdef __WIN32__ 00190 ; 00191 #else 00192 __attribute__((packed)); 00193 #endif 00194 /* sizeof(struct sadb_supported) == 8 */ 00195 00196 /* followed by: 00197 struct sadb_alg sadb_algs[(sadb_supported_len + 00198 sizeof(uint64_t) - sizeof(struct sadb_supported)) / 00199 sizeof(struct sadb_alg)]; */ 00200 00201 struct sadb_alg { 00202 uint8_t sadb_alg_id; 00203 uint8_t sadb_alg_ivlen; 00204 uint16_t sadb_alg_minbits; 00205 uint16_t sadb_alg_maxbits; 00206 uint16_t sadb_alg_reserved; 00207 } 00208 #ifdef __WIN32__ 00209 ; 00210 #else 00211 __attribute__((packed)); 00212 #endif 00213 /* sizeof(struct sadb_alg) == 8 */ 00214 00215 struct sadb_spirange { 00216 uint16_t sadb_spirange_len; 00217 uint16_t sadb_spirange_exttype; 00218 uint32_t sadb_spirange_min; 00219 uint32_t sadb_spirange_max; 00220 uint32_t sadb_spirange_reserved; 00221 } 00222 #ifdef __WIN32__ 00223 ; 00224 #else 00225 __attribute__((packed)); 00226 #endif 00227 /* sizeof(struct sadb_spirange) == 16 */ 00228 00229 struct sadb_x_kmprivate { 00230 uint16_t sadb_x_kmprivate_len; 00231 uint16_t sadb_x_kmprivate_exttype; 00232 u_int32_t sadb_x_kmprivate_reserved; 00233 } 00234 #ifdef __WIN32__ 00235 ; 00236 #else 00237 __attribute__((packed)); 00238 #endif 00239 /* sizeof(struct sadb_x_kmprivate) == 8 */ 00240 00241 struct sadb_x_sa2 { 00242 uint16_t sadb_x_sa2_len; 00243 uint16_t sadb_x_sa2_exttype; 00244 uint8_t sadb_x_sa2_mode; 00245 uint8_t sadb_x_sa2_reserved1; 00246 uint16_t sadb_x_sa2_reserved2; 00247 uint32_t sadb_x_sa2_sequence; 00248 uint32_t sadb_x_sa2_reqid; 00249 } 00250 #ifdef __WIN32__ 00251 ; 00252 #else 00253 __attribute__((packed)); 00254 #endif 00255 /* sizeof(struct sadb_x_sa2) == 16 */ 00256 00257 struct sadb_x_policy { 00258 uint16_t sadb_x_policy_len; 00259 uint16_t sadb_x_policy_exttype; 00260 uint16_t sadb_x_policy_type; 00261 uint8_t sadb_x_policy_dir; 00262 uint8_t sadb_x_policy_reserved; 00263 uint32_t sadb_x_policy_id; 00264 uint32_t sadb_x_policy_priority; 00265 } 00266 #ifdef __WIN32__ 00267 ; 00268 #else 00269 __attribute__((packed)); 00270 #endif 00271 /* sizeof(struct sadb_x_policy) == 16 */ 00272 00273 struct sadb_x_ipsecrequest { 00274 uint16_t sadb_x_ipsecrequest_len; 00275 uint16_t sadb_x_ipsecrequest_proto; 00276 uint8_t sadb_x_ipsecrequest_mode; 00277 uint8_t sadb_x_ipsecrequest_level; 00278 uint16_t sadb_x_ipsecrequest_reserved1; 00279 uint32_t sadb_x_ipsecrequest_reqid; 00280 uint32_t sadb_x_ipsecrequest_reserved2; 00281 } 00282 #ifdef __WIN32__ 00283 ; 00284 #else 00285 __attribute__((packed)); 00286 #endif 00287 /* sizeof(struct sadb_x_ipsecrequest) == 16 */ 00288 00289 /* This defines the TYPE of Nat Traversal in use. Currently only one 00290 * type of NAT-T is supported, draft-ietf-ipsec-udp-encaps-06 00291 */ 00292 struct sadb_x_nat_t_type { 00293 uint16_t sadb_x_nat_t_type_len; 00294 uint16_t sadb_x_nat_t_type_exttype; 00295 uint8_t sadb_x_nat_t_type_type; 00296 uint8_t sadb_x_nat_t_type_reserved[3]; 00297 } 00298 #ifdef __WIN32__ 00299 ; 00300 #else 00301 __attribute__((packed)); 00302 #endif 00303 /* sizeof(struct sadb_x_nat_t_type) == 8 */ 00304 00305 /* Pass a NAT Traversal port (Source or Dest port) */ 00306 struct sadb_x_nat_t_port { 00307 uint16_t sadb_x_nat_t_port_len; 00308 uint16_t sadb_x_nat_t_port_exttype; 00309 uint16_t sadb_x_nat_t_port_port; 00310 uint16_t sadb_x_nat_t_port_reserved; 00311 } 00312 #ifdef __WIN32__ 00313 ; 00314 #else 00315 __attribute__((packed)); 00316 #endif 00317 /* sizeof(struct sadb_x_nat_t_port) == 8 */ 00318 00319 00320 #ifdef CONFIG_HIP 00321 struct sadb_seqno { 00322 uint16_t sadb_seqno_len; 00323 uint16_t sadb_seqno_exttype; 00324 uint32_t sadb_seqno; 00325 }; 00326 00327 struct sadb_lsi { 00328 uint16_t sadb_lsi_len; 00329 uint16_t sadb_lsi_exttype; 00330 uint32_t sadb_lsi; 00331 }; 00332 00333 struct sadb_hit { 00334 uint16_t sadb_hit_len; 00335 uint16_t sadb_hit_exttype; 00336 uint16_t sadb_hit; 00337 uint16_t sadb_hit_reserved; 00338 } 00339 #ifdef __WIN32__ 00340 ; 00341 #else 00342 __attribute__((packed)); 00343 #endif 00344 00345 #endif /* CONFIG_HIP */ 00346 /* Message types */ 00347 #define SADB_RESERVED 0 00348 #define SADB_GETSPI 1 00349 #define SADB_UPDATE 2 00350 #define SADB_ADD 3 00351 #define SADB_DELETE 4 00352 #define SADB_GET 5 00353 #define SADB_ACQUIRE 6 00354 #define SADB_REGISTER 7 00355 #define SADB_EXPIRE 8 00356 #define SADB_FLUSH 9 00357 #define SADB_DUMP 10 00358 #define SADB_X_PROMISC 11 00359 #define SADB_X_PCHANGE 12 00360 #define SADB_X_SPDUPDATE 13 00361 #define SADB_X_SPDADD 14 00362 #define SADB_X_SPDDELETE 15 00363 #define SADB_X_SPDGET 16 00364 #define SADB_X_SPDACQUIRE 17 00365 #define SADB_X_SPDDUMP 18 00366 #define SADB_X_SPDFLUSH 19 00367 #define SADB_X_SPDSETIDX 20 00368 #define SADB_X_SPDEXPIRE 21 00369 #define SADB_X_SPDDELETE2 22 00370 #define SADB_X_NAT_T_NEW_MAPPING 23 00371 #ifdef CONFIG_HIP 00372 #define SADB_GETSEQ 24 00373 #define SADB_GETLSI 25 00374 #define SADB_READDRESS 26 00375 #define SADB_HIP_ACQUIRE 27 00376 #define SADB_HIP_ADD 28 00377 #define SADB_MAX 29 00378 #else 00379 #define SADB_MAX 23 00380 #endif 00381 /* Security Association flags */ 00382 #define SADB_SAFLAGS_PFS 1 00383 #define SADB_SAFLAGS_NOECN 0x80000000 00384 00385 /* Security Association states */ 00386 #define SADB_SASTATE_LARVAL 0 00387 #define SADB_SASTATE_MATURE 1 00388 #define SADB_SASTATE_DYING 2 00389 #define SADB_SASTATE_DEAD 3 00390 #define SADB_SASTATE_MAX 3 00391 00392 /* Security Association types */ 00393 #define SADB_SATYPE_UNSPEC 0 00394 #define SADB_SATYPE_AH 2 00395 #define SADB_SATYPE_ESP 3 00396 #define SADB_SATYPE_RSVP 5 00397 #define SADB_SATYPE_OSPFV2 6 00398 #define SADB_SATYPE_RIPV2 7 00399 #define SADB_SATYPE_MIP 8 00400 #define SADB_X_SATYPE_IPCOMP 9 00401 /* 00402 #ifdef CONFIG_HIP 00403 */ 00404 #define SADB_X_SATYPE_HIP 10 00405 #define SADB_SATYPE_MAX 10 00406 /* 00407 #else 00408 #define SADB_SATYPE_MAX 9 00409 #endif 00410 */ 00411 /* Authentication algorithms */ 00412 #define SADB_AALG_NONE 0 00413 #define SADB_AALG_MD5HMAC 2 00414 #define SADB_AALG_SHA1HMAC 3 00415 #define SADB_X_AALG_SHA2_256HMAC 5 00416 #define SADB_X_AALG_SHA2_384HMAC 6 00417 #define SADB_X_AALG_SHA2_512HMAC 7 00418 #define SADB_X_AALG_RIPEMD160HMAC 8 00419 #define SADB_X_AALG_NULL 251 /* kame */ 00420 #define SADB_AALG_MAX 251 00421 00422 /* Encryption algorithms */ 00423 #define SADB_EALG_NONE 0 00424 #define SADB_EALG_DESCBC 2 00425 #define SADB_EALG_3DESCBC 3 00426 #define SADB_X_EALG_CASTCBC 6 00427 #define SADB_X_EALG_BLOWFISHCBC 7 00428 #define SADB_EALG_NULL 11 00429 #define SADB_X_EALG_AESCBC 12 00430 #define SADB_EALG_MAX 253 /* last EALG */ 00431 /* private allocations should use 249-255 (RFC2407) */ 00432 #define SADB_X_EALG_SERPENTCBC 252 /* draft-ietf-ipsec-ciph-aes-cbc-00 */ 00433 #define SADB_X_EALG_TWOFISHCBC 253 /* draft-ietf-ipsec-ciph-aes-cbc-00 */ 00434 00435 /* Compression algorithms */ 00436 #define SADB_X_CALG_NONE 0 00437 #define SADB_X_CALG_OUI 1 00438 #define SADB_X_CALG_DEFLATE 2 00439 #define SADB_X_CALG_LZS 3 00440 #define SADB_X_CALG_LZJH 4 00441 #define SADB_X_CALG_MAX 4 00442 00443 /* Extension Header values */ 00444 #define SADB_EXT_RESERVED 0 00445 #define SADB_EXT_SA 1 00446 #define SADB_EXT_LIFETIME_CURRENT 2 00447 #define SADB_EXT_LIFETIME_HARD 3 00448 #define SADB_EXT_LIFETIME_SOFT 4 00449 #define SADB_EXT_ADDRESS_SRC 5 00450 #define SADB_EXT_ADDRESS_DST 6 00451 #define SADB_EXT_ADDRESS_PROXY 7 00452 #define SADB_EXT_KEY_AUTH 8 00453 #define SADB_EXT_KEY_ENCRYPT 9 00454 #define SADB_EXT_IDENTITY_SRC 10 00455 #define SADB_EXT_IDENTITY_DST 11 00456 #define SADB_EXT_SENSITIVITY 12 00457 #define SADB_EXT_PROPOSAL 13 00458 #define SADB_EXT_SUPPORTED_AUTH 14 00459 #define SADB_EXT_SUPPORTED_ENCRYPT 15 00460 #define SADB_EXT_SPIRANGE 16 00461 #define SADB_X_EXT_KMPRIVATE 17 00462 #define SADB_X_EXT_POLICY 18 00463 #define SADB_X_EXT_SA2 19 00464 /* The next four entries are for setting up NAT Traversal */ 00465 #define SADB_X_EXT_NAT_T_TYPE 20 00466 #define SADB_X_EXT_NAT_T_SPORT 21 00467 #define SADB_X_EXT_NAT_T_DPORT 22 00468 #define SADB_X_EXT_NAT_T_OA 23 00469 #ifdef CONFIG_HIP 00470 #define SADB_EXT_SEQNO 24 00471 #define SADB_EXT_LSI 25 00472 #define SADB_EXT_HIT 26 00473 #define SADB_EXT_MAX 26 00474 #else 00475 #define SADB_EXT_MAX 23 00476 #endif 00477 /* Identity Extension values */ 00478 #define SADB_IDENTTYPE_RESERVED 0 00479 #define SADB_IDENTTYPE_PREFIX 1 00480 #define SADB_IDENTTYPE_FQDN 2 00481 #define SADB_IDENTTYPE_USERFQDN 3 00482 #define SADB_IDENTTYPE_MAX 3 00483 00484 #endif /* !(_LINUX_PFKEY2_H) */
1.5.1