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

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?

UserRevisionLine numberNew contents of line
RodColeman 0:0791c1fece8e 1 #ifndef TCPLISTENER_H
RodColeman 0:0791c1fece8e 2 #define TCPLISTENER_H
RodColeman 0:0791c1fece8e 3
RodColeman 0:0791c1fece8e 4 #include "TCPItem.h"
RodColeman 0:0791c1fece8e 5
RodColeman 0:0791c1fece8e 6 #include "arch/cc.h"
RodColeman 0:0791c1fece8e 7 #include "lwip/err.h"
RodColeman 0:0791c1fece8e 8 #include "lwip/tcp.h"
RodColeman 0:0791c1fece8e 9
RodColeman 0:0791c1fece8e 10 namespace mbed {
RodColeman 0:0791c1fece8e 11 class NetServer;
RodColeman 0:0791c1fece8e 12 class TCPConnection;
RodColeman 0:0791c1fece8e 13
RodColeman 0:0791c1fece8e 14 class TCPListener : public TCPItem {
RodColeman 0:0791c1fece8e 15 public:
RodColeman 0:0791c1fece8e 16 TCPListener(u16_t port) : _port(port) {
RodColeman 0:0791c1fece8e 17 }
RodColeman 0:0791c1fece8e 18
RodColeman 0:0791c1fece8e 19 virtual ~TCPListener() {}
RodColeman 0:0791c1fece8e 20
RodColeman 0:0791c1fece8e 21 void bind();
RodColeman 0:0791c1fece8e 22 protected:
RodColeman 0:0791c1fece8e 23 /**
RodColeman 0:0791c1fece8e 24 * Function to call when a listener has been connected.
RodColeman 0:0791c1fece8e 25 * @param err an error argument (TODO: that is current always ERR_OK?)
RodColeman 0:0791c1fece8e 26 * @return ERR_OK: accept the new connection,
RodColeman 0:0791c1fece8e 27 * any other err_t abortsthe new connection
RodColeman 0:0791c1fece8e 28 */
RodColeman 0:0791c1fece8e 29 virtual err_t accept(struct tcp_pcb *, err_t err) = 0;
RodColeman 0:0791c1fece8e 30
RodColeman 0:0791c1fece8e 31 u16_t _port;
RodColeman 0:0791c1fece8e 32 private:
RodColeman 0:0791c1fece8e 33 static err_t accept_callback(void *arg, struct tcp_pcb *newpcb, err_t err);
RodColeman 0:0791c1fece8e 34 friend NetServer;
RodColeman 0:0791c1fece8e 35 friend TCPConnection;
RodColeman 0:0791c1fece8e 36
RodColeman 0:0791c1fece8e 37 };
RodColeman 0:0791c1fece8e 38
RodColeman 0:0791c1fece8e 39 };
RodColeman 0:0791c1fece8e 40
RodColeman 0:0791c1fece8e 41 #endif /* TCPLISTENER_H */