Changeset 1458:c25dea477d6a in freeDiameter
- Timestamp:
- Feb 28, 2020, 9:22:07 AM (4 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/dbg_dict_dump/dbg_dict_dump.c
r1436 r1458 34 34 *********************************************************************************************************/ 35 35 36 /* This extension logs a dump of the global dictionary */ 36 /* 37 * Dump Diameter dictionary (using fd_dict_dump()) to a file or the log. 38 * 39 * If conffile is provided, write the dump to that file, 40 * otherwise write to log. 41 */ 37 42 38 43 #include <freeDiameter/extension.h> … … 42 47 TRACE_ENTRY("%p", conffile); 43 48 49 FILE * out = NULL; 50 if (conffile) { 51 LOG_N("Dictionary dump to file '%s'", conffile); 52 out = fopen(conffile, "w"); 53 if (NULL == out) { 54 LOG_E("Cannot open output file '%s' for writing", conffile); 55 return EINVAL; 56 } 57 } else { 58 LOG_N("Dictionary dump to log"); 59 } 60 44 61 char * tbuf = NULL; size_t tbuflen = 0; 45 LOG_N("Dumping dictionary information"); 46 LOG_N("%s", fd_dict_dump(&tbuf, &tbuflen, NULL, fd_g_config->cnf_dict)); 62 if (NULL == fd_dict_dump(&tbuf, &tbuflen, NULL, fd_g_config->cnf_dict)) { 63 LOG_E("Cannot dump dictionary"); 64 } else if (out) { 65 fprintf(out, "%s\n", tbuf); 66 } else { 67 LOG_N("%s", fd_dict_dump(&tbuf, &tbuflen, NULL, fd_g_config->cnf_dict)); 68 } 47 69 free(tbuf); 70 if (out) { 71 fclose(out); 72 out = NULL; 73 } 48 74 49 LOG_N("Dictionary dumped"); 50 75 LOG_N("Dictionary dump completed"); 51 76 return 0; 52 77 }
Note: See TracChangeset
for help on using the changeset viewer.