xref: /freebsd/contrib/wpa/hostapd/eap_register.c (revision e28a4053b110e06768631ac8401ed4a3c05e68a5)
1*e28a4053SRui Paulo /*
2*e28a4053SRui Paulo  * EAP method registration
3*e28a4053SRui Paulo  * Copyright (c) 2004-2009, Jouni Malinen <j@w1.fi>
4*e28a4053SRui Paulo  *
5*e28a4053SRui Paulo  * This program is free software; you can redistribute it and/or modify
6*e28a4053SRui Paulo  * it under the terms of the GNU General Public License version 2 as
7*e28a4053SRui Paulo  * published by the Free Software Foundation.
8*e28a4053SRui Paulo  *
9*e28a4053SRui Paulo  * Alternatively, this software may be distributed under the terms of BSD
10*e28a4053SRui Paulo  * license.
11*e28a4053SRui Paulo  *
12*e28a4053SRui Paulo  * See README and COPYING for more details.
13*e28a4053SRui Paulo  */
14*e28a4053SRui Paulo 
15*e28a4053SRui Paulo #include "includes.h"
16*e28a4053SRui Paulo 
17*e28a4053SRui Paulo #include "common.h"
18*e28a4053SRui Paulo #include "eap_server/eap_methods.h"
19*e28a4053SRui Paulo #include "eap_register.h"
20*e28a4053SRui Paulo 
21*e28a4053SRui Paulo 
22*e28a4053SRui Paulo /**
23*e28a4053SRui Paulo  * eap_server_register_methods - Register statically linked EAP server methods
24*e28a4053SRui Paulo  * Returns: 0 on success, -1 or -2 on failure
25*e28a4053SRui Paulo  *
26*e28a4053SRui Paulo  * This function is called at program initialization to register all EAP
27*e28a4053SRui Paulo  * methods that were linked in statically.
28*e28a4053SRui Paulo  */
29*e28a4053SRui Paulo int eap_server_register_methods(void)
30*e28a4053SRui Paulo {
31*e28a4053SRui Paulo 	int ret = 0;
32*e28a4053SRui Paulo 
33*e28a4053SRui Paulo #ifdef EAP_SERVER_IDENTITY
34*e28a4053SRui Paulo 	if (ret == 0)
35*e28a4053SRui Paulo 		ret = eap_server_identity_register();
36*e28a4053SRui Paulo #endif /* EAP_SERVER_IDENTITY */
37*e28a4053SRui Paulo 
38*e28a4053SRui Paulo #ifdef EAP_SERVER_MD5
39*e28a4053SRui Paulo 	if (ret == 0)
40*e28a4053SRui Paulo 		ret = eap_server_md5_register();
41*e28a4053SRui Paulo #endif /* EAP_SERVER_MD5 */
42*e28a4053SRui Paulo 
43*e28a4053SRui Paulo #ifdef EAP_SERVER_TLS
44*e28a4053SRui Paulo 	if (ret == 0)
45*e28a4053SRui Paulo 		ret = eap_server_tls_register();
46*e28a4053SRui Paulo #endif /* EAP_SERVER_TLS */
47*e28a4053SRui Paulo 
48*e28a4053SRui Paulo #ifdef EAP_SERVER_MSCHAPV2
49*e28a4053SRui Paulo 	if (ret == 0)
50*e28a4053SRui Paulo 		ret = eap_server_mschapv2_register();
51*e28a4053SRui Paulo #endif /* EAP_SERVER_MSCHAPV2 */
52*e28a4053SRui Paulo 
53*e28a4053SRui Paulo #ifdef EAP_SERVER_PEAP
54*e28a4053SRui Paulo 	if (ret == 0)
55*e28a4053SRui Paulo 		ret = eap_server_peap_register();
56*e28a4053SRui Paulo #endif /* EAP_SERVER_PEAP */
57*e28a4053SRui Paulo 
58*e28a4053SRui Paulo #ifdef EAP_SERVER_TLV
59*e28a4053SRui Paulo 	if (ret == 0)
60*e28a4053SRui Paulo 		ret = eap_server_tlv_register();
61*e28a4053SRui Paulo #endif /* EAP_SERVER_TLV */
62*e28a4053SRui Paulo 
63*e28a4053SRui Paulo #ifdef EAP_SERVER_GTC
64*e28a4053SRui Paulo 	if (ret == 0)
65*e28a4053SRui Paulo 		ret = eap_server_gtc_register();
66*e28a4053SRui Paulo #endif /* EAP_SERVER_GTC */
67*e28a4053SRui Paulo 
68*e28a4053SRui Paulo #ifdef EAP_SERVER_TTLS
69*e28a4053SRui Paulo 	if (ret == 0)
70*e28a4053SRui Paulo 		ret = eap_server_ttls_register();
71*e28a4053SRui Paulo #endif /* EAP_SERVER_TTLS */
72*e28a4053SRui Paulo 
73*e28a4053SRui Paulo #ifdef EAP_SERVER_SIM
74*e28a4053SRui Paulo 	if (ret == 0)
75*e28a4053SRui Paulo 		ret = eap_server_sim_register();
76*e28a4053SRui Paulo #endif /* EAP_SERVER_SIM */
77*e28a4053SRui Paulo 
78*e28a4053SRui Paulo #ifdef EAP_SERVER_AKA
79*e28a4053SRui Paulo 	if (ret == 0)
80*e28a4053SRui Paulo 		ret = eap_server_aka_register();
81*e28a4053SRui Paulo #endif /* EAP_SERVER_AKA */
82*e28a4053SRui Paulo 
83*e28a4053SRui Paulo #ifdef EAP_SERVER_AKA_PRIME
84*e28a4053SRui Paulo 	if (ret == 0)
85*e28a4053SRui Paulo 		ret = eap_server_aka_prime_register();
86*e28a4053SRui Paulo #endif /* EAP_SERVER_AKA_PRIME */
87*e28a4053SRui Paulo 
88*e28a4053SRui Paulo #ifdef EAP_SERVER_PAX
89*e28a4053SRui Paulo 	if (ret == 0)
90*e28a4053SRui Paulo 		ret = eap_server_pax_register();
91*e28a4053SRui Paulo #endif /* EAP_SERVER_PAX */
92*e28a4053SRui Paulo 
93*e28a4053SRui Paulo #ifdef EAP_SERVER_PSK
94*e28a4053SRui Paulo 	if (ret == 0)
95*e28a4053SRui Paulo 		ret = eap_server_psk_register();
96*e28a4053SRui Paulo #endif /* EAP_SERVER_PSK */
97*e28a4053SRui Paulo 
98*e28a4053SRui Paulo #ifdef EAP_SERVER_SAKE
99*e28a4053SRui Paulo 	if (ret == 0)
100*e28a4053SRui Paulo 		ret = eap_server_sake_register();
101*e28a4053SRui Paulo #endif /* EAP_SERVER_SAKE */
102*e28a4053SRui Paulo 
103*e28a4053SRui Paulo #ifdef EAP_SERVER_GPSK
104*e28a4053SRui Paulo 	if (ret == 0)
105*e28a4053SRui Paulo 		ret = eap_server_gpsk_register();
106*e28a4053SRui Paulo #endif /* EAP_SERVER_GPSK */
107*e28a4053SRui Paulo 
108*e28a4053SRui Paulo #ifdef EAP_SERVER_VENDOR_TEST
109*e28a4053SRui Paulo 	if (ret == 0)
110*e28a4053SRui Paulo 		ret = eap_server_vendor_test_register();
111*e28a4053SRui Paulo #endif /* EAP_SERVER_VENDOR_TEST */
112*e28a4053SRui Paulo 
113*e28a4053SRui Paulo #ifdef EAP_SERVER_FAST
114*e28a4053SRui Paulo 	if (ret == 0)
115*e28a4053SRui Paulo 		ret = eap_server_fast_register();
116*e28a4053SRui Paulo #endif /* EAP_SERVER_FAST */
117*e28a4053SRui Paulo 
118*e28a4053SRui Paulo #ifdef EAP_SERVER_WSC
119*e28a4053SRui Paulo 	if (ret == 0)
120*e28a4053SRui Paulo 		ret = eap_server_wsc_register();
121*e28a4053SRui Paulo #endif /* EAP_SERVER_WSC */
122*e28a4053SRui Paulo 
123*e28a4053SRui Paulo #ifdef EAP_SERVER_IKEV2
124*e28a4053SRui Paulo 	if (ret == 0)
125*e28a4053SRui Paulo 		ret = eap_server_ikev2_register();
126*e28a4053SRui Paulo #endif /* EAP_SERVER_IKEV2 */
127*e28a4053SRui Paulo 
128*e28a4053SRui Paulo #ifdef EAP_SERVER_TNC
129*e28a4053SRui Paulo 	if (ret == 0)
130*e28a4053SRui Paulo 		ret = eap_server_tnc_register();
131*e28a4053SRui Paulo #endif /* EAP_SERVER_TNC */
132*e28a4053SRui Paulo 
133*e28a4053SRui Paulo 	return ret;
134*e28a4053SRui Paulo }
135