Mercurial > hg > waaad
view extensions/radius_gw/sub_echo_drop.h @ 374:883330e610e1
Progress on the echo_drop sub extension
author | Sebastien Decugis <sdecugis@nict.go.jp> |
---|---|
date | Tue, 26 May 2009 11:37:32 +0900 |
parents | 0cb02e490017 |
children |
line wrap: on
line source
/********************************************************************************************************* * Software License Agreement (BSD License) * * Author: Sebastien Decugis <sdecugis@nict.go.jp> * * * * Copyright (c) 2009, 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. * *********************************************************************************************************/ /* Sub-extension for radius_gw, to handle specific RADIUS attributes by either caching them and adding them to a corresponding RADIUS reply, or just dropping the attributes (no conversion to Diameter) */ #ifndef _SUB_ECHO_DROP #define _SUB_ECHO_DROP /* Default debug level for the extension */ #ifndef SUB_ECHO_DROP_VERBO #define SUB_ECHO_DROP_VERBO 0 #endif /* SUB_ECHO_DROP_VERBO */ #define IN_EXTENSION #define DEFINE_DEBUG_MACRO sub_echo_drop #include <waaad/waaad.h> #include "rg_common.h" #include <stdint.h> extern int sub_echo_drop_verbosity; /* Action to perform on an attribute */ #define ACT_ECHO 1 #define ACT_DROP 2 /* Parsed configuration: list of attributes and associated actions */ struct sed_conf_item { struct rg_list chain; struct { unsigned action :2; /* ACT_ECHO or ACT_DROP */ unsigned vsa :1; /* Interpret as Vendor-Specific, and match the vendor id in addition to the code */ unsigned tlv :1; /* Interpret as Vendor-Specific with TLV format, and match the type also */ unsigned ext :1; /* Interpret as radius extended attribute, and match the ext-type also */ }; uint32_t vendor_id; /* vendor id to match when vsa = 1 */ uint16_t extype; /* Ext-Type value to match if ext = 1 */ uint8_t type; /* Type value to match if tlv = 1; */ uint8_t code; /* The attribute code, the list is ordered by this value */ }; /* The structure that holds both configuration and state */ struct rga_conf_state { /* Input: configuration file */ char * conffile; /* Parsed configuration: what to do with attributes (list of struct sed_conf_item) */ struct rg_list conf; /* Session handler where "echo" attributes are kept */ sess_reg_t * sess_hdl; }; /* For ECHO items, we save a list of these in the session */ struct sed_saved_item { struct rg_list chain; struct radius_attr_hdr attr; /* copy of the attribute content, including the data */ }; /* The yacc parser */ int sed_conf_parse(struct rga_conf_state *cs); #endif /* _SUB_ECHO_DROP */