Sergey Pastor / 1

Dependents:   Nucleo

Embed: (wiki syntax)

« Back to documentation index

net.h File Reference

net.h File Reference

TCP/IP stack core. More...

Go to the source code of this file.

Data Structures

struct  _NetInterface
 Structure describing a network interface. More...
struct  LinkChangeCallbackDesc
 Entry describing a user callback. More...

Typedefs

typedef void(* LinkChangeCallback )(NetInterface *interface, bool_t linkState, void *params)
 Link change callback.

Functions

error_t netInit (void)
 TCP/IP stack initialization.
error_t netSetMacAddr (NetInterface *interface, const MacAddr *macAddr)
 Set MAC address.
error_t netGetMacAddr (NetInterface *interface, MacAddr *macAddr)
 Retrieve MAC address.
error_t netSetEui64 (NetInterface *interface, const Eui64 *eui64)
 Set EUI-64 interface identifier.
error_t netGetEui64 (NetInterface *interface, Eui64 *eui64)
 Retrieve EUI-64 interface identifier.
error_t netSetInterfaceId (NetInterface *interface, uint32_t id)
 Set interface identifier.
error_t netSetInterfaceName (NetInterface *interface, const char_t *name)
 Set interface name.
error_t netSetHostname (NetInterface *interface, const char_t *name)
 Set host name.
error_t netSetProxy (NetInterface *interface, const char_t *name, uint16_t port)
 Set proxy server.
error_t netSetDriver (NetInterface *interface, const NicDriver *driver)
 Set Ethernet MAC driver.
error_t netSetPhyDriver (NetInterface *interface, const PhyDriver *driver)
 Set Ethernet PHY driver.
error_t netSetPhyAddr (NetInterface *interface, uint8_t phyAddr)
 Set Ethernet PHY address.
error_t netSetSpiDriver (NetInterface *interface, const SpiDriver *driver)
 Set SPI driver.
error_t netSetUartDriver (NetInterface *interface, const UartDriver *driver)
 Set UART driver.
error_t netSetExtIntDriver (NetInterface *interface, const ExtIntDriver *driver)
 Set external interrupt line driver.
error_t netSetLinkState (NetInterface *interface, NicLinkState linkState)
 Set link state (for virtual drivers only)
bool_t netGetLinkState (NetInterface *interface)
 Get link state.
error_t netConfigInterface (NetInterface *interface)
 Configure network interface.
void netTask (void)
 TCP/IP events handling.
void netTick (void)
 Manage TCP/IP timers.
NetInterface * netGetDefaultInterface (void)
 Get default network interface.
error_t netInitRand (uint32_t seed)
 Seed pseudo-random number generator.
uint32_t netGetRand (void)
 Get a random value.
int32_t netGetRandRange (int32_t min, int32_t max)
 Get a random value in the specified range.
error_t netAttachLinkChangeCallback (NetInterface *interface, LinkChangeCallback callback, void *params, uint_t *cookie)
 Register link change callback.
error_t netDetachLinkChangeCallback (uint_t cookie)
 Unregister link change callback.
void netInvokeLinkChangeCallback (NetInterface *interface, bool_t linkState)
 Invoke link change callback.

Detailed Description

TCP/IP stack core.

License

Copyright (C) 2010-2017 Oryx Embedded SARL. All rights reserved.

This file is part of CycloneTCP Open.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Author:
Oryx Embedded SARL (www.oryx-embedded.com)
Version:
1.7.6

Definition in file net.h.


Typedef Documentation

typedef void(* LinkChangeCallback)(NetInterface *interface, bool_t linkState, void *params)

Link change callback.

Definition at line 230 of file net.h.


Function Documentation

error_t netAttachLinkChangeCallback ( NetInterface *  interface,
LinkChangeCallback  callback,
void *  params,
uint_t *  cookie 
)

Register link change callback.

Parameters:
[in]interfaceUnderlying network interface
[in]callbackCallback function to be called when the link state changed
[in]paramsCallback function parameter (optional)
[out]cookieIdentifier that can be used to unregister the callback function
Returns:
Error code

Definition at line 1448 of file net.c.

error_t netConfigInterface ( NetInterface *  interface )

Configure network interface.

Parameters:
[in]interfaceNetwork interface to configure
Returns:
Error code

Definition at line 792 of file net.c.

error_t netDetachLinkChangeCallback ( uint_t  cookie )

Unregister link change callback.

Parameters:
[in]cookieIdentifier specifying the callback to be unregistered
Returns:
Error code

Definition at line 1497 of file net.c.

NetInterface* netGetDefaultInterface ( void   )

Get default network interface.

Returns:
Pointer to the default network interface to be used

Definition at line 1373 of file net.c.

error_t netGetEui64 ( NetInterface *  interface,
Eui64 *  eui64 
)

Retrieve EUI-64 interface identifier.

Parameters:
[in]interfacePointer to the desired network interface
[out]eui64Interface identifier
Returns:
Error code

Definition at line 404 of file net.c.

bool_t netGetLinkState ( NetInterface *  interface )

Get link state.

Parameters:
[in]interfacePointer to the desired network interface
Returns:
Link state

