Retail products


Traffic interception SDK

Control every TCP/IP network connection

  • Route connections via proxy
  • Redirect connections and modify the data
  • Block connections and applications
SSL interception SDK

View SSL in plaintext and modify it

  • View the SSL stream decrypted in plaintext
  • Redirect SSL connection and modify decrypted data
  • Browser shows "SSL lock" without warnings

Documentation


extension.cpp File Reference

#include "lspdef.h"

Include dependency graph for extension.cpp:

Go to the source code of this file.


Functions

BOOL LoadExtensionFunction (FARPROC **func, GUID ExtensionGuid, LPWSPIOCTL fnIoctl, SOCKET s)
BOOL PASCAL FAR ExtConnectEx (IN SOCKET s, IN const struct sockaddr FAR *name, IN int namelen, IN PVOID lpSendBuffer OPTIONAL, IN DWORD dwSendDataLength, OUT LPDWORD lpdwBytesSent, IN LPOVERLAPPED lpOverlapped)

Function Documentation

BOOL PASCAL FAR ExtConnectEx ( IN SOCKET  s,
IN const struct sockaddr FAR *  name,
IN int  namelen,
IN PVOID lpSendBuffer  OPTIONAL,
IN DWORD  dwSendDataLength,
OUT LPDWORD  lpdwBytesSent,
IN LPOVERLAPPED  lpOverlapped 
)

Definition at line 83 of file extension.cpp.

00092 {
00093     SOCKET_CONTEXT *sockContext = NULL;
00094     SOCKADDR       *proxyAddr = NULL;
00095     int             Errno = NO_ERROR,
00096                     proxyLen = 0,
00097                     rc = FALSE;
00098 
00099     sockContext = FindSocketContext( s );
00100     if ( NULL == sockContext )
00101     {
00102         dbgprint("ExtConnectEx: FindSocketContext failed!");
00103         Errno = WSAENOTSOCK;
00104         goto cleanup;
00105     }
00106 
00107     // Make sure we already have the extension function
00108     if ( NULL == sockContext->Provider->NextProcTableExt.lpfnConnectEx )
00109     {
00110         GUID    guidConnectEx = WSAID_CONNECTEX;
00111 
00112         rc = LoadExtensionFunction(
00113                 (FARPROC **)&sockContext->Provider->NextProcTableExt.lpfnConnectEx,
00114                 guidConnectEx,
00115                 sockContext->Provider->NextProcTable.lpWSPIoctl,
00116                 s
00117                 );
00118         if ( FALSE == rc )
00119         {
00120             dbgprint("Next proc table ConnectEx == NULL!");
00121             Errno = WSAEFAULT;
00122             goto cleanup;
00123         }
00124     }
00125 
00126     // See if the connect needs to be proxied
00127     FindDestinationAddress( sockContext, name, namelen, &proxyAddr, &proxyLen );
00128 
00129     rc = sockContext->Provider->NextProcTableExt.lpfnConnectEx(
00130             s,
00131             proxyAddr,
00132             proxyLen,
00133             lpSendBuffer,
00134             dwSendDataLength,
00135             lpdwBytesSent,
00136             lpOverlapped
00137             );
00138 
00139 cleanup:
00140 
00141     return rc;
00142 }

BOOL LoadExtensionFunction ( FARPROC **  func,
GUID  ExtensionGuid,
LPWSPIOCTL  fnIoctl,
SOCKET  s 
)

Definition at line 35 of file extension.cpp.

00041 {
00042     DWORD   dwBytes;
00043     int     rc, 
00044             error;
00045 
00046     // Use the lower provider's WSPIoctl to load the extension function
00047     rc = fnIoctl(
00048             s,
00049             SIO_GET_EXTENSION_FUNCTION_POINTER,
00050            &ExtensionGuid,
00051             sizeof(GUID),
00052             func,
00053             sizeof(FARPROC),
00054            &dwBytes,
00055             NULL,
00056             NULL,
00057             NULL,
00058            &error
00059             );
00060     if ( SOCKET_ERROR == rc )
00061     {
00062         dbgprint("LoadExtensionFunction: WSAIoctl (SIO_GET_EXTENSION_FUNCTION) failed: %d",
00063             error);
00064         return FALSE;
00065     }
00066     else
00067     {
00068         return TRUE;
00069     }
00070 }