mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-08-30 14:52:51 +08:00
Adding initial http daemon implementation
This commit is contained in:
+2
-2
@@ -1,9 +1,9 @@
|
||||
CC = sdcc
|
||||
CC_FLAGS = -mmcs51 -I. -I../hello-world
|
||||
CC_FLAGS = -mmcs51 -I. -I../httpd
|
||||
ASM = sdas8051
|
||||
AFLAGS= -plosgff
|
||||
|
||||
SRCS = psock.c timer.c uip_arp.c uip.c uip-fw.c uiplib.c uip-neighbor.c uip-split.c
|
||||
SRCS = timer.c uip_arp.c uip.c uip-fw.c uiplib.c uip-neighbor.c uip-split.c
|
||||
OBJS = ${SRCS:.c=.rel}
|
||||
|
||||
all: $(OBJS)
|
||||
|
||||
+1
-1
@@ -148,7 +148,7 @@ typedef unsigned short uip_stats_t;
|
||||
/* Here we include the header file for the application(s) we use in
|
||||
our project. */
|
||||
/*#include "smtp.h"*/
|
||||
#include "hello-world.h"
|
||||
#include "httpd.h"
|
||||
/*#include "telnetd.h"*/
|
||||
/*#include "webserver.h" */
|
||||
/*#include "dhcpc.h"*/
|
||||
|
||||
@@ -690,7 +690,9 @@ uip_process(u8_t flag) __banked
|
||||
if((uip_connr->tcpstateflags & UIP_TS_MASK) == UIP_ESTABLISHED &&
|
||||
!uip_outstanding(uip_connr)) {
|
||||
uip_flags = UIP_POLL;
|
||||
write_char('B');
|
||||
UIP_APPCALL();
|
||||
write_char('b');
|
||||
goto appsend;
|
||||
}
|
||||
goto drop;
|
||||
@@ -742,7 +744,9 @@ uip_process(u8_t flag) __banked
|
||||
UIP_TIMEDOUT to inform the application that the
|
||||
connection has timed out. */
|
||||
uip_flags = UIP_TIMEDOUT;
|
||||
write_char('C');
|
||||
UIP_APPCALL();
|
||||
write_char('c');
|
||||
|
||||
/* We also send a reset packet to the remote host. */
|
||||
BUF->flags = TCP_RST | TCP_ACK;
|
||||
@@ -781,6 +785,7 @@ uip_process(u8_t flag) __banked
|
||||
the code for sending out the packet (the apprexmit
|
||||
label). */
|
||||
uip_flags = UIP_REXMIT;
|
||||
write_char('R');
|
||||
UIP_APPCALL();
|
||||
goto apprexmit;
|
||||
|
||||
@@ -993,8 +998,6 @@ uip_process(u8_t flag) __banked
|
||||
uip_ipaddr_copy(BUF->destipaddr, BUF->srcipaddr);
|
||||
uip_ipaddr_copy(BUF->srcipaddr, uip_hostaddr);
|
||||
|
||||
// ICMPBUF->proto = 0x06; //BUG: Only for testing...
|
||||
|
||||
UIP_STAT(++uip_stat.icmp.sent);
|
||||
goto send;
|
||||
|
||||
@@ -1166,6 +1169,7 @@ uip_process(u8_t flag) __banked
|
||||
/* Start of TCP input header processing code. */
|
||||
|
||||
// BUG: We need to reimplement this with RTL837x TCP checksum checking
|
||||
// i.e. figure out which bit in the RX-tag states the checksum is correct
|
||||
// if(uip_tcpchksum() != 0xffff) { /* Compute and check the TCP
|
||||
// checksum. */
|
||||
// UIP_STAT(++uip_stat.tcp.drop);
|
||||
@@ -1381,7 +1385,9 @@ uip_process(u8_t flag) __banked
|
||||
uip_connr->tcpstateflags = UIP_CLOSED;
|
||||
UIP_LOG("tcp: got reset, aborting connection.");
|
||||
uip_flags = UIP_ABORT;
|
||||
write_char('F');
|
||||
UIP_APPCALL();
|
||||
write_char('f');
|
||||
goto drop;
|
||||
}
|
||||
/* Calculated the length of the data, if the application has sent
|
||||
@@ -1470,7 +1476,7 @@ uip_process(u8_t flag) __banked
|
||||
uip_add_rcv_nxt(uip_len);
|
||||
}
|
||||
uip_slen = 0;
|
||||
UIP_APPCALL();
|
||||
UIP_APPCALL(); // UIP_CONNECTED
|
||||
goto appsend;
|
||||
}
|
||||
goto drop;
|
||||
@@ -1525,12 +1531,16 @@ uip_process(u8_t flag) __banked
|
||||
uip_connr->len = 0;
|
||||
uip_len = 0;
|
||||
uip_slen = 0;
|
||||
write_char('H');
|
||||
UIP_APPCALL();
|
||||
write_char('h');
|
||||
goto appsend;
|
||||
}
|
||||
/* Inform the application that the connection failed */
|
||||
uip_flags = UIP_ABORT;
|
||||
write_char('I');
|
||||
UIP_APPCALL();
|
||||
write_char('I');
|
||||
/* The connection is closed after we send the RST */
|
||||
uip_conn->tcpstateflags = UIP_CLOSED;
|
||||
goto reset;
|
||||
@@ -1557,7 +1567,9 @@ uip_process(u8_t flag) __banked
|
||||
if(uip_len > 0) {
|
||||
uip_flags |= UIP_NEWDATA;
|
||||
}
|
||||
write_char('J');
|
||||
UIP_APPCALL();
|
||||
write_char('j');
|
||||
uip_connr->len = 1;
|
||||
uip_connr->tcpstateflags = UIP_LAST_ACK;
|
||||
uip_connr->nrtx = 0;
|
||||
@@ -1715,7 +1727,9 @@ uip_process(u8_t flag) __banked
|
||||
if(uip_flags & UIP_ACKDATA) {
|
||||
uip_connr->tcpstateflags = UIP_CLOSED;
|
||||
uip_flags = UIP_CLOSE;
|
||||
write_char('L');
|
||||
UIP_APPCALL();
|
||||
write_char('l');
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1736,7 +1750,9 @@ uip_process(u8_t flag) __banked
|
||||
}
|
||||
uip_add_rcv_nxt(1);
|
||||
uip_flags = UIP_CLOSE;
|
||||
write_char('M');
|
||||
UIP_APPCALL();
|
||||
write_char('m');
|
||||
goto tcp_send_ack;
|
||||
} else if(uip_flags & UIP_ACKDATA) {
|
||||
uip_connr->tcpstateflags = UIP_FIN_WAIT_2;
|
||||
@@ -1757,7 +1773,9 @@ uip_process(u8_t flag) __banked
|
||||
uip_connr->timer = 0;
|
||||
uip_add_rcv_nxt(1);
|
||||
uip_flags = UIP_CLOSE;
|
||||
write_char('N');
|
||||
UIP_APPCALL();
|
||||
write_char('n');
|
||||
goto tcp_send_ack;
|
||||
}
|
||||
if(uip_len > 0) {
|
||||
|
||||
Reference in New Issue
Block a user