libiec61850  1.2.0
Typedefs | Functions
Direct access to the ethernet layer (optional - required by GOOSE and Sampled Values)

Typedefs

typedef struct sEthernetSocket * EthernetSocket
 Opaque handle that represents an Ethernet "socket". More...
 
typedef struct sEthernetHandleSet * EthernetHandleSet
 

Functions

EthernetHandleSet EthernetHandleSet_new (void)
 Create a new connection handle set (EthernetHandleSet) More...
 
void EthernetHandleSet_addSocket (EthernetHandleSet self, const EthernetSocket sock)
 add a socket to an existing handle set More...
 
void EthernetHandleSet_removeSocket (EthernetHandleSet self, const EthernetSocket sock)
 remove a socket from an existing handle set More...
 
int EthernetHandleSet_waitReady (EthernetHandleSet self, unsigned int timeoutMs)
 wait for a socket to become ready More...
 
void EthernetHandleSet_destroy (EthernetHandleSet self)
 destroy the EthernetHandleSet instance More...
 
void Ethernet_getInterfaceMACAddress (const char *interfaceId, uint8_t *addr)
 Return the MAC address of an Ethernet interface. More...
 
EthernetSocket Ethernet_createSocket (const char *interfaceId, uint8_t *destAddress)
 Create an Ethernet socket using the specified interface and destination MAC address. More...
 
void Ethernet_destroySocket (EthernetSocket ethSocket)
 destroy the ethernet socket More...
 
void Ethernet_sendPacket (EthernetSocket ethSocket, uint8_t *buffer, int packetSize)
 
void Ethernet_setProtocolFilter (EthernetSocket ethSocket, uint16_t etherType)
 
int Ethernet_receivePacket (EthernetSocket ethSocket, uint8_t *buffer, int bufferSize)
 receive an ethernet packet (non-blocking) More...
 
bool Ethernet_isSupported (void)
 Indicates if runtime provides support for direct Ethernet access. More...
 

Detailed Description

Typedef Documentation

typedef struct sEthernetHandleSet* EthernetHandleSet

Opaque reference for a set of ethernet socket handles

typedef struct sEthernetSocket* EthernetSocket

Opaque handle that represents an Ethernet "socket".

Function Documentation

EthernetSocket Ethernet_createSocket ( const char *  interfaceId,
uint8_t *  destAddress 
)

Create an Ethernet socket using the specified interface and destination MAC address.

Parameters
interfaceIdthe ID of the Ethernet interface
destAddressbyte array that contains the Ethernet MAC address
void Ethernet_destroySocket ( EthernetSocket  ethSocket)

destroy the ethernet socket

Parameters
ethSocketthe ethernet socket handle
void Ethernet_getInterfaceMACAddress ( const char *  interfaceId,
uint8_t *  addr 
)

Return the MAC address of an Ethernet interface.

The result are the six bytes that make up the Ethernet MAC address.

Parameters
interfaceIdthe ID of the Ethernet interface
addrpointer to a buffer to store the MAC address
bool Ethernet_isSupported ( void  )

Indicates if runtime provides support for direct Ethernet access.

Returns
true if Ethernet support is available, false otherwise
int Ethernet_receivePacket ( EthernetSocket  ethSocket,
uint8_t *  buffer,
int  bufferSize 
)

receive an ethernet packet (non-blocking)

Parameters
ethSocketthe ethernet socket handle
bufferthe buffer to copy the message to
themaximum size of the buffer
Returns
size of message received in bytes
void Ethernet_sendPacket ( EthernetSocket  ethSocket,
uint8_t *  buffer,
int  packetSize 
)
void Ethernet_setProtocolFilter ( EthernetSocket  ethSocket,
uint16_t  etherType 
)
void EthernetHandleSet_addSocket ( EthernetHandleSet  self,
const EthernetSocket  sock 
)

add a socket to an existing handle set

Parameters
selfthe HandleSet instance
sockthe socket to add
void EthernetHandleSet_destroy ( EthernetHandleSet  self)

destroy the EthernetHandleSet instance

Parameters
selfthe HandleSet instance to destroy
EthernetHandleSet EthernetHandleSet_new ( void  )

Create a new connection handle set (EthernetHandleSet)

Returns
new EthernetHandleSet instance
void EthernetHandleSet_removeSocket ( EthernetHandleSet  self,
const EthernetSocket  sock 
)

remove a socket from an existing handle set

Parameters
selfthe HandleSet instance
sockthe socket to add
int EthernetHandleSet_waitReady ( EthernetHandleSet  self,
unsigned int  timeoutMs 
)

wait for a socket to become ready

This function is corresponding to the BSD socket select function. The function will return after timeoutMs ms if no data is pending.

Parameters
selfthe HandleSet instance
timeoutin milliseconds (ms)
Returns
It returns the number of sockets on which data is pending or 0 if no data is pending on any of the monitored connections. The function shall return -1 if a socket error occures.