Amazon Kinesis Webrtc C SDK
Loading...
Searching...
No Matches
LwsApiCalls.c File Reference
#include "../Include_i.h"
#include <libwebsockets.h>
#include "Signaling.h"
#include "LwsApiCalls.h"
Include dependency graph for LwsApiCalls.c:

Macros

#define LOG_CLASS   "LwsApiCalls"
#define WEBRTC_SCHEME_NAME   "webrtc"

Functions

VOID lwsSignalHandler (INT32 signal)
INT32 lwsHttpCallbackRoutine (PVOID wsi, INT32 reason, PVOID user, PVOID pDataIn, size_t dataSize)
INT32 lwsWssCallbackRoutine (PVOID wsi, INT32 reason, PVOID user, PVOID pDataIn, size_t dataSize)
STATUS lwsCompleteSync (PLwsCallInfo pCallInfo)
BOOL isCallResultSignatureExpired (PCallInfo pCallInfo)
BOOL isCallResultSignatureNotYetCurrent (PCallInfo pCallInfo)
INT64 recordClockSkewCorrection (PSignalingClient pSignalingClient, UINT64 serverTime, UINT64 nowTime)
STATUS checkAndCorrectForClockSkew (PSignalingClient pSignalingClient, PRequestInfo pRequestInfo)
SERVICE_CALL_RESULT getWssUpgradeFailureResult (PSignalingClient pSignalingClient, PVOID wsi)
STATUS describeChannelLws (PSignalingClient pSignalingClient, UINT64 time)
STATUS createChannelLws (PSignalingClient pSignalingClient, UINT64 time)
STATUS getChannelEndpointLws (PSignalingClient pSignalingClient, UINT64 time)
STATUS getIceConfigLws (PSignalingClient pSignalingClient, UINT64 time)
STATUS parseIceConfigResponse (PCHAR pResponseStr, UINT32 responseLen, UINT8 maxIceConfigs, PIceConfigInfo pIceConfigs, PUINT32 pIceConfigCount)
STATUS deleteChannelLws (PSignalingClient pSignalingClient, UINT64 time)
STATUS createLwsCallInfo (PSignalingClient pSignalingClient, PRequestInfo pRequestInfo, UINT32 protocolIndex, PLwsCallInfo *ppLwsCallInfo)
STATUS freeLwsCallInfo (PLwsCallInfo *ppLwsCallInfo)
STATUS connectSignalingChannelLws (PSignalingClient pSignalingClient, UINT64 time)
STATUS joinStorageSessionLws (PSignalingClient pSignalingClient, UINT64 time)
STATUS describeMediaStorageConfLws (PSignalingClient pSignalingClient, UINT64 time)
PVOID lwsListenerHandler (PVOID args)
STATUS startReconnectHandler (PSignalingClient pSignalingClient)
PVOID reconnectHandler (PVOID args)
STATUS sendLwsMessage (PSignalingClient pSignalingClient, SIGNALING_MESSAGE_TYPE messageType, PCHAR peerClientId, PCHAR pMessage, UINT32 messageLen, PCHAR pCorrelationId, UINT32 correlationIdLen)
STATUS writeLwsData (PSignalingClient pSignalingClient, BOOL awaitForResponse)
STATUS parseSignalingMessage (PCHAR pMessage, UINT32 messageLen, PReceivedSignalingMessage pReceivedSignalingMessage)
STATUS receiveLwsMessage (PSignalingClient pSignalingClient, PCHAR pMessage, UINT32 messageLen)
STATUS terminateConnectionWithStatus (PSignalingClient pSignalingClient, SERVICE_CALL_RESULT callResult)
STATUS getMessageTypeFromString (PCHAR typeStr, UINT32 typeLen, SIGNALING_MESSAGE_TYPE *pMessageType)
PCHAR getMessageTypeInString (SIGNALING_MESSAGE_TYPE messageType)
STATUS terminateLwsListenerLoop (PSignalingClient pSignalingClient)
PVOID receiveLwsMessageWrapper (PVOID args)
STATUS wakeLwsServiceEventLoop (PSignalingClient pSignalingClient, UINT32 protocolIndex)
STATUS configureLwsLogging (UINT32 kvsLogLevel)

