libIEC61850
Open-source IEC 61850 MMS server and client library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Typedefs | Functions
Hardware/OS abstraction layer

Typedefs

typedef struct sServerSocket * ServerSocket
 
typedef struct sSocket * Socket
 
typedef struct sThread * Thread
 
typedef void *(* ThreadExecutionFunction )(void *)
 

Functions

ServerSocket TcpServerSocket_create (char *address, int port)
 
void ServerSocket_listen (ServerSocket socket)
 
Socket ServerSocket_accept (ServerSocket socket)
 
void ServerSocket_setBacklog (ServerSocket socket, int backlog)
 
void ServerSocket_destroy (ServerSocket socket)
 
Socket TcpSocket_create ()
 
int Socket_connect (Socket socket, char *address, int port)
 
int Socket_read (Socket socket, uint8_t *buf, int size)
 
int Socket_write (Socket socket, uint8_t *buf, int size)
 
void Socket_destroy (Socket socket)
 
Thread Thread_create (ThreadExecutionFunction function, void *parameter, bool autodestroy)
 
void Thread_start (Thread thread)
 
void Thread_destroy (Thread thread)
 
void Thread_sleep (int millies)
 
uint64_t Hal_getTimeInMs ()
 

Detailed Description

Thread and Socket abstraction layer. This functions have to be implemented to port libIEC61850 to a new hardware/OS platform.

Typedef Documentation

typedef struct sServerSocket* ServerSocket

Opaque reference for a server socket instance

typedef struct sSocket* Socket

Opaque reference for a client or connection socket instance

typedef struct sThread* Thread

Opaque reference for a Thread instance

typedef void*(* ThreadExecutionFunction)(void *)

Reference to a function that is called when starting the thread

Function Documentation

uint64_t Hal_getTimeInMs ( )

Get the system time in milliseconds

Socket ServerSocket_accept ( ServerSocket  socket)
void ServerSocket_destroy ( ServerSocket  socket)
void ServerSocket_listen ( ServerSocket  socket)
void ServerSocket_setBacklog ( ServerSocket  socket,
int  backlog 
)
int Socket_connect ( Socket  socket,
char *  address,
int  port 
)
void Socket_destroy ( Socket  socket)
int Socket_read ( Socket  socket,
uint8_t *  buf,
int  size 
)
int Socket_write ( Socket  socket,
uint8_t *  buf,
int  size 
)
ServerSocket TcpServerSocket_create ( char *  address,
int  port 
)

Create a new TcpServerSocket instance

Parameters
addressip address or hostname to listen on
portthe TCP port to listen on
Returns
the newly create TcpServerSocket instance
Socket TcpSocket_create ( )
Thread Thread_create ( ThreadExecutionFunction  function,
void *  parameter,
bool  autodestroy 
)

Create a new Thread instance

Parameters
functionthe entry point of the thread
parametera parameter that is passed to the threads start function
autodestroythe thread is automatically destroyed if the ThreadExecutionFunction has finished.
Returns
the newly created Thread instance
void Thread_destroy ( Thread  thread)

Destroy a Thread and free resources.

Parameters
threadthe Thread instance to destroy
void Thread_sleep ( int  millies)

Suspend execution of the Thread for the specified number of milliseconds

void Thread_start ( Thread  thread)

Start a Thread.

This function invokes the start function of the thread. The thread terminates when the start function returns.

Parameters
threadthe Thread instance to start