104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt/*
204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * RADIUS Dynamic Authorization Server (DAS)
304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * Copyright (c) 2012, Jouni Malinen <j@w1.fi>
404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt *
504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * This software may be distributed under the terms of the BSD license.
604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt * See README for more details.
704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt */
804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt
904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt#ifndef RADIUS_DAS_H
1004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt#define RADIUS_DAS_H
1104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt
1204949598a23f501be6eec21697465fd46a28840aDmitry Shmidtstruct radius_das_data;
1304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt
1404949598a23f501be6eec21697465fd46a28840aDmitry Shmidtenum radius_das_res {
1504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt	RADIUS_DAS_SUCCESS,
1604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt	RADIUS_DAS_NAS_MISMATCH,
1704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt	RADIUS_DAS_SESSION_NOT_FOUND
1804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt};
1904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt
2004949598a23f501be6eec21697465fd46a28840aDmitry Shmidtstruct radius_das_attrs {
2104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt	const u8 *sta_addr;
2204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt	const u8 *user_name;
2304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt	size_t user_name_len;
2404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt	const u8 *acct_session_id;
2504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt	size_t acct_session_id_len;
2604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt	const u8 *cui;
2704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt	size_t cui_len;
2804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt};
2904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt
3004949598a23f501be6eec21697465fd46a28840aDmitry Shmidtstruct radius_das_conf {
3104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt	int port;
3204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt	const u8 *shared_secret;
3304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt	size_t shared_secret_len;
3404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt	const struct hostapd_ip_addr *client_addr;
3504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt	unsigned int time_window;
3604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt	int require_event_timestamp;
3704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt	void *ctx;
3804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt	enum radius_das_res (*disconnect)(void *ctx,
3904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt					  struct radius_das_attrs *attr);
4004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt};
4104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt
4204949598a23f501be6eec21697465fd46a28840aDmitry Shmidtstruct radius_das_data *
4304949598a23f501be6eec21697465fd46a28840aDmitry Shmidtradius_das_init(struct radius_das_conf *conf);
4404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt
4504949598a23f501be6eec21697465fd46a28840aDmitry Shmidtvoid radius_das_deinit(struct radius_das_data *data);
4604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt
4704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt#endif /* RADIUS_DAS_H */
48