sockinfo.cpp File Reference#include "lspdef.h"
Include dependency graph for sockinfo.cpp:
![]() Go to the source code of this file.
Function Documentation
Definition at line 94 of file sockinfo.cpp. 00099 { 00100 SOCKET_CONTEXT *newContext = NULL; 00101 00102 newContext = (SOCKET_CONTEXT *) LspAlloc( 00103 sizeof( SOCKET_CONTEXT ), 00104 lpErrno 00105 ); 00106 if ( NULL == newContext ) 00107 { 00108 dbgprint("CreateSocketContext: LspAlloc failed: %d", *lpErrno ); 00109 goto cleanup; 00110 } 00111 00112 newContext->Socket = Socket; 00113 newContext->Provider = Provider; 00114 newContext->Proxied = FALSE; 00115 00116 EnterCriticalSection( &Provider->ProviderCritSec ); 00117 00118 InsertHeadList( &Provider->SocketList, &newContext->Link ); 00119 00120 LeaveCriticalSection( &Provider->ProviderCritSec ); 00121 00122 return newContext; 00123 00124 cleanup: 00125 00126 return NULL; 00127 }
Definition at line 32 of file sockinfo.cpp. 00036 { 00037 SOCKET_CONTEXT *SocketContext = NULL, 00038 *info = NULL; 00039 LIST_ENTRY *lptr = NULL; 00040 int i; 00041 00042 EnterCriticalSection( &gCriticalSection ); 00043 00044 for(i=0; i < gLayerCount ;i++) 00045 { 00046 EnterCriticalSection( &gLayerInfo[ i ].ProviderCritSec ); 00047 00048 for(lptr = gLayerInfo[ i ].SocketList.Flink ; 00049 lptr != &gLayerInfo[ i ].SocketList ; 00050 lptr = lptr->Flink ) 00051 { 00052 info = CONTAINING_RECORD( lptr, SOCKET_CONTEXT, Link ); 00053 00054 if ( s == info->Socket ) 00055 { 00056 SocketContext = info; 00057 00058 if ( TRUE == Remove ) 00059 { 00060 RemoveEntryList( &info->Link ); 00061 } 00062 break; 00063 } 00064 } 00065 00066 LeaveCriticalSection( &gLayerInfo[ i ].ProviderCritSec ); 00067 00068 if ( NULL != SocketContext ) 00069 break; 00070 } 00071 00072 LeaveCriticalSection( &gCriticalSection ); 00073 00074 return SocketContext; 00075 }
Definition at line 136 of file sockinfo.cpp. 00140 { 00141 EnterCriticalSection( &Provider->ProviderCritSec ); 00142 00143 RemoveEntryList( &Context->Link ); 00144 LspFree( Context ); 00145 00146 LeaveCriticalSection( &Provider->ProviderCritSec ); 00147 00148 return; 00149 }
Definition at line 160 of file sockinfo.cpp. 00163 { 00164 LIST_ENTRY *lptr = NULL; 00165 SOCKET_CONTEXT *context = NULL; 00166 00167 ASSERT( provider ); 00168 00169 // Walk the list of sockets 00170 while ( !IsListEmpty( &provider->SocketList ) ) 00171 { 00172 lptr = RemoveHeadList( &provider->SocketList ); 00173 00174 ASSERT( lptr ); 00175 00176 context = CONTAINING_RECORD( lptr, SOCKET_CONTEXT, Link ); 00177 00178 // Context is already removed so just free it 00179 LspFree( context ); 00180 } 00181 00182 return; 00183 }
|