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

Function parse_qop_value

parser/parse_authenticate.c:99–154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97}
98
99int parse_qop_value(str val, struct authenticate_body *auth)
100{
101
102 /* parse first token */
103 if (!STR_ADVANCE_IF_STARTS(&val, "auth"))
104 return -1;
105 if (val.len == 0) {
106 auth->flags |= QOP_AUTH;
107 return 0;
108 }
109 switch (*val.s) {
110 case ' ':
111 case '\t':
112 STR_ADVANCE(&val);
113 auth->flags |= QOP_AUTH;
114 break;
115 case '-':
116 STR_ADVANCE(&val);
117 if (STR_ADVANCE_IF_STARTS(&val, "int")) {
118 auth->flags |= QOP_AUTH_INT;
119 } else
120 return -1;
121 break;
122 case ',':
123 auth->flags |= QOP_AUTH;
124 goto postcomma;
125 default:
126 return -1;
127 }
128
129 if (val.len == 0)
130 return 0;
131
132 trim_leading(&val);
133
134 if (val.len == 0)
135 return 0;
136 if (*val.s != ',')
137 return -1;
138postcomma:
139 STR_ADVANCE(&val);
140 trim_leading(&val);
141
142 /* parse second token */
143 if (!STR_ADVANCE_IF_STARTS(&val, "auth"))
144 return -1;
145 if (val.len == 0) {
146 auth->flags |= QOP_AUTH;
147 return 0;
148 }
149 if (TRB_STRCASEMATCH(&val, "-int")) {
150 auth->flags |= QOP_AUTH_INT;
151 return 0;
152 } else
153 return -1;
154}
155
156int parse_authenticate_body( str body, struct authenticate_body *auth)

Callers 3

parse_authenticate_bodyFunction · 0.85
test_parse_qop_valFunction · 0.85
test_parse_qop_oobFunction · 0.85

Calls 1

trim_leadingFunction · 0.85

Tested by 2

test_parse_qop_valFunction · 0.68
test_parse_qop_oobFunction · 0.68