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.
Files | |
file | slipdev.c |
SLIP protocol implementation. | |
file | slipdev.h |
SLIP header file. | |
Macros | |
#define | SLIP_END 0300 |
#define | SLIP_ESC 0333 |
#define | SLIP_ESC_END 0334 |
#define | SLIP_ESC_ESC 0335 |
Functions | |
uint8_t | slipdev_char_poll (uint8_t *c) |
Poll the serial device for a character. More... | |
void | slipdev_char_put (uint8_t c) |
Put a character on the serial device. More... | |
void | slipdev_init (void) |
Initialize the SLIP module. More... | |
uint16_t | slipdev_poll (void) |
Poll the SLIP device for an available packet. More... | |
uint8_t | slipdev_send (void) |
Send the packet in the uip_buf and uip_appdata buffers using the SLIP protocol. More... | |
Variables | |
static uint8_t | lastc |
static uint16_t | len |
static uint8_t | slip_buf [UIP_BUFSIZE] |
static uint16_t | tmplen |
#define SLIP_END 0300 |
Referenced by slipdev_poll(), and slipdev_send().
#define SLIP_ESC 0333 |
Referenced by slipdev_poll(), and slipdev_send().
#define SLIP_ESC_END 0334 |
Referenced by slipdev_poll(), and slipdev_send().
#define SLIP_ESC_ESC 0335 |
Referenced by slipdev_poll(), and slipdev_send().
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.
c | A pointer to a byte that is filled in by the function with the received character, if available. |
0 | If no character is available. |
Non-zero | If 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.
c | The character to be put on the serial device. |
Referenced by slipdev_send().
void slipdev_init | ( | void | ) |
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.
References c, lastc, len, slip_buf, SLIP_END, SLIP_ESC, SLIP_ESC_END, SLIP_ESC_ESC, slipdev_char_poll(), tmplen, uip_buf, 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.
References c, i, SLIP_END, SLIP_ESC, SLIP_ESC_END, SLIP_ESC_ESC, slipdev_char_put(), uip_appdata, uip_buf, uip_len, UIP_LLH_LEN, and UIP_TCPIP_HLEN.
|
static |
Referenced by slipdev_init(), and slipdev_poll().
|
static |
Referenced by _read(), _write(), cbcmac_calc(), cbcmac_verify(), crc16_data(), create(), dao_input(), decode_name(), dio_input(), get_match_length(), handle_incoming_rreq(), mdns_lookup(), mdns_query(), newdata(), packetbuf_compact(), packetbuf_copyfrom(), packetbuf_reference(), packetbuf_set_datalen(), parse(), parse_options(), PROCESS_THREAD(), PT_THREAD(), read(), remove_trailing_dots(), rf233_read(), rpl_set_prefix(), send_one_packet(), send_packet(), send_rreq(), senddata(), sensors_find(), slip_poll_handler(), slip_write(), slipdev_init(), slipdev_poll(), tcp_socket_send(), uip_packetqueue_set_buflen(), uip_udp_packet_send(), uiplib_ip6addrconv(), and uncompress_hdr_hc06().
|
static |
Referenced by slipdev_poll().
|
static |
Referenced by slipdev_poll().