* Child initialization -- generates suffix */
| 100 | * Child initialization -- generates suffix |
| 101 | */ |
| 102 | int child_init_callid(int rank) |
| 103 | { |
| 104 | const struct socket_info *si; |
| 105 | |
| 106 | /* on tcp/tls bind_address is 0 so try to get the first address we listen |
| 107 | * on no matter the protocol */ |
| 108 | si=bind_address?bind_address:get_first_socket(); |
| 109 | if (si==0){ |
| 110 | LM_CRIT("null socket list\n"); |
| 111 | return -1; |
| 112 | } |
| 113 | callid_suffix.s = callid_buf + callid_prefix.len; |
| 114 | |
| 115 | callid_suffix.len = snprintf(callid_suffix.s, CALLID_SUFFIX_LEN, |
| 116 | "%c%d@%.*s", CID_SEP, my_pid(), |
| 117 | si->address_str.len, |
| 118 | si->address_str.s); |
| 119 | if ((callid_suffix.len == -1) || (callid_suffix.len > CALLID_SUFFIX_LEN)) { |
| 120 | LM_ERR("buffer too small\n"); |
| 121 | return -1; |
| 122 | } |
| 123 | |
| 124 | LM_DBG("callid: '%.*s'\n", callid_prefix.len + callid_suffix.len, callid_prefix.s); |
| 125 | return 0; |
| 126 | } |
| 127 | |
| 128 | |
| 129 | /* |
no test coverage detected