Mercurial > hg > waaad
annotate extensions/radius_gw/sub_acct.c @ 393:f63adc1b3e99
Renamed accounting sub extension
author | Sebastien Decugis <sdecugis@nict.go.jp> |
---|---|
date | Fri, 29 May 2009 17:39:38 +0900 |
parents | extensions/radius_gw/sub_2866.c@9907abba8681 |
children | bcc13af0825a |
rev | line source |
---|---|
391
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
1 /********************************************************************************************************* |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
2 * Software License Agreement (BSD License) * |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
3 * Author: Sebastien Decugis <sdecugis@nict.go.jp> * |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
4 * * |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
5 * Copyright (c) 2009, WIDE Project and NICT * |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
6 * All rights reserved. * |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
7 * * |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
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 * |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
9 * permitted provided that the following conditions are met: * |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
10 * * |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
11 * * Redistributions of source code must retain the above * |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
12 * copyright notice, this list of conditions and the * |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
13 * following disclaimer. * |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
14 * * |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
15 * * Redistributions in binary form must reproduce the above * |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
16 * copyright notice, this list of conditions and the * |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
17 * following disclaimer in the documentation and/or other * |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
18 * materials provided with the distribution. * |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
19 * * |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
20 * * Neither the name of the WIDE Project or NICT nor the * |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
21 * names of its contributors may be used to endorse or * |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
22 * promote products derived from this software without * |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
23 * specific prior written permission of WIDE Project and * |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
24 * NICT. * |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
25 * * |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
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 * |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
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 * |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
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 * |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
29 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
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 * |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
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 * |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
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 * |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
33 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
34 *********************************************************************************************************/ |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
35 |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
36 /* Sub extension for handling RADIUS Accounting-Request messages */ |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
37 |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
38 #define IN_EXTENSION |
393
f63adc1b3e99
Renamed accounting sub extension
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
391
diff
changeset
|
39 #define DEFINE_DEBUG_MACRO sub_acct |
391
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
40 #define DECLARE_API_POINTERS |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
41 #include <waaad/waaad.h> |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
42 |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
43 #include "rg_common.h" |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
44 |
393
f63adc1b3e99
Renamed accounting sub extension
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
391
diff
changeset
|
45 #ifndef SUB_ACCT_VERBO |
f63adc1b3e99
Renamed accounting sub extension
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
391
diff
changeset
|
46 #define SUB_ACCT_VERBO 0 |
f63adc1b3e99
Renamed accounting sub extension
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
391
diff
changeset
|
47 #endif /* SUB_ACCT_VERBO */ |
391
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
48 |
393
f63adc1b3e99
Renamed accounting sub extension
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
391
diff
changeset
|
49 int sub_acct_verbosity = SUB_ACCT_VERBO; |
391
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
50 |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
51 struct rga_conf_state { |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
52 char * conffile; |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
53 }; |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
54 |
393
f63adc1b3e99
Renamed accounting sub extension
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
391
diff
changeset
|
55 static struct rga_conf_state * acct_conf_parse(char * conffile) |
391
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
56 { |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
57 struct rga_conf_state * cs; |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
58 |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
59 TRACE_ENTRY("%p", conffile); |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
60 |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
61 CHECK_MALLOC_DO( cs = malloc(sizeof(struct rga_conf_state)), return NULL ); |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
62 memset(cs, 0, sizeof(struct rga_conf_state)); |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
63 |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
64 if (conffile) |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
65 cs->conffile = conffile; |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
66 else |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
67 cs->conffile = "-"; |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
68 |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
69 TRACE_DEBUG(INFO, "Sub extension Accounting (RFC2866) initialized with configuration: '%s'", cs->conffile); |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
70 return cs; |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
71 } |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
72 |
393
f63adc1b3e99
Renamed accounting sub extension
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
391
diff
changeset
|
73 static void acct_conf_free(struct rga_conf_state * cs) |
391
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
74 { |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
75 TRACE_ENTRY("%p", cs); |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
76 CHECK_PARAMS_DO( cs, ); |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
77 free(cs); |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
78 return; |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
79 } |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
80 |
393
f63adc1b3e99
Renamed accounting sub extension
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
391
diff
changeset
|
81 static int acct_rad_req(struct rga_conf_state * cs, sess_id_t ** session, struct radius_msg * rad_req, struct radius_msg ** rad_ans, msg_t ** diam_fw, void * cli ) |
391
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
82 { |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
83 int idx; |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
84 int got_id = 0; |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
85 uint32_t status_type; |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
86 |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
87 TRACE_ENTRY("%p %p %p %p %p %p", cs, session, rad_req, rad_ans, diam_fw, cli); |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
88 CHECK_PARAMS(rad_req && (rad_req->hdr->code == RADIUS_CODE_ACCOUNTING_REQUEST) && rad_ans && diam_fw && *diam_fw); |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
89 |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
90 /* Check the message contains the NAS idnetification */ |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
91 for (idx = 0; idx < rad_req->attr_used; idx++) { |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
92 struct radius_attr_hdr * attr = (struct radius_attr_hdr *)(rad_req->buf + rad_req->attr_pos[idx]); |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
93 switch (attr->type) { |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
94 case RADIUS_ATTR_NAS_IP_ADDRESS: |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
95 case RADIUS_ATTR_NAS_IDENTIFIER: |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
96 case RADIUS_ATTR_NAS_IPV6_ADDRESS: |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
97 got_id = 1; |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
98 break; |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
99 } |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
100 } |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
101 |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
102 /* Check basic information is there */ |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
103 if (!got_id || radius_msg_get_attr_int32(rad_req, RADIUS_ATTR_ACCT_STATUS_TYPE, &status_type)) { |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
104 TRACE_DEBUG(INFO, "RADIUS Account-Request did not contain a NAS ip/identifier or Acct-Status-Type attribute, reject."); |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
105 return EINVAL; |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
106 } |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
107 |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
108 /* Handle the Accounting-On case: nothing to do, just reply OK, since Diameter does not support this */ |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
109 if (status_type == RADIUS_ACCT_STATUS_TYPE_ACCOUNTING_ON) { |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
110 TRACE_DEBUG(FULL, "Received Accounting-On Acct-Status-Type attribute, replying directly."); |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
111 CHECK_MALLOC( *rad_ans = radius_msg_new(RADIUS_CODE_ACCOUNTING_RESPONSE, rad_req->hdr->identifier) ); |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
112 return -3; |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
113 } |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
114 |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
115 return ENOTSUP; |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
116 } |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
117 |
393
f63adc1b3e99
Renamed accounting sub extension
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
391
diff
changeset
|
118 static int acct_diam_ans(struct rga_conf_state * cs, sess_id_t ** session, msg_t ** diam_ans, struct radius_msg ** rad_fw, void * cli ) |
391
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
119 { |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
120 TRACE_ENTRY("%p %p %p %p %p", cs, session, diam_ans, rad_fw, cli); |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
121 CHECK_PARAMS(cs); |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
122 |
393
f63adc1b3e99
Renamed accounting sub extension
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
391
diff
changeset
|
123 return ENOTSUP; |
391
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
124 } |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
125 |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
126 int rga_register(int version, waaad_api_t * waaad_api, struct radius_gw_api * api) |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
127 { |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
128 TRACE_ENTRY("%d %p %p", version, waaad_api, api); |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
129 CHECK_PARAMS( waaad_api && api ); |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
130 |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
131 if (version != RADIUS_GW_API_VER) { |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
132 log_error("ABI version mismatch, please recompile this extension (%s)\n", __FILE__); |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
133 return EINVAL; |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
134 } |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
135 |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
136 /* Required to use the waaad api from this sub-extension: */ |
393
f63adc1b3e99
Renamed accounting sub extension
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
391
diff
changeset
|
137 EXTENSION_API_INIT_INTERN( API_MODULE_ALL, "sub_acct", waaad_api ); |
391
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
138 |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
139 /* Initialize the radius_gw api callbacks */ |
393
f63adc1b3e99
Renamed accounting sub extension
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
391
diff
changeset
|
140 api->rga_conf_parse_cb = acct_conf_parse; |
f63adc1b3e99
Renamed accounting sub extension
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
391
diff
changeset
|
141 api->rga_conf_free_cb = acct_conf_free; |
f63adc1b3e99
Renamed accounting sub extension
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
391
diff
changeset
|
142 api->rga_rad_req_cb = acct_rad_req; |
f63adc1b3e99
Renamed accounting sub extension
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
391
diff
changeset
|
143 api->rga_diam_ans_cb = acct_diam_ans; |
391
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
144 |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
145 /* We're done, we must not initialize any state here since the extension must be re-entrant, but in sample_conf_parse */ |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
146 return 0; |
9907abba8681
Added early support for RADIUS Accounting (RFC2866)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
147 } |