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

Function send_rtpp_command

modules/rtpproxy/rtpproxy.c:2173–2371  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2171#define OSIP_IOV_MAX 1024
2172
2173char *
2174send_rtpp_command(struct rtpp_node *node, struct rtpproxy_vcmd *vcmd, int vcnt)
2175{
2176 struct sockaddr_un addr;
2177 int fd, len, i;
2178 int max_vcnt=OSIP_IOV_MAX;
2179 char *cp;
2180 static char buf[RTPPROXY_BUF_SIZE];
2181 struct pollfd fds[1];
2182
2183 DASSERT(vcnt <= vcmd->useritems);
2184 DASSERT(vcmd->vu == vcmd->vs + 1);
2185
2186#ifdef IOV_MAX
2187 if (IOV_MAX < OSIP_IOV_MAX)
2188 max_vcnt = IOV_MAX;
2189#endif
2190
2191 if (rtpp_socks[node->idx].fd == -1 && node->rn_umode != CM_UNIX &&
2192 node->rn_umode != CM_RTPIO) {
2193 rtpp_socks[node->idx].fd = connect_rtpp_node(node);
2194 if (rtpp_socks[node->idx].fd == -1) {
2195 LM_ERR("connect_rtpp_node() failed\n");
2196 return (NULL);
2197 }
2198 }
2199 /* normalize vcntl to max_vcnt, as on some systems this limit is very low (16 on Solaris) */
2200 if (vcnt + 1 > max_vcnt) {
2201 int i, vec_len = 0;
2202 /* use buf if possible :) */
2203 for (i = max_vcnt - 1; i < (vcnt + 1); i++)
2204 vec_len += vcmd->vs[i].iov_len;
2205 /* use buf, error otherwise */
2206 if (vec_len > RTPPROXY_BUF_SIZE) {
2207 LM_ERR("Command too big %d - max %d\n", vec_len, RTPPROXY_BUF_SIZE);
2208 return NULL;
2209 }
2210 cp = buf;
2211 for (i = max_vcnt - 1; i < (vcnt + 1); i++) {
2212 memcpy(cp, vcmd->vs[i].iov_base, vcmd->vs[i].iov_len);
2213 cp += vcmd->vs[i].iov_len;
2214 }
2215 i = max_vcnt - 1;
2216 vcmd->vs[i].iov_len = vec_len;
2217 vcmd->vs[i].iov_base = buf;
2218 /* finally solve the problem */
2219 vcnt = max_vcnt;
2220
2221 }
2222
2223 len = 0;
2224 cp = buf;
2225
2226 if (node->rn_umode == CM_UNIX) {
2227 int s_errno, nretry;
2228
2229 nretry = 1;
2230 memset(&addr, 0, sizeof(addr));

Callers 10

rtpproxy_streamFunction · 0.85
rtpproxy_stop_streamFunction · 0.85
rtpp_checkcapFunction · 0.85
rtpp_testFunction · 0.85
unforce_rtpproxyFunction · 0.85
rtpproxy_offer_answerFunction · 0.85
rtpproxy_stats_fFunction · 0.85
rtpproxy_all_stats_fFunction · 0.85
w_rtpproxy_recordingFunction · 0.85

Calls 4

connect_rtpp_nodeFunction · 0.85
get_ticksFunction · 0.85
raise_rtpproxy_eventFunction · 0.85
gencookieFunction · 0.70

Tested by

no test coverage detected