Network Component  Version 7.3
MDK Middleware for IPv4 and IPv6 Networking
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
System Functions (User)

Core system functions to be called by user. More...

Functions

netStatus netInitialize (void)
 Initialize Network Component, resources and interfaces. [not_thread-safe]. More...
 
const char * netSYS_GetHostName (void)
 Retrieve localhost name. [thread-safe]. More...
 
netStatus netSYS_SetHostName (const char *hostname)
 Set localhost name. [thread-safe]. More...
 

Description

Core system functions to be called by user.

System Functions represent the core of the protocol stack. They form an operating system that calls all other protocol module functions. The functions require a CMSIS-RTOS compatible RTOS to run and are not reentrant.

The functions are part of the Network Component library and are defined in rl_net.h.

Function Documentation

netStatus netInitialize ( void  )

Initialize Network Component, resources and interfaces. [not_thread-safe].

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

The function netInitialize initializes the Network Core's system resources, protocols, threads and applications.

Note
You must call the function at system start-up to properly initialize the networking environment.

Code Example

int main (void) {
init_hal ();
// Initialize the Network Core
..
}
const char * netSYS_GetHostName ( void  )

Retrieve localhost name. [thread-safe].

Returns
pointer to localhost name, a null-terminated string.

The function netSYS_GetHostName returns the name of the local host. The name is set with NET_HOST_NAME in the Net_Config.c, and can be changed at runtime.

Code Example

printf ("Localhost name is %s\n", netSYS_GetHostName ());
netStatus netSYS_SetHostName ( const char *  hostname)

Set localhost name. [thread-safe].

Parameters
[in]hostnamenew localhost name, a null-terminated string.
Returns
status code that indicates the execution status of the function as defined with netStatus.

The function netSYS_SetHostName sets the name of the local host. Default name is set with NET_HOST_NAME in the Net_Config.c, and can be changed at runtime.

The argument hostname is a pointer to the localhost name that is to be set, which is a null-terminated string. The function copies the content of the hostname to the localhost name. The maximum length of the hostname string is limited to 15 characters.

Note
When the function ends, the content of hostname becomes irrelevant and may be discarded.

Code Example

netSYS_SetHostName ("MCB1800");
printf ("Localhost name is %s\n", netSYS_GetHostName ());