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/TCPCallbackListener.h@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 | #ifndef TCPCALLBACKLISTENER_H |
RodColeman | 0:0791c1fece8e | 2 | #define TCPCALLBACKLISTENER_H |
RodColeman | 0:0791c1fece8e | 3 | |
RodColeman | 0:0791c1fece8e | 4 | #include "TCPListener.h" |
RodColeman | 0:0791c1fece8e | 5 | |
RodColeman | 0:0791c1fece8e | 6 | namespace mbed { |
RodColeman | 0:0791c1fece8e | 7 | class NetServer; |
RodColeman | 0:0791c1fece8e | 8 | |
RodColeman | 0:0791c1fece8e | 9 | class TCPCallbackListener : public TCPListener { |
RodColeman | 0:0791c1fece8e | 10 | public: |
RodColeman | 0:0791c1fece8e | 11 | TCPCallbackListener( |
RodColeman | 0:0791c1fece8e | 12 | u16_t port, |
RodColeman | 0:0791c1fece8e | 13 | err_t (*paccept)(TCPCallbackListener *, struct tcp_pcb *, err_t)) |
RodColeman | 0:0791c1fece8e | 14 | : TCPListener(port), _accept(paccept) { |
RodColeman | 0:0791c1fece8e | 15 | } |
RodColeman | 0:0791c1fece8e | 16 | |
RodColeman | 0:0791c1fece8e | 17 | private: |
RodColeman | 0:0791c1fece8e | 18 | virtual err_t accept(struct tcp_pcb *newpcb, err_t err) { |
RodColeman | 0:0791c1fece8e | 19 | if(_accept) { |
RodColeman | 0:0791c1fece8e | 20 | return (_accept)(this, newpcb, err); |
RodColeman | 0:0791c1fece8e | 21 | } else { |
RodColeman | 0:0791c1fece8e | 22 | return ERR_OK; |
RodColeman | 0:0791c1fece8e | 23 | } |
RodColeman | 0:0791c1fece8e | 24 | } |
RodColeman | 0:0791c1fece8e | 25 | |
RodColeman | 0:0791c1fece8e | 26 | err_t (*_accept)(TCPCallbackListener *, struct tcp_pcb *newpcb, err_t err); |
RodColeman | 0:0791c1fece8e | 27 | |
RodColeman | 0:0791c1fece8e | 28 | friend class NetServer; |
RodColeman | 0:0791c1fece8e | 29 | }; |
RodColeman | 0:0791c1fece8e | 30 | |
RodColeman | 0:0791c1fece8e | 31 | }; |
RodColeman | 0:0791c1fece8e | 32 | |
RodColeman | 0:0791c1fece8e | 33 | #endif /* TCPCALLBACKLISTENER_H */ |