mbed OS5

Fork of UIPEthernet by Zoltan Hudak

Embed: (wiki syntax)

« Back to documentation index

Architecture specific UIP functions

Architecture specific UIP functions
[The UIP TCP/IP stack]

The functions in the architecture specific module implement the IP check sum and 32-bit additions. More...

Files

file  uip_arch.h
 

Declarations of architecture specific functions.


Functions

void uip_add32 (u8_t *op32, u16_t op16)
 Carry out a 32-bit addition.
u16_t uip_chksum (u16_t *buf, u16_t len)
 Calculate the Internet checksum over a buffer.
u16_t uip_ipchksum (void)
 Calculate the IP header checksum of the packet header in uip_buf.
u16_t uip_tcpchksum (void)
 Calculate the TCP checksum of the packet in uip_buf and uip_appdata.
u16_t uip_udpchksum (void)
 Calculate the UDP checksum of the packet in uip_buf and uip_appdata.

Variables

u8_t uip_acc32 [4]
 4-byte array used for the 32-bit sequence number calculations.

Detailed Description

The functions in the architecture specific module implement the IP check sum and 32-bit additions.

The IP checksum calculation is the most computationally expensive operation in the TCP/IP stack and it therefore pays off to implement this in efficient assembler. The purpose of the uip-arch module is to let the checksum functions to be implemented in architecture specific assembler.


Function Documentation

void uip_add32 ( u8_t *  op32,
u16_t  op16 
)

Carry out a 32-bit addition.

Because not all architectures for which UIP is intended has native 32-bit arithmetic, UIP uses an external C function for doing the required 32-bit additions in the TCP protocol processing. This function should add the two arguments and place the result in the global variable uip_acc32.

Note:
The 32-bit integer pointed to by the op32 parameter and the result in the uip_acc32 variable are in network byte order (big endian).
Parameters:
op32A pointer to a 4-byte array representing a 32-bit integer in network byte order (big endian).
op16A 16-bit integer in host byte order.
Note:
Parameters:
@retval

Definition at line 265 of file uip.c.

u16_t uip_chksum ( u16_t *  buf,
u16_t  len 
)

Calculate the Internet checksum over a buffer.

The Internet checksum is the one's complement of the one's complement sum of all 16-bit words in the buffer.

See RFC1071.

Note:
This function is not called in the current version of UIP, but future versions might make use of it.
Parameters:
bufA pointer to the buffer over which the checksum is to be computed.
lenThe length of the buffer over which the checksum is to be computed.
Returns:
The Internet checksum of the buffer.

The Internet checksum is the one's complement of the one's complement sum of all 16-bit words in the buffer.

See RFC1071.

Parameters:
bufA pointer to the buffer over which the checksum is to be computed.
lenThe length of the buffer over which the checksum is to be computed.
Returns:
The Internet checksum of the buffer.

Definition at line 326 of file uip.c.

u16_t uip_ipchksum ( void   )

Calculate the IP header checksum of the packet header in uip_buf.

The IP header checksum is the Internet checksum of the 20 bytes of the IP header.

Returns:
The IP header checksum of the IP header in the uip_buf buffer.
Note:
Parameters:
@retvalThe IP header checksum is the Internet checksum of the 20 bytes of the IP header.
Returns:
The IP header checksum of the IP header in the uip_buf buffer.

Definition at line 566 of file UIPEthernet.cpp.

u16_t uip_tcpchksum ( void   )

Calculate the TCP checksum of the packet in uip_buf and uip_appdata.

The TCP checksum is the Internet checksum of data contents of the TCP segment, and a pseudo-header as defined in RFC793.

Note:
The uip_appdata pointer that points to the packet data may point anywhere in memory, so it is not possible to simply calculate the Internet checksum of the contents of the uip_buf buffer.
Returns:
The TCP checksum of the TCP segment in uip_buf and pointed to by uip_appdata.
Note:
Parameters:
@retvalThe TCP checksum is the Internet checksum of data contents of the TCP segment, and a pseudo-header as defined in RFC793.
Returns:
The TCP checksum of the TCP segment in uip_buf and pointed to by uip_appdata.

The TCP checksum is the Internet checksum of data contents of the TCP segment, and a pseudo-header as defined in RFC793.

Returns:
The TCP checksum of the TCP segment in uip_buf and pointed to by uip_appdata.

Definition at line 578 of file UIPEthernet.cpp.

u16_t uip_udpchksum ( void   )

Calculate the UDP checksum of the packet in uip_buf and uip_appdata.

Note:
Parameters:
@retval
Note:
Parameters:
@retvalThe UDP checksum is the Internet checksum of data contents of the UDP segment, and a pseudo-header as defined in RFC768.
Returns:
The UDP checksum of the UDP segment in uip_buf and pointed to by uip_appdata.
Note:
Parameters:
@retvalThe UDP checksum is the Internet checksum of data contents of the UDP segment, and a pseudo-header as defined in RFC768.
Returns:
The UDP checksum of the UDP segment in uip_buf and pointed to by uip_appdata.

Definition at line 590 of file UIPEthernet.cpp.


Variable Documentation

u8_t uip_acc32[4]

4-byte array used for the 32-bit sequence number calculations.

Definition at line 202 of file uip.c.