Port of LwIP performed by Ralf in 2010. Not recommended for use with recent mbed libraries, but good demos of raw LwIP possible
Dependents: LwIP_raw_API_serverExample tiny-dtls
Core/TCPItem.cpp@0:0791c1fece8e, 2012-09-18 (annotated)
- Committer:
- RodColeman
- Date:
- Tue Sep 18 14:41:24 2012 +0000
- Revision:
- 0:0791c1fece8e
[mbed] converted /Eth_TCP_Wei_Server/lwip
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
RodColeman | 0:0791c1fece8e | 1 | #include "TCPItem.h" |
RodColeman | 0:0791c1fece8e | 2 | |
RodColeman | 0:0791c1fece8e | 3 | using namespace std; |
RodColeman | 0:0791c1fece8e | 4 | using namespace mbed; |
RodColeman | 0:0791c1fece8e | 5 | |
RodColeman | 0:0791c1fece8e | 6 | void TCPItem::abort() const { |
RodColeman | 0:0791c1fece8e | 7 | tcp_abort(this->_pcb); |
RodColeman | 0:0791c1fece8e | 8 | } |
RodColeman | 0:0791c1fece8e | 9 | |
RodColeman | 0:0791c1fece8e | 10 | void TCPItem::release_callbacks() const { |
RodColeman | 0:0791c1fece8e | 11 | tcp_arg(this->_pcb, NULL); |
RodColeman | 0:0791c1fece8e | 12 | tcp_sent(this->_pcb, NULL); |
RodColeman | 0:0791c1fece8e | 13 | tcp_recv(this->_pcb, NULL); |
RodColeman | 0:0791c1fece8e | 14 | tcp_poll(this->_pcb, NULL, 255); |
RodColeman | 0:0791c1fece8e | 15 | tcp_accept(this->_pcb, NULL); |
RodColeman | 0:0791c1fece8e | 16 | tcp_err(this->_pcb, NULL); |
RodColeman | 0:0791c1fece8e | 17 | } |
RodColeman | 0:0791c1fece8e | 18 | |
RodColeman | 0:0791c1fece8e | 19 | err_t TCPItem::close() { |
RodColeman | 0:0791c1fece8e | 20 | err_t err = tcp_close(this->_pcb); |
RodColeman | 0:0791c1fece8e | 21 | this->_pcb = NULL; |
RodColeman | 0:0791c1fece8e | 22 | return err; |
RodColeman | 0:0791c1fece8e | 23 | } |
RodColeman | 0:0791c1fece8e | 24 | |
RodColeman | 0:0791c1fece8e | 25 | void TCPItem::open() { |
RodColeman | 0:0791c1fece8e | 26 | if(!this->_pcb) { |
RodColeman | 0:0791c1fece8e | 27 | this->_pcb = tcp_new(); |
RodColeman | 0:0791c1fece8e | 28 | tcp_arg(this->_pcb, this); |
RodColeman | 0:0791c1fece8e | 29 | } |
RodColeman | 0:0791c1fece8e | 30 | } |