* Module initialization function */
| 154 | * Module initialization function |
| 155 | */ |
| 156 | static int mod_init(void) |
| 157 | { |
| 158 | bind_auth_t bind_auth; |
| 159 | str proto_url; |
| 160 | |
| 161 | aaa_map vendor; |
| 162 | |
| 163 | LM_INFO("initializing...\n"); |
| 164 | |
| 165 | memset(attrs, 0, sizeof(attrs)); |
| 166 | memset(vals, 0, sizeof(vals)); |
| 167 | attrs[A_SERVICE_TYPE].name = "Service-Type"; |
| 168 | attrs[A_SIP_URI_USER].name = "Sip-Uri-User"; |
| 169 | attrs[A_SIP_URI_HOST].name = "Sip-Uri-Host"; |
| 170 | attrs[A_DIGEST_RESPONSE].name = "Digest-Response"; |
| 171 | attrs[A_DIGEST_ALGORITHM].name = "Digest-Algorithm"; |
| 172 | attrs[A_DIGEST_OPAQUE].name = "Digest-Opaque"; |
| 173 | attrs[A_DIGEST_CNONCE].name = "Digest-CNonce"; |
| 174 | attrs[A_DIGEST_NONCE_COUNT].name = "Digest-Nonce-Count"; |
| 175 | attrs[A_DIGEST_QOP].name = digest_qop_name; |
| 176 | attrs[A_DIGEST_METHOD].name = "Digest-Method"; |
| 177 | attrs[A_DIGEST_URI].name = "Digest-URI"; |
| 178 | attrs[A_DIGEST_NONCE].name = "Digest-Nonce"; |
| 179 | attrs[A_DIGEST_REALM].name = "Digest-Realm"; |
| 180 | attrs[A_DIGEST_USER_NAME].name = "Digest-Username"; |
| 181 | attrs[A_USER_NAME].name = "User-Name"; |
| 182 | attrs[A_CISCO_AVPAIR].name = "Cisco-AVPair"; |
| 183 | attrs[A_SIP_AVP].name = "SIP-AVP"; |
| 184 | attrs[A_ACCT_SESSION_ID].name = "Acct-Session-Id"; |
| 185 | vals[V_SIP_SESSION].name = "Sip-Session"; |
| 186 | vals[V_CALL_CHECK].name = "Call-Check"; |
| 187 | |
| 188 | use_ruri_flag = get_flag_id_by_name(FLAG_TYPE_MSG, use_ruri_flag_str, 0); |
| 189 | |
| 190 | if (!aaa_proto_url) { |
| 191 | LM_ERR("aaa_url is empty\n"); |
| 192 | return -1; |
| 193 | } |
| 194 | |
| 195 | proto_url.s = aaa_proto_url; |
| 196 | proto_url.len = strlen(aaa_proto_url); |
| 197 | |
| 198 | if(aaa_prot_bind(&proto_url, &proto)) { |
| 199 | LM_ERR("aaa protocol bind failure\n"); |
| 200 | return -1; |
| 201 | } |
| 202 | |
| 203 | if (!(conn = proto.init_prot(&proto_url))) { |
| 204 | LM_ERR("aaa init protocol failure\n"); |
| 205 | return -2; |
| 206 | } |
| 207 | |
| 208 | vendor.name = "Cisco"; |
| 209 | if (proto.dictionary_find(conn, &vendor, AAA_DICT_FIND_VEND)) { |
| 210 | LM_DBG("no `Cisco' vendor in AAA protocol dictionary\n"); |
| 211 | attrs[A_CISCO_AVPAIR].name = NULL; |
| 212 | } else { |
| 213 | attrs[A_CISCO_AVPAIR].type = vendor.value; |
nothing calls this directly
no test coverage detected