clientconnection.h

// SPDX-License-Identifier: MIT

safuResultE_t elosClientConnectionDeleteMembers(elosClientConnection_t *clientConnection)
[source]

Frees all resources used be the given ClientConnection. Will also automatically Stop an active worker thread before freeing up the resources.

Parameters:
  • clientConnection – The ClientConnection to be freed

Returns:

  • SAFU_RESULT_FAILED on error

  • SAFU_RESULT_OK on success

safuResultE_t elosClientConnectionInitialize(elosClientConnection_t *clientConnection, elosClientConnectionSharedData_t *sharedData)
[source]

Initializes a new ClientConnection.

Parameters:
  • clientConnection – ClientConnection structure that will be initialized

  • sharedData – Reference to shared data of all connecitons.

Returns:

  • SAFU_RESULT_FAILED on error

  • SAFU_RESULT_OK on success

safuResultE_t elosClientConnectionIsActive(elosClientConnection_t *clientConnection, bool *active)
[source]

Checks if the given ClientConnection has been started or not.

Parameters:
  • clientConnection – The ClientConnection to be checked

  • active – set to ‘true’ if a connection is active/started, ‘false’ otherwise.

Returns:

  • SAFU_RESULT_FAILED on error

  • SAFU_RESULT_OK on success

safuResultE_t elosClientConnectionStart(elosClientConnection_t *clientConnection, int socketFd)
[source]

Creates a worker thread using the given socketFd for communication. Each ClientConnection can only handle one worker thread, calling Start a second time will result in an error.

Parameters:
  • clientConnection – The ClientConnection to be started

  • socketFd – The socketFd that shall be used for communication

Returns:

  • SAFU_RESULT_FAILED on error

  • SAFU_RESULT_OK on success

safuResultE_t elosClientConnectionStop(elosClientConnection_t *clientConnection)
[source]

Stops the currently active worker thread. Start can be called again with a new socketFd after a ClientConnection has been stopped.

Parameters:
  • clientConnection – The ClientConnection to be stopped

Returns:

  • SAFU_RESULT_FAILED on error

  • SAFU_RESULT_OK on success

void *elosClientConnectionWorker(void *ptr)
[source]

Worker thread function used by pthread_create()

Parameters:
  • ptr – Pointer to a ClientConnection struct

Returns:

  • Always NULL