MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / aaa_parse_url

Function aaa_parse_url

aaa/aaa.c:30–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28#include "../ut.h"
29
30int aaa_parse_url(str* aaa_url, aaa_prot_config* aaa_config) {
31
32 char* p;
33 int len;
34
35 if (!aaa_url || !aaa_config) {
36 LM_ERR("null arguments\n");
37 return -1;
38 }
39
40 p = q_memchr(aaa_url->s, ':', aaa_url->len);
41
42 if (!p) {
43 LM_ERR("invalid aaa url\n");
44 return -1;
45 }
46
47 len = p - aaa_url->s;
48
49 aaa_config->prot_name = (str*) pkg_malloc (sizeof(str));
50 if (!aaa_config->prot_name) {
51 LM_ERR("no pkg memory left\n");
52 return -1;
53 }
54
55 aaa_config->prot_name->s = (char*) pkg_malloc (len * sizeof(char));
56 if (!aaa_config->prot_name->s) {
57 LM_ERR("no pkg memory left\n");
58 return -1;
59 }
60
61 aaa_config->prot_name->len = len;
62 aaa_config->rest = p + 1;
63
64 strncpy(aaa_config->prot_name->s, aaa_url->s, len);
65
66 return 0;
67}
68
69
70int aaa_prot_bind(str* aaa_url, aaa_prot* prot) {

Callers 3

dm_init_protFunction · 0.85
rad_init_protFunction · 0.85
aaa_prot_bindFunction · 0.85

Calls 1

q_memchrFunction · 0.85

Tested by

no test coverage detected