FreeRDP
pipe.c File Reference
#include <winpr/config.h>
#include <winpr/crt.h>
#include <winpr/path.h>
#include <winpr/synch.h>
#include <winpr/handle.h>
#include <winpr/pipe.h>
#include "../handle/handle.h"
#include <fcntl.h>
#include <errno.h>
#include <sys/un.h>
#include <sys/socket.h>
#include <winpr/assert.h>
#include "pipe.h"
#include "../log.h"

Macros

#define TAG   WINPR_TAG("pipe")
 

Functions

static BOOL PipeIsHandled (HANDLE handle)
 
static int PipeGetFd (HANDLE handle)
 
static BOOL PipeCloseHandle (HANDLE handle)
 
static BOOL PipeRead (PVOID Object, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped)
 
static BOOL PipeWrite (PVOID Object, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped)
 
static BOOL NamedPipeIsHandled (HANDLE handle)
 
static int NamedPipeGetFd (HANDLE handle)
 
static BOOL NamedPipeCloseHandle (HANDLE handle)
 
BOOL NamedPipeRead (PVOID Object, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped)
 
BOOL NamedPipeWrite (PVOID Object, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped)
 
static BOOL InitWinPRPipeModule (void)
 
BOOL CreatePipe (PHANDLE hReadPipe, PHANDLE hWritePipe, LPSECURITY_ATTRIBUTES lpPipeAttributes, DWORD nSize)
 
static void winpr_unref_named_pipe (WINPR_NAMED_PIPE *pNamedPipe)
 
HANDLE CreateNamedPipeA (LPCSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode, DWORD nMaxInstances, DWORD nOutBufferSize, DWORD nInBufferSize, DWORD nDefaultTimeOut, LPSECURITY_ATTRIBUTES lpSecurityAttributes)
 
HANDLE CreateNamedPipeW (LPCWSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode, DWORD nMaxInstances, DWORD nOutBufferSize, DWORD nInBufferSize, DWORD nDefaultTimeOut, LPSECURITY_ATTRIBUTES lpSecurityAttributes)
 
BOOL ConnectNamedPipe (HANDLE hNamedPipe, LPOVERLAPPED lpOverlapped)
 
BOOL DisconnectNamedPipe (HANDLE hNamedPipe)
 
BOOL PeekNamedPipe (HANDLE hNamedPipe, LPVOID lpBuffer, DWORD nBufferSize, LPDWORD lpBytesRead, LPDWORD lpTotalBytesAvail, LPDWORD lpBytesLeftThisMessage)
 
BOOL TransactNamedPipe (HANDLE hNamedPipe, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesRead, LPOVERLAPPED lpOverlapped)
 
BOOL WaitNamedPipeA (LPCSTR lpNamedPipeName, DWORD nTimeOut)
 
BOOL WaitNamedPipeW (LPCWSTR lpNamedPipeName, DWORD nTimeOut)
 
BOOL SetNamedPipeHandleState (HANDLE hNamedPipe, LPDWORD lpMode, LPDWORD lpMaxCollectionCount, LPDWORD lpCollectDataTimeout)
 
BOOL ImpersonateNamedPipeClient (HANDLE hNamedPipe)
 
BOOL GetNamedPipeClientComputerNameA (HANDLE Pipe, LPCSTR ClientComputerName, ULONG ClientComputerNameLength)
 
BOOL GetNamedPipeClientComputerNameW (HANDLE Pipe, LPCWSTR ClientComputerName, ULONG ClientComputerNameLength)
 

Variables

static wArrayList * g_NamedPipeServerSockets = NULL
 
static HANDLE_OPS ops
 
static HANDLE_OPS namedOps
 

Macro Definition Documentation

◆ TAG

#define TAG   WINPR_TAG("pipe")

WinPR: Windows Portable Runtime Pipe Functions

Copyright 2012 Marc-Andre Moreau marca.nosp@m.ndre.nosp@m..more.nosp@m.au@g.nosp@m.mail..nosp@m.com Copyright 2017 Armin Novak armin.nosp@m..nov.nosp@m.ak@th.nosp@m.inca.nosp@m.st.co.nosp@m.m Copyright 2017 Thincast Technologies GmbH

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Function Documentation

◆ ConnectNamedPipe()

