39 #include "loader/cle.h"
40 #include "loader/cmod.h"
47 #include "lib/assert.h"
53 PROCESS(tcp_loader_process,
"TCP loader");
56 struct codeprop_state {
59 struct pt tcpthread_pt;
73 if(
uip_datalen() <
sizeof(
struct codeprop_tcphdr)) {
74 PRINTF((
"codeprop: header not found in first tcp segment\n"));
82 uip_len -=
sizeof(
struct codeprop_tcphdr);
84 ret = xmem_erase(XMEM_ERASE_UNIT_SIZE, EEPROMFS_ADDR_CODEPROP);
97 }
while(s.addr < s.len);
104 static char msg[30 + 10];
106 s = cmod_load(0, elfloader_unknown, xmem_pread, EEPROMFS_ADDR_CODEPROP);
108 sprintf(msg,
"ok\n");
110 sprintf(msg,
"err %d %s\n", s, elfloader_unknown);
141 PRINTF((
"codeprop: uip_connected() and data != NULL\n"));
145 recv_tcpthread(&s.tcpthread_pt);
148 PRINTF((
"codeprop: connection down\n"));
uip_len
The length of the packet in the uip_buf buffer.
void process_poll(struct process *p)
Request a process to be polled.
#define PROCESS_BEGIN()
Define the beginning of a process.
Representation of a uIP TCP connection.
Header file for the uIP TCP/IP stack.
#define uip_aborted()
Has the connection been aborted by the other end?
CCIF void uip_send(const void *data, int len)
Send data on the current connection.
#define uip_newdata()
Is new incoming data available?
uint16_t lport
The local TCP port, in network byte order.
#define NULL
The null pointer.
#define PT_INIT(pt)
Initialize a protothread.
#define UIP_HTONS(n)
Convert 16-bit quantity from host byte order to network byte order.
#define PT_THREAD(name_args)
Declaration of a protothread.
#define uip_acked()
Has previously sent data been acknowledged?
#define uip_connected()
Has the connection just been connected?
#define PT_WAIT_UNTIL(pt, condition)
Block and wait until condition is true.
#define PROCESS_THREAD(name, ev, data)
Define the body of a process.
cle_scratch elfloader_unknown
If elfloader_load() could not find a specific symbol, it is copied into this array.
#define PROCESS_END()
Define the end of a process.
#define uip_abort()
Abort the current connection.
CCIF uint16_t uip_htons(uint16_t val)
Convert a 16-bit quantity from host byte order to network byte order.
#define PT_BEGIN(pt)
Declare the start of a protothread inside the C function implementing the protothread.
#define PROCESS(name, strname)
Declare a process.
#define uip_close()
Close the current connection.
#define uip_datalen()
The length of any incoming data that is currently available (if available) in the uip_appdata buffer...
#define PT_YIELD_UNTIL(pt, cond)
Yield from the protothread until a condition occurs.
process_event_t tcpip_event
The uIP event.
#define uip_timedout()
Has the connection timed out?
#define PT_END(pt)
Declare the end of a protothread.
#define PROCESS_YIELD()
Yield the currently running process.
CCIF void tcp_listen(uint16_t port)
Open a TCP port.
#define uip_closed()
Has the connection been closed by the other end?
uip_appdata
Pointer to the application data in the packet buffer.
#define uip_rexmit()
Do we need to retransmit previously data?