1c1d255d3SCy Schubert /* 2c1d255d3SCy Schubert * RSN PTKSA cache interface 3c1d255d3SCy Schubert * 4c1d255d3SCy Schubert * Copyright (C) 2019 Intel Corporation 5c1d255d3SCy Schubert * 6c1d255d3SCy Schubert * This software may be distributed under the terms of the BSD license. 7c1d255d3SCy Schubert * See README for more details. 8c1d255d3SCy Schubert */ 9c1d255d3SCy Schubert 10c1d255d3SCy Schubert #ifndef PTKSA_CACHE_H 11c1d255d3SCy Schubert #define PTKSA_CACHE_H 12c1d255d3SCy Schubert 13c1d255d3SCy Schubert #include "wpa_common.h" 14c1d255d3SCy Schubert #include "defs.h" 15c1d255d3SCy Schubert #include "list.h" 16c1d255d3SCy Schubert 17c1d255d3SCy Schubert /** 18c1d255d3SCy Schubert * struct ptksa_cache_entry - PTKSA cache entry 19c1d255d3SCy Schubert */ 20c1d255d3SCy Schubert struct ptksa_cache_entry { 21c1d255d3SCy Schubert struct dl_list list; 22c1d255d3SCy Schubert struct wpa_ptk ptk; 23c1d255d3SCy Schubert os_time_t expiration; 24c1d255d3SCy Schubert u32 cipher; 25c1d255d3SCy Schubert u8 addr[ETH_ALEN]; 26*a90b9d01SCy Schubert u8 own_addr[ETH_ALEN]; 27*a90b9d01SCy Schubert void (*cb)(struct ptksa_cache_entry *e); 28*a90b9d01SCy Schubert void *ctx; 29*a90b9d01SCy Schubert u32 akmp; 30c1d255d3SCy Schubert }; 31c1d255d3SCy Schubert 32c1d255d3SCy Schubert 33c1d255d3SCy Schubert struct ptksa_cache; 34c1d255d3SCy Schubert 35c1d255d3SCy Schubert struct ptksa_cache * ptksa_cache_init(void); 36c1d255d3SCy Schubert void ptksa_cache_deinit(struct ptksa_cache *ptksa); 37c1d255d3SCy Schubert struct ptksa_cache_entry * ptksa_cache_get(struct ptksa_cache *ptksa, 38c1d255d3SCy Schubert const u8 *addr, u32 cipher); 39c1d255d3SCy Schubert int ptksa_cache_list(struct ptksa_cache *ptksa, char *buf, size_t len); 40c1d255d3SCy Schubert struct ptksa_cache_entry * ptksa_cache_add(struct ptksa_cache *ptksa, 41*a90b9d01SCy Schubert const u8 *own_addr, 42c1d255d3SCy Schubert const u8 *addr, u32 cipher, 43c1d255d3SCy Schubert u32 life_time, 44*a90b9d01SCy Schubert const struct wpa_ptk *ptk, 45*a90b9d01SCy Schubert void (*cb) 46*a90b9d01SCy Schubert (struct ptksa_cache_entry *e), 47*a90b9d01SCy Schubert void *ctx, u32 akmp); 48c1d255d3SCy Schubert void ptksa_cache_flush(struct ptksa_cache *ptksa, const u8 *addr, u32 cipher); 49c1d255d3SCy Schubert 50c1d255d3SCy Schubert #endif /* PTKSA_CACHE_H */ 51