Definition at line 766 of file net.c.

error_t netGetMacAddr ( NetInterface *  interface,
MacAddr *  macAddr 
)

Retrieve MAC address.

Parameters:
[in]interfacePointer to the desired network interface
[out]macAddrMAC address
Returns:
Error code

Definition at line 352 of file net.c.

uint32_t netGetRand ( void   )

Get a random value.

Returns:
Error code

Definition at line 1401 of file net.c.

int32_t netGetRandRange ( int32_t  min,
int32_t  max 
)

Get a random value in the specified range.

Parameters:
[in]minLower bound
[in]maxUpper bound
Returns:
Random value in the specified range

Definition at line 1432 of file net.c.

error_t netInit ( void   )

TCP/IP stack initialization.

Returns:
Error code

Definition at line 103 of file net.c.

error_t netInitRand ( uint32_t  seed )

Seed pseudo-random number generator.

Parameters:
[in]seedAn integer value to be used as seed by the pseudo-random number generator
Returns:
Error code

Definition at line 1386 of file net.c.

void netInvokeLinkChangeCallback ( NetInterface *  interface,
bool_t  linkState 
)

Invoke link change callback.

Parameters:
[in]interfaceUnderlying network interface
[in]linkStateLink state

Definition at line 1521 of file net.c.

error_t netSetDriver ( NetInterface *  interface,
const NicDriver driver 
)

Set Ethernet MAC driver.

Parameters:
[in]interfacePointer to the desired network interface
[in]driverEthernet MAC driver
Returns:
Error code

Definition at line 551 of file net.c.

error_t netSetEui64 ( NetInterface *  interface,
const Eui64 *  eui64 
)

Set EUI-64 interface identifier.

Parameters:
[in]interfacePointer to the desired network interface
[in]eui64Interface identifier
Returns:
Error code

Definition at line 379 of file net.c.

error_t netSetExtIntDriver ( NetInterface *  interface,
const ExtIntDriver driver 
)

Set external interrupt line driver.

Parameters:
[in]interfacePointer to the desired network interface
[in]driverUnderlying SPI driver
Returns:
Error code

Definition at line 709 of file net.c.

error_t netSetHostname ( NetInterface *  interface,
const char_t *  name 
)

Set host name.

Parameters:
[in]interfacePointer to the desired network interface
[in]nameNULL-terminated string that contains the host name
Returns:
Error code

Definition at line 494 of file net.c.

error_t netSetInterfaceId ( NetInterface *  interface,
uint32_t  id 
)

Set interface identifier.

Parameters:
[in]interfacePointer to the desired network interface
[in]idUnique number identifying the interface
Returns:
Error code

Definition at line 429 of file net.c.

error_t netSetInterfaceName ( NetInterface *  interface,
const char_t *  name 
)

Set interface name.

Parameters:
[in]interfacePointer to the desired network interface
[in]nameNULL-terminated string that contains the interface name
Returns:
Error code

Definition at line 454 of file net.c.

error_t netSetLinkState ( NetInterface *  interface,
NicLinkState  linkState 
)

Set link state (for virtual drivers only)

Parameters:
[in]interfacePointer to the desired network interface
[in]linkStateLink state
Returns:
Error code

Definition at line 734 of file net.c.

error_t netSetMacAddr ( NetInterface *  interface,
const MacAddr *  macAddr 
)

Set MAC address.

Parameters:
[in]interfacePointer to the desired network interface
[in]macAddrMAC address
Returns:
Error code

Definition at line 316 of file net.c.

error_t netSetPhyAddr ( NetInterface *  interface,
uint8_t  phyAddr 
)

Set Ethernet PHY address.

Parameters:
[in]interfacePointer to the desired network interface
[in]phyAddrPHY address
Returns:
Error code

Definition at line 630 of file net.c.

error_t netSetPhyDriver ( NetInterface *  interface,
const PhyDriver driver 
)

Set Ethernet PHY driver.

Parameters:
[in]interfacePointer to the desired network interface
[in]driverEthernet PHY driver (can be NULL for MAC + PHY controller)
Returns:
Error code

Definition at line 605 of file net.c.

error_t netSetProxy ( NetInterface *  interface,
const char_t *  name,
uint16_t  port 
)

Set proxy server.

Parameters:
[in]interfacePointer to the desired network interface
[in]nameProxy server name
[in]portProxy server port
Returns:
Error code

Definition at line 522 of file net.c.

error_t netSetSpiDriver ( NetInterface *  interface,
const SpiDriver driver 
)

Set SPI driver.

Parameters:
[in]interfacePointer to the desired network interface
[in]driverUnderlying SPI driver
Returns:
Error code

Definition at line 659 of file net.c.

error_t netSetUartDriver ( NetInterface *  interface,
const UartDriver driver 
)

Set UART driver.

Parameters:
[in]interfacePointer to the desired network interface
[in]driverUnderlying UART driver
Returns:
Error code

Definition at line 684 of file net.c.

void netTask ( void   )

TCP/IP events handling.

Definition at line 946 of file net.c.

void netTick ( void   )

Manage TCP/IP timers.

Definition at line 1063 of file net.c.