Sample Code
Windows Driver Samples/ Windows Filtering Platform Sample/ C++/ lib/ HelperFunctions_WinSock.h/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | //////////////////////////////////////////////////////////////////////////////////////////////////// // // Copyright (c) 2012 Microsoft Corporation. All Rights Reserved. // // Module Name: // HelperFunctions_WinSock.h // // Abstract: // This module contains prototypes of functions which assist in operations pertaining to // Windows Sockets. // // Author: // Dusty Harper (DHarper) // // Revision History: // // [ Month ][Day] [Year] - [Revision]-[ Comments ] // May 01, 2010 - 1.0 - Creation // //////////////////////////////////////////////////////////////////////////////////////////////////// #ifndef HELPERFUNCTIONS_WINSOCK_H #define HELPERFUNCTIONS_WINSOCK_H _Success_( return == NO_ERROR) UINT32 HlprWinSockCleanup(); _Success_( return == NO_ERROR) UINT32 HlprWinSockInitialize(); _Success_( return == NO_ERROR) UINT32 HlprWinSockDestroyWSAEvent(_Inout_ WSAEVENT* pWSAEvent); _Success_( return == NO_ERROR) UINT32 HlprWinSockSetWSAEvent(_In_ WSAEVENT wsaEvent); _Success_( return == NO_ERROR) UINT32 HlprWinSockCreateWSAEvent(_Inout_ WSAEVENT* pWSAEvent); _Success_( return == NO_ERROR) UINT32 HlprWinSockDestroySocket(_Inout_ SOCKET* pSocket); _Success_( return == NO_ERROR) UINT32 HlprWinSockCreateSocket(_In_ SOCKADDR_STORAGE* pSockAddr, _In_ UINT8 protocol, _Inout_ SOCKET* pSocket); _Success_( return == NO_ERROR) UINT32 HlprWinSockSetAbortiveDisconnect(_In_ SOCKET abortedSocket); _Success_( return == NO_ERROR) UINT32 HlprWinSockSetSocketReceiveTimeout(_In_ SOCKET receivingSocket, _In_ UINT32 timeout = 5000); _Success_( return == NO_ERROR) UINT32 HlprWinSockSetSocketSendTimeout(_In_ SOCKET sendingSocket, _In_ UINT32 timeout = 5000); _Success_( return == NO_ERROR) UINT32 HlprWinSockSetSocketNonBlocking(_In_ SOCKET unboundSocket); _Success_( return == NO_ERROR) UINT32 HlprWinSockAcquirePortReservationForSocket(_In_ SOCKET unboundSocket, _In_ INET_PORT_RANGE* pPortRange, _Inout_ UINT64 * pReservationToken); _Success_( return == NO_ERROR) UINT32 HlprWinSockAssociatePortReservationWithSocket(_In_ SOCKET unboundSocket, _In_ UINT64 reservationToken); _Success_( return == NO_ERROR) UINT32 HlprWinSockQueryPortReservation(_In_ UINT8 ipProtocol, _In_ INET_PORT_RANGE* pPortRange, _Inout_ UINT64 * pReservationToken); _Success_( return == NO_ERROR) UINT32 HlprWinSockDestroyPortReservation(_In_ UINT8 ipProtocol, _In_ INET_PORT_RANGE* pPortRange, _Inout_opt_ UINT64 * pReservationToken = 0); _Success_( return == NO_ERROR) UINT32 HlprWinSockCreatePortReservation(_In_ UINT8 ipProtocol, _In_ INET_PORT_RANGE* pPortRange, _Inout_ UINT64 * pReservationToken); #if(NTDDI_VERSION >= NTDDI_WIN8) _Success_( return == NO_ERROR) UINT32 HlprWinSockAssociateResourceRecordsWithProxiedConnection(_In_ SOCKET originalSocket, _Inout_ SOCKET proxySocket, _Inout_ SOCKADDR_STORAGE* pRemoteSockAddrStorage, _Inout_opt_ SOCKADDR_STORAGE* pOriginSockAddrStorage = 0); #endif /// (NTDDI_VERSION >= NTDDI_WIN8) _Success_( return == NO_ERROR) UINT32 HlprWinSockBindToSocket(_In_ SOCKET unboundSocket, _In_ SOCKADDR_STORAGE* pSockAddrStorage); _Success_( return == NO_ERROR) UINT32 HlprWinSockListenOnSocket(_In_ SOCKET boundSocket); _Success_( return == NO_ERROR) UINT32 HlprWinSockAcceptConnection(_In_ SOCKET listeningSocket, _Inout_ SOCKET* pConnectedSocket, _Inout_ SOCKADDR_STORAGE* pPeerSockAddrStorage); _Success_( return == NO_ERROR) UINT32 HlprWinSockConnectSocket(_In_ SOCKET unconnectedSocket, _In_ SOCKADDR_STORAGE* pPeerSockAddrStorage); _Success_( return == NO_ERROR) UINT32 HlprWinSockReceiveTCPData(_In_ SOCKET receivingSocket, _Inout_updates_(numDataBuffers) WSABUF* pDataBuffers, _Inout_ UINT32 * pNumBytesReceived, _In_opt_ LPWSAOVERLAPPED pOverlapped = 0, _In_opt_ LPWSAOVERLAPPED_COMPLETION_ROUTINE pCompletionFn = 0, _In_ UINT32 numDataBuffers = 1, _In_ UINT32 msgFlags = 0); _Success_( return == NO_ERROR) UINT32 HlprWinSockSendTCPData(_In_ SOCKET sendingSocket, _In_reads_(numDataBuffers) WSABUF* pDataBuffers, _Inout_opt_ UINT32 * pNumBytesTransmitted, _In_opt_ LPWSAOVERLAPPED pOverlapped = 0, _In_opt_ LPWSAOVERLAPPED_COMPLETION_ROUTINE pCompletionFn = 0, _In_ UINT32 numDataBuffers = 1); #endif /// HELPERFUNCTIONS_WINSOCK_H |
Our Services
-
What our customers say about us?
Read our customer testimonials to find out why our clients keep returning for their projects.
View Testimonials