* Initialize UAC */
| 82 | * Initialize UAC |
| 83 | */ |
| 84 | int uac_init(void) |
| 85 | { |
| 86 | str src[3]; |
| 87 | const struct socket_info *si; |
| 88 | |
| 89 | if (RAND_MAX < TM_TABLE_ENTRIES) { |
| 90 | LM_WARN("uac does not spread across the whole hash table\n"); |
| 91 | } |
| 92 | /* on tcp/tls bind_address is 0 so try to get the first address we listen |
| 93 | * on no matter the protocol */ |
| 94 | si=bind_address?bind_address:get_first_socket(); |
| 95 | if (si==0){ |
| 96 | LM_CRIT("null socket list\n"); |
| 97 | return -1; |
| 98 | } |
| 99 | |
| 100 | /* calculate the initial From tag */ |
| 101 | src[0].s = "Long live SER server"; |
| 102 | src[0].len = strlen(src[0].s); |
| 103 | src[1].s = si->address_str.s; |
| 104 | src[1].len = strlen(src[1].s); |
| 105 | src[2].s = si->port_no_str.s; |
| 106 | src[2].len = strlen(src[2].s); |
| 107 | |
| 108 | MD5StringArray(from_tag, src, 3); |
| 109 | from_tag[MD5_LEN] = '-'; |
| 110 | return 1; |
| 111 | } |
| 112 | |
| 113 | |
| 114 | /* |
no test coverage detected