MCPcopy Create free account
hub / github.com/3proxy/3proxy / parsehost

Function parsehost

src/common.c:234–253  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

232#endif
233
234int parsehost(int family, unsigned char *host, struct sockaddr *sa){
235 char *sp=NULL,*se=NULL;
236 unsigned short port=0;
237 int ret = 0;
238
239 if(!host) return 2;
240 if(*host == '[') se=strchr((char *)host, ']');
241 if ( (sp = strchr(se?se:(char *)host, ':')) && !strchr(sp+1, ':')) *sp = 0;
242 if(se){
243 *se = 0;
244 }
245 if(sp){
246 port = atoi(sp+1);
247 }
248 ret = !getip46(family, host + (se!=0), (struct sockaddr *)sa);
249 if(se) *se = ']';
250 if(sp) *sp = ':';
251 if(port)*SAPORT(sa) = htons(port);
252 return ret;
253}
254
255int parsehostname(char *hostname, struct clientparam *param, unsigned short port){
256 char *sp=NULL,*se=NULL;

Callers 3

proxymain.cFile · 0.85
h_nserverFunction · 0.85
h_authnserverFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected