/*
   3APA3A simpliest proxy server
   (c) 2002-2003 by ZARAZA <3APA3A@security.nnov.ru>

   please read License Agreement

   $Id: tcppm.c,v 1.1.1.1 2003/07/19 11:18:19 vlad Exp $
*/

#include "proxy.h"

#ifndef PORTMAP
#define PORTMAP
#endif
#define RETURN(xxx) { param->res = xxx; goto CLEANRET; }

#define child tcppmchild

#define SERVICE S_TCPPM

void * child(void * data) {
#define param ((struct clientparam*)data)
 int res;

 param->hostname = param->target;
 param->sins.sin_port = htons(param->targetport);
 param->operation = CONNECT;
 res = (*param->authfunc)(param);
 param->hostname = NULL;
 if(res) {RETURN(res);}
 RETURN (sockmap(param, timeouts[CONNECTION_L]));
CLEANRET:
 
 (*param->logfunc)(param, NULL);
 freeparam(param);
 return (NULL);
}

#ifdef WITHMAIN
#include "proxymain.c"
#endif
