f
Fork of lwip by
trunk/Core/TCPListener.h@1:803fdc96fbd7, 2017-08-03 (annotated)
- Committer:
- idijoeteque
- Date:
- Thu Aug 03 10:24:16 2017 +0000
- Revision:
- 1:803fdc96fbd7
- Parent:
- 0:5e1631496985
hello
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
root@mbed.org | 0:5e1631496985 | 1 | #ifndef TCPLISTENER_H |
root@mbed.org | 0:5e1631496985 | 2 | #define TCPLISTENER_H |
root@mbed.org | 0:5e1631496985 | 3 | |
root@mbed.org | 0:5e1631496985 | 4 | #include "TCPItem.h" |
root@mbed.org | 0:5e1631496985 | 5 | |
root@mbed.org | 0:5e1631496985 | 6 | #include "arch/cc.h" |
root@mbed.org | 0:5e1631496985 | 7 | #include "lwip/err.h" |
root@mbed.org | 0:5e1631496985 | 8 | #include "lwip/tcp.h" |
root@mbed.org | 0:5e1631496985 | 9 | |
root@mbed.org | 0:5e1631496985 | 10 | namespace mbed { |
root@mbed.org | 0:5e1631496985 | 11 | class NetServer; |
root@mbed.org | 0:5e1631496985 | 12 | class TCPConnection; |
root@mbed.org | 0:5e1631496985 | 13 | |
root@mbed.org | 0:5e1631496985 | 14 | class TCPListener : public TCPItem { |
root@mbed.org | 0:5e1631496985 | 15 | public: |
root@mbed.org | 0:5e1631496985 | 16 | TCPListener(u16_t port) : _port(port) { |
root@mbed.org | 0:5e1631496985 | 17 | } |
root@mbed.org | 0:5e1631496985 | 18 | |
root@mbed.org | 0:5e1631496985 | 19 | virtual ~TCPListener() {} |
root@mbed.org | 0:5e1631496985 | 20 | |
root@mbed.org | 0:5e1631496985 | 21 | void bind(); |
root@mbed.org | 0:5e1631496985 | 22 | protected: |
root@mbed.org | 0:5e1631496985 | 23 | /** |
root@mbed.org | 0:5e1631496985 | 24 | * Function to call when a listener has been connected. |
root@mbed.org | 0:5e1631496985 | 25 | * @param err an error argument (TODO: that is current always ERR_OK?) |
root@mbed.org | 0:5e1631496985 | 26 | * @return ERR_OK: accept the new connection, |
root@mbed.org | 0:5e1631496985 | 27 | * any other err_t abortsthe new connection |
root@mbed.org | 0:5e1631496985 | 28 | */ |
root@mbed.org | 0:5e1631496985 | 29 | virtual err_t accept(struct tcp_pcb *, err_t err) = 0; |
root@mbed.org | 0:5e1631496985 | 30 | |
root@mbed.org | 0:5e1631496985 | 31 | u16_t _port; |
root@mbed.org | 0:5e1631496985 | 32 | private: |
root@mbed.org | 0:5e1631496985 | 33 | static err_t accept_callback(void *arg, struct tcp_pcb *newpcb, err_t err); |
root@mbed.org | 0:5e1631496985 | 34 | friend NetServer; |
root@mbed.org | 0:5e1631496985 | 35 | friend TCPConnection; |
root@mbed.org | 0:5e1631496985 | 36 | |
root@mbed.org | 0:5e1631496985 | 37 | }; |
root@mbed.org | 0:5e1631496985 | 38 | |
root@mbed.org | 0:5e1631496985 | 39 | }; |
root@mbed.org | 0:5e1631496985 | 40 | |
root@mbed.org | 0:5e1631496985 | 41 | #endif /* TCPLISTENER_H */ |