Network Component  Version 6.6
MDK-Professional Middleware for IP Networking
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Serial Line Internet Protocol (SLIP)

SLIP routines enable IP communication over a serial line. More...

Functions

netStatus slip_close (void)
 Disconnect SLIP link between two modems.
 
netStatus slip_connect (const char *dial_num)
 Start a dial-up connection to remote SLIP server.
 
netStatus slip_listen (void)
 Start SLIP interface to accept incoming SLIP connections.
 
bool slip_is_up (void)
 Determine the state of SLIP link.
 

Description

SLIP routines enable IP communication over a serial line.

The Serial Line Internet Protocol (SLIP) is an encapsulation of the Internet Protocol designed to work over serial ports and modem connections. SLIP has been largely replaced by the Point-to-Point Protocol (PPP), which has more features and does not require a predefined IP address configuration. However, embedded applications running on microcontrollers are still using SLIP for encapsulating IP packets due to its very small overhead.

Standard TCP/IP datagrams are modified by adding a special "SLIP END" character to them, for distinguishing datagram boundaries in the binary data stream. To make use of SLIP, the UART has to be configured to 8 data bits, no parity, and either hardware flow control, or 3-wire null-modem settings.

Note
  • As SLIP does not provide error detection, it is not recommended for error-prone dial-up connections.
  • For more information about the configuration please visit the Serial Line Internet Protocol (SLIP) page.

Function Documentation

netStatus slip_close ( void  )

Disconnect SLIP link between two modems.

Returns
status code that indicates the execution status of the function as defined with netStatus.

The function slip_close disconnects the SLIP link between the two modems.

Note
  • You can call the slip_close function when the SLIP network daemon is either in client mode or in server mode.
  • Since the SLIP client starts a dial-up connection, it is also the SLIP client that usually disconnects the SLIP link.
  • The slip_close function does not change the running mode of the SLIP daemon. If the SLIP daemon was in server mode, SLIP daemon re-initializes the modem driver to accept further incoming calls.

Code Example

void disconnect_link (void) {
// Disconnect a dial-up link.
}
netStatus slip_connect ( const char *  dial_num)

Start a dial-up connection to remote SLIP server.

Parameters
[in]dial_numphone number of remote SLIP server.
Returns
status code that indicates the execution status of the function as defined with netStatus.
Note
Parameter is null-terminated string.

The function slip_connect starts a dial-up connection to the remote SLIP server by starting the SLIP daemon in client mode.

The argument dial_num points to a NULL-terminated ASCII string containing the phone number of the remote SLIP server.

Note
  • You must call the slip_connect function when you want to establish a dial-up connection using SLIP.
  • When using a direct cable connection, you can set dial_num to NULL because the Null_Modem device driver ignores dial_num.

Code Example

void dial_remote (void) {
// Dial remote SLIP Server.
slip_connect ("04213372");
}
bool slip_is_up ( void  )

Determine the state of SLIP link.

Returns
link state:
  • true = Link is up, IP frames can be exchanged.
  • false = Link is down.

The function slip_is_up determines the state of SLIP link between the two modems. It returns true if IP frames can be exchanged over the SLIP link.

Note
  • You can call the slip_is_up function when the SLIP network daemon is either in client mode or in server mode.
  • You can also use the slip_is_up function to continuously monitor the state of the SLIP link.

Code Example

void connect_soc (void) {
// Connect TCP socket when SLIP is up.
if(slip_is_up()) {
tcp_connect (socket_tcp, remip, 1000, 0);
}
}
netStatus slip_listen ( void  )

Start SLIP interface to accept incoming SLIP connections.

Returns
status code that indicates the execution status of the function as defined with netStatus.

The function slip_listen configures the SLIP interface to accept incoming SLIP connections by starting the SLIP daemon in server mode.

Note
It is common to call the slip_listen function at system start-up.

Code Example

void main (void) {
// Activate the SLIP interface.
while (1) {
}
}