#include "../Include_i.h"#include <libwebsockets.h>#include "Signaling.h"#include "LwsApiCalls.h"
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) |
| #define LOG_CLASS "LwsApiCalls" |
Implementation of a API calls based on LibWebSocket
| #define WEBRTC_SCHEME_NAME "webrtc" |
| STATUS checkAndCorrectForClockSkew | ( | PSignalingClient | pSignalingClient, |
| PRequestInfo | pRequestInfo ) |

| STATUS configureLwsLogging | ( | UINT32 | kvsLogLevel | ) |

| STATUS connectSignalingChannelLws | ( | PSignalingClient | pSignalingClient, |
| UINT64 | time ) |


| STATUS createChannelLws | ( | PSignalingClient | pSignalingClient, |
| UINT64 | time ) |


| STATUS createLwsCallInfo | ( | PSignalingClient | pSignalingClient, |
| PRequestInfo | pRequestInfo, | ||
| UINT32 | protocolIndex, | ||
| PLwsCallInfo * | ppLwsCallInfo ) |


| STATUS deleteChannelLws | ( | PSignalingClient | pSignalingClient, |
| UINT64 | time ) |


| STATUS describeChannelLws | ( | PSignalingClient | pSignalingClient, |
| UINT64 | time ) |


| STATUS describeMediaStorageConfLws | ( | PSignalingClient | pSignalingClient, |
| UINT64 | time ) |


| STATUS freeLwsCallInfo | ( | PLwsCallInfo * | ppLwsCallInfo | ) |

| STATUS getChannelEndpointLws | ( | PSignalingClient | pSignalingClient, |
| UINT64 | time ) |


| STATUS getIceConfigLws | ( | PSignalingClient | pSignalingClient, |
| UINT64 | time ) |


| STATUS getMessageTypeFromString | ( | PCHAR | typeStr, |
| UINT32 | typeLen, | ||
| SIGNALING_MESSAGE_TYPE * | pMessageType ) |

| PCHAR getMessageTypeInString | ( | SIGNALING_MESSAGE_TYPE | messageType | ) |

| 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.


| BOOL isCallResultSignatureExpired | ( | PCallInfo | pCallInfo | ) |

| BOOL isCallResultSignatureNotYetCurrent | ( | PCallInfo | pCallInfo | ) |

| STATUS joinStorageSessionLws | ( | PSignalingClient | pSignalingClient, |
| UINT64 | time ) |
< TBD. Accroding to the design document, the prefix of url will be webrtc://


| STATUS lwsCompleteSync | ( | PLwsCallInfo | pCallInfo | ) |


| INT32 lwsHttpCallbackRoutine | ( | PVOID | wsi, |
| INT32 | reason, | ||
| PVOID | user, | ||
| PVOID | pDataIn, | ||
| size_t | dataSize ) |


| PVOID lwsListenerHandler | ( | PVOID | args | ) |


| VOID lwsSignalHandler | ( | INT32 | signal | ) |
| INT32 lwsWssCallbackRoutine | ( | PVOID | wsi, |
| INT32 | reason, | ||
| PVOID | user, | ||
| PVOID | pDataIn, | ||
| size_t | dataSize ) |


| 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.
| [in] | pResponseStr | JSON string containing ICE server configuration. |
| [in] | responseLen | Length of the JSON string (excluding null-terminator). |
| [in] | maxIceConfigs | Maximum number of ICE configurations the array can hold. |
| [out] | pIceConfigs | Pointer to array of IceConfigInfo structures to be populated. |
| [out] | pIceConfigCount | Pointer to receive the number of ICE configurations parsed. |


| 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.
| [in] | pMessage | JSON of the signaling message. |
| [in] | messageLen | Length of the JSON string (excluding null-terminator). |
| [out] | pReceivedSignalingMessage | Pointer to receive the parsed signaling message. |


| STATUS receiveLwsMessage | ( | PSignalingClient | pSignalingClient, |
| PCHAR | pMessage, | ||
| UINT32 | messageLen ) |


| PVOID receiveLwsMessageWrapper | ( | PVOID | args | ) |


| PVOID reconnectHandler | ( | PVOID | args | ) |


| 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.

| STATUS sendLwsMessage | ( | PSignalingClient | pSignalingClient, |
| SIGNALING_MESSAGE_TYPE | messageType, | ||
| PCHAR | peerClientId, | ||
| PCHAR | pMessage, | ||
| UINT32 | messageLen, | ||
| PCHAR | pCorrelationId, | ||
| UINT32 | correlationIdLen ) |


| STATUS startReconnectHandler | ( | PSignalingClient | pSignalingClient | ) |


| STATUS terminateConnectionWithStatus | ( | PSignalingClient | pSignalingClient, |
| SERVICE_CALL_RESULT | callResult ) |


| STATUS terminateLwsListenerLoop | ( | PSignalingClient | pSignalingClient | ) |


| STATUS wakeLwsServiceEventLoop | ( | PSignalingClient | pSignalingClient, |
| UINT32 | protocolIndex ) |

| STATUS writeLwsData | ( | PSignalingClient | pSignalingClient, |
| BOOL | awaitForResponse ) |

