Lines Matching defs:theSocketStruct
181 SocketStruct *theSocketStruct = &(sSockets[inSocketNum]);
186 *outSocketErrCode = theSocketStruct->mLastError;
191 CopyCStrToCStr(theSocketStruct->mErrMessage,outSocketErrString,inSocketErrStringMaxLength);
201 SocketStruct *theSocketStruct = &(sSockets[inSocketNum]);
203 theSocketStruct->mUserRefPtr = inNewRefPtr;
214 SocketStruct *theSocketStruct = &(sSockets[inSocketNum]);
219 if (theSocketStruct->mAssignedAddrInfo != nil)
221 InetAddress *theInetAddress = (InetAddress *) theSocketStruct->mAssignedAddrInfo->addr.buf;
251 SocketStruct *theSocketStruct = &(sSockets[inSocketNum]);
256 if (theSocketStruct->mRemoteAddrInfo != nil)
258 InetAddress *theInetAddress = (InetAddress *) theSocketStruct->mRemoteAddrInfo->addr.buf;
289 SocketStruct *theSocketStruct = &(sSockets[inSocketNum]);
291 theResult = theSocketStruct->mReceivedTOrdRel;
305 SocketStruct *theSocketStruct = &(sSockets[inSocketNum]);
307 theResult = theSocketStruct->mReceivedTPassCon;
319 SocketStruct *theSocketStruct = &(sSockets[inSocketNum]);
321 return(theSocketStruct->mRemoteEndIsConnected);
336 SocketStruct *theSocketStruct = &(sSockets[inSocketNum]);
338 return(theSocketStruct->mLocalEndIsConnected);
489 SocketStruct *theSocketStruct = (SocketStruct *) contextPtr;
491 if (theSocketStruct != nil)
493 if (theSocketStruct->mExpectedCode != 0 && code == theSocketStruct->mExpectedCode)
495 theSocketStruct->mAsyncOperationResult = result;
497 theSocketStruct->mExpectedCode = 0;
505 theSocketStruct->mReceivedTOpenComplete = true;
507 theSocketStruct->mEndPointRef = (EndpointRef) cookie;
515 theSocketStruct->mReceivedTBindComplete = true;
523 theSocketStruct->mReceivedTConnect = true;
525 theSocketStruct->mLocalEndIsConnected = true;
527 theSocketStruct->mRemoteEndIsConnected = true;
535 theSocketStruct->mReceivedTListen = true;
543 theSocketStruct->mReceivedTPassCon = true;
545 theSocketStruct->mLocalEndIsConnected = true;
547 theSocketStruct->mRemoteEndIsConnected = true;
555 theSocketStruct->mReadyToReadData = true;
562 theSocketStruct->mReadyToWriteData = true;
569 theSocketStruct->mReceivedTDisconnect = true;
571 theSocketStruct->mRemoteEndIsConnected = false;
573 theSocketStruct->mLocalEndIsConnected = false;
575 ::OTRcvDisconnect(theSocketStruct->mEndPointRef,nil);
582 theSocketStruct->mReceivedTOrdRel = true;
586 ::OTRcvOrderlyDisconnect(theSocketStruct->mEndPointRef);
593 theSocketStruct->mReceivedTDisconnectComplete = true;
595 theSocketStruct->mRemoteEndIsConnected = false;
597 theSocketStruct->mLocalEndIsConnected = false;
650 SocketStruct *theSocketStruct = &(sSockets[i]);
652 if (theSocketStruct->mIsInUse)
654 if (theSocketStruct->mEndPointRef != kOTInvalidEndpointRef)
662 if (theSocketStruct->mLocalEndIsConnected)
666 theOTResult = ::OTSndDisconnect(theSocketStruct->mEndPointRef, nil);
670 theSocketStruct->mLocalEndIsConnected = false;
674 theOTResult = ::OTCloseProvider(theSocketStruct->mEndPointRef);
677 theSocketStruct->mEndPointRef = kOTInvalidEndpointRef;
680 if (theSocketStruct->mBindRequestedAddrInfo != nil)
682 ::OTFree((void *) theSocketStruct->mBindRequestedAddrInfo,T_BIND);
684 theSocketStruct->mBindRequestedAddrInfo = nil;
687 if (theSocketStruct->mAssignedAddrInfo != nil)
689 ::OTFree((void *) theSocketStruct->mAssignedAddrInfo,T_BIND);
691 theSocketStruct->mAssignedAddrInfo = nil;
694 if (theSocketStruct->mRemoteAddrInfo != nil)
696 ::OTFree((void *) theSocketStruct->mRemoteAddrInfo,T_CALL);
698 theSocketStruct->mRemoteAddrInfo = nil;
742 SocketStruct *theSocketStruct = &(sSockets[i]);
745 InitSocket(theSocketStruct);
747 theSocketStruct->mIdleWaitCallback = inIdleWaitCallback;
748 theSocketStruct->mUserRefPtr = inUserRefPtr;
750 theSocketStruct->mTimeoutTicks = inTimeoutTicks;
755 PrepareForAsyncOperation(theSocketStruct,T_OPENCOMPLETE);
757 theOTResult = ::OTAsyncOpenEndpoint(OTCreateConfiguration(kTCPName),0,nil,OTNonYieldingNotifier,(void *) theSocketStruct);
761 BailIfError(MyBusyWait(theSocketStruct,false,&theOTResult,&(theSocketStruct->mReceivedTOpenComplete)));
770 theSocketStruct->mIsInUse = true;
795 SocketStruct *theSocketStruct = nil;
804 theSocketStruct = &(sSockets[inSocketNum]);
810 if (theSocketStruct->mBindRequestedAddrInfo == nil)
812 theSocketStruct->mBindRequestedAddrInfo = (TBind *) ::OTAlloc(theSocketStruct->mEndPointRef,T_BIND,T_ADDR,&theOTResult);
815 SetErrorMessageAndBailIfNil(theSocketStruct->mBindRequestedAddrInfo,"MacSocket_listen: Can't allocate OT T_BIND structure, OTAlloc() returned nil");
818 if (theSocketStruct->mAssignedAddrInfo == nil)
820 theSocketStruct->mAssignedAddrInfo = (TBind *) ::OTAlloc(theSocketStruct->mEndPointRef,T_BIND,T_ADDR,&theOTResult);
823 SetErrorMessageAndBailIfNil(theSocketStruct->mAssignedAddrInfo,"MacSocket_listen: Can't allocate OT T_BIND structure, OTAlloc() returned nil");
826 if (theSocketStruct->mRemoteAddrInfo == nil)
828 theSocketStruct->mRemoteAddrInfo = (TCall *) ::OTAlloc(theSocketStruct->mEndPointRef,T_CALL,T_ADDR,&theOTResult);
831 SetErrorMessageAndBailIfNil(theSocketStruct->mRemoteAddrInfo,"MacSocket_listen: Can't allocate OT T_CALL structure, OTAlloc() returned nil");
835 if (!theSocketStruct->mEndpointIsBound)
844 InetAddress *theInetAddress = (InetAddress *) theSocketStruct->mBindRequestedAddrInfo->addr.buf;
852 theSocketStruct->mBindRequestedAddrInfo->addr.len = sizeof(InetAddress);
854 theSocketStruct->mBindRequestedAddrInfo->qlen = 1;
857 theOTResult = ::OTSetSynchronous(theSocketStruct->mEndPointRef);
861 theOTResult = NegotiateIPReuseAddrOption(theSocketStruct->mEndPointRef,true);
865 theOTResult = ::OTSetAsynchronous(theSocketStruct->mEndPointRef);
870 PrepareForAsyncOperation(theSocketStruct,T_BINDCOMPLETE);
872 theOTResult = ::OTBind(theSocketStruct->mEndPointRef,theSocketStruct->mBindRequestedAddrInfo,theSocketStruct->mAssignedAddrInfo);
876 BailIfError(MyBusyWait(theSocketStruct,false,&theOTResult,&(theSocketStruct->mReceivedTBindComplete)));
881 theSocketStruct->mEndpointIsBound = true;
885 PrepareForAsyncOperation(theSocketStruct,T_LISTEN);
887 theOTResult = ::OTListen(theSocketStruct->mEndPointRef,theSocketStruct->mRemoteAddrInfo);
891 PrepareForAsyncOperation(theSocketStruct,T_PASSCON);
893 theOTResult = ::OTAccept(theSocketStruct->mEndPointRef,theSocketStruct->mEndPointRef,theSocketStruct->mRemoteAddrInfo);
897 BailIfError(MyBusyWait(theSocketStruct,false,&theOTResult,&(theSocketStruct->mReceivedTPassCon)));
918 if (theSocketStruct != nil)
920 theSocketStruct->mLastError = noErr;
922 CopyCStrToCStr("",theSocketStruct->mErrMessage,sizeof(theSocketStruct->mErrMessage));
926 theSocketStruct->mLastError = errCode;
928 CopyCStrToCStr(GetErrorMessage(),theSocketStruct->mErrMessage,sizeof(theSocketStruct->mErrMessage));
943 SocketStruct *theSocketStruct = nil;
951 theSocketStruct = &(sSockets[inSocketNum]);
953 if (theSocketStruct->mEndpointIsBound)
961 theSocketStruct->mBindRequestedAddrInfo = (TBind *) ::OTAlloc(theSocketStruct->mEndPointRef,T_BIND,T_ADDR,&theOTResult);
964 SetErrorMessageAndBailIfNil(theSocketStruct->mBindRequestedAddrInfo,"MacSocket_connect: Can't allocate OT T_BIND structure, OTAlloc() returned nil");
967 theSocketStruct->mAssignedAddrInfo = (TBind *) ::OTAlloc(theSocketStruct->mEndPointRef,T_BIND,T_ADDR,&theOTResult);
970 SetErrorMessageAndBailIfNil(theSocketStruct->mAssignedAddrInfo,"MacSocket_connect: Can't allocate OT T_BIND structure, OTAlloc() returned nil");
973 theSocketStruct->mRemoteAddrInfo = (TCall *) ::OTAlloc(theSocketStruct->mEndPointRef,T_CALL,T_ADDR,&theOTResult);
976 SetErrorMessageAndBailIfNil(theSocketStruct->mRemoteAddrInfo,"MacSocket_connect: Can't allocate OT T_CALL structure, OTAlloc() returned nil");
979 PrepareForAsyncOperation(theSocketStruct,T_BINDCOMPLETE);
981 theOTResult = ::OTBind(theSocketStruct->mEndPointRef,nil,theSocketStruct->mAssignedAddrInfo);
985 BailIfError(MyBusyWait(theSocketStruct,false,&theOTResult,&(theSocketStruct->mReceivedTBindComplete)));
989 theSocketStruct->mEndpointIsBound = true;
1007 PrepareForAsyncOperation(theSocketStruct,T_CONNECT);
1009 theOTResult = ::OTConnect(theSocketStruct->mEndPointRef,&sndCall,nil);
1018 BailIfError(MyBusyWait(theSocketStruct,false,&theOTResult,&(theSocketStruct->mReceivedTConnect)));
1030 theOTResult = ::OTRcvConnect(theSocketStruct->mEndPointRef,nil);
1044 if (theSocketStruct != nil)
1046 theSocketStruct->mLastError = noErr;
1048 CopyCStrToCStr("",theSocketStruct->mErrMessage,sizeof(theSocketStruct->mErrMessage));
1052 theSocketStruct->mLastError = errCode;
1054 CopyCStrToCStr(GetErrorMessage(),theSocketStruct->mErrMessage,sizeof(theSocketStruct->mErrMessage));
1071 SocketStruct *theSocketStruct = nil;
1080 theSocketStruct = &(sSockets[inSocketNum]);
1082 if (theSocketStruct->mEndPointRef != kOTInvalidEndpointRef)
1088 if (theSocketStruct->mReceivedTOrdRel)
1092 if (theSocketStruct->mLocalEndIsConnected)
1094 theOTResult = ::OTSndOrderlyDisconnect(theSocketStruct->mEndPointRef);
1096 theSocketStruct->mLocalEndIsConnected = false;
1100 else if (theSocketStruct->mLocalEndIsConnected)
1102 theOTResult = ::OTSndOrderlyDisconnect(theSocketStruct->mEndPointRef);
1104 theSocketStruct->mLocalEndIsConnected = false;
1108 // PrepareForAsyncOperation(theSocketStruct,T_ORDREL);
1110 // errCode = MyBusyWait(theSocketStruct,false,&theOTResult,&(theSocketStruct->mReceivedTOrdRel));
1116 ::OTCloseProvider(theSocketStruct->mEndPointRef);
1121 theOTResult = ::OTCloseProvider(theSocketStruct->mEndPointRef);
1124 theSocketStruct->mEndPointRef = kOTInvalidEndpointRef;
1130 theSocketStruct->mIsInUse = false;
1135 if (theSocketStruct != nil)
1137 theSocketStruct->mLastError = noErr;
1139 CopyCStrToCStr("",theSocketStruct->mErrMessage,sizeof(theSocketStruct->mErrMessage));
1143 theSocketStruct->mLastError = errCode;
1145 CopyCStrToCStr(GetErrorMessage(),theSocketStruct->mErrMessage,sizeof(theSocketStruct->mErrMessage));
1163 SocketStruct *theSocketStruct = nil;
1178 theSocketStruct = &(sSockets[inSocketNum]);
1180 if (!theSocketStruct->mLocalEndIsConnected)
1185 if (theSocketStruct->mReceivedTOrdRel)
1193 PrepareForAsyncOperation(theSocketStruct,0);
1201 theOTResult = ::OTRcv(theSocketStruct->mEndPointRef,(void *) ((unsigned long) outBuff + (unsigned long) totalBytesRead),outBuffLength - totalBytesRead,nil);
1228 if (theSocketStruct->mReceivedTOrdRel)
1237 if (TimeoutElapsed(theSocketStruct))
1242 if (theSocketStruct->mIdleWaitCallback != nil)
1244 theOTResult = (*(theSocketStruct->mIdleWaitCallback))(theSocketStruct->mUserRefPtr);
1267 if (theSocketStruct != nil)
1269 theSocketStruct->mLastError = noErr;
1271 CopyCStrToCStr("",theSocketStruct->mErrMessage,sizeof(theSocketStruct->mErrMessage));
1275 theSocketStruct->mLastError = errCode;
1277 CopyCStrToCStr(GetErrorMessage(),theSocketStruct->mErrMessage,sizeof(theSocketStruct->mErrMessage));
1294 SocketStruct *theSocketStruct = nil;
1310 theSocketStruct = &(sSockets[inSocketNum]);
1312 if (!theSocketStruct->mLocalEndIsConnected)
1321 PrepareForAsyncOperation(theSocketStruct,0);
1325 if (theSocketStruct->mIdleWaitCallback != nil)
1327 theOTResult = (*(theSocketStruct->mIdleWaitCallback))(theSocketStruct->mUserRefPtr);
1333 theOTResult = ::OTSnd(theSocketStruct->mEndPointRef,(void *) ((unsigned long) inBuff + bytesSent),inBuffLength - bytesSent,0);
1343 PrepareForAsyncOperation(theSocketStruct,0);
1348 if (TimeoutElapsed(theSocketStruct))
1369 if (theSocketStruct != nil)
1371 theSocketStruct->mLastError = noErr;
1373 CopyCStrToCStr("",theSocketStruct->mErrMessage,sizeof(theSocketStruct->mErrMessage));
1377 theSocketStruct->mLastError = errCode;
1379 CopyCStrToCStr(GetErrorMessage(),theSocketStruct->mErrMessage,sizeof(theSocketStruct->mErrMessage));