/**
 * \brief TCP/IPv4/ethernet/LAN communication
 * \copyright 2013-2014, IQ² Development GmbH, Neckartenzlingen. All rights reserved.
 */

#ifndef _iqi_ethernet_h
#define _iqi_ethernet_h

#include "iqi_define.h" 

/**
 * \brief Starts up TCP/IPv4/ethernet/LAN (winsock2 library)
 *  This call is necessary before first usage of ethernet communication
 * \param[out]  cpErrMsg an error message (minimum 256 symbols!)
 * \return ERR_NONE or error code
 */
DLL_API
int16 enet_Startup(char08 * cpErrMsg);

/**
 * \brief Free TCP/IPv4/ethernet/LAN system resources (winsock2 library)
 * \param[out]  cpErrMsg an error message (minimum 256 symbols!)
 * \return ERR_NONE or error code
 */
DLL_API
int16 enet_Cleanup(char08 * cpErrMsg);

/**
 * \brief Search iqInterface in all availiable IPv4 networks
 *  
 *  Takes time, used, if ip address of iqInterface is unknown,
 *  sends UDP broadcast message to the port 30718.
 *
 * \param[out]  pFoundConnections         buffer to return found TCP/IPv4 connections with iqInterface
 * \param[in]   ucMaxConnectionsNumber    size of foundConnections buffer
 * \param[out]  ucpFoundConnectionsNumber number of found connections returned in foundConnections buffer
 * \param[in]   uiSendRecvTimoutMs        send/receive timeout for UDP broadcast and TCP/IPv4 connection
 * \param[out]  cpErrMsg                  an error message (minimum 256 symbols!)
 *
 * \return error or ERR_NONE, 
 *         found TCP/IPv4 connections with iqInterface in foundConnections buffer
 *         and their number in ucpFoundConnectionsNumber
 */
DLL_API
int16 enet_Search(enet_ConnectionT * pFoundConnections, 
                  uchar08 ucMaxConnectionsNumber, 
                  uchar08 * ucpFoundConnectionsNumber,
                  uint16 uiSendRecvTimoutMs, 
                  char08 *cpErrMsg);

#endif
