mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-10-03 21:32:08 +00:00
Added comments whether fields are host or network byte order (task #1568)
This commit is contained in:
parent
5e9d80fbdb
commit
874415a193
@ -241,6 +241,7 @@ lwip_standard_chksum(void *dataptr, int len)
|
||||
/* inet_chksum_pseudo:
|
||||
*
|
||||
* Calculates the pseudo Internet checksum used by TCP and UDP for a pbuf chain.
|
||||
* IP addresses are expected to be in network byte order.
|
||||
*/
|
||||
|
||||
u16_t
|
||||
|
@ -249,6 +249,8 @@ end:
|
||||
* @param dst_ip Destination IP address.
|
||||
* @param dst_port Destination UDP port.
|
||||
*
|
||||
* dst_ip & dst_port are expected to be in the same byte order as in the pcb.
|
||||
*
|
||||
* If the PCB already has a remote address association, it will
|
||||
* be restored after the data is sent.
|
||||
*
|
||||
@ -430,6 +432,8 @@ udp_send(struct udp_pcb *pcb, struct pbuf *p)
|
||||
* bind to all local interfaces.
|
||||
* @param port local UDP port to bind with.
|
||||
*
|
||||
* ipaddr & port are expected to be in the same byte order as in the pcb.
|
||||
*
|
||||
* @return lwIP error code.
|
||||
* - ERR_OK. Successful. No error occured.
|
||||
* - ERR_USE. The specified ipaddr and port are already bound to by
|
||||
@ -528,6 +532,8 @@ udp_bind(struct udp_pcb *pcb, struct ip_addr *ipaddr, u16_t port)
|
||||
*
|
||||
* @return lwIP error code
|
||||
*
|
||||
* ipaddr & port are expected to be in the same byte order as in the pcb.
|
||||
*
|
||||
* @see udp_disconnect()
|
||||
*/
|
||||
err_t
|
||||
|
@ -74,7 +74,9 @@ err_t ip_output_if(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
|
||||
beginning of a PCB type definition. It is located here so that
|
||||
changes to this common part are made in one location instead of
|
||||
having to change all PCB structs. */
|
||||
#define IP_PCB struct ip_addr local_ip; \
|
||||
#define IP_PCB \
|
||||
/* ip addresses in network byte order */ \
|
||||
struct ip_addr local_ip; \
|
||||
struct ip_addr remote_ip; \
|
||||
/* Socket options */ \
|
||||
u16_t so_options; \
|
||||
|
@ -42,6 +42,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* members are in network byte order */
|
||||
struct sockaddr_in {
|
||||
u8_t sin_len;
|
||||
u8_t sin_family;
|
||||
|
@ -170,6 +170,9 @@ void tcp_rexmit_rto (struct tcp_pcb *pcb);
|
||||
|
||||
#define TCP_MAXIDLE TCP_KEEPCNT_DEFAULT * TCP_KEEPINTVL_DEFAULT /* Maximum KEEPALIVE probe time */
|
||||
|
||||
/* Fields are (of course) in network byte order.
|
||||
* Some fields are converted to host byte order in tcp_input().
|
||||
*/
|
||||
#ifdef PACK_STRUCT_USE_INCLUDES
|
||||
# include "arch/bpstruct.h"
|
||||
#endif
|
||||
@ -226,6 +229,7 @@ struct tcp_pcb {
|
||||
u8_t prio;
|
||||
void *callback_arg;
|
||||
|
||||
/* ports are in host byte order */
|
||||
u16_t local_port;
|
||||
u16_t remote_port;
|
||||
|
||||
@ -238,6 +242,8 @@ struct tcp_pcb {
|
||||
#define TF_GOT_FIN (u8_t)0x20U /* Connection was closed by the remote end. */
|
||||
#define TF_NODELAY (u8_t)0x40U /* Disable Nagle algorithm */
|
||||
|
||||
/* the rest of the fields are in host byte order
|
||||
as we have to do some math with them */
|
||||
/* receiver variables */
|
||||
u32_t rcv_nxt; /* next seqno expected */
|
||||
u16_t rcv_wnd; /* receiver window */
|
||||
|
@ -44,6 +44,7 @@ extern "C" {
|
||||
|
||||
#define UDP_HLEN 8
|
||||
|
||||
/* Fields are (of course) in network byte order. */
|
||||
struct udp_hdr {
|
||||
PACK_STRUCT_FIELD(u16_t src);
|
||||
PACK_STRUCT_FIELD(u16_t dest); /* src/dest UDP ports */
|
||||
@ -64,10 +65,13 @@ struct udp_pcb {
|
||||
struct udp_pcb *next;
|
||||
|
||||
u8_t flags;
|
||||
/* ports are in host byte order */
|
||||
u16_t local_port, remote_port;
|
||||
|
||||
/* used for UDP_LITE only */
|
||||
u16_t chksum_len;
|
||||
|
||||
/* addr and port are in same byte order as in the pcb */
|
||||
void (* recv)(void *arg, struct udp_pcb *pcb, struct pbuf *p,
|
||||
struct ip_addr *addr, u16_t port);
|
||||
void *recv_arg;
|
||||
|
Loading…
Reference in New Issue
Block a user