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

Function fixup_f_send_sock

core_cmds.c:529–570  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

527}
528
529static int fixup_f_send_sock(void** param)
530{
531 str *s = (str*)*param;
532 str host, host_nt;
533 int proto=PROTO_NONE, port;
534 struct hostent* he;
535 const struct socket_info* si;
536 struct ip_addr ip;
537
538 if (parse_phostport(s->s, s->len, &host.s, &host.len, &port, &proto) != 0) {
539 LM_ERR("Failed to parse socket\n");
540 return E_CFG;
541 }
542 if (pkg_nt_str_dup(&host_nt, &host) < 0) {
543 LM_ERR("oom\n");
544 return E_OUT_OF_MEM;
545 }
546
547 he=resolvehost(host_nt.s,0);
548 if (he==0){
549 LM_ERR(" could not resolve %s\n", host_nt.s);
550 goto error;
551 }
552 hostent2ip_addr(&ip, he, 0);
553 si=find_si(&ip, port, proto);
554 if (si==0){
555 LM_ERR("bad force_send_socket"
556 " argument: %s:%d (opensips doesn't listen on it)\n",
557 host_nt.s, port);
558 goto error;
559 }
560
561 pkg_free(host_nt.s);
562
563 const void **_param = (const void **)param;
564 *_param = si;
565 return 0;
566
567error:
568 pkg_free(host_nt.s);
569 return E_BAD_ADDRESS;
570}
571
572static int fixup_bond_sock(void** param)
573{

Callers

nothing calls this directly

Calls 4

parse_phostportFunction · 0.85
resolvehostFunction · 0.85
find_siFunction · 0.85
pkg_nt_str_dupFunction · 0.70

Tested by

no test coverage detected