Macro Definition Documentation

◆ LOG_CLASS

#define LOG_CLASS   "LwsApiCalls"

Implementation of a API calls based on LibWebSocket

◆ WEBRTC_SCHEME_NAME

#define WEBRTC_SCHEME_NAME   "webrtc"

Function Documentation

◆ checkAndCorrectForClockSkew()

STATUS checkAndCorrectForClockSkew ( PSignalingClient pSignalingClient,
PRequestInfo pRequestInfo )
Here is the caller graph for this function:

◆ configureLwsLogging()

STATUS configureLwsLogging ( UINT32 kvsLogLevel)
Here is the caller graph for this function:

◆ connectSignalingChannelLws()

STATUS connectSignalingChannelLws ( PSignalingClient pSignalingClient,
UINT64 time )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ createChannelLws()

STATUS createChannelLws ( PSignalingClient pSignalingClient,
UINT64 time )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ createLwsCallInfo()

STATUS createLwsCallInfo ( PSignalingClient pSignalingClient,
PRequestInfo pRequestInfo,
UINT32 protocolIndex,
PLwsCallInfo * ppLwsCallInfo )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ deleteChannelLws()

STATUS deleteChannelLws ( PSignalingClient pSignalingClient,
UINT64 time )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ describeChannelLws()

STATUS describeChannelLws ( PSignalingClient pSignalingClient,
UINT64 time )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ describeMediaStorageConfLws()

STATUS describeMediaStorageConfLws ( PSignalingClient pSignalingClient,
UINT64 time )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freeLwsCallInfo()

STATUS freeLwsCallInfo ( PLwsCallInfo * ppLwsCallInfo)
Here is the caller graph for this function:

◆ getChannelEndpointLws()

STATUS getChannelEndpointLws ( PSignalingClient pSignalingClient,
UINT64 time )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getIceConfigLws()

STATUS getIceConfigLws ( PSignalingClient pSignalingClient,
UINT64 time )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getMessageTypeFromString()

STATUS getMessageTypeFromString ( PCHAR typeStr,
UINT32 typeLen,
SIGNALING_MESSAGE_TYPE * pMessageType )
Here is the caller graph for this function:

◆ getMessageTypeInString()

PCHAR getMessageTypeInString ( SIGNALING_MESSAGE_TYPE messageType)
Here is the caller graph for this function:

◆ getWssUpgradeFailureResult()

SERVICE_CALL_RESULT getWssUpgradeFailureResult ( PSignalingClient pSignalingClient,
PVOID wsi )

Maps a failed WSS upgrade to a service call result. lws keeps the response headers attached until after the connection error callback, so a 401/403 can be checked against its Date header: when the upgrade was signed with a stale clock skew correction, the measured one is recorded and the connect is retried in place.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isCallResultSignatureExpired()

BOOL isCallResultSignatureExpired ( PCallInfo pCallInfo)
Here is the caller graph for this function:

◆ isCallResultSignatureNotYetCurrent()

BOOL isCallResultSignatureNotYetCurrent ( PCallInfo pCallInfo)
Here is the caller graph for this function:

◆ joinStorageSessionLws()

STATUS joinStorageSessionLws ( PSignalingClient pSignalingClient,
UINT64 time )

< TBD. Accroding to the design document, the prefix of url will be webrtc://

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lwsCompleteSync()

STATUS lwsCompleteSync ( PLwsCallInfo pCallInfo)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lwsHttpCallbackRoutine()

INT32 lwsHttpCallbackRoutine ( PVOID wsi,
INT32 reason,
PVOID user,
PVOID pDataIn,
size_t dataSize )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lwsListenerHandler()

PVOID lwsListenerHandler ( PVOID args)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lwsSignalHandler()

VOID lwsSignalHandler ( INT32 signal)

◆ lwsWssCallbackRoutine()

INT32 lwsWssCallbackRoutine ( PVOID wsi,
INT32 reason,
PVOID user,
PVOID pDataIn,
size_t dataSize )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ parseIceConfigResponse()