BOOL ConnectNamedPipe ( HANDLE  hNamedPipe,
LPOVERLAPPED  lpOverlapped 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CreateNamedPipeA()

HANDLE CreateNamedPipeA ( LPCSTR  lpName,
DWORD  dwOpenMode,
DWORD  dwPipeMode,
DWORD  nMaxInstances,
DWORD  nOutBufferSize,
DWORD  nInBufferSize,
DWORD  nDefaultTimeOut,
LPSECURITY_ATTRIBUTES  lpSecurityAttributes 
)

Named pipe

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CreateNamedPipeW()

HANDLE CreateNamedPipeW ( LPCWSTR  lpName,
DWORD  dwOpenMode,
DWORD  dwPipeMode,
DWORD  nMaxInstances,
DWORD  nOutBufferSize,
DWORD  nInBufferSize,
DWORD  nDefaultTimeOut,
LPSECURITY_ATTRIBUTES  lpSecurityAttributes 
)
Here is the call graph for this function:

◆ CreatePipe()

BOOL CreatePipe ( PHANDLE  hReadPipe,
PHANDLE  hWritePipe,
LPSECURITY_ATTRIBUTES  lpPipeAttributes,
DWORD  nSize 
)

Unnamed pipe

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DisconnectNamedPipe()

BOOL DisconnectNamedPipe ( HANDLE  hNamedPipe)
Here is the caller graph for this function:

◆ GetNamedPipeClientComputerNameA()

BOOL GetNamedPipeClientComputerNameA ( HANDLE  Pipe,
LPCSTR  ClientComputerName,
ULONG  ClientComputerNameLength 
)
Here is the call graph for this function:

◆ GetNamedPipeClientComputerNameW()

BOOL GetNamedPipeClientComputerNameW ( HANDLE  Pipe,
LPCWSTR  ClientComputerName,
ULONG  ClientComputerNameLength 
)
Here is the call graph for this function:

◆ ImpersonateNamedPipeClient()

BOOL ImpersonateNamedPipeClient ( HANDLE  hNamedPipe)
Here is the call graph for this function:

◆ InitWinPRPipeModule()

static BOOL InitWinPRPipeModule ( void  )
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ NamedPipeCloseHandle()

static BOOL NamedPipeCloseHandle ( HANDLE  handle)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ NamedPipeGetFd()

static int NamedPipeGetFd ( HANDLE  handle)
static
Here is the call graph for this function:

◆ NamedPipeIsHandled()

static BOOL NamedPipeIsHandled ( HANDLE  handle)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ NamedPipeRead()

BOOL NamedPipeRead ( PVOID  Object,
LPVOID  lpBuffer,
DWORD  nNumberOfBytesToRead,
LPDWORD  lpNumberOfBytesRead,
LPOVERLAPPED  lpOverlapped 
)
Here is the call graph for this function:

◆ NamedPipeWrite()

BOOL NamedPipeWrite ( PVOID  Object,
LPCVOID  lpBuffer,
DWORD  nNumberOfBytesToWrite,
LPDWORD  lpNumberOfBytesWritten,
LPOVERLAPPED  lpOverlapped 
)
Here is the call graph for this function:

◆ PeekNamedPipe()

BOOL PeekNamedPipe ( HANDLE  hNamedPipe,
LPVOID  lpBuffer,
DWORD  nBufferSize,
LPDWORD  lpBytesRead,
LPDWORD  lpTotalBytesAvail,
LPDWORD  lpBytesLeftThisMessage 
)
Here is the call graph for this function:

◆ PipeCloseHandle()

static BOOL PipeCloseHandle ( HANDLE  handle)
static
Here is the call graph for this function:

◆ PipeGetFd()

static int PipeGetFd ( HANDLE  handle)
static
Here is the call graph for this function:

◆ PipeIsHandled()

static BOOL PipeIsHandled ( HANDLE  handle)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PipeRead()

static BOOL PipeRead ( PVOID  Object,
LPVOID  lpBuffer,
DWORD  nNumberOfBytesToRead,
LPDWORD  lpNumberOfBytesRead,
LPOVERLAPPED  lpOverlapped 
)
static
Here is the call graph for this function:

◆ PipeWrite()

static BOOL PipeWrite ( PVOID  Object,
LPCVOID  lpBuffer,
DWORD  nNumberOfBytesToWrite,
LPDWORD  lpNumberOfBytesWritten,
LPOVERLAPPED  lpOverlapped 
)
static
Here is the call graph for this function:

◆ SetNamedPipeHandleState()

BOOL SetNamedPipeHandleState ( HANDLE  hNamedPipe,
LPDWORD  lpMode,
LPDWORD  lpMaxCollectionCount,
LPDWORD  lpCollectDataTimeout 
)
Here is the call graph for this function:

◆ TransactNamedPipe()

BOOL TransactNamedPipe ( HANDLE  hNamedPipe,
LPVOID  lpInBuffer,
DWORD  nInBufferSize,
LPVOID  lpOutBuffer,
DWORD  nOutBufferSize,
LPDWORD  lpBytesRead,
LPOVERLAPPED  lpOverlapped 
)
Here is the call graph for this function:

◆ WaitNamedPipeA()

BOOL WaitNamedPipeA ( LPCSTR  lpNamedPipeName,
DWORD  nTimeOut 
)
Here is the call graph for this function:

◆ WaitNamedPipeW()

BOOL WaitNamedPipeW ( LPCWSTR  lpNamedPipeName,
DWORD  nTimeOut 
)
Here is the call graph for this function:

◆ winpr_unref_named_pipe()

static void winpr_unref_named_pipe ( WINPR_NAMED_PIPE *  pNamedPipe)
static

Named pipe

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ g_NamedPipeServerSockets

wArrayList* g_NamedPipeServerSockets = NULL
static

◆ namedOps

HANDLE_OPS namedOps
static
Initial value:
NULL,
NULL }
if availableBytes return NULL
Definition: TPCircularBuffer.h:109
static int NamedPipeGetFd(HANDLE handle)
Definition: pipe.c:206
static BOOL NamedPipeIsHandled(HANDLE handle)
Definition: pipe.c:201
BOOL NamedPipeWrite(PVOID Object, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped)
Definition: pipe.c:341
BOOL NamedPipeRead(PVOID Object, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped)
Definition: pipe.c:248
static BOOL NamedPipeCloseHandle(HANDLE handle)
Definition: pipe.c:219

◆ ops

HANDLE_OPS ops
static
Initial value:
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
,
NULL }
static BOOL PipeCloseHandle(HANDLE handle)
Definition: pipe.c:95
static int PipeGetFd(HANDLE handle)
Definition: pipe.c:85
static BOOL PipeRead(PVOID Object, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped)
Definition: pipe.c:112
static BOOL PipeWrite(PVOID Object, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped)
Definition: pipe.c:151
static BOOL PipeIsHandled(HANDLE handle)
Definition: pipe.c:80