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

Function get_msg_branch_field

pvar.c:2163–2210  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2161/******* MSG Branch stuff *******/
2162
2163static inline int get_msg_branch_field( struct sip_msg *msg, int idx,
2164 int field_id, pv_value_t *res)
2165{
2166 if (idx==0) {
2167 /* this is the RURI branch */
2168 switch (field_id) {
2169 case 0:
2170 case BR_URI_ID: /* return URI */
2171 res->rs = *GET_RURI(msg);
2172 res->flags = PV_VAL_STR;
2173 break;
2174 case BR_Q_ID: /* return Q */
2175 res->rs.s = q2str(msg->ruri_q, (unsigned int*)&res->rs.len);
2176 res->flags = PV_VAL_STR;
2177 break;
2178 case BR_DURI_ID: /* return DURI */
2179 if ( ZSTR(msg->dst_uri) )
2180 return pv_get_null(NULL, NULL, res);
2181 res->rs = msg->dst_uri;
2182 res->flags = PV_VAL_STR;
2183 break;
2184 case BR_PATH_ID: /* return PATH */
2185 if ( ZSTR(msg->path_vec) )
2186 return pv_get_null(NULL, NULL, res);
2187 res->rs = msg->path_vec;
2188 res->flags = PV_VAL_STR;
2189 break;
2190 case BR_FLAGS_ID: /* return FLAGS */
2191 res->rs = bitmask_to_flag_list(FLAG_TYPE_BRANCH,
2192 msg->ruri_bflags);
2193 res->flags = PV_VAL_STR;
2194 break;
2195 case BR_SOCKET_ID: /* return SOCKET */
2196 if ( msg->force_send_socket==NULL )
2197 return pv_get_null(NULL, NULL, res);
2198 res->rs = msg->force_send_socket->sock_str;
2199 res->flags = PV_VAL_STR;
2200 break;
2201 default:
2202 LM_CRIT("BUG - unsupported ID %d\n",field_id);
2203 return pv_get_null(NULL, NULL, res);
2204 }
2205 return 0;
2206 } else {
2207 /* translate this to idx into the additional msg branches */
2208 return get_branch_field( idx-1, field_id, res);
2209 }
2210}
2211
2212static int pv_get_msg_branch_fields(struct sip_msg *msg, pv_param_t *param,
2213 pv_value_t *res, int field)

Callers 1

pv_get_msg_branch_fieldsFunction · 0.85

Calls 4

q2strFunction · 0.85
pv_get_nullFunction · 0.85
bitmask_to_flag_listFunction · 0.85
get_branch_fieldFunction · 0.85

Tested by

no test coverage detected