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

Function add_dst

modules/drouting/routing.c:544–748  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

542}
543
544int
545add_dst(
546 rt_data_t *r,
547 /* id */
548 char *id,
549 /* ip address */
550 char* ip,
551 /* strip len */
552 int strip,
553 /* pri prefix */
554 char* pri,
555 /* dst type*/
556 int type,
557 /* dst attrs*/
558 char* attrs,
559 /* probe_mode */
560 int probing,
561 /* socket */
562 const struct socket_info *sock,
563 /* state */
564 int state,
565 osips_malloc_f mf,
566 osips_free_f ff,
567 MD5_CTX* hash_ctx
568 )
569{
570 static unsigned id_counter = 0;
571 pgw_t *pgw=NULL;
572 struct sip_uri uri;
573 int l_ip,l_pri,l_attrs,l_id;
574#define GWABUF_MAX_SIZE 512
575 char gwabuf[GWABUF_MAX_SIZE];
576 char *p;
577 union sockaddr_union sau;
578 struct proxy_l *proxy;
579 unsigned int sip_prefix;
580 str gwas;
581 str key;
582
583 if (NULL==r || NULL==ip) {
584 LM_ERR("invalid parametres\n");
585 goto err_exit;
586 }
587
588 l_id = strlen(id);
589 l_ip = strlen(ip);
590 l_pri = pri?strlen(pri):0;
591 l_attrs = attrs?strlen(attrs):0;
592
593 /* check the ID of the gateway */
594 for (p = id + l_id - 1; p >= id; p--)
595 if (!is_valid_gw_char(*p)) {
596 LM_ERR("invalid char in gateway's name [%c]\n", *p);
597 goto err_exit;
598 }
599
600 /* check if GW address starts with 'sip' or 'sips' */
601 if (l_ip>5) {

Callers 1

dr_load_routing_infoFunction · 0.85

Calls 8

parse_uriFunction · 0.85
mk_proxyFunction · 0.85
ip_addr2aFunction · 0.85
get_next_suFunction · 0.85
su2ip_addrFunction · 0.85
free_proxyFunction · 0.85
map_putFunction · 0.85
hash_dstFunction · 0.85

Tested by

no test coverage detected