STATUS parseIceConfigResponse ( PCHAR pResponseStr,
UINT32 responseLen,
UINT8 maxIceConfigs,
PIceConfigInfo pIceConfigs,
PUINT32 pIceConfigCount )

Parses ICE configuration from a JSON response string. If there are more ICE configurations in the string than maxIceConfigs, we will only parse up until maxIceConfigs.

Parameters
[in]pResponseStrJSON string containing ICE server configuration.
[in]responseLenLength of the JSON string (excluding null-terminator).
[in]maxIceConfigsMaximum number of ICE configurations the array can hold.
[out]pIceConfigsPointer to array of IceConfigInfo structures to be populated.
[out]pIceConfigCountPointer to receive the number of ICE configurations parsed.
Returns
STATUS code of the execution:
  • STATUS_SUCCESS: Successfully parsed ICE configuration.
  • STATUS_NULL_ARG: Invalid NULL argument provided.
  • STATUS_INVALID_API_CALL_RETURN_JSON: Malformed JSON or missing required fields.
  • STATUS_SIGNALING_MAX_ICE_URI_COUNT: Too many URIs in configuration (more than MAX_ICE_CONFIG_URI_COUNT).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ parseSignalingMessage()

STATUS parseSignalingMessage ( PCHAR pMessage,
UINT32 messageLen,
PReceivedSignalingMessage pReceivedSignalingMessage )

Parses the signaling message from a JSON response string. The payload is base64-decoded in the output. See Asynchronous message reception.

Parameters
[in]pMessageJSON of the signaling message.
[in]messageLenLength of the JSON string (excluding null-terminator).
[out]pReceivedSignalingMessagePointer to receive the parsed signaling message.
Returns
STATUS code of the execution:
  • STATUS_SUCCESS: Successfully parsed ICE configuration.
  • STATUS_NULL_ARG: Invalid NULL argument provided.
  • STATUS_SIGNALING_INVALID_MESSAGE_TYPE: If the required field 'messageType' is missing for non error response messages.
  • STATUS_INVALID_API_CALL_RETURN_JSON: Malformed JSON or missing other required fields.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ receiveLwsMessage()

STATUS receiveLwsMessage ( PSignalingClient pSignalingClient,
PCHAR pMessage,
UINT32 messageLen )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ receiveLwsMessageWrapper()

PVOID receiveLwsMessageWrapper ( PVOID args)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ reconnectHandler()

PVOID reconnectHandler ( PVOID args)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ recordClockSkewCorrection()

INT64 recordClockSkewCorrection ( PSignalingClient pSignalingClient,
UINT64 serverTime,
UINT64 nowTime )

Records the clock skew measured from a response Date header as the correction for all later requests. The measurement is always against the raw device time, so a device clock that gets fixed resets it to 0.

Returns how far off the signing time of the last signed request was. Beyond MIN_CLOCK_SKEW_TIME_TO_CORRECT, re-signing that request with the new correction can succeed.

Here is the caller graph for this function:

◆ sendLwsMessage()

STATUS sendLwsMessage ( PSignalingClient pSignalingClient,
SIGNALING_MESSAGE_TYPE messageType,
PCHAR peerClientId,
PCHAR pMessage,
UINT32 messageLen,
PCHAR pCorrelationId,
UINT32 correlationIdLen )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ startReconnectHandler()

STATUS startReconnectHandler ( PSignalingClient pSignalingClient)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ terminateConnectionWithStatus()

STATUS terminateConnectionWithStatus ( PSignalingClient pSignalingClient,
SERVICE_CALL_RESULT callResult )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ terminateLwsListenerLoop()

STATUS terminateLwsListenerLoop ( PSignalingClient pSignalingClient)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ wakeLwsServiceEventLoop()

STATUS wakeLwsServiceEventLoop ( PSignalingClient pSignalingClient,
UINT32 protocolIndex )
Here is the caller graph for this function:

◆ writeLwsData()

STATUS writeLwsData ( PSignalingClient pSignalingClient,
BOOL awaitForResponse )
Here is the call graph for this function:
Here is the caller graph for this function: