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

Function grep_aliases

name_alias.h:88–113  ·  view source on GitHub ↗

returns 1 if name is in the alias list; if port=0, port no is ignored * if proto=0, proto is ignored*/

Source from the content-addressed store, hash-verified

86/* returns 1 if name is in the alias list; if port=0, port no is ignored
87 * if proto=0, proto is ignored*/
88static inline int grep_aliases(char* name, int len, unsigned short port,
89 unsigned short proto)
90{
91 struct host_alias* a;
92 struct alias_function *af;
93
94 if ((len>2)&&((*name)=='[')&&(name[len-1]==']')){
95 /* ipv6 reference, skip [] */
96 name++;
97 len-=2;
98 }
99
100 for(a=aliases;a;a=a->next) {
101 if (((a->port==0) || (port==0) || (a->port==port)) &&
102 ((a->proto==0) || (proto==0) || (a->proto==proto))) {
103 if (match_domain(a->alias.s, a->alias.len, name, len, a->accept_subdomain))
104 return 1;
105 }
106 }
107
108 for( af=alias_fcts ; af ; af=af->next ) {
109 if ( af->alias_f(name,len,port,proto)>0 )
110 return 1;
111 }
112 return 0;
113}
114
115/* adds an alias to the list (only if it isn't already there) */
116int add_alias(char* name, int len, unsigned short port, unsigned short proto, int accept_subdomain);

Callers 2

add_aliasFunction · 0.85
check_selfFunction · 0.85

Calls 1

match_domainFunction · 0.85

Tested by

no test coverage detected