mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-10 13:23:41 +00:00
1. Modified WebRTC_DataChannel to use union, to simplify struct def
2. Added ChainLink MetaData 3. Added 'ChainViewer' to allow JS to debug Chain events
This commit is contained in:
@@ -239,6 +239,7 @@ void ILibDuktape_Debugger_AsyncWaitConn(ILibDuktape_Debugger *dbg)
|
||||
if (dbg->chainedObject == NULL)
|
||||
{
|
||||
dbg->chainedObject = ILibChain_Link_Allocate(sizeof(ILibChain_Link), sizeof(void*));
|
||||
dbg->chainedObject->MetaData = "ILibDuktape_Debugger_AsyncWaitConn";
|
||||
((void**)dbg->chainedObject->ExtraMemoryPtr)[0] = dbg;
|
||||
dbg->chainedObject->PreSelectHandler = ILibDuktape_Debugger_AsyncWaitConn_PreSelect;
|
||||
dbg->chainedObject->PostSelectHandler = ILibDuktape_Debugger_AsyncWaitConn_PostSelect;
|
||||
|
||||
@@ -1086,6 +1086,7 @@ void ILibDuktape_HECI_Push(duk_context *ctx, void *chain)
|
||||
duk_put_prop_string(ctx, -2, ILibDuktape_HECI_Descriptor); // [HECI]
|
||||
|
||||
HECI_chainLink *hlink = ILibMemory_Allocate(sizeof(HECI_chainLink), 0, NULL, NULL);
|
||||
hlink->link.MetaData = "ILibDuktape_HECI";
|
||||
hlink->ctx = ctx;
|
||||
hlink->descriptor = h;
|
||||
hlink->link.PreSelectHandler = ILibDuktape_HECI_PreSelect;
|
||||
|
||||
@@ -1809,6 +1809,82 @@ void ILibDuktape_Polyfills_JS_Init(duk_context *ctx)
|
||||
|
||||
}
|
||||
|
||||
void ILibDuktape_ChainViewer_PostSelect(void* object, int slct, fd_set *readset, fd_set *writeset, fd_set *errorset)
|
||||
{
|
||||
duk_context *ctx = (duk_context*)((void**)((ILibTransport*)object)->ChainLink.ExtraMemoryPtr)[0];
|
||||
void *hptr = ((void**)((ILibTransport*)object)->ChainLink.ExtraMemoryPtr)[1];
|
||||
int i;
|
||||
|
||||
ILibDuktape_EventEmitter_SetupEmit(ctx, hptr, "PostSelect"); // [emit][this][name]
|
||||
duk_push_int(ctx, slct); // [emit][this][name][select]
|
||||
duk_push_array(ctx); // [emit][this][name][select][readset
|
||||
for (i = 0; i < 4096; ++i)
|
||||
{
|
||||
if (FD_ISSET(i, readset))
|
||||
{
|
||||
duk_push_int(ctx, i);
|
||||
duk_put_prop_index(ctx, -2, duk_get_length(ctx, -1)); // [emit][this][name][select][readset]
|
||||
}
|
||||
}
|
||||
duk_push_array(ctx); // [emit][this][name][select][readset][writeset]
|
||||
for (i = 0; i < 4096; ++i)
|
||||
{
|
||||
if (FD_ISSET(i, writeset))
|
||||
{
|
||||
duk_push_int(ctx, i);
|
||||
duk_put_prop_index(ctx, -2, duk_get_length(ctx, -1)); // [emit][this][name][select][readset][writeset]
|
||||
}
|
||||
}
|
||||
duk_push_array(ctx); // [emit][this][name][select][readset][writeset][errorset]
|
||||
for (i = 0; i < 4096; ++i)
|
||||
{
|
||||
if (FD_ISSET(i, errorset))
|
||||
{
|
||||
duk_push_int(ctx, i);
|
||||
duk_put_prop_index(ctx, -2, duk_get_length(ctx, -1)); // [emit][this][name][select][readset][writeset][errorset]
|
||||
}
|
||||
}
|
||||
if (duk_pcall_method(ctx, 5) != 0) { ILibDuktape_Process_UncaughtExceptionEx(ctx, "ChainViewer.emit('PostSelect'): Error "); }
|
||||
duk_pop(ctx);
|
||||
}
|
||||
duk_ret_t ILibDuktape_ChainViewer_GetDescriptorInfo(duk_context *ctx)
|
||||
{
|
||||
int fd = duk_require_int(ctx, 0);
|
||||
void *chain = Duktape_GetChain(ctx);
|
||||
|
||||
void *module = ILibChain_GetObjectForDescriptor(chain, fd);
|
||||
duk_push_object(ctx);
|
||||
if (module != NULL)
|
||||
{
|
||||
duk_push_pointer(ctx, module);
|
||||
duk_put_prop_string(ctx, -2, "_ptr");
|
||||
duk_push_string(ctx, Duktape_GetStashKey(module));
|
||||
duk_put_prop_string(ctx, -2, "pointer");
|
||||
if (((ILibChain_Link*)module)->MetaData != NULL)
|
||||
{
|
||||
duk_push_string(ctx, ((ILibChain_Link*)module)->MetaData);
|
||||
duk_put_prop_string(ctx, -2, "moduleType");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return(1);
|
||||
}
|
||||
void ILibDuktape_ChainViewer_Push(duk_context *ctx, void *chain)
|
||||
{
|
||||
duk_push_object(ctx); // [viewer]
|
||||
|
||||
ILibTransport *t = (ILibTransport*)ILibChain_Link_Allocate(sizeof(ILibTransport), 2*sizeof(void*));
|
||||
t->ChainLink.MetaData = "ILibDuktape_ChainViewer";
|
||||
t->ChainLink.PostSelectHandler = ILibDuktape_ChainViewer_PostSelect;
|
||||
((void**)t->ChainLink.ExtraMemoryPtr)[0] = ctx;
|
||||
((void**)t->ChainLink.ExtraMemoryPtr)[1] = duk_get_heapptr(ctx, -1);
|
||||
ILibDuktape_EventEmitter *emitter = ILibDuktape_EventEmitter_Create(ctx);
|
||||
ILibDuktape_EventEmitter_CreateEventEx(emitter, "PostSelect");
|
||||
|
||||
ILibDuktape_CreateInstanceMethod(ctx, "GetDescriptorInfo", ILibDuktape_ChainViewer_GetDescriptorInfo, 1);
|
||||
ILibAddToChain(chain, (void*)t);
|
||||
}
|
||||
|
||||
void ILibDuktape_Polyfills_Init(duk_context *ctx)
|
||||
{
|
||||
@@ -1823,6 +1899,7 @@ void ILibDuktape_Polyfills_Init(duk_context *ctx)
|
||||
ILibDuktape_ModSearch_AddHandler(ctx, "bignum", ILibDuktape_bignum_Push);
|
||||
ILibDuktape_ModSearch_AddHandler(ctx, "dataGenerator", ILibDuktape_dataGenerator_Push);
|
||||
#endif
|
||||
ILibDuktape_ModSearch_AddHandler(ctx, "ChainViewer", ILibDuktape_ChainViewer_Push);
|
||||
|
||||
// Global Polyfills
|
||||
duk_push_global_object(ctx); // [g]
|
||||
|
||||
@@ -192,9 +192,9 @@ void ILibDuktape_WebRTC_DataChannel_PUSH(duk_context *ctx, ILibWrapper_WebRTC_Da
|
||||
if (dataChannel->userData != NULL) { duk_push_heapptr(((ILibDuktape_WebRTC_DataChannel*)dataChannel->userData)->ctx, ((ILibDuktape_WebRTC_DataChannel*)dataChannel->userData)->emitter->object); return; }
|
||||
ILibDuktape_WebRTC_DataChannel *ptrs;
|
||||
|
||||
dataChannel->TransportSendOKPtr = ILibDuktape_WebRTC_OnDataChannelSendOK;
|
||||
dataChannel->Header.transport.SendOkPtr = ILibDuktape_WebRTC_OnDataChannelSendOK;
|
||||
dataChannel->OnClosed = ILibDuktape_WebRTC_DataChannel_OnClose;
|
||||
dataChannel->OnRawData = ILibDuktape_WebRTC_DataChannel_OnData;
|
||||
dataChannel->Header.DataChannelCallbacks.OnRawData = ILibDuktape_WebRTC_DataChannel_OnData;
|
||||
|
||||
duk_push_object(ctx); // [dataChannel]
|
||||
ILibDuktape_WriteID(ctx, "webRTC.dataChannel");
|
||||
|
||||
@@ -1309,6 +1309,7 @@ duk_ret_t ILibDuktape_fs_watch(duk_context *ctx)
|
||||
else
|
||||
{
|
||||
notifyDispatcher = ILibMemory_Allocate(sizeof(ILibDuktape_fs_linuxWatcher), 0, NULL, NULL);
|
||||
notifyDispatcher->chainLink.MetaData = "ILibDuktape_fs_linuxWatcher";
|
||||
notifyDispatcher->chainLink.PreSelectHandler = ILibDuktape_fs_notifyDispatcher_PreSelect;
|
||||
notifyDispatcher->chainLink.PostSelectHandler = ILibDuktape_fs_notifyDispatcher_PostSelect;
|
||||
notifyDispatcher->chainLink.DestroyHandler = ILibDuktape_fs_notifyDispatcher_Destroy;
|
||||
|
||||
@@ -632,7 +632,7 @@ ILibAsyncServerSocket_ServerModule ILibCreateAsyncServerSocketModuleWithMemoryEx
|
||||
|
||||
// Instantiate a new AsyncServer module
|
||||
RetVal = (struct ILibAsyncServerSocketModule*)ILibChain_Link_Allocate(sizeof(struct ILibAsyncServerSocketModule), ServerUserMappedMemorySize);
|
||||
|
||||
RetVal->ChainLink.MetaData = "ILibAsyncServerSocket";
|
||||
RetVal->ChainLink.PreSelectHandler = &ILibAsyncServerSocket_PreSelect;
|
||||
RetVal->ChainLink.PostSelectHandler = &ILibAsyncServerSocket_PostSelect;
|
||||
RetVal->ChainLink.DestroyHandler = &ILibAsyncServerSocket_Destroy;
|
||||
|
||||
@@ -443,7 +443,7 @@ ILibTransport_DoneState ILibAsyncSocket_TransportSend(void *transport, char* buf
|
||||
ILibAsyncSocket_SocketModule ILibCreateAsyncSocketModuleWithMemory(void *Chain, int initialBufferSize, ILibAsyncSocket_OnData OnData, ILibAsyncSocket_OnConnect OnConnect, ILibAsyncSocket_OnDisconnect OnDisconnect, ILibAsyncSocket_OnSendOK OnSendOK, int UserMappedMemorySize)
|
||||
{
|
||||
struct ILibAsyncSocketModule *RetVal = (struct ILibAsyncSocketModule*)ILibChain_Link_Allocate(sizeof(struct ILibAsyncSocketModule), UserMappedMemorySize);
|
||||
|
||||
RetVal->Transport.ChainLink.MetaData = "ILibAsyncSocket";
|
||||
RetVal->Transport.IdentifierFlags = ILibTransports_AsyncSocket;
|
||||
RetVal->Transport.SendPtr = &ILibAsyncSocket_TransportSend;
|
||||
RetVal->Transport.ClosePtr = &ILibAsyncSocket_Disconnect;
|
||||
|
||||
@@ -138,6 +138,7 @@ void ILibIPAddressMonitor_PostSelect(void* object, int slct, fd_set *readset, fd
|
||||
ILibIPAddressMonitor ILibIPAddressMonitor_Create(void *chain, ILibIPAddressMonitor_Handler handler, void *user)
|
||||
{
|
||||
_ILibIPAddressMonitor *obj = (_ILibIPAddressMonitor*)ILibChain_Link_Allocate(ILibMemory_IPAddressMonitor_CONTAINER_SIZE, 0);
|
||||
obj->chainLink.MetaData = "ILibIPAddressMonitor";
|
||||
#ifndef NO_IPADDR_MONITOR
|
||||
|
||||
obj->onUpdate = handler;
|
||||
|
||||
@@ -297,6 +297,7 @@ struct ILibMulticastSocket_StateModule *ILibMulticastSocket_Create(void *Chain,
|
||||
addr6.sin6_port = htons(LocalPort);
|
||||
|
||||
// Setup the multicasting module
|
||||
module->ChainLink.MetaData = "ILibMulticastSocket";
|
||||
module->ChainLink.DestroyHandler = &ILibMulticastSocket_Destroy;
|
||||
module->ChainLink.ParentChain = Chain;
|
||||
module->LocalPort = LocalPort;
|
||||
|
||||
@@ -2625,6 +2625,37 @@ void ILibChain_DisableWatchDog(void *chain)
|
||||
((ILibBaseChain*)chain)->nowatchdog = 1;
|
||||
}
|
||||
|
||||
void *ILibChain_GetObjectForDescriptor(void *chain, int fd)
|
||||
{
|
||||
void *ret = NULL;
|
||||
ILibChain_Link *module;
|
||||
void *node = ILibLinkedList_GetNode_Head(((ILibBaseChain*)chain)->Links);
|
||||
int selectTimeout = UPNP_MAX_WAIT * 1000;
|
||||
|
||||
fd_set readset;
|
||||
fd_set errorset;
|
||||
fd_set writeset;
|
||||
|
||||
while (node != NULL && (module = (ILibChain_Link*)ILibLinkedList_GetDataFromNode(node)) != NULL)
|
||||
{
|
||||
if (module->PreSelectHandler != NULL)
|
||||
{
|
||||
FD_ZERO(&readset);
|
||||
FD_ZERO(&errorset);
|
||||
FD_ZERO(&writeset);
|
||||
|
||||
module->PreSelectHandler(module, &readset, &writeset, &errorset, &selectTimeout);
|
||||
if (FD_ISSET(fd, &readset) || FD_ISSET(fd, &writeset) || FD_ISSET(fd, &errorset))
|
||||
{
|
||||
ret = module;
|
||||
break;
|
||||
}
|
||||
}
|
||||
node = ILibLinkedList_GetNextNode(node);
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
/*! \fn ILibStartChain(void *Chain)
|
||||
\brief Starts a Chain
|
||||
\par
|
||||
|
||||
@@ -327,6 +327,7 @@ int ILibIsRunningOnChainThread(void* chain);
|
||||
ILibChain_Destroy DestroyHandler;
|
||||
void* ParentChain;
|
||||
void* ExtraMemoryPtr;
|
||||
char* MetaData;
|
||||
}ILibChain_Link;
|
||||
ILibChain_Link* ILibChain_Link_Allocate(int structSize, int extraMemorySize);
|
||||
int ILibChain_Link_GetExtraMemorySize(ILibChain_Link* link);
|
||||
@@ -922,6 +923,7 @@ int ILibIsRunningOnChainThread(void* chain);
|
||||
void ILibChain_SafeRemoveEx(void *chain, void *object);
|
||||
void ILibChain_DestroyEx(void *chain);
|
||||
void ILibChain_DisableWatchDog(void *chain);
|
||||
void *ILibChain_GetObjectForDescriptor(void *chain, int fd);
|
||||
ILibExportMethod void ILibStartChain(void *chain);
|
||||
ILibExportMethod void ILibStopChain(void *chain);
|
||||
ILibExportMethod void ILibChain_Continue(void *chain, ILibChain_Link **modules, int moduleCount, int maxTimeout);
|
||||
|
||||
@@ -488,7 +488,7 @@ ILibProcessPipe_Manager ILibProcessPipe_Manager_Create(void *chain)
|
||||
|
||||
if ((retVal = (ILibProcessPipe_Manager_Object*)malloc(sizeof(ILibProcessPipe_Manager_Object))) == NULL) { ILIBCRITICALEXIT(254); }
|
||||
memset(retVal, 0, sizeof(ILibProcessPipe_Manager_Object));
|
||||
|
||||
retVal->ChainLink.MetaData = "ILibProcessPipe_Manager";
|
||||
retVal->ChainLink.ParentChain = chain;
|
||||
retVal->ActivePipes = ILibLinkedList_Create();
|
||||
|
||||
|
||||
@@ -2475,7 +2475,7 @@ ILibWebClient_RequestManager ILibCreateWebClient(int PoolSize, void *Chain)
|
||||
if ((RetVal = (struct ILibWebClientManager*)malloc(sizeof(struct ILibWebClientManager))) == NULL) ILIBCRITICALEXIT(254);
|
||||
memset(RetVal, 0, sizeof(struct ILibWebClientManager));
|
||||
RetVal->MaxConnectionsToSameServer = 1;
|
||||
|
||||
RetVal->ChainLink.MetaData = "ILibWebClient";
|
||||
RetVal->ChainLink.DestroyHandler = &ILibDestroyWebClient;
|
||||
RetVal->ChainLink.PreSelectHandler = &ILibWebClient_PreProcess;
|
||||
//RetVal->PostSelect = &ILibWebClient_PreProcess;
|
||||
|
||||
@@ -6370,7 +6370,7 @@ void* ILibStunClient_Start(void *Chain, unsigned short LocalPort, ILibStunClient
|
||||
memset(obj, 0, sizeof(struct ILibStun_Module));
|
||||
obj->State = STUN_STATUS_NOT_TESTED;
|
||||
obj->StunUsers = ILibLinkedList_Create();
|
||||
|
||||
obj->ChainLink.MetaData = "ILibWebRTC";
|
||||
obj->OnResult = OnResult;
|
||||
obj->LocalIf.sin_family = AF_INET;
|
||||
obj->LocalIf.sin_port = htons(LocalPort);
|
||||
@@ -7045,7 +7045,7 @@ ILibTURN_ClientModule ILibTURN_CreateTurnClient(void* chain, ILibTURN_OnConnectT
|
||||
retVal->OnChannelDataCallback = OnChannelData;
|
||||
retVal->transactionData = ILibInitHashTree();
|
||||
retVal->ChainLink.ParentChain = chain;
|
||||
|
||||
retVal->ChainLink.MetaData = "ILibWebRTC_TURN_Client";
|
||||
ILibAddToChain(chain, retVal);
|
||||
|
||||
return retVal;
|
||||
|
||||
@@ -459,7 +459,7 @@ void ILibWebServer_OnConnect(void *AsyncServerSocketModule, void *ConnectionToke
|
||||
|
||||
wsm = (struct ILibWebServer_StateModule*)ILibAsyncServerSocket_GetTag(AsyncServerSocketModule);
|
||||
ws = (struct ILibWebServer_Session*)ILibChain_Link_Allocate(ILibMemory_WEBSERVERSESSION_CONTAINERSIZE, ILibMemory_GetExtraMemorySize(wsm->ChainLink.ExtraMemoryPtr));
|
||||
|
||||
ws->Reserved_Transport.ChainLink.MetaData = "ILibWebServer_Session";
|
||||
ws->Reserved_Transport.ChainLink.ParentChain = wsm->ChainLink.ParentChain;
|
||||
ws->Reserved_Transport.IdentifierFlags = (unsigned int)ILibTransports_WebServer;
|
||||
ws->Reserved_Transport.ClosePtr = (ILibTransport_ClosePtr)&ILibWebServer_DisconnectSession;
|
||||
@@ -1019,7 +1019,7 @@ void ILibWebServer_SetTLS(ILibWebServer_ServerToken object, void *ssl_ctx)
|
||||
ILibExportMethod ILibWebServer_ServerToken ILibWebServer_CreateEx2(void *Chain, int MaxConnections, unsigned short PortNumber, int loopbackFlag, ILibWebServer_Session_OnSession OnSession, int ExtraMemorySize, void *User)
|
||||
{
|
||||
struct ILibWebServer_StateModule *RetVal = (struct ILibWebServer_StateModule *)ILibChain_Link_Allocate(sizeof(struct ILibWebServer_StateModule), ExtraMemorySize);
|
||||
|
||||
RetVal->ChainLink.MetaData = "ILibWebServer";
|
||||
RetVal->ChainLink.DestroyHandler = &ILibWebServer_Destroy;
|
||||
RetVal->ChainLink.ParentChain = Chain;
|
||||
RetVal->OnSession = OnSession;
|
||||
|
||||
@@ -127,11 +127,11 @@ unsigned int ILibWrapper_ILibTransport_PendingBytesPtr(void *transport)
|
||||
}
|
||||
void ILibWrapper_InitializeDataChannel_Transport(ILibWrapper_WebRTC_DataChannel *dataChannel)
|
||||
{
|
||||
dataChannel->Chain = ((ILibWrapper_WebRTC_ConnectionStruct*)dataChannel->parent)->mFactory->ChainLink.ParentChain;
|
||||
dataChannel->IdentifierFlags = ILibTransports_WebRTC_DataChannel;
|
||||
dataChannel->ClosePtr = (ILibTransport_ClosePtr)ILibWrapper_WebRTC_DataChannel_Close;
|
||||
dataChannel->SendPtr = (ILibTransport_SendPtr)ILibWrapper_ILibTransport_SendSink;
|
||||
dataChannel->PendingBytesPtr = (ILibTransport_PendingBytesToSendPtr)ILibWrapper_ILibTransport_PendingBytesPtr;
|
||||
dataChannel->Header.transport.ChainLink.ParentChain = ((ILibWrapper_WebRTC_ConnectionStruct*)dataChannel->parent)->mFactory->ChainLink.ParentChain;
|
||||
dataChannel->Header.transport.IdentifierFlags = ILibTransports_WebRTC_DataChannel;
|
||||
dataChannel->Header.transport.ClosePtr = (ILibTransport_ClosePtr)ILibWrapper_WebRTC_DataChannel_Close;
|
||||
dataChannel->Header.transport.SendPtr = (ILibTransport_SendPtr)ILibWrapper_ILibTransport_SendSink;
|
||||
dataChannel->Header.transport.PendingBytesPtr = (ILibTransport_PendingBytesToSendPtr)ILibWrapper_ILibTransport_PendingBytesPtr;
|
||||
}
|
||||
|
||||
short ILibWrapper_ReadShort(char* buffer, int offset)
|
||||
@@ -708,16 +708,16 @@ void ILibWrapper_WebRTC_OnDataSink(void* StunModule, void* module, unsigned shor
|
||||
|
||||
if(dc!=NULL)
|
||||
{
|
||||
if(dc->OnRawData!=NULL) {dc->OnRawData(dc, buffer, bufferLen, pid);}
|
||||
if(dc->OnStringData!=NULL && pid == 51) {dc->OnStringData(dc, buffer, bufferLen);}
|
||||
if(dc->OnBinaryData!=NULL && pid == 53) {dc->OnBinaryData(dc, buffer, bufferLen);}
|
||||
if(dc->Header.DataChannelCallbacks.OnRawData!=NULL) {dc->Header.DataChannelCallbacks.OnRawData(dc, buffer, bufferLen, pid);}
|
||||
if(dc->Header.DataChannelCallbacks.OnStringData!=NULL && pid == 51) {dc->Header.DataChannelCallbacks.OnStringData(dc, buffer, bufferLen);}
|
||||
if(dc->Header.DataChannelCallbacks.OnBinaryData!=NULL && pid == 53) {dc->Header.DataChannelCallbacks.OnBinaryData(dc, buffer, bufferLen);}
|
||||
}
|
||||
}
|
||||
void ILibWrapper_WebRTC_OnSendOK_EnumerateSink(ILibSparseArray sender, int index, void *value, void *user)
|
||||
{
|
||||
ILibWrapper_WebRTC_DataChannel *dc = (ILibWrapper_WebRTC_DataChannel*)value;
|
||||
|
||||
if (dc != NULL && dc->TransportSendOKPtr != NULL) { dc->TransportSendOKPtr(dc); }
|
||||
if (dc != NULL && dc->Header.transport.SendOkPtr != NULL) { dc->Header.transport.SendOkPtr(dc); }
|
||||
}
|
||||
void ILibWrapper_WebRTC_OnSendOKSink(void* StunModule, void* module, void* user)
|
||||
{
|
||||
@@ -756,7 +756,7 @@ int ILibWrapper_WebRTC_OnDataChannel(void *StunModule, void* WebRTCModule, unsig
|
||||
if((dataChannel = (ILibWrapper_WebRTC_DataChannel*)ILibSparseArray_Get(obj->DataChannels, (int)StreamId))==NULL)
|
||||
{
|
||||
dataChannel = (ILibWrapper_WebRTC_DataChannel*)ILibChain_Link_Allocate(sizeof(ILibWrapper_WebRTC_DataChannel), (int)ILibMemory_ExtraSize(obj));
|
||||
|
||||
dataChannel->Header.transport.ChainLink.MetaData = "ILibWrapper_WebRTC_DataChannel";
|
||||
dataChannel->parent = obj;
|
||||
dataChannel->streamId = StreamId;
|
||||
if((dataChannel->channelName = (char*)malloc(ChannelNameLength+1))==NULL){ILIBCRITICALEXIT(254);}
|
||||
@@ -849,6 +849,7 @@ ILibWrapper_WebRTC_ConnectionFactory ILibWrapper_WebRTC_ConnectionFactory_Create
|
||||
if (retVal == NULL) { ILIBCRITICALEXIT(254); }
|
||||
|
||||
memset(retVal, 0, sizeof(ILibWrapper_WebRTC_ConnectionFactoryStruct));
|
||||
retVal->ChainLink.MetaData = "ILibWrapper_WebRTC_ConnectionFactory";
|
||||
retVal->ChainLink.DestroyHandler = &ILibWrapper_WebRTC_ConnectionFactory_OnDestroy;
|
||||
ILibAddToChain(chain, retVal);
|
||||
|
||||
@@ -1254,7 +1255,7 @@ void ILibWrapper_WebRTC_DataChannel_Close(ILibWrapper_WebRTC_DataChannel* dataCh
|
||||
ILibWrapper_WebRTC_DataChannel* ILibWrapper_WebRTC_DataChannel_CreateEx(ILibWrapper_WebRTC_Connection connection, char* channelName, int channelNameLen, unsigned short streamId, ILibWrapper_WebRTC_DataChannel_OnDataChannelAck OnAckHandler)
|
||||
{
|
||||
ILibWrapper_WebRTC_DataChannel *retVal = (ILibWrapper_WebRTC_DataChannel*)ILibChain_Link_Allocate(sizeof(ILibWrapper_WebRTC_DataChannel), (int)ILibMemory_ExtraSize(connection));
|
||||
|
||||
retVal->Header.transport.ChainLink.MetaData = "ILibWrapper_WebRTC_DataChannel";
|
||||
retVal->parent = connection;
|
||||
if ((retVal->channelName = (char*)malloc(channelNameLen + 1)) == NULL) { ILIBCRITICALEXIT(254); }
|
||||
memcpy_s(retVal->channelName, channelNameLen + 1, channelName, channelNameLen);
|
||||
|
||||
@@ -66,16 +66,16 @@ typedef void(*ILibWrapper_WebRTC_DataChannel_OnClosed)(struct ILibWrapper_WebRTC
|
||||
/** DataChannel abstraction used to send/receive peer-to-peer data. */
|
||||
typedef struct ILibWrapper_WebRTC_DataChannel
|
||||
{
|
||||
union ILibWrapper_WebRTC_DataChannel_Header
|
||||
{
|
||||
ILibTransport transport;
|
||||
struct DataChannelCallbacks
|
||||
{
|
||||
ILibWrapper_WebRTC_DataChannel_OnData OnBinaryData; //!< Binary Data Event Handler
|
||||
ILibWrapper_WebRTC_DataChannel_OnData OnStringData; //!< String Data Event Handler
|
||||
ILibWrapper_WebRTC_DataChannel_OnRawData OnRawData; //!< Raw Data Event Handler
|
||||
void* Chain; //!< Microstack Chain to which this object resides
|
||||
void* ReservedMemory; //!< RESERVED
|
||||
ILibTransport_SendPtr SendPtr; //!< RESERVED
|
||||
ILibTransport_ClosePtr ClosePtr; //!< RESERVED
|
||||
ILibTransport_PendingBytesToSendPtr PendingBytesPtr; //!< RESERVED
|
||||
ILibTransport_OnSendOK TransportSendOKPtr; //!< RESERVED
|
||||
unsigned int IdentifierFlags; //!< RESERVED
|
||||
}DataChannelCallbacks;
|
||||
}Header;
|
||||
/*
|
||||
*
|
||||
* DO NOT MODIFY STRUCT DEFINITION ABOVE THIS COMMENT BLOCK
|
||||
|
||||
Reference in New Issue
Block a user