comparison extensions/dict_dcca_3gpp/dict_dcca_3gpp.c @ 1436:ad50ef2eddea

dbg_dict_dump: new extension to dump dictionary when loaded Add extension dbg_dict_dump to log the dictionary when loaded. Remove debug code in extension dict_dcca_3gpp to log the vendor dictionary if the config file is the word "dumpdict" that I added on 2020-02-19.
author Luke Mewburn <luke@mewburn.net>
date Tue, 25 Feb 2020 09:45:15 +1100
parents 4bd30996ad7f
children d6469b0f2111
comparison
equal deleted inserted replaced
1435:4bd30996ad7f 1436:ad50ef2eddea
142 { _str_, { .os = { .data = (unsigned char *)_val_, .len = _len_ }}} 142 { _str_, { .os = { .data = (unsigned char *)_val_, .len = _len_ }}}
143 143
144 144
145 static int dict_dcca_3gpp_entry(char * conffile) 145 static int dict_dcca_3gpp_entry(char * conffile)
146 { 146 {
147 struct dict_object * vendor = NULL;
148
149 /* Applications section */ 147 /* Applications section */
150 { 148 {
151 /* Create the vendors */ 149 /* Create the vendors */
152 { 150 {
153 struct dict_vendor_data vendor_data = { 10415, "3GPP" }; 151 struct dict_vendor_data vendor_data = { 10415, "3GPP" };
154 CHECK_FCT(fd_dict_new(fd_g_config->cnf_dict, DICT_VENDOR, &vendor_data, NULL, &vendor)); 152 CHECK_FCT(fd_dict_new(fd_g_config->cnf_dict, DICT_VENDOR, &vendor_data, NULL, NULL));
155 } 153 }
156 { 154 {
157 struct dict_vendor_data vendor_data = { 5535, "3GPP2" }; 155 struct dict_vendor_data vendor_data = { 5535, "3GPP2" };
158 CHECK_FCT(fd_dict_new(fd_g_config->cnf_dict, DICT_VENDOR, &vendor_data, NULL, NULL)); 156 CHECK_FCT(fd_dict_new(fd_g_config->cnf_dict, DICT_VENDOR, &vendor_data, NULL, NULL));
159 } 157 }
10896 { { .avp_vendor = 10415, .avp_name = "Delivery-Status" }, RULE_OPTIONAL, -1, 1 }, 10894 { { .avp_vendor = 10415, .avp_name = "Delivery-Status" }, RULE_OPTIONAL, -1, 1 },
10897 }; 10895 };
10898 PARSE_loc_rules(rules, rule_avp); 10896 PARSE_loc_rules(rules, rule_avp);
10899 } 10897 }
10900 10898
10901 if (conffile && (0 == strcmp(conffile, "dumpdict"))) {
10902 char * tbuf = NULL; size_t tbuflen = 0;
10903 LOG_D("dict_dcca_3gpp dictionary: %s", fd_dict_dump_object(&tbuf, &tbuflen, NULL, vendor));
10904 free(tbuf);
10905 }
10906
10907 LOG_D( "Extension 'Dictionary definitions for DCCA 3GPP' initialized"); 10899 LOG_D( "Extension 'Dictionary definitions for DCCA 3GPP' initialized");
10908 return 0; 10900 return 0;
10909 } 10901 }
10910 10902
10911 EXTENSION_ENTRY("dict_dcca_3gpp", dict_dcca_3gpp_entry, "dict_dcca"); 10903 EXTENSION_ENTRY("dict_dcca_3gpp", dict_dcca_3gpp_entry, "dict_dcca");
"Welcome to our mercurial repository"