FreeRDP
libfreerdp/core/gateway/rpc.c File Reference
#include <winpr/crt.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"

Macros

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

Functions

void rpc_pdu_header_print (rpcconn_hdr_t *header)
 
void rpc_pdu_header_init (rdpRpc *rpc, rpcconn_hdr_t *header)
 
UINT32 rpc_offset_align (UINT32 *offset, UINT32 alignment)
 
UINT32 rpc_offset_pad (UINT32 *offset, UINT32 pad)
 
BOOL rpc_get_stub_data_info (rdpRpc *rpc, BYTE *buffer, UINT32 *offset, UINT32 *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 RpcInChannel * rpc_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)
 
RpcOutChannel * rpc_out_channel_new (rdpRpc *rpc)
 
BOOL rpc_virtual_connection_transition_to_state (rdpRpc *rpc, RpcVirtualConnection *connection, VIRTUAL_CONNECTION_STATE state)
 
static RpcVirtualConnection * rpc_virtual_connection_new (rdpRpc *rpc)
 
static void rpc_virtual_connection_free (RpcVirtualConnection *connection)
 
static BOOL rpc_channel_tls_connect (RpcChannel *channel, int timeout)
 
static int rpc_in_channel_connect (RpcInChannel *inChannel, int 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, int timeout)
 
rdpRpc * rpc_new (rdpTransport *transport)
 
void rpc_free (rdpRpc *rpc)
 

Variables

static const char * PTYPE_STRINGS []
 

Macro Definition Documentation

#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

void rpc_channel_free ( RpcChannel *  channel)

Here is the call graph for this function:

Here is the caller graph for this function:

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:

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:

static BOOL rpc_channel_tls_connect ( RpcChannel *  channel,
int  timeout 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

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:

BOOL rpc_connect ( rdpRpc *  rpc,
int  timeout 
)

Here is the call graph for this function:

Here is the caller graph for this function:

void rpc_free ( rdpRpc *  rpc)

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL rpc_get_stub_data_info ( rdpRpc *  rpc,
BYTE buffer,
UINT32 offset,
UINT32 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:

static int rpc_in_channel_connect ( RpcInChannel *  inChannel,
int  timeout 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

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:

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:

BOOL rpc_in_channel_transition_to_state ( RpcInChannel *  inChannel,
CLIENT_IN_CHANNEL_STATE  state 
)

Here is the caller graph for this function:

rdpRpc* rpc_new ( rdpTransport *  transport)

Here is the call graph for this function:

Here is the caller graph for this function:

UINT32 rpc_offset_align ( UINT32 offset,
UINT32  alignment 
)

Here is the caller graph for this function:

UINT32 rpc_offset_pad ( UINT32 offset,
UINT32  pad 
)

Here is the caller graph for this function:

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:

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:

RpcOutChannel* rpc_out_channel_new ( rdpRpc *  rpc)

Here is the call graph for this function:

Here is the caller graph for this function:

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:

BOOL rpc_out_channel_transition_to_state ( RpcOutChannel *  outChannel,
CLIENT_OUT_CHANNEL_STATE  state 
)

Here is the caller graph for this function:

void rpc_pdu_header_init ( rdpRpc *  rpc,
rpcconn_hdr_t header 
)

Here is the caller graph for this function:

void rpc_pdu_header_print ( rpcconn_hdr_t header)

[MS-RPCH]: Remote Procedure Call over HTTP Protocol Specification: http://msdn.microsoft.com/en-us/library/cc243950/ Connection Establishment
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------—| | |
| | | |

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:

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:

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

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",
""
}