blob: 33bce71955cd9be10efda75c4c4d90e5a7784c65 [file] [log] [blame]
Brian Waters13d96012017-12-08 16:53:31 -06001/*
2* Copyright (c) 2017 Sprint
3*
4* Licensed under the Apache License, Version 2.0 (the "License");
5* you may not use this file except in compliance with the License.
6* You may obtain a copy of the License at
7*
8* http://www.apache.org/licenses/LICENSE-2.0
9*
10* Unless required by applicable law or agreed to in writing, software
11* distributed under the License is distributed on an "AS IS" BASIS,
12* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13* See the License for the specific language governing permissions and
14* limitations under the License.
15*/
16
17/****************
18 Generated By: fdtool enhancements to diafuzzer
19 License: same as freeDiameter
20****************/
21
22
23/*
24 * Dictionary definitions of objects specified in S6t (e10).
25 */
26#include <freeDiameter/extension.h>
27
28#define PROTO_VER "e10"
29#define GEN_DATE 1508010210.19
30
31const char *s6t_proto_ver = PROTO_VER;
32const double s6t_gen_date = GEN_DATE;
33
34/* The content of this file follows the same structure as dict_base_proto.c */
35
36#define CHECK_dict_new( _type, _data, _parent, _ref ) \
37{ \
38 int _ret = fd_dict_new( fd_g_config->cnf_dict, (_type), (_data), (_parent), (_ref) ); \
39 if ( _ret != 0 && _ret != EEXIST ) \
40 return _ret; \
41}
42
43#define CHECK_dict_search( _type, _criteria, _what, _result ) \
44 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, (_type), (_criteria), (_what), (_result), ENOENT) );
45
46struct local_rules_definition {
47 struct dict_avp_request avp_vendor_plus_name;
48 enum rule_position position;
49 int min;
50 int max;
51};
52
53#define RULE_ORDER( _position ) ((((_position) == RULE_FIXED_HEAD) || ((_position) == RULE_FIXED_TAIL)) ? 1 : 0 )
54
55/* Attention! This version of the macro uses AVP_BY_NAME_AND_VENDOR, in contrast to most other copies! */
56#define PARSE_loc_rules( _rulearray, _parent) { \
57 int __ar; \
58 for (__ar=0; __ar < sizeof(_rulearray) / sizeof((_rulearray)[0]); __ar++) { \
59 struct dict_rule_data __data = { NULL, \
60 (_rulearray)[__ar].position, \
61 0, \
62 (_rulearray)[__ar].min, \
63 (_rulearray)[__ar].max}; \
64 __data.rule_order = RULE_ORDER(__data.rule_position); \
65 CHECK_FCT( fd_dict_search( \
66 fd_g_config->cnf_dict, \
67 DICT_AVP, \
68 AVP_BY_NAME_AND_VENDOR, \
69 &(_rulearray)[__ar].avp_vendor_plus_name, \
70 &__data.rule_avp, 0 ) ); \
71 if ( !__data.rule_avp ) { \
72 TRACE_DEBUG(INFO, "AVP Not found: '%s'", (_rulearray)[__ar].avp_vendor_plus_name.avp_name); \
73 return ENOENT; \
74 } \
75 { \
76 int _ret = fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &(__data), (_parent), NULL ); \
77 if ( _ret != 0 && _ret != EEXIST ) { \
78 TRACE_DEBUG(INFO, "Error on rule with AVP '%s'", \
79 (_rulearray)[__ar].avp_vendor_plus_name.avp_name); \
80 return EINVAL; \
81 } \
82 } \
83 } \
84}
85
86#define CHECK_vendor_new( _data ) { \
87 struct dict_object * vendor_found; \
88 if (fd_dict_search(fd_g_config->cnf_dict,DICT_VENDOR,VENDOR_BY_ID,&_data.vendor_id,&vendor_found,ENOENT) == ENOENT) { \
89 CHECK_FCT(fd_dict_new(fd_g_config->cnf_dict, DICT_VENDOR, &_data, NULL, NULL)); \
90 } \
91}
92
93#define enumval_def_u32( _val_, _str_ ) \
94 { _str_, { .u32 = _val_ }}
95
96#define enumval_def_os( _len_, _val_, _str_ ) \
97 { _str_, { .os = { .data = (unsigned char *)_val_, .len = _len_ }}}
98
99
100static int dict_s6t_load_defs(char * conffile)
101{
102 TRACE_ENTRY("%p", conffile);
103 struct dict_object * app_id16777345;
104
105 /* Application Section */
106 {
107 {
108 struct dict_object * vendor;
109 CHECK_dict_search(DICT_VENDOR, VENDOR_BY_NAME, "3GPP", &vendor)
110 struct dict_application_data data = { 16777345, "S6t" };
111 CHECK_dict_new( DICT_APPLICATION, &data, vendor, &app_id16777345)
112 }
113 }
114
115
116 /* AVP section */
117 {
118 struct dict_object * Address_type;
119 struct dict_object * UTF8String_type;
120 struct dict_object * DiameterIdentity_type;
121 struct dict_object * DiameterURI_type;
122 struct dict_object * Time_type;
123 struct dict_object * IPFilterRule_type;
124
125 CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "Address", &Address_type);
126 CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "UTF8String", &UTF8String_type);
127 CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "DiameterIdentity", &DiameterIdentity_type);
128 CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "DiameterURI", &DiameterURI_type);
129 CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "Time", &Time_type);
130 CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "IPFilterRule", &IPFilterRule_type);
131
132
133 }
134
135 /* Commands section */
136 {
137 /* Configuration-Information-Request */
138 {
139 struct dict_object* cmd;
140 struct dict_cmd_data data = {
141 8388718, /* Code */
142 "Configuration-Information-Request", /* Name */
143 CMD_FLAG_REQUEST | CMD_FLAG_ERROR, /* Fixed flags */
144 CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE, /* Fixed flag values */
145 };
146
147 CHECK_dict_new( DICT_COMMAND, &data , app_id16777345, &cmd)
148 }
149 /* Configuration-Information-Answer */
150 {
151 struct dict_object* cmd;
152 struct dict_cmd_data data = {
153 8388718, /* Code */
154 "Configuration-Information-Answer", /* Name */
155 CMD_FLAG_REQUEST, /* Fixed flags */
156 CMD_FLAG_PROXIABLE, /* Fixed flag values */
157 };
158
159 CHECK_dict_new( DICT_COMMAND, &data , app_id16777345, &cmd)
160 }
161 /* Reporting-Information-Request */
162 {
163 struct dict_object* cmd;
164 struct dict_cmd_data data = {
165 8388719, /* Code */
166 "Reporting-Information-Request", /* Name */
167 CMD_FLAG_REQUEST | CMD_FLAG_ERROR, /* Fixed flags */
168 CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE, /* Fixed flag values */
169 };
170
171 CHECK_dict_new( DICT_COMMAND, &data , app_id16777345, &cmd)
172 }
173 /* Reporting-Information-Answer */
174 {
175 struct dict_object* cmd;
176 struct dict_cmd_data data = {
177 8388719, /* Code */
178 "Reporting-Information-Answer", /* Name */
179 CMD_FLAG_REQUEST, /* Fixed flags */
180 CMD_FLAG_PROXIABLE, /* Fixed flag values */
181 };
182
183 CHECK_dict_new( DICT_COMMAND, &data , app_id16777345, &cmd)
184 }
185 /* NIDD-Information-Request */
186 {
187 struct dict_object* cmd;
188 struct dict_cmd_data data = {
189 8388726, /* Code */
190 "NIDD-Information-Request", /* Name */
191 CMD_FLAG_REQUEST | CMD_FLAG_ERROR, /* Fixed flags */
192 CMD_FLAG_REQUEST | CMD_FLAG_PROXIABLE, /* Fixed flag values */
193 };
194
195 CHECK_dict_new( DICT_COMMAND, &data , app_id16777345, &cmd)
196 }
197 /* NIDD-Information-Answer */
198 {
199 struct dict_object* cmd;
200 struct dict_cmd_data data = {
201 8388726, /* Code */
202 "NIDD-Information-Answer", /* Name */
203 CMD_FLAG_REQUEST, /* Fixed flags */
204 CMD_FLAG_PROXIABLE, /* Fixed flag values */
205 };
206
207 CHECK_dict_new( DICT_COMMAND, &data , app_id16777345, &cmd)
208 }
209
210 }
211
212 return 0;
213}
214
215static int dict_s6t_load_rules(char * conffile)
216{
217 /* Grouped AVP section */
218 {
219
220 }
221
222 /* Commands section */
223 {
224 /* Configuration-Information-Request */
225 {
226 struct dict_object* cmd;
227 CHECK_dict_search( DICT_COMMAND, CMD_BY_NAME, "Configuration-Information-Request", &cmd)
228 struct local_rules_definition rules[] =
229 {
230 { { .avp_vendor = 0, .avp_name = "Session-Id"}, RULE_FIXED_HEAD, -1, -1 },
231 { { .avp_vendor = 0, .avp_name = "DRMP"}, RULE_OPTIONAL, -1, -1 },
232 { { .avp_vendor = 0, .avp_name = "Auth-Session-State"}, RULE_REQUIRED, -1, -1 },
233 { { .avp_vendor = 0, .avp_name = "Origin-Host"}, RULE_REQUIRED, -1, -1 },
234 { { .avp_vendor = 0, .avp_name = "Origin-Realm"}, RULE_REQUIRED, -1, -1 },
235 { { .avp_vendor = 0, .avp_name = "Destination-Host"}, RULE_OPTIONAL, -1, -1 },
236 { { .avp_vendor = 0, .avp_name = "Destination-Realm"}, RULE_REQUIRED, -1, -1 },
237 { { .avp_vendor = 10415, .avp_name = "User-Identifier"}, RULE_REQUIRED, -1, -1 },
238 { { .avp_vendor = 0, .avp_name = "OC-Supported-Features"}, RULE_OPTIONAL, -1, -1 },
239 { { .avp_vendor = 10415, .avp_name = "Supported-Features"}, RULE_OPTIONAL, -1, -1 },
240 { { .avp_vendor = 10415, .avp_name = "Monitoring-Event-Configuration"}, RULE_OPTIONAL, -1, -1 },
241 { { .avp_vendor = 10415, .avp_name = "CIR-Flags"}, RULE_OPTIONAL, -1, -1 },
242 { { .avp_vendor = 10415, .avp_name = "AESE-Communication-Pattern"}, RULE_OPTIONAL, -1, -1 },
243 { { .avp_vendor = 10415, .avp_name = "Enhanced-Coverage-Restriction"}, RULE_OPTIONAL, -1, -1 },
244 { { .avp_vendor = 10415, .avp_name = "Group-Reporting-Guard-Timer"}, RULE_OPTIONAL, -1, -1 },
245 { { .avp_vendor = 0, .avp_name = "Proxy-Info"}, RULE_OPTIONAL, -1, -1 },
246 { { .avp_vendor = 0, .avp_name = "Route-Record"}, RULE_OPTIONAL, -1, -1 }
247 };
248 PARSE_loc_rules(rules, cmd);
249 }
250 /* Configuration-Information-Answer */
251 {
252 struct dict_object* cmd;
253 CHECK_dict_search( DICT_COMMAND, CMD_BY_NAME, "Configuration-Information-Answer", &cmd)
254 struct local_rules_definition rules[] =
255 {
256 { { .avp_vendor = 0, .avp_name = "Session-Id"}, RULE_FIXED_HEAD, -1, -1 },
257 { { .avp_vendor = 0, .avp_name = "DRMP"}, RULE_OPTIONAL, -1, -1 },
258 { { .avp_vendor = 0, .avp_name = "Result-Code"}, RULE_OPTIONAL, -1, -1 },
259 { { .avp_vendor = 0, .avp_name = "Experimental-Result"}, RULE_OPTIONAL, -1, -1 },
260 { { .avp_vendor = 0, .avp_name = "Auth-Session-State"}, RULE_REQUIRED, -1, -1 },
261 { { .avp_vendor = 0, .avp_name = "Origin-Host"}, RULE_REQUIRED, -1, -1 },
262 { { .avp_vendor = 0, .avp_name = "Origin-Realm"}, RULE_REQUIRED, -1, -1 },
263 { { .avp_vendor = 0, .avp_name = "OC-Supported-Features"}, RULE_OPTIONAL, -1, -1 },
264 { { .avp_vendor = 0, .avp_name = "OC-OLR"}, RULE_OPTIONAL, -1, -1 },
265 { { .avp_vendor = 0, .avp_name = "Load"}, RULE_OPTIONAL, -1, -1 },
266 { { .avp_vendor = 10415, .avp_name = "Supported-Features"}, RULE_OPTIONAL, -1, -1 },
267 { { .avp_vendor = 10415, .avp_name = "User-Identifier"}, RULE_OPTIONAL, -1, -1 },
268 { { .avp_vendor = 10415, .avp_name = "Monitoring-Event-Report"}, RULE_OPTIONAL, -1, -1 },
269 { { .avp_vendor = 10415, .avp_name = "Monitoring-Event-Config-Status"}, RULE_OPTIONAL, -1, -1 },
270 { { .avp_vendor = 10415, .avp_name = "AESE-Communication-Pattern-Config-Status"}, RULE_OPTIONAL, -1, -1 },
271 { { .avp_vendor = 10415, .avp_name = "Supported-Services"}, RULE_OPTIONAL, -1, -1 },
272 { { .avp_vendor = 10415, .avp_name = "S6t-HSS-Cause"}, RULE_OPTIONAL, -1, -1 },
273 { { .avp_vendor = 10415, .avp_name = "Enhanced-Coverage-Restriction-Data"}, RULE_OPTIONAL, -1, -1 },
274 { { .avp_vendor = 10415, .avp_name = "CIA-Flags"}, RULE_OPTIONAL, -1, -1 },
275 { { .avp_vendor = 0, .avp_name = "Failed-AVP"}, RULE_OPTIONAL, -1, -1 },
276 { { .avp_vendor = 0, .avp_name = "Proxy-Info"}, RULE_OPTIONAL, -1, -1 },
277 { { .avp_vendor = 0, .avp_name = "Route-Record"}, RULE_OPTIONAL, -1, -1 }
278 };
279 PARSE_loc_rules(rules, cmd);
280 }
281 /* Reporting-Information-Request */
282 {
283 struct dict_object* cmd;
284 CHECK_dict_search( DICT_COMMAND, CMD_BY_NAME, "Reporting-Information-Request", &cmd)
285 struct local_rules_definition rules[] =
286 {
287 { { .avp_vendor = 0, .avp_name = "Session-Id"}, RULE_FIXED_HEAD, -1, -1 },
288 { { .avp_vendor = 0, .avp_name = "DRMP"}, RULE_OPTIONAL, -1, -1 },
289 { { .avp_vendor = 0, .avp_name = "Auth-Session-State"}, RULE_REQUIRED, -1, -1 },
290 { { .avp_vendor = 0, .avp_name = "Origin-Host"}, RULE_REQUIRED, -1, -1 },
291 { { .avp_vendor = 0, .avp_name = "Origin-Realm"}, RULE_REQUIRED, -1, -1 },
292 { { .avp_vendor = 0, .avp_name = "Destination-Host"}, RULE_REQUIRED, -1, -1 },
293 { { .avp_vendor = 0, .avp_name = "Destination-Realm"}, RULE_REQUIRED, -1, -1 },
294 { { .avp_vendor = 10415, .avp_name = "Supported-Features"}, RULE_OPTIONAL, -1, -1 },
295 { { .avp_vendor = 10415, .avp_name = "User-Identifier"}, RULE_OPTIONAL, -1, -1 },
296 { { .avp_vendor = 10415, .avp_name = "Monitoring-Event-Report"}, RULE_OPTIONAL, -1, -1 },
297 { { .avp_vendor = 10415, .avp_name = "Group-Monitoring-Event-Report"}, RULE_OPTIONAL, -1, -1 },
298 { { .avp_vendor = 10415, .avp_name = "RIR-Flags"}, RULE_OPTIONAL, -1, -1 },
299 { { .avp_vendor = 10415, .avp_name = "Supported-Services"}, RULE_OPTIONAL, -1, -1 },
300 { { .avp_vendor = 0, .avp_name = "Proxy-Info"}, RULE_OPTIONAL, -1, -1 },
301 { { .avp_vendor = 0, .avp_name = "Route-Record"}, RULE_OPTIONAL, -1, -1 }
302 };
303 PARSE_loc_rules(rules, cmd);
304 }
305 /* Reporting-Information-Answer */
306 {
307 struct dict_object* cmd;
308 CHECK_dict_search( DICT_COMMAND, CMD_BY_NAME, "Reporting-Information-Answer", &cmd)
309 struct local_rules_definition rules[] =
310 {
311 { { .avp_vendor = 0, .avp_name = "Session-Id"}, RULE_FIXED_HEAD, -1, -1 },
312 { { .avp_vendor = 0, .avp_name = "DRMP"}, RULE_OPTIONAL, -1, -1 },
313 { { .avp_vendor = 0, .avp_name = "Result-Code"}, RULE_OPTIONAL, -1, -1 },
314 { { .avp_vendor = 0, .avp_name = "Experimental-Result"}, RULE_OPTIONAL, -1, -1 },
315 { { .avp_vendor = 0, .avp_name = "Auth-Session-State"}, RULE_REQUIRED, -1, -1 },
316 { { .avp_vendor = 0, .avp_name = "Origin-Host"}, RULE_REQUIRED, -1, -1 },
317 { { .avp_vendor = 0, .avp_name = "Origin-Realm"}, RULE_REQUIRED, -1, -1 },
318 { { .avp_vendor = 10415, .avp_name = "Supported-Features"}, RULE_OPTIONAL, -1, -1 },
319 { { .avp_vendor = 0, .avp_name = "Failed-AVP"}, RULE_OPTIONAL, -1, -1 },
320 { { .avp_vendor = 0, .avp_name = "Proxy-Info"}, RULE_OPTIONAL, -1, -1 },
321 { { .avp_vendor = 0, .avp_name = "Route-Record"}, RULE_OPTIONAL, -1, -1 }
322 };
323 PARSE_loc_rules(rules, cmd);
324 }
325 /* NIDD-Information-Request */
326 {
327 struct dict_object* cmd;
328 CHECK_dict_search( DICT_COMMAND, CMD_BY_NAME, "NIDD-Information-Request", &cmd)
329 struct local_rules_definition rules[] =
330 {
331 { { .avp_vendor = 0, .avp_name = "Session-Id"}, RULE_FIXED_HEAD, -1, -1 },
332 { { .avp_vendor = 0, .avp_name = "DRMP"}, RULE_OPTIONAL, -1, -1 },
333 { { .avp_vendor = 0, .avp_name = "Auth-Session-State"}, RULE_REQUIRED, -1, -1 },
334 { { .avp_vendor = 0, .avp_name = "Origin-Host"}, RULE_REQUIRED, -1, -1 },
335 { { .avp_vendor = 0, .avp_name = "Origin-Realm"}, RULE_REQUIRED, -1, -1 },
336 { { .avp_vendor = 0, .avp_name = "Destination-Host"}, RULE_OPTIONAL, -1, -1 },
337 { { .avp_vendor = 0, .avp_name = "Destination-Realm"}, RULE_REQUIRED, -1, -1 },
338 { { .avp_vendor = 10415, .avp_name = "User-Identifier"}, RULE_REQUIRED, -1, -1 },
339 { { .avp_vendor = 0, .avp_name = "OC-Supported-Features"}, RULE_OPTIONAL, -1, -1 },
340 { { .avp_vendor = 10415, .avp_name = "Supported-Features"}, RULE_OPTIONAL, -1, -1 },
341 { { .avp_vendor = 10415, .avp_name = "NIDD-Authorization-Request"}, RULE_OPTIONAL, -1, -1 },
342 { { .avp_vendor = 10415, .avp_name = "NIDD-Authorization-Update"}, RULE_OPTIONAL, -1, -1 },
343 { { .avp_vendor = 0, .avp_name = "Proxy-Info"}, RULE_OPTIONAL, -1, -1 },
344 { { .avp_vendor = 0, .avp_name = "Route-Record"}, RULE_OPTIONAL, -1, -1 }
345 };
346 PARSE_loc_rules(rules, cmd);
347 }
348 /* NIDD-Information-Answer */
349 {
350 struct dict_object* cmd;
351 CHECK_dict_search( DICT_COMMAND, CMD_BY_NAME, "NIDD-Information-Answer", &cmd)
352 struct local_rules_definition rules[] =
353 {
354 { { .avp_vendor = 0, .avp_name = "Session-Id"}, RULE_FIXED_HEAD, -1, -1 },
355 { { .avp_vendor = 0, .avp_name = "DRMP"}, RULE_OPTIONAL, -1, -1 },
356 { { .avp_vendor = 0, .avp_name = "Result-Code"}, RULE_OPTIONAL, -1, -1 },
357 { { .avp_vendor = 0, .avp_name = "Experimental-Result"}, RULE_OPTIONAL, -1, -1 },
358 { { .avp_vendor = 0, .avp_name = "Auth-Session-State"}, RULE_REQUIRED, -1, -1 },
359 { { .avp_vendor = 0, .avp_name = "Origin-Host"}, RULE_REQUIRED, -1, -1 },
360 { { .avp_vendor = 0, .avp_name = "Origin-Realm"}, RULE_REQUIRED, -1, -1 },
361 { { .avp_vendor = 0, .avp_name = "OC-Supported-Features"}, RULE_OPTIONAL, -1, -1 },
362 { { .avp_vendor = 0, .avp_name = "OC-OLR"}, RULE_OPTIONAL, -1, -1 },
363 { { .avp_vendor = 0, .avp_name = "Load"}, RULE_OPTIONAL, -1, -1 },
364 { { .avp_vendor = 10415, .avp_name = "Supported-Features"}, RULE_OPTIONAL, -1, -1 },
365 { { .avp_vendor = 10415, .avp_name = "User-Identifier"}, RULE_OPTIONAL, -1, -1 },
366 { { .avp_vendor = 10415, .avp_name = "NIDD-Authorization-Response"}, RULE_OPTIONAL, -1, -1 },
367 { { .avp_vendor = 0, .avp_name = "Failed-AVP"}, RULE_OPTIONAL, -1, -1 },
368 { { .avp_vendor = 0, .avp_name = "Proxy-Info"}, RULE_OPTIONAL, -1, -1 },
369 { { .avp_vendor = 0, .avp_name = "Route-Record"}, RULE_OPTIONAL, -1, -1 }
370 };
371 PARSE_loc_rules(rules, cmd);
372 }
373
374 }
375
376 LOG_D( "Extension 'Dictionary definitions for S6t (e10)' initialized");
377 return 0;
378}
379
380int dict_entry(char * conffile)
381{
382 dict_s6t_load_defs(conffile);
383 return dict_s6t_load_rules(conffile);
384}
385
386const char* dict_proto_ver(char * conffile) {
387 return s6t_proto_ver;
388}
389
390const double dict_gen_ts(char * conffile) {
391 return s6t_gen_date;
392}
393
394EXTENSION_ENTRY2("dict_s6t", dict_s6t_load_defs, dict_s6t_load_rules, "dict_ts32299_avps", "dict_ts29336_avps", "dict_ts29272_avps", "dict_ts29338_avps", "dict_ts29368_avps", "dict_ts29329_avps", "dict_ts29229_avps", "dict_ts29217_avps", "dict_ts29173_avps", "dict_rfc5778_avps", "dict_draftload_avps", "dict_rfc7683_avps", "dict_rfc5777_avps", "dict_rfc7944_avps");
395
396
397