mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-01-27 12:35:26 +00:00
- changed "struct ip_addr" to "ip_addr_t";
- tcp_accepted(): added a note to call this on the listening pcb, not the connection pcb; - tcp_write(): change last parameter from "copy" to "apiflags", documented the apiflags
This commit is contained in:
parent
4eb5acd9e2
commit
12c2d7e4cf
@ -107,7 +107,7 @@ incoming connections or be explicitly connected to another host.
|
|||||||
Creates a new connection identifier (PCB). If memory is not
|
Creates a new connection identifier (PCB). If memory is not
|
||||||
available for creating the new pcb, NULL is returned.
|
available for creating the new pcb, NULL is returned.
|
||||||
|
|
||||||
- err_t tcp_bind(struct tcp_pcb *pcb, struct ip_addr *ipaddr,
|
- err_t tcp_bind(struct tcp_pcb *pcb, ip_addr_t *ipaddr,
|
||||||
u16_t port)
|
u16_t port)
|
||||||
|
|
||||||
Binds the pcb to a local IP address and port number. The IP address
|
Binds the pcb to a local IP address and port number. The IP address
|
||||||
@ -147,6 +147,8 @@ incoming connections or be explicitly connected to another host.
|
|||||||
usually be called from the accept callback. This allows lwIP to perform
|
usually be called from the accept callback. This allows lwIP to perform
|
||||||
housekeeping tasks, such as allowing further incoming connections to be
|
housekeeping tasks, such as allowing further incoming connections to be
|
||||||
queued in the listen backlog.
|
queued in the listen backlog.
|
||||||
|
ATTENTION: the PCB passed in must be the listening pcb, not the pcb passed
|
||||||
|
into the accept callback!
|
||||||
|
|
||||||
- void tcp_accept(struct tcp_pcb *pcb,
|
- void tcp_accept(struct tcp_pcb *pcb,
|
||||||
err_t (* accept)(void *arg, struct tcp_pcb *newpcb,
|
err_t (* accept)(void *arg, struct tcp_pcb *newpcb,
|
||||||
@ -154,8 +156,8 @@ incoming connections or be explicitly connected to another host.
|
|||||||
|
|
||||||
Specified the callback function that should be called when a new
|
Specified the callback function that should be called when a new
|
||||||
connection arrives on a listening connection.
|
connection arrives on a listening connection.
|
||||||
|
|
||||||
- err_t tcp_connect(struct tcp_pcb *pcb, struct ip_addr *ipaddr,
|
- err_t tcp_connect(struct tcp_pcb *pcb, ip_addr_t *ipaddr,
|
||||||
u16_t port, err_t (* connected)(void *arg,
|
u16_t port, err_t (* connected)(void *arg,
|
||||||
struct tcp_pcb *tpcb,
|
struct tcp_pcb *tpcb,
|
||||||
err_t err));
|
err_t err));
|
||||||
@ -176,7 +178,7 @@ incoming connections or be explicitly connected to another host.
|
|||||||
available for enqueueing the SYN segment. If the SYN indeed was
|
available for enqueueing the SYN segment. If the SYN indeed was
|
||||||
enqueued successfully, the tcp_connect() function returns ERR_OK.
|
enqueued successfully, the tcp_connect() function returns ERR_OK.
|
||||||
|
|
||||||
|
|
||||||
--- Sending TCP data
|
--- Sending TCP data
|
||||||
|
|
||||||
TCP data is sent by enqueueing the data with a call to
|
TCP data is sent by enqueueing the data with a call to
|
||||||
@ -184,15 +186,19 @@ tcp_write(). When the data is successfully transmitted to the remote
|
|||||||
host, the application will be notified with a call to a specified
|
host, the application will be notified with a call to a specified
|
||||||
callback function.
|
callback function.
|
||||||
|
|
||||||
- err_t tcp_write(struct tcp_pcb *pcb, void *dataptr, u16_t len,
|
- err_t tcp_write(struct tcp_pcb *pcb, const void *dataptr, u16_t len,
|
||||||
u8_t copy)
|
u8_t apiflags)
|
||||||
|
|
||||||
Enqueues the data pointed to by the argument dataptr. The length of
|
Enqueues the data pointed to by the argument dataptr. The length of
|
||||||
the data is passed as the len parameter. The copy argument is either
|
the data is passed as the len parameter. The apiflags can be one or more of:
|
||||||
0 or 1 and indicates whether the new memory should be allocated for
|
- TCP_WRITE_FLAG_COPY: indicates whether the new memory should be allocated
|
||||||
the data to be copied into. If the argument is 0, no new memory
|
for the data to be copied into. If this flag is not given, no new memory
|
||||||
should be allocated and the data should only be referenced by
|
should be allocated and the data should only be referenced by pointer. This
|
||||||
pointer.
|
also means that the memory behind dataptr must not change until the data is
|
||||||
|
ACKed by the remote host
|
||||||
|
- TCP_WRITE_FLAG_MORE: indicates that more data follows. If this is given,
|
||||||
|
the PSH flag is set in the last segment created by this call to tcp_write.
|
||||||
|
If this flag is given, the PSH flag is not set.
|
||||||
|
|
||||||
The tcp_write() function will fail and return ERR_MEM if the length
|
The tcp_write() function will fail and return ERR_MEM if the length
|
||||||
of the data exceeds the current send buffer size or if the length of
|
of the data exceeds the current send buffer size or if the length of
|
||||||
@ -238,7 +244,7 @@ window.
|
|||||||
|
|
||||||
Must be called when the application has received the data. The len
|
Must be called when the application has received the data. The len
|
||||||
argument indicates the length of the received data.
|
argument indicates the length of the received data.
|
||||||
|
|
||||||
|
|
||||||
--- Application polling
|
--- Application polling
|
||||||
|
|
||||||
@ -253,7 +259,7 @@ again when the connection has been idle for a while.
|
|||||||
|
|
||||||
- void tcp_poll(struct tcp_pcb *pcb,
|
- void tcp_poll(struct tcp_pcb *pcb,
|
||||||
err_t (* poll)(void *arg, struct tcp_pcb *tpcb),
|
err_t (* poll)(void *arg, struct tcp_pcb *tpcb),
|
||||||
u8_t interval)
|
u8_t interval)
|
||||||
|
|
||||||
Specifies the polling interval and the callback function that should
|
Specifies the polling interval and the callback function that should
|
||||||
be called to poll the application. The interval is specified in
|
be called to poll the application. The interval is specified in
|
||||||
@ -322,14 +328,14 @@ level of complexity of UDP, the interface is significantly simpler.
|
|||||||
|
|
||||||
Removes and deallocates the pcb.
|
Removes and deallocates the pcb.
|
||||||
|
|
||||||
- err_t udp_bind(struct udp_pcb *pcb, struct ip_addr *ipaddr,
|
- err_t udp_bind(struct udp_pcb *pcb, ip_addr_t *ipaddr,
|
||||||
u16_t port)
|
u16_t port)
|
||||||
|
|
||||||
Binds the pcb to a local address. The IP-address argument "ipaddr"
|
Binds the pcb to a local address. The IP-address argument "ipaddr"
|
||||||
can be IP_ADDR_ANY to indicate that it should listen to any local IP
|
can be IP_ADDR_ANY to indicate that it should listen to any local IP
|
||||||
address. The function currently always return ERR_OK.
|
address. The function currently always return ERR_OK.
|
||||||
|
|
||||||
- err_t udp_connect(struct udp_pcb *pcb, struct ip_addr *ipaddr,
|
- err_t udp_connect(struct udp_pcb *pcb, ip_addr_t *ipaddr,
|
||||||
u16_t port)
|
u16_t port)
|
||||||
|
|
||||||
Sets the remote end of the pcb. This function does not generate any
|
Sets the remote end of the pcb. This function does not generate any
|
||||||
@ -347,7 +353,7 @@ level of complexity of UDP, the interface is significantly simpler.
|
|||||||
- void udp_recv(struct udp_pcb *pcb,
|
- void udp_recv(struct udp_pcb *pcb,
|
||||||
void (* recv)(void *arg, struct udp_pcb *upcb,
|
void (* recv)(void *arg, struct udp_pcb *upcb,
|
||||||
struct pbuf *p,
|
struct pbuf *p,
|
||||||
struct ip_addr *addr,
|
ip_addr_t *addr,
|
||||||
u16_t port),
|
u16_t port),
|
||||||
void *recv_arg)
|
void *recv_arg)
|
||||||
|
|
||||||
@ -408,8 +414,8 @@ Call these functions in the order of appearance:
|
|||||||
Note: you must call tcp_fasttmr() and tcp_slowtmr() at the
|
Note: you must call tcp_fasttmr() and tcp_slowtmr() at the
|
||||||
predefined regular intervals after this initialization.
|
predefined regular intervals after this initialization.
|
||||||
|
|
||||||
- netif_add(struct netif *netif, struct ip_addr *ipaddr,
|
- netif_add(struct netif *netif, ip_addr_t *ipaddr,
|
||||||
struct ip_addr *netmask, struct ip_addr *gw,
|
ip_addr_t *netmask, ip_addr_t *gw,
|
||||||
void *state, err_t (* init)(struct netif *netif),
|
void *state, err_t (* init)(struct netif *netif),
|
||||||
err_t (* input)(struct pbuf *p, struct netif *netif))
|
err_t (* input)(struct pbuf *p, struct netif *netif))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user