weAut_01 / weAutSys    R 2.2.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines
Files | Functions | Variables
Architecture specific uIP functions and types
+ + uIP -- Adam Dunkels' TCP/IP stack + +

Overview

The functions in this architecture specific module mainly implement the IP checksum and 32-bit additions. They have to bridge the gap between big endian network byte order and little endian used in weAut_01's ATmel and most other architectures as well as the differences between normal arithmetic and internet / RFC (check) sum definitions.

The IP checksum calculation is the most computationally expensive operation in the TCP/IP stack and it therefore pays off to implement this as efficiently as the underlying architecture reasonably permits. Hence this is one of the fields where weAutSys' implementation significantly uses (GCC inline) ASM.

The type definitions in this module map uIP types to appropriate types of the architecture, runtime system and tool chain.

Files

file  uip_mess.h
 

weAutSys definition of system message texts for uIP


Functions

uint16_t chksum (uint16_t sum, const uint8_t *data, uint16_t len)
 Calculate the Internet checksum over a buffer.

Variables

char icmpNotIcmpEcho []
 icmp: not icmp echo. (in flash)
char icmpUnknownMess []
 icmp: unknown ICMP message. (in flash IPV6)
char ipBadCheckS []
 ip: bad checksum. (in flash)
char ipFragmDropp []
 ip: fragment dropped. (in flash)
char ipInvVersHeadL []
 ip: invalid version or header length. (in flash)
char ipNotTcpNorIcmp []
 ip: neither tcp nor icmp. (in flash)
char ipNotTcpNorIcmp6 []
 ip: neither tcp nor icmp6. (in flash IPV6)
char ipPackDroppSiAA []
 ip: packet dropped since no address assigned. (in flash)
char ipPackShorter []
 ip: packet shorter than reported in IP header. (in flash)
char ipPossPingConfR []
 ip: possible ping config packet received. (in flash)
char tcpBadCheckS []
 tcp: bad checksum. (in flash)
char tcpGotResetAbrt []
 tcp: got reset, aborting connection. (in flash)
char tcpNoUUsedCon []
 tcp: found no unused connections. (in flash)
char udpBadCheckS []
 udp: bad checksum. (in flash)
char udpNoMatchCon []
 udp: no connection matching (in flash)

Function Documentation

uint16_t chksum ( uint16_t  sum,
const uint8_t *  data,
uint16_t  len 
)

Calculate the Internet checksum over a buffer.

This function adds the sum of all all 16-bit words in the buffer data to the parameter sum and returns the result.

sum and the returned result are in architecture byte order, being little endian (intel, ATmega, weAutSys — Automation runtime system weAut_01).

The 16 bit words in the buffer on the other hand are big endian. If len is odd the last byte in the buffer data is hence the high byte of word with an imaginary low byte 0x00.

Another peculiarity of this type of unsigned checksum is the feeding back of a carry out of any 16 bit addition step.

This characteristics are adversarial to higher programming languages even to C. For weAutSys this function is significantly improved by inline assembler.

Parameters:
sumthe checksum's start value
dataa pointer to the buffer over which the checksum is to be computed
lenthe length of the buffer
Returns:
the checksum