void ICACHE_FLASH_ATTR TCP_recv_callback (void *arg,char *pdata,unsigned short len){ process_form(pdata,len,arg); os_delay_us(5000); espconn_disconnect((struct espconn *)arg); }
int protocol_arachne(struct HTTPrecord *cacheitem,struct Url *url,int *returnvalue) { char *value; #ifndef NOTCPIP #ifndef CLEMTEST if(!strncmpi(url->file,"ftp-",4)) { char back=1; if(!strncmpi(&(url->file[4]),"send",4)) back=0; strcpy(url->user,configvariable(&ARACHNEcfg,"FTPusername",NULL)); strcpy(url->password,configvariable(&ARACHNEcfg,"FTPpassword",NULL)); strcpy(url->host,configvariable(&ARACHNEcfg,"FTPserver",NULL)); strcpy(url->file,configvariable(&ARACHNEcfg,"FTPpath",NULL)); url->port=21; if(tcpip) ftpsession(url,cacheitem,LASTlocname); if(!GLOBAL.gotolocation) { if(back) goback(); else strcpy(GLOBAL.location,p->htmlframe[p->activeframe].cacheitem.URL); arachne.target=p->activeframe; } GLOBAL.reload=0; GLOBAL.postdata=0; return GOTO_IVEGOTNEWURL; } #endif #endif #ifndef POSIX if(!strcmpi(url->file,"restart")) { char buf[IE_MAXLEN]; char *ptr=getenv("ASETUP"); if(ptr && !strcmp(ptr,"inst")) //special case - "Finish Setup" button return GOTO_USEREND; arachne.target=0; //!!! strcpy(buf,"@arachne"); if(tcpip) strcat(buf," -o\n"); else strcat(buf,"\n"); unlink("lock"); *returnvalue=willexecute(buf); return GOTO_END; } else #endif ///!!!! ///POSIX restart: TerminateArachne + exec.. (argv[0],argv[0],NULL) ! #ifndef NOTCPIP if(!strcmpi(url->file,"dialpage")) { value=configvariable(&ARACHNEcfg,"DialPage",NULL); //!!glennmcc: Begin Feb 06, 2005 -- default to ppp_init.htm //if 'DialPage' is missing from arachne.cfg if(!value) value="file:ppp_init.htm"; //also use ppp_init.htm if DialPage does not begin with file:ppp //indicating that it has been changed from one of the 4 included dialpages //which are... ppp_init.htm, pppenhan.htm, pppframe.htm or ppp_fast.htm //value=strlwr(value); if(!strstr(value,"file:ppp")) value="file:ppp_init.htm"; //!!glennmcc: end if(value) { strcpy(GLOBAL.location,value); AnalyseURL(GLOBAL.location,url,IGNORE_PARENT_FRAME); } } else #ifndef CLEMTEST if(!strcmpi(url->file,"dialer")) { *returnvalue=willexecute(ArachneDIAL()); return GOTO_END; } else if(!strcmpi(url->file,"hangup")) { char buf[IE_MAXLEN]; arachne.target=0; //!!! outs(MSG_HANGUP); if(reg && tcpip) PPPtimelog(); process_form(0,IE_NULL); //updateovat Arachne.Cfg sprintf(buf,"%s\nif exist PPP.LOG del PPP.LOG\n",configvariable(&ARACHNEcfg,"Hangup",NULL)); value=configvariable(&ARACHNEcfg,"ExitOnHangup",NULL); if(!(value && toupper(*value)=='Y')) strcat(buf,"@arachne -c\n"); else exitmsg(); *returnvalue=willexecute(buf); return GOTO_END; } else #endif #endif //NOTCPIP if(!strncmpi(url->file,"exit",4)) { if(url->file[4]=='=' || url->file[4]=='?') *returnvalue=atoi(&(url->file[5])); return GOTO_USEREND; } return 0; }
char *ArachneDIAL(void) { char *value; char str[80]; char terminal[80]="\0",hangup[80]="\0",useterm=0,dospppd=0; char *pausemsg=ctrlbreak; char buf[5*IE_MAXLEN]; char altnameserver[IE_MAXLEN]; char *altdns="\0"; //!!glennmcc: Mar 06, 2006 -- allow use of %DNS1 with miniterm/epppd char nameserver[IE_MAXLEN]; char *dns="\0"; //!!glennmcc: end process_form(0,IE_NULL); //updateovat Arachne.Cfg if(tcpip) { value=configvariable(&ARACHNEcfg,"Hangup",NULL); if(value) { makestr(hangup,value,128); strcat(hangup,"\n"); } } value=configvariable(&ARACHNEcfg,"UseTerminal",NULL); if(value && toupper(*value)=='Y') { value=configvariable(&ARACHNEcfg,"TerminalWindow",NULL); useterm=1; } else value=configvariable(&ARACHNEcfg,"Dialer",NULL); if(value && strcmpi(value,"NUL")) { makestr(terminal,value,128); strcat(terminal,"\n"); } else useterm=0; #ifndef NOETHERPPP value=configvariable(&ARACHNEcfg,"Connection",NULL); if(!value) return (""); /* if(!strncmpi(value,"@PPP.EXE",8)) { int f,l; //vytvorit CONFIG.PPP f=a_open(configvariable(&ARACHNEcfg,"PPPconfig",NULL),O_RDONLY|O_TEXT,0); if(f!=-1) { l=a_read(f,buf,BUF/2); buf[l]='\0'; a_close(f); sprintf(&buf[BUF/2+1],buf, configvariable(&ARACHNEcfg,"PPPusername",NULL), configvariable(&ARACHNEcfg,"PPPpassword",NULL)); f=a_open("config.ppp",O_TEXT|O_WRONLY|O_CREAT|O_TRUNC,S_IREAD|S_IWRITE); write(f,&buf[BUF/2+1],strlen(&buf[BUF/2+1])); a_close(f); } }//end if ETHERPPP else */ //!!glennmcc: begin Dec 24, 2000 // changed "PPPD.EXE to "PPP" so that *any* .EXE, .COM or .BAT // with "PPP" in the name will still result in a new PPPDRC.CFG file // examples... epppd.exe ppp.exe myppp.exe lsppp.exe loadppp.bat ppp_drv.com // if(strstr(strupr(value),"PPPD.EXE")) //!!glennmcc: July 6, 2002 always write pppdrc.cfg // if(strstr(strupr(value),"PPP")) //!!glennmcc: end //!!glennmcc: Jan 16, 2008 -- write data into both pppdrc.cfg & lsppp.cfg { int f=a_open("pppdrc.cfg",O_TEXT|O_WRONLY|O_CREAT|O_TRUNC,S_IREAD|S_IWRITE); int f2=a_open("lsppp.cfg",O_TEXT|O_WRONLY|O_CREAT|O_TRUNC,S_IREAD|S_IWRITE); if(f!=-1 && f2!=-1) { char *base,*default_base[4]={"0x3f8","0x2f8","0x3e8","0x2e8"}; char *irq,*default_irq[4]={"4","3","4","3"}; int port=0; value=configvariable(&ARACHNEcfg,"Port",NULL); if(value) port=atoi(value)-1; if(port>=0 && port<4) { irq=default_irq[port]; base=default_base[port]; } else { irq=configvariable(&ARACHNEcfg,"Irq",NULL); base=configvariable(&ARACHNEcfg,"Base",NULL); } dns=configvariable(&ARACHNEcfg,"NameServer",NULL); if(*dns=='%') { char *ptr=strchr(&dns[1],'%'); if(ptr) *ptr='\0'; dns=getenv(&dns[1]); } if(strlen(dns)>6) sprintf(nameserver,"namsrv %s\n",dns); else strcpy(nameserver,"\0"); altdns=configvariable(&ARACHNEcfg,"AltNameServer",NULL); if(*altdns=='%') { char *ptr=strchr(&altdns[1],'%'); if(ptr) *ptr='\0'; altdns=getenv(&altdns[1]); } if(strlen(altdns)>6) sprintf(altnameserver,"namsrv %s\n",altdns); else strcpy(altnameserver,"\0"); //write pppdrc.cfg sprintf(buf,"\ %s\n\ irq %s\n\ base %s\n\ modem\n\ crtscts\n\ asyncmap 0\n\ %s\ %s\ user \"%s\"\n\ passwd \"%s\"\n", configvariable(&ARACHNEcfg,"Speed",NULL), irq,base, nameserver, altnameserver, configvariable(&ARACHNEcfg,"PPPusername",NULL), configvariable(&ARACHNEcfg,"PPPpassword",NULL)); write(f,buf,strlen(buf)); a_close(f); //write lsppp.cfg sprintf(buf,"\ /M:%s\n\ /d:%s\n\ /B:%s\n\ /i:%s\n\ /b:%s\n\ /U:%s\n\ /P:%s\n\ /V:60\n", configvariable(&ARACHNEcfg,"InitString",NULL), configvariable(&ARACHNEcfg,"PhoneNumber",NULL), configvariable(&ARACHNEcfg,"Speed",NULL), irq,base, configvariable(&ARACHNEcfg,"PPPusername",NULL), configvariable(&ARACHNEcfg,"PPPpassword",NULL)); //!!glennmcc: Feb 14, 2008 -- also write DNSs into lsppp.cfg if(strlen(dns)>6) { strcat(buf,"/N:"); strcat(buf,dns); } if(strlen(altdns)>6) { strcat(buf,","); strcat(buf,altdns); } if(strlen(dns)>6) strcat(buf,"\n"); //!!glennmcc: end, Feb 14, 2008 write(f2,buf,strlen(buf)); a_close(f2); } dospppd=1; pausemsg=MSG_ESC; }