Add trunc and truncf.
[dragonfly.git] / contrib / hostapd-0.4.9 / eap_sim_db.h
1 #ifndef EAP_SIM_DB_H
2 #define EAP_SIM_DB_H
3
4 #ifdef EAP_SIM
5
6 /* Initialize EAP-SIM database/authentication gateway interface.
7  * Returns pointer to a private data structure. */
8 void * eap_sim_db_init(const char *config);
9
10 /* Deinitialize EAP-SIM database/authentication gateway interface.
11  * priv is the pointer from eap_sim_db_init(). */
12 void eap_sim_db_deinit(void *priv);
13
14 /* Get GSM triplets for user name identity (identity_len bytes). In most cases,
15  * the user name is '1' | IMSI, i.e., 1 followed by the IMSI in ASCII format.
16  * priv is the pointer from eap_sim_db_init().
17  * Returns the number of triplets received (has to be less than or equal to
18  * max_chal) or -1 on error (e.g., user not found). rand, kc, and sres are
19  * pointers to data areas for the triplets. */
20 int eap_sim_db_get_gsm_triplets(void *priv, const u8 *identity,
21                                 size_t identity_len, int max_chal,
22                                 u8 *rand, u8 *kc, u8 *sres);
23
24 /* Verify whether the given user identity (identity_len bytes) is known. In
25  * most cases, the user name is '1' | IMSI, i.e., 1 followed by the IMSI in
26  * ASCII format.
27  * priv is the pointer from eap_sim_db_init().
28  * Returns 0 if the user is found and GSM triplets would be available for it or
29  * -1 on error (e.g., user not found or no triplets available). */
30 int eap_sim_db_identity_known(void *priv, const u8 *identity,
31                               size_t identity_len);
32
33 #else /* EAP_SIM */
34 static inline void * eap_sim_db_init(const char *config)
35 {
36         return NULL;
37 }
38
39 static inline void eap_sim_db_deinit(void *priv)
40 {
41 }
42 #endif /* EAP_SIM */
43
44 #endif /* EAP_SIM_DB_H */