Mercurial > hg > waaad
view extensions/radius_gw/radius_gw_internal.h @ 363:9d330bd07134
Progress on the radius_gw gateway
author | Sebastien Decugis <sdecugis@nict.go.jp> |
---|---|
date | Thu, 21 May 2009 15:14:18 +0900 |
parents | 2206c7f2945a |
children |
line wrap: on
line source
/********************************************************************************************************* * Software License Agreement (BSD License) * * Author: Sebastien Decugis <sdecugis@nict.go.jp> * * * * Copyright (c) 2008, WIDE Project and NICT * * All rights reserved. * * * * Redistribution and use of this software in source and binary forms, with or without modification, are * * permitted provided that the following conditions are met: * * * * * Redistributions of source code must retain the above * * copyright notice, this list of conditions and the * * following disclaimer. * * * * * Redistributions in binary form must reproduce the above * * copyright notice, this list of conditions and the * * following disclaimer in the documentation and/or other * * materials provided with the distribution. * * * * * Neither the name of the WIDE Project or NICT nor the * * names of its contributors may be used to endorse or * * promote products derived from this software without * * specific prior written permission of WIDE Project and * * NICT. * * * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED * * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * *********************************************************************************************************/ /* This file contains the definitions needed by the radius_gw extension alone, not exported to sub-extensions. */ #ifndef _RADIUS_GW_INTERNAL_H #define _RADIUS_GW_INTERNAL_H /* This file extends definitions from the standard waaad API */ #define IN_EXTENSION #define DEFINE_DEBUG_MACRO radius_gw #include <waaad/waaad.h> /* include the general stuff */ #include "radius_gw.h" /* Some headers that are useful in many files */ #include <string.h> #include <stdlib.h> #include <errno.h> /* API definition of waaad */ extern waaad_api_t * waaad_api; /* The RADIUS server(s) interface */ struct rgw_serv { unsigned disabled :1; unsigned ip_disabled :1; unsigned ip6_disabled :1; unsigned :13; /* padding */ uint16_t port; /* stored in network byte order */ struct in_addr ip_endpoint; struct in6_addr ip6_endpoint; }; extern struct rgw_servs { struct rgw_serv auth_serv; struct rgw_serv acct_serv; } rgw_servers; int rgw_servers_init(void); int rgw_servers_start(void); void rgw_servers_dump(void); void rgw_servers_fini(void); /* The clients allowed to connect to these servers */ int rgw_clients_init(void); int rgw_clients_add( struct sockaddr * ip_port, unsigned char ** key, size_t keylen ); int rgw_clients_getkey(void * cli, unsigned char **key, size_t *key_len); int rgw_clients_search(struct sockaddr * ip_port, void ** ref); int rgw_clients_checkdup(rad_t **msg, void *cli); void rgw_clients_dispose(void ** ref); void rgw_clients_dump(void); void rgw_clients_fini(void); /* Functions related to RADIUS messages buffers on the network */ int rgw_msg_parse(unsigned char *buf, size_t len, rad_t **msg); int rgw_msg_gen(rad_t *msg, unsigned char **buf, size_t *len); int rgw_msg_send(rad_t * msg, void * cli); /* The sub-extensions that provide functions to support RADIUS messages and attributes (see also radius_gw.h) */ #define RGW_EXT_PORT_AUTH 1 #define RGW_EXT_PORT_ACCT 2 int rgw_extensions_init(void); int rgw_extensions_add( char * extfile, char * conffile, int port, unsigned char ** codes_array, size_t codes_sz ); void rgw_extensions_dump(void); void rgw_extensions_start_cache(void); int rgw_extensions_loop_req(rad_t **rad, sess_id_t **session, msg_t **diam_msg, void * cli); void rgw_extensions_fini(void); /* The function to parse the configuration file */ int rgw_conf_handle(char * conffile); /* Worker module that handle incoming RADIUS messages */ int rgw_work_start(void); int rgw_work_add(rad_t * msg, void * client); void rgw_work_fini(void); /* Verbosity level for debug */ extern int radius_gw_verbosity; #endif /* _RADIUS_GW_INTERNAL_H */