FreeRDP
libfreerdp/core/gateway/rpc.c File Reference
#include <freerdp/config.h>
#include <winpr/crt.h>
#include <winpr/assert.h>
#include <winpr/tchar.h>
#include <winpr/synch.h>
#include <winpr/dsparse.h>
#include <winpr/crypto.h>
#include <freerdp/log.h>
#include <openssl/bio.h>
#include "../proxy.h"
#include "http.h"
#include "ntlm.h"
#include "ncacn_http.h"
#include "rpc_bind.h"
#include "rpc_fault.h"
#include "rpc_client.h"
#include "rpc.h"
#include "rts.h"

Macros

#define TAG   FREERDP_TAG("core.gateway.rpc")
 

Functions

void rpc_pdu_header_print (const rpcconn_hdr_t *header)
 
rpcconn_common_hdr_t rpc_pdu_header_init (const rdpRpc *rpc)
 
size_t rpc_offset_align (size_t *offset, size_t alignment)
 
size_t rpc_offset_pad (size_t *offset, size_t pad)
 
BOOL rpc_get_stub_data_info (const rpcconn_hdr_t *header, size_t *poffset, size_t *length)
 
SSIZE_T rpc_channel_read (RpcChannel *channel, wStream *s, size_t length)
 
SSIZE_T rpc_channel_write (RpcChannel *channel, const BYTE *data, size_t length)
 
BOOL rpc_in_channel_transition_to_state (RpcInChannel *inChannel, CLIENT_IN_CHANNEL_STATE state)
 
static int rpc_channel_rpch_init (RpcClient *client, RpcChannel *channel, const char *inout)
 
static int rpc_in_channel_init (rdpRpc *rpc, RpcInChannel *inChannel)
 
static RpcInChannelrpc_in_channel_new (rdpRpc *rpc)
 
void rpc_channel_free (RpcChannel *channel)
 
BOOL rpc_out_channel_transition_to_state (RpcOutChannel *outChannel, CLIENT_OUT_CHANNEL_STATE state)
 
static int rpc_out_channel_init (rdpRpc *rpc, RpcOutChannel *outChannel)
 
RpcOutChannelrpc_out_channel_new (rdpRpc *rpc)
 
BOOL rpc_virtual_connection_transition_to_state (rdpRpc *rpc, RpcVirtualConnection *connection, VIRTUAL_CONNECTION_STATE state)
 
static RpcVirtualConnectionrpc_virtual_connection_new (rdpRpc *rpc)
 
static void rpc_virtual_connection_free (RpcVirtualConnection *connection)
 
static BOOL rpc_channel_tls_connect (RpcChannel *channel, UINT32 timeout)
 
static int rpc_in_channel_connect (RpcInChannel *inChannel, UINT32 timeout)
 
static int rpc_out_channel_connect (RpcOutChannel *outChannel, int timeout)
 
int rpc_out_channel_replacement_connect (RpcOutChannel *outChannel, int timeout)
 
BOOL rpc_connect (rdpRpc *rpc, UINT32 timeout)
 
rdpRpc * rpc_new (rdpTransport *transport)
 
void rpc_free (rdpRpc *rpc)
 

Variables

static const char * PTYPE_STRINGS []
 

Macro Definition Documentation

◆ TAG

#define TAG   FREERDP_TAG("core.gateway.rpc")

FreeRDP: A Remote Desktop Protocol Implementation RPC over HTTP

Copyright 2012 Fujitsu Technology Solutions GmbH Copyright 2012 Dmitrij Jasnov dmitr.nosp@m.ij.j.nosp@m.asnov.nosp@m.@ts..nosp@m.fujit.nosp@m.su.c.nosp@m.om Copyright 2012 Marc-Andre Moreau marca.nosp@m.ndre.nosp@m..more.nosp@m.au@g.nosp@m.mail..nosp@m.com

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

◆ rpc_channel_free()

void rpc_channel_free ( RpcChannel channel)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rpc_channel_read()

