Changeset 842:42ce0a2c1772 in freeDiameter
- Timestamp:
- Oct 17, 2012, 3:05:31 AM (11 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/dict_dcca/dict_dcca.c
r800 r842 1 1 /**************** 2 Contributed by: Konstantin Chekushin <koch@lmt.lv> 2 Contributed by: Konstantin Chekushin <koch@lmt.lv> and Thomas Klausner <tk@giga.or.at> 3 3 License: same as freeDiameter 4 4 TODO: 5 - rules for CCR/CCA andall Grouped AVPs5 - rules for all Grouped AVPs 6 6 ****************/ 7 7 … … 67 67 static int dict_dcca_entry(char * conffile) 68 68 { 69 70 69 struct dict_object * dcca; 70 TRACE_ENTRY("%p", conffile); 71 71 72 /* Applications section */ 72 /* Applications section */ 73 { 74 /* DCCA */ 73 75 { 74 /* DCCA */ 75 { 76 struct dict_application_data data = { 4, "Diameter Credit Control Application" }; 77 CHECK_dict_new( DICT_APPLICATION, &data, NULL, &dcca); 78 } 79 80 } 76 struct dict_application_data data = { 4, "Diameter Credit Control Application" }; 77 CHECK_dict_new( DICT_APPLICATION, &data, NULL, &dcca); 78 } 79 } 81 80 82 81 /* Result codes */ … … 99 98 100 99 101 /* Commands section */102 {103 /*Credit Control Request*/104 {105 struct dict_object * cmd;106 struct dict_cmd_data data = {107 272, /* Code */108 "Credit-Control-Request", /* Name */109 CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE | CMD_FLAG_ERROR, /* Fixed flags */110 CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE /* Fixed flag values */111 };112 CHECK_dict_new(DICT_COMMAND, &data, NULL, &cmd);113 }114 115 /*Credit Control Response*/116 {117 struct dict_object * cmd;118 struct dict_cmd_data data = {119 272, /* Code */120 "Credit-Control-Answer", /* Name */121 CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE, /* Fixed flags */122 CMD_FLAG_PROXIABLE /* Fixed flag values */123 };124 CHECK_dict_new(DICT_COMMAND, &data, NULL, &cmd);125 }126 }127 100 128 101 /* AVP section */ … … 181 154 Grouped 182 155 */ 183 156 184 157 struct dict_avp_data data = { 185 158 413, /* Code */ … … 1152 1125 } 1153 1126 1154 1127 1128 /* Commands section */ 1129 { 1130 /* Credit-Control-Request (CCR) Command */ 1131 { 1132 /* 1133 From RFC 4006: 1134 1135 3.1. Credit-Control-Request (CCR) Command 1136 1137 The Credit-Control-Request message (CCR) is indicated by the 1138 command-code field being set to 272 and the 'R' bit being set in the 1139 Command Flags field. It is used between the Diameter credit-control 1140 client and the credit-control server to request credit authorization 1141 for a given service. 1142 1143 The Auth-Application-Id MUST be set to the value 4, indicating the 1144 Diameter credit-control application. 1145 1146 Message Format 1147 1148 <Credit-Control-Request> ::= < Diameter Header: 272, REQ, PXY > 1149 < Session-Id > 1150 { Origin-Host } 1151 { Origin-Realm } 1152 { Destination-Realm } 1153 { Auth-Application-Id } 1154 { Service-Context-Id } 1155 { CC-Request-Type } 1156 { CC-Request-Number } 1157 [ Destination-Host ] 1158 [ User-Name ] 1159 [ CC-Sub-Session-Id ] 1160 [ Acct-Multi-Session-Id ] 1161 [ Origin-State-Id ] 1162 [ Event-Timestamp ] 1163 *[ Subscription-Id ] 1164 [ Service-Identifier ] 1165 [ Termination-Cause ] 1166 [ Requested-Service-Unit ] 1167 [ Requested-Action ] 1168 *[ Used-Service-Unit ] 1169 [ Multiple-Services-Indicator ] 1170 *[ Multiple-Services-Credit-Control ] 1171 *[ Service-Parameter-Info ] 1172 [ CC-Correlation-Id ] 1173 [ User-Equipment-Info ] 1174 *[ Proxy-Info ] 1175 *[ Route-Record ] 1176 *[ AVP ] 1177 1178 10.1. Credit-Control AVP Table 1179 1180 The table in this section is used to represent which credit-control 1181 applications specific AVPs defined in this document are to be present 1182 in the credit-control messages. 1183 1184 +-----------+ 1185 | Command | 1186 | Code | 1187 |-----+-----+ 1188 Attribute Name | CCR | CCA | 1189 ------------------------------|-----+-----+ 1190 Acct-Multi-Session-Id | 0-1 | 0-1 | 1191 Auth-Application-Id | 1 | 1 | 1192 CC-Correlation-Id | 0-1 | 0 | 1193 CC-Session-Failover | 0 | 0-1 | 1194 CC-Request-Number | 1 | 1 | 1195 CC-Request-Type | 1 | 1 | 1196 CC-Sub-Session-Id | 0-1 | 0-1 | 1197 Check-Balance-Result | 0 | 0-1 | 1198 Cost-Information | 0 | 0-1 | 1199 Credit-Control-Failure- | 0 | 0-1 | 1200 Handling | | | 1201 Destination-Host | 0-1 | 0 | 1202 Destination-Realm | 1 | 0 | 1203 Direct-Debiting-Failure- | 0 | 0-1 | 1204 Handling | | | 1205 Event-Timestamp | 0-1 | 0-1 | 1206 Failed-AVP | 0 | 0+ | 1207 Final-Unit-Indication | 0 | 0-1 | 1208 Granted-Service-Unit | 0 | 0-1 | 1209 Multiple-Services-Credit- | 0+ | 0+ | 1210 Control | | | 1211 Multiple-Services-Indicator | 0-1 | 0 | 1212 Origin-Host | 1 | 1 | 1213 Origin-Realm | 1 | 1 | 1214 Origin-State-Id | 0-1 | 0-1 | 1215 Proxy-Info | 0+ | 0+ | 1216 Redirect-Host | 0 | 0+ | 1217 Redirect-Host-Usage | 0 | 0-1 | 1218 Redirect-Max-Cache-Time | 0 | 0-1 | 1219 Requested-Action | 0-1 | 0 | 1220 Requested-Service-Unit | 0-1 | 0 | 1221 Route-Record | 0+ | 0+ | 1222 Result-Code | 0 | 1 | 1223 Service-Context-Id | 1 | 0 | 1224 Service-Identifier | 0-1 | 0 | 1225 Service-Parameter-Info | 0+ | 0 | 1226 Session-Id | 1 | 1 | 1227 Subscription-Id | 0+ | 0 | 1228 Termination-Cause | 0-1 | 0 | 1229 User-Equipment-Info | 0-1 | 0 | 1230 Used-Service-Unit | 0+ | 0 | 1231 User-Name | 0-1 | 0-1 | 1232 Validity-Time | 0 | 0-1 | 1233 ------------------------------|-----+-----+ 1234 1235 1236 */ 1237 struct dict_object * cmd; 1238 struct dict_cmd_data data = { 1239 272, /* Code */ 1240 "Credit-Control-Request", /* Name */ 1241 CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE, /* Fixed flags */ 1242 CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE /* Fixed flag values */ 1243 }; 1244 struct local_rules_definition rules[] = 1245 { { "Session-Id", RULE_FIXED_HEAD, -1, 1 }, 1246 { "Origin-Host", RULE_REQUIRED, -1, 1 }, 1247 { "Origin-Realm", RULE_REQUIRED, -1, 1 }, 1248 { "Destination-Realm", RULE_REQUIRED, -1, 1 }, 1249 { "Auth-Application-Id", RULE_REQUIRED, -1, 1 }, 1250 { "Service-Context-Id", RULE_REQUIRED, -1, 1 }, 1251 { "CC-Request-Type", RULE_REQUIRED, -1, 1 }, 1252 { "CC-Request-Number", RULE_REQUIRED, -1, 1 }, 1253 { "Destination-Host", RULE_OPTIONAL, -1, 1 }, 1254 { "User-Name", RULE_OPTIONAL, -1, 1 }, 1255 { "CC-Sub-Session-Id", RULE_OPTIONAL, -1, 1 }, 1256 { "Acct-Multi-Session-Id", RULE_OPTIONAL, -1, 1 }, 1257 { "Origin-State-Id", RULE_OPTIONAL, -1, 1 }, 1258 { "Event-Timestamp", RULE_OPTIONAL, -1, 1 }, 1259 { "Subscription-Id", RULE_OPTIONAL, -1, -1 }, 1260 { "Service-Identifier", RULE_OPTIONAL, -1, 1 }, 1261 { "Termination-Cause", RULE_OPTIONAL, -1, 1 }, 1262 { "Requested-Service-Unit", RULE_OPTIONAL, -1, 1 }, 1263 { "Requested-Action", RULE_OPTIONAL, -1, 1 }, 1264 { "Used-Service-Unit", RULE_OPTIONAL, -1, -1 }, 1265 { "Multiple-Services-Indicator", RULE_OPTIONAL, -1, 1 }, 1266 { "Multiple-Services-Credit-Control", RULE_OPTIONAL, -1, -1 }, 1267 { "Service-Parameter-Info", RULE_OPTIONAL, -1, -1 }, 1268 { "CC-Correlation-Id", RULE_OPTIONAL, -1, 1 }, 1269 { "User-Equipment-Info", RULE_OPTIONAL, -1, 1 }, 1270 { "Proxy-Info", RULE_OPTIONAL, -1, -1 }, 1271 { "Route-Record", RULE_OPTIONAL, -1, -1 } 1272 /* plus any additional AVPs { "AVP", RULE_OPTIONAL, -1, -1 } */ 1273 }; 1274 1275 CHECK_dict_new( DICT_COMMAND, &data, dcca, &cmd); 1276 PARSE_loc_rules( rules, cmd ); 1277 } 1278 1279 /* Credit-Control-Answer (CCA) Command */ 1280 { 1281 /* 1282 From RFC 4006: 1283 3.2. Credit-Control-Answer (CCA) Command 1284 1285 The Credit-Control-Answer message (CCA) is indicated by the command- 1286 code field being set to 272 and the 'R' bit being cleared in the 1287 Command Flags field. It is used between the credit-control server 1288 and the Diameter credit-control client to acknowledge a Credit- 1289 Control-Request command. 1290 1291 Message Format 1292 1293 <Credit-Control-Answer> ::= < Diameter Header: 272, PXY > 1294 < Session-Id > 1295 { Result-Code } 1296 { Origin-Host } 1297 { Origin-Realm } 1298 { Auth-Application-Id } 1299 { CC-Request-Type } 1300 { CC-Request-Number } 1301 [ User-Name ] 1302 [ CC-Session-Failover ] 1303 [ CC-Sub-Session-Id ] 1304 [ Acct-Multi-Session-Id ] 1305 [ Origin-State-Id ] 1306 [ Event-Timestamp ] 1307 [ Granted-Service-Unit ] 1308 *[ Multiple-Services-Credit-Control ] 1309 [ Cost-Information] 1310 [ Final-Unit-Indication ] 1311 [ Check-Balance-Result ] 1312 [ Credit-Control-Failure-Handling ] 1313 [ Direct-Debiting-Failure-Handling ] 1314 [ Validity-Time] 1315 *[ Redirect-Host] 1316 [ Redirect-Host-Usage ] 1317 [ Redirect-Max-Cache-Time ] 1318 *[ Proxy-Info ] 1319 *[ Route-Record ] 1320 *[ Failed-AVP ] 1321 *[ AVP ] 1322 1323 */ 1324 struct dict_object * cmd; 1325 struct dict_cmd_data data = { 1326 272, /* Code */ 1327 "Credit-Control-Answer", /* Name */ 1328 CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE | CMD_FLAG_ERROR, /* Fixed flags */ 1329 CMD_FLAG_PROXIABLE /* Fixed flag values */ 1330 }; 1331 struct local_rules_definition rules[] = 1332 { { "Session-Id", RULE_FIXED_HEAD, -1, 1 }, 1333 { "Result-Code", RULE_REQUIRED, -1, 1 }, 1334 { "Origin-Host", RULE_REQUIRED, -1, 1 }, 1335 { "Origin-Realm", RULE_REQUIRED, -1, 1 }, 1336 { "Auth-Application-Id", RULE_REQUIRED, -1, 1 }, 1337 { "CC-Request-Type", RULE_REQUIRED, -1, 1 }, 1338 { "CC-Request-Number", RULE_REQUIRED, -1, 1 }, 1339 { "User-Name", RULE_OPTIONAL, -1, 1 }, 1340 { "CC-Session-Failover", RULE_OPTIONAL, -1, 1 }, 1341 { "CC-Sub-Session-Id", RULE_OPTIONAL, -1, 1 }, 1342 { "Acct-Multi-Session-Id", RULE_OPTIONAL, -1, 1 }, 1343 { "Origin-State-Id", RULE_OPTIONAL, -1, 1 }, 1344 { "Event-Timestamp", RULE_OPTIONAL, -1, 1 }, 1345 { "Granted-Service-Unit", RULE_OPTIONAL, -1, 1 }, 1346 { "Multiple-Services-Credit-Control", RULE_OPTIONAL, -1, -1 }, 1347 { "Cost-Information", RULE_OPTIONAL, -1, 1 }, 1348 { "Final-Unit-Indication", RULE_OPTIONAL, -1, 1 }, 1349 { "Check-Balance-Result", RULE_OPTIONAL, -1, 1 }, 1350 { "Credit-Control-Failure-Handling", RULE_OPTIONAL, -1, 1 }, 1351 { "Direct-Debiting-Failure-Handling", RULE_OPTIONAL, -1, 1 }, 1352 { "Validity-Time", RULE_OPTIONAL, -1, 1 }, 1353 { "Redirect-Host", RULE_OPTIONAL, -1, -1 }, 1354 { "Redirect-Host-Usage", RULE_OPTIONAL, -1, 1 }, 1355 { "Redirect-Max-Cache-Time", RULE_OPTIONAL, -1, 1 }, 1356 { "Proxy-Info", RULE_OPTIONAL, -1, -1 }, 1357 { "Route-Record", RULE_OPTIONAL, -1, -1 }, 1358 { "Failed-AVP", RULE_OPTIONAL, -1, -1 } 1359 /* plus any additional AVPs { "AVP", RULE_OPTIONAL, -1, -1 } */ 1360 }; 1361 1362 CHECK_dict_new( DICT_COMMAND, &data, dcca, &cmd); 1363 PARSE_loc_rules( rules, cmd ); 1364 } 1365 } 1155 1366 TRACE_DEBUG(INFO, "Extension 'Dictionary definitions for DCCA (rfc4006)' initialized"); 1156 1367 return 0;
Note: See TracChangeset
for help on using the changeset viewer.