MCPcopy Index your code
hub / github.com/3proxy/3proxy / sockmap

Function sockmap

src/sockmap.c:13–273  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11#define BUFSIZE (param->srv->bufsize?param->srv->bufsize:((param->service == S_UDPPM)?UDPBUFSIZE:TCPBUFSIZE))
12
13int sockmap(struct clientparam * param, int timeo){
14 int res=0;
15 uint64_t sent=0, received=0;
16 SASIZETYPE sasize;
17 struct pollfd fds[2];
18 int sleeptime = 0, stop = 0;
19 unsigned minsize;
20 unsigned bufsize;
21 FILTER_ACTION action;
22 int retcode = 0;
23
24 bufsize = BUFSIZE;
25
26 minsize = (param->service == S_UDPPM || param->service == S_TCPPM)? bufsize - 1 : (bufsize>>2);
27
28 fds[0].fd = param->clisock;
29 fds[1].fd = param->remsock;
30
31#if DEBUGLEVEL > 2
32(*param->srv->logfunc)(param, "Starting sockets mapping");
33#endif
34 if(!param->waitclient64){
35 if(!param->srvbuf && (!(param->srvbuf=myalloc(bufsize)) || !(param->srvbufsize = bufsize))){
36 return (21);
37 }
38 }
39 if(!param->waitserver64){
40 if(!param->clibuf && (!(param->clibuf=myalloc(bufsize)) || !(param->clibufsize = bufsize))){
41 return (21);
42 }
43 }
44
45 action = handlepredatflt(param);
46 if(action == HANDLED){
47 return 0;
48 }
49 if(action != PASS) return 19;
50 if(!param->nolongdatfilter){
51 if(param->cliinbuf > param->clioffset){
52 action = handledatfltcli(param, &param->clibuf, (int *)&param->clibufsize, param->clioffset, (int *)&param->cliinbuf);
53 if(action == HANDLED){
54 return 0;
55 }
56 if(action != PASS) return 19;
57 }
58 if(param->srvinbuf > param->srvoffset){
59 action = handledatfltsrv(param, &param->srvbuf, (int *)&param->srvbufsize, param->srvoffset, (int *)&param->srvinbuf);
60 if(action == HANDLED){
61 return 0;
62 }
63 if(action != PASS) return 19;
64 }
65 }
66
67
68
69 while (!stop&&!conf.timetoexit){
70 sasize = sizeof(struct sockaddr_in);

Callers 8

proxychildFunction · 0.85
smtppchildFunction · 0.85
ftpprchildFunction · 0.85
tcppmchildFunction · 0.85
icqprchildFunction · 0.85
socks.cFile · 0.85
udppmchildFunction · 0.85
pop3pchildFunction · 0.85

Calls 5

myallocFunction · 0.85
handlepredatfltFunction · 0.85
handledatfltcliFunction · 0.85
handledatfltsrvFunction · 0.85
socksendtoFunction · 0.85

Tested by

no test coverage detected