| 870 | } |
| 871 | |
| 872 | static int mod_init(void) |
| 873 | { |
| 874 | tlist_elem_p it; |
| 875 | |
| 876 | date_column.len = strlen(date_column.s); |
| 877 | callid_column.len = strlen(callid_column.s); |
| 878 | trace_attrs_column.len = strlen(trace_attrs_column.s); |
| 879 | msg_column.len = strlen(msg_column.s); |
| 880 | method_column.len = strlen(method_column.s); |
| 881 | status_column.len = strlen(status_column.s); |
| 882 | fromproto_column.len = strlen(fromproto_column.s); |
| 883 | fromip_column.len = strlen(fromip_column.s); |
| 884 | fromport_column.len = strlen(fromport_column.s); |
| 885 | toproto_column.len = strlen(toproto_column.s); |
| 886 | toip_column.len = strlen(toip_column.s); |
| 887 | toport_column.len = strlen(toport_column.s); |
| 888 | fromtag_column.len = strlen(fromtag_column.s); |
| 889 | direction_column.len = strlen(direction_column.s); |
| 890 | |
| 891 | if (trace_local_ip.s) |
| 892 | parse_trace_local_ip(); |
| 893 | |
| 894 | if (trace_default_syslog_facility < 0) |
| 895 | trace_default_syslog_facility = log_facility; |
| 896 | if (trace_default_syslog_level != 0) |
| 897 | trace_default_syslog_level = *log_level; |
| 898 | |
| 899 | LM_INFO("initializing...\n"); |
| 900 | |
| 901 | trace_on_flag = (int*)shm_malloc(sizeof(int)); |
| 902 | if(trace_on_flag==NULL) |
| 903 | { |
| 904 | LM_ERR("no more shm memory left\n"); |
| 905 | return -1; |
| 906 | } |
| 907 | |
| 908 | if (init_dyn_tracing() < 0) { |
| 909 | LM_ERR("could not initiate dynamic tracing!\n"); |
| 910 | return -1; |
| 911 | } |
| 912 | |
| 913 | *trace_on_flag = trace_on; |
| 914 | |
| 915 | /* best effort - try to load any tracing protocol, if possible */ |
| 916 | if (trace_prot_bind(TRACE_PROTO, &tprot) != 0) |
| 917 | LM_DBG("failed to load a tracing protocol API\n"); |
| 918 | |
| 919 | /* initialize the trace IDs */ |
| 920 | for (it=trace_list;it;it=it->next) { |
| 921 | |
| 922 | switch (it->type) { |
| 923 | |
| 924 | case TYPE_HEP: |
| 925 | |
| 926 | if (tprot.get_trace_dest_by_name == NULL) { |
| 927 | LM_ERR("NO tracing protocol specified!\n"); |
| 928 | return -1; |
| 929 | } |
nothing calls this directly
no test coverage detected