SSIZE_T rpc_channel_read ( RpcChannel channel,
wStream s,
size_t  length 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rpc_channel_rpch_init()

static int rpc_channel_rpch_init ( RpcClient client,
RpcChannel channel,
const char *  inout 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rpc_channel_tls_connect()

static BOOL rpc_channel_tls_connect ( RpcChannel channel,
UINT32  timeout 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rpc_channel_write()

SSIZE_T rpc_channel_write ( RpcChannel channel,
const BYTE data,
size_t  length 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rpc_connect()

BOOL rpc_connect ( rdpRpc *  rpc,
UINT32  timeout 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rpc_free()

void rpc_free ( rdpRpc *  rpc)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rpc_get_stub_data_info()

BOOL rpc_get_stub_data_info ( const rpcconn_hdr_t header,
size_t *  poffset,
size_t *  length 
)

PDU Segments:


| | | PDU Header |

________________________________
PDU Body
________________________________
Security Trailer
________________________________
Authentication Token
________________________________

PDU Structure with verification trailer

MUST only appear in a request PDU!


| | | PDU Header | |________________________________| _______ | | /|\ | | |

Stub Data
________________________________
PDU Body
Stub Pad
________________________________
Verification Trailer
________________________________
Authentication Pad
________________________________ __|/__

| | | Security Trailer |

________________________________
Authentication Token
________________________________

Security Trailer:

The sec_trailer structure MUST be placed at the end of the PDU, including past stub data, when present. The sec_trailer structure MUST be 4-byte aligned with respect to the beginning of the PDU. Padding octets MUST be used to align the sec_trailer structure if its natural beginning is not already 4-byte aligned.

All PDUs that carry sec_trailer information share certain common fields: frag_length and auth_length. The beginning of the sec_trailer structure for each PDU MUST be calculated to start from offset (frag_length – auth_length – 8) from the beginning of the PDU.

Immediately after the sec_trailer structure, there MUST be a BLOB carrying the authentication information produced by the security provider. This BLOB is called the authentication token and MUST be of size auth_length. The size MUST also be equal to the length from the first octet immediately after the sec_trailer structure all the way to the end of the fragment; the two values MUST be the same.

A client or a server that (during composing of a PDU) has allocated more space for the authentication token than the security provider fills in SHOULD fill in the rest of the allocated space with zero octets. These zero octets are still considered to belong to the authentication token part of the PDU.

According to [MS-RPCE], auth_pad_length is the number of padding octets used to 4-byte align the security trailer, but in practice we get values up to 15, which indicates 16-byte alignment.

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

◆ rpc_in_channel_connect()

static int rpc_in_channel_connect ( RpcInChannel inChannel,
UINT32  timeout 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rpc_in_channel_init()

static int rpc_in_channel_init ( rdpRpc *  rpc,
RpcInChannel inChannel 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rpc_in_channel_new()

static RpcInChannel* rpc_in_channel_new ( rdpRpc *  rpc)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rpc_in_channel_transition_to_state()

BOOL rpc_in_channel_transition_to_state ( RpcInChannel inChannel,
CLIENT_IN_CHANNEL_STATE  state 
)
Here is the caller graph for this function:

◆ rpc_new()

rdpRpc* rpc_new ( rdpTransport *  transport)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rpc_offset_align()

size_t rpc_offset_align ( size_t *  offset,
size_t  alignment 
)
Here is the caller graph for this function:

◆ rpc_offset_pad()

size_t rpc_offset_pad ( size_t *  offset,
size_t  pad 
)
Here is the caller graph for this function:

◆ rpc_out_channel_connect()

static int rpc_out_channel_connect ( RpcOutChannel outChannel,
int  timeout 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rpc_out_channel_init()

static int rpc_out_channel_init ( rdpRpc *  rpc,
RpcOutChannel outChannel 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rpc_out_channel_new()

RpcOutChannel* rpc_out_channel_new ( rdpRpc *  rpc)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rpc_out_channel_replacement_connect()

int rpc_out_channel_replacement_connect ( RpcOutChannel outChannel,
int  timeout 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rpc_out_channel_transition_to_state()

BOOL rpc_out_channel_transition_to_state ( RpcOutChannel outChannel,
CLIENT_OUT_CHANNEL_STATE  state 
)
Here is the caller graph for this function:

◆ rpc_pdu_header_init()

rpcconn_common_hdr_t rpc_pdu_header_init ( const rdpRpc *  rpc)
Here is the caller graph for this function:

◆ rpc_pdu_header_print()

void rpc_pdu_header_print ( const rpcconn_hdr_t header)

[MS-RPCH]: Remote Procedure Call over HTTP Protocol Specification: http://msdn.microsoft.com/en-us/library/cc243950/

                             Connection Establishment\n

Client Outbound Proxy Inbound Proxy Server
| | | |
|--------------—IN Channel Request------------—>| |
|—OUT Channel Request-->| |<-Legacy Server Response-|
| |<-----------—Legacy Server Response-----------—|
| | | |
|------—CONN_A1-----—>| | |
|-------------------—CONN_B1------------------—>| |
| |-------------------—CONN_A2------------------—>|
| | | |
|<–OUT Channel Response–| |------—CONN_B2-----—>|
|<-----—CONN_A3------—| | |
| |<------------------—CONN_C1-------------------—|
| | |<-----—CONN_B3------—|
|<-----—CONN_C2------—| | |
| | | |

◆ rpc_virtual_connection_free()

static void rpc_virtual_connection_free ( RpcVirtualConnection connection)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rpc_virtual_connection_new()

static RpcVirtualConnection* rpc_virtual_connection_new ( rdpRpc *  rpc)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rpc_virtual_connection_transition_to_state()

BOOL rpc_virtual_connection_transition_to_state ( rdpRpc *  rpc,
RpcVirtualConnection connection,
VIRTUAL_CONNECTION_STATE  state 
)
Here is the caller graph for this function:

Variable Documentation

◆ PTYPE_STRINGS

const char* PTYPE_STRINGS[]
static
Initial value:
= { "PTYPE_REQUEST", "PTYPE_PING",
"PTYPE_RESPONSE", "PTYPE_FAULT",
"PTYPE_WORKING", "PTYPE_NOCALL",
"PTYPE_REJECT", "PTYPE_ACK",
"PTYPE_CL_CANCEL", "PTYPE_FACK",
"PTYPE_CANCEL_ACK", "PTYPE_BIND",
"PTYPE_BIND_ACK", "PTYPE_BIND_NAK",
"PTYPE_ALTER_CONTEXT", "PTYPE_ALTER_CONTEXT_RESP",
"PTYPE_RPC_AUTH_3", "PTYPE_SHUTDOWN",
"PTYPE_CO_CANCEL", "PTYPE_ORPHANED",
"PTYPE_RTS", "" }