/* Module: main.c Purpose: Main commandline dispatcher for imo.im Skypeproxy Author: leecher Date: 07.11.2009 */ #include #include #include "imo2sproxy.h" #include "socksproxy.h" #ifdef WIN32 #include "w32skypeemu.h" #define WIN32_LEAN_AND_MEAN #include #include #define Daemonize FreeConsole() #ifdef _DEBUG #define LOG(_args_) printf _args_ #ifndef _WIN64 #include "crash.c" #endif #endif #else #define Daemonize daemon(0, 0) #endif // ----------------------------------------------------------------------------- // EIP // ----------------------------------------------------------------------------- int main(int argc, char **argv) { int i, j=0, bDaemon = 0; char cMode='s'; IMO2SPROXY_CFG stCfg; SOCKSPROXY_CFG stSocksCfg; #ifdef WIN32 W32SKYPEEMU_CFG stSypeEmuCfg; #endif IMO2SPROXY *pProxy; #ifdef _DEBUG Crash_Init(); #endif Imo2sproxy_Defaults (&stCfg); SocksProxy_Defaults (&stSocksCfg); #ifdef WIN32 W32SkypeEmu_Defaults(&stSypeEmuCfg); #endif if (argc<3) { printf ("imo.im Skypeproxy V1.15 - (c) by leecher 2009-2012\n\n" "%s [-d] [-v [-l ]] [-t] [-i]\n" "[-m] [-h ] [-p ] \n\n" "-d\t- Daemonize (detach from console)\n" "-v\t- Verbose mode, log commands to console\n" "-l\t- Set logfile to redirect verbose log to.\n" "-t\t- Ignore server timestamp and use current time for messages\n" "-i\t- Use interactive mode (starts imo.im flash app upon call)\n" "-m\t- Specify connection mode to use:\n" "\t\ts\tSocket mode (SkypeProxy protocol) [default]\n" #ifdef WIN32 "\t\ta\tSkype API Emulation via Window messages (real Skype API)\n" #endif "\tParameters for socket mode:\n" "-h\t- Bind to a specific IP, not to all interfaces (default)\n" "-p\t- Bind to another port (default: 1401)\n" "Default: Bind to any interface, Use Port %d\n", argv[0], stSocksCfg.sPort); return EXIT_FAILURE; } for (i=1; iOpen(pProxy) == 0) pProxy->Loop(pProxy); pProxy->Exit(pProxy); if (stCfg.fpLog && stCfg.fpLog != stdout && stCfg.fpLog != stderr) { fclose(stCfg.fpLog); stCfg.fpLog = NULL; } return EXIT_SUCCESS; }