/*---------------------------------------------------------------------------*/ void httpd_init(void) { tcp_listen(HTONS(80)); memb_init(&conns); httpd_cgi_init(); }
/*---------------------------------------------------------------------------*/ void httpd_init(void) { tcp_listen(HTONS(80)); memb_init(&conns); #if HTTPD_CONF_CGI httpd_cgi_init(); #endif /* HTTPD_CONF_CGI */ }
/*---------------------------------------------------------------------------*/ void httpd_appcall(void *state) { #if DEBUGLOGIC struct httpd_state *s; //Enter here for debugging with output directed to TCPBUF s = sg = (struct httpd_state *)memb_alloc(&conns); if (1) { #else struct httpd_state *s = (struct httpd_state *)state; if(uip_closed() || uip_aborted() || uip_timedout()) { if(s != NULL) { memb_free(&conns, s); } } else if(uip_connected()) { s = (struct httpd_state *)memb_alloc(&conns); if(s == NULL) { uip_abort(); return; } #endif tcp_markconn(uip_conn, s); PSOCK_INIT(&s->sin, (uint8_t *)s->inputbuf, sizeof(s->inputbuf) - 1); PSOCK_INIT(&s->sout, (uint8_t *)s->inputbuf, sizeof(s->inputbuf) - 1); PT_INIT(&s->outputpt); s->state = STATE_WAITING; /* timer_set(&s->timer, CLOCK_SECOND * 100);*/ s->timer = 0; handle_connection(s); } else if(s != NULL) { if(uip_poll()) { ++s->timer; if(s->timer >= 20) { uip_abort(); memb_free(&conns, s); } } else { s->timer = 0; } handle_connection(s); } else { uip_abort(); } } /*---------------------------------------------------------------------------*/ void httpd_init(void) { tcp_listen(UIP_HTONS(80)); memb_init(&conns); httpd_cgi_init(); }