void MyRoutingClientDataWithReasonCallback(WONRoutingClientDataWithReason *theData, void *theUserParam) { printf("ClientDataWithReason Callback: %s\n",(char*)theUserParam); printf("Reason: %d",theData->mReason); PrintClientData(&theData->mData); SetEvent(mEvent); printf("\n"); }
void MyRoutingClientInfoCallback(WONRoutingClientInfoResult *theInfo, void *theUserParam) { printf("ClientInfo Callback: %s\n",(char*)theUserParam); printf("Status: %d\n",theInfo->mStatus); printf("IncludesIPs: %d\n",theInfo->mIncludesIPs); printf("IncludesAuthInfo: %d\n", theInfo->mIncludesAuthInfo); printf("IncludesMuteFlag: %d\n", theInfo->mIncludesMuteFlag); printf("IncludesModeratorFlag: %d\n",theInfo->mIncludesModeratorFlag); PrintClientData(&theInfo->mClient); SetEvent(mEvent); printf("\n"); }
void MyRoutingClientListCallback(WONRoutingClientListResult *theList, void *theUserParam) { int i; printf("ClientList Callback: %s\n",(char*)theUserParam); printf("Status: %d\n",theList->mStatus); printf("IncludesIPs: %d\n",theList->mIncludesIPs); printf("IncludesAuthInfo: %d\n", theList->mIncludesAuthInfo); printf("IncludesMuteFlag: %d\n", theList->mIncludesMuteFlag); printf("IncludesModeratorFlag: %d\n",theList->mIncludesModeratorFlag); printf("NumSpectators: %d\n",theList->mNumSpectators); printf("Clients:\n\n"); for(i=0; i<theList->mNumClients; i++) { PrintClientData(&theList->mClients[i]); printf("\n"); } SetEvent(mEvent); printf("\n"); }
unsigned int ShmemClientNode(void) { volatile unsigned int *remoteMapAddr1; volatile unsigned int *remoteMapAddr2; printf("here?\n"); /* Create a segmentId */ remoteSegmentId1 = 1;//(remoteNodeId1 << 16) | localNodeId1; /* Connect to remote segment */ printf("Connect to remote segment .... \n"); printf("segid = %d node %d \n",remoteSegmentId1, remoteNodeId1 ); do { SCIConnectSegment(sdOne, &remoteSegmentOne, remoteNodeId1, remoteSegmentId1, localAdapterNo, NO_CALLBACK, NULL, SCI_INFINITE_TIMEOUT, NO_FLAGS, &error); } while (error != SCI_ERR_OK); printf("connected\n"); // remoteSegmentId2 = (remoteNodeId2 << 16) | localNodeId2; // printf("segid = %d\n",remoteSegmentId2 ); printf("segid = %d node %d \n",remoteSegmentId1, remoteNodeId1 ); do { SCIConnectSegment(sdTwo, &remoteSegmentTwo, remoteNodeId2, remoteSegmentId1, standbyAdapterNo, NO_CALLBACK, NULL, SCI_INFINITE_TIMEOUT, NO_FLAGS, &error); } while (error != SCI_ERR_OK); printf("connected 3\n"); printf("Remote segment (id=0x%x) is connected.\n", remoteSegmentId2); /* Map remote segment to user space */ remoteMapAddr1 = (unsigned int*)SCIMapRemoteSegment(remoteSegmentOne,&remoteMapOne,offset,segmentSize,NULL,NO_FLAGS,&error); if (error == SCI_ERR_OK) { printf("Remote segment (id=0x%x) is mapped to user space @ 0x%x. \n", remoteSegmentId1, remoteMapAddr1); } else { fprintf(stderr,"SCIMapRemoteSegment failed - Error code 0x%x\n",error); return 0; } remoteMapAddr2 = (unsigned int *)SCIMapRemoteSegment(remoteSegmentTwo,&remoteMapTwo,offset,segmentSize,NULL,NO_FLAGS,&error); if (error == SCI_ERR_OK) { printf("Remote segment (id=0x%x) is mapped to user space @ 0x%x. \n", remoteSegmentId2, remoteMapAddr2); } else { fprintf(stderr,"SCIMapRemoteSegment failed - Error code 0x%x\n",error); return 0; } /* Start data transfer and error checking */ error = (sci_error_t)TransferData(remoteMapOne,remoteMapAddr1, remoteMapAddr2,segmentSize); if (error == SCI_ERR_OK) { printf("Data transfer done!\n\n"); } else { fprintf(stderr,"Data transfer failed - Error code 0x%x\n\n",error); return 0; } /* Send an interrupt to remote node telling that the data transfer is ready */ error = SendInterrupt(sdOne,localAdapterNo,localNodeId1,remoteNodeId1, DATA_TRANSFER_READY); if (error == SCI_ERR_OK) { printf("\nInterrupt message sent to remote node\n"); } else { printf("\nInterrupt synchronization failed\n"); return 0; } PrintClientData(); /* Unmap remote segment */ SCIUnmapSegment(remoteMapOne,NO_FLAGS,&error); if (error == SCI_ERR_OK) { printf("The remote segment is unmapped\n"); } else { fprintf(stderr,"SCIUnmapSegment failed - Error code 0x%x\n",error); return 0; } SCIUnmapSegment(remoteMapTwo,NO_FLAGS,&error); if (error == SCI_ERR_OK) { printf("The remote segment is unmapped\n"); } else { fprintf(stderr,"SCIUnmapSegment failed - Error code 0x%x\n",error); return 0; } /* Disconnect segment */ SCIDisconnectSegment(remoteSegmentOne,NO_FLAGS,&error); if (error == SCI_ERR_OK) { printf("The segment is disconnected\n"); } else { fprintf(stderr,"SCIDisconnectSegment failed - Error code 0x%x\n",error); return 0; } SCIDisconnectSegment(remoteSegmentTwo,NO_FLAGS,&error); if (error == SCI_ERR_OK) { printf("The segment is disconnected\n"); } else { fprintf(stderr,"SCIDisconnectSegment failed - Error code 0x%x\n",error); return 0; } return 1; }