Mercurial > hg > freeDiameter
annotate extensions/app_radgw/rgwx_echodrop.h @ 554:25440e53a48e 1.0.1-rc1
Remove erroneous comment, the value was actually quite meaningless
author | Sebastien Decugis <sdecugis@nict.go.jp> |
---|---|
date | Wed, 15 Sep 2010 15:01:03 +0900 |
parents | c78f623c702d |
children | 4a9f08d6b6ba |
rev | line source |
---|---|
269
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
1 /********************************************************************************************************* |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
2 * Software License Agreement (BSD License) * |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
3 * Author: Sebastien Decugis <sdecugis@nict.go.jp> * |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
4 * * |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
5 * Copyright (c) 2010, WIDE Project and NICT * |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
6 * All rights reserved. * |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
7 * * |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
8 * Redistribution and use of this software in source and binary forms, with or without modification, are * |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
9 * permitted provided that the following conditions are met: * |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
10 * * |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
11 * * Redistributions of source code must retain the above * |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
12 * copyright notice, this list of conditions and the * |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
13 * following disclaimer. * |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
14 * * |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
15 * * Redistributions in binary form must reproduce the above * |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
16 * copyright notice, this list of conditions and the * |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
17 * following disclaimer in the documentation and/or other * |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
18 * materials provided with the distribution. * |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
19 * * |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
20 * * Neither the name of the WIDE Project or NICT nor the * |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
21 * names of its contributors may be used to endorse or * |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
22 * promote products derived from this software without * |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
23 * specific prior written permission of WIDE Project and * |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
24 * NICT. * |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
25 * * |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED * |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
27 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
28 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
29 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
30 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
32 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
33 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
34 *********************************************************************************************************/ |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
35 |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
36 /* RADIUS translation plugin, to handle specific RADIUS attributes by either caching them and |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
37 adding them to a corresponding RADIUS reply, or just dropping the attributes (no conversion to Diameter) */ |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
38 /* This extension is a kind of swiss army-knife for interoperability, must be used with care. |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
39 All attribute behaviors are specified through the configuration file of the extension |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
40 */ |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
41 |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
42 #include "rgw_common.h" |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
43 |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
44 /* Action associated with an attribute */ |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
45 #define ACT_ECHO 1 |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
46 #define ACT_DROP 2 |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
47 |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
48 /* Result of configuration parsing */ |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
49 struct rgwp_config { |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
50 /* list of attributes and associated actions */ |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
51 struct fd_list attributes; |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
52 |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
53 /* Handler to store the echo'ed attributes values */ |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
54 struct session_handler * sess_hdl; |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
55 }; |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
56 |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
57 /* An item of the attribute list */ |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
58 struct ed_conf_attribute { |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
59 struct fd_list chain; /* link in the list */ |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
60 |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
61 struct { |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
62 unsigned action :2; /* ACT_ECHO or ACT_DROP */ |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
63 unsigned vsa :1; /* Interpret as Vendor-Specific, and match the vendor id in addition to the code */ |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
64 unsigned tlv :1; /* Interpret as Vendor-Specific with TLV format, and match the type also */ |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
65 unsigned ext :1; /* Interpret as radius extended attribute, and match the ext-type also */ |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
66 }; |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
67 |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
68 uint32_t vendor_id; /* vendor id to match when vsa = 1 */ |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
69 uint16_t extype; /* Ext-Type value to match if ext = 1 */ |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
70 uint8_t type; /* Type value to match if tlv = 1; */ |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
71 |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
72 uint8_t code; /* The attribute code, the list is ordered by this value */ |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
73 }; |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
74 |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
75 /* For ECHO items, we save a list of these in the session */ |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
76 struct ed_saved_attribute { |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
77 struct fd_list chain; |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
78 struct radius_attr_hdr attr; /* copy of the attribute */ |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
79 /* The data of the attribute follows ... */ |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
80 }; |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
81 |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
82 |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
83 /* The yacc parser */ |
c78f623c702d
Ported the Echo/Drop plugin from waaad (missing files)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
84 int ed_conffile_parse(char * conffile, struct rgwp_config *cs); |