Contiki 2.6

Serial Line IP (SLIP) protocol

The SLIP protocol is a very simple way to transmit IP packets over a serial line. More...

Files

file  slipdev.c
 

SLIP protocol implementation.


file  slipdev.h
 

SLIP header file.


Functions

uint8_t slipdev_send (void)
 Send the packet in the uip_buf and uip_appdata buffers using the SLIP protocol.
uint16_t slipdev_poll (void)
 Poll the SLIP device for an available packet.
void slipdev_init (void)
 Initialize the SLIP module.
void slipdev_char_put (uint8_t c)
 Put a character on the serial device.
uint8_t slipdev_char_poll (uint8_t *c)
 Poll the serial device for a character.

Detailed Description

The SLIP protocol is a very simple way to transmit IP packets over a serial line.

It does not provide any framing or error control, and is therefore not very widely used today.

This SLIP implementation requires two functions for accessing the serial device: slipdev_char_poll() and slipdev_char_put(). These must be implemented specifically for the system on which the SLIP protocol is to be run.


Function Documentation

uint8_t slipdev_char_poll ( uint8_t *  c)

Poll the serial device for a character.

This function is used by the SLIP implementation to poll the serial device for a character. It must be implemented specifically for the system on which the SLIP implementation is to be run.

The function should return immediately regardless if a character is available or not. If a character is available it should be placed at the memory location pointed to by the pointer supplied by the argument c.

Parameters:
cA pointer to a byte that is filled in by the function with the received character, if available.
Return values:
0If no character is available.
Non-zeroIf a character is available.

Referenced by slipdev_poll().

void slipdev_char_put ( uint8_t  c)

Put a character on the serial device.

This function is used by the SLIP implementation to put a character on the serial device. It must be implemented specifically for the system on which the SLIP implementation is to be run.

Parameters:
cThe character to be put on the serial device.

Referenced by slipdev_send().

void slipdev_init ( void  )

Initialize the SLIP module.

This function does not initialize the underlying RS232 device, but only the SLIP part.

Definition at line 201 of file slipdev.c.

uint16_t slipdev_poll ( void  )

Poll the SLIP device for an available packet.

This function will poll the SLIP device to see if a packet is available. It uses a buffer in which all avaliable bytes from the RS232 interface are read into. When a full packet has been read into the buffer, the packet is copied into the uip_buf buffer and the length of the packet is returned.

Returns:
The length of the packet placed in the uip_buf buffer, or zero if no packet is available.

Definition at line 144 of file slipdev.c.

References slipdev_char_poll(), UIP_BUFSIZE, and UIP_LLH_LEN.

uint8_t slipdev_send ( void  )

Send the packet in the uip_buf and uip_appdata buffers using the SLIP protocol.

The first 40 bytes of the packet (the IP and TCP headers) are read from the uip_buf buffer, and the following bytes (the application data) are read from the uip_appdata buffer.

Returns:
This function will always return UIP_FW_OK.

Definition at line 97 of file slipdev.c.

References slipdev_char_put(), uip_appdata, UIP_FW_OK, uip_len, and UIP_LLH_LEN.