Dependents:
Nucleo
« Back to documentation index
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] interface Underlying network interface
[in] callback Callback function to be called when the link state changed
[in] params Callback function parameter (optional)
[out] cookie Identifier 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] interface Network 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] cookie Identifier 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] interface Pointer to the desired network interface
[out] eui64 Interface identifier
Returns: Error code
Definition at line 404 of file net.c .
bool_t netGetLinkState
(
NetInterface *
interface )
Get link state.
Parameters:
[in] interface Pointer 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] interface Pointer to the desired network interface
[out] macAddr MAC 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] min Lower bound
[in] max Upper bound
Returns: Random value in the specified range
Definition at line 1432 of file net.c .
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] seed An 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] interface Underlying network interface
[in] linkState Link state
Definition at line 1521 of file net.c .
Set Ethernet MAC driver.
Parameters:
[in] interface Pointer to the desired network interface
[in] driver Ethernet 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] interface Pointer to the desired network interface
[in] eui64 Interface identifier
Returns: Error code
Definition at line 379 of file net.c .
Set external interrupt line driver.
Parameters:
[in] interface Pointer to the desired network interface
[in] driver Underlying 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] interface Pointer to the desired network interface
[in] name NULL-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] interface Pointer to the desired network interface
[in] id Unique 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] interface Pointer to the desired network interface
[in] name NULL-terminated string that contains the interface name
Returns: Error code
Definition at line 454 of file net.c .
Set link state (for virtual drivers only)
Parameters:
[in] interface Pointer to the desired network interface
[in] linkState Link 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] interface Pointer to the desired network interface
[in] macAddr MAC 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] interface Pointer to the desired network interface
[in] phyAddr PHY address
Returns: Error code
Definition at line 630 of file net.c .
Set Ethernet PHY driver.
Parameters:
[in] interface Pointer to the desired network interface
[in] driver Ethernet 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] interface Pointer to the desired network interface
[in] name Proxy server name
[in] port Proxy server port
Returns: Error code
Definition at line 522 of file net.c .
Set SPI driver.
Parameters:
[in] interface Pointer to the desired network interface
[in] driver Underlying SPI driver
Returns: Error code
Definition at line 659 of file net.c .
Set UART driver.
Parameters:
[in] interface Pointer to the desired network interface
[in] driver Underlying UART driver
Returns: Error code
Definition at line 684 of file net.c .
TCP/IP events handling.
Definition at line 946 of file net.c .
Manage TCP/IP timers.
Definition at line 1063 of file net.c .